;ò ,!tDc@s¿dkZdkZdklZdkZdeeiieiieiifd„ƒYZ deeiieiieiifd„ƒYZ deeiieiifd„ƒYZ d„Z dS( N(s PersistentsOntoElecBs½tZdZgZdZdZdZeiƒZ e i ƒd„Z d„Z dd„Z d„Zd„Zd „Zd „Zd „Zd „Zd „Zd„Zd„Zd„Zd„ZRS(s Main classis OntoEle_procCs$|id7_dt|iƒSdS(sfor creating question objectsisqN(sselfsqnrsstr(sself((s#d:\zope\Products\ontoele\OntoEle.pysgetNewQuestionIDscCs9|it|dƒt|ddƒƒ|iidƒdS(sAdding questionsqtextsqlinkssmainpageN(sselfscreateNewQuestionsgetattrsREQUESTsRESPONSEsredirect(sselfsREQUEST((s#d:\zope\Products\ontoele\OntoEle.pysquestion_add_form_handlers%scCs<t||ƒ}|iƒ|_|i|i|ƒ|iSdS(screateN(s OntoQuestionstextslinksqsselfsgetNewQuestionIDsids _setObject(sselfstextslinksq((s#d:\zope\Products\ontoele\OntoEle.pyscreateNewQuestions cCslxU|iƒD]G}t||itƒ}|o%|i||i|d|dƒq q W|i i dƒdS(sAdding answersiismainpageN( sselfs getQuestionssqsgetattrsREQUESTsidsNonesqassaveQuestionAnswersRESPONSEsredirect(sselfsREQUESTsqasq((s#d:\zope\Products\ontoele\OntoEle.pysanswer_add_form_handler$s )cCs¤t|iƒ}||ijo |ii|ƒ|i|_nt||ƒ}t ||ƒo|i |ƒnt t |ƒ|ƒ}||_|i|i|ƒdS(s Save answerN(sstrsREQUESTsAUTHENTICATED_USERsunamesselfs usernamessappendsgetattrsqidsqshasattrs _delObjects OntoAnswersfloatsvaluestextsasids _setObject(sselfsREQUESTsqidsvaluestextsasqsuname((s#d:\zope\Products\ontoele\OntoEle.pyssaveQuestionAnswer,s cCs|idƒSdS(sQuestion objects arrays OntoQuestionN(sselfs objectValues(sself((s#d:\zope\Products\ontoele\OntoEle.pys getQuestions8scCs |iSdS(slogged usernames listN(sselfs usernames(sself((s#d:\zope\Products\ontoele\OntoEle.pys getUserNames<scCs |iSdS(sgetterN(sselfsdefaultAnswerValue(sself((s#d:\zope\Products\ontoele\OntoEle.pysgetDefaultAnswerValue@scCsZd}t||ƒ}x'|iD]}||id|ƒ7}qWt|ƒt |iƒSdS(sarithmetical averageisusernameN( sssgetattrsselfsqidsqs usernamessunamesgetUserAnswerValuesfloatslen(sselfsqidsqsunamess((s#d:\zope\Products\ontoele\OntoEle.pysgetQuestionAverageValueDs cCsT|i|iƒ|i|iƒ}|djodSn|djodSndSdS(scompares by average valueiiÿÿÿÿiN(sselfsgetQuestionAverageValuesq2sidsq1sd(sselfsq1sq2sd((s#d:\zope\Products\ontoele\OntoEle.pysquestionCompareLs"  cCs$|iƒ}|i|iƒ|SdS(sSorted by average valueN(sselfs getQuestionssqsssortsquestionCompare(sselfsqs((s#d:\zope\Products\ontoele\OntoEle.pysgetSortedQuestionsSs cCsGg}x6|iƒD](}|i|ƒ o|i|ƒqqW|SdS(s6list of questions, which current user not answered yetN(stsselfs getQuestionssqsisAnsweredByCurrentUsersREQUESTsappend(sselfsREQUESTsqst((s#d:\zope\Products\ontoele\OntoEle.pysgetUnansweredQuestionListYs cCsFg}x5|iƒD]'}|i|ƒo|i|ƒqqW|SdS(s6list of questions, which current user not answered yetN(stsselfsgetSortedQuestionssqsisAnsweredByCurrentUsersREQUESTsappend(sselfsREQUESTsqst((s#d:\zope\Products\ontoele\OntoEle.pysgetAnsweredQuestionListas cCsdSdS(sPlace where Wiki startss!http://localhost:8080/muu/zwiki1/N((sself((s#d:\zope\Products\ontoele\OntoEle.pysgetWikiMainURLis(s__name__s __module__s__doc__s usernamessdefaultAnswerValuesqnrs meta_types AccessControlsClassSecurityInfossecuritysdeclareObjectPublicsgetNewQuestionIDsquestion_add_form_handlerscreateNewQuestionsanswer_add_form_handlerssaveQuestionAnswers getQuestionss getUserNamessgetDefaultAnswerValuesgetQuestionAverageValuesquestionComparesgetSortedQuestionssgetUnansweredQuestionListsgetAnsweredQuestionListsgetWikiMainURL(((s#d:\zope\Products\ontoele\OntoEle.pysOntoEles*               s OntoQuestioncBsntZdZdZdZdZed„Zd„Zd„Z eed„Z d„Z eed „Z d „Z RS( s Question datasxxxss OntoQuestioncCs!||_|o ||_ndS(s ConstructorN(stextsselfslink(sselfstextslink((s#d:\zope\Products\ontoele\OntoEle.pys__init__xs cCs |iSdS(sgetterN(sselfstext(sself((s#d:\zope\Products\ontoele\OntoEle.pysgetText~scCs |iSdS(sgetterN(sselfslink(sself((s#d:\zope\Products\ontoele\OntoEle.pysgetLink‚scCsO|ot|iƒ}nt||tƒ}|o|iƒSn|i ƒSdS(s User answerN( sREQUESTsstrsAUTHENTICATED_USERsusernamesgetattrsselfsNonesuanswersgetAnswerValuesgetDefaultAnswerValue(sselfsREQUESTsusernamesuanswer((s#d:\zope\Products\ontoele\OntoEle.pysgetUserAnswerValue†scCs|iƒ|iSdS(sPlace to write wiki pageN(sselfsgetWikiMainURLsid(sself((s#d:\zope\Products\ontoele\OntoEle.pysgetQuestionWikiURLŽscCsI|ot|iƒ}nt||tƒ}|o|iƒSndSdS(s User answersN( sREQUESTsstrsAUTHENTICATED_USERsusernamesgetattrsselfsNonesuanswers getAnswerText(sselfsREQUESTsusernamesuanswer((s#d:\zope\Products\ontoele\OntoEle.pysgetUserAnswerText’scCs t|iƒ}t||ƒSdS(sgetterN(sstrsREQUESTsAUTHENTICATED_USERsunameshasattrsself(sselfsREQUESTsuname((s#d:\zope\Products\ontoele\OntoEle.pysisAnsweredByCurrentUseršs(s__name__s __module__s__doc__stextslinks meta_typesNones__init__sgetTextsgetLinksgetUserAnswerValuesgetQuestionWikiURLsgetUserAnswerTextsisAnsweredByCurrentUser(((s#d:\zope\Products\ontoele\OntoEle.pys OntoQuestionms     s OntoAnswercBs>tZdZdZdZdZed„Zd„Zd„Z RS(sUser answer datasxxf0.0s OntoAnswercCs||_||_dS(s constructorN(svaluesselfs answervaluestexts answertext(sselfsvaluestext((s#d:\zope\Products\ontoele\OntoEle.pys__init__ªs cCs |iSdS(sgetterN(sselfs answertext(sself((s#d:\zope\Products\ontoele\OntoEle.pys getAnswerText¯scCs |iSdS(sgetterN(sselfs answervalue(sself((s#d:\zope\Products\ontoele\OntoEle.pysgetAnswerValue³s( s__name__s __module__s__doc__s answertexts answervalues meta_typesNones__init__s getAnswerTextsgetAnswerValue(((s#d:\zope\Products\ontoele\OntoEle.pys OntoAnswer s   cCs!|iƒidtƒƒdSdS(sConstructor for new instancesontoelesCreated new ontoeleN(slisajas Destinations _setObjectsOntoEle(slisaja((s#d:\zope\Products\ontoele\OntoEle.pyslisamisKonstruktor¸s( sOFSsGlobalss Persistents AccessControlsFolders SimpleItemsItemsRoles RoleManagersOntoEles OntoQuestions OntoAnswerslisamisKonstruktor(s AccessControls OntoQuestionsOntoEleslisamisKonstruktors OntoAnswers PersistentsOFSsGlobals((s#d:\zope\Products\ontoele\OntoEle.pys?s   1h13(