public function updateCMSFields(FieldList $fields)
 {
     $fields->insertBefore($shoptab = new Tab('Shop', 'Shop'), 'Access');
     $fields->addFieldsToTab("Root.Shop", new TabSet("ShopTabs", $maintab = new Tab("Main", TreeDropdownField::create('TermsPageID', _t("ShopConfig.TERMSPAGE", 'Terms and Conditions Page'), 'SiteTree'), TreeDropdownField::create("CustomerGroupID", _t("ShopConfig.CUSTOMERGROUP", "Group to add new customers to"), "Group"), UploadField::create('DefaultProductImage', _t('ShopConfig.DEFAULTIMAGE', 'Default Product Image'))), $countriestab = new Tab("Countries", CheckboxSetField::create('AllowedCountries', 'Allowed Ordering and Shipping Countries', self::config()->iso_3166_country_codes))));
     $fields->removeByName("CreateTopLevelGroups");
     $countriestab->setTitle("Allowed Countries");
 }
 function updateCMSFields(&$fields)
 {
     /*
      * don't want slideshow on a redirector page
      */
     if ($this->owner->ClassName == 'RedirectorPage') {
         return $fields;
     }
     /*
      * if this is a new page set defaults 
      */
     if ($this->owner->Version == 1) {
         $this->set_defaults();
     }
     $tabSlides = new Tab('Slides');
     $tabSlides->setTitle(_t('Slideshow.SLIDESTABTITLE', 'Slides'));
     $tabSettings = new Tab('Settings');
     $tabSettings->setTitle(_t('Slideshow.SETTINGSTABTITLE', 'Settings'));
     $tabSlideShow = new TabSet('SlideshowTabs', $tabSlides, $tabSettings);
     $tabSlideShow->setTitle(_t('Slideshow.SLIDESHOWTABTITLE', 'Slideshow'));
     $fields->addFieldToTab('Root.Content', $tabSlideShow);
     $image_manager = new ImageDataObjectManager($this->owner, 'SlideshowSlides', 'SlideshowSlide', 'SlideImage', array(), 'getCMSFields_forPopup');
     $image_manager->copyOnImport = false;
     $fields->addFieldToTab('Root.Content.SlideshowTabs.Slides', $image_manager);
     /*
      * settings
      */
     if (count(self::$effects) > 1) {
         $fields->addFieldToTab('Root.Content.SlideshowTabs.Settings', new DropdownField($name = 'SlideEffect', $title = _t('Slideshow.EFFECT', 'Slide effect'), $source = array_combine(array_keys(self::$effects), array_keys(self::$effects))));
     } else {
         $fields->addFieldToTab('Root.Content.SlideshowTabs.Settings', new HiddenField($name = 'SlideEffect', $title = 'Slide Effect', $value = key(self::$effects)));
     }
     $fields->addFieldsToTab('Root.Content.SlideshowTabs.Settings', array(new TextField($name = 'SlideDuration', $title = _t('Slideshow.SLIDEDURATIOM', 'Duration of Each Slide (milliseconds)')), new TextField($name = 'TransitionDuration', $title = _t('Slideshow.TRANSITIONDURATION', 'Duration of Transition Between Slides (milliseconds)')), new CheckboxField($name = 'AutoPlay', $title = _t('Slideshow.AUTOPLAY', 'Start slideshow automatically')), new CheckboxField($name = 'Loop', $title = _t('Slideshow.LOOP', 'Loop slides')), new CheckboxField($name = 'PauseOnHover', $title = _t('Slideshow.PAUSEONHOVER', 'Pause the slideshow when the mouse hovers over it')), new OptionsetField($name = 'UpdateSlideshows', $title = _t('Slideshow.UPDATE', 'Update slideshows'), $source = array('page' => _t('Slideshow.UPDATEPAGEONLY', 'Apply to this page only'), 'section' => _t('Slideshow.UPDATESECTION', 'Apply to all slideshows in this section'), 'site' => _t('Slideshow.UPDATEALL', 'Apply to all slideshows on this site')), $value = 'page')));
 }
Beispiel #3
0
 public static function user_profile(Model_User $user, Tabs $tabs)
 {
     $pets = ORM::factory('User_Pet')->where('user_id', '=', $user->id)->order_by('active', 'desc')->find_all();
     $tab = new Tab('Pets');
     $tab->add_content(new Tab_PetList($user, $pets->as_array()));
     $tabs->add_tab($tab);
 }
 public function getEditForm($id = null, $fields = null)
 {
     $form = parent::getEditForm($id, $fields);
     $fields = $form->Fields();
     $title = _t('AssetAdmin.FILES', 'Files');
     // File listing
     $gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldSortableHeader(), new GridFieldFilterHeader(), new GridFieldDataColumns(), new GridFieldPaginator(self::config()->page_length), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm());
     $gridField = GridField::create('CloudinaryFile', $title, $this->getList(), $gridFieldConfig);
     $columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
     $columns->setDisplayFields(array('StripThumbnail' => '', 'NameForSummaryField' => _t('File.Name'), 'Created' => _t('AssetAdmin.CREATED', 'Date'), 'getSize' => _t('AssetAdmin.SIZE', 'Size')));
     $columns->setFieldCasting(array('Created' => 'Date->Nice'));
     $gridField->setAttribute('data-url-folder-template', Controller::join_links($this->Link('show'), '%s'));
     if (!$fields->hasTabset()) {
         $tabs = new TabSet('Root', $tabList = new Tab('ListView', _t('AssetAdmin.ListView', 'List View')));
         $tabList->addExtraClass("content-listview cms-tabset-icon list");
         $fields->push($tabs);
     }
     $uploadBtn = new LiteralField('UploadButton', sprintf('<a class="ss-ui-button ss-ui-action-constructive cms-panel-link" data-pjax-target="Content" data-icon="drive-upload" href="%s">%s</a>', Controller::join_links(singleton('CloudinaryFileAddController')->Link()), _t('Folder.UploadFilesButton', 'Upload')));
     $actionButtonsComposite = CompositeField::create()->addExtraClass('cms-actions-row');
     $actionButtonsComposite->push($uploadBtn);
     $fields->addFieldsToTab('Root.ListView', array($actionsComposite = CompositeField::create($actionButtonsComposite)->addExtraClass('cms-content-toolbar field'), $gridField));
     $fields->setForm($form);
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     $form->addExtraClass('cms-edit-form center ' . $this->BaseCSSClasses());
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $this->extend('updateEditForm', $form);
     return $form;
 }
 public function uninstall ()
 {
     $tab = new Tab(Tab::getIdFromClassName('AdminNewsletter'));
     return parent::uninstall()
             && $tab->delete()
             && Configuration::deleteByName('NSletter_id_parent_tab');;
 }
 public function uninstall()
 {
     Configuration::deleteByName('poslogo');
     // Uninstall Tabs
     $tab = new Tab((int) Tab::getIdFromClassName('AdminPosLogo'));
     $tab->delete();
     Configuration::deleteByName($this->name . '_auto');
     Configuration::deleteByName($this->name . '_speed_slide');
     Configuration::deleteByName($this->name . '_a_speed');
     // Configuration::deleteByName($this->name . '_show_price');
     //Configuration::deleteByName($this->name . '_show_des');
     Configuration::deleteByName($this->name . '_qty_products');
     Configuration::deleteByName($this->name . '_qty_items');
     Configuration::deleteByName($this->name . '_width_item');
     Configuration::deleteByName($this->name . '_show_nextback');
     Configuration::deleteByName($this->name . '_show_control');
     Configuration::deleteByName($this->name . '_min_item');
     Configuration::deleteByName($this->name . '_max_item');
     Configuration::deleteByName($this->name . '_mode_dir');
     include dirname(__FILE__) . '/sql/uninstall_sql.php';
     foreach ($sql as $s) {
         if (!Db::getInstance()->execute($s)) {
             return false;
         }
     }
     // Uninstall Module
     if (!parent::uninstall()) {
         return false;
     }
     // !$this->unregisterHook('actionObjectExampleDataAddAfter')
     return true;
 }
Beispiel #7
0
function upgrade_module_1_0_3($object)
{
    $sql = array();
    $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'simpleblog_tag` (
            `id_simpleblog_tag` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT,
            `id_lang` INT( 11 ) unsigned NOT NULL,
            `name` VARCHAR(60) NOT NULL,
            PRIMARY KEY (`id_simpleblog_tag`)
        ) ENGINE = ' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8';
    $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'simpleblog_post_tag` (
            `id_simpleblog_post` INT( 11 ) unsigned NOT NULL,
            `id_simpleblog_tag` INT( 11 ) unsigned NOT NULL,
            PRIMARY KEY (`id_simpleblog_tag`)
        ) ENGINE = ' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8';
    foreach ($sql as $s) {
        if (!Db::getInstance()->Execute($s)) {
            return false;
        }
    }
    $context = Context::getContext();
    $tab = new Tab();
    $tab->name[$context->language->id] = $object->l('Tags');
    $tab->class_name = 'AdminSimpleBlogTags';
    $tab->id_parent = Tab::getIdFromClassName('AdminSimpleBlog');
    $tab->module = $object->name;
    $tab->add();
    return true;
}
 public function updateCMSFields(FieldList $fields)
 {
     // vars
     $config = SiteConfig::current_site_config();
     $owner = $this->owner;
     // decode data into array
     $data = json_decode($owner->OpenGraphData, true);
     // @todo Add repair method if data is missing / corrupt ~ for fringe cases
     // tab
     $tab = new Tab('OpenGraph');
     // add disabled/error state if `off`
     if ($data['og:type'] === 'off') {
         $tab->addExtraClass('error');
     }
     // add the tab
     $fields->addFieldToTab('Root.Metadata', $tab, 'FullOutput');
     // new identity
     $tab = 'Root.Metadata.OpenGraph';
     // add description
     // type always visible
     $fields->addFieldsToTab($tab, array(LabelField::create('OpenGraphHeader', '@todo Information</a>')->addExtraClass('information'), DropdownField::create('OpenGraphType', '<a href="http://ogp.me/#types">og:type</a>', self::$types, $data['og:type'])));
     if ($data['og:type'] !== 'off') {
         $fields->addFieldsToTab($tab, array(ReadonlyField::create('OpenGraphURL', 'Canonical URL', $owner->AbsoluteLink()), TextField::create('OpenGraphSiteName', 'Site Name', $data['og:site_name'])->setAttribute('placeholder', $config->Title), TextField::create('OpenGraphTitle', 'Page Title', $data['og:title'])->setAttribute('placeholder', $owner->Title), TextareaField::create('OpenGraphDescription', 'Description', $data['og:description'])->setAttribute('placeholder', $owner->GenerateDescription()), UploadField::create('OpenGraphImage', 'Image<pre>type: png/jpg/gif</pre><pre>size: variable *</pre>', $owner->OpenGraphImage)->setAllowedExtensions(array('png', 'jpg', 'jpeg', 'gif'))->setFolderName(self::$SEOOpenGraphUpload . $owner->Title)->setDescription('* <a href="https://developers.facebook.com/docs/sharing/best-practices#images" target="_blank">Facebook image best practices</a>, or use any preferred Open Graph guide.')));
     }
 }
Beispiel #9
0
 public function uninstall()
 {
     Configuration::deleteByName('POSSEQUENCE');
     // Uninstall Tabs
     //$tab = new Tab((int)Tab::getIdFromClassName('AdminPosMenu'));
     //$tab->delete();
     $tab = new Tab((int) Tab::getIdFromClassName('AdminPossequence'));
     $tab->delete();
     Configuration::deleteByName($this->name . '_pause_time');
     Configuration::deleteByName($this->name . '_animation_speed');
     Configuration::deleteByName($this->name . '_show_arrow');
     Configuration::deleteByName($this->name . '_show_navigation');
     Configuration::deleteByName($this->name . '_auto_slide');
     //uninstall db
     include dirname(__FILE__) . '/sql/uninstall_sql.php';
     foreach ($sql as $s) {
         if (!Db::getInstance()->execute($s)) {
             return false;
         }
     }
     // Uninstall Module
     if (!parent::uninstall()) {
         return false;
     }
     // !$this->unregisterHook('actionObjectExampleDataAddAfter')
     return true;
 }
 public function getEditForm($id = null, $fields = null)
 {
     // TODO Duplicate record fetching (see parent implementation)
     if (!$id) {
         $id = $this->currentPageID();
     }
     $form = parent::getEditForm($id);
     // TODO Duplicate record fetching (see parent implementation)
     $record = $this->getRecord($id);
     if ($record && !$record->canView()) {
         return Security::permissionFailure($this);
     }
     $memberList = GridField::create('Members', false, Member::get(), $memberListConfig = GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldButtonRow('after'))->addComponent(new GridFieldExportButton('buttons-after-left')))->addExtraClass("members_grid");
     if ($record && method_exists($record, 'getValidator')) {
         $validator = $record->getValidator();
     } else {
         $validator = Injector::inst()->get('Member')->getValidator();
     }
     $memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator($validator);
     $groupList = GridField::create('Groups', false, Group::get(), GridFieldConfig_RecordEditor::create());
     $columns = $groupList->getConfig()->getComponentByType('GridFieldDataColumns');
     $columns->setDisplayFields(array('Breadcrumbs' => singleton('Group')->fieldLabel('Title')));
     $columns->setFieldFormatting(array('Breadcrumbs' => function ($val, $item) {
         return Convert::raw2xml($item->getBreadcrumbs(' > '));
     }));
     $fields = new FieldList($root = new TabSet('Root', $usersTab = new Tab('Users', _t('SecurityAdmin.Users', 'Users'), $memberList, new LiteralField('MembersCautionText', sprintf('<p class="caution-remove"><strong>%s</strong></p>', _t('SecurityAdmin.MemberListCaution', 'Caution: Removing members from this list will remove them from all groups and the' . ' database')))), $groupsTab = new Tab('Groups', singleton('Group')->i18n_plural_name(), $groupList)), new HiddenField('ID', false, 0));
     // Add import capabilities. Limit to admin since the import logic can affect assigned permissions
     if (Permission::check('ADMIN')) {
         $fields->addFieldsToTab('Root.Users', array(new HeaderField(_t('SecurityAdmin.IMPORTUSERS', 'Import users'), 3), new LiteralField('MemberImportFormIframe', sprintf('<iframe src="%s" id="MemberImportFormIframe" width="100%%" height="250px" frameBorder="0">' . '</iframe>', $this->Link('memberimport')))));
         $fields->addFieldsToTab('Root.Groups', array(new HeaderField(_t('SecurityAdmin.IMPORTGROUPS', 'Import groups'), 3), new LiteralField('GroupImportFormIframe', sprintf('<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="250px" frameBorder="0">' . '</iframe>', $this->Link('groupimport')))));
     }
     // Tab nav in CMS is rendered through separate template
     $root->setTemplate('CMSTabSet');
     // Add roles editing interface
     if (Permission::check('APPLY_ROLES')) {
         $rolesField = GridField::create('Roles', false, PermissionRole::get(), GridFieldConfig_RecordEditor::create());
         $rolesTab = $fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.TABROLES', 'Roles'));
         $rolesTab->push($rolesField);
     }
     $actionParam = $this->getRequest()->param('Action');
     if ($actionParam == 'groups') {
         $groupsTab->addExtraClass('ui-state-active');
     } elseif ($actionParam == 'users') {
         $usersTab->addExtraClass('ui-state-active');
     } elseif ($actionParam == 'roles') {
         $rolesTab->addExtraClass('ui-state-active');
     }
     $actions = new FieldList();
     $form = Form::create($this, 'EditForm', $fields, $actions)->setHTMLID('Form_EditForm');
     $form->addExtraClass('cms-edit-form');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     // Tab nav in CMS is rendered through separate template
     if ($form->Fields()->hasTabset()) {
         $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
     }
     $form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses());
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $this->extend('updateEditForm', $form);
     return $form;
 }
 /**
  * Gets the form fields as defined through the metadata
  * on {@link $obj} and the custom parameters passed to FormScaffolder.
  * Depending on those parameters, the fields can be used in ajax-context,
  * contain {@link TabSet}s etc.
  * 
  * @return FieldList
  */
 public function getFieldList()
 {
     $fields = new FieldList();
     // tabbed or untabbed
     if ($this->tabbed) {
         $fields->push(new TabSet("Root", $mainTab = new Tab("Main")));
         $mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
     }
     //var_dump($this->obj->db());exit();
     // add database fields
     foreach ($this->obj->db() as $fieldName => $fieldType) {
         if ($this->restrictFields && !in_array($fieldName, $this->restrictFields)) {
             continue;
         }
         // @todo Pass localized title
         if ($this->fieldClasses && isset($this->fieldClasses[$fieldName])) {
             $fieldClass = $this->fieldClasses[$fieldName];
             $fieldObject = new $fieldClass($fieldName);
         } else {
             $fieldObject = $this->obj->dbObject($fieldName)->scaffoldFormField(null, $this->getParamsArray());
         }
         $fieldObject->setTitle($this->obj->fieldLabel($fieldName));
         if ($this->tabbed) {
             $fields->addFieldToTab("Root.Main", $fieldObject);
         } else {
             $fields->push($fieldObject);
         }
     }
     return $fields;
 }
Beispiel #12
0
 /**
  * View users profile
  */
 public function action_index()
 {
     $id = $this->request->param('id');
     $user = ORM::factory('User', $id);
     if (!$user->loaded()) {
         throw HTTP_Exception::Factory('404', 'No such user');
     }
     $container = new Tabs();
     $about = new Tab('About me');
     $about->add_content(new Tab_Text($user->get_property('about')));
     $about->add_content(new Tab_Text($user->get_property('signature')));
     $container->add_tab($about);
     Event::fire('user.profile_tabs', array($user, $container));
     $this->view = new View_User_Profile();
     $this->view->user = $user;
     $this->view->tabs = $container->render();
     /*
     // @TODO, This belongs to the pet module, better to use events?
     $pets = ORM::factory('User_Pet')
     	->where('user_id', '=', $user->id)
     	->order_by('active', 'desc');
     
     $paginate = Paginate::factory($pets)
     	->execute();
     
     $this->view = new View_User_Profile;
     $this->view->pagination = $paginate->render();
     $this->view->profile_user = $user;
     // $this->view->pets = ORM::factory('User_Pet')->where('user_id', '=', $user->id)->order_by('active', 'desc')->find_all()->as_array();
     $this->view->pets = $paginate->result();
     */
 }
 /**
  * @return boolean
  */
 public function install()
 {
     if (Shop::isFeatureActive()) {
         Shop::setContext(Shop::CONTEXT_ALL);
     }
     // Install invisible tab
     $tab = new Tab();
     $tab->name[$this->context->language->id] = $this->l('SecurionPay');
     $tab->class_name = 'AdminSecurionPay';
     $tab->id_parent = -1;
     // No parent tab
     $tab->module = $this->name;
     $tab->add();
     //Init
     Configuration::updateValue('SECURIONPAY_CONF', '');
     if (!parent::install()) {
         return false;
     }
     if (!Configuration::updateValue(self::MODE, self::MODE_TEST)) {
         return false;
     }
     if (!$this->registerHook('payment') || !$this->registerHook('displayAdminOrder')) {
         return false;
     }
     return true;
 }
Beispiel #14
0
 /**
  * Get the fields that are sent to the CMS. In
  * your decorators: updateCMSFields(&$fields)
  *
  * @return Fieldset
  */
 function getCMSFields()
 {
     Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js");
     $fields = new FieldSet(new TabSet("Root", $tabMain = new Tab('Main', $titleField = new TextField("Title", _t('SiteConfig.SITETITLE', "Site title")), $taglineField = new TextField("Tagline", _t('SiteConfig.SITETAGLINE', "Site Tagline/Slogan")), new DropdownField("Theme", _t('SiteConfig.THEME', 'Theme'), $this->getAvailableThemes(), '', null, _t('SiteConfig.DEFAULTTHEME', '(Use default theme)'))), $tabAccess = new Tab('Access', new HeaderField('WhoCanViewHeader', _t('SiteConfig.VIEWHEADER', "Who can view pages on this site?"), 2), $viewersOptionsField = new OptionsetField("CanViewType"), $viewerGroupsField = new TreeMultiselectField("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups")), new HeaderField('WhoCanEditHeader', _t('SiteConfig.EDITHEADER', "Who can edit pages on this site?"), 2), $editorsOptionsField = new OptionsetField("CanEditType"), $editorGroupsField = new TreeMultiselectField("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups")), new HeaderField('WhoCanCreateTopLevelHeader', _t('SiteConfig.TOPLEVELCREATE', "Who can create pages in the root of the site?"), 2), $topLevelCreatorsOptionsField = new OptionsetField("CanCreateTopLevelType"), $topLevelCreatorsGroupsField = new TreeMultiselectField("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators")))));
     $viewersOptionsSource = array();
     $viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone");
     $viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users");
     $viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)");
     $viewersOptionsField->setSource($viewersOptionsSource);
     $editorsOptionsSource = array();
     $editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS");
     $editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)");
     $editorsOptionsField->setSource($editorsOptionsSource);
     $topLevelCreatorsOptionsField->setSource($editorsOptionsSource);
     // Translatable doesn't handle updateCMSFields on DataObjects,
     // so add it here to save the current Locale,
     // because onBeforeWrite does not work.
     if (Object::has_extension('SiteConfig', "Translatable")) {
         $fields->push(new HiddenField("Locale"));
     }
     if (!Permission::check('EDIT_SITECONFIG')) {
         $fields->makeFieldReadonly($viewersOptionsField);
         $fields->makeFieldReadonly($viewerGroupsField);
         $fields->makeFieldReadonly($editorsOptionsField);
         $fields->makeFieldReadonly($editorGroupsField);
         $fields->makeFieldReadonly($topLevelCreatorsOptionsField);
         $fields->makeFieldReadonly($topLevelCreatorsGroupsField);
         $fields->makeFieldReadonly($taglineField);
         $fields->makeFieldReadonly($titleField);
     }
     $tabMain->setTitle(_t('SiteConfig.TABMAIN', "Main"));
     $tabAccess->setTitle(_t('SiteConfig.TABACCESS', "Access"));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
Beispiel #15
0
 /**
  * format() should return string if format is html
  */
 public function testFormat_returnsString_ifFormatIsText()
 {
     $word = new Tab();
     $expected = "\t";
     $actual = $word->format('text');
     $this->assertEquals($expected, $actual);
     return;
 }
Beispiel #16
0
 function getCMSFields()
 {
     Requirements::javascript("sapphire/javascript/RedirectorPage.js");
     $fields = new FieldSet(new TabSet("Root", $tabContent = new Tab("Content", new TextField("Title", _t('SiteTree.PAGETITLE')), new TextField("MenuTitle", _t('SiteTree.MENUTITLE')), new FieldGroup(_t('SiteTree.URL'), new LabelField("http://www.yoursite.com/"), new TextField("URLSegment", ""), new LabelField("/")), new HeaderField(_t('RedirectorPage.HEADER', "This page will redirect users to another page")), new OptionsetField("RedirectionType", _t('RedirectorPage.REDIRECTTO', "Redirect to"), array("Internal" => _t('RedirectorPage.REDIRECTTOPAGE', "A page on your website"), "External" => _t('RedirectorPage.REDIRECTTOEXTERNAL', "Another website")), "Internal"), new TreeDropdownField("LinkToID", _t('RedirectorPage.YOURPAGE', "Page on your website"), "SiteTree"), new TextField("ExternalURL", _t('RedirectorPage.OTHERURL', "Other website URL")), new TextareaField("MetaDescription", _t('SiteTree.METADESC'))), $tabBehaviour = new Tab("Behaviour", new DropdownField("ClassName", _t('SiteTree.PAGETYPE'), $this->getClassDropdown()), new CheckboxField("ShowInMenus", _t('SiteTree.SHOWINMENUS')), new CheckboxField("ShowInSearch", _t('SiteTree.SHOWINSEARCH')))));
     $tabContent->setTitle(_t('SiteTree.TABCONTENT'));
     $tabBehaviour->setTitle(_t('SiteTree.TABBEHAVIOUR'));
     return $fields;
 }
 public function getCMSFields()
 {
     $existing_customer = $this->config()->existing_customer_class;
     // Manually inject HTML for totals as Silverstripe refuses to
     // render Currency.Nice any other way.
     $subtotal_html = '<div id="SubTotal" class="field readonly">';
     $subtotal_html .= '<label class="left" for="Form_ItemEditForm_SubTotal">';
     $subtotal_html .= _t("Orders.SubTotal", "Sub Total");
     $subtotal_html .= '</label>';
     $subtotal_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_SubTotal" class="readonly">';
     $subtotal_html .= $this->SubTotal->Nice();
     $subtotal_html .= '</span></div></div>';
     $discount_html = '<div id="Discount" class="field readonly">';
     $discount_html .= '<label class="left" for="Form_ItemEditForm_Discount">';
     $discount_html .= _t("Orders.Discount", "Discount");
     $discount_html .= '</label>';
     $discount_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_Discount" class="readonly">';
     $discount_html .= $this->dbObject("DiscountAmount")->Nice();
     $discount_html .= '</span></div></div>';
     $postage_html = '<div id="Postage" class="field readonly">';
     $postage_html .= '<label class="left" for="Form_ItemEditForm_Postage">';
     $postage_html .= _t("Orders.Postage", "Postage");
     $postage_html .= '</label>';
     $postage_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_Postage" class="readonly">';
     $postage_html .= $this->Postage->Nice();
     $postage_html .= '</span></div></div>';
     $tax_html = '<div id="TaxTotal" class="field readonly">';
     $tax_html .= '<label class="left" for="Form_ItemEditForm_TaxTotal">';
     $tax_html .= _t("Orders.Tax", "Tax");
     $tax_html .= '</label>';
     $tax_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_TaxTotal" class="readonly">';
     $tax_html .= $this->TaxTotal->Nice();
     $tax_html .= '</span></div></div>';
     $total_html = '<div id="Total" class="field readonly">';
     $total_html .= '<label class="left" for="Form_ItemEditForm_Total">';
     $total_html .= _t("Orders.Total", "Total");
     $total_html .= '</label>';
     $total_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_Total" class="readonly">';
     $total_html .= $this->Total->Nice();
     $total_html .= '</span></div></div>';
     $fields = new FieldList($tab_root = new TabSet("Root", $tab_main = new Tab('Main', new OrderItemGridField("Items", "", $this->Items(), $config = GridFieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldTitleHeader(), new GridFieldEditableColumns(), new GridFieldDeleteAction(), new GridFieldAddOrderItem())), new HeaderField("PostageDetailsHeader", _t("Orders.PostageDetails", "Postage Details")), TextField::create("PostageType"), TextField::create("PostageCost"), TextField::create("PostageTax"), new HeaderField("DiscountDetailsHeader", _t("Orders.DiscountDetails", "Discount")), TextField::create("Discount"), TextField::create("DiscountAmount"), OrderSidebar::create(ReadonlyField::create("QuoteNumber", "#")->setValue($this->ID), LiteralField::create("SubTotal", $subtotal_html), LiteralField::create("Discount", $discount_html), LiteralField::create("Postage", $postage_html), LiteralField::create("TaxTotal", $tax_html), LiteralField::create("Total", $total_html))->setTitle("Details")), $tab_customer = new Tab('Customer', TextField::create("Company"), TextField::create("FirstName"), TextField::create("Surname"), TextField::create("Address1"), TextField::create("Address2"), TextField::create("City"), TextField::create("PostCode"), TextField::create("Country"), TextField::create("Email"), TextField::create("PhoneNumber"))));
     if ($this->canEdit()) {
         // Sidebar
         $tab_customer->insertBefore(CustomerSidebar::create(new GridField("ExistingCustomers", "", $existing_customer::get(), $config = GridFieldConfig_Base::create()->addComponents($map_extension = new GridFieldMapExistingAction())))->setTitle("Use Existing Customer"), "Company");
         if (is_array($this->config()->existing_customer_fields)) {
             $columns = $config->getComponentByType("GridFieldDataColumns");
             if ($columns) {
                 $columns->setDisplayFields($this->config()->existing_customer_fields);
             }
         }
         // Set the record ID
         $map_extension->setMapFields($this->config()->existing_customer_map);
     }
     $tab_main->addExtraClass("order-admin-items");
     $tab_customer->addExtraClass("order-admin-customer");
     $this->extend("updateCMSFields", $fields);
     return $fields;
 }
Beispiel #18
0
 public function uninstallAdminTab($class_name)
 {
     $id_tab = (int) Tab::getIdFromClassName($class_name);
     if ($id_tab) {
         $tab = new Tab($id_tab);
         return $tab->delete();
     }
     return false;
 }
Beispiel #19
0
 public function getCMSFields()
 {
     $fields = FieldList::create();
     $fields->push(TabSet::create('Root', $mainTab = new Tab('Main')));
     $mainTab->setTitle(_t('SiteTree.TABMAIN', "Main"));
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Title', _t('Block.TITLE', 'Title'))));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
Beispiel #20
0
 public function uninstall()
 {
     $id_tab = (int) Tab::getIdFromClassName('AdminDashgoals');
     if ($id_tab) {
         $tab = new Tab($id_tab);
         $tab->delete();
     }
     return parent::uninstall();
 }
Beispiel #21
0
 public function uninstallTab()
 {
     $id_tab = (int) Tab::getIdFromClassName('AdminOnboarding');
     if ($id_tab) {
         $tab = new Tab($id_tab);
         return $tab->delete();
     } else {
         return false;
     }
 }
Beispiel #22
0
 private function uninstallModuleTab($tabClass)
 {
     $idTab = Tab::getIdFromClassName($tabClass);
     if ($idTab != 0) {
         $tab = new Tab($idTab);
         $tab->delete();
         return true;
     }
     return false;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab("Root", $subscriptionTab = new Tab(_t('Newsletter.SUBSCRIPTIONFORM', 'SubscriptionForm')));
     Requirements::javascript('newsletter/javascript/SubscriptionPage.js');
     Requirements::css('newsletter/css/SubscriptionPage.css');
     $subscriptionTab->push(new HeaderField("SubscriptionFormConfig", _t('Newsletter.SUBSCRIPTIONFORMCONFIGURATION', "Subscription Form Configuration")));
     $subscriptionTab->push(new TextField('CustomisedHeading', 'Heading at the top of the form'));
     //Fields selction
     $frontFields = singleton('Recipient')->getFrontEndFields()->dataFields();
     $fieldCandidates = array();
     if (count($frontFields)) {
         foreach ($frontFields as $fieldName => $dataField) {
             $fieldCandidates[$fieldName] = $dataField->Title() ? $dataField->Title() : $dataField->Name();
         }
     }
     //Since Email field is the Recipient's identifier,
     //and newsletters subscription is non-sence if no email is given by the user,
     //we should force that email to be checked and required.
     //FisrtName should be checked as default, though it might not be required
     $defaults = array("Email", "FirstName");
     $extra = array('CustomLabel' => "Varchar", "ValidationMessage" => "Varchar", "Required" => "Boolean");
     $extraValue = array('CustomLabel' => $this->CustomLabel, "ValidationMessage" => $this->ValidationMessage, "Required" => $this->Required);
     $subscriptionTab->push($fieldsSelection = new CheckboxSetWithExtraField("Fields", _t('Newsletter.SelectFields', "Select the fields to display on the subscription form"), $fieldCandidates, $extra, $defaults, $extraValue));
     $fieldsSelection->setCellDisabled(array("Email" => array("Value", "Required")));
     //Mailing Lists selection
     $mailinglists = MailingList::get();
     $newsletterSelection = $mailinglists && $mailinglists->count() ? new CheckboxSetField("MailingLists", _t("Newsletter.SubscribeTo", "Newsletters to subscribe to"), $mailinglists->map('ID', 'FullTitle'), $mailinglists) : new LiteralField("NoMailingList", sprintf('<p>%s</p>', sprintf('You haven\'t defined any mailing list yet, please go to ' . '<a href=\\"%s\\">the newsletter administration area</a> ' . 'to define a mailing list.', singleton('NewsletterAdmin')->Link())));
     $subscriptionTab->push($newsletterSelection);
     $subscriptionTab->push(new TextField("SubmissionButtonText", "Submit Button Text"));
     $subscriptionTab->push(new LiteralField('BottomTaskSelection', sprintf('<div id="SendNotificationControlls" class="field actions">' . '<label class="left">%s</label>' . '<ul><li class="ss-ui-button no" data-panel="no">%s</li>' . '<li class="ss-ui-button yes" data-panel="yes">%s</li>' . '</ul></div>', _t('Newsletter.SendNotif', 'Send notification email to the subscriber'), _t('Newsletter.No', 'No'), _t('Newsletter.Yes', 'Yes'))));
     $subscriptionTab->push(CompositeField::create(new HiddenField("SendNotification", "Send Notification"), new TextField("NotificationEmailSubject", _t('Newsletter.NotifSubject', "Notification Email Subject Line")), new TextField("NotificationEmailFrom", _t('Newsletter.FromNotif', "From Email Address for Notification Email")))->addExtraClass('SendNotificationControlledPanel'));
     $subscriptionTab->push(new HtmlEditorField('OnCompleteMessage', _t('Newsletter.OnCompletion', 'Message shown on subscription completion')));
     return $fields;
 }
Beispiel #24
0
 /**
  * Returns a FieldSet with which to create the CMS editing form.
  * You can use the extend() method of FieldSet to create customised forms for your other
  * data objects.
  */
 function getCMSFields($controller = null)
 {
     require_once "forms/Form.php";
     $group = DataObject::get_by_id("Group", $this->Parent()->GroupID);
     $sent_status_report = $this->renderWith("Newsletter_SentStatusReport");
     $ret = new FieldSet(new TabSet("Root", $mailTab = new Tab(_t('Newsletter.NEWSLETTER', 'Newsletter'), new TextField("Subject", _t('Newsletter.SUBJECT', 'Subject'), $this->Subject), new HtmlEditorField("Content", _t('Newsletter.CONTENT', 'Content'))), $sentToTab = new Tab(_t('Newsletter.SENTREPORT', 'Sent Status Report'), new LiteralField("Sent Status Report", $sent_status_report))));
     if ($this->Status != 'Draft') {
         $mailTab->push(new ReadonlyField("SendDate", _t('Newsletter.SENTAT', 'Sent at'), $this->SendDate));
     }
     return $ret;
 }
 public function uninstall()
 {
     // Database Table
     include dirname(__FILE__) . '/sql/uninstall.php';
     // Module Tab
     if ($id_tab = (int) Tab::getIdFromClassName('AdminAutozip')) {
         $tab = new Tab($id_tab);
         $tab->delete();
     }
     return parent::uninstall();
 }
Beispiel #26
0
 public function uninstall()
 {
     $id_tab = (int) Tab::getIdFromClassName('AdminBlockCategories');
     if ($id_tab) {
         $tab = new Tab($id_tab);
         $tab->delete();
     }
     if (!parent::uninstall() || !Configuration::deleteByName('BLOCK_CATEG_MAX_DEPTH') || !Configuration::deleteByName('BLOCK_CATEG_DHTML') || !Configuration::deleteByName('BLOCK_CATEG_ROOT_CATEGORY')) {
         return false;
     }
     return true;
 }
Beispiel #27
0
function upgrade_module_1_0_3($object)
{
    $idTabs = array();
    $idTabs[] = Tab::getIdFromClassName('AdminSimpleBlogRelatedPosts');
    foreach ($idTabs as $idTab) {
        if ($idTab) {
            $tab = new Tab($idTab);
            $tab->delete();
        }
    }
    return true;
}
Beispiel #28
0
 public function removeAdminTab()
 {
     $adminTabId = Configuration::get('ADMIN_TAB_MODULE_MAPPA');
     if (Tab::existsInDatabase($adminTabId, Tab::$definition['table'])) {
         $adminTab = new Tab($adminTabId);
         if (!$adminTab->delete()) {
             return false;
         }
         return Configuration::deleteByName('ADMIN_TAB_MODULE_MAPPA');
     }
     return true;
 }
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
        Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
        Requirements::javascript('memberprofiles/javascript/MemberProfilePageCms.js');
        // Setup tabs
        $fields->addFieldToTab('Root', $profile = new TabSet('Profile'), 'Content');
        $fields->addFieldToTab('Root', $email = new Tab('Email'), 'Behaviour');
        $profile->setTitle(_t('MemberProfiles.PROFILE', 'Profile'));
        $email->setTitle(_t('MemberProfiles.EMAIL', 'Email'));
        $fields->findOrMakeTab('Root.Profile.Fields', _t('MemberProfiles.FIELDS', 'Fields'));
        $fields->findOrMakeTab('Root.Profile.Groups', _t('MemberProfiles.GROUPS', 'Groups'));
        $fields->findOrMakeTab('Root.Profile.PublicProfile', _t('MemberProfiles.PUBLICPROFILE', 'Public Profile'));
        // Profile fields
        $fields->addFieldsToTab('Root.Profile.Fields', array(new HeaderField('ProfileFieldsHeader', _t('MemberProfiles.PROFILEFIELDS', 'Profile Fields')), $table = new OrderableComplexTableField($this, 'Fields', 'MemberProfileField')));
        $table->setPermissions(array('show', 'edit'));
        $table->setCustomSourceItems($this->getProfileFields());
        // Groups
        $fields->addFieldsToTab('Root.Profile.Groups', array(new HeaderField('GroupsHeader', _t('MemberProfiles.GROUPASSIGNMENT', 'Group Assignment')), new LiteralField('GroupsNote', '<p>' . _t('MemberProfiles.GROUPSNOTE', 'Any users registering via this page will always be added to ' . 'the below groups (if registration is enabled). Conversely, a ' . 'member must belong to these groups in order to edit their ' . 'profile on this page.') . '</p>'), new CheckboxSetField('Groups', '', DataObject::get('Group')->map()), new HeaderField('SelectableGroupsHeader', _t('MemberProfiles.USERSELECTABLE', 'User Selectable')), new LiteralField('SelectableGroupsNote', '<p>' . _t('MemberProfiles.SELECTABLEGROUPSNOTE', 'Users can choose to belong to the following groups, if the ' . '"Groups" field is enabled in the "Fields" tab.') . '</p>'), new CheckboxSetField('SelectableGroups', '', DataObject::get('Group')->map())));
        // Public profile
        $fields->addFieldsToTab('Root.Profile.PublicProfile', array(new HeaderField('PublicProfileHeader', _t('MemberProfiles.PUBLICPROFILE', 'Public Profile')), new CheckboxField('AllowProfileViewing', _t('MemberProfiles.ALLOWPROFILEVIEWING', 'Allow people to view user profiles.')), new HeaderField('ProfileSectionsHeader', _t('MemberProfiles.PROFILESECTIONS', 'Profile Sections')), new MemberProfileSectionField($this, 'Sections', 'MemberProfileSection')));
        // Email confirmation and validation
        $fields->addFieldsToTab('Root.Email', array(new HeaderField('EmailHeader', 'Email Confirmation and Validation'), new OptionSetField('EmailType', '', array('Validation' => 'Require email validation to activate an account', 'Confirmation' => 'Send a confirmation email after a user registers', 'None' => 'Do not send any emails')), new ToggleCompositeField('EmailContent', 'Email Content', array(new TextField('EmailSubject', 'Email subject'), new TextField('EmailFrom', 'Email from'), new TextareaField('EmailTemplate', 'Email template'), new LiteralField('TemplateNote', MemberConfirmationEmail::TEMPLATE_NOTE))), new ToggleCompositeField('ConfirmationContent', 'Confirmation Content', array(new LiteralField('ConfirmationNote', '<p>This content is dispayed when
					a user confirms their account.</p>'), new TextField('ConfirmationTitle', 'Title'), new HtmlEditorField('ConfirmationContent', 'Content')))));
        // Content
        $fields->removeFieldFromTab('Root.Content.Main', 'Content');
        $fields->addFieldToTab('Root.Content', $profileContent = new Tab('Profile'), 'Metadata');
        $fields->addFieldToTab('Root.Content', $regContent = new Tab('Registration'), 'Metadata');
        $fields->addFieldToTab('Root.Content', $afterReg = new Tab('AfterRegistration'), 'Metadata');
        $profileContent->setTitle(_t('MemberProfiles.PROFILE', 'Profile'));
        $regContent->setTitle(_t('MemberProfiles.REGISTRATION', 'Registration'));
        $afterReg->setTitle(_t('MemberProfiles.AFTERREG', 'After Registration'));
        $tabs = array('Profile', 'Registration', 'AfterRegistration');
        foreach ($tabs as $tab) {
            $fields->addFieldsToTab("Root.Content.{$tab}", array(new TextField("{$tab}Title", _t('MemberProfiles.TITLE', 'Title')), new HtmlEditorField("{$tab}Content", _t('MemberProfiles.CONTENT', 'Content'))));
        }
        $fields->addFieldToTab('Root.Content.AfterRegistration', new CheckboxField('RegistrationRedirect', _t('MemberProfiles.REDIRECT_AFTER_REG', 'Redirect after registration?')), 'AfterRegistrationContent');
        $fields->addFieldToTab('Root.Content.AfterRegistration', new TreeDropdownField('PostRegistrationTargetID', _t('MemberProfiles.REDIRECT_TARGET', 'Redirect to page'), 'SiteTree'), 'AfterRegistrationContent');
        // Behaviour
        $fields->addFieldToTab('Root.Behaviour', new HeaderField('ProfileBehaviour', _t('MemberProfiles.PROFILEBEHAVIOUR', 'Profile Behaviour')), 'ClassName');
        $fields->addFieldToTab('Root.Behaviour', new CheckboxField('AllowRegistration', _t('MemberProfiles.ALLOWREG', 'Allow registration via this page')), 'ClassName');
        $fields->addFieldToTab('Root.Behaviour', new CheckboxField('AllowProfileEditing', _t('MemberProfiles.ALLOWEDITING', 'Allow users to edit their own profile on this page')), 'ClassName');
        $fields->addFieldToTab('Root.Behaviour', new CheckboxField('AllowAdding', _t('MemberProfiles.ALLOWADD', 'Allow members with member creation permissions to add members via this page')), 'ClassName');
        $requireApproval = new CheckboxField('RequireApproval', _t('MemberProfiles.REQUIREREGAPPROVAL', 'Require registration approval by an administrator?'));
        $fields->addFieldToTab('Root.Behaviour', $requireApproval, 'ClassName');
        $approvalGroups = _t('MemberProfiles.NOTIFYTHESEGROUPS', 'Notify these groups to approve new registrations');
        $approvalGroups = new TreeMultiselectField('ApprovalGroups', $approvalGroups, 'Group');
        $fields->addFieldToTab('Root.Behaviour', $approvalGroups, 'ClassName');
        $pageSettings = new HeaderField('PageSettingsHeader', _t('MemberProfiles.PAGEBEHAVIOUR', 'Page Behaviour'));
        $fields->addFieldToTab('Root.Behaviour', $pageSettings, 'ClassName');
        return $fields;
    }
 public function getCMSFields()
 {
     $message = sprintf('<p>%s</p><p><a href="%2$s">%2$s</a></p>', _t('ElementVirtualLinked.DESCRIBE', 'This is a virtual copy of a block. To edit, visit'), $this->LinkedElement()->getEditLink());
     $fields = new FieldList(new TabSet('Root', $main = new Tab('Main')));
     if ($this->isInvalidPublishState()) {
         $warning = 'Error: The original block is not published. This block will not work on the live site until you click the link below and publish it.';
         $main->push(new LiteralField('WarningHeader', '<p class="message error">' . $warning . '</p>'));
     }
     $main->push(new LiteralField('Existing', $message));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }