Changeset 304


Ignore:
Timestamp:
21.11.2008 15:12:22 (3 years ago)
Author:
mike
Message:
 
Location:
CMESS/forum/branches/captcha
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • CMESS/forum/branches/captcha/org/cmess/forum/zms/zmsforum.metaobj.xml

    r277 r304  
    9191<item key="repetitive" type="int">0</item> 
    9292<item key="type"><![CDATA[boolean]]></item> 
     93</dictionary> 
     94</item> 
     95<item type="dictionary"><dictionary> 
     96<item key="id"><![CDATA[zfEnableCaptcha]]></item> 
     97<item key="keys" type="list"><list> 
     98<item><![CDATA[captcha.net]]></item> 
     99</list> 
     100</item> 
     101<item key="mandatory" type="int">0</item> 
     102<item key="multilang" type="int">1</item> 
     103<item key="name"><![CDATA[Captcha?]]></item> 
     104<item key="repetitive" type="int">0</item> 
     105<item key="type"><![CDATA[select]]></item> 
    93106</dictionary> 
    94107</item> 
     
    733746- zfmEmail value 
    734747- zfmBody text 
     748- captcha content 
    735749</dtml-comment> 
    736750 
     
    768782                        <input type="file" name="zfmFile" size="19"> 
    769783                </div> 
     784                <div class="field"> 
     785                        %s 
     786                </div> 
    770787        </fieldset> 
    771788        <input type="submit" name="btn" value="<dtml-var "getLangStr('zfBtnSend', lang)">"> 
     
    10441061<item key="name"><![CDATA[Forum]]></item> 
    10451062<item key="package"><![CDATA[org.cmess.forum]]></item> 
    1046 <item key="revision"><![CDATA[1.0.0]]></item> 
     1063<item key="revision"><![CDATA[1.1.0]]></item> 
    10471064<item key="type"><![CDATA[ZMSObject]]></item> 
    10481065</dictionary> 
     
    11921209        return temp_result 
    11931210 
     1211def checkCaptcha(): 
     1212        temp_captcha_mode = context.getObjProperty('zfEnableCaptcha', REQUEST) 
     1213        if ((temp_captcha_mode is not None) and (len(temp_captcha_mode) > 0)): 
     1214                temp_result = context.ZMSForum_isCaptchaValid(temp_captcha_mode, REQUEST) 
     1215        else: 
     1216                temp_result = (True, '') 
     1217                 
     1218        return temp_result 
     1219 
    11941220def checkNewEmail(): 
    11951221        temp_err = [] 
     
    12121238                temp_err.extend(temp_email_err) 
    12131239                 
     1240        temp_captcha_err = checkCaptcha() 
     1241        if (not temp_captcha_err[0]): 
     1242                temp_err.append(temp_captcha_err[1]) 
     1243                 
    12141244        return (len(temp_err) > 0) and temp_err or None 
     1245 
     1246def getCaptchaContent(): 
     1247        temp_captcha_mode = context.getObjProperty('zfEnableCaptcha', REQUEST) 
     1248        if ((temp_captcha_mode is not None) and (len(temp_captcha_mode) > 0)): 
     1249                temp_captcha_content = context.ZMSForum_getCaptchaContent(temp_captcha_mode) 
     1250        else: 
     1251                temp_captcha_content = '' 
     1252                 
     1253        return temp_captcha_content 
    12151254 
    12161255def handleDisplayHelp(): 
     
    12461285                                                                                                        'AW: ' + temp_msg[0]['zfmSubject'],  
    12471286                                                                                                        REQUEST.get('zfmAuthor', REQUEST.cookies.get('__ac_author', '')),  
    1248                                                                                                         REQUEST.get('zfmEmail', REQUEST.cookies.get('__ac_email', '')), temp_text) 
     1287                                                                                                        REQUEST.get('zfmEmail', REQUEST.cookies.get('__ac_email', '')), temp_text, getCaptchaContent()) 
    12491288                else: 
    12501289                        temp_err_list, temp_result = processError(context.getLangStr('zfErrMsgNotFound', temp_lang), handleDisplayOverview) 
     
    12531292                                                                                                'insertReply', context.getLangStr('zfReplyMessage', temp_lang),  
    12541293                                                                                                REQUEST.form.get('zfmSubject', ''), REQUEST.form.get('zfmAuthor', ''),  
    1255                                                                                                 REQUEST.form.get('zfmEmail', ''), REQUEST.form.get('zfmBody', '')) 
     1294                                                                                                REQUEST.form.get('zfmEmail', ''), REQUEST.form.get('zfmBody', ''), getCaptchaContent()) 
    12561295        else: 
    12571296                temp_err_list, temp_result = processError(context.getLangStr('zfErrParams', temp_lang), handleDisplayMessage) 
     
    13261365                                                                                        context.getLangStr('zfInsertTopic', temp_lang), REQUEST.form.get('zfmSubject', ''),  
    13271366                                                                                        REQUEST.form.get('zfmAuthor', ''), REQUEST.form.get('zfmEmail', ''),  
    1328                                                                                         REQUEST.form.get('zfmBody', '')) 
     1367                                                                                        REQUEST.form.get('zfmBody', ''), getCaptchaContent()) 
     1368        elif (REQUEST.form.has_key('captcha_new')): 
     1369                temp_err_list = None 
     1370                temp_result = (context.getObjProperty('newMessageForm', REQUEST))%('', 'insertNew',  
     1371                                                                                        context.getLangStr('zfInsertTopic', temp_lang), REQUEST.form.get('zfmSubject', ''),  
     1372                                                                                        REQUEST.form.get('zfmAuthor', ''), REQUEST.form.get('zfmEmail', ''),  
     1373                                                                                        REQUEST.form.get('zfmBody', ''), getCaptchaContent()) 
    13291374        else: 
    13301375                temp_err_list = None 
    13311376                temp_result = (context.getObjProperty('newMessageForm', REQUEST))%('', 'insertNew',  
    1332                                                                                         context.getLangStr('zfInsertTopic', temp_lang), '', '', '', '') 
     1377                                                                                        context.getLangStr('zfInsertTopic', temp_lang), '', '', '', '', getCaptchaContent()) 
    13331378         
    13341379        return (temp_err_list, temp_result) 
     
    21862231</dictionary> 
    21872232</item> 
     2233<item type="dictionary"><dictionary> 
     2234<item key="custom"><![CDATA[from org.cmess.forum.c_handler_captcha import C_Handler_Captcha  
     2235 
     2236def ZMSForum_getCaptchaContent(captcha_mode): 
     2237  temp_handler = C_Handler_Captcha(captcha_mode) 
     2238  temp_result = temp_handler.GetCaptchaContent() 
     2239   
     2240  return temp_result]]></item> 
     2241<item key="id"><![CDATA[ZMSForum_getCaptchaContent]]></item> 
     2242<item key="mandatory" type="int">0</item> 
     2243<item key="multilang" type="int">0</item> 
     2244<item key="name"><![CDATA[ZMSForum_getCaptchaContent]]></item> 
     2245<item key="repetitive" type="int">0</item> 
     2246<item key="type"><![CDATA[External Method]]></item> 
     2247</dictionary> 
     2248</item> 
     2249<item type="dictionary"><dictionary> 
     2250<item key="custom"><![CDATA[from org.cmess.forum.c_handler_captcha import C_Handler_Captcha  
     2251 
     2252def ZMSForum_isCaptchaValid(captcha_mode, REQUEST): 
     2253  temp_handler = C_Handler_Captcha(captcha_mode) 
     2254  temp_result = temp_handler.IsCodeValid(REQUEST) 
     2255   
     2256  return temp_result]]></item> 
     2257<item key="id"><![CDATA[ZMSForum_isCaptchaValid]]></item> 
     2258<item key="mandatory" type="int">0</item> 
     2259<item key="multilang" type="int">0</item> 
     2260<item key="name"><![CDATA[ZMSForum_isCaptchaValid]]></item> 
     2261<item key="repetitive" type="int">0</item> 
     2262<item key="type"><![CDATA[External Method]]></item> 
     2263</dictionary> 
     2264</item> 
    21882265</list> 
    21892266</item> 
     
    22072284<item key="name"><![CDATA[Library]]></item> 
    22082285<item key="package"><![CDATA[org.cmess.forum]]></item> 
    2209 <item key="revision"><![CDATA[1.0.0]]></item> 
     2286<item key="revision"><![CDATA[1.1.0]]></item> 
    22102287<item key="type"><![CDATA[ZMSLibrary]]></item> 
    22112288</dictionary> 
     
    27652842<item key="name"><![CDATA[org.cmess.forum]]></item> 
    27662843<item key="package"></item> 
    2767 <item key="revision"><![CDATA[1.0.0]]></item> 
     2844<item key="revision"><![CDATA[1.1.0]]></item> 
    27682845<item key="type"><![CDATA[ZMSPackage]]></item> 
    27692846</dictionary> 
Note: See TracChangeset for help on using the changeset viewer.