diff --git a/CommentForm.php b/CommentForm.php index c9b7469..64c4ab8 100644 --- a/CommentForm.php +++ b/CommentForm.php @@ -61,6 +61,25 @@ public function init() ) ); + // The legal agreement is checked by default for logged users. + if (get_option('commenting_legal_text')) { + $this->addElement('checkbox', 'commenting_legal_text', array( + 'label' => get_option('commenting_legal_text'), + 'value' => (boolean) $user, + 'required' => true, + 'uncheckedValue'=> '', + 'checkedValue' => 'checked', + 'validators' => array( + array('notEmpty', true, array( + 'messages' => array( + 'isEmpty'=> __('You must agree to the terms and conditions.'), + ), + )), + ), + 'decorators' => array('ViewHelper', 'Errors', array('label', array('escape' => false))), + )); + } + $request = Zend_Controller_Front::getInstance()->getRequest(); $params = $request->getParams(); @@ -135,4 +154,4 @@ private function _getRecordType($params) return $model; } -} \ No newline at end of file +} diff --git a/CommentingPlugin.php b/CommentingPlugin.php index f399ac9..c9557ac 100644 --- a/CommentingPlugin.php +++ b/CommentingPlugin.php @@ -27,6 +27,13 @@ class CommentingPlugin extends Omeka_Plugin_AbstractPlugin 'api_extend_collections' ); + /** + * @var array Options and their default values. + */ + protected $_options = array( + 'commenting_legal_text' => '', + ); + /** * Add the translations. */ @@ -78,6 +85,15 @@ public function hookInstall() set_option('commenting_reqapp_comment_roles', serialize(array())); set_option('commenting_view_roles', serialize(array())); + $html = '
'; + $html .= __('I agree with %s terms of use %s and I accept to free my contribution under the licence %s CCÂ BY-SA %s.', + '', '', + '', '' + ); + $html .= '
'; + $this->_options['commenting_legal_text'] = $html; + + $this->_installOptions(); } public function hookUpgrade($args) diff --git a/config_form.php b/config_form.php index 31c74b2..a047c0b 100644 --- a/config_form.php +++ b/config_form.php @@ -1,3 +1,12 @@ + + @@ -30,7 +39,30 @@ - + ++ +
+