Esempio n. 1
0
    def __init__(self, id, name=None, parent=None, key=None):
        BaseField.__init__(self, id, name, parent)
        self.key = key

        inputContainer = Layout.Box(id + "_inputContainer", '', self)
        inputContainer.style['float'] = 'left'
        inputContainer.style['clear'] = 'none'
        userInput = Inputs.CheckBox(id, None, self, key=key)
        self.userInput.addJavascriptEvent('onload', 'CCClickCheckbox(this)')
        self.userInput.addJavascriptEvent('onclick',
                                          CallBack(self, 'toggleChildren'))
        self.userInput = self.userInput.replaceWith(userInput)
        self.inputContainer = self.addChildElement(inputContainer)

        labelContainer = Layout.Box(id + "_labelContainer", '', self)
        labelContainer.style['float'] = 'left'
        labelContainer.style['clear'] = 'none'
        labelContainer.style['margin-top'] = "3px"
        label = Display.Label(id + "_label", '', self)
        self.label = labelContainer.addChildElement(label)
        self.labelContainer = self.addChildElement(labelContainer)

        self.addChildElement(Layout.LineBreak())

        childContainer = Layout.Box(id + "_childContainer", name, self)
        childContainer.style['display'] = CallBack(self, 'displayValue')
        self.childContainer = self.addChildElement(childContainer)
        self.addChildElementsTo = childContainer
Esempio n. 2
0
 def __updateUI__(self):
     self.tabLabel.textAfterChildren = self.text or self.name
     if self.imageName:
         image = self.tabLabel.addChildElement(Layout.Box())
         image.addClass(self.imageName)
         image.style['margin'] = "auto"
         image.style['clear'] = "both"
Esempio n. 3
0
    def __init__(self, id, name=None, parent=None):
        Layout.Box.__init__(self, id + "${suffix}", name, parent)

        baseId = id
        id += "${suffix}"
        self.index = 0

        self.id = id + "Controller"
        self.name = id + "Controller"

        if self.hidden:
            self.style['display'] = 'none'

        controller = HiddenInputs.HiddenValue(name="serverController")
        controller.setValue(baseId)
        self.addChildElement(controller)

        self.function = self.addChildElement(
            HiddenInputs.HiddenValue(name="callFunction"))

        content = Layout.Box(id)
        content.addClass(id)
        self.ajaxContent = self.addChildElement(content)

        loading = self.Loading(id + ":Loading", parent=self)
        self.loadingBanner = self.addChildElement(loading)

        if self.autoload != "AJAX":
            loading.hide()

        self.defaultFields = loading.addChildElement(
            Layout.Box(id + ":Defaults"))
        self.defaultFields.hide()

        self.addJSFunctions(AjaxController)

        if self.autoload == "AJAX":
            self.addScript("ajaxUpdate('" + id + "');")
        if self.autoreload:
            self.addScript("setInterval('ajaxUpdate(\"" + id + "\", true)', " +
                           unicode(self.autoreload) + ");")
Esempio n. 4
0
    def __init__(self, id, name=None, parent=None):
        Layout.Vertical.__init__(self, id, name, parent=parent)

        self.inputContainer = self.addChildElement(Layout.Horizontal())

        self.label = self.inputContainer.addChildElement(Display.Label())
        self.fieldActions = self.inputContainer.addChildElement(Layout.Box())
        self.addChildElementsTo = self.fieldActions
        self.userInput = self.inputContainer.addChildElement(Base.Invalid())

        errorContainer = self.addChildElement(Layout.Horizontal())
        self.formError = errorContainer.addChildElement(
            Display.FormError(id, parent=self))
Esempio n. 5
0
    def __init__(self, id, name=None, parent=None):
        Base.WebElement.__init__(self, id, name, parent)

        self.tabs = {}
        self.selectedTab = None

        self.layout = self.addChildElement(
            self.__layoutElement__(id, name, parent))
        self.layout.addClass("WebElement" + self.__class__.__name__)

        self.__tabLabelContainer__ = self.layout.addChildElement(
            self.__tabLayoutElement__())
        self.__tabLabelContainer__.addClass('TabLabels')
        self.__tabContentContainer__ = self.layout.addChildElement(
            Layout.Box())
        self.__tabContentContainer__.addClass('TabContents')

        self.addScript(CallBack(self, 'jsInit'))
Esempio n. 6
0
    def __init__(self, id, name=None, parent=None):
        Layout.Box.__init__(self, id + "Field", name, parent)
        self.submitIfDisabled = False

        self.layout = self.addChildElement(Layout.Vertical(id + "Container"))
        self.inputContainer = self.layout.addChildElement(Layout.Horizontal())

        self.label = self.inputContainer.addChildElement(Display.Label())

        self.inputAndActions = self.inputContainer.addChildElement(
            Layout.Horizontal())
        self.userInput = self.inputAndActions.addChildElement(
            self.inputElement(id, name=name))
        self.fieldActions = self.inputAndActions.addChildElement(Layout.Box())
        self.addChildElementsTo = self.fieldActions

        errorContainer = self.layout.addChildElement(Layout.Horizontal())
        self.formError = errorContainer.addChildElement(
            Display.FormError(id, parent=self))
        self.layout.addChildElement(errorContainer)

        self.connect('beforeToHtml', None, self, '__checkIfNeedsValidation__')
        self.connect('beforeToHtml', None, self, '__updateReadOnly__')
Esempio n. 7
0
    def __init__(self, id, name=None, parent=None):
        Layout.Vertical.__init__(self, id, name, parent)
        self.addClass("WebElementAccordion")

        self.toggle = self.addChildElement(Layout.Horizontal())
        self.toggle.addClass('AccordionToggle')
        self.toggle.addJavascriptEvent('onclick', CallBack(self, 'jsToggle'))
        self.toggleImage = self.toggle.addChildElement(
            Display.Image(id + "Image"))
        self.toggleImage.addClass('AccordionImage')
        self.toggleLabel = self.toggle.addChildElement(Display.Label())
        self.toggleLabel.addClass('AccordionLabel')
        self.isOpen = self.toggle.addChildElement(
            HiddenInputs.HiddenBooleanValue(id + "Value"))
        self.contentElement = self.addChildElement(Layout.Box(id + "Content"))
        self.contentElement.addClass('AccordionContent')
        self.addChildElementsTo = self.contentElement

        self.isOpen.connect('valueChanged', True, self, 'open')
        self.isOpen.connect('valueChanged', False, self, 'close')
        self.close()

        self.addJSFunctions(Accordion)
Esempio n. 8
0
    def __init__(self, id, name=None, parent=None):
        Layout.Box.__init__(self, id, name, parent)

        self.searchFieldList = []
        self.filters = [
            self,
        ]
        self.isSubFilter = False

        filterContainer = Layout.Box(id + ":Container")
        filterContainer.addClass('Filter')
        self.filterContainer = self.addChildElement(filterContainer)

        filterInput = Layout.Box()
        filterInput.style['float'] = 'left'
        filterContainer.addChildElement(filterInput)

        label = Display.Label('filterTermLabel')
        label.setText('Search for:')
        filterInput.addChildElement(label)

        searchTerm = Inputs.TextBox(id + ":SearchTerm", "FilterTerm")
        searchTerm.addClass("FilterTerm")
        self.searchTerm = filterInput.addChildElement(searchTerm)

        label = Display.Label('filterFieldLabel')
        label.setText('in:')
        filterInput.addChildElement(label)

        searchFields = Inputs.Select(id + ":SearchFields", "FilterField")
        searchFields.addClass("FilterField")
        self.searchFields = filterInput.addChildElement(searchFields)

        filterType = Inputs.TextBox(id + ":FilterType", "FilterType")
        filterType.addClass('filterType')
        filterType.attributes['type'] = "hidden"
        filterType.setValue("BaseFilter")
        self.filterType = filterInput.addChildElement(filterType)

        removeButton = Buttons.Link(id + ":Remove")
        removeButton.style['float'] = 'right'
        removeButton.style['display'] = 'none'
        removeButton.setText("")
        removeButton.textBeforeChildren = "<img src='images/close.gif' />"
        removeButton.addClass('Clickable')
        removeButton.addClass('RemoveFilter')
        removeButton.addJavascriptEvent("onclick",
                                        CallBack(self, 'jsRemoveFilter'))
        removeButton.addJavascriptEvent(
            "onmouseover", """JUAddClass(JUParentElement(this,
                                                                      'Filter'),
                                                        'FilterHighlight');""")
        removeButton.addJavascriptEvent(
            "onmouseout", """JURemoveClass(JUParentElement(this,
                                                                      'Filter'),
                                                        'FilterHighlight');""")
        self.removeButton = filterContainer.addChildElement(removeButton)

        addFilter = Layout.Box()
        addFilter.addClass('AddFilter')
        addFilter.style['clear'] = 'both'
        addAndFilter = Buttons.ToggleButton(id + ":And")
        addAndFilter.button.addClass('AddFilterButton')
        addAndFilter.button.addClass('AddAndFilter')
        addAndFilter.setValue("And")
        self.addAndFilter = addFilter.addChildElement(addAndFilter)
        addOrFilter = Buttons.ToggleButton(id + ":Or")
        addOrFilter.button.addClass('AddFilterButton')
        addOrFilter.button.addClass('AddOrFilter')
        addOrFilter.setValue("Or")
        self.addOrFilter = addFilter.addChildElement(addOrFilter)
        self.addFilter = filterContainer.addChildElement(addFilter)

        subFilter = Layout.Box()
        subFilter.addClass('subFilter')
        self.subFilter = self.addChildElement(subFilter)

        addOrFilter.connect('toggled', True, addAndFilter, 'toggleOff')
        addOrFilter.connect('jsToggled', None, self, 'jsAddOrFilter')
        addOrFilter.connect('jsToggled', True, addAndFilter, 'jsToggleOff')

        addAndFilter.connect('toggled', True, addOrFilter, 'toggleOff')
        addAndFilter.connect('jsToggled', None, self, 'jsAddAndFilter')
        addAndFilter.connect('jsToggled', True, addOrFilter, 'jsToggleOff')

        self.addJSFunctions(self.__class__)