Exemple #1
0
# -*- coding: utf-8 -*-
#from plugin_bootstrap import Messaging
from plugin_managed_html import ManagedHTML
from gluon.storage import Storage

### setup core objects #########################################################
managed_html = ManagedHTML(db)
managed_html.settings.table_content_name = 'plugin_managed_html_content'
managed_html.settings.table_file_name = 'plugin_managed_html_file'
managed_html.settings.extra_fields = {
    'plugin_managed_html_content': [
        Field('created_on', 'datetime', default=request.now, 
              readable=False, writable=False)],
    'plugin_managed_html_file': [
        Field('created_on', 'datetime', default=request.now, 
              readable=False, writable=False)],
}

managed_html.settings.home_url = URL('web2py_plugins', 'index')
managed_html.settings.home_label = 'Web2py plugins'

managed_html.settings.page_crud = DIV('TODO')

image_crud_keyword = 'managed_html_image_crud'
managed_html.settings.image_crud =LOAD(
    url=URL(args=request.args, vars={image_crud_keyword:True}), ajax=True)

### define tables ##############################################################
managed_html.define_tables()
managed_html.settings.image_comment = '<- upload an image (max file size=10k)'
managed_html.settings.image_requires = [managed_html.is_length(10240, 1), managed_html.is_image()]
# -*- coding: utf-8 -*-
#from plugin_bootstrap import Messaging
from plugin_managed_html import ManagedHTML, EDIT_MODE
from gluon.storage import Storage

### setup core objects #########################################################
managed_html = ManagedHTML(db)
managed_html.settings.table_content_name = 'plugin_managed_html_content'
managed_html.settings.table_file_name = 'plugin_managed_html_file'
managed_html.settings.extra_fields = {
    'plugin_managed_html_content': [
        Field('created_on', 'datetime', default=request.now,
              readable=False, writable=False)],
    'plugin_managed_html_file': [
        Field('created_on', 'datetime', default=request.now,
              readable=False, writable=False)],
}

managed_html.settings.home_url = URL('web2py_plugins', 'index')
managed_html.settings.home_label = 'Web2py plugins'

### define tables ##############################################################
managed_html.define_tables()

from plugin_uploadify_widget import IS_UPLOADIFY_LENGTH
managed_html.settings.table_file.name.comment = '<- upload a file (max file size=100k)'
managed_html.settings.table_file.name.requires = [IS_UPLOADIFY_LENGTH(102400, 1)]

table_content = managed_html.settings.table_content
table_file = managed_html.settings.table_file
        
# -*- coding: utf-8 -*-
#from plugin_bootstrap import Messaging
from plugin_managed_html import ManagedHTML
from gluon.storage import Storage

### setup core objects #########################################################
managed_html = ManagedHTML(db)
managed_html.settings.table_content_name = 'plugin_managed_html_content'
managed_html.settings.table_response_name = 'plugin_managed_html_response'
managed_html.settings.extra_fields = {
    'plugin_managed_html_content': [
        Field('created_on', 'datetime', default=request.now, 
              readable=False, writable=False)],
}

### define tables ##############################################################
managed_html.define_tables()
table_content = managed_html.settings.table_content
table_response = managed_html.settings.table_response

### populate records ###########################################################
import datetime
if db(table_content.created_on<request.now-datetime.timedelta(minutes=60)).count():
    for table in (table_content, table_response):
        table.truncate()
    session.flash = 'the database has been refreshed'
    redirect(URL('index'))

### demo functions #############################################################

def index():
# -*- coding: utf-8 -*-
#from plugin_bootstrap import Messaging
from plugin_managed_html import ManagedHTML
from gluon.storage import Storage

from plugin_uploadify_widget import (
    uploadify_widget, IS_UPLOADIFY_IMAGE, IS_UPLOADIFY_LENGTH
)
### setup core objects #########################################################
managed_html = ManagedHTML(db)
managed_html.settings.table_content_name = 'plugin_managed_html_content'
managed_html.settings.table_file_name = 'plugin_managed_html_file'
managed_html.settings.extra_fields = {
    'plugin_managed_html_content': [
        Field('created_on', 'datetime', default=request.now, 
              readable=False, writable=False)],
    'plugin_managed_html_file': [
        Field('created_on', 'datetime', default=request.now, 
              readable=False, writable=False)],
}

managed_html.settings.home_url = URL('web2py_plugins', 'index')
managed_html.settings.home_label = 'Web2py plugins'

managed_html.settings.page_crud = DIV('TODO')

image_crud_keyword = 'managed_html_image_crud'
managed_html.settings.image_crud =LOAD(
    url=URL(args=request.args, vars={image_crud_keyword:True}), ajax=True)

### define tables ##############################################################
Exemple #5
0
# -*- coding: utf-8 -*-
#from plugin_bootstrap import Messaging
from plugin_managed_html import ManagedHTML
from gluon.storage import Storage

from plugin_uploadify_widget import (uploadify_widget, IS_UPLOADIFY_IMAGE,
                                     IS_UPLOADIFY_LENGTH)
### setup core objects #########################################################
managed_html = ManagedHTML(db)
managed_html.settings.table_content_name = 'plugin_managed_html_content'
managed_html.settings.table_file_name = 'plugin_managed_html_file'
managed_html.settings.extra_fields = {
    'plugin_managed_html_content': [
        Field('created_on',
              'datetime',
              default=request.now,
              readable=False,
              writable=False)
    ],
    'plugin_managed_html_file': [
        Field('created_on',
              'datetime',
              default=request.now,
              readable=False,
              writable=False)
    ],
}

managed_html.settings.home_url = URL('web2py_plugins', 'index')
managed_html.settings.home_label = 'Web2py plugins'