diff --git a/ContributionPlugin.php b/ContributionPlugin.php index 4afff01e..52ded17b 100644 --- a/ContributionPlugin.php +++ b/ContributionPlugin.php @@ -78,7 +78,7 @@ public function setUp() $this->_hooks[] = 'user_profiles_user_page'; } - if (! is_admin_theme()) { + if (!is_admin_theme()) { //dig up all the elements being used, and add their ElementForm hook $elementsTable = $this->_db->getTable('Element'); $select = $elementsTable->getSelect(); @@ -112,6 +112,7 @@ public function hookInstall() `item_type_id` INT UNSIGNED NOT NULL, `display_name` VARCHAR(255) NOT NULL, `file_permissions` ENUM('Disallowed', 'Allowed', 'Required') NOT NULL DEFAULT 'Disallowed', + `add_tags` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `item_type_id` (`item_type_id`) ) ENGINE=MyISAM;"; @@ -259,6 +260,12 @@ public function hookUpgrade($args) set_option('contribution_open', get_option('contribution_simple')); delete_option('contribution_simple'); } + + if (version_compare($oldVersion, '3.1.2', '<')) { + $db = $this->_db; + $sql = "ALTER TABLE `$db->ContributionType` ADD COLUMN `add_tags` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'"; + $db->query($sql); + } } public function hookUninstallMessage() @@ -634,8 +641,8 @@ public function hookUserProfilesUserPage($args) { $user = $args['user']; $contributionCount = $this->_db->getTable('ContributionContributedItem')->count(array('contributor' => $user->id)); - if ($contributionCount !=0) { - echo "id) . "'>Contributed Items ($contributionCount)"; + if ($contributionCount != 0) { + echo "id) . "'>" . __('Contributed Items (%d)', $contributionCount) . ''; } } diff --git a/controllers/ContributionController.php b/controllers/ContributionController.php index 96e931c1..192899e2 100644 --- a/controllers/ContributionController.php +++ b/controllers/ContributionController.php @@ -185,7 +185,6 @@ protected function _setupCaptcha() protected function _processForm($post) { if (!empty($post)) { - //for the "Simple" configuration, look for the user if exists by email. Log them in. //If not, create the user and log them in. $user = current_user(); @@ -274,6 +273,9 @@ protected function _processForm($post) return false; } $this->_addElementTextsToItem($item, $post['Elements']); + if ($contributionType->add_tags && isset($post['tags'])) { + $item->addTags($post['tags']); + } // Allow plugins to deal with the inputs they may have added to the form. fire_plugin_hook('contribution_save_form', array('contributionType'=>$contributionType,'record'=>$item, 'post'=>$post)); $item->save(); diff --git a/models/ContributionType.php b/models/ContributionType.php index adfbaafb..6785d978 100644 --- a/models/ContributionType.php +++ b/models/ContributionType.php @@ -22,6 +22,7 @@ class ContributionType extends Omeka_Record_AbstractRecord public $item_type_id; public $display_name; public $file_permissions = 'Disallowed'; + public $add_tags = 0; protected $_related = array('ContributionTypeElements' => 'getTypeElements', 'ItemType' => 'getItemType'); diff --git a/plugin.ini b/plugin.ini index b9dfbc78..d31c8d97 100644 --- a/plugin.ini +++ b/plugin.ini @@ -6,7 +6,7 @@ link="http://omeka.org/codex/Plugins/Contribution_2.0" support_link="http://omeka.org/forums/forum/plugins" omeka_minimum_version="2.3" omeka_target_version="2.3" -version="3.1.0" +version="3.1.2" tags="social, items" license="GPLv3" required_plugins="GuestUser" diff --git a/views/admin/types/form.php b/views/admin/types/form.php index 3cdd85b0..d73ec36c 100644 --- a/views/admin/types/form.php +++ b/views/admin/types/form.php @@ -43,9 +43,19 @@ - - +
+
+ +
+
+

+
+ formCheckbox('add_tags', null, array('checked' => $contribution_type->add_tags)); ?> +
+
+
+