Author: sevein
Date: Mon Jul 11 19:06:53 2011
New Revision: 9280
Log:
Move donor module inside qtAccessionPlugin module dir
Added:
trunk/plugins/qtAccessionPlugin/modules/donor/
- copied from r9274, trunk/apps/qubit/modules/donor/
trunk/plugins/qtAccessionPlugin/modules/donor/actions/editAction.class.php
- copied unchanged from r9276,
trunk/apps/qubit/modules/donor/actions/editAction.class.php
trunk/plugins/qtAccessionPlugin/modules/donor/actions/indexAction.class.php
- copied unchanged from r9276,
trunk/apps/qubit/modules/donor/actions/indexAction.class.php
trunk/plugins/qtAccessionPlugin/modules/donor/config/
- copied from r9276, trunk/apps/qubit/modules/donor/config/
trunk/plugins/qtAccessionPlugin/modules/donor/templates/editSuccess.php
- copied unchanged from r9276,
trunk/apps/qubit/modules/donor/templates/editSuccess.php
trunk/plugins/qtAccessionPlugin/modules/donor/templates/indexSuccess.php
- copied unchanged from r9276,
trunk/apps/qubit/modules/donor/templates/indexSuccess.php
Deleted:
trunk/apps/qubit/modules/donor/
Copied:
trunk/plugins/qtAccessionPlugin/modules/donor/actions/editAction.class.php
(from r9276, trunk/apps/qubit/modules/donor/actions/editAction.class.php)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/plugins/qtAccessionPlugin/modules/donor/actions/editAction.class.php
Mon Jul 11 19:06:53 2011 (r9280, copy of r9276,
trunk/apps/qubit/modules/donor/actions/editAction.class.php)
@@ -0,0 +1,114 @@
+<?php
+
+/*
+ * This file is part of Qubit Toolkit.
+ *
+ * Qubit Toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Qubit Toolkit 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 Qubit Toolkit. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class DonorEditAction extends DefaultEditAction
+{
+ // Arrays not allowed in class constants
+ public static
+ $NAMES = array(
+ 'authorizedFormOfName');
+
+ protected function addField($name)
+ {
+ switch ($name)
+ {
+ case 'authorizedFormOfName':
+ $this->form->setDefault('authorizedFormOfName',
$this->resource->authorizedFormOfName);
+ $this->form->setValidator('authorizedFormOfName', new
sfValidatorString);
+ $this->form->setWidget('authorizedFormOfName', new sfWidgetFormInput);
+
+ break;
+
+ default:
+
+ return parent::addField($name);
+ }
+ }
+
+ protected function earlyExecute()
+ {
+ $this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
+
+ $this->resource = new QubitDonor;
+
+ if (isset($this->getRoute()->resource))
+ {
+ $this->resource = $this->getRoute()->resource;
+
+ // Check that this isn't the root
+ if (!isset($this->resource->parent))
+ {
+ $this->forward404();
+ }
+
+ // Check user authorization
+ if (!QubitAcl::check($this->resource, 'update'))
+ {
+ QubitAcl::forwardUnauthorized();
+ }
+
+ // Add optimistic lock
+ $this->form->setDefault('serialNumber', $this->resource->serialNumber);
+ $this->form->setValidator('serialNumber', new sfValidatorInteger);
+ $this->form->setWidget('serialNumber', new sfWidgetFormInputHidden);
+ }
+ else
+ {
+ // Check user authorization
+ if (!QubitAcl::check($this->resource, 'create'))
+ {
+ QubitAcl::forwardUnauthorized();
+ }
+ }
+
+ $title = $this->context->i18n->__('Add new donor');
+ if (isset($this->getRoute()->resource))
+ {
+ if (1 > strlen($title = $this->resource->__toString()))
+ {
+ $title = $this->context->i18n->__('Untitled');
+ }
+
+ $title = $this->context->i18n->__('Edit %1%', array('%1%' => $title));
+ }
+
+ $this->response->setTitle("$title - {$this->response->getTitle()}");
+ }
+
+ public function execute($request)
+ {
+ parent::execute($request);
+
+ if ($request->isMethod('post'))
+ {
+ $this->form->bind($request->getPostParameters());
+
+ if ($this->form->isValid())
+ {
+ $this->processForm();
+
+ $this->resource->save();
+
+ // $this->updateContactInformation();
+
+ $this->redirect(array($this->resource, 'module' => 'donor'));
+ }
+ }
+ }
+}
Copied:
trunk/plugins/qtAccessionPlugin/modules/donor/actions/indexAction.class.php
(from r9276, trunk/apps/qubit/modules/donor/actions/indexAction.class.php)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/plugins/qtAccessionPlugin/modules/donor/actions/indexAction.class.php
Mon Jul 11 19:06:53 2011 (r9280, copy of r9276,
trunk/apps/qubit/modules/donor/actions/indexAction.class.php)
@@ -0,0 +1,65 @@
+<?php
+
+/*
+ * This file is part of Qubit Toolkit.
+ *
+ * Qubit Toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Qubit Toolkit 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 Qubit Toolkit. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class DonorIndexAction extends sfAction
+{
+ public function execute($request)
+ {
+ $this->resource = $this->getRoute()->resource;
+
+ // Check that this isn't the root
+ if (!isset($this->resource->parent))
+ {
+ $this->forward404();
+ }
+
+ // Check user authorization
+ if (!QubitAcl::check($this->resource, 'read'))
+ {
+ QubitAcl::forwardUnauthorized();
+ }
+
+ if (1 > strlen($title = $this->resource->__toString()))
+ {
+ $title = $this->context->i18n->__('Untitled');
+ }
+
+ $this->response->setTitle("$title - {$this->response->getTitle()}");
+
+ if (QubitAcl::check($this->resource, 'update'))
+ {
+ $validatorSchema = new sfValidatorSchema;
+ $values = array();
+
+ $validatorSchema->authorizedFormOfName = new sfValidatorString(array(
+ 'required' => true), array(
+ 'required' => $this->context->i18n->__('Authorized form of name - This
is a mandatory element.')));
+ $values['authorizedFormOfName'] =
$this->resource->getAuthorizedFormOfName(array('cultureFallback' => true));
+
+ try
+ {
+ $validatorSchema->clean($values);
+ }
+ catch (sfValidatorErrorSchema $e)
+ {
+ $this->errorSchema = $e;
+ }
+ }
+ }
+}
Copied: trunk/plugins/qtAccessionPlugin/modules/donor/templates/editSuccess.php
(from r9276, trunk/apps/qubit/modules/donor/templates/editSuccess.php)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/plugins/qtAccessionPlugin/modules/donor/templates/editSuccess.php
Mon Jul 11 19:06:53 2011 (r9280, copy of r9276,
trunk/apps/qubit/modules/donor/templates/editSuccess.php)
@@ -0,0 +1,43 @@
+<h1><?php echo __('Edit donor') ?></h1>
+
+<h1 class="label"><?php echo render_title($resource) ?></h1>
+
+<?php echo $form->renderGlobalErrors() ?>
+
+<?php if (isset($sf_request->getAttribute('sf_route')->resource)): ?>
+ <?php echo $form->renderFormTag(url_for(array($resource, 'module' =>
'donor', 'action' => 'edit')), array('id' => 'editForm')) ?>
+<?php else: ?>
+ <?php echo $form->renderFormTag(url_for(array('module' => 'donor', 'action'
=> 'add')), array('id' => 'editForm')) ?>
+<?php endif; ?>
+
+ <?php echo $form->renderHiddenFields() ?>
+
+ <fieldset class="collapsible" id="identityArea">
+
+ <legend><?php echo __('Identity area') ?></legend>
+
+ <?php echo render_field($form->authorizedFormOfName, $resource) ?>
+
+ </fieldset>
+
+ <div class="actions section">
+
+ <h2 class="element-invisible"><?php echo __('Actions') ?></h2>
+
+ <div class="content">
+ <ul class="clearfix links">
+
+ <?php if (isset($sf_request->getAttribute('sf_route')->resource)): ?>
+ <li><input class="form-submit" type="submit" value="<?php echo
__('Save') ?>"/></li>
+ <li><?php echo link_to(__('Cancel'), array($resource, 'module' =>
'donor'), array('title' => __('Cancel'))) ?></li>
+ <?php else: ?>
+ <li><input class="form-submit" type="submit" value="<?php echo
__('Create') ?>"/></li>
+ <li><?php echo link_to(__('Cancel'), array('module' => 'donor',
'action' => 'list'), array('title' => __('Cancel'))) ?></li>
+ <?php endif; ?>
+
+ </ul>
+ </div>
+
+ </div>
+
+</form>
Copied:
trunk/plugins/qtAccessionPlugin/modules/donor/templates/indexSuccess.php (from
r9276, trunk/apps/qubit/modules/donor/templates/indexSuccess.php)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/plugins/qtAccessionPlugin/modules/donor/templates/indexSuccess.php
Mon Jul 11 19:06:53 2011 (r9280, copy of r9276,
trunk/apps/qubit/modules/donor/templates/indexSuccess.php)
@@ -0,0 +1,39 @@
+<h1><?php echo __('View donor') ?></h1>
+
+<?php echo link_to_if(QubitAcl::check($resource, 'update'), '<h1
class="label">'.render_title($resource).'</h1>', array($resource, 'module' =>
'donor', 'action' => 'edit'), array('title' => __('Edit donor'))) ?>
+
+<?php if (isset($errorSchema)): ?>
+ <div class="messages error">
+ <ul>
+ <?php foreach ($errorSchema as $error): ?>
+ <li><?php echo $error ?></li>
+ <?php endforeach; ?>
+ </ul>
+ </div>
+<?php endif; ?>
+
+<?php echo render_show(__('Authorized form of name'),
render_value($resource->getAuthorizedFormOfName(array('cultureFallback' =>
true)))) ?>
+
+<div class="actions section">
+
+ <h2 class="element-invisible"><?php echo __('Actions') ?></h2>
+
+ <div class="content">
+ <ul class="clearfix links">
+
+ <?php if (QubitAcl::check($resource, 'update')): ?>
+ <li><?php echo link_to(__('Edit'), array($resource, 'module' =>
'donor', 'action' => 'edit'), array('title' => __('Edit'))) ?></li>
+ <?php endif; ?>
+
+ <?php if (QubitAcl::check($resource, 'delete')): ?>
+ <li><?php echo link_to(__('Delete'), array($resource, 'module' =>
'donor', 'action' => 'delete'), array('title' => __('Delete'))) ?></li>
+ <?php endif; ?>
+
+ <?php if (QubitAcl::check($resource, 'create')): ?>
+ <li><?php echo link_to(__('Add new'), array('module' => 'donor',
'action' => 'add'), array('title' => __('Add new'))) ?></li>
+ <?php endif; ?>
+
+ </ul>
+ </div>
+
+</div>
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.