def hoi_dap(): forlder_id = cms.get_folder(request.args(0)) hoi_dap = cms.define_table(tablename ='hoi_dap',migrate=True) hoi_dap.folder.writable=False hoi_dap.folder.readable=False hoi_dap.folder.default=forlder_id hoi_dap.avatar.writable=False hoi_dap.avatar.readable=False hoi_dap.avatar.default=' ' hoi_dap.htmlcontent.writable=False hoi_dap.htmlcontent.readable=False from gluon.tools import Recaptcha public_key='6LdtT_YSAAAAALCH4vbHKl1yjqvhB80JZh1J21Lv' private_key='6LdtT_YSAAAAAI6XnBMNNWwSkJeSYtbP_-kW5HUH' ### provided by recaptcha.net from gluon.tools import Crud crud = Crud(cms.db) crud.settings.captcha = Recaptcha(request,public_key,private_key,options = "lang:'en', theme:'clean'") form=crud.create(hoi_dap) # form[0].insert(-1, TR('', Recaptcha(request,public_key,private_key,options = "lang:'en', theme:'clean'"))) if form.process().accepted: from plugin_process import ProcessModel process = ProcessModel() objects = process.define_objects(True) log = process.define_process_log(True) objects_id =objects.insert(folder=forlder_id ,tablename='hoi_dap',table_id=form.vars.id ,process=2) log.insert(objects=objects_id, process=2) response.flash=T('done!') # scr ='''<script type="text/javascript"> # setInterval("location.reload();",1000); # </script>''' # form.append(XML(scr)) # if form.errors: # response.flash=T('Loi nhap du lieu!') # scr ='''<script type="text/javascript"> # setInterval("location.reload();",1000); # </script>''' # form.append(XML(scr)) div = DIV(_id='hoi_dap') div.append(DIV(H2('Nhập câu hỏi',_class="title_box"),_class="tinlienquan")) div.append(form) response.view = 'layout/hoi_dap_13.html' return dict(content=div)
# -*- coding: utf-8 -*- ################################################### # This file was developed by ToanLK # It is released under BSD, MIT and GPL2 licenses # Version 0.1 Date: 27/02/2014 ################################################### if request.controller in ['plugin_process', 'plugin_comment']: from plugin_process import ProcessModel from plugin_cms import CmsModel processmodel = ProcessModel() processmodel.define_process() processmodel.define_procedures() processmodel.define_process_log() processmodel.define_process_lock() auth = processmodel.auth db = processmodel.db cms = CmsModel() elif request.controller in ['appadmin', 'plugin_tools']: from plugin_process import ProcessModel from plugin_cms import CmsModel processmodel = ProcessModel() processmodel.define_process(False) processmodel.define_procedures(False) processmodel.define_process_log(False) processmodel.define_process_lock(False) auth = processmodel.auth db = processmodel.db cms = CmsModel() cmsdb = cms.db