39 Fakoli::using(
"comment",
"email",
"captcha",
"rating",
"text_lookup");
85 $this->usernameFormat =
"{User.".$mgr->getUsernameField().
"}";
93 $qs = getCleanQueryString();
95 $panel =
new Panel(
"comment_panel",
"/action/comment/comment_panel?$qs");
105 $parent = $adapter->createParent();
112 trace(
"Building Comment List", 3);
114 if(checkRole(
"admin"))
116 $comments =
$obj->Comments(
"ORDER BY date_posted DESC");
120 $comments =
$obj->Comments(
"Where published=1 ORDER BY date_posted DESC");
123 $list->CSSclass =
"Standard";
124 $list->styles =
"clear: both";
125 $list->paginate =
false;
137 $out =
"<div id='comment{$comment->comment_id}' class='message'>\n";
141 $out =
"<a name='comment{$comment->comment_id}'></a><div id='comment{$comment->comment_id}' class='message_unpublished'>\n";
143 $out .=
" <div class='title'>";
147 $out .=
"<strong>{$comment->title}</strong><br/>";
150 $out .=
"<span class='small'>Posted by $author at {$comment->date_posted}</span>\n </div>\n <div class='message_content'>";
157 $out .=
$comment->format(
"{description:stripHTML}$edit");
158 $out .=
"</div></div></a>";
164 $edit =
"<div class='button_row'>\n";
168 $edit .=
"<a href='#' class='button' onclick=\"new Comment().showCommentDialog({comment_id}, '{$this->xrefClass}', '{$this->component}'); return false\"> Edit </a> ";
174 $edit .=
"<a href='#' class='button' onclick=\"new Comment().commentPublish({comment_id}); return false;\"> Un-Publish </a>\n";
178 $edit .=
"<a href='#' class='button' onclick=\"new Comment().commentPublish({comment_id}); return false;\"> Publish </a>\n";
181 $edit .=
"<div style='clear:both'></div></div>\n";
190 $script .= $this->list->writeScript();
194 $script .= $this->form->writeScript();
209 echo
"<h3>{$this->title}</h3>\n";
216 if(count($this->list->items) > 0)
218 $this->list->drawList();
229 $this->form->drawForm();
236 trace(
"Building Comment Form", 3);
248 $form =
new AutoForm(
$comment,
"POST",
"/action/comment/comment_form?comment_id=&xref_class={$this->xrefClass}&key_name=$key_name&key_value=$key_value&xref_component={$this->component}",
"Comment_form");
249 $form->ajaxSubmit(
"function(result) {new Comment().commentFormResult(result);}",
"function() {document.id('{$form->id}_error').set('text','Failed to communicate with server'); }");
251 $form->required(
"description");
252 $form->alias(
"title",
"Subject",
"author",
"Your Name");
253 $form->alias(
"description",
"Comment");
260 $form->hide(
"author");
265 $form->required(
"author");
272 $captchaMgr->addCaptchaToForm(
$form);
283 $xref->set($this->obj->primary_key, $this->obj->get($this->obj->primary_key));
284 $xref->set(
$form->data->primary_key,
$form->data->get(
$form->data->primary_key));
300 $xref->set(
"comment_id",
$form->data->get(
"comment_id"));
327 $xref->set(
"comment_id",
$obj->get(
"comment_id"));
329 if (method_exists($xref, verifyEnabled))
340 $confirmation_message =
"Thank you for your comment.";
344 $confimation_message =
"Thank you. Your comment has been submitted to the moderator.";
347 $form->data->set(
"confirmation_message", $confirmation_message);
352 $pks =
$obj->getPrimaryKeyList();
355 if ($xref->hasField(
$pk))
return $pk;
358 throw new DataItemException(
"No matching foreign key in xref table");
Provides a central management class for event handlers and common functionality for the captcha compo...
static usingFeature()
Uses the specified framework feature(s).
static using()
Import the datamodels, views and manifest for the specified component(s).
static end($message="")
Use this method to terminate execution of a script instead of using the php keywords exit() or die().
Panel provides a reloadable panel tied to an action handler.
static drawRatingWidget($obj=null)
static getValue($component, $name)
Retrieve the value of the specified Setting.
static getText($code, $obj=null, $blank=false)
Retrieves text for display on a page, given the code.
Provides the interface to the user model for the application.
sendEmailUsingEmailManager($sendingItem, $name, $onSendComplete="")