/**
  */
 public function getCMSFields()
 {
     $fields = new FieldSet(new TabSet('Root'));
     $cmsUsers = Member::mapInCMSGroups()->getItems();
     if ($cmsUsers && $cmsUsers->count()) {
         $cmsUsers = $cmsUsers->map();
     } else {
         $cmsUsers = array();
     }
     $fields->addFieldToTab('Root.Main', new TextField('Title', _t('WorkflowDefinition.TITLE', 'Title')));
     $fields->addFieldToTab('Root.Main', new TextareaField('Description', _t('WorkflowDefinition.DESCRIPTION', 'Description')));
     $fields->addFieldToTab('Root.Main', new CheckboxSetField('Users', _t('WorkflowDefinition.USERS', 'Users'), $cmsUsers));
     $fields->addFieldToTab('Root.Main', new TreeMultiselectField('Groups', _t('WorkflowDefinition.GROUPS', 'Groups'), 'Group'));
     if (class_exists('AbstractQueuedJob')) {
         $before = _t('WorkflowDefinition.SENDREMINDERDAYSBEFORE', 'Send reminder email after ');
         $after = _t('WorkflowDefinition.SENDREMINDERDAYSAFTER', ' days without action.');
         $fields->addFieldToTab('Root.Main', new FieldGroup(_t('WorkflowDefinition.REMINDEREMAIL', 'Reminder Email'), new LabelField('ReminderEmailBefore', $before), new NumericField('RemindDays', ''), new LabelField('ReminderEmailAfter', $after)));
     }
     if ($this->ID && Permission::check('VIEW_ACTIVE_WORKFLOWS')) {
         $fields->addFieldToTab('Root.ActiveInstances', $active = new ComplexTableField($this, 'Instances', 'WorkflowInstance', array('Title' => 'Title', 'Target.Title' => 'Target Title', 'WorkflowStatus' => 'Status', 'CurrentAction.Title' => 'Current Action', 'LastEdited' => 'Last Actioned'), 'getInstanceManagementFields', '"WorkflowStatus" IN (\'Active\', \'Paused\')', '"LastEdited" DESC'));
         if (Permission::check('REASSIGN_ACTIVE_WORKFLOWS')) {
             $active->setPermissions(array('show', 'edit'));
         } else {
             $active->setPermissions(array('show'));
         }
         $fields->addFieldToTab('Root.Completed', $complete = new ComplexTableField($this, 'CompletedInstances', 'WorkflowInstance', array('Title' => 'Title', 'Target.Title' => 'Target Title', 'WorkflowStatus' => 'Status', 'CurrentAction.Title' => 'Current Action', 'LastEdited' => 'Last Actioned'), 'getActionsSummaryFields', '"WorkflowStatus" IN (\'Complete\', \'Cancelled\')', '"LastEdited" DESC'));
         $complete->setPermissions(array('show'));
     }
     return $fields;
 }
 /**
  * Get the CMS view of the instance. This is used to display the log of
  * this workflow, and options to reassign if the workflow hasn't been
  * finished yet
  *
  * @return \FieldList
  */
 public function getCMSFields()
 {
     $fields = new FieldList();
     if (Permission::check('REASSIGN_ACTIVE_WORKFLOWS')) {
         if ($this->WorkflowStatus == 'Paused' || $this->WorkflowStatus == 'Active') {
             $cmsUsers = Member::mapInCMSGroups();
             $fields->push(new HiddenField('DirectUpdate', '', 1));
             $fields->push(new HeaderField('InstanceReassignHeader', _t('WorkflowInstance.REASSIGN_HEADER', 'Reassign workflow')));
             $fields->push(new CheckboxSetField('Users', _t('WorkflowDefinition.USERS', 'Users'), $cmsUsers));
             $fields->push(new TreeMultiselectField('Groups', _t('WorkflowDefinition.GROUPS', 'Groups'), 'Group'));
         }
     }
     if ($this->canEdit()) {
         $action = $this->CurrentAction();
         if ($action->exists()) {
             $actionFields = $this->getWorkflowFields();
             $fields->merge($actionFields);
             $transitions = $action->getValidTransitions();
             if ($transitions) {
                 $fields->replaceField('TransitionID', DropdownField::create("TransitionID", "Next action", $transitions->map()));
             }
         }
     }
     $items = WorkflowActionInstance::get()->filter(array('Finished' => 1, 'WorkflowID' => $this->ID));
     $grid = new GridField('Actions', _t('WorkflowInstance.ActionLogTitle', 'Log'), $items);
     $fields->push($grid);
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $cmsUsers = Member::mapInCMSGroups();
     $fields->addFieldsToTab('Root.Main', array(new HeaderField('AssignUsers', $this->fieldLabel('AssignUsers')), new CheckboxField('AssignInitiator', $this->fieldLabel('AssignInitiator')), new CheckboxSetField('Users', $this->fieldLabel('Users'), $cmsUsers), new TreeMultiselectField('Groups', $this->fieldLabel('Groups'), 'Group')));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $cmsUsers = Member::mapInCMSGroups();
     $fields->addFieldsToTab('Root.Main', array(new HeaderField('AssignUsers', $this->fieldLabel('AssignUsers')), new CheckboxField('AssignInitiator', $this->fieldLabel('AssignInitiator')), $users = CheckboxSetField::create('Users', $this->fieldLabel('Users'), $cmsUsers), new TreeMultiselectField('Groups', $this->fieldLabel('Groups'), 'Group')));
     // limit to the users which actually can access the CMS
     $users->setSource(Member::mapInCMSGroups());
     return $fields;
 }
	/**
	 * Get the pop-up fields for the given record.
	 */
	function getCustomFieldsFor($childData) {
		if(!$childData) {
			user_error("AssetTableField::DetailForm No record found");
			return null;
		}
		
		if($childData->ParentID) {
			$folder = DataObject::get_by_id('File', $childData->ParentID );
		} else {
			$folder = singleton('Folder');
		}
		
		$urlLink = "<div class='field readonly'>";
		$urlLink .= "<label class='left'>"._t('AssetTableField.URL','URL')."</label>";
		$urlLink .= "<span class='readonly'><a href='{$childData->Link()}'>{$childData->RelativeLink()}</a></span>";
		$urlLink .= "</div>";
		
		$detailFormFields = new FieldSet(
			new TabSet("BottomRoot",
				$mainTab = new Tab('Main',
					new TextField("Title", _t('AssetTableField.TITLE','Title')),
					new TextField("Name", _t('AssetTableField.FILENAME','Filename')),
					new LiteralField("AbsoluteURL", $urlLink),
					new ReadonlyField("FileType", _t('AssetTableField.TYPE','Type')),
					new ReadonlyField("Size", _t('AssetTableField.SIZE','Size'), $childData->getSize()),
					new DropdownField("OwnerID", _t('AssetTableField.OWNER','Owner'), Member::mapInCMSGroups()),
					new DateField_Disabled("Created", _t('AssetTableField.CREATED','First uploaded')),
					new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT','Last changed'))
				)
			)
		);
		$mainTab->setTitle(_t('AssetTableField.MAIN', 'Main'));

		if(is_a($childData, 'Image')) {
			$tab = $detailFormFields->findOrMakeTab("BottomRoot.Image", _t('AssetTableField.IMAGE', 'Image'));
			
			$big = $childData->URL;
			$formattedImage = $childData->getFormattedImage('AssetLibraryPreview');
			$thumbnail = $formattedImage ? $formattedImage->URL : '';
			
			// Hmm this required the translated string to be appended to BottomRoot to add this to the Main tab
			$detailFormFields->addFieldToTab('BottomRoot.Main',
				new ReadonlyField("Dimensions", _t('AssetTableField.DIM','Dimensions'))
			);

			$tab->push(
				new LiteralField("ImageFull",
					"<img id='thumbnailImage' src='{$thumbnail}?r=" . rand(1,100000)  . "' alt='{$childData->Name}' />"
				)
			);
		}

		if($childData && $childData->hasMethod('BackLinkTracking')) {
			if(class_exists('Subsite')) Subsite::disable_subsite_filter(true);
			$links = $childData->BackLinkTracking();
			if(class_exists('Subsite')) Subsite::disable_subsite_filter(false);

			if($links && $links->exists()) {
				$backlinks = array();
				foreach($links as $link) {
					$backlinks[] = "<li><a href=\"admin/show/$link->ID\">" . $link->Breadcrumbs(null,true). "</a></li>";
				}
				$backlinks = "<div style=\"clear:left\">". _t('AssetTableField.PAGESLINKING','The following pages link to this file:') ."<ul>" . implode("",$backlinks) . "</ul></div>";
			}
			if(!isset($backlinks)) $backlinks = "<p>". _t('AssetTableField.NOLINKS',"This file hasn't been linked to from any pages.") ."</p>";
			$detailFormFields->addFieldToTab("BottomRoot.Links", new LiteralField("Backlinks", $backlinks));
		}
		
		// the ID field confuses the Controller-logic in finding the right view for ReferencedField
		$detailFormFields->removeByName('ID');
		
		if($childData) $childData->extend('updateCMSFields', $detailFormFields);
		
		return $detailFormFields;
	}
Beispiel #6
0
 /**
  * Returns the fields to power the edit screen of files in the CMS.
  * You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
  * and implemeting updateCMSFields(FieldList $fields) on that extension.
  *
  * @return FieldList
  */
 public function getCMSFields()
 {
     // Preview
     if ($this instanceof Image) {
         $formattedImage = $this->getFormattedImage('ScaleWidth', Config::inst()->get('Image', 'asset_preview_width'));
         $thumbnail = $formattedImage ? $formattedImage->URL : '';
         $previewField = new LiteralField("ImageFull", "<img id='thumbnailImage' class='thumbnail-preview' src='{$thumbnail}?r=" . rand(1, 100000) . "' alt='{$this->Name}' />\n");
     } else {
         $previewField = new LiteralField("ImageFull", $this->CMSThumbnail());
     }
     // Upload
     $uploadField = UploadField::create('UploadField', 'Upload Field')->setPreviewMaxWidth(40)->setPreviewMaxHeight(30)->setAllowedMaxFileNumber(1);
     //$uploadField->setTemplate('FileEditUploadField');
     if ($this->ParentID) {
         $parent = $this->Parent();
         if ($parent) {
             //set the parent that the Upload field should use for uploads
             $uploadField->setFolderName($parent->getFilename());
             $uploadField->setRecord($parent);
         }
     }
     //create the file attributes in a FieldGroup
     $filePreview = CompositeField::create(CompositeField::create($previewField)->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create(CompositeField::create(new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'File type') . ':'), new ReadonlyField("Size", _t('AssetTableField.SIZE', 'File size') . ':', $this->getSize()), $urlField = new ReadonlyField('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<a href="%s" target="_blank">%s</a>', $this->Link(), $this->RelativeLink())), new DateField_Disabled("Created", _t('AssetTableField.CREATED', 'First uploaded') . ':'), new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed') . ':')))->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info');
     $urlField->dontEscape = true;
     //get a tree listing with only folder, no files
     $folderTree = new TreeDropdownField("ParentID", _t('AssetTableField.FOLDER', 'Folder'), 'Folder');
     $fields = new FieldList(new TabSet('Root', new Tab('Main', $filePreview, new TextField("Title", _t('AssetTableField.TITLE', 'Title')), new TextField("Name", _t('AssetTableField.FILENAME', 'Filename')), $ownerField = new DropdownField("OwnerID", _t('AssetTableField.OWNER', 'Owner'), Member::mapInCMSGroups()), $folderTree)));
     $ownerField->setHasEmptyDefault(true);
     // Folder has its own updateCMSFields hook
     if (!$this instanceof Folder) {
         $this->extend('updateCMSFields', $fields);
     }
     return $fields;
 }
 /**
  * Returns the fields to power the edit screen of files in the CMS.
  * You can modify this FieldList by subclassing folder, or by creating a {@link DataExtension}
  * and implemeting updateCMSFields(FieldList $fields) on that extension.
  *
  * @return FieldList
  */
 public function getCMSFields()
 {
     // Preview
     $filePreview = CompositeField::create(CompositeField::create(new LiteralField("ImageFull", $this->PreviewThumbnail()))->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'), CompositeField::create(CompositeField::create(new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'File type') . ':'), new ReadonlyField("Size", _t('AssetTableField.SIZE', 'File size') . ':', $this->getSize()), ReadonlyField::create('ClickableURL', _t('AssetTableField.URL', 'URL'), sprintf('<a href="%s" target="_blank">%s</a>', $this->Link(), $this->RelativeLink()))->setDontEscape(true), new DateField_Disabled("Created", _t('AssetTableField.CREATED', 'First uploaded') . ':'), new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed') . ':')))->setName("FilePreviewData")->addExtraClass('cms-file-info-data'))->setName("FilePreview")->addExtraClass('cms-file-info');
     //get a tree listing with only folder, no files
     $fields = new FieldList(new TabSet('Root', new Tab('Main', $filePreview, new TextField("Title", _t('AssetTableField.TITLE', 'Title')), new TextField("Name", _t('AssetTableField.FILENAME', 'Filename')), DropdownField::create("OwnerID", _t('AssetTableField.OWNER', 'Owner'), Member::mapInCMSGroups())->setHasEmptyDefault(true), new TreeDropdownField("ParentID", _t('AssetTableField.FOLDER', 'Folder'), 'Folder'))));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 function DetailForm()
 {
     $ID = isset($_REQUEST['ctf']['ID']) ? Convert::raw2xml($_REQUEST['ctf']['ID']) : null;
     $childID = isset($_REQUEST['ctf']['childID']) ? Convert::raw2xml($_REQUEST['ctf']['childID']) : null;
     $childClass = isset($_REQUEST['fieldName']) ? Convert::raw2xml($_REQUEST['fieldName']) : null;
     $methodName = isset($_REQUEST['methodName']) ? $_REQUEST['methodName'] : null;
     if (!$childID) {
         user_error("AssetTableField::DetailForm Please specify a valid ID");
         return null;
     }
     if ($childID) {
         $childData = DataObject::get_by_id("File", $childID);
     }
     if (!$childData) {
         user_error("AssetTableField::DetailForm No record found");
         return null;
     }
     if ($childData->ParentID) {
         $folder = DataObject::get_by_id('File', $childData->ParentID);
     } else {
         $folder = singleton('Folder');
     }
     $urlLink = "<div class='field readonly'>";
     $urlLink .= "<label class='left'>" . _t('AssetTableField.URL', 'URL') . "</label>";
     $urlLink .= "<span class='readonly'><a href='{$childData->Link()}'>{$childData->RelativeLink()}</a></span>";
     $urlLink .= "</div>";
     $detailFormFields = new FieldSet(new TabSet("BottomRoot", new Tab(_t('AssetTableField.MAIN', 'Main'), new TextField("Title", _t('AssetTableField.TITLE', 'Title')), new TextField("Name", _t('AssetTableField.FILENAME', 'Filename')), new LiteralField("AbsoluteURL", $urlLink), new ReadonlyField("FileType", _t('AssetTableField.TYPE', 'Type')), new ReadonlyField("Size", _t('AssetTableField.SIZE', 'Size'), $childData->getSize()), new DropdownField("OwnerID", _t('AssetTableField.OWNER', 'Owner'), Member::mapInCMSGroups($folder->CanEdit())), new DateField_Disabled("Created", _t('AssetTableField.CREATED', 'First uploaded')), new DateField_Disabled("LastEdited", _t('AssetTableField.LASTEDIT', 'Last changed')))));
     if (is_a($childData, 'Image')) {
         $big = $childData->URL;
         $thumbnail = $childData->getFormattedImage('AssetLibraryPreview')->URL;
         // Hmm this required the translated string to be appended to BottomRoot to add this to the Main tab
         $detailFormFields->addFieldToTab("BottomRoot." . _t('AssetTableField.MAIN', 'Main'), new ReadonlyField("Dimensions", _t('AssetTableField.DIM', 'Dimensions')), "Created");
         $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.IMAGE', 'Image'), new LiteralField("ImageFull", '<a id="ImageEditorActivator" href="javascript: void(0)">' . "<img id='thumbnailImage' src='{$thumbnail}?r=" . rand(1, 100000) . "' alt='{$childData->Name}' /><p>" . _t('AssetTableField.EDITIMAGE', 'Edit this image') . "</p>" . '</a>' . '<script type="text/javascript" src="cms/javascript/ImageEditor/Activator.js"></script><script type="text/javascript">var imageActivator = new ImageEditor.Activator.initialize();Event.observe("ImageEditorActivator","click",imageActivator.onOpen);</script>')), 'Main');
         if (class_exists('GalleryFile')) {
             $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), new TextField("Content", _t('AssetTableField.CAPTION', 'Caption'))));
         }
     } else {
         if (class_exists('GalleryFile')) {
             if ($childData->Extension == 'swf') {
                 $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), new TextField("Content", _t('AssetTableField.CAPTION', 'Caption')), new TextField('PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width')), new TextField('PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height')), new HeaderField(_t('AssetTableField.SWFFILEOPTIONS', 'SWF File Options')), new CheckboxField('Embed', _t('AssetTableField.ISFLASH', 'Is A Flash Document')), new CheckboxField('LimitDimensions', _t('AssetTableField.DIMLIMT', 'Limit The Dimensions In The Popup Window'))));
             } else {
                 $detailFormFields->addFieldToTab("BottomRoot", new Tab(_t('AssetTableField.GALLERYOPTIONS', 'Gallery Options'), new TextField("Content", _t('AssetTableField.CAPTION', 'Caption')), new TextField('PopupWidth', _t('AssetTableField.POPUPWIDTH', 'Popup Width')), new TextField('PopupHeight', _t('AssetTableField.POPUPHEIGHT', 'Popup Height'))));
             }
         }
     }
     if ($childData && $childData->hasMethod('BackLinkTracking')) {
         $links = $childData->BackLinkTracking();
         if ($links->exists()) {
             foreach ($links as $link) {
                 $backlinks[] = "<li><a href=\"admin/show/{$link->ID}\">" . $link->Breadcrumbs(null, true) . "</a></li>";
             }
             $backlinks = "<div style=\"clear:left\">" . _t('AssetTableField.PAGESLINKING', 'The following pages link to this file:') . "<ul>" . implode("", $backlinks) . "</ul>";
         }
         if (!isset($backlinks)) {
             $backlinks = "<p>" . _t('AssetTableField.NOLINKS', "This file hasn't been linked to from any pages.") . "</p>";
         }
         $detailFormFields->addFieldToTab("BottomRoot.Links", new LiteralField("Backlinks", $backlinks));
     }
     // the ID field confuses the Controller-logic in finding the right view for ReferencedField
     $detailFormFields->removeByName('ID');
     if ($childData) {
         $childData->extend('updateCMSFields', $detailFormFields);
     }
     // add a namespaced ID instead thats "converted" by saveComplexTableField()
     $detailFormFields->push(new HiddenField("ctf[childID]", "", $childID));
     $detailFormFields->push(new HiddenField("ctf[ClassName]", "", $this->sourceClass));
     $readonly = $this->methodName == "show";
     $form = new ComplexTableField_Popup($this, "DetailForm", $detailFormFields, $this->sourceClass, $readonly);
     if (is_numeric($childID)) {
         if ($methodName == "show" || $methodName == "edit") {
             $form->loadDataFrom($childData);
         }
     }
     if (!$folder->userCanEdit() || $methodName == "show") {
         $form->makeReadonly();
     }
     return $form;
 }
 /**
  */
 public function getCMSFields()
 {
     $cmsUsers = Member::mapInCMSGroups();
     $fields = new FieldList(new TabSet('Root'));
     $fields->addFieldToTab('Root.Main', new TextField('Title', _t('WorkflowDefinition.TITLE', 'Title')));
     $fields->addFieldToTab('Root.Main', new TextareaField('Description', _t('WorkflowDefinition.DESCRIPTION', 'Description')));
     if ($this->ID) {
         $fields->addFieldToTab('Root.Main', new CheckboxSetField('Users', _t('WorkflowDefinition.USERS', 'Users'), $cmsUsers));
         $fields->addFieldToTab('Root.Main', new TreeMultiselectField('Groups', _t('WorkflowDefinition.GROUPS', 'Groups'), 'Group'));
     }
     if (class_exists('AbstractQueuedJob')) {
         $before = _t('WorkflowDefinition.SENDREMINDERDAYSBEFORE', 'Send reminder email after ');
         $after = _t('WorkflowDefinition.SENDREMINDERDAYSAFTER', ' days without action.');
         $fields->addFieldToTab('Root.Main', new FieldGroup(_t('WorkflowDefinition.REMINDEREMAIL', 'Reminder Email'), new LabelField('ReminderEmailBefore', $before), new NumericField('RemindDays', ''), new LabelField('ReminderEmailAfter', $after)));
     }
     if ($this->ID) {
         if ($this->Template) {
             $template = $this->workflowService->getNamedTemplate($this->Template);
             $fields->addFieldToTab('Root.Main', new ReadonlyField('Template', _t('WorkflowDefinition.TEMPLATE_NAME', 'Source Template'), $this->Template));
             $fields->addFieldToTab('Root.Main', new ReadonlyField('TemplateDesc', _t('WorkflowDefinition.TEMPLATE_INFO', 'Template Info'), $template ? $template->getDescription() : ''));
             $fields->addFieldToTab('Root.Main', $tv = new ReadonlyField('TemplateVersion', _t('WorkflowDefinition:TEMPLATE_VERSION', 'Template Version')));
             $tv->setRightTitle(sprintf(_t('WorkflowDefinition.LATEST_VERSION', 'Latest version is %s'), $template->getVersion()));
         }
         $fields->addFieldToTab('Root.Main', new WorkflowField('Workflow', _t('WorkflowDefinition.WORKFLOW', 'Workflow'), $this));
     } else {
         // add in the 'template' info
         $templates = $this->workflowService->getTemplates();
         if (is_array($templates)) {
             $items = array('' => '');
             foreach ($templates as $template) {
                 $items[$template->getName()] = $template->getName();
             }
             $templates = array_combine(array_keys($templates), array_keys($templates));
             $fields->addFieldToTab('Root.Main', $dd = new DropdownField('Template', _t('WorkflowDefinition.CHOOSE_TEMPLATE', 'Choose template (optional)'), $items));
             $dd->setRightTitle('If set, this workflow definition will be automatically updated if the template is changed');
         }
         $message = _t('WorkflowDefinition.ADDAFTERSAVING', 'You can add workflow steps after you save for the first time.');
         $fields->addFieldToTab('Root.Main', new LiteralField('AddAfterSaving', "<p class='message notice'>{$message}</p>"));
     }
     if ($this->ID && Permission::check('VIEW_ACTIVE_WORKFLOWS')) {
         $active = $this->Instances()->filter(array('WorkflowStatus' => array('Active', 'Paused')));
         $active = new GridField('Active', 'Active Workflow Instances', $active, new GridFieldConfig_RecordEditor());
         $active->getConfig()->removeComponentsByType('GridFieldAddNewButton');
         $active->getConfig()->removeComponentsByType('GridFieldDeleteAction');
         if (!Permission::check('REASSIGN_ACTIVE_WORKFLOWS')) {
             $active->getConfig()->removeComponentsByType('GridFieldEditButton');
             $active->getConfig()->addComponent(new GridFieldViewButton());
             $active->getConfig()->addComponent(new GridFieldDetailForm());
         }
         $completed = $this->Instances()->filter(array('WorkflowStatus' => array('Complete', 'Cancelled')));
         $config = new GridFieldConfig_Base();
         $config->addComponent(new GridFieldEditButton());
         $config->addComponent(new GridFieldDetailForm());
         $completed = new GridField('Completed', 'Completed Workflow Instances', $completed, $config);
         $fields->addFieldToTab('Root.Active', $active);
         $fields->addFieldToTab('Root.Completed', $completed);
     }
     return $fields;
 }