public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->insertAfter(new ToggleCompositeField('AfterRegistrationContent', _t('EventRegistration.AFTER_REG_CONTENT', 'After Registration Content'), array(new TextField('AfterRegTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterRegContent', _t('EventRegistration.CONTENT', 'Content')))), 'Content');
     $fields->insertAfter(new ToggleCompositeField('AfterUnRegistrationContent', _t('EventRegistration.AFTER_UNREG_CONTENT', 'After Un-Registration Content'), array(new TextField('AfterUnregTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterUnregContent', _t('EventRegistration.CONTENT', 'Content')))), 'AfterRegistrationContent');
     if ($this->RegEmailConfirm) {
         $fields->addFieldToTab('Root.Main', new ToggleCompositeField('AfterRegistrationConfirmation', _t('EventRegistration.AFTER_REG_CONFIRM_CONTENT', 'After Registration Confirmation Content'), array(new TextField('AfterConfirmTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterConfirmContent', _t('EventRegistration.CONTENT', 'Content')))));
     }
     if ($this->UnRegEmailConfirm) {
         $fields->addFieldToTab('Root.Main', new ToggleCompositeField('AfterUnRegistrationConfirmation', _t('EventRegistration.AFTER_UNREG_CONFIRM_CONTENT', 'After Un-Registration Confirmation Content'), array(new TextField('AfterConfUnregTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterConfUnregContent', _t('EventRegistration.CONTENT', 'Content')))));
     }
     $fields->addFieldToTab('Root.Tickets', new GridField('Tickets', 'Ticket Types', $this->Tickets(), GridFieldConfig_RecordEditor::create()));
     $generators = ClassInfo::implementorsOf('EventRegistrationTicketGenerator');
     if ($generators) {
         foreach ($generators as $generator) {
             $instance = new $generator();
             $generators[$generator] = $instance->getGeneratorTitle();
         }
         $generator = new DropdownField('TicketGenerator', _t('EventRegistration.TICKET_GENERATOR', 'Ticket generator'), $generators);
         $generator->setEmptyString(_t('EventManagement.NONE', '(None)'));
         $generator->setDescription(_t('EventManagement.TICKET_GENERATOR_NOTE', 'The ticket generator is used to generate a ticket file for the user to download.'));
         $fields->addFieldToTab('Root.Tickets', $generator);
     }
     $regGridFieldConfig = GridFieldConfig_Base::create()->removeComponentsByType('GridFieldAddNewButton')->removeComponentsByType('GridFieldDeleteAction')->addComponents(new GridFieldButtonRow('after'), new GridFieldPrintButton('buttons-after-left'), new GridFieldExportButton('buttons-after-left'));
     $fields->addFieldsToTab('Root.Registrations', array(new GridField('Registrations', _t('EventManagement.REGISTRATIONS', 'Registrations'), $this->DateTimes()->relation('Registrations')->filter('Status', 'Valid'), $regGridFieldConfig), new GridField('CanceledRegistrations', _t('EventManagement.CANCELLATIONS', 'Cancellations'), $this->DateTimes()->relation('Registrations')->filter('Status', 'Canceled'), $regGridFieldConfig)));
     if ($this->RegEmailConfirm) {
         $fields->addFieldToTab('Root.Registrations', new ToggleCompositeField('UnconfirmedRegistrations', _t('EventManagement.UNCONFIRMED_REGISTRATIONS', 'Unconfirmed Registrations'), array(new GridField('UnconfirmedRegistrations', '', $this->DateTimes()->relation('Registrations')->filter('Status', 'Unconfirmed')))));
     }
     $fields->addFieldToTab('Root.Invitations', new GridField('Invitations', _t('EventManagement.INVITATIONS', 'Invitations'), $this->Invitations(), GridFieldConfig_RecordViewer::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new EventSendInvitationsButton($this))));
     return $fields;
 }
 public function getCMSFields($params = null)
 {
     //fields that shouldn't be changed once coupon is used
     $fields = new FieldList(array($tabset = new TabSet("Root", $maintab = new Tab("Main", TextField::create("Title"), CheckboxField::create("Active", "Active")->setDescription("Enable/disable all use of this discount."), HeaderField::create("ActionTitle", "Action", 3), $typefield = SelectionGroup::create("Type", array(new SelectionGroup_Item("Percent", $percentgroup = FieldGroup::create($percentfield = NumericField::create("Percent", "Percentage", "0.00")->setDescription("e.g. 0.05 = 5%, 0.5 = 50%, and 5 = 500%"), $maxamountfield = CurrencyField::create("MaxAmount", _t("MaxAmount", "Maximum Amount"))->setDescription("The total allowable discount. 0 means unlimited.")), "Discount by percentage"), new SelectionGroup_Item("Amount", $amountfield = CurrencyField::create("Amount", "Amount", "\$0.00"), "Discount by fixed amount")))->setTitle("Type"), OptionSetField::create("For", "Applies to", array("Order" => "Entire Order", "Cart" => "Cart Subtotal", "Shipping" => "Shipping Subtotal", "Items" => "Each Individual Item")), new Tab("Main", HeaderField::create("ConstraintsTitle", "Constraints", 3), LabelField::create("ConstraintsDescription", "Configure the requirements an order must meet for this discount to be valid:")), new TabSet("Constraints")))));
     if (!$this->isInDB()) {
         $fields->addFieldToTab("Root.Main", LiteralField::create("SaveNote", "<p class=\"message good\">More constraints will show up after you save for the first time.</p>"), "Constraints");
     }
     $this->extend("updateCMSFields", $fields, $params);
     if ($count = $this->getUseCount()) {
         $fields->addFieldsToTab("Root.Usage", array(HeaderField::create("UseCount", sprintf("This discount has been used {$count} time%s.", $count > 1 ? "s" : "")), HeaderField::create("TotalSavings", sprintf("A total of %s has been saved by customers using this discount.", $this->SavingsTotal), "3"), GridField::create("Orders", "Orders", $this->getAppliedOrders(), GridFieldConfig_RecordViewer::create()->removeComponentsByType("GridFieldViewButton"))));
     }
     if ($params && isset($params['forcetype'])) {
         $valuefield = $params['forcetype'] == "Percent" ? $percentfield : $amountfield;
         $fields->insertAfter($valuefield, "Type");
         $fields->removeByName("Type");
     } elseif ($this->Type && (double) $this->{$this->Type}) {
         $valuefield = $this->Type == "Percent" ? $percentfield : $amountfield;
         $fields->removeByName("Type");
         $fields->insertAfter($valuefield, "ActionTitle");
         $fields->replaceField($this->Type, $valuefield->performReadonlyTransformation());
         if ($this->Type == "Percent") {
             $fields->insertAfter($maxamountfield, "Percent");
         }
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab('Root.Options', array(GridField::create('Options', 'Product Options', $this->Options(), GridFieldConfig_RecordViewer::create())));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->removeByName('Order');
        $fields->removeByName('Title');
        $fields->removeByName('ProcessInfo');
        $fields->removeByName('ParentProcessID');
        $fields->addFieldToTab('Root.Main', $processSteps = new CompositeField($title = new TextField('Title', 'Title')));
        $title->addExtraClass('process-noborder');
        $processSteps->addExtraClass('process-step');
        $fields->addFieldToTab('Root.Main', $processSteps = new CompositeField(new GridField('ProcessInfo', 'Information for this case', $this->ProcessInfo(), GridFieldConfig_RecordViewer::create())));
        $processes = Process::get();
        if ($processes) {
            $fields->insertAfter($inner = new CompositeField(new LiteralField('ExplainStop', '<label class="right">This must be set after you create a process</label>'), $processesOptions = new DropdownField('ParentProcessID', 'Process', $processes->map('ID', 'Title'))), 'Title');
            $inner->addExtraClass('message special');
        }
        $processSteps->addExtraClass('process-step');
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
				<span class="step-label">
					<span class="flyout">0.1</span><span class="arrow"></span>
					<span class="title">Case details</span>
				</span>
			</h3>'), 'Title');
        $fields->insertBefore(new LiteralField('StageTitle', '<h3 class="process-info-header">
				<span class="step-label">
					<span class="flyout">0.2</span><span class="arrow"></span>
					<span class="title">Associated Information Pieces</span>
				</span>
			</h3>'), 'ProcessInfo');
        return $fields;
    }
 public function getCMSFields()
 {
     $fields = new FieldList(TextField::create("MoneyValue", _t("Payment.MONEY", "Money"), $this->dbObject('Money')->Nice()), TextField::create("GatewayTitle", _t("Payment.GATEWAY", "Gateway")));
     $fields = $fields->makeReadonly();
     $fields->push(GridField::create("Messages", _t("Payment.MESSAGES", "Messages"), $this->Messages(), GridFieldConfig_RecordViewer::create()));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
Exemplo n.º 6
0
 public function getCMSFields()
 {
     $fields = new FieldList(TextField::create('MoneyValue', _t('Payment.db_Money', 'Money'), $this->dbObject('Money')->Nice()), TextField::create('GatewayTitle', _t('Payment.db_Gateway', 'Gateway')));
     $fields = $fields->makeReadonly();
     $fields->push(GridField::create('Messages', _t('Payment.has_many_Messages', 'Messages'), $this->Messages(), GridFieldConfig_RecordViewer::create()));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     //Get all data changes relating to this page filter them by publish/unpublish
     $dataChanges = DataChangeRecord::get()->filter('ClassID', $this->owner->ID)->exclude('ChangeType', 'Change');
     //create a gridfield out of them
     $gridFieldConfig = GridFieldConfig_RecordViewer::create();
     $publishedGrid = new GridField('PublishStates', 'Published States', $dataChanges, $gridFieldConfig);
     $dataColumns = $publishedGrid->getConfig()->getComponentByType('GridFieldDataColumns');
     $dataColumns->setDisplayFields(array('ChangeType' => 'Change Type', 'ObjectTitle' => 'Page Title', 'ChangedBy.Title' => 'User', 'Created' => 'Modification Date'));
     //linking through to the datachanges modeladmin
     $fields->addFieldsToTab('Root.PublishedState', $publishedGrid);
     return $fields;
 }
Exemplo n.º 8
0
 public function getCMSFields()
 {
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', $ddl_type = new DropdownField('Type', 'Type', singleton('RoomMetricType')->dbObject('Type')->enumValues()));
     $f->addFieldToTab('Root.Main', new TextField('Endpoint', 'Endpoint URL'));
     $f->addFieldToTab('Root.Main', new HiddenField('RoomID', 'RoomID'));
     $ddl_type->setEmptyString("-- SELECT A TYPE --");
     if ($this->ID > 0) {
         $config = GridFieldConfig_RecordViewer::create();
         $gridField = new GridField('Samples', 'Samples', $this->Samples(), $config);
         $f->addFieldToTab('Root.Main', $gridField);
     }
     return $f;
 }
 public function updateCMSFields(FieldList $fields)
 {
     if (!$this->owner instanceof Folder) {
         $showfields = array('Filename' => 'Filename', 'Created' => 'At time', 'Downloader' => 'Downloader');
         $records = FileDownloadRecord::get()->filter(array('FileID' => $this->owner->ID));
         $config = GridFieldConfig_RecordViewer::create();
         $colums = $config->getComponentByType('GridFieldDataColumns')->setDisplayFields($showfields);
         $grid = GridField::create('Downloads', 'Recorded downloads', $records, $config);
         $total = $records->count();
         $tf = TextField::create('DownloadTotal', _t('DownloadTrackable.TOTAL', 'Total'), $total);
         $tf = $tf->performReadonlyTransformation();
         $fields->addFieldToTab('Root.' . _t('DownloadTrackable.DOWNLOADTRACKINGTAB', 'Downloads'), $tf);
         $fields->addFieldToTab('Root.' . _t('DownloadTrackable.DOWNLOADTRACKINGTAB', 'Downloads'), $grid);
     }
 }
Exemplo n.º 10
0
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     $customer = $this->Customer();
     $fields = FieldList::create(Tabset::create("Root", Tabset::create("Order", Tab::create("CustomerDetails", HeaderField::create("Customer Selection"), CompositeField::create(DropdownField::create("CustomerID", $this->exists() ? "Customer" : "Select a Customer", Customer::get()->sort(array('Surname' => 'ASC', 'FirstName' => 'ASC'))->map())->setEmptyString("(Select a Customer)")->setRightTitle($this->exists() ? "To change the customer against this order select the new customer above (when editing from the\n\t\t\t\t\t\t\t\t'Store Orders' screen) and click save." : "Which customer is this order for?")), $this->exists() ? HeaderField::create("Customer Details") : null, $this->exists() ? CompositeField::create(ReadonlyField::create("Customer.FirstName", "First Name", $customer->FirstName), ReadonlyField::create("Customer.Surname", "Surname", $customer->Surname), ReadonlyField::create("Customer.CompanyName", "Company", $customer->CompanyName), ReadonlyField::create("Customer.Landline", "Landline Number", $customer->LandlineNumber), ReadonlyField::create("Customer.Mobile", "Mobile Number", $customer->MobileNumber)) : ""), Tab::create("OrderDetails", HeaderField::create("Order Details"), CompositeField::create(DropdownField::create("Status", "Order Status", Order_Statuses::get()->map()), DropdownField::create("BillingAddressID", "Billing Address", DataObject::get("Customer_AddressBook", "(`CustomerID`=" . $this->Customer()->ID . ")")->map())->setRightTitle("Customers' billing address.")->setEmptyString("(Select one)"), DropdownField::create("ShippingAddressID", "Shipping Address", DataObject::get("Customer_AddressBook", "(`CustomerID`=" . $this->Customer()->ID . ")")->map())->setRightTitle("Customers' shipping address.")->setEmptyString("(Select one)")), HeaderField::create("Order Items (Basket)"), CompositeField::create($items = GridField::create("OrderItems", "", $this->Order_Items(), GridFieldConfig_RecordEditor::create()), ReadonlyField::create("SubTotal", "Basket Total (" . Product::getDefaultCurrency() . ")", $this->calculateSubTotal())), HeaderField::create("Shipping"), CompositeField::create(FieldGroup::create(DropdownField::create("Courier", "Courier", $this->getCouriers($this->ID))->setRightTitle("Which courier is being used for this order?")->setEmptyString("(Select one)"), Textfield::create("TrackingNo", "Tracking Number (Optional)")->setRightTitle("If the shipment has a tracking number, enter it here.")), ReadonlyField::create("Shipping", "Shipping Total (" . Product::getDefaultCurrency() . ")", $this->calculateShippingTotal())), HeaderField::create("Order Totals"), CompositeField::create(FieldGroup::create("Tax (" . Product::getDefaultCurrency() . ")", ReadonlyField::create("ProductTaxInclusive", "Product Tax (Inclusive)", $this->calculateProductTax(1))->setRightTitle("Basket total is inclusive of this tax."), ReadonlyField::create("ProductTaxExclusive", "Product Tax (Exclusive)", $this->calculateProductTax(2))->setRightTitle("Basket total is exclusive of this tax."), ReadonlyField::create("ShippingTax", "Shipping Tax", $this->calculateShippingTax($this->calculateShippingTotal()))->setRightTitle(StoreSettings::get_settings()->TaxSettings_ShippingInclusiveExclusive == 1 ? "Shipping price is inclusive of this tax." : "Shipping price is exclusive of this tax.")), FieldGroup::create("Final Totals (" . Product::getDefaultCurrency() . ")", ReadonlyField::create("Total", "Final Total", $this->calculateOrderTotal()), ReadonlyField::create("TotalPayments", "Total Payments", $this->calculatePaymentTotal()), ReadonlyField::create("OutstandingBalance", "Outstanding Balance", $this->calculateRemainingBalance()))), HeaderField::create("Payments"), CompositeField::create($items = GridField::create("OrderPayments", "", $this->Order_Payment(), GridFieldConfig_RecordEditor::create()))), Tab::create("OrderComments", HeaderField::create("Order Comments"), CompositeField::create(ReadonlyField::create("CustomerComments", "Customer Comments")->setRightTitle("These are the comments of this customer."), TextareaField::create("AdminComments", "Admin Comments")->setRightTitle("Only store admins can see these comments"))), Tab::create("OrderEmails", HeaderField::create("Order Emails"), CompositeField::create($items = GridField::create("Order_Emails", "", $this->Order_Emails(), GridFieldConfig_RecordViewer::create()))))));
     //If record doesn't exist yet, hide certain tabs.
     !$this->exists() ? $fields->RemoveFieldsFromTab("Root.Order", array("OrderDetails", "OrderComments", "OrderEmails")) : null;
     /* 
      * If record exists, and order is unpaid show warning message to prevent shipment of unpaid orders.
      * Otherwise show a success message.
      */
     if ($this->exists() && $this->calculateRemainingBalance() > 0) {
         $alert = new LiteralField("OrderPayment_LiteralField", "<div class=\"literal-field field\">\n\t\t\t\t\t<div class=\"message error\">\n\t\t\t\t\t\t<strong>ORDER REMAINS UNPAID</strong> - This order has an outstanding balance of " . Product::getDefaultCurrency() . $this->calculateRemainingBalance() . ". If the customer has paid then the\n\t\t\t\t\t\t payment gateway may not have provided a payment status yet.\n\t\t\t\t\t</div>\n\t\t\t\t</div>");
         $fields->addFieldToTab("Root.Order", $alert, "Status");
     } elseif ($this->exists() && $this->calculateRemainingBalance() == 0) {
         $alert = new LiteralField("OrderPayment_LiteralField", "<div class=\"literal-field field\">\n\t\t\t\t\t<div class=\"message good\">\n\t\t\t\t\t\t<strong>BALANCE PAID</strong> - This balance of this order has been paid. You may now prepare and \n\t\t\t\t\t\tdispatch the order items below.\n\t\t\t\t\t</div> \n\t\t\t\t</div>");
         $fields->addFieldToTab("Root.Order", $alert, "Status");
     }
     return $fields;
 }
Exemplo n.º 11
0
 /**
  *
  * @return GridField
  */
 protected function getPaymentsField()
 {
     $gridFieldConfig = GridFieldConfig_RecordViewer::create()->addComponents(new GridFieldDetailForm(), new GridFieldEditButton());
     return new GridField("Payments", _t("Order.PAYMENTS", "Payments"), $this->Payments(), $gridFieldConfig);
 }
Exemplo n.º 12
0
    /**
     * @return FieldList
     */
    public function getCMSFields()
    {
        $fields = new FieldList(new TabSet('Root'));
        $project = $this->Project();
        if ($project && $project->exists()) {
            $viewerGroups = $project->Viewers();
            $groups = $viewerGroups->sort('Title')->map()->toArray();
            $members = array();
            foreach ($viewerGroups as $group) {
                foreach ($group->Members()->map() as $k => $v) {
                    $members[$k] = $v;
                }
            }
            asort($members);
        } else {
            $groups = array();
            $members = array();
        }
        // Main tab
        $fields->addFieldsToTab('Root.Main', array(TextField::create('ProjectName', 'Project')->setValue(($project = $this->Project()) ? $project->Name : null)->performReadonlyTransformation(), TextField::create('Name', 'Environment name')->setDescription('A descriptive name for this environment, e.g. staging, uat, production'), $this->obj('Usage')->scaffoldFormField('Environment usage'), TextField::create('URL', 'Server URL')->setDescription('This url will be used to provide the front-end with a link to this environment'), TextField::create('Filename')->setDescription('The capistrano environment file name')->performReadonlyTransformation()));
        // Backend identifier - pick from a named list of configurations specified in YML config
        $backends = $this->config()->get('allowed_backends', Config::FIRST_SET);
        // If there's only 1 backend, then user selection isn't needed
        if (sizeof($backends) > 1) {
            $fields->addFieldToTab('Root.Main', DropdownField::create('BackendIdentifier', 'Deployment backend')->setSource($backends)->setDescription('What kind of deployment system should be used to deploy to this environment'));
        }
        $fields->addFieldsToTab('Root.UserPermissions', array($this->buildPermissionField('ViewerGroups', 'Viewers', $groups, $members)->setTitle('Who can view this environment?')->setDescription('Groups or Users who can view this environment'), $this->buildPermissionField('DeployerGroups', 'Deployers', $groups, $members)->setTitle('Who can deploy?')->setDescription('Groups or Users who can deploy to this environment'), $this->buildPermissionField('TickAllSnapshotGroups', 'TickAllSnapshot', $groups, $members)->setTitle("<em>All snapshot permissions</em>")->addExtraClass('tickall')->setDescription('UI shortcut to select all snapshot-related options - not written to the database.'), $this->buildPermissionField('CanRestoreGroups', 'CanRestoreMembers', $groups, $members)->setTitle('Who can restore?')->setDescription('Groups or Users who can restore archives from Deploynaut into this environment'), $this->buildPermissionField('CanBackupGroups', 'CanBackupMembers', $groups, $members)->setTitle('Who can backup?')->setDescription('Groups or Users who can backup archives from this environment into Deploynaut'), $this->buildPermissionField('ArchiveDeleterGroups', 'ArchiveDeleters', $groups, $members)->setTitle('Who can delete?')->setDescription("Groups or Users who can delete archives from this environment's staging area."), $this->buildPermissionField('ArchiveUploaderGroups', 'ArchiveUploaders', $groups, $members)->setTitle('Who can upload?')->setDescription('Users who can upload archives linked to this environment into Deploynaut.<br />' . 'Linking them to an environment allows limiting download permissions (see below).'), $this->buildPermissionField('ArchiveDownloaderGroups', 'ArchiveDownloaders', $groups, $members)->setTitle('Who can download?')->setDescription(<<<PHP
Users who can download archives from this environment to their computer.<br />
Since this implies access to the snapshot, it is also a prerequisite for restores
to other environments, alongside the "Who can restore" permission.<br>
Should include all users with upload permissions, otherwise they can't download
their own uploads.
PHP
), $this->buildPermissionField('PipelineApproverGroups', 'PipelineApprovers', $groups, $members)->setTitle('Who can approve pipelines?')->setDescription('Users who can approve waiting deployment pipelines.'), $this->buildPermissionField('PipelineCancellerGroups', 'PipelineCancellers', $groups, $members)->setTitle('Who can cancel pipelines?')->setDescription('Users who can cancel in-progess deployment pipelines.')));
        // The Main.DeployConfig
        if ($this->Project()->exists()) {
            $this->setDeployConfigurationFields($fields);
        }
        // The DataArchives
        $dataArchiveConfig = GridFieldConfig_RecordViewer::create();
        $dataArchiveConfig->removeComponentsByType('GridFieldAddNewButton');
        if (class_exists('GridFieldBulkManager')) {
            $dataArchiveConfig->addComponent(new GridFieldBulkManager());
        }
        $dataArchive = GridField::create('DataArchives', 'Data Archives', $this->DataArchives(), $dataArchiveConfig);
        $fields->addFieldToTab('Root.DataArchive', $dataArchive);
        // Pipeline templates
        $this->setPipelineConfigurationFields($fields);
        // Pipelines
        if ($this->Pipelines()->Count()) {
            $pipelinesConfig = GridFieldConfig_RecordEditor::create();
            $pipelinesConfig->removeComponentsByType('GridFieldAddNewButton');
            if (class_exists('GridFieldBulkManager')) {
                $pipelinesConfig->addComponent(new GridFieldBulkManager());
            }
            $pipelines = GridField::create('Pipelines', 'Pipelines', $this->Pipelines(), $pipelinesConfig);
            $fields->addFieldToTab('Root.Pipelines', $pipelines);
        }
        // Deployments
        $deploymentsConfig = GridFieldConfig_RecordEditor::create();
        $deploymentsConfig->removeComponentsByType('GridFieldAddNewButton');
        if (class_exists('GridFieldBulkManager')) {
            $deploymentsConfig->addComponent(new GridFieldBulkManager());
        }
        $deployments = GridField::create('Deployments', 'Deployments', $this->Deployments(), $deploymentsConfig);
        $fields->addFieldToTab('Root.Deployments', $deployments);
        Requirements::javascript('deploynaut/javascript/environment.js');
        // Add actions
        $action = new FormAction('check', 'Check Connection');
        $action->setUseButtonTag(true);
        $dataURL = Director::absoluteBaseURL() . 'naut/api/' . $this->Project()->Name . '/' . $this->Name . '/ping';
        $action->setAttribute('data-url', $dataURL);
        $fields->insertBefore($action, 'Name');
        // Allow extensions
        $this->extend('updateCMSFields', $fields);
        return $fields;
    }
Exemplo n.º 13
0
 /**
  * Helper function to help children class add GridFieldView to display
  * their relations to other HailApiObject
  *
  * @param FieldList $fields
  * @param string $name Name that should be given to the GridFieldView
  * @param ManyManyList $relation Relation to display
  * @return void
  */
 protected function makeRecordViewer($fields, $name, $relation, $viewComponent = 'GridFieldHailViewButton')
 {
     $config = GridFieldConfig_RecordViewer::create();
     // Remove the standard GridFieldView button and replace it with our
     // custom button that will link to our the right action in our HailModelAdmin
     $config->removeComponentsByType('GridFieldViewButton');
     $config->addComponents(new $viewComponent());
     $grid = new GridField($name, $name, $relation, $config);
     $fields->addFieldToTab('Root.' . $name, $grid);
 }
 /**
  * @param {int} $itemsPerPage How many items per page should show up
  */
 public function __construct($itemsPerPage = null)
 {
     parent::__construct($itemsPerPage);
     $this->removeComponentsByType('GridFieldDetailForm')->addComponent(new FrontEndGridFieldDetailForm());
 }
 /**
  * Return all fields of the backend.
  *
  * @return FieldList Fields of the CMS
  */
 public function getCMSFields()
 {
     $this->getCMSFieldsIsCalled = true;
     $fields = parent::getCMSFields();
     $useOnlydefaultGroupviewSource = array('inherit' => _t('SilvercartProductGroupPage.DEFAULTGROUPVIEW_DEFAULT'), 'yes' => _t('Silvercart.YES'), 'no' => _t('Silvercart.NO'));
     $useContentField = new CheckboxField('useContentFromParent', $this->fieldLabel('useContentFromParent'));
     $doNotShowProductsField = new CheckboxField('DoNotShowProducts', $this->fieldLabel('DoNotShowProducts'));
     $productsPerPageField = new TextField('productsPerPage', $this->fieldLabel('productsPerPage'));
     $defaultGroupViewField = SilvercartGroupViewHandler::getGroupViewDropdownField('DefaultGroupView', $this->fieldLabel('DefaultGroupView'), $this->DefaultGroupView, _t('SilvercartProductGroupPage.DEFAULTGROUPVIEW_DEFAULT'));
     $useOnlyDefaultGroupViewField = new DropdownField('UseOnlyDefaultGroupView', $this->fieldLabel('UseOnlyDefaultGroupView'), $useOnlydefaultGroupviewSource, $this->UseOnlyDefaultGroupView);
     $productGroupsPerPageField = new TextField('productGroupsPerPage', $this->fieldLabel('productGroupsPerPage'));
     $defaultGroupHolderViewField = SilvercartGroupViewHandler::getGroupViewDropdownField('DefaultGroupHolderView', $this->fieldLabel('DefaultGroupHolderView'), $this->DefaultGroupHolderView, _t('SilvercartProductGroupPage.DEFAULTGROUPVIEW_DEFAULT'));
     $useOnlyDefaultGroupHolderViewField = new DropdownField('UseOnlyDefaultGroupHolderView', $this->fieldLabel('UseOnlyDefaultGroupHolderView'), $useOnlydefaultGroupviewSource, $this->UseOnlyDefaultGroupHolderView);
     $fieldGroup = new SilvercartFieldGroup('FieldGroup', '', $fields);
     $productsPerPageField->setRightTitle(_t('SilvercartProductGroupPage.PRODUCTSPERPAGEHINT'));
     $productGroupsPerPageField->setRightTitle(_t('SilvercartProductGroupPage.PRODUCTSPERPAGEHINT'));
     $fieldGroup->push($useContentField);
     $fieldGroup->breakAndPush($doNotShowProductsField);
     $fieldGroup->breakAndPush($productsPerPageField);
     $fieldGroup->breakAndPush($defaultGroupViewField);
     $fieldGroup->push($useOnlyDefaultGroupViewField);
     $fieldGroup->breakAndPush($productGroupsPerPageField);
     $fieldGroup->breakAndPush($defaultGroupHolderViewField);
     $fieldGroup->push($useOnlyDefaultGroupHolderViewField);
     $displaySettingsToggle = ToggleCompositeField::create('DisplaySettingsToggle', $this->fieldLabel('DisplaySettings'), array($fieldGroup))->setHeadingLevel(4)->setStartClosed(true);
     $fields->insertAfter($displaySettingsToggle, 'Content');
     $mirroredProductIdList = '';
     $mirroredProductIDs = $this->getMirroredProductIDs();
     foreach ($mirroredProductIDs as $mirroredProductID) {
         $mirroredProductIdList .= sprintf("'%s',", $mirroredProductID);
     }
     if (!empty($mirroredProductIdList)) {
         $mirroredProductIdList = substr($mirroredProductIdList, 0, -1);
         $filter = sprintf("SilvercartProductGroupID = %d OR\n                 \"SilvercartProduct\".\"ID\" IN (%s)", $this->ID, $mirroredProductIdList);
     } else {
         $filter = sprintf("SilvercartProductGroupID = %d", $this->ID);
     }
     if ($this->drawCMSFields()) {
         $config = GridFieldConfig_RecordViewer::create(100);
         $productsTableField = new GridField('SilvercartProducts', $this->fieldLabel('SilvercartProducts'), SilvercartProduct::get()->filter(array('SilvercartProductGroupID' => $this->ID)), $config);
         $tabPARAM = "Root." . _t('SilvercartProduct.TITLE', 'product');
         $fields->addFieldToTab($tabPARAM, $productsTableField);
         $productAdminLink = Director::baseURL() . 'admin/silvercart-products';
         $manageProductsButton = new LiteralField('ManageProductsButton', sprintf("<a href=\"%s\">%s</a>", $productAdminLink, _t('SilvercartProductGroupPage.MANAGE_PRODUCTS_BUTTON')));
         $fields->addFieldToTab($tabPARAM, $manageProductsButton);
         $fields->addFieldToTab('Root.Main', new UploadField('GroupPicture', _t('SilvercartProductGroupPage.GROUP_PICTURE')), 'Content');
     }
     $widgetSetContent = $fields->fieldByName('Root.Widgets.WidgetSetContent');
     if ($widgetSetContent) {
         $widgetSetAdminLink = Director::baseURL() . 'admin/silvercart-widget-sets';
         $manageWidgetsButton = new LiteralField('ManageWidgetsButton', sprintf("<a href=\"%s\">%s</a>", $widgetSetAdminLink, _t('SilvercartWidgetSet.MANAGE_WIDGETS_BUTTON')));
         $fields->insertAfter($manageWidgetsButton, 'WidgetSetContent');
     }
     $this->extend('extendCMSFields', $fields);
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     if (!$this->owner->ID) {
         return;
     }
     $accessibleSubsites = Subsite::accessible_sites("CMS_ACCESS_CMSMain");
     $accessibleSubsitesMap = array();
     if ($accessibleSubsites && $accessibleSubsites->Count()) {
         $accessibleSubsitesMap = $accessibleSubsites->map('ID', 'Title');
         unset($accessibleSubsitesMap[$this->owner->SubsiteID]);
     }
     $fields->removeByName('SubsiteList');
     if (Subsite::currentSubsiteID()) {
         $fields->removeByName('Subsites');
     } else {
         $currentSubsites = $this->owner->Subsites();
         $fields->removeByName('Subsites');
         $conf = new GridFieldConfig_RecordViewer();
         if (!Permission::check('ADMIN')) {
             $conf->removeComponentsByType('GridFieldAddNewButton');
         }
         $grid = new GridField('Subsites', 'Subsites', $currentSubsites, $conf);
         $fields->addFieldToTab('Root.Subsites', $grid);
         $fields->addFieldToTab('Root.Subsites', new ReadonlyField('SubsiteList'));
     }
     // Profile integration
     SubsiteProfile::applyToFields($this->owner, $fields);
 }
 /**
  * @param String $name
  * @param String $title
  * @param DataList $source
  *
  * @return GridField
  */
 private function gridFieldMaker($name, $title, $source)
 {
     return new GridField($name, _t("CopyFactory.COPY_FACTORY_LOG", "Copy Log: ") . $title, $source, GridFieldConfig_RecordViewer::create(30));
 }
Exemplo n.º 18
0
 public function getCMSFields()
 {
     $fields = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $fields->addFieldsToTab('Root.Main', new HiddenField('EventID', 'EventID'));
     $config = new GridFieldConfig_RecordViewer(50);
     $config->removeComponentsByType('GridFieldAddNewButton');
     $config->addComponent(new GridFieldAjaxRefresh(1000, false));
     $answers = new GridField('Answers', 'Answers', $this->Answers(), $config);
     $fields->addFieldToTab('Root.Main', $answers);
     return $fields;
 }
Exemplo n.º 19
0
 /**
  *	Display the respective CMS media type attributes.
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if ($this->Title) {
         // Display the title as read only.
         $fields->replaceField('Title', ReadonlyField::create('Title'));
         $fields->addFieldToTab('Root.Main', LiteralField::create('MediaAttributesTitle', "<div class='field'><label class='left'>Custom Attributes</label></div>"));
         // Allow customisation of media type attributes if a respective media page exists, depending on the current CMS user permissions.
         if (MediaPage::get()->innerJoin('MediaType', 'MediaPage.MediaTypeID = MediaType.ID')->where(array('MediaType.Title = ?' => $this->Title))->exists()) {
             $configuration = $this->checkPermissions() === false ? GridFieldConfig_RecordViewer::create() : GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldDeleteAction');
             $fields->addFieldToTab('Root.Main', GridField::create('MediaAttributes', 'Custom Attributes', MediaAttribute::get()->innerJoin('MediaPage', 'MediaAttribute.MediaPageID = MediaPage.ID')->innerJoin('MediaType', 'MediaPage.MediaTypeID = MediaType.ID')->where(array('MediaType.Title = ?' => $this->Title, 'MediaAttribute.LinkID = ?' => -1)), $configuration)->setModelClass('MediaAttribute'));
         } else {
             // Display a notice that respective media pages should first be created.
             Requirements::css(MEDIAWESOME_PATH . '/css/mediawesome.css');
             $fields->addFieldToTab('Root.Main', LiteralField::create('MediaNotice', "<p class='mediawesome notice'><strong>No {$this->Title} Pages Found</strong></p>"));
         }
     }
     // Allow extension customisation.
     $this->extend('updateMediaTypeCMSFields', $fields);
     return $fields;
 }
 public function __construct($itemsPerPage = null)
 {
     parent::__construct($itemsPerPage);
     $this->addComponent(new GridFieldViewButton());
     $this->addComponent(new AbcGridFieldDetailForm());
 }