Author: david
Date: Thu Oct 14 14:14:53 2010
New Revision: 8124

Log:
Add default publication status setting.  Refs issue #1658.

Modified:
   trunk/apps/qubit/modules/settings/actions/listAction.class.php
   trunk/lib/form/SettingsGlobalForm.class.php

Modified: trunk/apps/qubit/modules/settings/actions/listAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/settings/actions/listAction.class.php      Thu Oct 
14 13:38:16 2010        (r8123)
+++ trunk/apps/qubit/modules/settings/actions/listAction.class.php      Thu Oct 
14 14:14:53 2010        (r8124)
@@ -198,6 +198,7 @@
     $multiRepository = QubitSetting::getSettingByName('multi_repository');
     $explodeMultipageFiles = 
QubitSetting::getSettingByName('explode_multipage_files');
     $showTooltips = QubitSetting::getSettingByName('show_tooltips');
+    $defaultPubStatus = QubitSetting::getSettingByName('defaultPubStatus');
 
     // Set defaults for global form
     $this->globalForm->setDefaults(array(
@@ -210,7 +211,8 @@
       'sort_treeview_informationobject' => 
(isset($sortTreeviewInformationObject)) ? 
$sortTreeviewInformationObject->getValue(array('sourceCulture'=>true)) : 0,
       'multi_repository' => (isset($multiRepository)) ? 
intval($multiRepository->getValue(array('sourceCulture'=>true))) : 1,
       'explode_multipage_files' => (isset($explodeMultipageFiles)) ? 
intval($explodeMultipageFiles->getValue(array('sourceCulture'=>true))) : 1,
-      'show_tooltips' => (isset($showTooltips)) ? 
intval($showTooltips->getValue(array('sourceCulture'=>true))) : 1
+      'show_tooltips' => (isset($showTooltips)) ? 
intval($showTooltips->getValue(array('sourceCulture'=>true))) : 1,
+      'defaultPubStatus' => (isset($defaultPubStatus)) ? 
$defaultPubStatus->getValue(array('sourceCulture'=>true)) : 
QubitTerm::PUBLICATION_STATUS_DRAFT_ID 
     ));
   }
 
@@ -314,6 +316,16 @@
       $setting->save();
     }
 
+    // Default publication status 
+    if (null !== $defaultPubStatus = $thisForm->getValue('defaultPubStatus'))
+    {
+      $setting = QubitSetting::getSettingByName('defaultPubStatus');
+
+      // Force sourceCulture update to prevent discrepency in settings between 
cultures
+      $setting->setValue($defaultPubStatus, array('sourceCulture' => true));
+      $setting->save();
+    }
+
     return $this;
   }
 

Modified: trunk/lib/form/SettingsGlobalForm.class.php
==============================================================================
--- trunk/lib/form/SettingsGlobalForm.class.php Thu Oct 14 13:38:16 2010        
(r8123)
+++ trunk/lib/form/SettingsGlobalForm.class.php Thu Oct 14 14:14:53 2010        
(r8124)
@@ -48,7 +48,8 @@
       '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')),
       'explode_multipage_files' => new 
sfWidgetFormSelectRadio(array('choices'=>array(1=>'yes', 0=>'no')), 
array('class'=>'radio')),
-      'show_tooltips' => new 
sfWidgetFormSelectRadio(array('choices'=>array(1=>'yes', 0=>'no')), 
array('class'=>'radio'))
+      'show_tooltips' => new 
sfWidgetFormSelectRadio(array('choices'=>array(1=>'yes', 0=>'no')), 
array('class'=>'radio')),
+      'defaultPubStatus' => new 
sfWidgetFormSelectRadio(array('choices'=>array(QubitTerm::PUBLICATION_STATUS_DRAFT_ID=>__('Draft'),
 QubitTerm::PUBLICATION_STATUS_PUBLISHED_ID=>__('Published'))), 
array('class'=>'radio'))
     ));
 
     // Add labels
@@ -62,7 +63,8 @@
       'sort_treeview_informationobject' => __('Sort treeview (information 
object)'),
       'multi_repository' => __('Multiple repositories'),
       'explode_multipage_files' => __('Upload multi-page files as multiple 
descriptions'),
-      'show_tooltips' => __('Show tooltips')
+      'show_tooltips' => __('Show tooltips'),
+      'defaultPubStatus' => __('Default publication status')
     ));
 
     // Add helper text
@@ -74,7 +76,8 @@
       'hits_per_page' => __('The number of records shown per page on list 
pages'),
       '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')
+      'multi_repository' => __('When set to "no", the repository 
name is excluded from certain displays because it will be too repetitive'),
+      'defaultPubStatus' => __('Default publication status for newly created 
or imported %1%', array('%1%' => 
sfConfig::get('app_ui_label_informationobject')))
       // 'explode_multipage_files' => __('')
       // 'show_tooltips' => __('')
     ));
@@ -115,6 +118,7 @@
     $this->validatorSchema['multi_repository'] = new 
sfValidatorInteger(array('required' => false));
     $this->validatorSchema['explode_multipage_files'] = new 
sfValidatorInteger(array('required' => false));
     $this->validatorSchema['show_tooltips'] = new 
sfValidatorInteger(array('required' => false));
+    $this->validatorSchema['defaultPubStatus'] = new 
sfValidatorChoice(array('choices' => 
array(QubitTerm::PUBLICATION_STATUS_DRAFT_ID, 
QubitTerm::PUBLICATION_STATUS_PUBLISHED_ID)));
 
     // Set decorator
     $decorator = new QubitWidgetFormSchemaFormatterList($this->widgetSchema);

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