Skip to content

Commit

Permalink
added confirm dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola1971 committed Dec 16, 2017
1 parent f3742a4 commit a08fcb1
Showing 1 changed file with 48 additions and 9 deletions.
57 changes: 48 additions & 9 deletions install/assets/plugins/DashboardDocList.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* Dashboard Documents list/grid widget plugin
*
* @category plugin
* @version 2.0.3
* @version 2.0.4
* @author Nicola Lambathakis http://www.tattoocms.it/ https://github.com/Nicola1971/
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
* @internal @events OnManagerWelcomeHome,OnManagerWelcomePrerender
* @internal @properties &wdgVisibility=Show widget for:;menu;All,AdminOnly,AdminExcluded,ThisRoleOnly,ThisUserOnly;All &ThisRole=Show only to this role id:;string;;;enter the role id &ThisUser=Show only to this username:;string;;;enter the username &wdgTitle= Widget Title:;string;Documents List &wdgicon=widget icon:;string;fa-pencil &wdgposition=widget position:;list;1,2,3,4,5,6,7,8,9,10;1 &wdgsizex=widget width:;list;12,6,4,3;12 &ParentFolder=Parent folder for List documents:;string;0 &ListItems=Max items in List:;string;50 &dittolevel=Depht:;string;3 &hideFolders=Hide Folders:;list;yes,no;no &showUnpublished=Show Deleted and Unpublished:;list;yes,no;yes;;Show Deleted and Unpublished resources &showAddButtons=Show Create Resource Buttons:;list;yes,no;no;;show header add buttons &showStatusFilter=Show Status Filter:;list;yes,no;yes;;require Show Deleted and Unpublished - YES &DisplayTitle=Display Title in title column:;list;pagetitle,longtitle,menutitle;pagetitle;;choose which title display in title column &showParent=Show Parent Column:;list;yes,no;yes &showUser=Show User Column:;list;createdby,publishedby,editedby,no;createdby &showDate=Show Date Column:;list;createdon,publishedon,editedon,no;editedon &dateFormat=Date Column Format:;list;DD MM YYYY,MM DD YYYY,YYYY MM DD;DD MM YYYY &TvColumn=Tv Columns:;string;[+longtitle+],[+menuindex+] &TvSortType=Tv Column Sort type:;string;text,number &ImageTv=Show Image TV:;string;image;;enter tv name &ShowImageIn=Show image Tv in:;list;overview,column;overview &tablefields=Overview Tv Fields:;string;[+longtitle+],[+description+],[+introtext+],[+documentTags+] &tableheading=Overview TV headings:;string;Long Title,Description,Introtext,Tags &editInModal=Edit docs in modal:;list;yes,no;no;;edit and create resources in evo modal window &showMoveButton=Show Move Button:;list;yes,no;yes;;hides the button to everyone, even if the user has permissions &showAddHere=Show Create Resource here Button:;list;yes,no;yes;;hides the button to everyone, even if the user has permissions &showDuplicateButton=Show Duplicate Button:;list;yes,no;yes;;hides the button to everyone, even if the user has permissions &showPublishButton=Show Publish Button:;list;yes,no;yes;;hides the button to everyone, even if the user has permissions &showDeleteButton=Show Delete Button:;list;yes,no;yes;;hides the button to everyone, even if the user has permissions &HeadBG=Widget Title Background color:;string; &HeadColor=Widget title color:;string
* @internal @installset base, sample
* @internal @modx_category Dashboard
* @internal @disabled 0
* @lastupdate 11-12-2017
* @lastupdate 16-12-2017
* @documentation Requirements: This plugin requires Evolution 1.4 or later
* @documentation https://github.com/Nicola1971/DashboardListDoc-widget/
* @reportissues https://github.com/Nicola1971/DashboardListDoc-widget/issues
Expand Down Expand Up @@ -159,9 +159,48 @@ $(\'button.btn-size\').each(function(){
$(this).addClass(\'active\');
});
});
$("#TableList").on("click", ".btn-delete", function(){
trID = $(this).closest("tr").attr("id");
r = confirm("' . $_lang["delete_resource"] . ' ID:"+trID+" - ' . $_lang["confirm_delete_resource"] . '");
if(r) {
alert(trID+" ' . $_LDlang["deleted"] . '");
window.location.reload();
}
});
$("#TableList").on("click", ".btn-undelete", function(){
trID = $(this).closest("tr").attr("id");
r = confirm("' . $_lang["undelete_resource"] . ' ID:"+trID+" - ' . $_lang["confirm_undelete"] . '");
if(r) {
alert(trID+" ' . $_lang["undeleted"] . '");
window.location.reload();
}
});
$("#TableList").on("click", ".btn-unpublish", function(){
trID = $(this).closest("tr").attr("id");
r = confirm("' . $_lang["unpublish_resource"] . ' ID:"+trID+" - ' . $_lang["confirm_unpublish"] . '");
if(r) {
alert(trID+" ' . $_LDlang["unpublished"] . '");
window.location.reload();
}
});
$("#TableList").on("click", ".btn-publish", function(){
trID = $(this).closest("tr").attr("id");
r = confirm("' . $_lang["publish_resource"] . ' ID:"+trID+" - ' . $_lang["confirm_publish"] . '");
if(r) {
alert(trID+" ' . $_LDlang["published"] . '");
window.location.reload();
}
});
$("#TableList").on("click", ".btn-duplicate", function(){
trID = $(this).closest("tr").attr("id");
r = confirm("' . $_lang["resource_duplicate"] . ' ID:"+trID+" - ' . $_lang["confirm_duplicate_record"] . '");
if(r) {
//alert(trID+" ' . $_lang["duplicated"] . '");
window.location.reload();
}
});
$("div#DashboardList").fadeIn();
});
</script>';
if($manager_theme == "EvoFLAT") {
$cssOutput = '
Expand Down Expand Up @@ -232,7 +271,7 @@ $DLdate = str_replace($find,$replace,$dateFormat);

////////////Columns
//ID column
$rowTpl = '@CODE: <tr>
$rowTpl = '@CODE: <tr id="[+id+]">
<td aria-expanded="false" class="footable-toggle"> <span class="label label-info">[+id+]</span></td> ';

//Image column
Expand Down Expand Up @@ -318,14 +357,14 @@ $rowTpl .= '<a class="hidden-xs-down" target="main" href="index.php?a=51&id=[+id
}
//Duplicate btn
if ($showDuplicateButton == yes) {
$rowTpl .= '<a target="main" class="hidden-xs-down" href="index.php?a=94&id=[+id+]" onClick="window.location.reload();" title="' . $_lang["resource_duplicate"] . '"><i class="fa fa-clone"></i></a> ';
$rowTpl .= '<a target="main" class="btn-duplicate hidden-xs-down" href="index.php?a=94&id=[+id+]" onClick="window.location.reload();" title="' . $_lang["resource_duplicate"] . '"><i class="fa fa-clone"></i></a> ';
}
//Publish btn
if ($showPublishButton == yes) {
$rowTpl .= '[[if? &is=`[+deleted+]:=:0` &then=`[[if? &is=`[+published+]:=:1` &then=`
<a target="main" href="index.php?a=62&id=[+id+]" class="hidden-xs-down confirm" onClick="window.location.reload();" title="' . $_lang["unpublish_resource"] . '"><i class="fa fa-arrow-down"></i></a>
<a class="btn-unpublish hidden-xs-down" target="main" href="index.php?a=62&id=[+id+]" title="' . $_lang["unpublish_resource"] . '"><i class="fa fa-arrow-down"></i></a>
`&else=`
<a target="main" href="index.php?a=61&id=[+id+]" class="hidden-xs-down confirm" onClick="window.location.reload();" title="' . $_lang["publish_resource"] . '"><i class="fa fa-arrow-up"></i></a>
<a class="btn-publish hidden-xs-down" target="main" href="index.php?a=61&id=[+id+]" title="' . $_lang["publish_resource"] . '"><i class="fa fa-arrow-up"></i></a>
`]]
`&else=`
<span style="opacity:0; margin-right:-6px;" class="hidden-xs-down text-muted" title="publish"><i class="fa fa-arrow-up"></i></span>
Expand All @@ -346,9 +385,9 @@ $rowTpl .= '<a class="hidden-xs-down" target="main" href="index.php?a=4&pid=[+id
if ($showDeleteButton == yes) {
if($modx->hasPermission('delete_document')) {
$rowTpl .= '[[if? &is=`[+deleted+]:=:0` &then=`
<a target="main" href="index.php?a=6&id=[+id+]" title="' . $_lang["delete_resource"] . '" onClick="window.location.reload();"><i class="fa fa-trash"></i></a>
<a class="btn-delete" target="main" href="index.php?a=6&id=[+id+]" title="' . $_lang["delete_resource"] . '"><i class="fa fa-trash"></i></a>
`&else=`
<a target="main" href="index.php?a=63&id=[+id+]" title="' . $_lang["undelete_resource"] . '" onClick="window.location.reload();"><i class="fa fa-arrow-circle-o-up"></i></a>
<a class="btn-undelete" target="main" href="index.php?a=63&id=[+id+]" title="' . $_lang["undelete_resource"] . '"><i class="fa fa-arrow-circle-o-up"></i></a>
`]]';
}
}
Expand Down

0 comments on commit a08fcb1

Please sign in to comment.