#!/usr/bin/env python # coding: utf8 from gluon.html import * from gluon.utils import * from myhtml import * class FIELDGROUP(FIELDSET): def __init__(self, label, *divs, **attributes): FIELDSET.__init__(self, **attributes) self.label = label scriptText = 'YAHOO.util.Event.onContentReady("' + self.attributes['_id'] + '", function() { \n' scriptText += '\tvar group = new YAHOO.Ext.FieldGroup(this);\n' scriptText += '}); \n' self.title = CHECKBOX( self.label, _name=self.name, _value = self.attributes.get('_value', None), _class='fieldsetCheckbox' ) self.body = DIV(*divs) if self.attributes.get( '_value', None) == 'on': self.body['_class'] = 'enabled' else: self.body['_class'] = 'disabled' self.components = [ SCRIPT( scriptText, _language='javascript' ), LEGEND( self.title, _class='fieldsetLegend' ), self.body ] def _postprocessing(self): if '_class' in self.attributes: self.attributes['_class'] += ' fieldsetContainer' else: self.attributes['_class'] = 'fieldsetContainer' if '_name' in self.attributes: self.name = self.attributes['_name'] del self.attributes['_name'] else: self.name = None if '_id' not in self.attributes: self.attributes['_id'] = 'fieldset_container_' + web2py_uuid() if '_class' in self.attributes: self.attributes['_class'] += ' fieldsetContainer' else: self.attributes['_class'] = 'fieldsetContainer' if '_name' in self.attributes: self.name = self.attributes['_name'] del self.attributes['_name'] else: self.name = None if '_id' not in self.attributes: self.attributes['_id'] = 'fieldset_container_' + web2py_uuid()