/** * @param FieldSet $actions * @parma SiteTree $page */ public static function update_cms_actions(&$actions, $page) { $openRequest = $page->OpenWorkflowRequest(); // if user doesn't have publish rights if (!$page->canPublish() || $openRequest) { // authors shouldn't be able to revert, as this republishes the page. // they should rather change the page and re-request publication $actions->removeByName('action_revert'); } // Remove the one click publish if they are not an admin/workflow admin. if (self::$force_publishers_to_use_workflow && !Permission::checkMember(Member::currentUser(), 'IS_WORKFLOW_ADMIN')) { $actions->removeByName('action_publish'); } // Remove the save & publish button if you don't have edit rights if (!$page->canEdit()) { $actions->removeByName('action_publish'); } $liveVersion = Versioned::get_one_by_stage('SiteTree', 'Live', "\"SiteTree_Live\".\"ID\" = {$page->ID}"); if ($liveVersion && $liveVersion->ExpiryDate != null && $liveVersion->ExpiryDate != '0000-00-00 00:00:00') { if ($page->canApprove()) { $actions->push(new FormAction('cms_cancelexpiry', _t('WorkflowPublicationRequest.BUTTONCANCELEXPIRY', 'Cancel expiry'))); } } // Optional method $isPublishable = $page->hasMethod('isPublishable') ? $page->isPublishable() : true; if (!$openRequest && $page->canEdit() && $isPublishable && $page->stagesDiffer('Stage', 'Live') && ($page->Version > 1 || $page->Title != "New Page") && !$page->IsDeletedFromStage && (!$page->canPublish() || self::$publisher_can_create_wf_requests)) { $actions->push($requestPublicationAction = new FormAction('cms_requestpublication', _t('SiteTreeCMSWorkflow.BUTTONREQUESTPUBLICATION', 'Request Publication'))); // don't allow creation of a second request by another author if (!self::can_create(null, $page)) { $actions->makeFieldReadonly($requestPublicationAction->Name()); } } }
public function __construct($controller, $method, $fields = null, $actions = null, $checkCurrentUser = true) { if (isset($_REQUEST['BackURL'])) { $backURL = $_REQUEST['BackURL']; } else { $backURL = Session::get('BackURL'); } if ($checkCurrentUser && Member::currentUser() && Member::logged_in_session_exists()) { $fields = new FieldSet(new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this)); $actions = new FieldSet(new FormAction("logout", _t('Member.BUTTONLOGINOTHER', "Log in as someone else"))); } else { if (!$fields) { $fields = new FieldSet(new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this)); if (Security::$autologin_enabled) { $fields->push(new CheckboxField("Remember", _t('Member.REMEMBERME'), Session::get('SessionForms.LinkedinLoginForm.Remember'), $this)); } } if (!$actions) { $actions = new FieldSet(new ImageFormAction('dologin', 'Sign in with LinkedIn', 'linkedin/Images/linkedin.png')); } } if (!empty($backURL)) { $fields->push(new HiddenField('BackURL', 'BackURL', $backURL)); } parent::__construct($controller, $method, $fields, $actions); }
/** * Constructor * * @param Controller $controller The parent controller, necessary to * create the appropriate form action tag. * @param string $name The method on the controller that will return this * form object. * @param FieldSet|FormField $fields All of the fields in the form - a * {@link FieldSet} of {@link FormField} * objects. * @param FieldSet|FormAction $actions All of the action buttons in the * form - a {@link FieldSet} of */ function __construct($controller, $name, $fields = null, $actions = null) { if (isset($_REQUEST['BackURL'])) { $backURL = $_REQUEST['BackURL']; } else { $backURL = Session::get('BackURL'); } if (!$fields) { $fields = new FieldSet(); // Security/changepassword?h=XXX redirects to Security/changepassword // without GET parameter to avoid potential HTTP referer leakage. // In this case, a user is not logged in, and no 'old password' should be necessary. if (Member::currentUser()) { $fields->push(new PasswordField("OldPassword", _t('Member.YOUROLDPASSWORD', "Your old password"))); } $fields->push(new PasswordField("NewPassword1", _t('Member.NEWPASSWORD', "New Password"))); $fields->push(new PasswordField("NewPassword2", _t('Member.CONFIRMNEWPASSWORD', "Confirm New Password"))); } if (!$actions) { $actions = new FieldSet(new FormAction("doChangePassword", _t('Member.BUTTONCHANGEPASSWORD', "Change Password"))); } if (isset($backURL)) { $fields->push(new HiddenField('BackURL', 'BackURL', $backURL)); } parent::__construct($controller, $name, $fields, $actions); }
function getCMSFields_forPopup() { $fields = new FieldSet(); $fields->push(new TextField('Title', 'Title')); $fields->push(new TextField('Description')); return $fields; }
function getCMSFields_forPopup() { $fields = new FieldSet(); $fields->push(new TextField('Title')); $fields->push(new FileIFrameField('KmlFile')); return $fields; }
public function getCMSFields_forPopup() { $oFields = new FieldSet(); $oFields->push(new TextField('Title')); $oFields->push(new TextField('Percentage')); return $oFields; }
/** * Constructor * * @param Controller $controller The parent controller, necessary to * create the appropriate form action tag. * @param string $name The method on the controller that will return this * form object. * @param FieldSet|FormField $fields All of the fields in the form - a * {@link FieldSet} of {@link FormField} * objects. * @param FieldSet|FormAction $actions All of the action buttons in the * form - a {@link FieldSet} of * {@link FormAction} objects * @param bool $checkCurrentUser If set to TRUE, it will be checked if a * the user is currently logged in, and if * so, only a logout button will be rendered * @param string $authenticatorClassName Name of the authenticator class that this form uses. */ function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true) { // This is now set on the class directly to make it easier to create subclasses // $this->authenticator_class = $authenticatorClassName; $customCSS = project() . '/css/member_login.css'; if(Director::fileExists($customCSS)) { Requirements::css($customCSS); } // Focus on the email input when the page is loaded Requirements::customScript(" (function($){ $(document).ready(function() { $('#Email input').focus(); }); })(jQuery); "); if(isset($_REQUEST['BackURL'])) { $backURL = $_REQUEST['BackURL']; } else { $backURL = Session::get('BackURL'); } if($checkCurrentUser && Member::currentUserID()) { $fields = new FieldSet(); $actions = new FieldSet(new FormAction("logout", _t('Member.BUTTONLOGINOTHER', "Log in as someone else"))); } else { if(!$fields) { $fields = new FieldSet( new HiddenField("AuthenticationMethod", null, $this->authenticator_class, $this), new TextField("Email", _t('Member.EMAIL', 'Email'), Session::get('SessionForms.MemberLoginForm.Email'), null, $this), new PasswordField("Password", _t('Member.PASSWORD', 'Password')) ); if(Security::$autologin_enabled) { $fields->push(new CheckboxField( "Remember", _t('Member.REMEMBERME', "Remember me next time?") )); } } if(!$actions) { $actions = new FieldSet( new FormAction('dologin', _t('Member.BUTTONLOGIN', "Log in")), new LiteralField( 'forgotPassword', '<p id="ForgotPassword"><a href="Security/lostpassword">' . _t('Member.BUTTONLOSTPASSWORD', "I've lost my password") . '</a></p>' ) ); } } if(isset($backURL)) { $fields->push(new HiddenField('BackURL', 'BackURL', $backURL)); } parent::__construct($controller, $name, $fields, $actions); }
public function getCMSFields_forPopup() { $fields = new FieldSet(); $fields->push(new TextareaField('Caption')); $fields->push(new ImageField('Photo')); return $fields; }
public function getCMSFields_forPopup() { $oFields = new FieldSet(); $oFields->push(new TextField('FieldName', 'V.Important: No Spaces, Camel Case and abbreviate where possible')); $oFields->push(new TextField('Title')); $oFields->push(new TextField('Description')); return $oFields; }
/** * Create fields for editing a ProductImage in the CMS. * * @return FieldSet */ public function getCMSFields_forPopup() { $fields = new FieldSet(); $fields->push(new TextareaField('Caption')); $imageUploadField = class_exists('ImageUploadField') ? new ImageUploadField('Image') : new FileIFrameField('Image'); $fields->push($imageUploadField); return $fields; }
function parameterFields() { $params = new FieldSet(); $params->push($startDate = Object::create('DatetimeField', 'StartDate', 'Start date')); $params->push($endDate = Object::create('DatetimeField', 'EndDate', 'End date')); $startDate->getTimeField()->setValue('23:59:59'); $endDate->getTimeField()->setValue('23:59:59'); return $params; }
function __construct($controller, $name) { $member = Member::currentUser(); $requiredFields = null; if ($member && $member->exists()) { $fields = $member->getEcommerceFields(true); $fields->push(new HeaderField('LoginDetails', _t('Account.LOGINDETAILS', 'Login Details'), 3)); $logoutLink = ShoppingCart_Controller::clear_cart_and_logout_link(); $fields->push(new LiteralField('LogoutNote', "<p class=\"message warning\">" . _t("Account.LOGGEDIN", "You are currently logged in as ") . $member->FirstName . ' ' . $member->Surname . '. <a href="' . $logoutLink . '">' . _t('Account.LOGOUT', 'Log out now?') . "</a></p>")); // PASSWORD KEPT CHANGING - SO I REMOVED IT FOR NOW - Nicolaas $passwordField = new ConfirmedPasswordField('Password', _t('Account.PASSWORD', 'Password'), "", null, true); $fields->push($passwordField); $requiredFields = new ShopAccountForm_Validator($member->getEcommerceRequiredFields()); $actions = new FieldSet(new FormAction('submit', _t('Account.SAVE', 'Save Changes'))); if ($order = ShoppingCart::current_order()) { if ($order->Items()) { $actions->push(new FormAction('proceed', _t('Account.SAVEANDPROCEED', 'Save changes and proceed to checkout'))); } } } else { $member = new Member(); $fields = new FieldSet(); $fields->push(new HeaderField('SignUp', _t('ShopAccountForm.CREATEACCOUNT', 'Create Account'))); $fields->push(new LiteralField('MemberInfo', '<p class="message good">' . _t('OrderForm.MEMBERINFO', 'If you are already have an account then please') . " <a href=\"Security/login?BackURL=" . $controller->Link() . "\">" . _t('OrderForm.LOGIN', 'log in') . '</a>.</p>')); $memberFields = $member->getEcommerceFields(true); if ($memberFields) { foreach ($memberFields as $memberField) { $fields->push($memberField); } } // PASSWORD KEPT CHANGING - SO I REMOVED IT FOR NOW - Nicolaas $passwordField = new PasswordField('Password', _t('Account.PASSWORD', 'Password')); $fields->push($passwordField); $requiredFields = new ShopAccountForm_Validator($member->getEcommerceRequiredFields()); $actions = new FieldSet(new FormAction('creatememberandaddtoorder', _t('Account.SAVE', 'Create Account'))); } parent::__construct($controller, $name, $fields, $actions, $requiredFields); //extensions need to be set after __construct if ($this->extend('updateFields', $fields) !== null) { $this->setFields($fields); } if ($this->extend('updateActions', $actions) !== null) { $this->setActions($actions); } if ($this->extend('updateValidator', $requiredFields) !== null) { $this->setValidator($requiredFields); } if ($member && $member->Password) { $this->loadDataFrom($member); if (!isset($_REQUEST["Password"])) { $this->fields()->fieldByName("Password")->SetValue(""); } $this->fields()->fieldByName("Password")->setCanBeEmpty(true); } $this->extend('updateShopAccountForm', $this); }
public function getCMSFields_forPopup() { $fields = new FieldSet(); $fields->push(new TextareaField('Caption', _t('ImageGalleryItem.CAPTION', 'Caption'))); if ($this->ImageGalleryPageID) { $fields->push(new DropdownField('AlbumID', _t('ImageGalleryItem.ALBUM', 'Album'), $this->ImageGalleryPage()->Albums()->toDropdownMap('ID', 'AlbumName'))); } $fields->push(new ImageField('Image')); return $fields; }
function Form() { $fields = new FieldSet(new TextField('MyText')); if (class_exists('RecaptchaField')) { $fields->push(new RecaptchaField('MyRecaptcha')); } else { $fields->push(new LiteralField('<p class="message error">RecaptchaField class not found</p>')); } $form = new Form($this, 'Form', $fields, new FieldSet(new FormAction('submit', 'submit')), new RequiredFields(array('MyText'))); return $form; }
/** * Field for editing a {@link FlatFeeTaxRate}. * * @return FieldSet */ public function getCMSFields_forPopup() { $fields = new FieldSet(); $fields->push(new TextField('Title', _t('FlatFeeTaxRate.LABEL', 'Label'))); $fields->push(new TextField('Description', _t('FlatFeeTaxRate.DESCRIPTION', 'Description'))); $countryField = new DropdownField('CountryID', _t('FlatFeeTaxRate.COUNTRY', 'Country'), Country::shipping_countries()); $fields->push($countryField); $rateField = new NumericField('Rate', _t('FlatFeeTaxRate.TAX_RATE', 'Tax rate as a percentage')); $fields->push($rateField); return $fields; }
public function getCMSFields_forPopup() { $oFields = new FieldSet(); $oFields->push(new TextField('Title')); $oFields->push(new TextField('Amount')); // If there are Categorys if (Dataobject::get('DataCategory')) { // Add a selection box $oFields->push(new DropdownField('DataCategoryID', 'DataCategory', self::DataCategorySections())); } return $oFields; }
/** * @return FieldSet */ public function getCMSActions() { $actions = new FieldSet(); if ($this->SentDate) { $actions->push(new FormAction('send', _t('Newsletter.RESEND', 'Resend'))); } else { $actions->push(new FormAction('send', _t('Newsletter.SEND', 'Send...'))); } $actions->push(new FormAction('save', _t('Newsletter.SAVE', 'Save'))); $this->extend('updateCMSActions', $actions); return $actions; }
/** * Field for editing a {@link FlatFeeShippingRate}. * * @return FieldSet */ public function getCMSFields_forPopup() { $fields = new FieldSet(); $fields->push(new TextField('Title', _t('FlatFeeShippingRate.LABEL', 'Label'))); $fields->push(new TextField('Description', _t('FlatFeeShippingRate.DESCRIPTION', 'Description'))); $amountField = new MoneyField(_t('FlatFeeShippingRate.AMOUNT', 'Amount')); $amountField->setAllowedCurrencies(Product::$allowed_currency); $fields->push($amountField); $countryField = new DropdownField('CountryID', _t('FlatFeeShippingRate.COUNTRY', 'Country'), Country::shipping_countries()); $fields->push($countryField); return $fields; }
public function getCMSFields_forPopup() { $oFields = new FieldSet(); $oFields->push(new TextField('FieldName', 'V.Important: No Spaces and abbreviated')); $oFields->push(new TextField('Title')); $oFields->push(new TextField('Description')); // If there are Categorys if (Dataobject::get('FormCategory')) { // Add a selection box $oFields->push(new DropdownField('FormCategoryID', 'FormCategory', self::FormCategorySections())); } return $oFields; }
function Form() { $fields = new FieldSet(); $source = array(); $fields->push(new HeaderField('Header', _t('RemoveOrphanedPagesTask.HEADER', 'Remove all orphaned pages task'))); $fields->push(new LiteralField('Description', $this->description)); $orphans = $this->getOrphanedPages($this->orphanedSearchClass); if ($orphans) { foreach ($orphans as $orphan) { $latestVersion = Versioned::get_latest_version($this->orphanedSearchClass, $orphan->ID); $latestAuthor = DataObject::get_by_id('Member', $latestVersion->AuthorID); $stageRecord = Versioned::get_one_by_stage($this->orphanedSearchClass, 'Stage', sprintf("\"%s\".\"ID\" = %d", ClassInfo::baseDataClass($this->orphanedSearchClass), $orphan->ID)); $liveRecord = Versioned::get_one_by_stage($this->orphanedSearchClass, 'Live', sprintf("\"%s\".\"ID\" = %d", ClassInfo::baseDataClass($this->orphanedSearchClass), $orphan->ID)); $label = sprintf('<a href="admin/show/%d">%s</a> <small>(#%d, Last Modified Date: %s, Last Modifier: %s, %s)</small>', $orphan->ID, $orphan->Title, $orphan->ID, DBField::create('Date', $orphan->LastEdited)->Nice(), $latestAuthor ? $latestAuthor->Title : 'unknown', $liveRecord ? 'is published' : 'not published'); $source[$orphan->ID] = $label; } } if ($orphans && $orphans->Count()) { $fields->push(new CheckboxSetField('OrphanIDs', false, $source)); $fields->push(new LiteralField('SelectAllLiteral', sprintf('<p><a href="#" onclick="javascript:jQuery(\'#Form_Form_OrphanIDs :checkbox\').attr(\'checked\', \'checked\'); return false;">%s</a> ', _t('RemoveOrphanedPagesTask.SELECTALL', 'select all')))); $fields->push(new LiteralField('UnselectAllLiteral', sprintf('<a href="#" onclick="javascript:jQuery(\'#Form_Form_OrphanIDs :checkbox\').attr(\'checked\', \'\'); return false;">%s</a></p>', _t('RemoveOrphanedPagesTask.UNSELECTALL', 'unselect all')))); $fields->push(new OptionSetField('OrphanOperation', _t('RemoveOrphanedPagesTask.CHOOSEOPERATION', 'Choose operation:'), array('rebase' => _t('RemoveOrphanedPagesTask.OPERATION_REBASE', sprintf('Rebase selected to a new holder page "%s" and unpublish. None of these pages will show up for website visitors.', $this->rebaseHolderTitle())), 'remove' => _t('RemoveOrphanedPagesTask.OPERATION_REMOVE', 'Remove selected from all stages (WARNING: Will destroy all selected pages from both stage and live)')), 'rebase')); $fields->push(new LiteralField('Warning', sprintf('<p class="message">%s</p>', _t('RemoveOrphanedPagesTask.DELETEWARNING', 'Warning: These operations are not reversible. Please handle with care.')))); } else { $fields->push(new LiteralField('NotFoundLabel', sprintf('<p class="message">%s</p>', _t('RemoveOrphanedPagesTask.NONEFOUND', 'No orphans found')))); } $form = new Form($this, 'Form', $fields, new FieldSet(new FormAction('doSubmit', _t('RemoveOrphanedPagesTask.BUTTONRUN', 'Run')))); if (!$orphans || !$orphans->Count()) { $form->makeReadonly(); } return $form; }
function ShippingMethodForm() { $checkout = new Checkout($this->owner->Cart()); $estimates = $checkout->getShippingEstimates(); $fields = new FieldSet(); if ($estimates->exists()) { $fields->push(new OptionsetField("ShippingMethodID", "", $estimates->toDropDownMap(), $estimates->First()->ID)); } else { $fields->push(new LiteralField("NoShippingMethods", "<p class=\"message warning\">There are no shipping methods available</p>")); } $actions = new FieldSet(new FormAction("setShippingMethod", "Continue")); $form = new Form($this->owner, "ShippingMethodForm", $fields, $actions); return $form; }
function getCMSFields() { $objects = DataObject::get("SmartChimpSignupPage"); $fields = new FieldSet(); if ($objects) { $fields->push(new TextField('BetterTitle', 'Title')); $fields->push(new TextAreaField('Introduction', 'Introduction', $row = 5, $cols = 5)); $fields->push(new TextField('TextOnButton', 'Text On Button')); $fields->push(new DropdownField('NewsletterSignUpPageID', 'Signup Page', $objects->toDropdownMap())); } else { $fields->push(new LiteralField('NoSmartChimpSignupPage', '<p>Please first create a sign-up page.</p>')); } $this->extend('updateCMSFields', $fields); return $fields; }
function PostCommentForm() { Requirements::javascript('jsparty/behaviour.js'); Requirements::javascript('jsparty/prototype.js'); Requirements::javascript('jsparty/scriptaculous/effects.js'); Requirements::javascript('cms/javascript/PageCommentInterface.js'); $fields = new FieldSet(new HiddenField("ParentID", "ParentID", $this->page->ID), new TextField("Name", _t('PageCommentInterface.YOURNAME', 'Your name'))); if (MathSpamProtection::isEnabled()) { $fields->push(new TextField("Math", sprintf(_t('PageCommentInterface.SPAMQUESTION', "Spam protection question: %s"), MathSpamProtection::getMathQuestion()))); } $fields->push(new TextareaField("Comment", _t('PageCommentInterface.YOURCOMMENT', "Comments"))); $form = new PageCommentInterface_Form($this->controller, $this->methodName . ".PostCommentForm", $fields, new FieldSet(new FormAction("postcomment", _t('PageCommentInterface.POST', 'Post')))); $form->loadDataFrom(array("Name" => Cookie::get("PageCommentInterface_Name"))); return $form; }
/** * Constructor * * @param Controller $controller The parent controller, necessary to * create the appropriate form action tag. * @param string $name The method on the controller that will return this * form object. * @param FieldSet|FormField $fields All of the fields in the form - a * {@link FieldSet} of {@link FormField} * objects. * @param FieldSet|FormAction $actions All of the action buttons in the * form - a {@link FieldSet} of */ function __construct($controller, $name, $fields = null, $actions = null) { if (!$fields) { $fields = new FieldSet(); if (Member::currentUser() && (!isset($_REQUEST['h']) || !Member::member_from_autologinhash($_REQUEST['h']))) { $fields->push(new PasswordField("OldPassword", _t('Member.YOUROLDPASSWORD', "Your old password"))); } $fields->push(new PasswordField("NewPassword1", _t('Member.NEWPASSWORD', "New Password"))); $fields->push(new PasswordField("NewPassword2", _t('Member.CONFIRMNEWPASSWORD', "Confirm New Password"))); } if (!$actions) { $actions = new FieldSet(new FormAction("doChangePassword", _t('Member.BUTTONCHANGEPASSWORD', "Change Password"))); } parent::__construct($controller, $name, $fields, $actions); }
function getCMSFields_forPopup() { $fields = new FieldSet(); // $tabset = new HorizontalTabSet('Root'); // $tabset->push(new Tab('Main')); // $tabset->push(new Tab('Formats')); // $fields->push($tabset); $fields->push(new TextField('Title', 'Video Title')); $fields->push($blurbField = new SimpleTinyMCEField('Blurb')); $config = HtmlEditorConfig::get_active(); $contentCSS = $config->getOption('content_css'); // hack! $contentCSS = '/'.str_replace(', ', ', /', $contentCSS); $blurbField->setContentCSS($contentCSS); $blurbField->setExtraOptions("body_class : 'typography'"); $fields->push(new ImageField('Poster', 'Poster Image')); $videoManager = new FileDataobjectManager( $this, // Controller 'VideoFormats', // Source name 'MediaElementVideoFormat', // Source class 'Attachment', array( 'Type' => 'Type', 'LinkifiedLink' => 'Link' ), // Headings 'getCMSFields_forPopup' // Detail fields (function name or FieldSet object) // Filter clause // Sort clause // Join clause ); $videoManager->setPluralTitle('Formats'); $videoManager->setAddTitle('Format'); // $videoManager->setWideMode(true); $videoManager->setPopupWidth(600); $videoManager->setDefaultView('list'); $fields->push($videoManager); // $fields->push($videoManager); return $fields; }
public function getFields() { $datetime = $this->getForm()->getController()->getDateTime(); $session = $this->getForm()->getSession(); $fields = new FieldSet($tickets = new EventRegistrationTicketsTableField('Tickets', $datetime)); $tickets->setExcludedRegistrationId($session->RegistrationID); if ($member = Member::currentUser()) { $fields->push(new ReadonlyField('Name', 'Your name', $member->getName())); $fields->push(new ReadonlyField('Email', 'Email address', $member->Email)); } else { $fields->push(new TextField('Name', 'Your name')); $fields->push(new EmailField('Email', 'Email address')); } $this->extend('updateFields', $fields); return $fields; }
/** * Adds fields to the Member Ecommerce FieldSet. * In this case, we add the name of the organisation as READ-ONLY. * @param FieldSet $fields * @return FieldSet */ function augmentEcommerceFields(&$fields) { if ($group = $this->owner->getCorporateAccountGroup()) { $fields->push(new ReadonlyField("OrganisationName", _t("EcommerceCorporateAccount.FOR", "For"), $group->CombinedCorporateGroupName())); } return $fields; }
function getPaymentFormFields() { $site_currency = Payment::site_currency(); $paymentsList = '<div id="SecurePayTechCardsAvailable">'; $count = 0; foreach (self::$credit_cards as $name => $image) { $count++; $class = ''; if ($count == 1) { $class = "first"; } if ($count % 2) { $class .= " even"; } else { $class .= " odd"; } $paymentsList .= '<img src="' . $image . '" alt="' . $name . '" class="SecurePayTechCardImage' . $count . '" />'; } Requirements::customScript(' function paymark_verify(merchant) { window.open ("http://www.paymark.co.nz/dart/darthttp.dll?etsl&tn=verify&merchantid=" + merchant, "verify", "scrollbars=yes, width=400, height=400"); } ', 'paymark_verify'); $paymentsList .= ' <img height="30" src="payment_securatech/images/paymark_small.png" alt="Paymark Certified" onclick="paymark_verify (' . "'" . self::get_spt_merchant_id() . "'" . ')" class="last" /> </div>'; $fieldSet = new FieldSet(); $fieldSet->push(new LiteralField('SPTInfo', $paymentsList)); return $fieldSet; }
/** * Get the fields that are sent to the CMS. In * your decorators: updateCMSFields(&$fields) * * @return Fieldset */ function getCMSFields() { Requirements::javascript(CMS_DIR . "/javascript/SitetreeAccess.js"); $fields = new FieldSet(new TabSet("Root", $tabMain = new Tab('Main', $titleField = new TextField("Title", _t('SiteConfig.SITETITLE', "Site title")), $taglineField = new TextField("Tagline", _t('SiteConfig.SITETAGLINE', "Site Tagline/Slogan")), new DropdownField("Theme", _t('SiteConfig.THEME', 'Theme'), $this->getAvailableThemes(), '', null, _t('SiteConfig.DEFAULTTHEME', '(Use default theme)'))), $tabAccess = new Tab('Access', new HeaderField('WhoCanViewHeader', _t('SiteConfig.VIEWHEADER', "Who can view pages on this site?"), 2), $viewersOptionsField = new OptionsetField("CanViewType"), $viewerGroupsField = new TreeMultiselectField("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups")), new HeaderField('WhoCanEditHeader', _t('SiteConfig.EDITHEADER', "Who can edit pages on this site?"), 2), $editorsOptionsField = new OptionsetField("CanEditType"), $editorGroupsField = new TreeMultiselectField("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups")), new HeaderField('WhoCanCreateTopLevelHeader', _t('SiteConfig.TOPLEVELCREATE', "Who can create pages in the root of the site?"), 2), $topLevelCreatorsOptionsField = new OptionsetField("CanCreateTopLevelType"), $topLevelCreatorsGroupsField = new TreeMultiselectField("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators"))))); $viewersOptionsSource = array(); $viewersOptionsSource["Anyone"] = _t('SiteTree.ACCESSANYONE', "Anyone"); $viewersOptionsSource["LoggedInUsers"] = _t('SiteTree.ACCESSLOGGEDIN', "Logged-in users"); $viewersOptionsSource["OnlyTheseUsers"] = _t('SiteTree.ACCESSONLYTHESE', "Only these people (choose from list)"); $viewersOptionsField->setSource($viewersOptionsSource); $editorsOptionsSource = array(); $editorsOptionsSource["LoggedInUsers"] = _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS"); $editorsOptionsSource["OnlyTheseUsers"] = _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)"); $editorsOptionsField->setSource($editorsOptionsSource); $topLevelCreatorsOptionsField->setSource($editorsOptionsSource); // Translatable doesn't handle updateCMSFields on DataObjects, // so add it here to save the current Locale, // because onBeforeWrite does not work. if (Object::has_extension('SiteConfig', "Translatable")) { $fields->push(new HiddenField("Locale")); } if (!Permission::check('EDIT_SITECONFIG')) { $fields->makeFieldReadonly($viewersOptionsField); $fields->makeFieldReadonly($viewerGroupsField); $fields->makeFieldReadonly($editorsOptionsField); $fields->makeFieldReadonly($editorGroupsField); $fields->makeFieldReadonly($topLevelCreatorsOptionsField); $fields->makeFieldReadonly($topLevelCreatorsGroupsField); $fields->makeFieldReadonly($taglineField); $fields->makeFieldReadonly($titleField); } $tabMain->setTitle(_t('SiteConfig.TABMAIN', "Main")); $tabAccess->setTitle(_t('SiteConfig.TABACCESS', "Access")); $this->extend('updateCMSFields', $fields); return $fields; }
/** * Initiate the standard Metadata catalogue search form. The * additional parameter $defaults defines the default values for the form. * * @param Controller $controller The parent controller, necessary to create the appropriate form action tag. * @param String $name The method on the controller that will return this form object. * @param FieldSet $fields All of the fields in the form - a {@link FieldSet} of {@link FormField} objects. * @param FieldSet $actions All of the action buttons in the form - a {@link FieldSet} of {@link FormAction} objects * @param Validator $validator Override the default validator instance (Default: {@link RequiredFields}) * @param Array $defaults Override the default values of the form. */ function __construct($controller, $name, FieldSet $fields = null, FieldSet $actions = null, $validator = null, $defaults = null) { $format = $defaults['format']; $searchTerm = $defaults['searchTerm']; $bboxUpper = $bboxLower = null; if (isset($defaults['bboxUpper']) && isset($defaults['bboxLower'])) { $bboxUpper = $defaults['bboxUpper']; $bboxLower = $defaults['bboxLower']; } $values = CataloguePage_Controller::get_standard_names(); $upperField = new HiddenField('bboxUpper', _t('SearchForm.SEARCH', 'bboxUpper'), $bboxUpper); $upperField->addExtraClass('upper'); $lowerField = new HiddenField('bboxLower', _t('SearchForm.SEARCH', 'bboxLower'), $bboxLower); $lowerField->addExtraClass('lower'); if (!$fields) { $fields = new FieldSet(new TextField('searchTerm', _t('SearchForm.SEARCH', 'Search'), $searchTerm), $upperField, $lowerField, new OptionsetField('format', _t('SearchForm.MetadataStandard', 'Metadata Standard'), $values, $format)); } if (singleton('SiteTree')->hasExtension('Translatable')) { $fields->push(new HiddenField('locale', 'locale', Translatable::get_current_locale())); } if (!$actions) { $actions = new FieldSet(new FormAction("submit", _t('SearchForm.Search', 'Search'))); } parent::__construct($controller, $name, $fields, $actions); $this->setFormMethod('get'); }