def __init__ (self, key, modules, **kwargs): def key_to_url (key): return ''.join ([('_',c)[c in string.letters + string.digits] for c in key]) Widget.__init__ (self) # Properties self._key = key self._mods = modules active_name = cfg.get_val (self._key) # URL self._url = '/plugin_content_%s' %(key_to_url(key)) srv = get_server() if srv.use_sec_submit: self._url += '?key=%s' %(srv.sec_submit) # Widgets self.selector_widget = ComboCfg (key, modules) self.plugin = instance_plugin (active_name, key, **kwargs) # Register hidden URL for the plugin content publish (r'^/plugin_content_%s' %(key_to_url(key)), PluginInstanceProxy, key=key, modules=modules, method='POST', **kwargs)
def __init__(self, key, options, _props={}): Box.__init__(self) self.props = _props.copy() self._options = options if not 'id' in self.props: self.id = 'RadioGroup_%s' % (self.uniq_id) cfg_value = cfg.get_val(key) for o in options: val, desc = o new_props = {} new_props['name'] = key new_props['value'] = val # Initial value if cfg_value != None and \ cfg_value == val: new_props['checked'] = 1 elif 'checked' in self.props: if self.props['checked'] == val: new_props['checked'] = 1 self += RadioText(desc, new_props)
def __init__(self, key, modules, **kwargs): def key_to_url(key): return ''.join([('_', c)[c in string.letters + string.digits] for c in key]) Widget.__init__(self) # Properties self._key = key self._mods = modules active_name = cfg.get_val(self._key) # URL self._url = '/plugin_content_%s' % (key_to_url(key)) srv = get_server() if srv.use_sec_submit: self._url += '?key=%s' % (srv.sec_submit) # Widgets self.selector_widget = ComboCfg(key, modules) self.plugin = instance_plugin(active_name, key, **kwargs) # Register hidden URL for the plugin content publish(r'^/plugin_content_%s' % (key_to_url(key)), PluginInstanceProxy, key=key, modules=modules, method='POST', **kwargs)
def __init__ (self, key, options, _props={}): Box.__init__ (self) self.props = _props.copy() self._options = options if not 'id' in self.props: self.id = 'RadioGroup_%s' %(self.uniq_id) cfg_value = cfg.get_val (key) for o in options: val, desc = o new_props = {} new_props['name'] = key new_props['value'] = val # Initial value if cfg_value != None and \ cfg_value == val: new_props['checked'] = 1 elif 'checked' in self.props: if self.props['checked'] == val: new_props['checked'] = 1 self += RadioText (desc, new_props)
def Render (self): value = cfg.get_val (self.key, '') render = TextCfg.Render(self) render.js += JS %({'id': self.id, 'url': self.url, 'key': self.key, 'value': value}) return render
def Render(self): value = cfg.get_val(self.key, '') render = TextCfg.Render(self) render.js += JS % ({ 'id': self.id, 'url': self.url, 'key': self.key, 'value': value }) return render
def __init__(self, key, default, props=None): if not props: props = {} # Read the key value val = cfg.get_val(key) if not val: props['checked'] = "01"[bool(int(default))] elif val.isdigit(): props['checked'] = "01"[bool(int(val))] else: assert False, "Could not handle value: %s" % (val) # Other properties props['name'] = key # Init parent iPhoneToggle.__init__(self, props)
def __init__(self, key, default, props=None): if not props: props = {} # Read the key value val = cfg.get_val(key) if not val: props["checked"] = "01"[bool(int(default))] elif val.isdigit(): props["checked"] = "01"[bool(int(val))] else: assert False, "Could not handle value: %s" % (val) # Other properties props["name"] = key # Init parent iPhoneToggle.__init__(self, props)
def __init__(self, key, modules, **kwargs): def key_to_url(key): return "".join([("_", c)[c in string.letters + string.digits] for c in key]) Widget.__init__(self) # Properties self._key = key self._mods = modules self._url = "/plugin_content_%s" % (key_to_url(key)) active_name = cfg.get_val(self._key) # Widgets self.selector_widget = ComboCfg(key, modules) self.plugin = instance_plugin(active_name, key, **kwargs) # Register hidden URL for the plugin content publish(self._url, PluginInstanceProxy, key=key, modules=modules, method="POST", **kwargs)
def __init__ (self, key, options, _props={}): props = _props.copy() # Read the key value val = cfg.get_val(key) sel = None # Look for the selected entry for v,k in options: if v == val: sel = val if sel: props['selected'] = sel # Other properties props['name'] = key # Init parent Combobox.__init__ (self, props, options)
def __init__(self, key, options, _props={}): props = _props.copy() # Read the key value val = cfg.get_val(key) sel = None # Look for the selected entry for v, k in options: if v == val: sel = val if sel: props['selected'] = sel # Other properties props['name'] = key # Init parent Combobox.__init__(self, props, options)
def __init__(self, key, optional=False, props={}): # Sanity checks assert type(key) == str assert type(optional) == bool assert type(props) in (type(None), dict) props = props.copy() # Read the key value val = cfg.get_val(key) if val: props['value'] = val if optional: props['optional'] = True # Other properties props['name'] = key # Init parent TextField.__init__(self, props)
def __init__ (self, key, optional=False, props={}): # Sanity checks assert type(key) == str assert type(optional) == bool assert type(props) in (type(None), dict) props = props.copy() # Read the key value val = cfg.get_val(key) if val: props['value'] = escape(val, quote=True) if optional: props['optional'] = True # Other properties props['name'] = key # Init parent TextField.__init__ (self, props)
def __init__(self, key, optional=False, props={}, content=''): # Sanity checks assert type(key) == str assert type(optional) == bool assert type(props) in (type(None), dict) props = props.copy() # Read the key value val = cfg.get_val(key) if val: content = escape(val, quote=False) if optional: props['optional'] = True # Other properties props['name'] = key # Init parent TextArea.__init__(self, props, content)
def __init__(self, key, default, props=None): # Sanity checks assert type(key) == str assert type(default) == bool assert type(props) in (type(None), dict) if not props: props = {} # Read the key value val = cfg.get_val(key) if not val: props['checked'] = "01"[bool(int(default))] elif val.isdigit(): props['checked'] = "01"[bool(int(val))] else: assert False, "Could not handle value: %s" % (val) # Other properties props['name'] = key # Init parent Checkbox.__init__(self, props)
def __init__ (self, key, default, props=None): # Sanity checks assert type(key) == str assert type(default) == bool assert type(props) in (type(None), dict) if not props: props = {} # Read the key value val = cfg.get_val(key) if not val: props['checked'] = "01"[bool(int(default))] elif val.isdigit(): props['checked'] = "01"[bool(int(val))] else: assert False, "Could not handle value: %s"%(val) # Other properties props['name'] = key # Init parent Checkbox.__init__ (self, props)