Ejemplo n.º 1
0
def contact():
    id = 90
    from plugin_ckeditor import CKEditor
    box = cms.define_box()
    box.htmlcontent.widget = CKEditor(cms.db).widget

    box.name.writable = False

    box.id.writable = False
    box.id.readable = False

    box.boxtype.writable = False
    box.boxtype.readable = False

    box.avatar.writable = False
    box.avatar.readable = False

    box.link.writable = False
    box.link.readable = False

    box.setting.writable = False
    box.setting.readable = False

    box.textcontent.writable = False
    box.textcontent.readable = False

    form = SQLFORM(box, id)
    div = DIV(_class="panel panel-default")
    div.append(DIV(T('Thông tin hỗ trợ trực tuyến'), _class="panel-heading"))
    div.append(DIV(form, _class='panel-body'))
    if form.process().accepted:
        response.flash = T('Cập nhật thành công.')
    response.view = 'plugin_manager/index.html'
    return dict(content=div)
Ejemplo n.º 2
0
def edit_tin_tuc(id, cms, folder_id_ivinh):
    request = current.request
    T = current.T
    from plugin_ckeditor import CKEditor
    tin_tuc = cms.define_table('tintuc')
    tin_tuc.folder.default = folder_id_ivinh
    tin_tuc.folder.writable = False
    tin_tuc.folder.readable = False
    tin_tuc.htmlcontent.widget = CKEditor(cms.db).widget
    form = SQLFORM(tin_tuc, id)
    ajax = "ajax('%s', [''], 'news_detail')" % (URL(
        r=current.request,
        c='plugin_app',
        f='act_delete',
        args=[request.args(0)],
        vars=dict(table_name='tintuc', table_id=id)))
    form[0][-1] = TR(TD(INPUT(_type='submit', _value=T('Submit')),
                        INPUT(_type='button',
                              _value=T('Xóa bài viết'),
                              _onclick=ajax,
                              _class='btn btn-danger'),
                        _colspan="3"),
                     _class='act_ivinh')
    if form.process().accepted:
        current.response.flash = T('Cập nhật thành công.')
    return form
Ejemplo n.º 3
0
def add_cong_ty(folder):
	from sqlhtml import SQLFORM
   	from plugin_ckeditor import CKEditor
   	from plugin_cms import CmsModel
	T = current.T
	cms = CmsModel()
	db = cms.db
	div = DIV(_class='col-md-12')
	div.append(H2(SPAN(T('Thông tin chi tiết')),_class='title_name',_id='title_page'))
	cong_ty_edit = cms.define_table('cong_ty')
	cong_ty_id = db(cong_ty_edit.folder==folder).select().first()
	cong_ty_edit.folder.writable=False
	cong_ty_edit.folder.readable=False

	cong_ty_edit.start_time.writable=False
	cong_ty_edit.start_time.readable=False

	cong_ty_edit.danh_gia.writable=False
	cong_ty_edit.danh_gia.readable=False

	cong_ty_edit.is_maps.writable=False
	cong_ty_edit.is_maps.readable=False

	from plugin_app import widget_danh_muc
	cong_ty_edit.linh_vuc.widget=widget_danh_muc
	form=SQLFORM(cong_ty_edit,cong_ty_id)
	if form.process().accepted:
		current.response.flash = T("Cập nhật thành công!")
	div.append(form)
	return form
Ejemplo n.º 4
0
	def form(self,id=None):	
		from sqlhtml import SQLFORM
		table = self.db[self.tablename]
		table.parent.widget = self.widget_folder
		table.layout.widget = self.widget_layout
		table.setting.readable = False
		table.setting.writable = False
		
		form = SQLFORM(table,id,showid=False,buttons=[])
		return form
Ejemplo n.º 5
0
def form():
    try:
        from plugin_folder import FolderCrud
        folder = FolderCrud(cms.db, auth, parent=FOLDER_PARENT)
        id = request.vars.folder
        form = folder.form(id)

        from sqlhtml import SQLFORM
        table = folder.db[folder.tablename]
        table.parent.widget = folder.widget_folder

        table.parent.label = 'Danh mục cha'
        table.label.label = 'Tên danh mục'
        table.name.label = 'Mã danh mục'
        table.label.widget = folder.widget_label
        table.description.label = 'Mô tả'
        table.setting.readable = False
        table.setting.writable = False

        table.layout.default = 'page_san_pham.html'
        # table.layout.readable = False
        # table.layout.writable = False

        table.display_order.readable = False
        table.display_order.writable = False

        form = SQLFORM(table, id, showid=False, buttons=[])

        ajax = "ajax('%s',['name','label','parent','description','display_order','layout'],'')" % URL(
            f='update', args=[id] if id else None)
        ajax_d = "ajax('%s',[],'')" % URL(f='delete',
                                          args=[id] if id else None)
        div = DIV(_class='wr_act_form')
        div.append(
            A(SPAN(_class='glyphicon glyphicon-ok'),
              T('Submit'),
              _class='btn btn-primary',
              _onclick=ajax))
        if id:
            div.append(
                A(SPAN(_class='glyphicon glyphicon-trash'),
                  T('Delete'),
                  _class='btn btn-danger',
                  _onclick=ajax_d))
        form.append(div)
        return form
    except Exception, e:
        return e
Ejemplo n.º 6
0
def view_san_pham(id, cms, folder_id_ivinh):
    request = current.request
    T = current.T
    div = DIV(_class='col-md-12', _id='news_detail')
    name = request.args(0)
    from plugin_ckeditor import CKEditor
    san_pham = cms.define_table('san_pham')
    # san_pham.folder.default=folder_id_ivinh
    # san_pham.folder.writable=False
    # san_pham.folder.readable=False
    from plugin_app import widget_danh_muc_san_pham
    san_pham.folder.widget = widget_danh_muc_san_pham
    san_pham.r_folder.writable = False
    san_pham.r_folder.readable = False
    san_pham.htmlcontent.widget = CKEditor(cms.db).widget

    form = SQLFORM(san_pham, id)
    ajax = "ajax('%s', [''], 'news_detail')" % (URL(
        r=current.request,
        c='plugin_app',
        f='act_delete',
        args=[request.args(0)],
        vars=dict(table_name='san_pham', table_id=id)))
    form[0][-1] = TR(TD(INPUT(_type='submit', _value=T('Submit')),
                        INPUT(_type='button',
                              _value=T('Xóa sản phẩm'),
                              _onclick=ajax,
                              _class='btn btn-danger'),
                        _colspan="3"),
                     _class='act_ivinh')
    if form.process().accepted:
        dcontent = cms.define_dcontent()
        link = cms.db.san_pham[request.vars.id].link
        id_d = cms.db((dcontent.dtable == 'san_pham')
                      & (dcontent.link == link)).update(
                          name=request.vars.name,
                          folder=request.vars.folder,
                          avatar=request.vars.avatar,
                          description=request.vars.description)
        current.response.flash = T('Cập nhật thành công.')
    div.append(form)
    return div
Ejemplo n.º 7
0
 def test_SQLFORM(self):
     form = SQLFORM(self.db.auth_user)
     self.assertEqual(
         form.xml(),
         '<form action="#" enctype="multipart/form-data" method="post"><table><tr id="auth_user_first_name__row"><td class="w2p_fl"><label class="" for="auth_user_first_name" id="auth_user_first_name__label">First name: </label></td><td class="w2p_fw"><input class="string" id="auth_user_first_name" name="first_name" type="text" value="" /></td><td class="w2p_fc"></td></tr><tr id="auth_user_last_name__row"><td class="w2p_fl"><label class="" for="auth_user_last_name" id="auth_user_last_name__label">Last name: </label></td><td class="w2p_fw"><input class="string" id="auth_user_last_name" name="last_name" type="text" value="" /></td><td class="w2p_fc"></td></tr><tr id="auth_user_email__row"><td class="w2p_fl"><label class="" for="auth_user_email" id="auth_user_email__label">E-mail: </label></td><td class="w2p_fw"><input class="string" id="auth_user_email" name="email" type="text" value="" /></td><td class="w2p_fc"></td></tr><tr id="auth_user_username__row"><td class="w2p_fl"><label class="" for="auth_user_username" id="auth_user_username__label">Username: </label></td><td class="w2p_fw"><input class="string" id="auth_user_username" name="username" type="text" value="" /></td><td class="w2p_fc"></td></tr><tr id="auth_user_password__row"><td class="w2p_fl"><label class="" for="auth_user_password" id="auth_user_password__label">Password: </label></td><td class="w2p_fw"><input class="password" id="auth_user_password" name="password" type="password" value="" /></td><td class="w2p_fc"></td></tr><tr id="submit_record__row"><td class="w2p_fl"></td><td class="w2p_fw"><input type="submit" value="Submit" /></td><td class="w2p_fc"></td></tr></table></form>'
     )