/**
  * Build the "Hit Highlighting" form.
  */
 public function init()
 {
     parent::init();
     // Enable Highlighting:
     $this->addElement('checkbox', 'solr_search_hl', array('label' => __('Enable Highlighting'), 'description' => __('Display snippets with highlighted term matches.'), 'value' => get_option('solr_search_hl')));
     // Number of Snippets:
     $this->addElement('text', 'solr_search_hl_snippets', array('label' => __('Number of Snippets'), 'description' => __('The maximum number of snippets to display.'), 'value' => get_option('solr_search_hl_snippets'), 'required' => true, 'size' => 40, 'validators' => array(array('validator' => 'Int', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_Int::NOT_INT => __('Must be an integer.')))))));
     // Snippet Length:
     $this->addElement('text', 'solr_search_hl_fragsize', array('label' => __('Snippet Length'), 'description' => __('The maximum number of characters to display in a snippet.'), 'value' => get_option('solr_search_hl_fragsize'), 'required' => true, 'size' => 40, 'validators' => array(array('validator' => 'Int', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_Int::NOT_INT => __('Must be an integer.')))))));
     // Max Analyzed Chars
     $this->addElement('text', 'solr_search_hl_max_analyzed_chars', array('label' => __('Extent of Document Highlightable'), 'description' => __('How much of the document can be highlighted, in characters. Occurrences past this point will not be returned in the results highlighting.'), 'value' => get_option('solr_search_hl_max_analyzed_chars'), 'required' => true, 'size' => 10, 'validators' => array(array('validator' => 'Int', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_Int::NOT_INT => __('Must be an integer.')))))));
     // Facet Ordering:
     $this->addElement('select', 'solr_search_facet_sort', array('label' => __('Facet Ordering'), 'description' => __('The sorting criteria for result facets.'), 'multiOptions' => array('index' => __('Alphabetical'), 'count' => __('Occurrences')), 'value' => get_option('solr_search_facet_sort')));
     // Maximum Facet Count:
     $this->addElement('text', 'solr_search_facet_limit', array('label' => __('Facet Count'), 'description' => __('The maximum number of facets to display.'), 'value' => get_option('solr_search_facet_limit'), 'required' => true, 'size' => 40, 'validators' => array(array('validator' => 'Int', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_Int::NOT_INT => __('Must be an integer.')))))));
     // Display Private Items:
     $this->addElement('checkbox', 'solr_search_display_private_items', array('label' => __('Display private items'), 'description' => __('Display private items for all user roles with sufficient permission to view them.'), 'value' => get_option('solr_search_display_private_items')));
     // Display facets order:
     $this->addElement('textarea', 'solr_search_display_facets_order', array('label' => __('Display facets order'), 'description' => __('The order of facets to display (internal id code). Facets that are not mentioned here are not shown. Facets that are mentioned here MUST be added as facet in Fields setting.'), 'value' => get_option('solr_search_display_facets_order'), 'required' => false, 'rows' => 12));
     // Display ADMIN facets order:
     $this->addElement('textarea', 'solr_search_admin_display_facets_order', array('label' => __('Display facets order for ADMINS'), 'description' => __('ADMIN: The order of facets to display (internal id code). Facets that are not mentioned here are not shown. Facets that are mentioned here MUST be added as facet in Fields setting.'), 'value' => get_option('solr_search_admin_display_facets_order'), 'required' => false, 'rows' => 12));
     // Submit:
     $this->addElement('submit', 'submit', array('label' => __('Save Settings')));
     $this->addDisplayGroup(array('solr_search_hl', 'solr_search_hl_snippets', 'solr_search_hl_fragsize', 'solr_search_facet_sort', 'solr_search_facet_limit', 'solr_search_display_private_items'), 'fields');
     $this->addDisplayGroup(array('submit'), 'submit_button');
 }
 /**
  * Initialize the form.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     $this->setAttrib('id', 'bulk-metadata-editor-form');
     $this->setMethod('post');
     $this->_registerElements();
 }
Beispiel #3
0
 public function init()
 {
     parent::init();
     if (empty($this->_type)) {
         throw new Zend_Form_Exception("A type (often the record type) must be given to use Omeka_Form_Admin");
     }
     //instead of extending Zend_Form_DisplayGroup, setting up here so css classes can be options directly
     //on instantiating the form. If those classes should never change, then this probably should go to
     //Omeka extensions of Zend_Form_DisplayGroup
     $this->_editDisplayGroup = new Zend_Form_DisplayGroup('edit-form', $this->getPluginLoader(self::DECORATOR));
     $this->_saveDisplayGroup = new Zend_Form_DisplayGroup('save', $this->getPluginLoader(self::DECORATOR));
     $this->addDisplayGroups(array($this->_editDisplayGroup, $this->_saveDisplayGroup));
     //create the decorators with CSS classes set up via options
     $editDecorator = new Zend_Form_Decorator_HtmlTag(array('tag' => 'section', 'class' => $this->_editGroupCssClass));
     $saveDecorator = new Zend_Form_Decorator_HtmlTag(array('tag' => 'section', 'id' => 'save', 'class' => $this->_saveGroupCssClass));
     $hookDecoratorOptions = array('type' => $this->_type, 'hasPublicPage' => $this->_hasPublicPage);
     $this->_saveDisplayGroupActionDecorator = new Omeka_Form_Decorator_SavePanelAction($hookDecoratorOptions);
     if ($this->_record) {
         $this->_saveDisplayGroupActionDecorator->setOption('record', $this->_record);
         $hookDecoratorOptions['record'] = $this->_record;
     }
     $savePanelHookDecorator = new Omeka_Form_Decorator_SavePanelHook($hookDecoratorOptions);
     //Pro tip: order of adding decorators matters! if reversed, group elements would appear after the div!
     $this->_editDisplayGroup->setDecorators(array('FormElements', $editDecorator));
     $this->_saveDisplayGroup->setDecorators(array($this->_saveDisplayGroupActionDecorator, 'FormElements', $savePanelHookDecorator, $saveDecorator));
 }
 /**
  * Construct the exhibit add/edit form.
  *
  * @return void.
  */
 public function init()
 {
     parent::init();
     $this->setMethod('post');
     $this->setAttrib('id', 'server-form');
     $this->addElementPrefixPath('Neatline', dirname(__FILE__));
     // Name.
     $this->addElement('text', 'name', array('label' => __('Name'), 'description' => __('An internal (non-public) identifier for the server.'), 'size' => 40, 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Enter a name.')))))));
     // URL.
     $this->addElement('text', 'url', array('label' => __('URL'), 'description' => __('The location of the server.'), 'size' => 40, 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Enter a URL.')))), array('validator' => 'IsUrl', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Neatline_Validate_IsUrl::INVALID_URL => 'Enter a valid URL.'))))));
     // Namespace.
     $this->addElement('text', 'workspace', array('label' => __('Workspace'), 'description' => __('Enter the Geoserver workspace.'), 'size' => 40, 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Enter a workspace.')))))));
     // Username.
     $this->addElement('text', 'username', array('label' => __('Username'), 'description' => __('Enter the Geoserver username.'), 'size' => 40, 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Enter a username.')))))));
     // Password.
     $this->addElement('password', 'password', array('label' => __('Password'), 'description' => __('Enter the Geoserver password.'), 'size' => 40, 'required' => true, 'renderPassword' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Enter a password.')))))));
     // Active.
     $this->addElement('checkbox', 'active', array('label' => __('Active'), 'description' => __('Should this server be used to handle new GeoTiff uploads?'), 'checked' => true));
     // Submit.
     $this->addElement('submit', 'submit', array('label' => __('Save')));
     // Group the data fields.
     $this->addDisplayGroup(array('name', 'url', 'workspace', 'username', 'password', 'active'), 'server_information');
     // Group the submit button sparately.
     $this->addDisplayGroup(array('submit'), 'submit_button');
 }
 public function init()
 {
     parent::init();
     $this->setAttrib('id', 'recover-password');
     $this->addElement('text', 'email', array('label' => __('Email'), 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Email address is required.')))), array('validator' => 'EmailAddress', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_EmailAddress::INVALID => __('Invalid email address given.'), Zend_Validate_EmailAddress::INVALID_FORMAT => __('Invalid format given for email address.'), Zend_Validate_EmailAddress::INVALID_HOSTNAME => __('Invalid hostname given for email address.')))), array('validator' => 'Db_RecordExists', 'options' => array('table' => $this->_db->User, 'field' => 'email', 'adapter' => $this->_db->getAdapter(), 'messages' => array('noRecordFound' => __("Invalid email address")))))));
     $this->addElement('submit', 'Submit');
 }
Beispiel #6
0
 public function init()
 {
     parent::init();
     $this->setMethod('post');
     $this->addElement('text', 'username', array('label' => __('Username'), 'description' => __('must be 30 characters or fewer with no whitespace'), 'validators' => array(array('StringLength', false, array(User::USERNAME_MIN_LENGTH, User::USERNAME_MAX_LENGTH)), array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '#^[a-zA-Z0-9.*@+!\\-_%\\#\\^&$]*$#u', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => __('Whitespace is not allowed. Only these special characters may be used: %s', ' + ! @ # $ % ^ & * . - _'))))), 'required' => true));
     $this->addElement('password', 'password', array('label' => __('Password'), 'description' => __('must be at least 6 characters'), 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Password is required.'))), array('validator' => 'Confirmation', 'options' => array('field' => 'password_confirm', 'messages' => array('notMatch' => "Typed passwords do not match."))), array('validator' => 'StringLength', 'options' => array('min' => User::PASSWORD_MIN_LENGTH, 'messages' => array('stringLengthTooShort' => "Password must be at least %min% characters in length.")))), 'required' => true));
     $this->addElement('password', 'password_confirm', array('label' => __('Re-type the Password'), 'description' => __('Confirm your password.'), 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Password confirmation is required.'))))));
     $this->addElement('text', 'super_email', array('label' => __('Email'), 'validators' => array('EmailAddress'), 'required' => true));
     $this->addElement('text', 'site_title', array('label' => __('Site Title'), 'required' => true));
     $this->addElement('textarea', 'description', array('label' => __('Site Description')));
     $this->addElement('text', 'administrator_email', array('label' => __('Administrator Email'), 'validators' => array('EmailAddress'), 'required' => true));
     $this->addElement('text', 'copyright', array('label' => __('Site Copyright Information')));
     $this->addElement('text', 'author', array('label' => __('Site Author Information')));
     $this->addElement('text', 'tag_delimiter', array('label' => __('Tag Delimiter'), 'description' => __('Separate tags using this character or string.'), 'value' => self::DEFAULT_TAG_DELIMITER));
     // Allow the tag delimiter to be a whitespace character(s) (except for
     // new lines). The NotEmpty validator (and therefore the required flag)
     // considers spaces to be empty. Because of this we must set the
     // allowEmpty flag to false so Zend_Form_Element::isValid() passes an
     // "empty" value to the validators, and then, using the Regex validator,
     // match the value to a string containing one or more characters.
     $this->getElement('tag_delimiter')->setAllowEmpty(false);
     $this->getElement('tag_delimiter')->addValidator('regex', false, array('/^.+$/'));
     $this->addElement('text', 'fullsize_constraint', array('label' => __('Fullsize Image Size'), 'description' => __('Maximum fullsize image size constraint (in pixels)'), 'value' => self::DEFAULT_FULLSIZE_CONSTRAINT, 'validators' => array('Digits'), 'required' => true));
     $this->addElement('text', 'thumbnail_constraint', array('label' => __('Thumbnail Size'), 'description' => __('Maximum thumbnail size constraint (in pixels)'), 'value' => self::DEFAULT_THUMBNAIL_CONSTRAINT, 'validators' => array('Digits'), 'required' => true));
     $this->addElement('text', 'square_thumbnail_constraint', array('label' => __('Square Thumbnail Size'), 'description' => __('Maximum square thumbnail size constraint (in pixels)'), 'value' => self::DEFAULT_SQUARE_THUMBNAIL_CONSTRAINT, 'validators' => array('Digits'), 'required' => true));
     $this->addElement('text', 'per_page_admin', array('label' => __('Items Per Page (admin)'), 'description' => __('Limit the number of items displayed per page in the administrative interface.'), 'value' => self::DEFAULT_PER_PAGE_ADMIN, 'validators' => array('Digits'), 'required' => true));
     $this->addElement('text', 'per_page_public', array('label' => __('Items Per Page (public)'), 'description' => __('Limit the number of items displayed per page in the public interface.'), 'value' => self::DEFAULT_PER_PAGE_PUBLIC, 'validators' => array('Digits'), 'required' => true));
     $this->addElement('checkbox', 'show_empty_elements', array('label' => __('Show Empty Elements'), 'class' => 'checkbox', 'description' => __('Check box to show metadata elements with no text.')));
     $this->addElement('text', 'path_to_convert', array('label' => __('ImageMagick Directory Path')));
     $this->addElement('submit', 'install_submit', array('label' => __('Install'), 'decorators' => array('Tooltip', 'ViewHelper')));
     $this->addDisplayGroup(array('username', 'password', 'password_confirm', 'super_email'), 'superuser_account', array('legend' => __('Default Superuser Account')));
     $this->addDisplayGroup(array('administrator_email', 'site_title', 'description', 'copyright', 'author', 'tag_delimiter', 'fullsize_constraint', 'thumbnail_constraint', 'square_thumbnail_constraint', 'per_page_admin', 'per_page_public', 'show_empty_elements', 'path_to_convert'), 'site_settings', array('legend' => __('Site Settings')));
     $this->addDisplayGroup(array('install_submit'), 'submit');
 }
 /**
  * Build the form.
  */
 public function init()
 {
     parent::init();
     $this->setMethod('post');
     $this->setAttrib('id', 'datastream-form');
     // Server.
     $this->addElement('select', 'server', array('label' => __('Server'), 'description' => __('Select a Fedora server.'), 'multiOptions' => $this->getServersForSelect()));
     // PID.
     $this->addElement('text', 'pid', array('label' => __('PID'), 'description' => __('Enter the PID of the Fedora resource.'), 'size' => 40));
     // Datastream.
     $this->addElement('multiselect', 'dsids', array('label' => __('Datastreams'), 'description' => __('Choose one or more datastreams.'), 'attribs' => array('size' => 20), 'multiOptions' => array()));
     // Import.
     $this->addElement('checkbox', 'import', array('label' => 'Import now?', 'description' => 'Import Fedora data when the Item is saved.'));
     // Query datastreams uri.
     $this->addElement('hidden', 'datastreams-uri', array('value' => url('fedora-connector/datastreams')));
     /************************************************************
     *REVISIONS
     * Ver        Date       Author          Description
     * --------  ----------  --------------  ----------------------
     * 1.0       09/02/2015  mrs175          1. added try catch blocks
     ************************************************************/
     // Saved dsid.
     try {
         $this->addElement('hidden', 'saved-dsids');
     } catch (Exception $e) {
         _log($e->getMessage());
     }
     try {
         $this->addDisplayGroup(array('server', 'pid', 'dsids', 'import', 'datastreams-uri', 'saved-dsids'), 'fedora');
     } catch (Exception $e) {
         _log($e->getMessage());
     }
 }
Beispiel #8
0
 public function init()
 {
     parent::init();
     $this->addElement('text', 'base_url', array('label' => 'Base URL', 'description' => 'The base URL of the OAI-PMH data provider.', 'value' => 'http://localhost/atom-cg35/index.php/;oai?verb=ListRecords&metadataPrefix=oai_dc', 'size' => 60));
     $this->applyOmekaStyles();
     $this->setAutoApplyOmekaStyles(false);
     $this->addElement('submit', 'submit_view_sets', array('label' => 'View Sets', 'class' => 'submit submit-medium', 'decorators' => array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'field')))));
 }
Beispiel #9
0
 /**
  * Initialize the form.
  *
  *@return void
  */
 public function init()
 {
     //require_once(dirname(dirname(__FILE__)).'/views/scripts/FormRadio.php');
     parent::init();
     $this->setAttrib('id', 'bulk-metadata-editor-form');
     $this->setMethod('post');
     $this->_registerElements();
 }
 public function init()
 {
     parent::init();
     $this->addElement('text', 'base_url', array('label' => __('Base URL'), 'description' => __('The base URL of the OAI-PMH data provider.'), 'size' => 60));
     $this->applyOmekaStyles();
     $this->setAutoApplyOmekaStyles(false);
     $this->addElement('submit', 'submit_view_sets', array('label' => __('View Sets'), 'class' => 'submit submit-medium', 'decorators' => array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'field')))));
 }
Beispiel #11
0
 public function init()
 {
     parent::init();
     foreach ($this->els as $element) {
         $this->view->elementForm($element);
     }
     $this->addElement('Text', 'foo');
 }
Beispiel #12
0
 public function init()
 {
     parent::init();
     $this->setAttrib('id', 'reset-password');
     $this->addElement('password', 'new_password', array('label' => __('Create a Password'), 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => __('Password is required.')))), array('validator' => 'Confirmation', 'options' => array('field' => 'new_password_confirm', 'messages' => array('notMatch' => __("Typed passwords do not match.")))), array('validator' => 'StringLength', 'options' => array('min' => User::PASSWORD_MIN_LENGTH, 'messages' => array('stringLengthTooShort' => "Password must be at least %min% characters in length."))))));
     $this->addElement('password', 'new_password_confirm', array('label' => __('Re-type the Password')));
     $this->addElement('submit', 'Submit');
 }
 public function init()
 {
     parent::init();
     $this->setAction(WEB_ROOT . '/commenting/comment/add');
     $this->setAttrib('id', 'comment-form');
     $user = current_user();
     /************************************************************
      *REVISIONS
      * Ver        Date       Author          Description
      * --------  ----------  --------------  ----------------------
      * 1.0       09/02/2015  mrs175          1. added validators/form limitations for author name, email, and comment
      ************************************************************/
     //Validators
     //------------------------------------------------------------------
     $notEmptyValidator = array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Please fill in this box.'), Zend_Validate_NotEmpty::INVALID => __('Please only use letters numbers and punctuation.'))));
     $alphaNumericValidator = array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '#^[a-zA-Z0-9.*@+!\\-_%\\#\\^&$ ]*$#u', 'messages' => array(Zend_Validate_Regex::INVALID => __('Please only use these special characters for your name: + ! @ # $ % ^ & * . - _'), Zend_Validate_Regex::ERROROUS => __('Please only use these special characters for your name: + ! @ # $ % ^ & * . - _'), Zend_Validate_Regex::NOT_MATCH => __('Please only use these special characters for your name: + ! @ # $ % ^ & * . - _'))));
     //form element options
     //----------------------------------------------------------
     $nameOptions = array('label' => __('Name (required)'), 'required' => true, 'size' => '25', 'maxlength' => '25', 'validators' => array($notEmptyValidator, $alphaNumericValidator));
     $emailOptions = array('label' => __('Email (required)'), 'required' => true, 'size' => '100', 'maxlength' => '70', 'validators' => array($notEmptyValidator));
     $commentOptions = array('label' => __('1500 character limit'), 'id' => 'comment-form-body', 'rows' => "8", 'cols' => "50", 'maxlength' => '1500', 'required' => true, 'filters' => array(array('StripTags', array('allowTags' => array('p', 'span', 'em', 'strong', 'a', 'ul', 'ol', 'li'), 'allowAttribs' => array('style', 'href')))), 'validators' => array($notEmptyValidator));
     //Adding Elements to the form
     //-------------------------------------------------------------------------------
     //auto-filling the email and name boxes for logged in users
     //then making them read only, so logged in users must use their registered name and email
     if ($user) {
         $emailOptions['value'] = $user->email;
         $emailOptions['readonly'] = true;
         $emailOptions['onfocus'] = "this.blur()";
         $nameOptions['value'] = $user->name;
         $nameOptions['readonly'] = true;
         $nameOptions['onfocus'] = "this.blur()";
     }
     $this->addElement('text', 'author_name', $nameOptions);
     $this->addElement('text', 'author_email', $emailOptions);
     $this->addElement('textarea', 'body', $commentOptions);
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessage('Please enter an email address like stuff@email.com');
     $this->getElement('author_email')->addValidator($emailValidator, true, array());
     if (get_option('recaptcha_public_key') && get_option('recaptcha_private_key')) {
         $this->addElement('captcha', 'captcha', array('label' => __("Please verify you're a human"), 'captcha' => array('captcha' => 'ReCaptcha', 'pubkey' => get_option('recaptcha_public_key'), 'privkey' => get_option('recaptcha_private_key'), 'ssl' => true)));
         $this->getElement('captcha')->removeDecorator('ViewHelper');
     }
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $params = $request->getParams();
     $record_id = $this->_getRecordId($params);
     $record_type = $this->_getRecordType($params);
     $this->addElement('hidden', 'record_id', array('value' => $record_id, 'decorators' => array('ViewHelper')));
     $this->addElement('hidden', 'path', array('value' => $request->getPathInfo(), 'decorators' => array('ViewHelper')));
     if (isset($params['module'])) {
         $this->addElement('hidden', 'module', array('value' => $params['module'], 'decorators' => array('ViewHelper')));
     }
     $this->addElement('hidden', 'record_type', array('value' => $record_type, 'decorators' => array('ViewHelper')));
     fire_plugin_hook('commenting_form', array('comment_form' => $this));
     $this->addElement('submit', 'submit', array('label' => __('Submit')));
 }
Beispiel #14
0
 public function init()
 {
     parent::init();
     $this->setAttrib('id', 'change-password');
     $this->addElement('password', 'current_password', array('label' => __('Current Password'), 'description' => __('Password must be at least 6 characters long.'), 'required' => true, 'errorMessages' => array(__("Invalid current password"))));
     $this->addElement('password', 'new_password', array('label' => __('New Password'), 'required' => true, 'description' => __('Password must be at least 6 characters long.'), 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array('isEmpty' => __("New password must be entered.")))), array('validator' => 'Confirmation', 'options' => array('field' => 'new_password_confirm', 'messages' => array(Omeka_Validate_Confirmation::NOT_MATCH => __('New password must be typed correctly twice.')))), array('validator' => 'StringLength', 'options' => array('min' => User::PASSWORD_MIN_LENGTH, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => __("New password must be at least %min% characters long.")))))));
     $this->addElement('password', 'new_password_confirm', array('label' => __('Repeat New Password'), 'required' => true, 'errorMessages' => array(__('New password must be typed correctly twice.'))));
     $this->addElement('hash', 'password_csrf');
     $this->addDisplayGroup(array('current_password', 'new_password', 'new_password_confirm'), 'change_password', array("legend" => __("Change Password")));
 }
Beispiel #15
0
 public function init()
 {
     parent::init();
     $this->addElement('text', 'name', array('label' => 'Report Name', 'size' => 60, 'required' => true));
     $this->addElement('textarea', 'description', array('label' => 'Description', 'rows' => '10', 'cols' => '60'));
     // $this->addElement('submit', 'submit_add_report', array(
     //     'label' => 'Add Report',
     //     'class' => 'submit-medium',
     // ));
 }
Beispiel #16
0
 public function init()
 {
     parent::init();
     $this->setMethod('post');
     $this->setAttrib('id', 'login-form');
     $this->addElement('text', 'username', array('label' => __('Username'), 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => __('Username cannot be empty.'))))), 'decorators' => array('ViewHelper', array(array('input' => 'HtmlTag'), array('tag' => 'div', 'class' => 'inputs six columns omega')), array('Label', array('tag' => 'div', 'tagClass' => 'two columns alpha')), array('HtmlTag', array('tag' => 'div', 'class' => 'field')))));
     $this->addElement('password', 'password', array('label' => __('Password'), 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => __('Password cannot be empty.'))))), 'decorators' => array('ViewHelper', array(array('input' => 'HtmlTag'), array('tag' => 'div', 'class' => 'inputs six columns omega')), array('Label', array('tag' => 'div', 'tagClass' => 'two columns alpha')), array('HtmlTag', array('tag' => 'div', 'class' => 'field')))));
     $this->addElement('checkbox', 'remember', array('class' => 'checkbox', 'label' => __('Remember Me?'), 'decorators' => array('ViewHelper', array(array('input' => 'HtmlTag'), array('tag' => 'div', 'class' => 'inputs six columns omega')), array('Label', array('tag' => 'div', 'tagClass' => 'two columns alpha')), array('HtmlTag', array('tag' => 'div', 'class' => 'field')))));
     $this->addDisplayGroup(array('username', 'password', 'remember'), 'login');
     $this->addElement('submit', 'submit', array('label' => __('Log In')));
 }
Beispiel #17
0
 public function init()
 {
     parent::init();
     $mappings = $this->_getFiltered('archive_folder_mappings');
     $allowLocalPaths = Zend_Registry::get('archive_folder')->local_folders->allow == '1';
     $this->setAttrib('id', 'archive-folder');
     $this->setMethod('post');
     $this->addElement('text', 'uri', array('label' => __('Base URI'), 'description' => __('The base url or path of the folder to expose.') . ' ' . __('If url, the server should allow directory listing.') . ($allowLocalPaths ? '' : ' ' . __('Local paths are forbidden by the administrator.')), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', array('Callback', true, array('callback' => array('ArchiveFolder_Form_Validator', 'validateUri')), 'messages' => array(Zend_Validate_Callback::INVALID_VALUE => __('A url or a path is required to add a folder.'))))));
     $this->addElement('radio', 'unreferenced_files', array('label' => __('Unreferenced Files'), 'description' => __('This option indicates what to do with files, maybe all of them, that are not referenced inside metadata files ("%s").', implode('", "', array_keys($mappings))), 'value' => get_option('archive_folder_unreferenced_files') ?: 'by_file', 'multiOptions' => array('by_file' => __('One item by file'), 'by_directory' => __('One item by directory'), 'skip' => __("Skip"))));
     /*
     $this->addElement('checkbox', 'records_for_files', array(
         'label' => __('Files Metadata'),
         'description' => __('Create metadata for files, not only for items.')
             . ' ' . __('Metadata for files may be useless if there is only one file by item.')
             . ' ' . __('This parameter may be bypassed when a metadata file is directly included in the folder.'),
         'value' => true,
     ));
     */
     $this->addElement('hidden', 'records_for_files', array('value' => true));
     $this->addElement('text', 'exclude_extensions', array('label' => __('File extensions to exclude'), 'description' => __('A black-list of extensions (normal or double) to exclude from the source, separated by a space or a comma and without the initial dot.') . ' ' . __('The white-list is the Omeka one, defined in the security page.')));
     $this->addElement('checkbox', 'allow_no_extension', array('label' => __('Allow file without extension'), 'description' => __('This option allows to import some specific files and urls.') . ' ' . __('The option "Disable File Upload Validation" in Settings > Security should be set too.'), 'value' => false));
     $values = array('' => __('No default item type'), 'default' => __('Default type according to first file of each item')) + get_table_options('ItemType');
     $this->addElement('select', 'item_type_id', array('label' => __('Default Item Type'), 'description' => __('Set  the item type during import as Omeka Item Type and Dublin Core Type.') . ' ' . __('For the second option (type of the first file), it can be:') . ' ' . __('"Still image" for an item with a single Image, "Text" for an item with multiple image or a pdf, ' . '"Sound" for an audio file, "Moving Image" for a video file and none in all other cases.'), 'multiOptions' => $values, 'value' => ''));
     $this->addElement('checkbox', 'add_relations', array('label' => __('Add unique identifiers'), 'description' => __('To add unique identifiers allows to link items and files easily and independantly from Omeka.') . ' ' . __('Added identifiers are absolute urls.') . ' ' . __("This option is only usefull when there aren't such identifiers."), 'value' => false));
     $this->addElement('text', 'element_delimiter', array('label' => __('Table/Spreadsheet element separator'), 'description' => __('If metadata are available in a table (as Open Document Spreadsheet ods), multiple elements can be set within one cell for the same field.') . ' ' . __('This character or this string, for example the pipe "|", can be used to delimite them.') . ' ' . __('If the delimiter is empty, then the whole text will be used.') . ' ' . __('Anyway, multiple columns can be mapped to the same element and multiple rows can manage multiple values for the same field of the same record.'), 'value' => ArchiveFolder_Mapping_Table::DEFAULT_ELEMENT_DELIMITER));
     $this->addElement('text', 'empty_value', array('label' => __('Table/Spreadsheet empty value'), 'description' => __('If metadata are available in a table (as Open Document Spreadsheet ods), an empty cell can be an empty value or no value.') . ' ' . __('To distinct these two cases, an empty value can be replaced by this string (case sensitive).'), 'value' => ArchiveFolder_Mapping_Table::DEFAULT_EMPTY_VALUE));
     $this->addElement('textarea', 'extra_parameters', array('label' => __('Add specific parameters'), 'description' => __('Some formats require specific parameters, for example to be used in the xsl sheets.') . ' ' . __('You can specify them here, one by line.'), 'value' => '', 'required' => false, 'rows' => 5, 'placeholder' => __('parameter_1_name = parameter 1 value'), 'filters' => array('StringTrim'), 'validators' => array(array('callback', false, array('callback' => array('ArchiveFolder_Form_Validator', 'validateExtraParameters')), 'messages' => array(Zend_Validate_Callback::INVALID_VALUE => __('Each extra parameter, one by line, should have a name separated from the value with a "=".'))))));
     $identifierField = get_option('archive_folder_identifier_field');
     if (!empty($identifierField) && $identifierField != ArchiveFolder_Importer::IDFIELD_INTERNAL_ID) {
         $currentIdentifierField = $this->_getElementFromIdentifierField($identifierField);
         if ($currentIdentifierField) {
             $identifierField = $currentIdentifierField->id;
         }
     }
     $values = get_table_options('Element', null, array('record_types' => array('All'), 'sort' => 'alphaBySet'));
     unset($values['']);
     $values = array(ArchiveFolder_Importer::IDFIELD_NONE => __('No default identifier field'), ArchiveFolder_Importer::IDFIELD_INTERNAL_ID => __('Internal id')) + $values;
     $this->addElement('select', 'identifier_field', array('label' => __('Identifier field (required)'), 'description' => __('The identifier field is used to simplify the update of records.') . ' ' . __('This is the link between the files in the folder and the records in the Omeka base.') . ' ' . __('The identifier should be set and unique in all records (collections, items, files).') . ' ' . __('This is generally the Dublin Core : Identifier or a specific element.'), 'multiOptions' => $values, 'value' => $identifierField));
     $this->addElement('select', 'action', array('label' => __('Action'), 'multiOptions' => label_table_options(array(ArchiveFolder_Importer::ACTION_UPDATE_ELSE_CREATE => __('Update the record if it exists, else create one'), ArchiveFolder_Importer::ACTION_CREATE => __('Create a new record'), ArchiveFolder_Importer::ACTION_UPDATE => __('Update values of specific fields'), ArchiveFolder_Importer::ACTION_ADD => __('Add values to specific fields'), ArchiveFolder_Importer::ACTION_REPLACE => __('Replace values of all fields'), ArchiveFolder_Importer::ACTION_DELETE => __('Delete the record'), ArchiveFolder_Importer::ACTION_SKIP => __('Skip process of the record')), __('No default action')), 'description' => __('The action defines how records and metadara are processed.') . ' ' . __('The record can be created, updated, deleted or skipped.') . ' ' . __('The metadata of an existing record can be updated, appended or replaced.')));
     // Parameters for the folder of original files.
     $this->addDisplayGroup(array('uri'), 'archive_folder_folder', array('legend' => __('Archive Folder URI')));
     $this->addDisplayGroup(array('unreferenced_files', 'records_for_files', 'exclude_extensions', 'allow_no_extension', 'item_type_id', 'add_relations'), 'archive_folder_records', array('legend' => __('Archive Folder Records and files'), 'description' => __('Set parameters to create each record from files.') . ' ' . __('Note:') . ' ' . __('An item can have multiple files, and items and files can have different metadata.') . ' ' . __('For example, a record of a book can have each digitalized page attached to it.') . ' ' . __('An object can have multiple pictures under different views or taken by different photographers.') . ' ' . __('In that case, it is recommended to separate the metadata, for example to add data about each page or the different authors of the view.') . ' ' . __("Conversely, an image of a paint, a photography, or a book digitalized as a pdf and e-book files doesn't need to have separate records.")));
     // Parameters to create each record.
     $this->addDisplayGroup(array('element_delimiter', 'empty_value'), 'archive_folder_table', array('legend' => __('Tables'), 'description' => __('Set specific parameters for table or spreadsheets.')));
     apply_filters('archive_folder_add_parameters', $this);
     $this->addDisplayGroup(array('extra_parameters'), 'archive_folder_extra_parameters', array('legend' => __('Extra Parameters')));
     // Parameters for the folder of original files.
     $this->addDisplayGroup(array('identifier_field', 'action'), 'archive_folder_process', array('legend' => __('Process')));
     $this->applyOmekaStyles();
     $this->setAutoApplyOmekaStyles(false);
     $this->addElement('sessionCsrfToken', 'csrf_token');
     $this->addElement('submit', 'submit', array('label' => __('Add folder'), 'class' => 'submit submit-medium', 'decorators' => array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'field')))));
 }
 public function init()
 {
     parent::init();
     $this->addElement('text', 'fullsize_constraint', array('label' => __('Fullsize Image Size'), 'description' => __('Maximum fullsize image size constraint (in pixels).'), 'validators' => array('Digits'), 'required' => true));
     $this->addElement('text', 'thumbnail_constraint', array('label' => __('Thumbnail Size'), 'description' => __('Maximum thumbnail size constraint (in pixels).'), 'validators' => array('Digits'), 'required' => true));
     $this->addElement('text', 'square_thumbnail_constraint', array('label' => __('Square Thumbnail Size'), 'description' => __('Maximum square thumbnail size constraint (in pixels).'), 'validators' => array('Digits'), 'required' => true));
     $this->addElement('text', 'per_page_admin', array('label' => __('Results Per Page (admin)'), 'description' => __('Limit the number of results displayed per page in the administrative interface.'), 'validators' => array('Digits'), 'required' => true));
     $this->addElement('text', 'per_page_public', array('label' => __('Results Per Page (public)'), 'description' => __('Limit the number of results displayed per page in the public interface.'), 'validators' => array('Digits'), 'required' => true));
     $this->addElement('checkbox', 'show_empty_elements', array('label' => __('Show Empty Elements'), 'class' => 'checkbox'));
     $this->addElement('checkbox', 'show_element_set_headings', array('label' => __('Show Element Set Headings'), 'class' => 'checkbox'));
     $this->addElement('hash', 'appearance_csrf', array('timeout' => 3600));
     $this->addDisplayGroup(array('fullsize_constraint', 'thumbnail_constraint', 'square_thumbnail_constraint'), 'derivative-constraints', array('legend' => __('Derivative Size Constraints')));
     $this->addDisplayGroup(array('per_page_admin', 'per_page_public', 'show_empty_elements', 'show_element_set_headings'), 'display-settings', array('legend' => __('Display Settings')));
 }
 /**
  * Build the "Server Configuration" button.
  */
 public function init()
 {
     parent::init();
     // Server Host:
     $this->addElement('text', 'solr_search_host', array('label' => __('Server Host'), 'description' => __('The location of the Solr server.'), 'value' => get_option('solr_search_host'), 'required' => true, 'size' => 40));
     // Server Port:
     $this->addElement('text', 'solr_search_port', array('label' => __('Server Port'), 'description' => __('The port that Solr is listening on.'), 'value' => get_option('solr_search_port'), 'required' => true, 'size' => 40, 'validators' => array(array('validator' => 'Int', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_Int::NOT_INT => __('Must be an integer.')))))));
     // Core URL:
     $this->addElement('text', 'solr_search_core', array('label' => __('Core URL'), 'description' => __('The URL of the Solr core to index against.'), 'value' => get_option('solr_search_core'), 'required' => true, 'size' => 40, 'validators' => array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/\\/.*\\//i', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => __('Invalid core URL.')))))));
     // Submit:
     $this->addElement('submit', 'submit', array('label' => __('Save Settings')));
     $this->addDisplayGroup(array('solr_search_host', 'solr_search_port', 'solr_search_core'), 'fields');
     $this->addDisplayGroup(array('submit'), 'submit_button');
 }
 /**
  * Build the form.
  */
 public function init()
 {
     parent::init();
     $this->setMethod('post');
     $this->addElementPrefixPath('FedoraConnector', dirname(__FILE__));
     // Title.
     $this->addElement('text', 'name', array('label' => __('Name'), 'description' => __('An internal (non-public) identifier for the server.'), 'size' => 40, 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Enter a name.')))))));
     // URL.
     $this->addElement('text', 'url', array('label' => __('URL'), 'description' => __('The location of the server.'), 'size' => 40, 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Enter a URL.')))), array('validator' => 'IsUrl', 'breakChainOnFailure' => true, 'options' => array('messages' => array(FedoraConnector_Validate_IsUrl::INVALID_URL => 'Enter a valid URL.'))))));
     // Submit.
     $this->addElement('submit', 'submit', array('label' => __('Save Server')));
     // Group the data fields.
     $this->addDisplayGroup(array('name', 'url'), 'server');
     // Group the submit button separately.
     $this->addDisplayGroup(array('submit'), 'submit_button');
 }
Beispiel #21
0
 public function init()
 {
     parent::init();
     $this->setAttrib('id', 'settings-form');
     $this->addElement('checkbox', File::DISABLE_DEFAULT_VALIDATION_OPTION, array('label' => __('Disable File Upload Validation'), 'checked' => get_option(File::DISABLE_DEFAULT_VALIDATION_OPTION), 'description' => __('Check this field if you would like to allow any file to be uploaded to Omeka.')));
     $this->addElement('textarea', Omeka_Validate_File_Extension::WHITELIST_OPTION, array('label' => __('Allowed File Extensions'), 'description' => __('List of allowed extensions for file uploads'), 'value' => get_option(Omeka_Validate_File_Extension::WHITELIST_OPTION), 'cols' => 50, 'rows' => 5));
     $this->addElement('textarea', Omeka_Validate_File_MimeType::WHITELIST_OPTION, array('label' => __('Allowed File Types'), 'description' => __('List of allowed MIME types for file uploads'), 'value' => get_option(Omeka_Validate_File_MimeType::WHITELIST_OPTION), 'cols' => 50, 'rows' => 13));
     $this->addElement('text', Omeka_Captcha::PUBLIC_KEY_OPTION, array('label' => __('ReCaptcha Public Key'), 'description' => __('Enter public key from recaptcha.net. Both this and the private key must be filled in to secure public forms.'), 'value' => get_option(Omeka_Captcha::PUBLIC_KEY_OPTION)));
     $this->addElement('text', Omeka_Captcha::PRIVATE_KEY_OPTION, array('label' => __('ReCaptcha Private Key'), 'description' => __('Enter private key from recaptcha.net. Both this and the public key must be filled in to secure public forms.'), 'value' => get_option(Omeka_Captcha::PRIVATE_KEY_OPTION)));
     $this->addElement('checkbox', 'html_purifier_is_enabled', array('checked' => (bool) get_option('html_purifier_is_enabled'), 'description' => __('Check this field if you would like to filter HTML elements or attributes from form input.'), 'label' => __('Enable HTML Filtering')));
     $this->addElement('textarea', 'html_purifier_allowed_html_elements', array('value' => get_option('html_purifier_allowed_html_elements'), 'label' => __('Allowed HTML Elements'), 'description' => __('List of allowed HTML elements in form input'), 'cols' => 50, 'rows' => 5));
     $this->addElement('textarea', 'html_purifier_allowed_html_attributes', array('value' => get_option('html_purifier_allowed_html_attributes'), 'label' => __('Allowed HTML Attributes'), 'description' => __('List of allowed HTML attributes in form input'), 'cols' => 50, 'rows' => 5));
     $this->addElement('hash', 'security_csrf', array('timeout' => 3600));
     $this->addDisplayGroup(array(File::DISABLE_DEFAULT_VALIDATION_OPTION, Omeka_Validate_File_Extension::WHITELIST_OPTION, Omeka_Validate_File_MimeType::WHITELIST_OPTION), 'file-validation', array('legend' => __('File Validation')));
     $this->addDisplayGroup(array(Omeka_Captcha::PUBLIC_KEY_OPTION, Omeka_Captcha::PRIVATE_KEY_OPTION), 'captcha', array('legend' => __('Captcha')));
     $this->addDisplayGroup(array('html_purifier_is_enabled', 'html_purifier_allowed_html_elements', 'html_purifier_allowed_html_attributes'), 'html-filtering', array('legend' => __('HTML Filtering')));
 }
 /**
  * Build the "Hit Highlighting" form.
  */
 public function init()
 {
     parent::init();
     // Enable Highlighting:
     $this->addElement('checkbox', 'solr_search_hl', array('label' => __('Enable Highlighting'), 'description' => __('Display snippets with highlighted term matches.'), 'value' => get_option('solr_search_hl')));
     // Number of Snippets:
     $this->addElement('text', 'solr_search_hl_snippets', array('label' => __('Number of Snippets'), 'description' => __('The maximum number of snippets to display.'), 'value' => get_option('solr_search_hl_snippets'), 'required' => true, 'size' => 40, 'validators' => array(array('validator' => 'Int', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_Int::NOT_INT => __('Must be an integer.')))))));
     // Snippet Length:
     $this->addElement('text', 'solr_search_hl_fragsize', array('label' => __('Snippet Length'), 'description' => __('The maximum number of characters to display in a snippet.'), 'value' => get_option('solr_search_hl_fragsize'), 'required' => true, 'size' => 40, 'validators' => array(array('validator' => 'Int', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_Int::NOT_INT => __('Must be an integer.')))))));
     // Facet Ordering:
     $this->addElement('select', 'solr_search_facet_sort', array('label' => __('Facet Ordering'), 'description' => __('The sorting criteria for result facets.'), 'multiOptions' => array('index' => __('Alphabetical'), 'count' => __('Occurrences')), 'value' => get_option('solr_search_facet_sort')));
     // Maximum Facet Count:
     $this->addElement('text', 'solr_search_facet_limit', array('label' => __('Facet Count'), 'description' => __('The maximum number of facets to display.'), 'value' => get_option('solr_search_facet_limit'), 'required' => true, 'size' => 40, 'validators' => array(array('validator' => 'Int', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_Int::NOT_INT => __('Must be an integer.')))))));
     // Submit:
     $this->addElement('submit', 'submit', array('label' => __('Save Settings')));
     $this->addDisplayGroup(array('solr_search_hl', 'solr_search_hl_snippets', 'solr_search_hl_fragsize', 'solr_search_facet_sort', 'solr_search_facet_limit'), 'fields');
     $this->addDisplayGroup(array('submit'), 'submit_button');
 }
Beispiel #23
0
 public function init()
 {
     parent::init();
     $this->addElement('text', 'username', array('label' => __('Username'), 'description' => __('Username must be 30 characters or fewer. Whitespace is not allowed.'), 'required' => true, 'size' => '30', 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Username is required.')))), array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '#^[a-zA-Z0-9.*@+!\\-_%\\#\\^&$]*$#u', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => __('Whitespace is not allowed. Only these special characters may be used: %s', ' + ! @ # $ % ^ & * . - _')))), array('validator' => 'StringLength', 'breakChainOnFailure' => true, 'options' => array('min' => User::USERNAME_MIN_LENGTH, 'max' => User::USERNAME_MAX_LENGTH, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => __('Username must be at least %min% characters long.'), Zend_Validate_StringLength::TOO_LONG => __('Username must be at most %max% characters long.')))), array('validator' => 'Db_NoRecordExists', 'options' => array('table' => $this->_user->getTable()->getTableName(), 'field' => 'username', 'exclude' => array('field' => 'id', 'value' => (int) $this->_user->id), 'adapter' => $this->_user->getDb()->getAdapter(), 'messages' => array('recordFound' => __('This username is already in use.')))))));
     $this->addElement('text', 'name', array('label' => __('Display Name'), 'description' => __('Name as it should be displayed on the site'), 'size' => '30', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Real Name is required.')))))));
     $invalidEmailMessage = __('This email address is invalid.');
     $this->addElement('text', 'email', array('label' => __('Email'), 'size' => '30', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Email is required.')))), array('validator' => 'EmailAddress', 'options' => array('messages' => array(Zend_Validate_EmailAddress::INVALID => $invalidEmailMessage, Zend_Validate_EmailAddress::INVALID_FORMAT => $invalidEmailMessage, Zend_Validate_EmailAddress::INVALID_HOSTNAME => $invalidEmailMessage))), array('validator' => 'Db_NoRecordExists', 'options' => array('table' => $this->_user->getTable()->getTableName(), 'field' => 'email', 'exclude' => array('field' => 'id', 'value' => (int) $this->_user->id), 'adapter' => $this->_user->getDb()->getAdapter(), 'messages' => array('recordFound' => __('This email address is already in use.')))))));
     if ($this->_hasRoleElement) {
         $this->addElement('select', 'role', array('label' => __('Role'), 'description' => __("Roles describe the permissions a user has. See <a href='http://omeka.org/codex/User_Roles' target='_blank'>documentation</a> for details."), 'multiOptions' => get_user_roles(), 'required' => true));
     }
     if ($this->_hasActiveElement) {
         $description = __('Inactive users cannot log in to the site.');
         if ($this->_user->active == 0 && $this->_usersActivations) {
             $description .= '<br>' . __('Activation has been pending since %s.', format_date($this->_usersActivations->added));
         }
         $this->addElement('checkbox', 'active', array('label' => __('Active?'), 'description' => $description));
     }
     $this->addElement('hash', 'user_csrf', array('timeout' => 3600));
 }
Beispiel #24
0
 public function init()
 {
     parent::init();
     $this->addElement('text', 'username', array('label' => __('Username'), 'placeholder' => "Nom d'utilisateur", 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => __('Nom d\'utilisateur obligatoire.')))))));
     $this->addElement('hidden', 'name', array('label' => __('Display Name'), 'value' => 'aucun', 'placeholder' => "Nom et prénom", 'size' => '30', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Nom et prénom obligatoires.')))))));
     $invalidEmailMessage = __('Adresse e-mail invalide.');
     $this->addElement('text', 'email', array('label' => __('Email'), 'placeholder' => "Adresse e-mail", 'size' => '30', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'breakChainOnFailure' => true, 'options' => array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => __('Adresse  e-mail obligatoire.')))), array('validator' => 'EmailAddress', 'options' => array('messages' => array(Zend_Validate_EmailAddress::INVALID => $invalidEmailMessage, Zend_Validate_EmailAddress::INVALID_FORMAT => $invalidEmailMessage, Zend_Validate_EmailAddress::INVALID_HOSTNAME => $invalidEmailMessage))), array('validator' => 'Db_NoRecordExists', 'options' => array('table' => $this->_user->getTable()->getTableName(), 'field' => 'email', 'exclude' => array('field' => 'id', 'value' => (int) $this->_user->id), 'adapter' => $this->_user->getDb()->getAdapter(), 'messages' => array('recordFound' => __('Cette adresse e-mail est déjà utilisée.')))))));
     if ($this->_hasRoleElement) {
         $this->addElement('select', 'role', array('label' => __('Role'), 'description' => __("Les roles décrivent les permissions des utilisateurs. Voir <a href='http://omeka.org/codex/User_Roles' target='_blank'>documentation</a> pour plus d'infos."), 'multiOptions' => get_user_roles(), 'required' => true));
     }
     if ($this->_hasActiveElement) {
         $description = __('Inactive users cannot log in to the site.');
         if ($this->_user->active == 0 && $this->_usersActivations) {
             $description .= '<br>' . __('Activation en attente depuis %s.', format_date($this->_usersActivations->added));
         }
         $this->addElement('checkbox', 'active', array('label' => __('Active?'), 'description' => $description));
     }
     $this->addElement('hash', 'user_csrf', array('timeout' => 3600));
 }
 public function init()
 {
     parent::init();
     $this->setMethod('post');
     $this->setAttrib('id', 'timeline-form');
     // Title
     $this->addElement('text', 'title', array('label' => __('Title'), 'description' => __('A title for your timeline.')));
     // Description
     $this->addElement('textarea', 'description', array('label' => __('Description'), 'description' => __('A description for your timeline.'), 'attribs' => array('class' => 'html-editor', 'rows' => '15')));
     // Public/Not Public
     $this->addElement('select', 'public', array('label' => __('Status'), 'description' => __('Whether the timeline is public or not.'), 'multiOptions' => array('0' => 'Not Public', '1' => 'Public')));
     // Featured/Not Featured
     $this->addElement('select', 'featured', array('label' => __('Featured'), 'description' => __('Whether the timeline is featured or not.'), 'multiOptions' => array('0' => 'Not Featured', '1' => 'Featured')));
     // Submit
     $this->addElement('submit', 'submit', array('label' => __('Save Timeline')));
     // Group the title, description, and public fields
     $this->addDisplayGroup(array('title', 'description', 'public', 'featured'), 'timeline_info');
     // Add the submit to a separate display group.
     $this->addDisplayGroup(array('submit'), 'timeline_submit');
 }
Beispiel #26
0
 /**
  * Initialize the form.
  */
 public function init()
 {
     parent::init();
     $this->setAction(WEB_ROOT . '/archive-repertory/download/confirm');
     $this->setAttrib('id', 'confirm-form');
     $user = current_user();
     // Assume registered users are trusted and don't make them play recaptcha.
     if (!$user && get_option('recaptcha_public_key') && get_option('recaptcha_private_key')) {
         $this->addElement('captcha', 'captcha', array('class' => 'hidden', 'label' => __("Please verify you're a human"), 'captcha' => array('captcha' => 'ReCaptcha', 'pubkey' => get_option('recaptcha_public_key'), 'privkey' => get_option('recaptcha_private_key'), 'ssl' => true), 'decorators' => array()));
     }
     // The legal agreement is checked by default for logged users.
     if (get_option('archive_repertory_legal_text')) {
         $this->addElement('checkbox', 'archive_repertory_legal_text', array('label' => get_option('archive_repertory_legal_text'), 'value' => (bool) $user, 'required' => true, 'uncheckedValue' => '', 'checkedValue' => 'checked', 'validators' => array(array('notEmpty', true, array('messages' => array('isEmpty' => __('You must agree to the terms and conditions.'))))), 'decorators' => array('ViewHelper', 'Errors', array('label', array('escape' => false)))));
     }
     // The legal agreement is checked by default for logged users.
     if (get_option('archive_repertory_legal_text')) {
         $this->addElement('checkbox', 'archive_repertory_legal_text', array('label' => get_option('archive_repertory_legal_text'), 'value' => (bool) $user, 'required' => true, 'uncheckedValue' => '', 'checkedValue' => 'checked', 'validators' => array(array('notEmpty', true, array('messages' => array('isEmpty' => __('You must agree to the terms and conditions.'))))), 'decorators' => array('ViewHelper', 'Errors', array('label', array('escape' => false)))));
     }
     $this->addElement('submit', 'submit', array('label' => __('Confirm')));
 }
 /**
  * Initialize the form.
  */
 public function init()
 {
     parent::init();
     $this->setAttrib('id', 'csvimport-mapping');
     $this->setMethod('post');
     $elementsByElementSetName = $this->_getElementPairs($this->_itemTypeId);
     $elementsByElementSetName = array('' => 'Select Below') + $elementsByElementSetName;
     foreach ($this->_columnNames as $index => $colName) {
         $rowSubForm = new Zend_Form_SubForm();
         $selectElement = $rowSubForm->createElement('select', 'element', array('class' => 'map-element', 'multiOptions' => $elementsByElementSetName, 'multiple' => false));
         $selectElement->setIsArray(true);
         if ($this->_automapColumnNamesToElements) {
             $selectElement->setValue($this->_getElementIdFromColumnName($colName));
         }
         $rowSubForm->addElement($selectElement);
         $rowSubForm->addElement('checkbox', 'html');
         $rowSubForm->addElement('checkbox', 'tags');
         $rowSubForm->addElement('checkbox', 'file');
         $this->_setSubFormDecorators($rowSubForm);
         $this->addSubForm($rowSubForm, "row{$index}");
     }
     $this->addElement('submit', 'submit', array('label' => __('Import CSV File'), 'class' => 'submit submit-medium'));
 }
Beispiel #28
0
 public function init()
 {
     parent::init();
     $this->setMethod('post');
     $this->setAttrib('id', 'settings-form');
     $this->addElement('text', 'site_title', array('label' => __('Site Title')));
     $this->addElement('textarea', 'description', array('label' => __('Site Description'), 'rows' => 10));
     $this->addElement('text', 'administrator_email', array('label' => __('Administrator Email'), 'validators' => array('EmailAddress'), 'required' => true));
     $this->addElement('text', 'copyright', array('label' => __('Site Copyright Information')));
     $this->addElement('text', 'author', array('label' => __('Site Author Information')));
     $this->addElement('text', 'tag_delimiter', array('label' => __('Tag Delimiter'), 'description' => __('Separate tags using this character or string. Be careful when changing this setting. You run the risk of splitting tags that contain the old delimiter.')));
     // Allow the tag delimiter to be a whitespace character(s) (except for
     // new lines). The NotEmpty validator (and therefore the required flag)
     // considers spaces to be empty. Because of this we must set the
     // allowEmpty flag to false so Zend_Form_Element::isValid() passes an
     // "empty" value to the validators, and then, using the Regex validator,
     // match the value to a string containing one or more characters.
     $this->getElement('tag_delimiter')->setAllowEmpty(false);
     $this->getElement('tag_delimiter')->addValidator('regex', false, array('/^.+$/'));
     $this->addElement('text', 'path_to_convert', array('label' => __('ImageMagick Directory Path')));
     $this->addElement('hash', 'settings_csrf', array('timeout' => 3600));
     $this->addDisplayGroup(array('administrator_email', 'site_title', 'description', 'copyright', 'author', 'tag_delimiter', 'path_to_convert'), 'site_settings');
 }
 public function init()
 {
     parent::init();
     $this->setAction(WEB_ROOT . '/tagging/index/add');
     $this->setAttrib('id', 'tagging-form');
     $user = current_user();
     /************************************************************
     *REVISIONS
     * Ver        Date       Author          Description
     * --------  ----------  --------------  ----------------------
     * 1.0       09/02/2015  mrs175          1. modified the buttons, added filtering for tag input, and rearranged divs/teh table for formatting purposes
     ************************************************************/
     $this->addElement('submit', 'submit', array('label' => __('Tag it!')));
     $this->addElement('text', 'tagging', array('label' => __('Add Tags!'), 'required' => true, 'size' => 60, 'maxlength' => get_option('tagging_max_length_total'), 'validators' => array(array('name' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/[0-9a-zA-Z,]+/')), array('validator' => 'StringLength', 'options' => array('min' => 1, 'max' => get_option('tagging_max_length_total'), 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => __('The tags box is empty.'), Zend_Validate_StringLength::TOO_LONG => __('Tags cannot be longer than %d characters.', get_option('tagging_max_length_total')))))), 'decorators' => array()));
     //removes the dt/dd elements that normally surround the element text and its label so I can arrange the form elements later with css
     $this->getElement('tagging')->setDecorators(array('ViewHelper'));
     // Add some hidden fields to simplify redirection.
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $record_type = empty($this->_record) ? ucfirst(Inflector::singularize($request->getControllerName())) : get_class($this->_record);
     $record_id = empty($this->_record) ? $request->getParam('id') : $this->_record->id;
     $this->addElement('hidden', 'path', array('value' => $request->getPathInfo(), 'hidden' => true, 'class' => 'hidden'));
     $this->addElement('hidden', 'record_type', array('value' => $record_type, 'hidden' => true, 'class' => 'hidden'));
     $this->addElement('hidden', 'record_id', array('value' => $record_id, 'hidden' => true, 'class' => 'hidden'));
 }
 public function init()
 {
     parent::init();
     $themeName = $this->getThemeName();
     $theme = Theme::getTheme($themeName);
     $themeConfigIni = $theme->path . '/config.ini';
     if (file_exists($themeConfigIni) && is_readable($themeConfigIni)) {
         // get the theme configuration form specification
         $formIni = new Zend_Config_Ini($themeConfigIni);
         $configSource = array('elements' => $formIni->config);
         if (isset($formIni->groups)) {
             $configSource['displayGroups'] = $formIni->groups;
         }
         $configIni = new Zend_Config($configSource);
         // create an omeka form from the configuration file
         $this->setConfig($configIni);
         if (!($themeConfigValues = $this->getThemeOptions())) {
             $themeConfigValues = Theme::getOptions($themeName);
             $this->setThemeOptions($themeConfigValues);
         }
         // configure all of the form elements
         $elements = $this->getElements();
         foreach ($elements as $element) {
             if ($element instanceof Zend_Form_Element_File) {
                 $this->_processFileElement($element);
             }
         }
         // set all of the form element values
         foreach ($themeConfigValues as $key => $value) {
             if ($this->getElement($key)) {
                 $this->{$key}->setValue($value);
             }
         }
     }
     $this->addElement('hash', 'theme_config_csrf', array('timeout' => 3600));
 }