Skip to content
Snippets Groups Projects
Commit 1ea142c0 authored by Sebastian Kehr's avatar Sebastian Kehr :rowboat_tone2: Committed by Dorian Merz
Browse files

refs #15520 [fid_bbi] exclude certain fields on user registration

* let various registration related form fields be optional or not requested at all
* reduce adjusted form specs
parent a2128696
No related merge requests found
<?php
/**
* Copyright (C) 2019 Leipzig University Library
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @author Sebastian Kehr <kehr@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/
use fid\FormModel\UserCreateModel;
use fid\FormModel\UserInitModel;
return [
UserInitModel::class => [
'elements' => [
'firstname' => [
'spec' => [
'attributes' => [
'required' => false
],
],
],
'lastname' => [
'spec' => [
'attributes' => [
'required' => false
],
],
],
],
'input_filter' => [
'firstname' => [
'required' => false,
],
'lastname' => [
'required' => false,
],
]
],
UserCreateModel::class => [
'elements' => [
'firstname' => [
'spec' => [
'attributes' => [
'required' => false
],
],
],
'lastname' => [
'spec' => [
'attributes' => [
'required' => false
],
],
],
'homeLibrary' => [
'spec' => [
'attributes' => [
'required' => false
],
],
],
],
'input_filter' => [
'firstname' => [
'required' => false,
],
'lastname' => [
'required' => false,
],
'homeLibrary' => [
'required' => false,
]
]
],
];
<?php <?php
namespace fid_bbi\Module\Configuration; /**
* Copyright (C) 2019 Leipzig University Library
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @author Sebastian Kehr <kehr@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/
$config = [ $config = [
'forms' => require_once 'form.config.php',
'controllers' => [ 'controllers' => [
'factories' => [ 'factories' => [
'fid_bbi\Controller\FeedbackController' => 'VuFind\Controller\AbstractBaseFactory', 'fid_bbi\Controller\FeedbackController' => 'VuFind\Controller\AbstractBaseFactory',
'fid_bbi\Controller\SearchController' => 'VuFind\Controller\AbstractBaseFactory', 'fid_bbi\Controller\SearchController' => 'VuFind\Controller\AbstractBaseFactory',
], ],
'aliases' => [ 'aliases' => [
'feedback' => 'fid_bbi\Controller\FeedbackController', 'feedback' => 'fid_bbi\Controller\FeedbackController',
'Feedback' => 'fid_bbi\Controller\FeedbackController', 'Feedback' => 'fid_bbi\Controller\FeedbackController',
'Search' => 'fid_bbi\Controller\SearchController', 'Search' => 'fid_bbi\Controller\SearchController',
'search' => 'fid_bbi\Controller\SearchController', 'search' => 'fid_bbi\Controller\SearchController',
], ],
], ],
'vufind' => [ 'vufind' => [
'plugin_managers' => [ 'plugin_managers' => [
'recorddriver' => [ 'recorddriver' => [
'factories' => [ 'factories' => [
'solrdefault' => 'finc\RecordDriver\Factory::getSolrDefault', 'solrdefault' => 'finc\RecordDriver\Factory::getSolrDefault',
'solrmarc' => 'finc\RecordDriver\Factory::getSolrMarc', 'solrmarc' => 'finc\RecordDriver\Factory::getSolrMarc',
'solrmarcfinc' => 'fid_bbi\RecordDriver\Factory::getSolrMarcFinc', 'solrmarcfinc' => 'fid_bbi\RecordDriver\Factory::getSolrMarcFinc',
'solrmarcfincpda' => 'finc\RecordDriver\Factory::getSolrMarcFincPDA', 'solrmarcfincpda' => 'finc\RecordDriver\Factory::getSolrMarcFincPDA',
'solrmarcremote' => 'finc\RecordDriver\Factory::getSolrMarcRemote', 'solrmarcremote' => 'finc\RecordDriver\Factory::getSolrMarcRemote',
'solrmarcremotefinc' => 'finc\RecordDriver\Factory::getSolrMarcRemoteFinc', 'solrmarcremotefinc' => 'finc\RecordDriver\Factory::getSolrMarcRemoteFinc',
'solrai' => 'finc\RecordDriver\Factory::getSolrAI', 'solrai' => 'finc\RecordDriver\Factory::getSolrAI',
'solris' => 'finc\RecordDriver\Factory::getSolrIS', 'solris' => 'finc\RecordDriver\Factory::getSolrIS',
'solrlido' => 'finc\RecordDriver\Factory::getSolrLido', 'solrlido' => 'finc\RecordDriver\Factory::getSolrLido',
'solrlidondl' => 'finc\RecordDriver\Factory::getSolrLidoNdl' 'solrlidondl' => 'finc\RecordDriver\Factory::getSolrLidoNdl'
], ],
], ],
'recordtab' => [ 'recordtab' => [
'factories' => [ 'factories' => [
'hierarchytree' => 'finc\RecordTab\Factory::getHierarchyTree', 'hierarchytree' => 'finc\RecordTab\Factory::getHierarchyTree',
], ],
'invokables' => [ 'invokables' => [
'staffviewai' => 'finc\RecordTab\StaffViewAI', 'staffviewai' => 'finc\RecordTab\StaffViewAI',
'acquisitionpda' => 'finc\RecordTab\AcquisitionPDA', 'acquisitionpda' => 'finc\RecordTab\AcquisitionPDA',
'topics' => 'finc\RecordTab\Topics', 'topics' => 'finc\RecordTab\Topics',
'descriptionlido' => 'finc\RecordTab\DescriptionLido' 'descriptionlido' => 'finc\RecordTab\DescriptionLido'
], ],
], ],
], ],
'recorddriver_tabs' => [ 'recorddriver_tabs' => [
'finc\RecordDriver\SolrDefault' => [ 'finc\RecordDriver\SolrDefault' => [
'tabs' => [ 'tabs' => [
'Description' => 'Description', 'Holdings' => 'HoldingsILS', 'Description' => 'Description',
'TOC' => 'TOC', 'UserComments' => 'UserComments', 'Holdings' => 'HoldingsILS',
'Reviews' => 'Reviews', 'Excerpt' => 'Excerpt', 'TOC' => 'TOC',
'Preview' => 'preview', 'UserComments' => 'UserComments',
'HierarchyTree' => 'HierarchyTree', 'Map' => 'Map', 'Reviews' => 'Reviews',
'Similar' => null, 'Excerpt' => 'Excerpt',
'Details' => 'StaffViewArray', 'Preview' => 'preview',
'HierarchyTree' => 'HierarchyTree',
'Map' => 'Map',
'Similar' => null,
'Details' => 'StaffViewArray',
], ],
'defaultTab' => null, 'defaultTab' => null,
], ],
'finc\RecordDriver\SolrMarcFinc' => [ 'finc\RecordDriver\SolrMarcFinc' => [
'tabs' => [ 'tabs' => [
'Description' => 'Description', 'Holdings' => 'HoldingsILS', 'Description' => 'Description',
'TOC' => 'TOC', 'UserComments' => 'UserComments', 'Holdings' => 'HoldingsILS',
'Reviews' => 'Reviews', 'Excerpt' => 'Excerpt', 'TOC' => 'TOC',
'Preview' => 'preview', 'UserComments' => 'UserComments',
'HierarchyTree' => 'HierarchyTree', 'Map' => 'Map', 'Reviews' => 'Reviews',
'Similar' => null, 'Excerpt' => 'Excerpt',
'Details' => 'StaffViewMARC', 'Preview' => 'preview',
'HierarchyTree' => 'HierarchyTree',
'Map' => 'Map',
'Similar' => null,
'Details' => 'StaffViewMARC',
], ],
'defaultTab' => null, 'defaultTab' => null,
], ],
'finc\RecordDriver\SolrAI' => [ 'finc\RecordDriver\SolrAI' => [
'tabs' => [ 'tabs' => [
'Description' => 'Description', 'Holdings' => 'HoldingsILS', 'Description' => 'Description',
'TOC' => 'TOC', 'UserComments' => 'UserComments', 'Holdings' => 'HoldingsILS',
'Reviews' => 'Reviews', 'Excerpt' => 'Excerpt', 'TOC' => 'TOC',
'Preview' => 'preview', 'UserComments' => 'UserComments',
'HierarchyTree' => 'HierarchyTree', 'Map' => 'Map', 'Reviews' => 'Reviews',
'Similar' => null, 'Excerpt' => 'Excerpt',
'Details' => 'StaffViewAI', 'Preview' => 'preview',
'HierarchyTree' => 'HierarchyTree',
'Map' => 'Map',
'Similar' => null,
'Details' => 'StaffViewAI',
], ],
'defaultTab' => null, 'defaultTab' => null,
], ],
], ],
'recorddriver_collection_tabs' => [ 'recorddriver_collection_tabs' => [
'VuFind\RecordDriver\AbstractBase' => [ 'VuFind\RecordDriver\AbstractBase' => [
'tabs' => [ 'tabs' => [
'CollectionList' => 'CollectionList', 'CollectionList' => 'CollectionList',
'HierarchyTree' => 'CollectionHierarchyTree', 'HierarchyTree' => 'CollectionHierarchyTree',
'Details' => 'StaffViewArray', 'Details' => 'StaffViewArray',
], ],
'defaultTab' => null, 'defaultTab' => null,
], ],
...@@ -94,15 +125,17 @@ $config = [ ...@@ -94,15 +125,17 @@ $config = [
]; ];
$nonTabRecordActions = [ $nonTabRecordActions = [
'PDA', 'EmailHold', 'ReportErrors' 'PDA',
'EmailHold',
'ReportErrors'
]; ];
// Define record view routes -- route name => controller // Define record view routes -- route name => controller
// Define record view routes once again to add new nonTabRecordActions // Define record view routes once again to add new nonTabRecordActions
$recordRoutes = [ $recordRoutes = [
'record' => 'Record', 'record' => 'Record',
'export' => 'Export', 'export' => 'Export',
'resources' => 'Resources' 'resources' => 'Resources'
]; ];
......
<?php
/**
* Copyright (C) 2019 Leipzig University Library
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @author Gregor Gawol <gawol@ub.uni-leipzig.de>
* @author Sebastian Kehr <kehr@ub.uni-leipzig.de>
* @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
*/
use Zend\Form\Element\Checkbox;
use Zend\Form\Element\Submit;
use Zend\Form\Form;
use Zend\Form\Element as Element;
use Zend\Form\View\Helper\FormElementErrors;
use Zend\Form\View\Helper\FormLabel;
use Zend\Form\View\Helper\FormRadio;
use Zend\Form\View\Helper\FormSelect;
use Zend\Form\View\Helper\FormSubmit;
use Zend\I18n\Translator\TranslatorInterface;
/** @var FormLabel $formLabel */
$formLabel = $this->formLabel();
/**@var FormRadio $formRadio */
$formRadio = $this->formRadio();
/**@var FormSelect $formSelect */
$formSelect = $this->formSelect();
/**@var FormSubmit $formSubmit */
$formSubmit = $this->formSubmit();
/** @var FormElementErrors $formElementErrors */
$formElementErrors = $this->formElementErrors();
$formLabel->setTranslatorTextDomain('fid');
$formSelect->setTranslatorTextDomain('fid');
$formRadio->setTranslatorTextDomain('fid');
$formSubmit->setTranslatorTextDomain('fid');
$formElementErrors->setTranslatorTextDomain('fid');
/** @var TranslatorInterface $translator */
$translator = $this->getHelperPluginManager()->get('translate')
->getTranslator();
$formLabel->setTranslator($translator);
$formElementErrors->setTranslator($translator);
/** @var Form $form */
$form = $this->form;
$form->setAttribute('method', 'post');
$form->setAttribute('action', $this->url('fid/user/create'));
$form->setAttribute('class', 'fid-user-create-form registration');
$form->prepare();
$this->headTitle($this->translate('Profile Form'));
$this->headTitle($this->translate("fid::user_create_form_title"));
?>
<?= $this->flashmessages() ?>
<?= $this->form()->openTag($form) ?>
<h2><?= $this->translate("fid::user_create_form_title") ?></h2>
<div class="subito-pg">
* <?= $this->transEsc("This field is required") ?>
</div>
<? /* username */ ?>
<?php
/** @var Element\Text $elemUsername */
$elemUsername = $form->get('username');
$elemUsername->setLabelAttributes(['class' => 'col-md-4']);
$elemUsername->setAttributes(['class' => 'form-control', 'disabled' => 1]);
?>
<div class="form-group">
<?= $this->formLabel($elemUsername) ?>
<?= $this->formElement($elemUsername) ?>
<?= $this->formElementErrors($elemUsername) ?>
<?php
$elemUsername->removeAttribute('disabled');
$elemUsername->setAttribute('type', 'hidden');
echo $this->formElement($elemUsername);
?>
</div>
<? /* password */ ?>
<?php
/** @var Element\Password $elemPassword */
$elemPassword = $form->get('password');
$elemPassword->setLabelAttributes(['class' => 'col-md-4']);
$elemPassword->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemPassword) ?>
<?= $this->formElement($elemPassword) ?>
<?= $this->formElementErrors($elemPassword) ?>
</div>
<? /* password confirmation */ ?>
<?php
/** @var Element\Password $elemPasswordConfirmation */
$elemPasswordConfirmation = $form->get('passwordConfirmation');
$elemPasswordConfirmation->setLabelAttributes(['class' => 'col-md-4']);
$elemPasswordConfirmation->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemPasswordConfirmation) ?>
<?= $this->formElement($elemPasswordConfirmation) ?>
<?= $this->formElementErrors($elemPasswordConfirmation) ?>
</div>
<? /* home library */ ?>
<?php
/** @var Element\Select $elemHomeLibrary */
$elemHomeLibrary = $form->get('homeLibrary');
$elemHomeLibrary->setLabelAttributes(['class' => 'col-md-4']);
$elemHomeLibrary->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemHomeLibrary) ?>
<?= $this->formSelect($elemHomeLibrary) ?>
<?= $this->formElementErrors($elemHomeLibrary) ?>
</div>
<? /* salutation */ ?>
<?php
/** @var Element\Select $elemSalutation */
$elemSalutation = $form->get('salutation');
$elemSalutation->setAttribute('type', 'hidden');
echo $this->formElement($elemSalutation);
?>
<? /* academic title */ ?>
<?php
/** @var Element\Text $elemAcademicTitle */
$elemAcademicTitle = $form->get('academicTitle');
$elemAcademicTitle->setLabelAttributes(['class' => 'col-md-4']);
$elemAcademicTitle->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemAcademicTitle) ?>
<?= $this->formElement($elemAcademicTitle) ?>
</div>
<? /* firstname */ ?>
<?php
/** @var Element\Text $elemFirstname */
$elemFirstname = $form->get('firstname');
$elemFirstname->setLabelAttributes(['class' => 'col-md-4']);
$elemFirstname->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemFirstname) ?>
<?= $this->formElement($elemFirstname) ?>
<?= $this->formElementErrors($elemFirstname) ?>
</div>
<? /* lastname */ ?>
<?php
/** @var Element\Text $elemLastname */
$elemLastname = $form->get('lastname');
$elemLastname->setLabelAttributes(['class' => 'col-md-4']);
$elemLastname->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemLastname) ?>
<?= $this->formElement($elemLastname) ?>
<?= $this->formElementErrors($elemLastname) ?>
</div>
<? /* year of birth */ ?>
<?php
/** @var Element\Text $elemYearOfBirth */
$elemYearOfBirth = $form->get('yearOfBirth');
$elemYearOfBirth->setAttribute('type', 'hidden');
echo $this->formElement($elemYearOfBirth);
?>
<? /* college */ ?>
<?php
/** @var Element\Text $elemCollege */
$elemCollege = $form->get('college');
$elemCollege->setLabelAttributes(['class' => 'col-md-4']);
$elemCollege->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemCollege) ?>
<?= $this->formElement($elemCollege) ?>
<?= $this->formElementErrors($elemCollege) ?>
</div>
<? /* job title */ ?>
<?php
/** @var Element\Text $elemJobTitle */
$elemJobTitle = $form->get('jobTitle');
$elemJobTitle->setAttribute('type', 'hidden');
echo $this->formElement($elemJobTitle);
?>
<? /* role (user group) */ ?>
<?php
/** @var Element\Radio $accessLevel */
$accessLevel = $form->get('accessLevel');
?>
<div class="form-group">
<div class="col-md-4">
<?= $this->formLabel($accessLevel) ?>
</div>
<div class="col-md-8">
<?= $this->formRadio($accessLevel) ?>
</div>
<?= $this->formElementErrors($accessLevel) ?>
</div>
<?php
/** @var Element\Text $elemAddressLine1 */
$elemAddressLine1 = $form->get('addressLine1');
$elemAddressLine1->setLabelAttributes(['class' => 'col-md-4']);
$elemAddressLine1->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemAddressLine1) ?>
<?= $this->formElement($elemAddressLine1) ?>
<?= $this->formElementErrors($elemAddressLine1) ?>
</div>
<? /* second address line */ ?>
<?php
/** @var Element\Text $elemAddressLine2 */
$elemAddressLine2 = $form->get('addressLine2');
$elemAddressLine2->setLabelAttributes(['class' => 'col-md-4']);
$elemAddressLine2->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemAddressLine2) ?>
<?= $this->formElement($elemAddressLine2) ?>
<?= $this->formElementErrors($elemAddressLine2) ?>
</div>
<? /* address zip */ ?>
<?php
/** @var Element\Text $elemAddressZip */
$elemAddressZip = $form->get('addressZip');
$elemAddressZip->setLabelAttributes(['class' => 'col-md-4']);
$elemAddressZip->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemAddressZip) ?>
<?= $this->formElement($elemAddressZip) ?>
<?= $this->formElementErrors($elemAddressZip) ?>
</div>
<? /* address city */ ?>
<?php
/** @var Element\Text $elemAddressCity */
$elemAddressCity = $form->get('addressCity');
$elemAddressCity->setLabelAttributes(['class' => 'col-md-4']);
$elemAddressCity->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemAddressCity) ?>
<?= $this->formElement($elemAddressCity) ?>
<?= $this->formElementErrors($elemAddressCity) ?>
</div>
<? /* address country */ ?>
<?php
/** @var Element\Text $elemAddressCountry */
$elemAddressCountry = $form->get('addressCountry');
$elemAddressCountry->setLabelAttributes(['class' => 'col-md-4']);
$elemAddressCountry->setAttributes(['class' => 'form-control']);
?>
<div class="form-group">
<?= $this->formLabel($elemAddressCountry) ?>
<?= $this->formElement($elemAddressCountry) ?>
<?= $this->formElementErrors($elemAddressCountry) ?>
</div>
<? /* eula privacy policy */ ?>
<?php
/** @var Checkbox $elemEulaAccepted */
$elemEulaAccepted = $form->get('eulaAccepted');
$elemEulaAccepted->setAttribute('id', 'eulaAccepted');
?>
<div class="form-group eula">
<div>
<?= $this->formElement($elemEulaAccepted) ?>
<?= $this->formLabel()->openTag($elemEulaAccepted) ?>
<?= $this->translate("fid::policy_text") ?>
<?php $url = $this->url('fid/user/policy') ?>
<a data-lightbox href="<?= $url ?>">
<?= $this->translate("fid::policy") ?>
</a>
<?= $this->translate("fid::terms_text") ?>
<?php $url = $this->url('fid/user/terms') ?>
<a data-lightbox href="<?= $url ?>">
<?= $this->translate("fid::terms") ?>
</a>.
<?= $this->formLabel()->closeTag($elemEulaAccepted) ?>
</div>
<?= $this->formElementErrors($elemEulaAccepted) ?>
</div>
<? /* submit button */ ?>
<?php
/** @var Submit $elemSubmit */
$elemSubmit = $form->get('submit');
$elemSubmit->setAttributes(['class' => 'btn btn-primary']);
?>
<div class="form-group">
<div class="">
<?= $this->formSubmit($elemSubmit) ?>
</div>
</div>
<?= $this->form()->closeTag($form) ?>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment