| 1 |
<?php |
<?php |
| 2 |
// $Id: comment_revisions.module,v 1.42 2008/06/14 11:19:06 Raiden Exp $ |
// $Id: comment_revisions.module,v 1.49 2008/06/29 09:00:20 Raiden Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Complete module for comment_revisions |
* Complete module for comment_revisions |
| 156 |
break; |
break; |
| 157 |
case "validate": |
case "validate": |
| 158 |
/* Comment is edited and revision should be created */ |
/* Comment is edited and revision should be created */ |
| 159 |
if($a1["cid"] != NULL && $a1["create_revision"] == 1 && $a1["op"] != "Preview comment") { |
if($a1["cid"] != NULL && $a1["create_revision"] == 1 && $a1["op"] != t("Preview comment")) { |
| 160 |
/* No revision before, that means, the original has to be saved */ |
/* No revision before, that means, the original has to be saved */ |
| 161 |
if(!_comment_revision_cmt_has_revisions($a1["cid"])) { |
if(!_comment_revision_cmt_has_revisions($a1["cid"])) { |
| 162 |
$result = db_fetch_array(db_query("SELECT * FROM {comments} WHERE cid=%d", $a1['cid'])); |
$result = db_fetch_array(db_query("SELECT * FROM {comments} WHERE cid=%d", $a1['cid'])); |
| 241 |
} |
} |
| 242 |
if((user_access('create revisions') && !$isUserCmt) || (user_access('willful create own') && $isUserCmt)) { |
if((user_access('create revisions') && !$isUserCmt) || (user_access('willful create own') && $isUserCmt)) { |
| 243 |
/* if user can create revisions and its not his own, or it is his own and he is allowed to create his own revision */ |
/* if user can create revisions and its not his own, or it is his own and he is allowed to create his own revision */ |
| 244 |
$form["revisions"] = array( |
/*$form["revisions"] = array( |
| 245 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 246 |
'#title' => t('Revision'), |
'#title' => t('Revision'), |
| 247 |
'#weight' => -1, |
'#weight' => -1, |
| 248 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 249 |
'#collapsed' => FALSE, |
'#collapsed' => TRUE, |
| 250 |
); |
); */ |
| 251 |
$form["revisions"]["create_revision"] = array( |
$form["create_revision"] = array( |
| 252 |
'#type'=>'checkbox', |
'#type'=>'checkbox', |
| 253 |
'#title'=>t('Create Revision'), |
'#title'=>t('Create Revision'), |
| 254 |
'#default_value' => FALSE, |
'#default_value' => TRUE, |
| 255 |
); |
); |
| 256 |
$form["revisions"]["log_message"] = array( |
$form["log_message"] = array( |
| 257 |
'#type' => 'textarea', |
'#type' => 'textfield', |
| 258 |
'#title' => t('Log Message'), |
'#title' => t('Log Message'), |
| 259 |
|
'#maxlength' => 256, |
| 260 |
|
'#default_value' => t('Edit'), |
| 261 |
); |
); |
| 262 |
} else if(user_access('force revision') && $isUserCmt && !user_access('except from force')){ |
} else if(user_access('force revision') && $isUserCmt && !user_access('except from force')){ |
| 263 |
/* if user is forced to create a revision on edit, and it is his own comment and not excepted from beeing forced */ |
/* if user is forced to create a revision on edit, and it is his own comment and not excepted from beeing forced */ |