Commit be7af61f authored by Lisa Seeto's avatar Lisa Seeto

Bug 1827811: Move "Add comment" and "Details" into modal with "Comments"

create modal using configureblock id, update various templates to use the modal for blocks:
Image
Note
File(s) to download
Journal/blogs
add JS to open/close modal, add comments, delete comments, reply to comments, paginate comments.
add JS to handle url that redirects to view/view.php with modal open and populated.
Further changes to each block will be completed in child patches.
Add segment headings to the modal. Fix display of comments to cover width of modal.
Show comment removed msg in modal/page appropriately.
Fix behat test to close modal before continuing.
do not show existing comments if comments not allowed on artefact.
add validation to modal for comments/attachments
disable image as link when editing for image block
trigger focus on modal for accessibility
close modal on escape keydown event
fix merge conflict in view/view.php
fix merge conflict with master
make configureblock modal play nicely when comment block is on the page
update display of error messages to always show at top of modal so user doesn't have to scroll
add accesibility to close modal on escape key down
handle dock show/hide events for paginated pages in modal during validation
create block-comments-details-header template file
create details button and custom scss file with js to show and hide header
update comment links to save add comment and details when commentcount == 0
add active-block class to colour the block-header when active
toggle the details-btn active css
add _block-comments-details-header.scss to patch
change class invisble to class d-none
add block-comments-details-header.tpl to blocktypecontainerviewing.tpl
code review changes
add .no-modal class to links on group home page, dashboard and profile page.
add block header to appear above the title
change assessbtn from anchor tag to button to prevent scrolling.
make all clickable links clickable on page load (ignore assess mode)
fix js issues surrounding assessbtn move and show/hide blocks
change cursor on dashboard, my profile page, group homepage to default when over disabled modal links
update assessbtn to details btn
create tooltip for hover over file download block titles
fix containerElm console log error by not reattaching tinymce unneccessarily.
fix null named attributes issues on e.target when span (icons) instead of anchor is clicked.

Change-Id: I2e5218c040f8a9e252f785165ce9c566ecc2f56e
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent e3a53e16
...@@ -53,7 +53,6 @@ if (!empty($extradata->artefact) && !artefact_in_view($extradata->artefact, $ext ...@@ -53,7 +53,6 @@ if (!empty($extradata->artefact) && !artefact_in_view($extradata->artefact, $ext
} }
if ($ispagination) { if ($ispagination) {
// This is not really working yet. Need to do more work on artefact/artefact.php
$options = ArtefactTypeAnnotationfeedback::get_annotation_feedback_options(); $options = ArtefactTypeAnnotationfeedback::get_annotation_feedback_options();
$options->limit = $limit; $options->limit = $limit;
$options->offset = $offset; $options->offset = $offset;
......
...@@ -33,7 +33,7 @@ class PluginBlocktypeAnnotation extends MaharaCoreBlocktype { ...@@ -33,7 +33,7 @@ class PluginBlocktypeAnnotation extends MaharaCoreBlocktype {
} }
public static function has_title_link() { public static function has_title_link() {
return false; // true; // need to do more work on aretfact/artefact.php before this can be switched on. return false;
} }
public static function allowed_in_view(View $view) { public static function allowed_in_view(View $view) {
......
...@@ -894,9 +894,8 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType { ...@@ -894,9 +894,8 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType {
); );
$data->jsonscript = 'artefact/annotation/annotations.json.php'; $data->jsonscript = 'artefact/annotation/annotations.json.php';
$data->baseurl = get_config('wwwroot') . 'artefact/artefact.php?' . $data->baseurl = get_config('wwwroot') . 'view/view.php?id=' . $data->view .
'artefact=' . $data->annotation . '&artefact=' . $data->annotation .
'&view=' . $data->view .
(isset($data->block) ? '&block=' . $data->block : ''); (isset($data->block) ? '&block=' . $data->block : '');
$smarty = smarty_core(); $smarty = smarty_core();
...@@ -1139,6 +1138,7 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType { ...@@ -1139,6 +1138,7 @@ class ArtefactTypeAnnotationfeedback extends ArtefactType {
$block = new BlockInstance($blockid); $block = new BlockInstance($blockid);
$smarty->assign('blockid', $blockid); $smarty->assign('blockid', $blockid);
$smarty->assign('artefactid', $annotationartefact->get('id'));
$smarty->assign('annotationtitle', $block->get('title')); $smarty->assign('annotationtitle', $block->get('title'));
$smarty->assign('annotationfeedbackcount', $annotationfeedbackcount); $smarty->assign('annotationfeedbackcount', $annotationfeedbackcount);
$smarty->assign('annotationfeedback', $annotationfeedback); $smarty->assign('annotationfeedback', $annotationfeedback);
...@@ -1613,7 +1613,7 @@ function delete_annotation_feedback_submit(Pieform $form, $values) { ...@@ -1613,7 +1613,7 @@ function delete_annotation_feedback_submit(Pieform $form, $values) {
$viewid = $view->get('id'); $viewid = $view->get('id');
if ($artefactid = $annotation->get('artefact')) { if ($artefactid = $annotation->get('artefact')) {
$url = 'artefact/artefact.php?view=' . $viewid . '&artefact=' . $artefactid; $url = 'view/view.php?id=' . $viewid . '&artefact=' . $artefactid;
} }
else { else {
$url = $view->get_url(false); $url = $view->get_url(false);
...@@ -1959,7 +1959,7 @@ class ActivityTypeArtefactAnnotationAnnotationfeedback extends ActivityTypePlugi ...@@ -1959,7 +1959,7 @@ class ActivityTypeArtefactAnnotationAnnotationfeedback extends ActivityTypePlugi
$institutionid = $artefactinstance->get('institution'); $institutionid = $artefactinstance->get('institution');
} }
if (empty($this->url)) { if (empty($this->url)) {
$this->url = 'artefact/artefact.php?artefact=' . $onartefact . '&view=' . $this->viewid; $this->url = 'view/view.php?id=' . $this->viewid . '&artefact=' . $onartefact;
} }
} }
else if ($onview = $annotation->get('view')) { else if ($onview = $annotation->get('view')) {
......
...@@ -54,7 +54,7 @@ if (!empty($ancestors)) { ...@@ -54,7 +54,7 @@ if (!empty($ancestors)) {
$pathitem = artefact_instance_from_id($ancestor); $pathitem = artefact_instance_from_id($ancestor);
if (artefact_in_view($pathitem, $viewid)) { if (artefact_in_view($pathitem, $viewid)) {
$artefactpath[] = array( $artefactpath[] = array(
'url' => get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $pathitem->get('id') . '&view=' . $viewid, 'url' => get_config('wwwroot') . 'view/view.php?id=' . $viewid,
'title' => $pathitem->display_title(), 'title' => $pathitem->display_title(),
); );
$artefactok = true; $artefactok = true;
......
...@@ -41,7 +41,7 @@ class PluginBlocktypeBlog extends MaharaCoreBlocktype { ...@@ -41,7 +41,7 @@ class PluginBlocktypeBlog extends MaharaCoreBlocktype {
public static function get_link(BlockInstance $instance) { public static function get_link(BlockInstance $instance) {
$configdata = $instance->get('configdata'); $configdata = $instance->get('configdata');
if (!empty($configdata['artefactid'])) { if (!empty($configdata['artefactid'])) {
$data = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $configdata['artefactid'] . '&view=' . $instance->get('view'); $data = get_config('wwwroot') . 'view/view.php?id=' . $instance->get('view') . '&modal=1&block=' . $instance->get('id') . '&artefact=' . $configdata['artefactid'];
return sanitize_url($data); return sanitize_url($data);
} }
} }
......
...@@ -30,6 +30,7 @@ if ($blockid = param_integer('block', null)) { ...@@ -30,6 +30,7 @@ if ($blockid = param_integer('block', null)) {
$configdata['countcomments'] = true; $configdata['countcomments'] = true;
$configdata['versioning'] = false; $configdata['versioning'] = false;
$configdata['viewid'] = $bi->get('view'); $configdata['viewid'] = $bi->get('view');
$configdata['blockid'] = $blockid;
$posts = ArtefactTypeBlogpost::get_posts($configdata['artefactid'], $limit, $offset, $configdata); $posts = ArtefactTypeBlogpost::get_posts($configdata['artefactid'], $limit, $offset, $configdata);
$template = 'artefact:blog:viewposts.tpl'; $template = 'artefact:blog:viewposts.tpl';
$baseurl = $bi->get_view()->get_url(); $baseurl = $bi->get_view()->get_url();
......
...@@ -44,6 +44,7 @@ class PluginBlocktypeComment extends MaharaCoreBlocktype { ...@@ -44,6 +44,7 @@ class PluginBlocktypeComment extends MaharaCoreBlocktype {
if ($editing) { if ($editing) {
$smarty = smarty_core(); $smarty = smarty_core();
$smarty->assign('editing', get_string('ineditordescription1', 'blocktype.comment/comment')); $smarty->assign('editing', get_string('ineditordescription1', 'blocktype.comment/comment'));
$smarty->assign('blockid', $instance->get('id'));
$html = $smarty->fetch('blocktype:comment:comment.tpl'); $html = $smarty->fetch('blocktype:comment:comment.tpl');
return $html; return $html;
} }
......
...@@ -30,16 +30,20 @@ $limit = param_integer('limit', 10); ...@@ -30,16 +30,20 @@ $limit = param_integer('limit', 10);
$offset = param_integer('offset'); $offset = param_integer('offset');
$artefact = null; $artefact = null;
$blockid = null;
if (!empty($extradata->artefact)) { if (!empty($extradata->artefact)) {
$artefact = artefact_instance_from_id($extradata->artefact); $artefact = artefact_instance_from_id($extradata->artefact);
} }
if (!empty($extradata->blockid)) {
$blockid = $extradata->blockid;
}
$view = new View($extradata->view); $view = new View($extradata->view);
$commentoptions = ArtefactTypeComment::get_comment_options(); $commentoptions = ArtefactTypeComment::get_comment_options();
$commentoptions->limit = $limit; $commentoptions->limit = $limit;
$commentoptions->offset = $offset; $commentoptions->offset = $offset;
$commentoptions->view = $view; $commentoptions->view = $view;
$commentoptions->artefact = $artefact; $commentoptions->artefact = $artefact;
$commentoptions->blockid = $blockid;
$data = ArtefactTypeComment::get_comments($commentoptions); $data = ArtefactTypeComment::get_comments($commentoptions);
json_reply(false, array('data' => $data)); json_reply(false, array('data' => $data));
...@@ -16,7 +16,10 @@ $string['Comment'] = 'Comment'; ...@@ -16,7 +16,10 @@ $string['Comment'] = 'Comment';
$string['Comments'] = 'Comments'; $string['Comments'] = 'Comments';
$string['comment'] = 'comment'; $string['comment'] = 'comment';
$string['comments'] = 'comments'; $string['comments'] = 'comments';
$string['Details'] = 'Details';
$string['anddetails'] = 'and details';
$string['addcomment'] = 'Add comment'; $string['addcomment'] = 'Add comment';
$string['commentsanddetails'] = 'Comments (%d) and details';
$string['Allow'] = 'Allow'; $string['Allow'] = 'Allow';
$string['allowcomments'] = 'Allow comments'; $string['allowcomments'] = 'Allow comments';
$string['approvalrequired'] = 'Comments are moderated. If you choose to make this comment public, it will not be visible to others until it is approved by the owner.'; $string['approvalrequired'] = 'Comments are moderated. If you choose to make this comment public, it will not be visible to others until it is approved by the owner.';
......
This diff is collapsed.
...@@ -27,6 +27,8 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype { ...@@ -27,6 +27,8 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype {
public static function render_instance(BlockInstance $instance, $editing=false, $versioning=false) { public static function render_instance(BlockInstance $instance, $editing=false, $versioning=false) {
require_once(get_config('docroot') . 'artefact/lib.php'); require_once(get_config('docroot') . 'artefact/lib.php');
require_once(get_config('docroot') . 'artefact/comment/lib.php');
$configdata = $instance->get('configdata'); $configdata = $instance->get('configdata');
$viewid = $instance->get('view'); $viewid = $instance->get('view');
...@@ -41,6 +43,8 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype { ...@@ -41,6 +43,8 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype {
catch (ArtefactNotFoundException $e) { catch (ArtefactNotFoundException $e) {
continue; continue;
} }
$view = new View($viewid);
list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing, $versioning);
$file = array( $file = array(
'id' => $artefactid, 'id' => $artefactid,
...@@ -55,6 +59,7 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype { ...@@ -55,6 +59,7 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype {
array('id' => $artefactid, 'viewid' => $viewid) array('id' => $artefactid, 'viewid' => $viewid)
), ),
'downloadurl' => $wwwroot, 'downloadurl' => $wwwroot,
'commentcount' => $commentcount,
); );
if ($artefact instanceof ArtefactTypeProfileIcon) { if ($artefact instanceof ArtefactTypeProfileIcon) {
...@@ -70,7 +75,9 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype { ...@@ -70,7 +75,9 @@ class PluginBlocktypeFiledownload extends MaharaCoreBlocktype {
$smarty = smarty_core(); $smarty = smarty_core();
$smarty->assign('viewid', $instance->get('view')); $smarty->assign('viewid', $instance->get('view'));
$smarty->assign('blockid', $instance->get('id'));
$smarty->assign('files', $files); $smarty->assign('files', $files);
$smarty->assign('editing', $editing);
return $smarty->fetch('blocktype:filedownload:filedownload.tpl'); return $smarty->fetch('blocktype:filedownload:filedownload.tpl');
} }
......
...@@ -43,6 +43,7 @@ class PluginBlocktypeFolder extends MaharaCoreBlocktype { ...@@ -43,6 +43,7 @@ class PluginBlocktypeFolder extends MaharaCoreBlocktype {
$configdata = $instance->get('configdata'); $configdata = $instance->get('configdata');
$configdata['viewid'] = $instance->get('view'); $configdata['viewid'] = $instance->get('view');
$configdata['simpledisplay'] = true; $configdata['simpledisplay'] = true;
$configdata['blockid'] = $instance->get('id');
// This can be either an image or profileicon. They both implement // This can be either an image or profileicon. They both implement
// render_self // render_self
......
...@@ -361,7 +361,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype { ...@@ -361,7 +361,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
$link = $src . '&maxwidth=' . get_config_plugin('blocktype', 'gallery', 'previewwidth'); $link = $src . '&maxwidth=' . get_config_plugin('blocktype', 'gallery', 'previewwidth');
} }
else { else {
$link = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $artefactid . '&view=' . $instance->get('view'); $link = get_config('wwwroot') . 'view/view.php?id=' . $instance->get('view') . '&modal=1&block=' . $instance->get('id') .' &artefact=' . $artefactid;
} }
// If the Thumbnails are Square or not... // If the Thumbnails are Square or not...
......
...@@ -63,12 +63,14 @@ class PluginBlocktypeImage extends MaharaCoreBlocktype { ...@@ -63,12 +63,14 @@ class PluginBlocktypeImage extends MaharaCoreBlocktype {
$view = new View($viewid); $view = new View($viewid);
list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($image, $view, $instance->get('id'), true, $editing, $versioning); list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($image, $view, $instance->get('id'), true, $editing, $versioning);
$smarty = smarty_core(); $smarty = smarty_core();
$smarty->assign('editing', $editing);
$smarty->assign('commentcount', $commentcount); $smarty->assign('commentcount', $commentcount);
$smarty->assign('comments', $comments); $smarty->assign('comments', $comments);
$smarty->assign('url', $wwwroot . 'artefact/artefact.php?artefact=' . $id . '&view=' . $viewid);
$smarty->assign('src', $src); $smarty->assign('src', $src);
$smarty->assign('description', $description); $smarty->assign('description', $description);
$smarty->assign('showdescription', !empty($configdata['showdescription']) && !empty($description)); $smarty->assign('showdescription', !empty($configdata['showdescription']) && !empty($description));
$smarty->assign('blockid', $instance->get('id'));
$smarty->assign('artefactid', $id);
return $smarty->fetch('blocktype:image:image.tpl'); return $smarty->fetch('blocktype:image:image.tpl');
} }
......
...@@ -13,6 +13,7 @@ defined('INTERNAL') || die(); ...@@ -13,6 +13,7 @@ defined('INTERNAL') || die();
$string['pluginname'] = 'Files'; $string['pluginname'] = 'Files';
$string['commentsanddetails'] = 'Comments (%d) and details';
$string['sitefilesloaded'] = 'Site files loaded'; $string['sitefilesloaded'] = 'Site files loaded';
$string['addafile'] = 'Add a file'; $string['addafile'] = 'Add a file';
$string['archive'] = 'Archive'; $string['archive'] = 'Archive';
......
...@@ -2191,6 +2191,7 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase { ...@@ -2191,6 +2191,7 @@ class ArtefactTypeFolder extends ArtefactTypeFileBase {
} }
$smarty->assign('children', $childrecords); $smarty->assign('children', $childrecords);
} }
$smarty->assign('blockid', $options['blockid']);
return array('html' => $smarty->fetch('artefact:file:folder_render_self.tpl'), return array('html' => $smarty->fetch('artefact:file:folder_render_self.tpl'),
'javascript' => null); 'javascript' => null);
} }
...@@ -2476,12 +2477,15 @@ class ArtefactTypeImage extends ArtefactTypeFile { ...@@ -2476,12 +2477,15 @@ class ArtefactTypeImage extends ArtefactTypeFile {
public function render_self($options) { public function render_self($options) {
$downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $this->id; $downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $this->id;
$url = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $this->id;
if (isset($options['viewid'])) { if (isset($options['viewid'])) {
$downloadpath .= '&view=' . $options['viewid']; $downloadpath .= '&view=' . $options['viewid'];
$url .= '&view=' . $options['viewid'];
} }
$metadataurl = $url . '&details=1'; if (isset($options['viewid'])) {
$metadataurl = get_config('wwwroot') . 'view/view.php?id=' . $options['viewid'] . '&modal=1&artefact=' . $this->id;
}
else {
$metadataurl = null;
}
if (empty($options['metadata'])) { if (empty($options['metadata'])) {
$smarty = smarty_core(); $smarty = smarty_core();
$smarty->assign('id', $this->id); $smarty->assign('id', $this->id);
......
...@@ -53,7 +53,6 @@ class PluginBlocktypeTextbox extends MaharaCoreBlocktype { ...@@ -53,7 +53,6 @@ class PluginBlocktypeTextbox extends MaharaCoreBlocktype {
$f = artefact_instance_from_id($attachment->id); $f = artefact_instance_from_id($attachment->id);
$attachment->size = $f->describe_size(); $attachment->size = $f->describe_size();
$attachment->iconpath = $f->get_icon(array('id' => $attachment->id, 'viewid' => isset($options['viewid']) ? $options['viewid'] : 0)); $attachment->iconpath = $f->get_icon(array('id' => $attachment->id, 'viewid' => isset($options['viewid']) ? $options['viewid'] : 0));
$attachment->viewpath = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $attachment->id . '&view=' . (isset($viewid) ? $viewid : 0);
$attachment->downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $attachment->id; $attachment->downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $attachment->id;
if (isset($viewid)) { if (isset($viewid)) {
$attachment->downloadpath .= '&view=' . $viewid; $attachment->downloadpath .= '&view=' . $viewid;
......
...@@ -1000,7 +1000,6 @@ class ArtefactTypeHtml extends ArtefactType { ...@@ -1000,7 +1000,6 @@ class ArtefactTypeHtml extends ArtefactType {
$f = artefact_instance_from_id($attachment->id); $f = artefact_instance_from_id($attachment->id);
$attachment->size = $f->describe_size(); $attachment->size = $f->describe_size();
$attachment->iconpath = $f->get_icon(array('id' => $attachment->id, 'viewid' => isset($options['viewid']) ? $options['viewid'] : 0)); $attachment->iconpath = $f->get_icon(array('id' => $attachment->id, 'viewid' => isset($options['viewid']) ? $options['viewid'] : 0));
$attachment->viewpath = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $attachment->id . '&view=' . (isset($options['viewid']) ? $options['viewid'] : 0);
$attachment->downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $attachment->id; $attachment->downloadpath = get_config('wwwroot') . 'artefact/file/download.php?file=' . $attachment->id;
if (isset($options['viewid'])) { if (isset($options['viewid'])) {
$attachment->downloadpath .= '&view=' . $options['viewid']; $attachment->downloadpath .= '&view=' . $options['viewid'];
...@@ -1009,6 +1008,7 @@ class ArtefactTypeHtml extends ArtefactType { ...@@ -1009,6 +1008,7 @@ class ArtefactTypeHtml extends ArtefactType {
$smarty->assign('attachments', $attachments); $smarty->assign('attachments', $attachments);
} }
$smarty->assign('view', (isset($options['viewid']) ? $options['viewid'] : null)); $smarty->assign('view', (isset($options['viewid']) ? $options['viewid'] : null));
$smarty->assign('modal', (isset($options['modal']) ? $options['modal'] : false));
return array( return array(
'html' => $smarty->fetch('artefact.tpl'), 'html' => $smarty->fetch('artefact.tpl'),
'javascript'=>'' 'javascript'=>''
......
...@@ -1365,8 +1365,8 @@ class BlockInstance { ...@@ -1365,8 +1365,8 @@ class BlockInstance {
$configdata = $this->get('configdata'); $configdata = $this->get('configdata');
if (!empty($configdata['artefactid']) && $displayforrole) { if (!empty($configdata['artefactid']) && $displayforrole) {
if (call_static_method($classname, 'has_title_link')) { if (call_static_method($classname, 'has_title_link')) {
$smarty->assign('viewartefacturl', get_config('wwwroot') . 'artefact/artefact.php?artefact=' $smarty->assign('blockid', $this->get('id'));
. $configdata['artefactid'] . '&view=' . $this->get('view') . '&block=' . $this->get('id')); $smarty->assign('artefactid', $configdata['artefactid']);
} }
} }
...@@ -1389,6 +1389,36 @@ class BlockInstance { ...@@ -1389,6 +1389,36 @@ class BlockInstance {
$cardicontype = !empty($cssicontype) ? preg_replace('/^icon-/', 'card-', $cssicontype) : ''; $cardicontype = !empty($cssicontype) ? preg_replace('/^icon-/', 'card-', $cssicontype) : '';
$smarty->assign('cardicontype', $cardicontype); $smarty->assign('cardicontype', $cardicontype);
$smarty->assign('versioning', $versioning); $smarty->assign('versioning', $versioning);
/* Apply the comments and details header via template to these types of blocks only
* These blocks have one artefact per block, for blocks with multiple artefacts
* the header will be added elsewhere via their specific templates
*/
$includetheseblocks = array('image', 'textbox');
$blockheader = (in_array($this->get('blocktype'), $includetheseblocks)) ? true : false;
$smarty->assign('blockheader', $blockheader);
//Set up template for the blocks that have the comments and details header
if ($blockheader) {
if (!empty($configdata['artefactid'])) {
$smarty->assign('artefactid', $configdata['artefactid']);
$artefact = $this->get_artefact_instance($configdata['artefactid']);
$smarty->assign('allowcomments', $artefact->get('allowcomments'));
if (!$artefact->get('allowcomments')) {
$smarty->assign('allowdetails', (int)get_config('licensemetadata'));
}
else {
$commentoptions = ArtefactTypeComment::get_comment_options();
$commentoptions->limit = 0;
$commentoptions->view = new View($this->get('view'));
$commentoptions->artefact = $artefact;
$commentoptions->onview = true;
$commentoptions->blockid = $this->get('id');
$comments = ArtefactTypeComment::get_comments($commentoptions);
$commentcount = isset($comments->count) ? $comments->count : 0;
$smarty->assign('commentcount', $commentcount);
}
}
}
return $smarty->fetch('view/blocktypecontainerviewing.tpl'); return $smarty->fetch('view/blocktypecontainerviewing.tpl');
} }
......
...@@ -93,7 +93,16 @@ if ($group->public) { ...@@ -93,7 +93,16 @@ if ($group->public) {
$javascript = array('paginator'); $javascript = array('paginator');
$blocktype_js = $view->get_all_blocktype_javascript(); $blocktype_js = $view->get_all_blocktype_javascript();
$javascript = array_merge($javascript, $blocktype_js['jsfiles']); $javascript = array_merge($javascript, $blocktype_js['jsfiles']);
$inlinejs = "jQuery( function() {\n" . join("\n", $blocktype_js['initjs']) . "\n});"; $inlinejs = <<<JS
jQuery(function($) {
JS;
$inlinejs .= join("\n", $blocktype_js['initjs']) . "\n";
$inlinejs .= <<<JS
// Disable the modal_links for images etc... when page loads
$('a[class*=modal_link], a[class*=inner-link]').addClass('no-modal');
$('a[class*=modal_link], a[class*=inner-link]').css('cursor', 'default');
});
JS;
$headers = array_merge($headers, $view->get_all_blocktype_css()); $headers = array_merge($headers, $view->get_all_blocktype_css());
......
...@@ -78,6 +78,10 @@ jQuery(function($) { ...@@ -78,6 +78,10 @@ jQuery(function($) {
if ($('#hideinfo').length) { if ($('#hideinfo').length) {
$('#hideinfo').on('click', nevershow); $('#hideinfo').on('click', nevershow);
} }
// Disable the modal_links for images etc... when page loads
$('a[class*=modal_link], a[class*=inner-link]').addClass('no-modal');
$('a[class*=modal_link], a[class*=inner-link]').css('cursor', 'default');
}); });
JAVASCRIPT; JAVASCRIPT;
......
This diff is collapsed.
...@@ -90,7 +90,7 @@ function objection_form_submit(Pieform $form, $values) { ...@@ -90,7 +90,7 @@ function objection_form_submit(Pieform $form, $values) {
db_commit(); db_commit();
if ($artefact) { if ($artefact) {
$goto = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $artefact->get('id') . '&view='.$view->get('id'); $goto = get_config('wwwroot') . 'view/view.php?id=' . $view->get('id') . '&modal=1&artefact=' . $artefact->get('id');
} }
else { else {
$goto = $view->get_url(); $goto = $view->get_url();
...@@ -209,7 +209,7 @@ function notrude_form_submit(Pieform $form, $values) { ...@@ -209,7 +209,7 @@ function notrude_form_submit(Pieform $form, $values) {
$reportername = display_default_name($USER); $reportername = display_default_name($USER);
if ($artefact) { if ($artefact) {
$goto = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $artefact->get('id') . '&view=' . $view->get('id'); $goto = get_config('wwwroot') . 'view/view.php?id=' . $view->get('id') . 'artefact=' . $artefact->get('id');
} }
else { else {
$goto = $view->get_url(); $goto = $view->get_url();
...@@ -331,7 +331,7 @@ function stillrude_form_submit(Pieform $form, $values) { ...@@ -331,7 +331,7 @@ function stillrude_form_submit(Pieform $form, $values) {
// Send notification to the owner. // Send notification to the owner.
if ($artefact) { if ($artefact) {
$goto = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $artefact->get('id') . '&view=' . $view->get('id'); $goto = get_config('wwwroot') . 'view/view.php?id=' . $view->get('id') . 'artefact=' . $artefact->get('id');
} }
else { else {
$goto = $view->get_url(); $goto = $view->get_url();
...@@ -479,7 +479,7 @@ function review_form_submit(Pieform $form, $values) { ...@@ -479,7 +479,7 @@ function review_form_submit(Pieform $form, $values) {
db_commit(); db_commit();
if ($artefact) { if ($artefact) {
$goto = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $artefact . '&view='.$view->get('id'); $goto = get_config('wwwroot') . 'view/view.php?id=' . $view->get('id') . 'artefact=' . $artefact;
} }
else { else {
$goto = $view->get_url(); $goto = $view->get_url();
......
...@@ -1425,6 +1425,14 @@ function jsstrings() { ...@@ -1425,6 +1425,14 @@ function jsstrings() {
'blocksinstructionajaxlive1', 'blocksinstructionajaxlive1',
), ),
), ),
'viewmenu' => array(
'artefact.comment' => array(
'addcomment',
'Details',
'commentsanddetails',
'commentremoved',
)
)
); );
} }
......
...@@ -196,8 +196,8 @@ abstract class PluginSearch extends Plugin implements IPluginSearch { ...@@ -196,8 +196,8 @@ abstract class PluginSearch extends Plugin implements IPluginSearch {
$artefact = artefact_instance_from_id($result['id']); $artefact = artefact_instance_from_id($result['id']);
if ($artefact->in_view_list() && $views = $artefact->get_views_instances()) { if ($artefact->in_view_list() && $views = $artefact->get_views_instances()) {
foreach ($views as $view) { foreach ($views as $view) {
$result['views'][$view->get('title')] = get_config('wwwroot') . 'artefact/artefact.php?artefact=' $result['views'][$view->get('title')] = get_config('wwwroot') . 'view/view.php?id=' . $view->get('id') . '&modal=1&artefact='
. $result['id'] . '&view=' . $view->get('id'); . $result['id'];
} }
} }
if ($links = $artefact->get_links($result['id'])) { if ($links = $artefact->get_links($result['id'])) {
......
...@@ -28,6 +28,7 @@ jQuery(function($) { ...@@ -28,6 +28,7 @@ jQuery(function($) {
$('body, .navbar-fixed-top').width('auto'); $('body, .navbar-fixed-top').width('auto');
$('body').removeClass('modal-open modal-open-docked'); $('body').removeClass('modal-open modal-open-docked');
$('.active-block').removeClass('active-block');
}; };
/* /*
...@@ -74,7 +75,9 @@ jQuery(function($) { ...@@ -74,7 +75,9 @@ jQuery(function($) {
var targetID = $(this).attr('data-target'), var targetID = $(this).attr('data-target'),
target = $(targetID); target = $(targetID);
dock.show(target, false, true); if (!$(this).hasClass('no-modal')) {
dock.show(target, false, true);
}
}); });
scope.find('[data-dismiss="modal-docked"]').on('click', function(e){ scope.find('[data-dismiss="modal-docked"]').on('click', function(e){
...@@ -83,7 +86,9 @@ jQuery(function($) { ...@@ -83,7 +86,9 @@ jQuery(function($) {
}); });
scope.find('.submitcancel').on('click', function(){ scope.find('.submitcancel').on('click', function(){
dock.hide(); if (!$('#configureblock').hasClass('active')) {
dock.hide();
}
}); });
}; };
......
{if !$editing} {if !$editing}
<div id="annotationfeedbackview_{$blockid}" class="annotation-feedback"> <div id="annotationfeedbackview_{$blockid}" class="annotation-feedback">
{if $annotationfeedbackcount > 0} {if $annotationfeedbackcount > 0}
<a class="commentlink link-blocktype" id="block_{$blockid}" data-toggle="modal-docked" data-target="#annotation_feedbacktable_{$blockid}" href="#"> <a class="commentlink link-blocktype" id="block_{$blockid}" data-toggle="modal-docked" data-target="#annotation_feedbacktable_{$blockid}" href="#" data-artefactid="{$artefactid}" data-blockid="{$blockid}">
<span class="icon icon-comments" role="presentation" aria-hidden="true"></span> <span class="icon icon-comments" role="presentation" aria-hidden="true"></span>
{str tag=Annotationfeedback section=artefact.annotation} ({$annotationfeedbackcount}) {str tag=Annotationfeedback section=artefact.annotation} ({$annotationfeedbackcount})
</a> </a>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="recentblogpost list-group"> <div class="recentblogpost list-group">
{foreach from=$mostrecent item=post}