added comment editor!

This commit is contained in:
real_nowhereman 2009-02-27 10:37:40 +00:00
parent b9fedf7841
commit 184168d7a2
7 changed files with 41 additions and 8 deletions

View File

@ -111,7 +111,7 @@
function exec() { function exec() {
foreach($this->args as $mandatory_argument) { foreach($this->args as $mandatory_argument) {
if (!isset($_GET[$mandatory_argument])) { if (!isset($_REQUEST[$mandatory_argument])) {
return PANEL_REDIRECT_DEFAULT; return PANEL_REDIRECT_DEFAULT;
} }
} }
@ -159,7 +159,7 @@
* *
*/ */
function onsubmit() { function onsubmit($data = null) {
$returnvalue = 1; $returnvalue = 1;
$valid_evts = array_intersect(array_keys($_POST), $this->events); $valid_evts = array_intersect(array_keys($_POST), $this->events);
@ -167,7 +167,7 @@
if ($the_event=array_pop($valid_evts)) { if ($the_event=array_pop($valid_evts)) {
$event = "on{$the_event}"; $event = "on{$the_event}";
if (method_exists($this, $event)) if (method_exists($this, $event))
$returnvalue = call_user_func(array(&$this, $event)); $returnvalue = call_user_func(array(&$this, $event), $data);
} }
return $returnvalue; return $returnvalue;
@ -213,6 +213,7 @@
$dummyarr = array(); $dummyarr = array();
$errors = array(); $errors = array();
$content = array();
$lang_loaded = false; $lang_loaded = false;
$l = null; $l = null;
@ -256,13 +257,15 @@
$errors[$field] = $l['error'][$field]; $errors[$field] = $l['error'][$field];
if ($halt) if ($halt)
break; break;
} else {
$content[$field] = $string;
} }
} }
if(!$errors) { if(!$errors) {
$result = parent::onsubmit(); $result = parent::onsubmit($content);
} else { } else {
$this->smarty->assign('error', $errors); $this->smarty->assign('error', $errors);
$result = $this->onerror(); $result = $this->onerror();

View File

@ -102,7 +102,7 @@
if ($retval == PANEL_REDIRECT_CURRENT) { if ($retval == PANEL_REDIRECT_CURRENT) {
foreach ($fp_admin_action->args as $mandatory_argument) { foreach ($fp_admin_action->args as $mandatory_argument) {
$with_arguments .= '&' . $mandatory_argument . $with_arguments .= '&' . $mandatory_argument .
'=' . $_GET[$mandatory_argument]; '=' . $_REQUEST[$mandatory_argument];
} }
} }

View File

@ -40,10 +40,16 @@ function admin_entry_comment_delete() { return confirm({/literal}'{$plang.act_de
<td>{if $url}<a href="{$url}">{$name}</a>{else}{$name}{/if}</td> <td>{if $url}<a href="{$url}">{$name}</a>{else}{$name}{/if}</td>
<td><a href="mailto:{$email}">{$email}</a></td> <td><a href="mailto:{$email}">{$email}</a></td>
<td>{$ip_address}</td> <td>{$ip_address}</td>
<td><a class="link-delete" onclick="return admin_entry_comment_delete();" <td>
<a class="link-general"
href="{"`$panel_url`&entry=`$entryid`"|action_link:commedit|cmd_link:comment:$id}">
{$plang.act_edit}
</a>
<a class="link-delete" onclick="return admin_entry_comment_delete();"
href="{"`$action_url`&entry=`$entryid`"|cmd_link:delete:$id}"> href="{"`$action_url`&entry=`$entryid`"|cmd_link:delete:$id}">
{$plang.act_del} {$plang.act_del}
</a></td> </a>
</td>
</tr> </tr>
{/comment} {/comment}
</tbody></table> </tbody></table>

View File

@ -21,6 +21,7 @@
'list' => true, 'list' => true,
'write' => true, 'write' => true,
'commentlist' => false, 'commentlist' => false,
'commedit' => false,
'delete' => false, 'delete' => false,
'cats' => true, 'cats' => true,
'stats' => false 'stats' => false

View File

@ -108,7 +108,8 @@
$comment_dir = bdb_idtofile($id,BDB_COMMENT); $comment_dir = bdb_idtofile($id,BDB_COMMENT);
$comment['DATE'] = date_time(); if (!isset($comment['DATE']))
$comment['DATE'] = date_time();
$id = bdb_idfromtime(BDB_COMMENT, $comment['DATE']); $id = bdb_idfromtime(BDB_COMMENT, $comment['DATE']);
$f = $comment_dir . $id . EXT; $f = $comment_dir . $id . EXT;
$str = utils_kimplode($comment); $str = utils_kimplode($comment);

View File

@ -94,6 +94,7 @@
'email' => 'Email', 'email' => 'Email',
'ip' => 'IP', 'ip' => 'IP',
'actions' => 'Actions', 'actions' => 'Actions',
'act_edit' => 'Edit',
'act_del' => 'Delete', 'act_del' => 'Delete',
'act_del_confirm' => 'Do you really want to delete this comment?', 'act_del_confirm' => 'Do you really want to delete this comment?',
'nocomments' => 'This entry have not been commented, yet.', 'nocomments' => 'This entry have not been commented, yet.',
@ -108,6 +109,26 @@
the comment', the comment',
); );
$lang['admin']['entry']['commedit'] =
array(
'head' => "Edit comment for entry",
'content' => 'Content',
'date' => 'Date',
'author' => 'Author',
'www' => 'Web Site',
'email' => 'Email',
'ip' => 'IP',
'submit' => 'Save'
);
$lang['admin']['entry']['commedit']['msgs'] =
array(
1 => 'Comment has been edited',
-1 => 'An error occurred while trying to edit the comment',
);
/* delete action */ /* delete action */

View File

@ -237,6 +237,7 @@ input.maxsize, select.maxsize { width: 100% }
} }
.admin-entry-commentlist td ,
.admin-widgets-blockparser td , .admin-widgets-blockparser td ,
.admin-plugin-default td { .admin-plugin-default td {
padding: 1em .6em; padding: 1em .6em;