Commit 0db9ce89 authored by lindonb's avatar lindonb

[FIX] forum: update for confirm modal changes

parent d56e37c0
This diff is collapsed.
......@@ -76,7 +76,7 @@
</div>
{if $thread_style != 'commentStyle_headers' and isset($comment.attachments) and count($comment.attachments) > 0}
<div class="attachments">
<div class="attachments{$comment.threadId}">
{section name=ix loop=$comment.attachments}
<a class="tips" href="tiki-download_forum_attachment.php?attId={$comment.attachments[ix].attId}" title=":{tr}Download attachment{/tr}">
{icon name='attach' alt="{tr}Attachment{/tr}"}
......@@ -84,11 +84,11 @@
{if $tiki_p_admin_forum eq 'y'}
<span
{if $first eq 'y'}
data-service="{service controller=forum action=delete_attachment params="topics_offset={$smarty.request.topics_offset}{$topics_sort_mode_param}{$topics_find_param}{$topics_threshold_param}&comments_offset={$smarty.request.topics_offset}{$thread_sort_mode_param}&comments_threshold={$smarty.request.topics_threshold}{$comments_find_param}&forumId={$forum_info.forumId}{$comments_per_page_param}&comments_parentId={$comments_parentId}&remove_attachment={$comment.attachments[ix].attId}&filename={$comment.attachments[ix].filename}"}"
data-service="{service controller=forum action=delete_attachment params="topics_offset={$smarty.request.topics_offset}{$topics_sort_mode_param}{$topics_find_param}{$topics_threshold_param}&comments_offset={$smarty.request.topics_offset}{$thread_sort_mode_param}&comments_threshold={$smarty.request.topics_threshold}{$comments_find_param}&forumId={$forum_info.forumId}{$comments_per_page_param}&comments_parentId={$comments_parentId}&remove_attachment={$comment.attachments[ix].attId}&filename={$comment.attachments[ix].filename}&"}"
{else}
data-service="{service controller=forum action=delete_attachment params="topics_offset={$smarty.request.topics_offset}&topics_sort_mode={$smarty.request.topics_sort_mode}&topics_find={$smarty.request.topics_find}&topics_threshold={$smarty.request.topics_threshold}&comments_offset={$smarty.request.topics_offset}&thread_sort_mode={$thread_sort_mode}&comments_threshold={$smarty.request.topics_threshold}&comments_find={$smarty.request.topics_find}&forumId={$forum_info.forumId}&comments_per_page={$comments_per_page}&comments_parentId={$comments_parentId}&remove_attachment={$comment.attachments[ix].attId}&filename={$comment.attachments[ix].filename}"}"
{/if}
onclick="modalActionModal(this, {ldelim}'data':'service'{rdelim});"
onclick="confirmModal(this, {ldelim}'data':'service'{rdelim});"
class="btn-link tips"
title=":{tr}Remove attachment{/tr}">
{icon name='remove' alt="{tr}Remove attachment{/tr}"}
......
......@@ -11,7 +11,7 @@
<div class="actions pull-right btn-group">
{if $comment.threadId eq $comments_parentId}
{* Only on the main forum topic *}
{monitor_link type="forum post" object=$comments_parentId class='link'}
{monitor_link type="forum post" object=$comments_parentId class='tips' title="{$comment.title|escape}:{tr}Notification{/tr}"}
{/if}
{if $tiki_p_admin_forum eq 'y'
|| ( $comment.userName == $user && $tiki_p_forum_edit_own_posts eq 'y' )}
......@@ -31,9 +31,9 @@
{else}
data-service="{service controller=forum action=delete_topic params="forumId={$forum_info.forumId}&comments_threshold={$comments_threshold}&forumtopic[]={$comment.threadId}&comments_offset={$comments_offset}&thread_sort_mode={$thread_sort_mode}&comments_per_page={$comments_per_page}&comments_parentId={$comments_parentId}&thread_style={$thread_style}"}"
{/if}
onclick="modalActionModal(this, {ldelim}'data':'service'{rdelim});"
onclick="confirmModal(this, {ldelim}'data':'service'{rdelim});"
class="btn-link tips"
title="{$comments_coms[ix].title|escape}:{tr}Delete post{/tr}">
title="{$comment.title|escape|replace:':':' '}:{tr}Delete post{/tr}">
{icon name='remove'}
</span>
{/if}
......
......@@ -43,17 +43,31 @@
{if $topics|@count > 1}
<button
type="button"
onclick="modalActionModal(this, {ldelim}'controller':'forum','action':'merge_topic','closest':'form'{rdelim});"
id="merge-topic"
class="btn btn-default btn-sm tips"
title=":{tr}Merge selected topics{/tr}">
title=":{tr}Merge selected topics{/tr}"
onclick="confirmModal(this,
{ldelim}
'controller':'forum',
'action':'merge_topic',
'closest':'form'
{rdelim});"
>
{icon name="merge"}
</button>
{/if}
<button
type="button"
onclick="modalActionModal(this, {ldelim}'controller':'forum','action':'delete_topic','closest':'form'{rdelim});"
class="btn btn-default btn-sm tips"
title=":{tr}Delete selected posts{/tr}">
type="button"
id="delete-topic"
class="btn btn-default btn-sm tips"
title=":{tr}Delete selected posts{/tr}"
onclick="confirmModal(this,
{ldelim}
'controller':'forum',
'action':'delete_topic',
'closest':'form'
{rdelim});"
>
{icon name="remove"}
</button>
</div>
......
......@@ -38,13 +38,20 @@
</div>
</div>
<div class="submit">
<button type='submit' id="success" name="success" class="btn btn-primary success">
<button
id="merge-topics"
name="merge-topics"
type='button'
class="btn btn-primary"
onclick="confirmAction(this, {ldelim}'closest':'form'{rdelim});">
{tr}Merge{/tr}
</button>
{$encodedItems = json_encode($items)}
<input type='hidden' name='items' value="{$encodedItems|escape}">
{$encodedList = json_encode($toList)}
<input type='hidden' name='toList' value="{$encodedList|escape}">
{$encodedExtra = json_encode($extra)}
<input type='hidden' name='extra' value="{$encodedExtra|escape}">
<input type='hidden' name='ticket' value="{$ticket}">
<input type='hidden' name='daconfirm' value="y">
</div>
......
......@@ -38,7 +38,12 @@
</div>
</div>
<div class="submit">
<button type='submit' id="success" name="success" class="btn btn-primary success">
<button
id="move-topics"
name="move-topics"
type='button'
class="btn btn-primary"
onclick="confirmAction(this, {ldelim}'closest':'form'{rdelim});">
{tr}Move{/tr}
</button>
{$encodedItems = json_encode($items)}
......
......@@ -20,6 +20,12 @@
{/if}
</div>
{/if}
<div id="ajax-feedback" style="display:none"></div>
{if isset($ajaxfeedback) && $ajaxfeedback eq 'y'}
<div id="posted-ajax-feedback">
{include file="utilities/alert.tpl"}
</div>
{/if}
{tabset}
{tab name="{tr}Forums{/tr}"}
......@@ -104,7 +110,7 @@
{permission_link mode=glyph addclass="tips" type=forum permType=forums id=$channels[user].forumId title=$channels[user].name label="{$channels[user].name|escape}:{tr}Permissions{/tr}"}
{* go ahead and set action to delete_forum since that is the only action available in the multi selct dropdown *}
<span
onclick="modalActionModal(this, {ldelim}'data':'service'{rdelim});"
onclick="confirmModal(this, {ldelim}'data':'service'{rdelim});"
data-service="{service controller=forum action=delete_forum params="checked[]={$channels[user].forumId}"}"
class="btn-link tips"
title="{$channels[user].name|escape}:{tr}Delete{/tr}">
......@@ -127,18 +133,24 @@
{if $channels}
<div class="text-left form-group">
<br>
<label for="batchaction" class="col-lg-5">{tr}Perform action with checked:{/tr}</label>
<div class="col-lg-4 input-group">
<label for="batchaction" class="col-lg"></label>
<div class="col-lg-9 input-group">
<select name="batchaction" class="form-control" onchange="show('groups');">
<option value="">{tr}...{/tr}</option>
<option value="no_action">
{tr}Select action to perform with checked forums...{/tr}
</option>
{if $tiki_p_admin_forum eq 'y'}
<option value="delete_forum">{tr}Delete{/tr}</option>
{/if}
</select>
{*
Currently only set up to handle delete action. Will need to change to be like
Will need to be changed to be like tiki-adminusers.php if more actions are added
*}
<span class="input-group-btn">
<button
type="button"
onclick="modalActionModal(this, {ldelim}'controller':'forum','action':'delete_forum','closest':'form'{rdelim});"
onclick="confirmModal(this, {ldelim}'controller':'forum','action':'delete_forum','closest':'form'{rdelim});"
class="btn btn-primary">
{tr}OK{/tr}
</button>
......
......@@ -90,6 +90,12 @@
{/foreach}
{/remarksbox}
{/if}
<div id="ajax-feedback" style="display:none"></div>
{if isset($ajaxfeedback) && $ajaxfeedback eq 'y'}
<div id="posted-ajax-feedback">
{include file="utilities/alert.tpl"}
</div>
{/if}
{if $tiki_p_forum_post_topic eq 'y'}
{if $comment_preview eq 'y'}
......@@ -371,7 +377,7 @@
<input type="hidden" name="thread_sort_mode" value="{$thread_sort_mode|escape}">
<input type="hidden" name="forumId" value="{$forumId|escape}">
<input type="hidden" name="all_forums" value="{$all_forums_encoded|escape}">
<input type="hidden" name="comments_coms" value="{$comments_coms_encoded|escape}">
<input type="hidden" name="all_coms" value="{$all_coms_encoded|escape}">
{if $tiki_p_admin_forum eq 'y' && ($comments_coms|@count > 0 || $queued > 0 || $reported > 0)}
<div class="panel panel-primary">
<div class="panel-heading">
......@@ -382,7 +388,8 @@
{if $comments_coms|@count > 1}
<button
type="button"
onclick="modalActionModal(this, {ldelim}'controller':'forum','action':'merge_topic','closest':'form'{rdelim});"
id="merge-topic"
onclick="confirmModal(this, {ldelim}'controller':'forum','action':'merge_topic','closest':'form'{rdelim});"
class="btn btn-default btn-sm tips"
title=":{tr}Merge selected topics{/tr}">
{icon name="merge"}
......@@ -391,7 +398,8 @@
{if $all_forums|@count > 1 && $comments_coms|@count > 0}
<button
type="button"
onclick="modalActionModal(this, {ldelim}'controller':'forum','action':'move_topic','closest':'form'{rdelim});"
id="move-topic"
onclick="confirmModal(this, {ldelim}'controller':'forum','action':'move_topic','closest':'form'{rdelim});"
class="btn btn-default btn-sm tips"
title=":{tr}Move selected topics{/tr}">
{icon name="move"}
......@@ -400,21 +408,24 @@
{if $comments_coms|@count > 0}
<button
type="button"
onclick="actionModal(this, {ldelim}'controller':'forum','action':'lock_topic','closest':'form'{rdelim}, 'table#{$ts_tableid}', 'refreshTableRows');"
id="lock-topic"
onclick="confirmModal(this, {ldelim}'controller':'forum','action':'lock_topic','closest':'form'{rdelim});"
class="btn btn-default btn-sm tips"
title=":{tr}Lock selected topics{/tr}">
{icon name="lock"}
</button>
<button
type="button"
onclick="actionModal(this, {ldelim}'controller':'forum','action':'unlock_topic','closest':'form'{rdelim}, 'table#{$ts_tableid}', 'refreshTableRows');"
id="unlock-topic"
onclick="confirmModal(this, {ldelim}'controller':'forum','action':'unlock_topic','closest':'form'{rdelim});"
class="btn btn-default btn-sm tips"
title=":{tr}Unlock selected topics{/tr}">
{icon name="unlock"}
</button>
<button
type="button"
onclick="modalActionModal(this, {ldelim}'controller':'forum','action':'delete_topic','closest':'form'{rdelim});"
id="delete-topic"
onclick="confirmModal(this, {ldelim}'controller':'forum','action':'delete_topic','closest':'form'{rdelim});"
class="btn btn-default btn-sm tips"
title=":{tr}Delete selected topics{/tr}">
{icon name="remove"}
......@@ -431,6 +442,7 @@
</div>
</div>
</div>
<div id="ajax-feedback" style="display:none"></div>
{/if}
<div id="{$ts_tableid}-div" class="table-responsive ts-wrapperdiv" {if $tsOn}style="visibility:hidden;"{/if}>
<table id="{$ts_tableid}" class="table normal table-striped table-hover">
......@@ -440,7 +452,9 @@
<tr>
{$cntcol = 0}
{if $tiki_p_admin_forum eq 'y'}
<th id="checkbox">&nbsp;</th>
<th id="checkbox">
{select_all checkbox_names='forumtopic[]'}
</th>
{$cntcol = $cntcol + 1}
{/if}
<th id="type">{self_link _sort_arg='thread_sort_mode' _sort_field='type'}{tr}Type{/tr}{/self_link}</th>
......@@ -640,27 +654,59 @@
{if $prefs.feature_forum_topics_archiving eq 'y' && $tiki_p_admin_forum eq 'y'}
{if $comments_coms[ix].archived eq 'y'}
<span
onclick="actionModal(this, {ldelim}'controller':'forum','action':'unarchive_topic','params':{ldelim}'comments_parentId':'{$comments_coms[ix].threadId}'{rdelim}{rdelim}, 'table#{$ts_tableid}', 'refreshTableRows');"
id="unarchive-single-topic"
class="btn-link tips"
title="{$comments_coms[ix].title|escape}:{tr}Unarchive topic{/tr}">
{icon name='file-archive-open'}
title="{$comments_coms[ix].title|escape}:{tr}Unarchive topic{/tr}"
onclick="confirmModal(this,
{ldelim}
'controller':'forum',
'action':'unarchive_topic',
'closest':'form',
'params':
{ldelim}
'comments_parentId':'{$comments_coms[ix].threadId}'
{rdelim}
{rdelim});"
>
{icon name='file-archive-open'}
</span>
{else}
<span
onclick="actionModal(this, {ldelim}'controller':'forum','action':'archive_topic','params':{ldelim}'comments_parentId':'{$comments_coms[ix].threadId}'{rdelim}{rdelim}, 'table#{$ts_tableid}', 'refreshTableRows');"
id="archive-single-topic"
class="btn-link tips"
title="{$comments_coms[ix].title|escape}:{tr}Archive topic{/tr}">
{icon name='file-archive'}
title="{$comments_coms[ix].title|escape}:{tr}Archive topic{/tr}"
onclick="confirmModal(this,
{ldelim}
'controller':'forum',
'action':'archive_topic',
'closest':'form',
'params':
{ldelim}
'comments_parentId':'{$comments_coms[ix].threadId}'
{rdelim}
{rdelim});"
>
{icon name='file-archive'}
</span>
{/if}
{/if}
{if $tiki_p_admin_forum eq 'y'}
<span
onclick="modalActionModal(this, {ldelim}'data':'service'{rdelim});"
data-service="{service controller=forum action=delete_topic params="forumtopic[]={$comments_coms[ix].threadId}&forumId={$forum_info.forumId}&comments_threshold={$comments_threshold}&comments_offset={$comments_offset}&thread_sort_mode={$thread_sort_mode}&comments_per_page={$comments_per_page}"}"
id="delete-single-topic"
class="btn-link tips"
title="{$comments_coms[ix].title|escape}:{tr}Delete topic{/tr}">
{icon name='remove'}
title="{$comments_coms[ix].title|escape}:{tr}Delete topic{/tr}"
onclick="confirmModal(this,
{ldelim}
'controller':'forum',
'action':'delete_topic',
'closest':'form',
'params':
{ldelim}
'forumtopic[]':'{$comments_coms[ix].threadId}'
{rdelim}
{rdelim});"
>
{icon name='remove'}
</span>
{/if}
</td>
......
......@@ -14,7 +14,12 @@
{/if}
{button href="tiki-view_forum.php?forumId=$forumId" class="btn btn-default" _text="{tr}Topic List{/tr}"}
</div>
<div id="ajax-feedback" style="display:none"></div>
{if isset($ajaxfeedback) && $ajaxfeedback eq 'y'}
<div id="posted-ajax-feedback">
{include file="utilities/alert.tpl"}
</div>
{/if}
{if $post_reported eq 'y'}
{remarksbox type=warning title="{tr}The post has been reported and will be reviewed by a moderator.{/tr}"}{/remarksbox}
{/if}
......
......@@ -442,6 +442,19 @@ $smarty->assign(
)
);
if (isset($_POST['ajaxtype'])) {
$smarty->assign('ajaxfeedback', 'y');
$ajaxpost = array_intersect_key($_POST, [
'ajaxtype' => '',
'ajaxheading' => '',
'ajaxitems' => '',
'ajaxmsg' => '',
'ajaxtoMsg' => '',
'ajaxtoList' => '',
]);
$smarty->assign($ajaxpost);
}
$sections = $tikilib->get_forum_sections();
$smarty->assign_by_ref('sections', $sections);
include_once ('tiki-section_options.php');
......
......@@ -386,8 +386,11 @@ $smarty->assign_by_ref('last_comments', $last_comments);
$smarty->assign('comments_cant', $comments_cant);
$comments_maxRecords = $_REQUEST["comments_per_page"];
$smarty->assign_by_ref('comments_coms', $comments_coms);
$comms = array_column($comments_coms, 'title', 'threadId');
$smarty->assign('comments_coms_encoded', json_encode($comms));
$all_coms = $commentslib->get_forum_topics($_REQUEST['forumId'], 0, -1);
$all_coms = array_column($all_coms, 'title', 'threadId');
$smarty->assign('all_coms_encoded', json_encode($all_coms));
$cat_type = 'forum';
$cat_objid = $_REQUEST["forumId"];
......@@ -496,6 +499,21 @@ if ($prefs['feature_forum_parse'] == 'y') {
$smarty->assign_by_ref('plugins', $plugins);
}
if (isset($_POST['ajaxtype']) || !empty($_SESSION['ajaxpost' . $_GET['deleted_parentId']])) {
$smarty->assign('ajaxfeedback', 'y');
$posted = isset($_POST['ajaxtype']) ? $_POST : $_SESSION['ajaxpost' . $_GET['deleted_parentId']];
unset($_SESSION['ajaxpost' . $_GET['deleted_parentId']]);
$ajaxpost = array_intersect_key($posted, [
'ajaxtype' => '',
'ajaxheading' => '',
'ajaxitems' => '',
'ajaxmsg' => '',
'ajaxtoMsg' => '',
'ajaxtoList' => '',
]);
$smarty->assign($ajaxpost);
}
ask_ticket('view-forum');
if ($tsAjax) {
$smarty->display('tiki-view_forum.tpl');
......
......@@ -185,11 +185,24 @@ if ($prefs['feature_score'] == 'y' && $user != $thread_info['userName']) {
$tikilib->score_event($thread_info['userName'], 'forum_post_is_read', "$score_user:$score_id");
}
if (empty($thread_info)) {
if (empty($thread_info) && empty($_POST['ajaxtype'])) {
$smarty->assign('msg', tra("Incorrect thread"));
$smarty->display("error.tpl");
die;
} elseif (!empty($_POST['ajaxtype']) && empty($thread_info)) {
$ajaxpost = array_intersect_key($_POST, [
'ajaxtype' => '',
'ajaxheading' => '',
'ajaxitems' => '',
'ajaxmsg' => '',
'ajaxtoMsg' => '',
'ajaxtoList' => '',
]);
$keys = array_keys($_POST['ajaxitems']);
$_SESSION['ajaxpost' . $keys[0]] = $ajaxpost;
header('location: ' . 'tiki-view_forum.php?forumId=' . $_POST['forumId'] . '&deleted_parentId=' . $keys[0]);
}
if (!empty($thread_info['parentId'])) {
$thread_info['topic'] = $commentslib->get_comment($thread_info['parentId'], null, $forum_info);
}
......@@ -320,6 +333,19 @@ if (!empty($_REQUEST['view_atts']) && $_REQUEST['view_atts'] == 'y') {
$smarty->assign_by_ref('view_atts', $_REQUEST['view_atts']);
}
if (isset($_POST['ajaxtype'])) {
$smarty->assign('ajaxfeedback', 'y');
$ajaxpost = array_intersect_key($_POST, [
'ajaxtype' => '',
'ajaxheading' => '',
'ajaxitems' => '',
'ajaxmsg' => '',
'ajaxtoMsg' => '',
'ajaxtoList' => '',
]);
$smarty->assign($ajaxpost);
}
// Display the template
if (isset($_REQUEST['display'])) {
// Remove icons and actions that should not be printed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment