/**
  * Adds token creation fields to CMS
  * 
  * @param FieldSet $fields
  * @return void
  */
 public function updateCMSFields(FieldSet &$fields)
 {
     // Only modify file objects with parent nodes
     if (!$this->owner instanceof Folder || !$this->owner->ID) {
         return;
     }
     // Only allow ADMIN and SECURE_FILE_SETTINGS members to edit these options
     if (!Permission::checkMember(Member::currentUser(), array('ADMIN', 'SECURE_FILE_SETTINGS'))) {
         return;
     }
     // Update Security Tab
     $secureFilesTab = $fields->findOrMakeTab('Root.' . _t('SecureFiles.SECUREFILETABNAME', 'Security'));
     $secureFilesTab->push(new HeaderField(_t('SecureFiles.TOKENACCESSTITLE', 'Token Access')));
     if (!$this->owner->containsFiles()) {
         $secureFilesTab->push(new ReadonlyField('DummyTokenList', '', _t('SecureFiles.NOFILESINFOLDER', 'There are no files in this folder.')));
         return;
     }
     $secureFilesTab->push($tokenList = new ComplexTableField($this->owner, 'ContainedFileTokens', 'SecureFileAccessToken', null, null, "File.ParentID = '{$this->owner->ID}'", $sourceSort = null, "JOIN File ON FileID = File.ID"));
     $tokenList->setParentIdName('FolderID');
     $tokenList->setRelationAutoSetting(false);
     // Remove add link if there are no files in this folder
     if (!$this->owner->containsFiles()) {
         $tokenList->setPermissions(array('edit', 'delete'));
     }
 }
 public function updateCMSFields(FieldSet $fields)
 {
     $service = singleton('WorkflowService');
     if ($effective = $service->getDefinitionFor($this->owner)) {
         $effectiveTitle = $effective->Title;
     } else {
         $effectiveTitle = _t('WorkflowApplicable.NONE', '(none)');
     }
     $allDefinitions = array(_t('WorkflowApplicable.INHERIT', 'Inherit from parent'));
     if ($definitions = $service->getDefinitions()) {
         $allDefinitions += $definitions->map();
     }
     $tab = $fields->fieldByName('Root') ? 'Root.Workflow' : 'BottomRoot.Workflow';
     $applyWorkflowField = null;
     $fields->addFieldToTab($tab, new HeaderField('AppliedWorkflowHeader', _t('WorkflowApplicable.APPLIEDWORKFLOW', 'Applied Workflow')));
     if (Permission::check('APPLY_WORKFLOW')) {
         $fields->addFieldToTab($tab, new DropdownField('WorkflowDefinitionID', _t('WorkflowApplicable.DEFINITION', 'Applied Workflow'), $allDefinitions));
     }
     $fields->addFieldToTab($tab, new ReadonlyField('EffectiveWorkflow', _t('WorkflowApplicable.EFFECTIVE_WORKFLOW', 'Effective Workflow'), $effectiveTitle));
     $fields->addFieldToTab($tab, new HeaderField('WorkflowLogHeader', _t('WorkflowApplicable.WORKFLOWLOG', 'Workflow Log')));
     $fields->addFieldToTab($tab, $logTable = new ComplexTableField($this->owner, 'WorkflowLog', 'WorkflowInstance', null, 'getActionsSummaryFields', sprintf('"TargetClass" = \'%s\' AND "TargetID" = %d', $this->owner->class, $this->owner->ID)));
     $logTable->setRelationAutoSetting(false);
     $logTable->setPermissions(array('show'));
     $logTable->setPopupSize(760, 420);
 }
 /**
  * Standard SS function
  * @return FieldSet
  **/
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeFieldFromTab('Root.Content.Messages.Messages.Actions', "ProceedToCheckoutLabel");
     $fields->removeFieldFromTab('Root.Content.Messages.Messages.Actions', "ContinueShoppingLabel");
     $fields->removeFieldFromTab('Root.Content.Messages.Messages.Actions', "ContinuePageID");
     $fields->removeFieldFromTab('Root.Content.Messages.Messages.Actions', "LoadOrderLinkLabel");
     $fields->removeFieldFromTab('Root.Content.Messages.Messages.Actions', "CurrentOrderLinkLabel");
     $fields->removeFieldFromTab('Root.Content.Messages.Messages.Actions', "SaveOrderLinkLabel");
     $fields->removeFieldFromTab('Root.Content.Messages.Messages.Actions', "DeleteOrderLinkLabel");
     $termsPageIDField = new OptionalTreeDropdownField('TermsPageID', _t("CheckoutPage.TERMSANDCONDITIONSPAGE", "Terms and conditions page (if any - to remove, delete message below)"), 'SiteTree');
     $fields->addFieldToTab('Root.Content.Process', $termsPageIDField);
     $fields->addFieldToTab('Root.Content.Process', new TextField('TermsAndConditionsMessage', _t("CheckoutPage.TERMSANDCONDITIONSMESSAGE", "Terms and conditions page message (shown if the user does not tick the box) - leave blank to allow customer to proceed without ticking the box")));
     $fields->addFieldToTab('Root.Content.Process', new CheckboxField('HasCheckoutSteps', _t("CheckoutPage.HASCHECKOUTSTEPS", "Checkout Process in Steps")));
     $fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('InvitationToCompleteOrder', _t("CheckoutPage.INVITATIONTOCOMPLETEORDER", 'Invitation to complete order ... shown when the customer can do a regular checkout'), $row = 4));
     //The Content field has a slightly different meaning for the Checkout Page.
     $fields->removeFieldFromTab('Root.Content.Main', "Content");
     $fields->addFieldToTab('Root.Content.Messages.Messages.AlwaysVisible', new HtmlEditorField('Content', _t("CheckoutPage.CONTENT", 'General note - always visible on the checkout page'), 7, 7));
     if (DataObject::get_one("OrderModifier_Descriptor")) {
         $orderModifierDescriptionField = new ComplexTableField($this, _t("CheckoutPage.ORDERMODIFIERDESCRIPTMESSAGES", "Messages relating to order form extras (e.g. tax or shipping)"), "OrderModifier_Descriptor");
         $orderModifierDescriptionField->setRelationAutoSetting(false);
         $orderModifierDescriptionField->setTitle(_t("CheckoutPage.ORDERMODIFIERDESCRIPTMESSAGES", "Messages relating to order form extras (e.g. tax or shipping)"));
         $orderModifierDescriptionField->setPermissions(array("show", "edit"));
         $fields->addFieldToTab('Root.Content.Messages.Messages.OrderExtras', $orderModifierDescriptionField);
     }
     if (DataObject::get_one("CheckoutPage_StepDescription")) {
         $checkoutStepDescriptionField = new ComplexTableField($this, _t("CheckoutPage.CHECKOUTSTEPESCRIPTIONS", "Checkout Step Descriptions"), "CheckoutPage_StepDescription");
         $checkoutStepDescriptionField->setRelationAutoSetting(false);
         $checkoutStepDescriptionField->setTitle(_t("CheckoutPage.CHECKOUTSTEPESCRIPTIONS", "Checkout Step Descriptions"));
         $checkoutStepDescriptionField->setPermissions(array("show", "edit"));
         $fields->addFieldToTab('Root.Content.Messages.Messages.CheckoutSteps', $checkoutStepDescriptionField);
     }
     return $fields;
 }
Esempio n. 4
0
 /**
  * Standard SS variable.
  */
 function getCMSFields()
 {
     //prevent calling updateCMSFields extend function too early
     $siteTreeFieldExtensions = $this->get_static('SiteTree', 'runCMSFieldsExtensions');
     $this->disableCMSFieldsExtensions();
     $fields = parent::getCMSFields();
     if ($siteTreeFieldExtensions) {
         $this->enableCMSFieldsExtensions();
     }
     $fields->replaceField('Root.Content.Main', new HTMLEditorField('Content', _t('Product.DESCRIPTION', 'Product Description'), 3));
     //NOTE: IMAGE FIELD WAS GIVING ERRORS IN ModelAdmin
     //$fields->addFieldToTab('Root.Content.Images', new TreeDropdownField('ImageID', _t('Product.IMAGE', 'Product Image'), "Image"));
     $fields->addFieldToTab('Root.Content.Images', new ImageField('Image', _t('Product.IMAGE', 'Product Image')));
     $fields->addFieldToTab('Root.Content.Details', new ReadonlyField('FullName', _t('Product.FULLNAME', 'Full Name')));
     $fields->addFieldToTab('Root.Content.Details', new CheckboxField('AllowPurchase', _t('Product.ALLOWPURCHASE', 'Allow product to be purchased'), 1));
     $fields->addFieldToTab('Root.Content.Details', new CheckboxField('FeaturedProduct', _t('Product.FEATURED', 'Featured Product')));
     $fields->addFieldToTab('Root.Content.Details', new NumericField('Price', _t('Product.PRICE', 'Price'), '', 12));
     $fields->addFieldToTab('Root.Content.Details', new TextField('InternalItemID', _t('Product.CODE', 'Product Code'), '', 30));
     if ($this->EcomConfig()->ProductsHaveWeight) {
         $fields->addFieldToTab('Root.Content.Details', new NumericField('Weight', _t('Product.WEIGHT', 'Weight')));
     }
     if ($this->EcomConfig()->ProductsHaveModelNames) {
         $fields->addFieldToTab('Root.Content.Details', new TextField('Model', _t('Product.MODEL', 'Model')));
     }
     if ($this->EcomConfig()->ProductsHaveQuantifiers) {
         $fields->addFieldToTab('Root.Content.Details', new TextField('Quantifier', _t('Product.QUANTIFIER', 'Quantifier (e.g. per kilo, per month, per dozen, each)')));
     }
     if ($this->EcomConfig()->ProductsAlsoInOtherGroups) {
         $fields->addFieldsToTab('Root.Content.AlsoShowHere', array(new HeaderField('ProductGroupsHeader', _t('Product.ALSOSHOWSIN', 'Also shows in ...')), $this->getProductGroupsTable()));
     }
     $orderTableField = new ComplexTableField($this, 'OrderItems', 'OrderItem', array('Order.ID' => '#', 'Order.Created' => 'When', 'Quantity' => 'Quantity'), new FieldSet(), "\"BuyableID\" = '" . $this->ID . "' AND \"BuyableClassName\" = '" . $this->ClassName . "'", "\"Created\" DESC");
     $orderTableField->setPermissions(array("show"));
     $orderTableField->setShowPagination(true);
     $orderTableField->setRelationAutoSetting(true);
     /*
     $orderTableField->addSummary(
     	_t("Product.TOTALCOUNT", "Total Count"),
     	array("TotalCount" => array("sum","Quantity->Nice"))
     );
     */
     $fields->addFieldToTab('Root.Content.Orders', $orderTableField);
     if ($siteTreeFieldExtensions) {
         $this->extend('updateCMSFields', $fields);
     }
     return $fields;
 }