Esempio n. 1
0
class ContentLicensingPrefsForm(ControlPanelForm):
    """ The view class for the content licensing preferences form. """

    implements(IContentLicensingPrefsForm)
    form_fields = FormFieldsets(settingsset, newlicenseset)
    form_fields['default_license'].custom_widget = LicenseWidget
    form_fields[
        'supported_licenses'].custom_widget = MultiCheckBoxVocabularyWidget

    label = _(u'Content Licensing Settings')
    description = _(u'Configure site wide settings for copyright licensing '
                    'of content within this portal.')
    form_name = _(u'Content Licensing Settings')

    @form.action(_(u'Save'), name=u'save')
    def handle_edit_action(self, action, data):
        # If the CC license option has been chosen, copy the new fields
        # into the license
        if 'Creative Commons License' == data['default_license']:
            ad = self.adapters[IContentLicensingSettingsForm]
            # Get the hidden field data from the view in the form
            ad.setCCLicense(self.request['license_cc_name'],
                            self.request['license_cc_url'],
                            self.request['license_cc_button'])

        # Apply form changes
        if form.applyChanges(self.context, self.form_fields, data,
                             self.adapters):

            # If there is a new license in the form, add it to the properties page
            if data.has_key('new_license_name') and data['new_license_name']:
                ad = self.adapters[IContentLicensingNewLicenseForm]
                ad.setNewLicense(data['new_license_name'],
                                 data['new_license_url'],
                                 data['new_license_icon'])

            self.status = _("Changes saved.")
            self._on_save(data)
            self.request[
                'fieldset.current'] = u'fieldsetlegend-contentlicensingsettings'
        else:
            self.status = _("No changes made.")
    min_price = property(get_min_price, set_min_price)

    def get_max_price(self):
        value = getattr(self.context, "max_price", u"")
        value = safe_unicode(value, getSiteEncoding(self.context))
        return value

    def set_max_price(self, value):
        value = safe_unicode(value, getSiteEncoding(self.context))
        self.context._updateProperty("max_price", value)

    max_price = property(get_max_price, set_max_price)


generalset = FormFieldsets(IREBGeneralSchema)
generalset.id = "general"
generalset.label = _(u"General")

residentialset = FormFieldsets(IREBResidentialSchema)
residentialset.id = "residentialform"
residentialset.label = _(u"Residential")

commercialset = FormFieldsets(IREBCommercialSchema)
commercialset.id = "commercialform"
commercialset.label = _(u"Commercial")

searchset = FormFieldsets(IREBSearchFormSchema)
searchset.id = "searchform"
searchset.label = _(u"Searching")
Esempio n. 3
0
    new_license_icon = property(get_nothing, set_nothing)

    def setNewLicense(self, name, url, icon):
        """ Set a new license """
        new_license = [name, name, '', '']
        if url:
            new_license[2] = url
        if icon:
            new_license[3] = icon
        license_id = 'license_%s' %(''.join(name.lower().split()))
        self.clprops.manage_addProperty(license_id, new_license, 'lines')
        self.clprops.manage_changeProperties(SupportedLicenses=list(self.clprops.getProperty('SupportedLicenses')) + [license_id])
        self.clprops.manage_changeProperties(AvailableLicenses=list(self.clprops.getProperty('AvailableLicenses')) + [license_id])


settingsset = FormFieldsets(IContentLicensingSettingsForm)
settingsset.id = 'contentlicensingsettings'
settingsset.label = _(u'Content License Settings')

newlicenseset = FormFieldsets(IContentLicensingNewLicenseForm)
newlicenseset.id = 'contentlicensenewlicense'
newlicenseset.label = _(u'New License')


class ContentLicensingPrefsForm(ControlPanelForm):
    """ The view class for the content licensing preferences form. """

    implements(IContentLicensingPrefsForm)
    form_fields = FormFieldsets(settingsset, newlicenseset)
    form_fields['default_license'].custom_widget = LicenseWidget
    form_fields['supported_licenses'].custom_widget = MultiCheckBoxVocabularyWidget
Esempio n. 4
0
    new_site_icon = property(get_nothing, set_nothing)

    def setNewBookmarkingSite(self, name, url, icon):
        """ Set a new bookmarking site  """
        new_site = [name, '', '']
        if url:
            new_site[1] = url
        if icon:
            new_site[2] = icon

        site_id = ''.join(name.lower().split())
        self.bmprops.manage_addProperty(site_id, new_site, 'lines')
        self.bmprops.manage_changeProperties(displayed_sites=list(self.bmprops.displayed_sites) + [site_id])
        self.bmprops.manage_changeProperties(available_sites=list(self.bmprops.available_sites) + [site_id])

settingsset = FormFieldsets(IbookmarkletsSchema)
settingsset.id = 'bookmarkletssettings'
settingsset.label = _(u'Settings')

newsiteset = FormFieldsets(IbookmarkletsNewSiteForm)
newsiteset.id = 'bookmarkletsnewsite'
newsiteset.label = _('New Site')

class BookmarkletsControlPanel(ControlPanelForm):

    implements(IbookmarkletsControlPanel)
    form_fields = FormFieldsets(settingsset, newsiteset)
    form_fields['displayed_sites'].custom_widget = MultiCheckBoxVocabularyWidget
    

    label = _(u'PloneBookmarklets Settings')
Esempio n. 5
0
    def setNewLicense(self, name, url, icon):
        """ Set a new license """
        new_license = [name, name, '', '']
        if url:
            new_license[2] = url
        if icon:
            new_license[3] = icon
        license_id = 'license_%s' % (''.join(name.lower().split()))
        self.clprops.manage_addProperty(license_id, new_license, 'lines')
        self.clprops.manage_changeProperties(SupportedLicenses=list(
            self.clprops.getProperty('SupportedLicenses')) + [license_id])
        self.clprops.manage_changeProperties(AvailableLicenses=list(
            self.clprops.getProperty('AvailableLicenses')) + [license_id])


settingsset = FormFieldsets(IContentLicensingSettingsForm)
settingsset.id = 'contentlicensingsettings'
settingsset.label = _(u'Content License Settings')

newlicenseset = FormFieldsets(IContentLicensingNewLicenseForm)
newlicenseset.id = 'contentlicensenewlicense'
newlicenseset.label = _(u'New License')


class ContentLicensingPrefsForm(ControlPanelForm):
    """ The view class for the content licensing preferences form. """

    implements(IContentLicensingPrefsForm)
    form_fields = FormFieldsets(settingsset, newlicenseset)
    form_fields['default_license'].custom_widget = LicenseWidget
    form_fields[
Esempio n. 6
0
    def clearAllSettings(self):
        """ Remove all customizations. """
        objs = self.skins.objectIds()
        custom = ['logo.gif',
                  'favicon.ico',
                  'headerBackground.png', 
                  'topNavBackground.png',
                  'columnOneBackground.png',
                  'base_properties']
        self.skins.manage_delObjects(filter(lambda x:x in objs, custom))

        stool = self.context.portal_skins
        stool.leftskin.base_properties.manage_doCustomize(folder_path='custom')
        

generalset = FormFieldsets(ILeftSkinGeneralSchema)
generalset['portal_logo'].custom_widget = ImageWidget
generalset['portal_favicon'].custom_widget = ImageWidget
generalset.id = 'leftskinGeneralSchema'
generalset.description = _(u'General settings for the Left Skin Theme.')
generalset.label = _(u'General')

headerset = FormFieldsets(ILeftSkinHeaderSchema)
headerset['portal_banner'].custom_widget = ImageWidget
headerset.id = 'leftSkinHeaderSchema'
headerset.description = _(u'Skin settings for the portal header which appears '
                          'at the top of the page.')
headerset.label = _(u'Header')

topnavset = FormFieldsets(ILeftSkinTopNavSchema)
topnavset['topnav_background'].custom_widget = ImageWidget