forgot to commit the actual comment editor panel :D
This commit is contained in:
parent
184168d7a2
commit
5ffe855a74
52
admin/panels/entry/admin.entry.commedit.php
Normal file
52
admin/panels/entry/admin.entry.commedit.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
class admin_entry_commedit extends AdminPanelActionValidated {
|
||||
|
||||
var $validators = array(
|
||||
array('name', 'name', 'notEmpty', false, false, 'trim,stripslashes'),
|
||||
array('email', 'email', 'isEmail', true, false, 'trim,stripslashes'),
|
||||
array('www', 'www', 'isURL', true, false, 'trim,stripslashes'),
|
||||
array('content', 'content', 'notEmpty', false, false, 'stripslashes'),
|
||||
);
|
||||
|
||||
var $events = array('save');
|
||||
|
||||
var $args = array('entry', 'comment');
|
||||
|
||||
var $nosuchcomment = false;
|
||||
|
||||
function setup() {
|
||||
$this->nosuchcomment = !comment_exists($_REQUEST['entry'], $_REQUEST['comment']);
|
||||
$this->smarty->assign('entryid', $_REQUEST['entry']);
|
||||
$this->smarty->assign('id', $_REQUEST['comment']);
|
||||
}
|
||||
|
||||
function main() {
|
||||
if ($this->nosuchcomment) return PANEL_REDIRECT_DEFAULT;
|
||||
|
||||
$e = entry_parse($_REQUEST['entry']);
|
||||
if ($e) {
|
||||
$this->smarty->assign('entrysubject', $e['subject']);
|
||||
} else return PANEL_REDIRECT_DEFAULT;
|
||||
|
||||
$comment = comment_parse($_REQUEST['entry'], $_REQUEST['comment']);
|
||||
if ($comment) {
|
||||
$this->smarty->assign('values', $comment);
|
||||
} else return PANEL_REDIRECT_DEFAULT;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function onsave($content) {
|
||||
if ($this->nosuchcomment) return PANEL_REDIRECT_DEFAULT;
|
||||
|
||||
$comment = comment_parse($_REQUEST['entry'],$_REQUEST['comment']);
|
||||
$content['ip-address'] = $comment['ip-address'];
|
||||
$content['date'] = $comment['date'];
|
||||
$success = comment_save($_REQUEST['entry'], $content);
|
||||
$this->smarty->assign('success', $success? 1 : -1);
|
||||
return PANEL_REDIRECT_CURRENT;
|
||||
}
|
||||
|
||||
}
|
34
admin/panels/entry/admin.entry.commedit.tpl
Normal file
34
admin/panels/entry/admin.entry.commedit.tpl
Normal file
@ -0,0 +1,34 @@
|
||||
<h2>{$plang.head} <a href="admin.php?p=entry&action=write&entry={$entryid}">{$entrysubject}</a></h2>
|
||||
<p>{$plang.descr}</p>
|
||||
|
||||
|
||||
{html_form}
|
||||
|
||||
{include file='shared:errorlist.tpl'}
|
||||
|
||||
|
||||
|
||||
|
||||
<p><input type="hidden" name="entry" value="{$entryid}" /><input type="hidden" name="comment" value="{$id}" />
|
||||
<label class="textlabel" for="name">{$plang.author}</label><br />
|
||||
<input type="text" {$error.name|notempty:'class="field-error"'} name="name" id="name" value="{$values.name|default:$cookie.name}" /></p>
|
||||
|
||||
<p><label class="textlabel" for="email">{$plang.email}</label><br />
|
||||
<input type="text" {$error.email|notempty:'class="field-error"'} name="email" id="email" value="{$values.email|default:$cookie.email}" /></p>
|
||||
|
||||
<p><label class="textlabel" for="url">{$plang.www}</label><br />
|
||||
<input type="text" {$error.url|notempty:'class="field-error"'} name="url" id="url" value="{$values.url|default:$cookie.url}" /></p>
|
||||
|
||||
|
||||
|
||||
<p><label for="content">{$plang.content}</label><br />
|
||||
<textarea name="content" {$error.content|notempty:'class="field-error"'}
|
||||
id="content" rows="10" cols="74">{$values.content}</textarea></p>
|
||||
|
||||
<div class="buttonbar">
|
||||
<input type="submit" name="save" id="submit" value="{$plang.submit}" />
|
||||
</div>
|
||||
|
||||
{/html_form}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user