Interoperable interactive geometry for Europe
I forgot my login data
Register


Report a bug


Fan club

Quick Intro Videos
click to start movie
Create A Simple
GeoGebra Resource (25Mb)
click to start movie
Filing a review
click to start movie
Find a Resource

SPONSORS
This platform is brought to you by the intergeo project, funded under the eContent Plus programme of the European commission and by partners

import org.curriki.xwiki.plugin.asset.Asset import com.xpn.xwiki.api.Document import com.xpn.xwiki.web.XWikiMessageTool

/** Set of utilities to render a review. */ public class ReviewToolGroovy {

String assetName = null; Asset asset = null; Document reviewDoc = null; com.xpn.xwiki.api.Object reviewObj = null; XWikiMessageTool msg; StringWriter stringOut = new StringWriter(); PrintWriter out = new PrintWriter(stringOut); private boolean inForm = true;

public void setAsset(Asset a) { asset = a; assetName = a.fullName; }

public void setReviewDoc(Document doc) { reviewDoc = doc; System.out.println("Review doc "" + doc + ""."); reviewObj = doc.getObject("QF.ReviewClass"); if(reviewObj==null) { reviewObj = doc.newObject("QF.ReviewClass"); System.out.println("Review Object created."); } else System.out.println("Review Object found."); }

public void setMsg(XWikiMessageTool m) { msg = m; }

public void print(String s) { this.out.print(s); } public void println(String s) { this.out.println(s); }

public void renderRating(String propName, String sectionName) { String objValue = ""+reviewObj?.getProperty(propName)?.value?.toString(); if(!inForm){

if(objValue=="1"){ out.print(""); out.print("");

}else{ if(objValue=="2"){ out.print(""); out.print("");

}else{ if(objValue=="3"){ out.print(""); out.print("");

}else{ if(objValue=="4"){ out.print(""); out.print(""); }else{ out.print(""); out.print(""); } } } }

}else{ out.print(""); for(value in 1..4) { //out.print(""); String valueS = ""+value; out.print(" if(objValue.equals(valueS)) out.print("checked="checked" "); out.print("title=""); out.print(msg.get("QF.ratingHint" + valueS)); out.print("" ") out.print("/>");

} out.print("") out.print("") if(objValue=="") out.print(""); else out.print(""); out.println(""); } }

public List listSectionNames() { return Arrays.asList(msg.get("QF.qs").split(",| ")); }

public List listQuestionNames(String sectionName) { return Arrays.asList(msg.get("QF.qs_"+sectionName).split(',| ')) }

void setAction(String actionName) { if('view'.equals(actionName)) inForm = false; else if('edit'.equals(actionName) || 'inline'.equals(actionName)) inForm = true; else { System.out.println("Bizarre action name "" + actionName + "", defaulting to view"); inForm = false; } }

public void renderQuestion(String qName, String sectionName, boolean expanded) { out.println(""); char propNamePrefix = 'i'; if(sectionName!=null) propNamePrefix = 'q'; out.println(''); // none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; out.print('");

// if(sectionName!=null) { out.print(' '); // onclick="toggleFold('questions_'+qName+'',this)"> } else { out.print('  
'); } out.println(''); renderRating(qName, sectionName); out.println(''); out.println(''); out.print(msg.get("QF."+propNamePrefix+"tx_" + qName)); out.println(''); out.println(''); out.println(""); }

public String renderReviewSections(String sec) { stringOut.getBuffer().delete(0,stringOut.getBuffer().length()); if(sec==null || sec.length()==0) return ""; out.println("") out.println('

'); return stringOut.toString(); }

public void close() { stringOut = null; out = null; }

String escapeForXml(String v) { StringBuffer b = new StringBuffer(v.length()); for(char c in v) { if(c=='&') b.append('&'); else if (c==''') b.append(''') else if (c=='"') b.append(""") else if (c=='<') b.append("<"); else if (c=='>') b.append(">"); else b.append(c); } return b.toString(); }

String renderJSassignmentSectionHeadNames() { StringBuffer buff = new StringBuffer(); buff.append(""); return buff.toString(); } }