Produced by Araxis Merge on Fri Jun 13 14:30:55 2008 UTC. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Jun 13 14:30:55 2008 UTC | ||
| 2 | C:\devel_jahia\corp_V2TemplatesSP4\src\jsp\box | pollbox.inc | Fri Jun 13 14:30:10 2008 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 499 |
| Removed | 0 | 0 |
| Whitespace | All differences in whitespace within lines are ignored |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | <%@ page i mport="jav a.text.Dec imalFormat " %> | |||||
| 2 | <%-- | |||||
| 3 | Copyright 2002-2006 Jahia Ltd | |||||
| 4 | ||||||
| 5 | Licensed u nder the J AHIA COMMO N DEVELOPM ENT AND DI STRIBUTION LICENSE ( JCDDL), | |||||
| 6 | Version 1. 0 (the "Li cense"), o r (at your option) a ny later v ersion; yo u may | |||||
| 7 | not use th is file ex cept in co mpliance w ith the Li cense. You should ha ve | |||||
| 8 | received a copy of t he License along wit h this pro gram; if n ot, you ma y obtain | |||||
| 9 | a copy of the Licens e at | |||||
| 10 | ||||||
| 11 | http://ww w.jahia.or g/license/ | |||||
| 12 | ||||||
| 13 | Unless req uired by a pplicable law or agr eed to in writing, s oftware | |||||
| 14 | distribute d under th e License is distrib uted on an "AS IS" B ASIS, | |||||
| 15 | WITHOUT WA RRANTIES O R CONDITIO NS OF ANY KIND, eith er express or implie d. | |||||
| 16 | See the Li cense for the specif ic languag e governin g permissi ons and | |||||
| 17 | limitation s under th e License. | |||||
| 18 | --%> | |||||
| 19 | <% | |||||
| 20 | logger.deb ug("Enteri ng box pol l"); | |||||
| 21 | // to get an id for anwsers an d results binded on title of t he pollbox | |||||
| 22 | String pol lboxId=(St ring)pageC ontext.fin dAttribute ("boxtitle "); | |||||
| 23 | String pol lboxQuesti onId="ques tionContai nerList_"+ pollboxId; | |||||
| 24 | String pol lboxAnswer Id="answer ContainerL ist_"+poll boxId; | |||||
| 25 | %> | |||||
| 26 | ||||||
| 27 | <%@ includ e file=".. /poll/decl arations.i nc"%> | |||||
| 28 | ||||||
| 29 | ||||||
| 30 | <content:d eclareCont ainerList name="<%=p ollboxQues tionId%>" title="Lis t of quest ions" | |||||
| 31 | contai nerListTyp e="<%=Jahi aContainer Definition .SINGLE_MA NDATORY_TY PE%>" | |||||
| 32 | > | |||||
| 33 | <content:d eclareCont ainer> | |||||
| 34 | <conte nt:declare Field name ="question " title="Q uestion" t ype="Small Text" | |||||
| 35 | ti tleKey="po ll.questio n" bundleK ey="<%=res BundleID%> "/> | |||||
| 36 | ||||||
| 37 | <conte nt:declare ContainerL ist name=" <%=pollbox AnswerId%> " title="L ist of ans wers"> | |||||
| 38 | <conte nt:declare Container> | |||||
| 39 | <c ontent:dec lareField name="answ er" title= "Answer" t ype="Small Text" | |||||
| 40 | titleKey ="poll.ans wer" bundl eKey="<%=r esBundleID %>"/> | |||||
| 41 | </cont ent:declar eContainer > | |||||
| 42 | </cont ent:declar eContainer List> | |||||
| 43 | ||||||
| 44 | </content: declareCon tainer> | |||||
| 45 | </content: declareCon tainerList > | |||||
| 46 | ||||||
| 47 | <% | |||||
| 48 | JahiaC ontainerLi st questio nContainer List = nul l; | |||||
| 49 | JahiaC ontainer q uestionCon tainer = n ull; | |||||
| 50 | Decima lFormat df = new Dec imalFormat ("###.#"); | |||||
| 51 | ||||||
| 52 | ||||||
| 53 | ||||||
| 54 | JahiaConta inerList p ollPrefCon tainerList = jData.c ontainers( ).getConta inerList( "pollbox" + id ); | |||||
| 55 | String err orMsgIfNoV alue = get ResourceBu ndle("poll .chooseAVa lue","Plea se choose a value",j Data); | |||||
| 56 | String err orMsgIfalr eadyPosted = getReso urceBundle ("poll.alr eadyPosted At","Sorry , but you have alrea dy posted this poll" ,jData); | |||||
| 57 | String suc cessMessag e = getRes ourceBundl e("poll.su ccessMsg", "Thanks fo r your par ticipation ",jData); | |||||
| 58 | logger.deb ug(errorMs gIfNoValue +" "+error MsgIfalrea dyPosted); | |||||
| 59 | ContainerB ean pollPr efContaine rBean = nu ll; | |||||
| 60 | ||||||
| 61 | if (pollPr efContaine rList != n ull) { | |||||
| 62 | Enumer ation poll PrefContai nerEnum = pollPrefCo ntainerLis t.getConta iners(); | |||||
| 63 | while (pollPrefC ontainerEn um.hasMore Elements() ) { | |||||
| 64 | Ja hiaContain er pollPre fContainer = (JahiaC ontainer) pollPrefCo ntainerEnu m.nextElem ent(); | |||||
| 65 | po llPrefCont ainerBean = new Cont ainerBean( pollPrefCo ntainer,jP arams); | |||||
| 66 | // prefs mes sages | |||||
| 67 | er rorMsgIfNo Value = po llPrefCont ainer.getF ieldValue( "errorMsgI fNoValue", ""); | |||||
| 68 | erro rMsgIfalre adyPosted = pollPref Container. getFieldVa lue("error MsgIfalrea dyPosted", ""); | |||||
| 69 | su ccessMessa ge = pollP refContain er.getFiel dValue("su ccesMessag e",""); | |||||
| 70 | ||||||
| 71 | if ("<empty> ".equals(e rrorMsgIfN oValue)||" ".equals(e rrorMsgIfN oValue)) { | |||||
| 72 | errorMsg IfNoValue = getResou rceBundle( "poll.choo seAValue", "Please ch oose a val ue",jData) ; | |||||
| 73 | } | |||||
| 74 | ||||||
| 75 | if ("<empty> ".equals(e rrorMsgIfa lreadyPost ed)||"".eq uals(error MsgIfalrea dyPosted)) { | |||||
| 76 | errorMsg IfalreadyP osted = ge tResourceB undle("pol l.alreadyP ostedAt"," Sorry, but you have already po sted this poll",jDat a); | |||||
| 77 | } | |||||
| 78 | if ( "<empty>". equals(suc cessMessag e)||"".equ als(succes sMessage)) { | |||||
| 79 | successM essage = g etResource Bundle("po ll.success Msg","Than ks for you r particip ation",jDa ta); | |||||
| 80 | } | |||||
| 81 | } | |||||
| 82 | } | |||||
| 83 | logger.deb ug("defaul t messages :"+errorMs gIfNoValue +" "+error MsgIfalrea dyPosted+" "+success Message); | |||||
| 84 | String sen dForm = re quest.getP arameter(" sendForm") ; | |||||
| 85 | String pol lboxAnswer edId=reque st.getPara meter("pol lboxid"); | |||||
| 86 | if (sendFo rm != null && pollbo xAnsweredI d!=null && pollboxAn sweredId.e quals(poll boxId)) { | |||||
| 87 | // pro cess form | |||||
| 88 | logger .debug("pr ocessing f orm for po llbox "+po llboxId); | |||||
| 89 | ||||||
| 90 | questionCo ntainerLis t = jData. containers ().getCont ainerList( pollboxQu estionId ) ; | |||||
| 91 | if (questi onContaine rList != n ull) { | |||||
| 92 | Enumer ation post edQuestion sEnum = qu estionCont ainerList. getContain ers(); | |||||
| 93 | ||||||
| 94 | while (postedQue stionsEnum .hasMoreEl ements()) { | |||||
| 95 | qu estionCont ainer = (J ahiaContai ner) poste dQuestions Enum.nextE lement(); | |||||
| 96 | St ring poste dValue = r equest.get Parameter( "answer_" + question Container. getID()); | |||||
| 97 | lo ng votedTi me = getVo tedTime(jD ata,questi onContaine r.getID()) ; | |||||
| 98 | if (postedVa lue == nul l) { | |||||
| 99 | if (vote dTime == - 1) { | |||||
| 100 | %> | |||||
| 101 | <spa n style="c olor:red;" > | |||||
| 102 | <%=errorMs gIfNoValue %> | |||||
| 103 | </sp an><br/> | |||||
| 104 | ||||||
| 105 | ||||||
| 106 | <% | |||||
| 107 | // form.i nc | |||||
| 108 | if (hasWri teAccess & & isEditMo de) { | |||||
| 109 | %> | |||||
| 110 | <div s tyle="back ground-col or:#e9e9e9 ;border:1p x solid #6 66666;padd ing:5px;"> | |||||
| 111 | <h2><% =getResour ceBundle(" poll.prefe rences","P references ",jData)%> | |||||
| 112 | <% | |||||
| 113 | if (po llPrefCont ainerBean != null) { | |||||
| 114 | jD ata.gui(). html().dra wBeginActi onMenu(pol lPrefConta inerBean, null, null , false, " ", "jahiat emplates.C orporate_p ortal_temp lates_v2", null, out ); | |||||
| 115 | } | |||||
| 116 | %></h2 > | |||||
| 117 | <stron g><%=getRe sourceBund le("poll.e rrorMsgIfN oValue","E rror text if no valu e",jData)% >: </stron g> <%=erro rMsgIfNoVa lue%><br/> | |||||
| 118 | <stron g><%=getRe sourceBund le("poll.e rrorMsgIfa lreadyPost ed","Error message i f already answered", jData)%>: </strong> <%=errorMs gIfalready Posted%><b r/> | |||||
| 119 | <stron g><%=getRe sourceBund le("poll.s uccesMsg", "Message t hanks in c ase of suc cessful an swering",j Data)%>: < /strong> < %=successM essage%><b r/> | |||||
| 120 | <%=get ResourceBu ndle("poll .updatePre fsMsg","Pl ease updat e the pref erences of your poll ",jData)%> <br/> | |||||
| 121 | </div> | |||||
| 122 | <% | |||||
| 123 | } | |||||
| 124 | ||||||
| 125 | //question ContainerL ist = jDat a.containe rs().getCo ntainerLis t( "questi onContaine rList" ); | |||||
| 126 | //Containe rListBean questionCo ntainerLis tBean = ne w Containe rListBean( questionCo ntainerLis t,jParams) ; | |||||
| 127 | String lab elquestion = getReso urceBundle ("poll.typ eYourQuest ionHere"," Type your question h ere",jData ); | |||||
| 128 | String que stion=""; | |||||
| 129 | boolean is QuestionEm pty = true ; | |||||
| 130 | boolean ha veAnswers= false; | |||||
| 131 | ||||||
| 132 | Enumer ation ques tionsEnum = question ContainerL ist.getCon tainers(); | |||||
| 133 | while (questions Enum.hasMo reElements ()) { | |||||
| 134 | is QuestionEm pty = fals e; | |||||
| 135 | qu estionCont ainer = (J ahiaContai ner) quest ionsEnum.n extElement (); | |||||
| 136 | Co ntainerBea n question ContainerB ean = new ContainerB ean(questi onContaine r,jParams) ; | |||||
| 137 | qu estion = q uestionCon tainer.get FieldValue ("question ",""); | |||||
| 138 | ||||||
| 139 | if ("".equal s(question ) || "<emp ty>".equal s(question )) { | |||||
| 140 | isQu estionEmpt y = true; | |||||
| 141 | } else { | |||||
| 142 | isQu estionEmpt y = false; | |||||
| 143 | } | |||||
| 144 | %> | |||||
| 145 | <f orm method ="post" ac tion="<%=b ypassUrl%> " | |||||
| 146 | name ="submitTo ContainerL ist" id="f orm_<%=que stionConta iner.getID ()%>"> | |||||
| 147 | <i nput type= "hidden" n ame="formI d" value=" <%=questio nContainer .getID()%> "/> | |||||
| 148 | <i nput type= "hidden" n ame="sendF orm" value ="true"/> | |||||
| 149 | <h 2> | |||||
| 150 | <% | |||||
| 151 | //logger .debug(isE ditMode+" "+isQuesti onEmpty+ " q:"+quest ion); | |||||
| 152 | if(isEdi tMode && i sQuestionE mpty){ | |||||
| 153 | %><%=lab elquestion %> | |||||
| 154 | <% } els e if(!isQu estionEmpt y){ | |||||
| 155 | %><%=que stion%> | |||||
| 156 | <% | |||||
| 157 | } | |||||
| 158 | if (isEd itMode) { | |||||
| 159 | jData.g ui().html( ).drawBegi nActionMen u(question ContainerB ean, null, null, fal se, "", "j ahiatempla tes.Corpor ate_portal _templates _v2", null , out); | |||||
| 160 | } | |||||
| 161 | %> | |||||
| 162 | </ h2> | |||||
| 163 | <% | |||||
| 164 | if (!isQuest ionEmpty) { | |||||
| 165 | JahiaCon tainerList answerCon tainerList = questio nContainer .getContai nerList( p ollboxAnsw erId ); | |||||
| 166 | if (answ erContaine rList != n ull) { | |||||
| 167 | Cont ainerListB ean answer ContainerL istBean = new Contai nerListBea n(answerCo ntainerLis t,jParams) ; | |||||
| 168 | logg er.debug(" answerCont ainerList has " + an swerContai nerList.ge tFullSize( ) + " elem ents"); | |||||
| 169 | ||||||
| 170 | if ( isEditMode ) { | |||||
| 171 | ||||||
| 172 | if(a nswerConta inerList.g etFullSize ()<3){ | |||||
| 173 | out.pr int(getRes ourceBundl e("poll.ad dresponses ","Add you r answers" ,jData)); | |||||
| 174 | haveAnswer s=false; | |||||
| 175 | } | |||||
| 176 | jData.gui( ).html().d rawBeginAc tionMenu(a nswerConta inerListBe an, | |||||
| 177 | null, null, true , "", | |||||
| 178 | "jahia templates. Corporate_ portal_tem plates_v2" , null, ou t); | |||||
| 179 | ||||||
| 180 | } | |||||
| 181 | Enum eration an swersEnum = answerCo ntainerLis t.getConta iners(); | |||||
| 182 | whil e (answers Enum.hasMo reElements ()) { | |||||
| 183 | ||||||
| 184 | JahiaConta iner answe rContainer = (JahiaC ontainer) answersEnu m.nextElem ent(); | |||||
| 185 | ContainerB ean answer ContainerB ean = new ContainerB ean(answer Container, jParams); | |||||
| 186 | String ans wer = answ erContaine r.getField Value("ans wer",""); | |||||
| 187 | haveAnswer s=true; | |||||
| 188 | %> | |||||
| 189 | <label> | |||||
| 190 | <input name="ans wer_<%=que stionConta iner.getID ()%>" type ="radio" | |||||
| 191 | va lue="<%=an swerContai ner.getID( )%>" /> <% =answer%> | |||||
| 192 | </label> | |||||
| 193 | <% | |||||
| 194 | if (isEdit Mode) { | |||||
| 195 | jData. gui().html ().drawBeg inActionMe nu(answerC ontainerBe an, | |||||
| 196 | nu ll, null, false, "", | |||||
| 197 | "j ahiatempla tes.Corpor ate_portal _templates _v2", null , out); | |||||
| 198 | } | |||||
| 199 | %> | |||||
| 200 | <br/> | |||||
| 201 | <% | |||||
| 202 | } | |||||
| 203 | if ( isEditMode ) { | |||||
| 204 | jData.gui( ).html().d rawEndActi onMenu(ans werContain erListBean , | |||||
| 205 | null, null, true , "", | |||||
| 206 | "jahia templates. Corporate_ portal_tem plates_v2" , null, ou t); | |||||
| 207 | } | |||||
| 208 | } else { | |||||
| 209 | logg er.debug(" answerCont ainerList is NULL"); | |||||
| 210 | } | |||||
| 211 | %> | |||||
| 212 | <br/> | |||||
| 213 | <% | |||||
| 214 | if(haveA nswers && answerCont ainerList. getFullSiz e()>=2){ | |||||
| 215 | %> | |||||
| 216 | ||||||
| 217 | <input t ype="submi t" name="s ubmit_<%=q uestionCon tainer.get ID()%>" va lue='<cont ent:resour ceBundle | |||||
| 218 | reso urceBundle ="jahiatem plates.Cor porate_por tal_templa tes_v2" | |||||
| 219 | reso urceName=" poll.submi t"/>'/> | |||||
| 220 | <% | |||||
| 221 | } | |||||
| 222 | } | |||||
| 223 | %> | |||||
| 224 | </ form> | |||||
| 225 | <% | |||||
| 226 | } | |||||
| 227 | ||||||
| 228 | %> | |||||
| 229 | ||||||
| 230 | ||||||
| 231 | ||||||
| 232 | ||||||
| 233 | ||||||
| 234 | ||||||
| 235 | ||||||
| 236 | ||||||
| 237 | ||||||
| 238 | ||||||
| 239 | ||||||
| 240 | ||||||
| 241 | <% | |||||
| 242 | } else { | |||||
| 243 | Simp leDateForm at sdf = n ew SimpleD ateFormat( "dd/MM/yy kk:mm" ); | |||||
| 244 | sdf. setTimeZon e(TimeZone .getTimeZo ne("UTC")) ; | |||||
| 245 | %> | |||||
| 246 | <spa n style="c olor:red;" > | |||||
| 247 | <%=errorMs gIfalready Posted%> < !--<%=sdf. format( (n ew Date(vo tedTime)) )%>--> | |||||
| 248 | </sp an> | |||||
| 249 | <% | |||||
| 250 | } | |||||
| 251 | } else { | |||||
| 252 | logger.d ebug("Valu e for ques tion [" + questionCo ntainer.ge tID() + "] is [" + p ostedValue + "]"); | |||||
| 253 | if (vote dTime != - 1) { | |||||
| 254 | Simp leDateForm at sdf = n ew SimpleD ateFormat( "dd/MM/yy kk:mm" ); | |||||
| 255 | sdf. setTimeZon e(TimeZone .getTimeZo ne("UTC")) ; | |||||
| 256 | %> | |||||
| 257 | <spa n style="c olor:red;" > | |||||
| 258 | <%=errorMs gIfalready Posted%> < !--<%=sdf. format( (n ew Date(vo tedTime)) )%>--> | |||||
| 259 | </sp an> | |||||
| 260 | <% | |||||
| 261 | } else { | |||||
| 262 | // ok all is fine | |||||
| 263 | save Poll(jData ,questionC ontainer.g etID(),pos tedValue); | |||||
| 264 | %> | |||||
| 265 | <span> | |||||
| 266 | <%=suc cessMessag e%> | |||||
| 267 | </span> | |||||
| 268 | <% | |||||
| 269 | } | |||||
| 270 | ||||||
| 271 | // results | |||||
| 272 | ||||||
| 273 | ||||||
| 274 | float tota lAnswerCou nt = 0; | |||||
| 275 | ||||||
| 276 | Enumer ation ques tionsEnum = question ContainerL ist.getCon tainers(); | |||||
| 277 | while (questions Enum.hasMo reElements ()) { | |||||
| 278 | qu estionCont ainer = (J ahiaContai ner) quest ionsEnum.n extElement (); | |||||
| 279 | St ring quest ion = ques tionContai ner.getFie ldValue("q uestion"," "); | |||||
| 280 | %> | |||||
| 281 | <h 2><%=quest ion%></h2> | |||||
| 282 | <% | |||||
| 283 | Ja hiaContain erList ans werContain erList = q uestionCon tainer.get ContainerL ist( pollb oxAnswerId ); | |||||
| 284 | ||||||
| 285 | Ar rayList an swerKeys = new Arra yList(); | |||||
| 286 | Ha shtable an swerKeysTo ValueKey = new Hasht able(); | |||||
| 287 | Ha shtable an swerKeysTo Answer = n ew Hashtab le(); | |||||
| 288 | ||||||
| 289 | if (answerCo ntainerLis t != null) { | |||||
| 290 | ||||||
| 291 | Enumerat ion answer sEnum = an swerContai nerList.ge tContainer s(); | |||||
| 292 | while (a nswersEnum .hasMoreEl ements()) { | |||||
| 293 | Jahi aContainer answerCon tainer = ( JahiaConta iner) answ ersEnum.ne xtElement( ); | |||||
| 294 | Stri ng answer = answerCo ntainer.ge tFieldValu e("answer" ,""); | |||||
| 295 | Stri ng valueKe y = questi onContaine r.getID() + "_" + an swerContai ner.getID( ); | |||||
| 296 | //lo gger.debug ("Result - get answe rs for key [" + valu eKey + "]" ); | |||||
| 297 | floa t answerCo unt = 0; | |||||
| 298 | Stri ng answerC ountStr = contentPag e.getPrope rty(valueK ey); | |||||
| 299 | if ( answerCoun tStr != nu ll) { | |||||
| 300 | try { | |||||
| 301 | answer Count = Fl oat.parseF loat(answe rCountStr) ; | |||||
| 302 | totalA nswerCount += answer Count; | |||||
| 303 | } catch (N umberForma tException nfe) { | |||||
| 304 | } | |||||
| 305 | } | |||||
| 306 | // f ollowing k ey will be user to s ort the re sults | |||||
| 307 | Stri ng answerK ey = "0000 0000000000 000000" + answerCoun t + "_" + answerCont ainer.getR ank() + "_ " + valueK ey; | |||||
| 308 | //lo gger.debug ("Generate answerKey : " + answ erKey); | |||||
| 309 | answ erKey = an swerKey.su bstring(an swerKey.le ngth()-16, answerKey. length()); | |||||
| 310 | answ erKeys.add (answerKey ); | |||||
| 311 | answ erKeysToVa lueKey.put (answerKey ,valueKey) ; | |||||
| 312 | answ erKeysToAn swer.put(a nswerKey,a nswer); | |||||
| 313 | } | |||||
| 314 | Collecti ons.sort(a nswerKeys, new Compar ator() { | |||||
| 315 | publ ic int com pare(Objec t o1, Obje ct o2) { | |||||
| 316 | String str 1 = (Strin g) o1; | |||||
| 317 | String str 2 = (Strin g) o2; | |||||
| 318 | return str 2.compareT o(str1); | |||||
| 319 | } | |||||
| 320 | }); | |||||
| 321 | ||||||
| 322 | %> | |||||
| 323 | <table> | |||||
| 324 | <% | |||||
| 325 | for (int i = 0; i < answerKe ys.size(); i++) { | |||||
| 326 | Stri ng answerK ey = (Stri ng) answer Keys.get(i ); | |||||
| 327 | Stri ng answer = (String) answerKeys ToAnswer.g et(answerK ey); | |||||
| 328 | Stri ng valueKe y = (Strin g)answerKe ysToValueK ey.get(ans werKey); | |||||
| 329 | logg er.debug(" Result - g et answers for key [ " + valueK ey + "]"); | |||||
| 330 | floa t answerCo unt = 0; | |||||
| 331 | Stri ng answerC ountStr = contentPag e.getPrope rty(valueK ey); | |||||
| 332 | if ( answerCoun tStr != nu ll) { | |||||
| 333 | try { | |||||
| 334 | answer Count = Fl oat.parseF loat(answe rCountStr) ; | |||||
| 335 | } catch (N umberForma tException nfe) { | |||||
| 336 | } | |||||
| 337 | } | |||||
| 338 | floa t percent = (answerC ount / tot alAnswerCo unt) * 100 ; | |||||
| 339 | int percentInt = (new Fl oat(percen t)).intVal ue(); | |||||
| 340 | %> | |||||
| 341 | <tr> | |||||
| 342 | <td> <%=answer% ></td> | |||||
| 343 | <td> | |||||
| 344 | <div class="gr aph"> | |||||
| 345 | <strong <% | |||||
| 346 | if (an swerCount != 0) { | |||||
| 347 | %> class="ba r" style=" width: <%= percentInt %>%;"<% | |||||
| 348 | } | |||||
| 349 | %>> | |||||
| 350 | <%=df. format(per cent)%>% | |||||
| 351 | </strong> | |||||
| 352 | </di v> | |||||
| 353 | </td > | |||||
| 354 | </tr > | |||||
| 355 | <% | |||||
| 356 | } | |||||
| 357 | ||||||
| 358 | %> | |||||
| 359 | <tr><td> </td><td>< strong><br /> | |||||
| 360 | <content :resourceB undle | |||||
| 361 | reso urceBundle ="jahiatem plates.Cor porate_por tal_templa tes_v2" | |||||
| 362 | reso urceName=" poll.total Aanswers"/ >: <%=(new Float(tot alAnswerCo unt)).intV alue()%></ strong></t d></tr> | |||||
| 363 | </table> | |||||
| 364 | <% | |||||
| 365 | } | |||||
| 366 | } | |||||
| 367 | ||||||
| 368 | ||||||
| 369 | } | |||||
| 370 | } | |||||
| 371 | } | |||||
| 372 | %> | |||||
| 373 | <% | |||||
| 374 | } else { | |||||
| 375 | // to sen d the form with ques tions answ ered | |||||
| 376 | ||||||
| 377 | if (hasWri teAccess & & isEditMo de) { | |||||
| 378 | %> | |||||
| 379 | <div s tyle="back ground-col or:#e9e9e9 ;border:1p x solid #6 66666;padd ing:5px;"> | |||||
| 380 | <h2><% =getResour ceBundle(" poll.prefe rences","P references ",jData)%> | |||||
| 381 | <% | |||||
| 382 | if (po llPrefCont ainerBean != null) { | |||||
| 383 | jD ata.gui(). html().dra wBeginActi onMenu(pol lPrefConta inerBean, null, null , false, " ", "jahiat emplates.C orporate_p ortal_temp lates_v2", null, out ); | |||||
| 384 | } | |||||
| 385 | %></h2 > | |||||
| 386 | <stron g><%=getRe sourceBund le("poll.e rrorMsgIfN oValue","E rror text if no valu e",jData)% >: </stron g> <%=erro rMsgIfNoVa lue%><br/> | |||||
| 387 | <stron g><%=getRe sourceBund le("poll.e rrorMsgIfa lreadyPost ed","Error message i f already answered", jData)%>: </strong> <%=errorMs gIfalready Posted%><b r/> | |||||
| 388 | <stron g><%=getRe sourceBund le("poll.s uccesMsg", "Message t hanks in c ase of suc cessful an swering",j Data)%>: < /strong> < %=successM essage%><b r/> | |||||
| 389 | <%=get ResourceBu ndle("poll .updatePre fsMsg","Pl ease updat e the pref erences of your poll ",jData)%> <br/> | |||||
| 390 | </div> | |||||
| 391 | <% | |||||
| 392 | } | |||||
| 393 | ||||||
| 394 | questionCo ntainerLis t = jData. containers ().getCont ainerList( pollboxQu estionId ) ; | |||||
| 395 | //Containe rListBean questionCo ntainerLis tBean = ne w Containe rListBean( questionCo ntainerLis t,jParams) ; | |||||
| 396 | String lab elquestion = getReso urceBundle ("poll.typ eYourQuest ionHere"," Type your question h ere",jData ); | |||||
| 397 | String que stion=""; | |||||
| 398 | boolean is QuestionEm pty = true ; | |||||
| 399 | boolean ha veAnswers= false; | |||||
| 400 | if (questi onContaine rList != n ull) { | |||||
| 401 | Enumer ation ques tionsEnum = question ContainerL ist.getCon tainers(); | |||||
| 402 | while (questions Enum.hasMo reElements ()) { | |||||
| 403 | is QuestionEm pty = fals e; | |||||
| 404 | qu estionCont ainer = (J ahiaContai ner) quest ionsEnum.n extElement (); | |||||
| 405 | Co ntainerBea n question ContainerB ean = new ContainerB ean(questi onContaine r,jParams) ; | |||||
| 406 | qu estion = q uestionCon tainer.get FieldValue ("question ",""); | |||||
| 407 | ||||||
| 408 | if ("".equal s(question ) || "<emp ty>".equal s(question )) { | |||||
| 409 | isQu estionEmpt y = true; | |||||
| 410 | } else { | |||||
| 411 | isQu estionEmpt y = false; | |||||
| 412 | } | |||||
| 413 | %> | |||||
| 414 | <f orm method ="get" act ion="<%=by passUrl%>" | |||||
| 415 | name ="submitTo ContainerL ist" id="f orm_<%=que stionConta iner.getID ()%>"> | |||||
| 416 | <i nput type= "hidden" n ame="formI d" value=" <%=questio nContainer .getID()%> "/> | |||||
| 417 | <i nput type= "hidden" n ame="sendF orm" value ="true"/> | |||||
| 418 | <i nput type= "hidden" n ame="pollb oxid" valu e="<%=poll boxId%>"/> | |||||
| 419 | <h 2> | |||||
| 420 | <% | |||||
| 421 | //logger .debug(isE ditMode+" "+isQuesti onEmpty+ " q:"+quest ion); | |||||
| 422 | if(isEdi tMode && i sQuestionE mpty){ | |||||
| 423 | %><%=lab elquestion %> | |||||
| 424 | <% } els e if(!isQu estionEmpt y){ | |||||
| 425 | %><%=que stion%> | |||||
| 426 | <% | |||||
| 427 | } | |||||
| 428 | if (isEd itMode) { | |||||
| 429 | jData.g ui().html( ).drawBegi nActionMen u(question ContainerB ean, null, null, fal se, "", "j ahiatempla tes.Corpor ate_portal _templates _v2", null , out); | |||||
| 430 | } | |||||
| 431 | %> | |||||
| 432 | </ h2> | |||||
| 433 | <% | |||||
| 434 | if (!isQuest ionEmpty) { | |||||
| 435 | JahiaCon tainerList answerCon tainerList = questio nContainer .getContai nerList( p ollboxAnsw erId ); | |||||
| 436 | if (answ erContaine rList != n ull) { | |||||
| 437 | Cont ainerListB ean answer ContainerL istBean = new Contai nerListBea n(answerCo ntainerLis t,jParams) ; | |||||
| 438 | logg er.debug(" answerCont ainerList has " + an swerContai nerList.ge tFullSize( ) + " elem ents"); | |||||
| 439 | ||||||
| 440 | if ( isEditMode ) { | |||||
| 441 | ||||||
| 442 | if(a nswerConta inerList.g etFullSize ()<3){ | |||||
| 443 | out.pr int(getRes ourceBundl e("poll.ad dresponses ","Add you r answers" ,jData)); | |||||
| 444 | haveAnswer s=false; | |||||
| 445 | } | |||||
| 446 | jData.gui( ).html().d rawBeginAc tionMenu(a nswerConta inerListBe an, | |||||
| 447 | null, null, true , "", | |||||
| 448 | "jahia templates. Corporate_ portal_tem plates_v2" , null, ou t); | |||||
| 449 | ||||||
| 450 | } | |||||
| 451 | Enum eration an swersEnum = answerCo ntainerLis t.getConta iners(); | |||||
| 452 | whil e (answers Enum.hasMo reElements ()) { | |||||
| 453 | ||||||
| 454 | JahiaConta iner answe rContainer = (JahiaC ontainer) answersEnu m.nextElem ent(); | |||||
| 455 | ContainerB ean answer ContainerB ean = new ContainerB ean(answer Container, jParams); | |||||
| 456 | String ans wer = answ erContaine r.getField Value("ans wer",""); | |||||
| 457 | haveAnswer s=true; | |||||
| 458 | %> | |||||
| 459 | <label> | |||||
| 460 | <input name="ans wer_<%=que stionConta iner.getID ()%>" type ="radio" | |||||
| 461 | va lue="<%=an swerContai ner.getID( )%>" /> <% =answer%> | |||||
| 462 | </label> | |||||
| 463 | <% | |||||
| 464 | if (isEdit Mode) { | |||||
| 465 | jData. gui().html ().drawBeg inActionMe nu(answerC ontainerBe an, | |||||
| 466 | nu ll, null, false, "", | |||||
| 467 | "j ahiatempla tes.Corpor ate_portal _templates _v2", null , out); | |||||
| 468 | } | |||||
| 469 | %> | |||||
| 470 | <br/> | |||||
| 471 | <% | |||||
| 472 | } | |||||
| 473 | if ( isEditMode ) { | |||||
| 474 | jData.gui( ).html().d rawEndActi onMenu(ans werContain erListBean , | |||||
| 475 | null, null, true , "", | |||||
| 476 | "jahia templates. Corporate_ portal_tem plates_v2" , null, ou t); | |||||
| 477 | } | |||||
| 478 | } else { | |||||
| 479 | logg er.debug(" answerCont ainerList is NULL"); | |||||
| 480 | } | |||||
| 481 | %> | |||||
| 482 | <br/> | |||||
| 483 | <% | |||||
| 484 | if(haveA nswers && answerCont ainerList. getFullSiz e()>=2){ | |||||
| 485 | %> | |||||
| 486 | <input t ype="submi t" name="s ubmit_<%=q uestionCon tainer.get ID()%>" va lue='<cont ent:resour ceBundle | |||||
| 487 | reso urceBundle ="jahiatem plates.Cor porate_por tal_templa tes_v2" | |||||
| 488 | reso urceName=" poll.submi t"/>'/> | |||||
| 489 | <% | |||||
| 490 | } | |||||
| 491 | } | |||||
| 492 | %> | |||||
| 493 | </ form> | |||||
| 494 | <% | |||||
| 495 | } | |||||
| 496 | } | |||||
| 497 | ||||||
| 498 | } | |||||
| 499 | %> |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2007 Araxis Ltd (www.araxis.com). All rights reserved.