/** * Returns an HTML to edit an item in the appropriate bundle-based editor. If no specified item is specified (eg. no id value is set) * the a link to create a new item of the specfied type is returned. * * @param HTTPRequest $po_request The current request object * @param string $ps_content The displayed content of the link * @param string $ps_classname CSS classname(s) to apply to the link * @param string $ps_table The name or table_num of the edited items table * @param int $pn_id Optional row_id for edited item. If omitted a link will be returned to create a new item record. Note that unless the verifyLink option is set, the link will be returned with the specified id whether or not it actually exists. * @param array $pa_additional_parameters Optional array of parameters to return on the editor url * @param array $pa_attributes Optional array of attributes to set on the link's <a> tag. You can use this to set the id of the link, as well as any other <a> parameter. * @param array $pa_options Optional array of options. Supported options are: * verifyLink - if true and $pn_id is set, then existence of record with specified id is verified before link is returned. If the id does not exist then null is returned. Default is false - no verification performed. */ function caDetailLink($po_request, $ps_content, $ps_classname, $ps_table, $pn_id, $pa_additional_parameters = null, $pa_attributes = null, $pa_options = null) { if (!($vs_url = caDetailUrl($po_request, $ps_table, $pn_id, false, $pa_additional_parameters, $pa_options))) { return null; } $vs_tag = "<a href='" . $vs_url . "'"; if ($ps_classname) { $vs_tag .= " class='{$ps_classname}'"; } if (is_array($pa_attributes)) { foreach ($pa_attributes as $vs_attribute => $vs_value) { $vs_tag .= " {$vs_attribute}='" . htmlspecialchars($vs_value, ENT_QUOTES, 'UTF-8') . "'"; } } $vs_tag .= '>' . $ps_content . '</a>'; return $vs_tag; }
/** * */ public function SaveCommentTagging() { # --- inline is passed to indicate form appears embedded in detail page, not in overlay $vn_inline_form = $this->request->getParameter("inline", pInteger); if (!($t_item = $this->opo_datamodel->getInstanceByTableName($this->request->getParameter("tablename", pString), true))) { die("Invalid table name " . $this->request->getParameter("tablename", pString) . " for saving comment"); } $ps_table = $this->request->getParameter("tablename", pString); if (!($vn_item_id = $this->request->getParameter("item_id", pInteger))) { if ($vn_inline_form) { $this->notification->addNotification(_t("Invalid ID"), __NOTIFICATION_TYPE_ERROR__); $this->response->setRedirect(caDetailUrl($this->request, $ps_table, $vn_item_id)); } else { $this->view->setVar("message", _t("Invalid ID")); $this->render("Form/reload_html.php"); } return; } if (!$t_item->load($vn_item_id)) { if ($vn_inline_form) { $this->notification->addNotification(_t("ID does not exist"), __NOTIFICATION_TYPE_ERROR__); $this->response->setRedirect(caDetailUrl($this->request, $ps_table, $vn_item_id)); } else { $this->view->setVar("message", _t("ID does not exist")); $this->render("Form/reload_html.php"); } return; } # --- get params from form $ps_comment = $this->request->getParameter('comment', pString); $pn_rank = $this->request->getParameter('rank', pInteger); $ps_tags = $this->request->getParameter('tags', pString); $ps_email = $this->request->getParameter('email', pString); $ps_name = $this->request->getParameter('name', pString); $ps_location = $this->request->getParameter('location', pString); $ps_media1 = $_FILES['media1']['tmp_name']; $ps_media1_original_name = $_FILES['media1']['name']; $va_errors = array(); if (!$this->request->getUserID() && !$ps_name && !$ps_email) { $va_errors["general"] = _t("Please enter your name and email"); } if (!$ps_comment && !$pn_rank && !$ps_tags && !$ps_media1) { $va_errors["general"] = _t("Please enter your contribution"); } if (sizeof($va_errors)) { $this->view->setVar("form_comment", $ps_comment); $this->view->setVar("form_rank", $pn_rank); $this->view->setVar("form_tags", $ps_tags); $this->view->setVar("form_email", $ps_email); $this->view->setVar("form_name", $ps_name); $this->view->setVar("form_location", $ps_location); $this->view->setVar("item_id", $vn_item_id); $this->view->setVar("tablename", $ps_table); if ($vn_inline_form) { $this->notification->addNotification($va_errors["general"], __NOTIFICATION_TYPE_ERROR__); $this->request->setActionExtra($vn_item_id); $this->__call(caGetDetailForType($ps_table), null); #$this->response->setRedirect(caDetailUrl($this->request, $ps_table, $vn_item_id)); } else { $this->view->setVar("errors", $va_errors); $this->render('Details/form_comments_html.php'); } } else { if (!($pn_rank > 0 && $pn_rank <= 5)) { $pn_rank = null; } if ($ps_comment || $pn_rank || $ps_media1) { $t_item->addComment($ps_comment, $pn_rank, $this->request->getUserID(), null, $ps_name, $ps_email, $this->request->config->get("dont_moderate_comments") ? 1 : 0, null, array('media1_original_filename' => $ps_media1_original_name), $ps_media1, null, null, null, $ps_location); } if ($ps_tags) { $va_tags = array(); $va_tags = explode(",", $ps_tags); foreach ($va_tags as $vs_tag) { $t_item->addTag(trim($vs_tag), $this->request->getUserID(), null, $this->request->config->get("dont_moderate_comments") ? 1 : 0, null); } } if ($ps_comment || $ps_tags || $ps_media1) { # --- check if email notification should be sent to admin if (!$this->request->config->get("dont_email_notification_for_new_comments")) { # --- send email confirmation $o_view = new View($this->request, array($this->request->getViewsDirectoryPath())); $o_view->setVar("comment", $ps_comment); $o_view->setVar("tags", $ps_tags); $o_view->setVar("name", $ps_name); $o_view->setVar("email", $ps_email); $o_view->setVar("item", $t_item); # -- generate email subject line from template $vs_subject_line = $o_view->render("mailTemplates/admin_comment_notification_subject.tpl"); # -- generate mail text from template - get both the text and the html versions $vs_mail_message_text = $o_view->render("mailTemplates/admin_comment_notification.tpl"); $vs_mail_message_html = $o_view->render("mailTemplates/admin_comment_notification_html.tpl"); caSendmail($this->request->config->get("ca_admin_email"), $this->request->config->get("ca_admin_email"), $vs_subject_line, $vs_mail_message_text, $vs_mail_message_html); } if ($this->request->config->get("dont_moderate_comments")) { if ($vn_inline_form) { $this->notification->addNotification(_t("Thank you for contributing."), __NOTIFICATION_TYPE_INFO__); $this->response->setRedirect(caDetailUrl($this->request, $ps_table, $vn_item_id)); return; } else { $this->view->setVar("message", _t("Thank you for contributing.")); $this->render("Form/reload_html.php"); } } else { if ($vn_inline_form) { $this->notification->addNotification(_t("Thank you for contributing. Your comments will be posted on this page after review by site staff."), __NOTIFICATION_TYPE_INFO__); $this->response->setRedirect(caDetailUrl($this->request, $ps_table, $vn_item_id)); return; } else { $this->view->setVar("message", _t("Thank you for contributing. Your comments will be posted on this page after review by site staff.")); $this->render("Form/reload_html.php"); } } } else { if ($vn_inline_form) { $this->notification->addNotification(_t("Thank you for your contribution."), __NOTIFICATION_TYPE_INFO__); $this->response->setRedirect(caDetailUrl($this->request, $ps_table, $vn_item_id)); return; } else { $this->view->setVar("message", _t("Thank you for your contribution.")); $this->render("Form/reload_html.php"); } } } }
<div id="detailAnnotations"> <div class="jcarousel-wrapper"> <div id="detailScrollButtonNext"><i class="fa fa-angle-right"></i></div> <div id="detailScrollButtonPrevious"><i class="fa fa-angle-left"></i></div> <!-- Carousel --> <div class="jcarousel"> <ul> <?php foreach ($va_annotations as $va_annotation) { print "<li><div class='detailAnnotation'><small>" . $va_annotation["startTimecode"] . " - " . $va_annotation["endTimecode"] . "</small><br/>"; $va_labels = caExtractValuesByUserLocale($va_annotation["labels"]); foreach ($va_labels as $vs_label) { print "<a href='#' onclick='caAnnoEditorPlayerPlay(" . $va_annotation["startTimecode_raw"] . "); return false;'>" . $vs_label . "</a><br/>"; } print "<div class='annotationControls'><a href='#' onclick='\$(\"#detailAnnotationMoreInfo\").load(\"" . caDetailUrl($this->request, "ca_representation_annotations", $va_annotation["annotation_id"]) . "\")'><span class='glyphicon glyphicon-info-sign'></span></a> <a href='#' onclick='caAnnoEditorPlayerPlay(" . $va_annotation["startTimecode_raw"] . "); return false;'><span class='glyphicon glyphicon-play-circle'></span></a></div>"; print "</div><!-- end detailAnnotation --></li>"; } ?> </ul> </div><!-- end jcarousel --> </div><!-- end jcarousel-wrapper --> </div><!-- end detailAnnotations --> <script type='text/javascript'> jQuery(document).ready(function() { /* Carousel initialization */ $('.jcarousel')