Author: sevein
Date: Mon Jul 18 17:46:04 2011
New Revision: 9320

Log:
Add accession_counter QubitSetting

Modified:
   trunk/apps/qubit/modules/settings/actions/listAction.class.php
   trunk/data/fixtures/settings.yml
   trunk/lib/form/SettingsGlobalForm.class.php
   trunk/lib/task/migrate/QubitMigrate110.class.php

Modified: trunk/apps/qubit/modules/settings/actions/listAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/settings/actions/listAction.class.php      Mon Jul 
18 17:45:11 2011        (r9319)
+++ trunk/apps/qubit/modules/settings/actions/listAction.class.php      Mon Jul 
18 17:46:04 2011        (r9320)
@@ -197,6 +197,7 @@
     $refImageMaxWidth = 
QubitSetting::getSettingByName('reference_image_maxwidth');
     $hitsPerPage = QubitSetting::getSettingByName('hits_per_page');
     $accessionMask = QubitSetting::getSettingByName('accession_mask');
+    $accessionCounter = QubitSetting::getSettingByName('accession_counter');
     $inheritCodeInformationObject = 
QubitSetting::getSettingByName('inherit_code_informationobject');
     $sortTreeviewInformationObject = 
QubitSetting::getSettingByName('sort_treeview_informationobject');
     $multiRepository = QubitSetting::getSettingByName('multi_repository');
@@ -212,6 +213,7 @@
       'reference_image_maxwidth' => (isset($refImageMaxWidth)) ? 
$refImageMaxWidth->getValue(array('sourceCulture'=>true)) : null,
       'hits_per_page' => (isset($hitsPerPage)) ? 
$hitsPerPage->getValue(array('sourceCulture'=>true)) : null,
       'accession_mask' => (isset($accessionMask)) ? 
$accessionMask->getValue(array('sourceCulture'=>true)) : null,
+      'accession_counter' => (isset($accessionCounter)) ? 
intval($accessionCounter->getValue(array('sourceCulture'=>true))) : 1,
       'inherit_code_informationobject' => 
(isset($inheritCodeInformationObject)) ? 
intval($inheritCodeInformationObject->getValue(array('sourceCulture'=>true))) : 
1,
       'sort_treeview_informationobject' => 
(isset($sortTreeviewInformationObject)) ? 
$sortTreeviewInformationObject->getValue(array('sourceCulture'=>true)) : 0,
       'multi_repository' => (isset($multiRepository)) ? 
intval($multiRepository->getValue(array('sourceCulture'=>true))) : 1,
@@ -274,6 +276,19 @@
       $setting->save();
     }
 
+    // Accession counter
+    if (null !== $accessionCounter = $thisForm->getValue('accession_counter'))
+    {
+      if (intval($accessionCounter) && $accessionCounter > -1)
+      {
+        $setting = QubitSetting::getSettingByName('accession_counter');
+
+        // Force sourceCulture update to prevent discrepency in settings 
between cultures
+        $setting->setValue($accessionCounter, array('sourceCulture' => true));
+        $setting->save();
+      }
+    }
+
     // Inherit Code (Information Object)
     if (null !== $inheritCodeInformationObjectValue = 
$thisForm->getValue('inherit_code_informationobject'))
     {

Modified: trunk/data/fixtures/settings.yml
==============================================================================
--- trunk/data/fixtures/settings.yml    Mon Jul 18 17:45:11 2011        (r9319)
+++ trunk/data/fixtures/settings.yml    Mon Jul 18 17:46:04 2011        (r9320)
@@ -338,3 +338,6 @@
   QubitSetting_accessionMask:
     name: accession_mask
     value: '%Y-%m-%d/#i'
+  QubitSetting_accessionCounter:
+    name: accession_counter
+    value: 1

Modified: trunk/lib/form/SettingsGlobalForm.class.php
==============================================================================
--- trunk/lib/form/SettingsGlobalForm.class.php Mon Jul 18 17:45:11 2011        
(r9319)
+++ trunk/lib/form/SettingsGlobalForm.class.php Mon Jul 18 17:46:04 2011        
(r9320)
@@ -45,6 +45,7 @@
       'reference_image_maxwidth' => new sfWidgetFormInput,
       'hits_per_page' => new sfWidgetFormInput,
       'accession_mask' => new sfWidgetFormInput,
+      'accession_counter' => new sfWidgetFormInput,
       'inherit_code_informationobject' => new 
sfWidgetFormSelectRadio(array('choices'=>array(1=>'yes', 0=>'no')), 
array('class'=>'radio')),
       'sort_treeview_informationobject' => new 
sfWidgetFormSelectRadio(array('choices'=>array('none'=>'none', 
'title'=>'title', 'identifierTitle'=> 'identifier - title')), 
array('class'=>'radio')),
       'multi_repository' => new 
sfWidgetFormSelectRadio(array('choices'=>array(1=>'yes', 0=>'no')), 
array('class'=>'radio')),
@@ -61,6 +62,7 @@
       'reference_image_maxwidth' => __('Maximum image width (pixels)'),
       'hits_per_page' => __('Results per page'),
       'accession_mask' => __('Accession mask'),
+      'accession_counter' => __('Accession counter'),
       'inherit_code_informationobject' => __('Inherit reference code 
(information object)'),
       'sort_treeview_informationobject' => __('Sort treeview (information 
object)'),
       'multi_repository' => __('Multiple repositories'),
@@ -76,7 +78,8 @@
       'upload_dir' => __('The destination directory for uploaded digital 
object files'),
       'reference_image_maxwidth' => __('The maximum width for derived 
reference images'),
       'hits_per_page' => __('The number of records shown per page on list 
pages'),
-      // 'accession_mask' => __('The number of records shown per page on list 
pages'),
+      // 'accession_mask' => __(''),
+      // 'accession_counter' => __(''),
       'inherit_code_informationobject' => __('When set to "yes", the 
reference code string will be built using the information object identifier 
plus the identifiers of all its ancestors'),
       'sort_treeview_informationobject' => __('Determines whether to sort 
siblings in the information object treeview control and, if so, what sort 
criteria to use'),
       'multi_repository' => __('When set to "no", the repository 
name is excluded from certain displays because it will be too repetitive'),
@@ -117,6 +120,7 @@
     $this->validatorSchema['check_for_updates'] = new 
sfValidatorString(array('required' => false));
     $this->validatorSchema['upload_dir'] = new 
sfValidatorString(array('required' => false));
     $this->validatorSchema['accession_mask'] = new 
sfValidatorString(array('required' => false));
+    $this->validatorSchema['accession_counter'] = new 
sfValidatorInteger(array('required' => false));
     $this->validatorSchema['inherit_code_informationobject'] = new 
sfValidatorInteger(array('required' => false));
     $this->validatorSchema['sort_treeview_informationobject'] = new 
sfValidatorString(array('required' => false));
     $this->validatorSchema['multi_repository'] = new 
sfValidatorInteger(array('required' => false));

Modified: trunk/lib/task/migrate/QubitMigrate110.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate110.class.php    Mon Jul 18 17:45:11 
2011        (r9319)
+++ trunk/lib/task/migrate/QubitMigrate110.class.php    Mon Jul 18 17:46:04 
2011        (r9320)
@@ -80,6 +80,14 @@
       );
     }
 
+    // Add accession counter setting
+    if (false === $this->getRowKey('QubitSetting', 'name', 
'QubitSetting_accessionCounter'))
+    {
+      $this->data['QubitSetting']['QubitSetting_accessionCounter'] = array(
+        'name' => 'accession_counter',
+        'value' => 1
+      );
+    }
 
     // Update add button, accession is now the default action
     if ($key = $this->findRowKeyForColumnValue($this->data['QubitMenu'], 
'name', 'add'))

-- 
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.

Reply via email to