/**
  * @return Form
  */
 public function ItemEditForm()
 {
     VersionedReadingMode::setStageReadingMode();
     $form = parent::ItemEditForm();
     /* @var $actions FieldList */
     if ($form instanceof Form) {
         $actions = $form->Actions();
         $actions->replaceField('action_doSave', FormAction::create('save', _t('SiteTree.BUTTONSAVED', 'Saved'))->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'addpage')->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT', 'Save draft'))->setUseButtonTag(true));
         $published = $this->record->isPublished();
         /* @var $publish FormAction */
         $publish = FormAction::create('publish', $published ? _t('SiteTree.BUTTONPUBLISHED', 'Published') : _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'disk')->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setUseButtonTag(true);
         if ($this->record->stagesDiffer('Stage', 'Live') && $published) {
             $publish->addExtraClass('ss-ui-alternate');
             $actions->push(FormAction::create('rollback', _t('SiteTree.BUTTONCANCELDRAFT', 'Cancel draft changes'))->setDescription(_t('SiteTree.BUTTONCANCELDRAFTDESC', 'Delete your draft and revert to the currently published page')));
         }
         $actions->push($publish);
         if ($published) {
             /* @var $unpublish FormAction */
             $unpublish = FormAction::create('unpublish', _t('SiteTree.BUTTONUNPUBLISH', 'Unpublish'))->addExtraClass('ss-ui-action-destructive');
             $actions->push($unpublish);
             $actions->removeByName('action_doDelete');
         }
     }
     VersionedReadingMode::restoreOriginalReadingMode();
     return $form;
 }
 /**
  * @return Form
  */
 public function ItemEditForm()
 {
     if (!$this->record->isPublished()) {
         Versioned::reading_stage('Stage');
     }
     if (!$this->record->ParentID) {
         // set a parent id for the record, even if it will change
         $parents = $this->record->getCatalogParents();
         if ($parents && $parents->count()) {
             $this->record->ParentID = $parents->first()->ID;
         }
     }
     $form = parent::ItemEditForm();
     if ($this->record->has_extension('CatalogPageExtension') || $this->record->has_extension('CatalogDataObjectExtension')) {
         $actions = $form->Actions();
         if ($this->record->ID) {
             if ($this->record->isPublished()) {
                 $actions->push(FormAction::create('doDisable', _t('CatalogManager.DISABLE', 'Disable'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-destructive'));
             } else {
                 $actions->push(FormAction::create('doEnable', _t('CatalogManager.ENABLE', 'Enable'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
             }
         }
         if ($this->record->canCreate() && $this->record->stat('can_duplicate') == true) {
             $actions->push(FormAction::create('doDuplicate', _t('CatalogManager.DUPLICATE', 'Duplicate'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
         }
         $form->setActions($actions);
     }
     $this->extend('updateItemEditForm', $form);
     return $form;
 }
 /**
  * @return {Form}
  */
 public function ItemEditForm()
 {
     //Timepicker
     Requirements::css('calendar/thirdparty/timepicker/jquery.timepicker.css');
     //Requirements::javascript('calendar/thirdparty/timepicker/jquery.timepicker.js');
     //modification to allow timepicker and timeentry to work in tandem:
     Requirements::javascript('calendar/thirdparty/timepicker/jquery.timepicker-timeentry.js');
     //Timeentry
     Requirements::javascript('calendar/thirdparty/timeentry/jquery.timeentry.js');
     //CSS/JS Dependencies
     Requirements::css("calendar/css/admin/CalendarEventGridFieldDetailForm.css");
     Requirements::javascript("calendar/javascript/events/EventFields.js");
     Requirements::javascript("calendar/javascript/admin/CalendarEventGridFieldDetailForm.js");
     $form = parent::ItemEditForm();
     if (!$form instanceof Form) {
         return $form;
     }
     $form->addExtraClass('CalendarEventGridfieldDetailForm');
     if ($this->record->ID !== 0) {
         $actionFields = $form->Actions();
         $link = Controller::join_links($this->gridField->Link('item'), 'new');
         $actionFields->push(new LiteralField('addNew', '<a href="' . $link . '" class="action action-detail ss-ui-action-constructive ' . 'ss-ui-button ui-button ui-widget ui-state-default ui-corner-all new new-link" data-icon="add">Add new ' . $this->record->i18n_singular_name() . '</a>'));
     }
     return $form;
 }
 function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     $actions = $form->Actions();
     $majorActions = CompositeField::create()->setName('MajorActions')->setTag('fieldset')->addExtraClass('ss-ui-buttonset');
     $rootTabSet = new TabSet('ActionMenus');
     $moreOptions = new Tab('MoreOptions', _t('SiteTree.MoreOptions', 'More options', 'Expands a view for more buttons'));
     $rootTabSet->push($moreOptions);
     $rootTabSet->addExtraClass('ss-ui-action-tabset action-menus');
     // Render page information into the "more-options" drop-up, on the top.
     $baseClass = ClassInfo::baseDataClass($this->record->class);
     $live = Versioned::get_one_by_stage($this->record->class, 'Live', "\"{$baseClass}\".\"ID\"='{$this->record->ID}'");
     $existsOnLive = $this->record->getExistsOnLive();
     $published = $this->record->isPublished();
     $moreOptions->push(new LiteralField('Information', $this->record->customise(array('Live' => $live, 'ExistsOnLive' => $existsOnLive))->renderWith('SiteTree_Information')));
     $actions->removeByName('action_doSave');
     $actions->removeByName('action_doDelete');
     if ($this->record->canEdit()) {
         if ($this->record->IsDeletedFromStage) {
             if ($existsOnLive) {
                 $majorActions->push(FormAction::create('revert', _t('CMSMain.RESTORE', 'Restore')));
                 if ($this->record->canDelete() && $this->record->canDeleteFromLive()) {
                     $majorActions->push(FormAction::create('unpublish', _t('CMSMain.DELETEFP', 'Delete'))->addExtraClass('ss-ui-action-destructive'));
                 }
             } else {
                 if (!$this->record->isNew()) {
                     $majorActions->push(FormAction::create('restore', _t('CMSMain.RESTORE', 'Restore'))->setAttribute('data-icon', 'decline'));
                 } else {
                     $majorActions->push(FormAction::create('save', _t('SiteTree.BUTTONSAVED', 'Saved'))->addExtraClass('ss-ui-alternate ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'addpage')->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT', 'Save draft'))->setUseButtonTag(true));
                     $majorActions->push(FormAction::create('publish', _t('SiteTree.BUTTONPUBLISHED', 'Published'))->addExtraClass('ss-ui-alternate ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'disk')->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setUseButtonTag(true));
                 }
             }
         } else {
             if ($this->record->canDelete() && !$published) {
                 $moreOptions->push(FormAction::create('delete', _t('SiteTree.BUTTONDELETE', 'Delete draft'))->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true));
             }
             $majorActions->push(FormAction::create('save', _t('SiteTree.BUTTONSAVED', 'Saved'))->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'addpage')->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT', 'Save draft'))->setUseButtonTag(true));
         }
     }
     $publish = FormAction::create('publish', $published ? _t('SiteTree.BUTTONPUBLISHED', 'Published') : _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setAttribute('data-icon', 'accept')->setAttribute('data-icon-alternate', 'disk')->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))->setUseButtonTag(true);
     if (!$published || $this->record->stagesDiffer('Stage', 'Live') && $published) {
         $publish->addExtraClass('ss-ui-alternate');
     }
     if ($this->record->canPublish() && !$this->record->IsDeletedFromStage) {
         $majorActions->push($publish);
     }
     if ($published && $this->record->canPublish() && !$this->record->IsDeletedFromStage && $this->record->canDeleteFromLive()) {
         $moreOptions->push(FormAction::create('unpublish', _t('SiteTree.BUTTONUNPUBLISH', 'Unpublish'), 'delete')->addExtraClass('ss-ui-action-destructive')->setUseButtonTag(true));
     }
     if ($this->record->stagesDiffer('Stage', 'Live') && !$this->record->IsDeletedFromStage && $this->record->isPublished() && $this->record->canEdit()) {
         $moreOptions->push(FormAction::create('rollback', _t('SiteTree.BUTTONCANCELDRAFT', 'Cancel draft changes'))->setDescription(_t('SiteTree.BUTTONCANCELDRAFTDESC', 'Delete your draft and revert to the currently published page'))->setUseButtonTag(true));
     }
     $actions->push($majorActions);
     $actions->push($rootTabSet);
     if ($this->record->hasMethod('getCMSValidator')) {
         $form->setValidator($this->record->getCMSValidator());
     }
     return $form;
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($this->record->isInDB() && $this->record->canGenerate()) {
         $form->Actions()->merge(array(FormAction::create('reportpreview', '')->setTitle(_t('AdvancedReport.PREVIEW', 'Preview'))->setAttribute('target', '_blank')->setAttribute('data-icon', 'preview'), FormAction::create('generate', '')->setTitle(_t('AdvancedReport.GENERATE', 'Generate'))));
     }
     return $form;
 }
 function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($this->record->getCMSActions() && $this->record->getCMSActions()->count()) {
         $form->setActions($this->record->getCMSActions());
     }
     return $form;
 }
 function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($this->record->ID) {
         $form->Actions()->push($action = FormAction::create('previewpdf', 'Preview')->setAttribute('data-link', $this->Link() . '/previewpdf'));
         $form->Actions()->push($action = FormAction::create('compose', 'Compose'));
     }
     return $form;
 }
Ejemplo n.º 8
0
    /**
     * Add print button to order detail form
     */
    public function ItemEditForm()
    {
        $form = parent::ItemEditForm();
        $printlink = $this->Link('printorder') . "?print=1";
        $printwindowjs = <<<JS
\t\t\twindow.open('{$printlink}', 'print_order', 'toolbar=0,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 50,top = 50');return false;
JS;
        $form->Actions()->push(new LiteralField("PrintOrder", "<button class=\"no-ajax grid-print-button\" data-icon=\"grid_print\" onclick=\"javascript:{$printwindowjs}\">" . _t("Order.PRINT", "Print") . "</button>"));
        return $form;
    }
 /**	
  * adds a new button allowing users
  * to add a new record directly from the edit screen
  * @return {Form} 	 
  */
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($this->record->ID !== 0) {
         $actionFields = $form->Actions();
         $link = Controller::join_links($this->gridField->Link('item'), 'new');
         $actionFields->push(new LiteralField('addNew', '<a href="' . $link . '" class="action action-detail ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all new new-link" data-icon="add">' . _t("GridFieldDetailFormAddNew.ADD", "_Add") . ' ' . $this->record->i18n_singular_name() . '</a>'));
     }
     return $form;
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     $action = 'Save';
     if (!$this->record->ID) {
         $action = 'Create';
     }
     $form->Actions()->push(FormAction::create('SaveAndClose', $action . ' & Close'));
     $form->Actions()->push(FormAction::create('SaveAndAdd', $action . ' & Add Another'));
     return $form;
 }
 function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     $actions = $this->record->getCMSActions();
     $oldActions = $form->Actions();
     foreach ($actions as $action) {
         $oldActions->push($action);
     }
     $form->setActions($oldActions);
     return $form;
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($this->record->ID !== 0) {
         $form->Actions()->insertAfter(FormAction::create('doPublish', 'Save & Publish')->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'), 'action_doSave');
         if ($this->record->isPublished()) {
             $form->Actions()->push(FormAction::create('doUnpublish', 'Un-publish')->setUseButtonTag(true)->addExtraClass('ss-ui-action-destructive action-unpublished'));
         }
     }
     return $form;
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if (!$this->record->ID) {
         return $form;
     }
     $formActions = $form->Actions();
     if ($actions = $this->record->getCMSActions()) {
         foreach ($actions as $action) {
             $formActions->push($action);
         }
     }
     return $form;
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     // Do these action update only when the current record is_a newsletter
     if ($this->record && $this->record instanceof Newsletter) {
         $form->setActions($this->updateCMSActions($form->Actions()));
         $form->Fields()->push(new HiddenField("PreviewURL", "PreviewURL", $this->LinkPreview()));
         // Added in-line to the form, but plucked into different view by LeftAndMain.Preview.js upon load
         $navField = new LiteralField('SilverStripeNavigator', $this->getSilverStripeNavigator());
         $navField->setAllowHTML(true);
         $form->Fields()->push($navField);
     }
     return $form;
 }
 /**
  * @return Form
  */
 public function ItemEditForm()
 {
     if (!$this->record->isPublished()) {
         Versioned::reading_stage('Stage');
     }
     if (!$this->record->ParentID) {
         // set a parent id for the record, even if it will change
         $parents = $this->record->getCatalogParents();
         if ($parents && $parents->count()) {
             $this->record->ParentID = $parents->first()->ID;
         }
     }
     return parent::ItemEditForm();
 }
 function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     //add a data attribute specifying how many pages this document is referenced on
     if ($record = $this->record) {
         $numberOfPageRelations = $record->Pages()->Count();
         $relations = new ShortCodeRelationFinder();
         $numberOfInlineRelations = $relations->findPageCount($record->ID);
         //add the number of pages attached to this field as a data-attribute
         $form->setAttribute('data-pages-count', $numberOfPageRelations);
         $form->setAttribute('data-relation-count', $numberOfInlineRelations);
     }
     return $form;
 }
 public function ItemEditForm()
 {
     Requirements::css('silverstripe-postmarked/css/messages.css');
     Requirements::javascript('silverstripe-postmarked/javascript/Messages.js');
     $form = parent::ItemEditForm();
     $form->setTemplate('PostmarkEditorTemplate');
     if ($this->record) {
         $message = PostmarkMessage::get()->byID($this->record->ID);
         if (!$message->Read) {
             $message->Read = 1;
             $message->write();
         }
     }
     return $form;
 }
 /**
  * Builds an item edit form.  The arguments to getCMSFields() are the popupController and
  * popupFormName, however this is an experimental API and may change.
  * 
  * @todo In the future, we will probably need to come up with a tigher object representing a partially
  * complete controller with gaps for extra functionality.  This, for example, would be a better way
  * of letting Security/login put its log-in form inside a UI specified elsewhere.
  * 
  * @return Form
  * @see GridFieldDetailForm_ItemRequest::ItemEditForm()
  */
 function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($this->record->ID == 0) {
         $templates = Subsite::get()->sort('Title');
         $templateArray = array();
         if ($templates) {
             $templateArray = $templates->map('ID', 'Title');
         }
         $templateDropdown = new DropdownField('TemplateID', _t('Subsite.COPYSTRUCTURE', 'Copy structure from:'), $templateArray);
         $templateDropdown->setEmptyString('(' . _t('Subsite.NOTEMPLATE', 'No template') . ')');
         $form->Fields()->addFieldToTab('Root.Configuration', $templateDropdown);
     }
     return $form;
 }
Ejemplo n.º 19
0
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     $formActions = $form->Actions();
     if ($actions = $this->record->getCMSActions()) {
         foreach ($actions as $action) {
             $formActions->push($action);
         }
     }
     $dataObjectName = $this->record->ClassName;
     if ($dataObjectName == 'Subscription' || $dataObjectName == 'CreditCard') {
         $formActions->removeByName('action_doSave');
         $formActions->removeByName('action_doDelete');
     }
     return $form;
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     $fields = $form->Fields();
     $actions = $form->Actions();
     if ($this->record->ID !== 0 && $this->record->canEdit()) {
         // Remove the disabled field
         $fields->removeByName("Disabled");
         if ($this->record->isEnabled()) {
             $actions->insertBefore(FormAction::create('doDisable', _t('Catalogue.Disable', 'Disable'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-destructive'), "action_doDelete");
         } elseif ($this->record->isDisabled()) {
             $actions->insertBefore(FormAction::create('doEnable', _t('Catalogue.Enable', 'Enable'))->setUseButtonTag(true), "action_doDelete");
         }
     }
     return $form;
 }
 /**
  * Builds an item edit form. The arguments to getCMSFields() are the popupController and popupFormName, however this is an experimental API and may change.
  * @return {Form}
  */
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($form) {
         if ($this->record && $this->record->exists()) {
             $kapostBase = KapostAdmin::config()->kapost_base_url;
             if ($kapostBase[strlen($kapostBase) - 1] != '/') {
                 $kapostBase .= '/';
             }
             $form->Fields()->addFieldToTab('Root.Main', $field = ReadonlyField::create('KapostRefID_linked', $this->record->fieldLabel('KapostRefID'), !empty($kapostBase) ? '<a href="' . htmlentities($kapostBase . 'posts/' . $this->record->KapostRefID) . '" target="_blank">' . htmlentities($this->record->KapostRefID) . '</a>' : $this->record->KapostRefID)->setForm($form));
             $field->dontEscape = true;
             $form->Actions()->insertBefore(FormAction::create('doConvertPost', _t('KapostAdmin.CONVERT_OBJECT', '_Convert Object'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive kapost-action-convert')->setAttribute('data-icon', 'kapost-convert')->setForm($form), 'action_doDelete');
         }
         $form->addExtraClass('KapostAdmin');
     }
     return $form;
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($form instanceof Form) {
         $actions = $form->Actions();
         $record = $this->record;
         $actions->insertBefore('action_doDelete', $btnPublish = FormAction::create('doPublish', 'Save &amp; Publish'));
         $btnPublish->addExtraClass('ss-ui-action-constructive');
         if (!empty($record->ID)) {
             if ($record->isPublished()) {
                 $actions->removeByName('action_doDelete');
                 $actions->push(FormAction::create('doUnpublish', 'Unpublish')->addExtraClass('ss-ui-action-destructive'));
             }
         }
         $form->setActions($actions);
     }
     return $form;
 }
 /**
  * Chechs the current object in SEO Admin and creats publish and draft buttons if
  * the current object is an instance of Page
  *
  * @since version 1.0.2
  *
  * @return object Returns a record FieldList
  **/
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($this->record instanceof Page) {
         $actions = $form->Actions();
         $actions->removeByName('action_doSave');
         $button = FormAction::create('doDraft');
         $button->setTitle('Save as Draft');
         $button->addExtraClass('ss-ui-action ');
         $actions->push($button);
         $button = FormAction::create('doPublish');
         $button->setTitle('Save & Publish');
         $button->addExtraClass('ss-ui-action-constructive ui-button-text-icon-primary');
         $actions->push($button);
         $form->setActions($actions);
     }
     return $form;
 }
 /**
  * @return Form
  */
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($this->record->has_extension('CatalogPageExtension') || $this->record->has_extension('CatalogDataObjectExtension')) {
         $actions = $form->Actions();
         if ($this->record->ID) {
             if ($this->record->isPublished()) {
                 $actions->push(FormAction::create('doDisable', _t('CatalogManager.DISABLE', 'Disable'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-destructive'));
             } else {
                 $actions->push(FormAction::create('doEnable', _t('CatalogManager.ENABLE', 'Enable'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
             }
             if ($this->record->canCreate() && $this->record->stat('can_duplicate') == true) {
                 $actions->push(FormAction::create('doDuplicate', _t('CatalogManager.DUPLICATE', 'Duplicate'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
             }
         }
         $form->setActions($actions);
     }
     $this->extend('updateItemEditForm', $form);
     return $form;
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     $actions = $this->getCMSActions();
     $form->setActions($actions);
     return $form;
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     $form->addExtraClass('push-notification');
     return $form;
 }
 public function testItemEditFormCallback()
 {
     $this->logInWithPermission('ADMIN');
     $category = new GridFieldDetailFormTest_Category();
     $component = new GridFieldDetailForm();
     $component->setItemEditFormCallback(function ($form, $component) {
         $form->Fields()->push(new HiddenField('Callback'));
     });
     // Note: A lot of scaffolding to execute the tested logic,
     // due to the coupling of form creation with request handling (and its context)
     $request = new GridFieldDetailForm_ItemRequest(GridField::create('Categories', 'Categories'), $component, $category, new Controller(), 'Form');
     $form = $request->ItemEditForm();
     $this->assertNotNull($form->Fields()->fieldByName('Callback'));
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     $form->setAttribute('data-pjax-fragment', 'CurrentForm ');
     return $form;
 }
 public function ItemEditForm()
 {
     $form = parent::ItemEditForm();
     if ($form) {
         // Update the default parent field
         $parentParam = Controller::curr()->request->requestVar('ParentID');
         $parent_field = $form->Fields()->dataFieldByName("ParentID");
         if ($parentParam && $parent_field) {
             $parent_field->setValue($parentParam);
         }
         return $form;
     }
 }
 public function ItemEditForm()
 {
     Requirements::javascript("orders/javascript/entwine.orders.js");
     $form = parent::ItemEditForm();
     $fields = $form->Fields();
     $actions = $form->Actions();
     $record = $this->record;
     $member = Member::currentUser();
     $can_view = $this->record->canView();
     $can_edit = $this->record->canEdit();
     $can_change_status = $this->record->canChangeStatus();
     $can_delete = $this->record->canDelete();
     $can_create = $this->record->canCreate();
     // First remove the delete button
     $actions->removeByName("action_doDelete");
     // Deal with Estimate objects
     if ($record->ClassName == "Estimate") {
         if ($record->ID && $record->AccessKey) {
             $frontend_url = Controller::join_links(Director::absoluteBaseUrl(), "OrdersFront", "quote", $record->ID, $record->AccessKey);
             $html = '<a href="' . $frontend_url . '" ';
             $html .= 'target="_blank" ';
             $html .= 'class="action ss-ui-button ui-button ui-corner-all open-external" ';
             $html .= '>' . _t('Orders.ViewQuote', 'View Quote') . '</a>';
             $actions->insertAfter(LiteralField::create('openQuote', $html), "action_doSave");
         }
         if ($record->ID && $can_edit) {
             $actions->insertAfter(FormAction::create('doConvert', _t('Orders.ConvertToOrder', 'Convert To Order'))->setUseButtonTag(true), "action_doSave");
         }
     }
     // Deal with Order objects
     if ($record->ClassName == "Order") {
         // Set our status field as a dropdown (has to be here to
         // ignore canedit)
         // Allow users to change status (as long as they have permission)
         if ($can_edit || $can_change_status) {
             $status_field = DropdownField::create('Status', null, $record->config()->statuses);
             // Set default status if we can
             if (!$record->Status && !$record->config()->default_status) {
                 $status_field->setValue($record->config()->default_status);
             } else {
                 $status_field->setValue($record->Status);
             }
             $fields->replaceField("Status", $status_field);
         }
         // Setup order history
         if (Permission::check(array('COMMERCE_ORDER_HISTORY', 'ADMIN'), 'any', $member)) {
             $versions = $record->AllVersions();
             $first_version = $versions->First();
             $curr_version = $first_version ? $versions->First() : null;
             $message = "";
             foreach ($versions as $version) {
                 $i = $version->Version;
                 $name = "History_{$i}";
                 if ($i > 0) {
                     $frm = Versioned::get_version($record->class, $record->ID, $i - 1);
                     $to = Versioned::get_version($record->class, $record->ID, $i);
                     $diff = new DataDifferencer($frm, $to);
                     if ($version->Author()) {
                         $message = "<p>{$version->Author()->FirstName} ({$version->LastEdited})</p>";
                     } else {
                         $message = "<p>Unknown ({$version->LastEdited})</p>";
                     }
                     if ($diff->ChangedFields()->exists()) {
                         $message .= "<ul>";
                         // Now loop through all changed fields and track as message
                         foreach ($diff->ChangedFields() as $change) {
                             if ($change->Name != "LastEdited") {
                                 $message .= "<li>{$change->Title}: {$change->Diff}</li>";
                             }
                         }
                         $message .= "</ul>";
                     }
                     $fields->addFieldToTab("Root.History", LiteralField::create($name, "<div class=\"field\">{$message}</div>"));
                 }
             }
         }
         // Is user cannot edit, but can change status, add change
         // status button
         if ($record->ID && !$can_edit && $can_change_status) {
             $actions->push(FormAction::create('doChangeStatus', _t('Orders.Save', 'Save'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
         }
         if ($record->ID && $record->AccessKey) {
             $frontend_url = Controller::join_links(Director::absoluteBaseUrl(), "OrdersFront", "invoice", $record->ID, $record->AccessKey);
             $html = '<a href="' . $frontend_url . '" ';
             $html .= 'target="_blank" ';
             $html .= 'class="action ss-ui-button ui-button ui-corner-all open-external" ';
             $html .= '>' . _t('Orders.ViewInvoice', 'View Invoice') . '</a>';
             $link_field = LiteralField::create('openQuote', $html);
             if ($actions->find("Name", "action_doSave")) {
                 $actions->insertAfter($link_field, "action_doSave");
             }
             if ($actions->find("Name", "action_doChangeStatus")) {
                 $actions->insertAfter($link_field, "action_doChangeStatus");
             }
         }
     }
     // Add a duplicate button, either after the save button or
     // the change status "save" button.
     if ($record->ID) {
         $duplicate_button = FormAction::create('doDuplicate', _t('Orders.Duplicate', 'Duplicate'))->setUseButtonTag(true);
         if ($actions->find("Name", "action_doSave")) {
             $actions->insertAfter($duplicate_button, "action_doSave");
         }
         if ($actions->find("Name", "action_doChangeStatus")) {
             $actions->insertAfter($duplicate_button, "action_doChangeStatus");
         }
     }
     // Finally, if allowed, re-add the delete button (so it is last)
     if ($record->ID && $can_delete) {
         $actions->push(FormAction::create('doDelete', _t('GridFieldDetailForm.Delete', 'Delete'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-destructive action-delete'));
     }
     // Set our custom template
     $form->setTemplate("OrdersItemEditForm");
     $this->extend("updateItemEditForm", $form);
     return $form;
 }