diff --git a/install/assets/modules/LIstDocModule.tpl b/install/assets/modules/LIstDocModule.tpl index e08e619..8a2c06c 100644 --- a/install/assets/modules/LIstDocModule.tpl +++ b/install/assets/modules/LIstDocModule.tpl @@ -4,11 +4,12 @@ * Documents list/grid * * @category module - * @version 2.0.5.2 + * @version 2.0.5.3 * @author Author: Nicola Lambathakis http://www.tattoocms.it/ + * @icon fa fa-pencil * @internal @modx_category Manager * @internal @installset base, sample - * @lastupdate 30-12-2017 + * @lastupdate 29-11-2018 * @internal @properties &modTitle=Module Title:;string;Documents List &modicon=Module title icon:;string;fa-pencil &ParentFolder=Parent folder for List documents:;string;0 &ListItems=Max items in List:;string;100 &dittolevel=Depht:;string;3 &hideFolders=Hide Folders:;menu;yes,no;no &showUnpublished=Show Deleted and Unpublished:;menu;yes,no;yes;;Show Deleted and Unpublished resources &showAddButtons=Show Create Resource Buttons:;menu;yes,no;no;;show header add buttons &showStatusFilter=Show Status Filter:;menu;yes,no;yes;;require Show Deleted and Unpublished YES &DisplayTitle=Display Title in title column:;menu;pagetitle,longtitle,menutitle;pagetitle;;choose which title display in title column &showParent=Show Parent Column:;menu;yes,no;yes &showUser=Show User Column:;menu;createdby,publishedby,editedby,no;createdby &showDate=Show Date Column:;menu;createdon,publishedon,editedon,no;editedon &dateFormat=Date Column Format:;menu;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 image tv name &ShowImageIn=Show image Tv in:;menu;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:;menu;yes,no;no;;edit and create resources in evo modal window &showMoveButton=Show Move Button:;menu;yes,no;yes;;hides the button to everyone, even if the user has permissions &showAddHere=Show Create Resource here Button:;menu;yes,no;yes;;hides the button to everyone, even if the user has permissions &showDuplicateButton=Show Duplicate Button:;menu;yes,no;yes;;hides the button to everyone, even if the user has permissions &showPublishButton=Show Publish Button:;menu;yes,no;yes;;hides the button to everyone, even if the user has permissions &showDeleteButton=Show Delete Button:;menu;yes,no;yes;;hides the button to everyone, even if the user has permissions &showEmptyTrashButton=Show Empty Trash Button:;menu;yes,no;yes;;hides the button to everyone, even if the user has permissions &confirmTheme=jquery confirm Theme:;menu;modern,light,dark,supervan,material,bootstrap;modern;;theme styles for confim alert windows * @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL) * @documentation Requirements: This plugin requires Evolution 1.4 or later @@ -16,775 +17,776 @@ * @reportissues https://github.com/Nicola1971/ListDoc-module/issues */ -if(!defined('MODX_BASE_PATH')){die('What are you doing? Get out of here!');} -//lang -// get global language -global $modx,$_lang,$_style; -//get custom language -$_LDlang = array(); -include(MODX_BASE_PATH.'assets/modules/listdoc/lang/english.php'); -if (file_exists(MODX_BASE_PATH.'assets/modules/listdoc/lang/' . $modx->config['manager_language'] . '.php')) { - include(MODX_BASE_PATH.'assets/modules/listdoc/lang/' . $modx->config['manager_language'] . '.php'); -} -//config button -$module_id = (!empty($_REQUEST["id"])) ? (int)$_REQUEST["id"] : $yourModuleId; -if($modx->hasPermission('edit_module')) { -$button_config = ' ' . $_lang["settings_config"] . ''; -} -$manager_theme = $modx->config['manager_theme']; -$confirmTheme = isset($confirmTheme) ? $confirmTheme : 'modern'; -//clean languages confirms -$confirm_delete_resource = str_replace(array('\'', '"'), '', $_lang["confirm_delete_resource"]); -$confirm_publish = str_replace(array('\'', '"'), '', $_lang["confirm_publish"]); -$confirm_unpublish = str_replace(array('\'', '"'), '', $_lang["confirm_unpublish"]); -$jsOutput = ' - - - - - - -'; -if($manager_theme == "EvoFLAT") { -$cssOutput = ' - - - -'; -} -else { -$cssOutput = ' - - -'; -} - -//output -$WidgetOutput = isset($WidgetOutput) ? $WidgetOutput : ''; -$TvColumn = isset($TvColumn) ? $TvColumn : ''; -$tablefields = isset($tablefields) ? $tablefields : '[+longtitle+],[+description+],[+introtext+],[+documentTags+]'; -$tableheading = isset($tableheading) ? $tableheading : 'Long Title,Description,Introtext,Tags'; - -//Header create resource in parent buttons -if ($showAddButtons == yes) { - if($modx->hasPermission('edit_document')) { -$Parents = explode(",","$ParentFolder"); -foreach ($Parents as $Parent){ - if ($Parent != '0') { - $ParentT = $modx->getPageInfo($Parent,'*','pagetitle'); - $ParentTitle = $ParentT['pagetitle']; - } - else { - $ParentTitle = " Root";} - if ($editInModal == yes) { - $ParentsButtons .= '.container\',position:\'center center\',width:\'80%\',height:\'80%\',wrap:\'body\',hide:0,hover:0,overlay:1,overlayclose:1})">+ ' . $ParentTitle . ' '; - } - else { - $ParentsButtons .= " - + " . $ParentTitle . " - "; - } - } -} -} -//get Tv vars Heading Titles from Module configuration (ie: Page Title,Description,Date) -$tharr = explode(",","$tableheading"); -$tdarr = explode(",","$tablefields"); -foreach (array_combine($tharr, $tdarr) as $thval => $tdval){ - $thtdfields .= " -
  • " . $thval . ": " . $tdval . "
  • - "; -} -//get tv columns -$TvColumns = explode(",","$TvColumn"); -$TvTypes = explode(",","$TvSortType"); -foreach (array_combine($TvColumns, $TvTypes) as $TvTD => $TvType){ - $TvTDs .= ''.$TvTD.''; - $find = array('[+','+]'); - $replace = array('',''); - $getTvName = str_replace($find,$replace,$TvTD); - $TvName = $getTvName; - $TvColumnsHeaders .= ''.$TvName.' '; -} -//get date format -$dateFormat = isset($dateFormat) ? $dateFormat : 'DD MM YYYY'; -$find = array('DD','MM','YYYY'); -$replace = array('%d','%m','%Y'); -$DLdate = str_replace($find,$replace,$dateFormat); - -////////////Columns -//ID column -$rowTpl = '@CODE: - [+id+] '; - -//Image column -if ($ImageTv != '') { -if ($ShowImageIn == column) { -$rowTpl .= '[+title+] '; -$ImageTVHead = ' '; -} -} -//Title column -$rowTpl .= '[[if? &is=`[+'.$DisplayTitle.'+]:!empty` &then=`[+'.$DisplayTitle.'+]` &else=[+title+]`]][[if? &is=`[+type+]:is:reference` &then=` `]] '; - -//Parent column and context menu -if ($showParent == yes) { -$rowTpl .= ' - -[[if? &is=`[+parent+]:not:0`&then=`[[DocInfo? &docid=`[+parent+]` &field=`pagetitle`]]`]] -'; -} -//TVs columns -$rowTpl .= $TvTDs; - -//Status column (hidden) -$rowTpl .= ' - - [[if? &is=`[+deleted+]:=:1` &then=`' . $_LDlang["deleted"] . '` &else=`[[if? &is=`[+published+]:=:1` &then=`' . $_LDlang["published"] . '` &else=`' . $_LDlang["unpublished"] . '`]]`]] -'; - -//DATE column -if ($showDate == 'createdon') { -$rowTpl .= '[+createdon:date=`' . $DLdate . '`+]'; -$dateColHead = '' . $_lang["page_data_created"] . ''; -} -else if ($showDate == 'publishedon') { -$rowTpl .= '[+publishedon:date=`' . $DLdate . '`+]'; -$dateColHead = '' . $_lang["page_data_published"] . ''; -} -else if ($showDate == 'editedon') { -$rowTpl .= '[+editedon:date=`' . $DLdate . '`+]'; -$dateColHead = '' . $_lang["page_data_edited"] . ''; -} -else {} - -//USER column -if ($showUser == 'createdby') { -$rowTpl .= '[+user.username.createdby+]'; -$userColHead = '' . $_lang["user"] . ''; -} -else if ($showUser == 'publishedby') { -$rowTpl .= '[+user.username.publishedby+]'; -$userColHead = '' . $_lang["user"] . ''; -} -else if ($showUser == 'editedby') { -$rowTpl .= '[+user.username.editedby+]'; -$userColHead = '' . $_lang["user"] . ''; -} -else {} - -$rowTpl .=''; -//Action buttons -if($modx->hasPermission('edit_document')) { -if ($editInModal == yes) { -$rowTpl .= '.container\',position:\'center center\',width:\'80%\',height:\'80%\',wrap:\'body\',hide:0,hover:0,overlay:1,overlayclose:1})">'; -} -else { -$rowTpl .= ''; -} -} -$rowTpl .= ' '; -if($modx->hasPermission('edit_document')) { -if ($showMoveButton == yes) { -$rowTpl .= ' '; -} - -//Duplicate btn href="index.php?a=94&id=[+id+]" -if ($showDuplicateButton == yes) { -$rowTpl .= ' '; -} -//Publish btn -if ($showPublishButton == yes) { -$rowTpl .= '[[if? &is=`[+deleted+]:=:0` &then=`[[if? &is=`[+published+]:=:1` &then=` - -`&else=` - -`]] -`&else=` - -`]] -'; -} -} -//add resource here btn -if ($showAddHere == yes) { -if ($editInModal == yes) { -$rowTpl .= '.container\',position:\'center center\',width:\'80%\',height:\'80%\',wrap:\'body\',hide:0,hover:0,overlay:1,overlayclose:1})">'; -} -else { -$rowTpl .= ' '; -} -} -//delete btn -if ($showDeleteButton == yes) { -if($modx->hasPermission('delete_document')) { -$rowTpl .= '[[if? &is=`[+deleted+]:=:0` &then=` - -`&else=` - -`]]'; -} -} -//overview btn -$rowTpl .= ' - -'; -//image tv -if ($ImageTv != '') { -if ($ShowImageIn == overview) { -$rowTpl .= '
    [+title+]
    '; -} -} -$rowTpl .= ' -
    - -
    - - -'; -//headers -if ($showParent == yes) { -$parentColumnHeader = ' -' . $_lang["resource_parent"] . ' '; -} -$ImageTV = isset($ImageTV) ? $ImageTV : ''; - -//DocListerTvs -$find = array('[+','+]'); -$replace = array('',''); -$DocListerTvs = str_replace($find,$replace,$tablefields); -$DocListerTvFields = $DocListerTvs; -//DocListerTvs -$findtv = array('[+','+]'); -$replacetv = array('',''); -$TvColumnList = str_replace($find,$replace,$TvColumn); -if ($TvColumn != '') { -$TvFields = ''.$ImageTv.','.$DocListerTvFields.','.$TvColumnList.''; -$TvColumnHeader = ' -'.$TvColumn.' '; -} -else { -$TvFields = ''.$ImageTv.','.$DocListerTvFields.''; -} -$parentId = $ParentFolder; -// DocLister parameters -$params['debug'] = '0'; //enable to debug listing -$params['id'] = 'doclistwdg'; -$params['parents'] = $parentId; -$params['depth'] = $dittolevel; -$params['filters'] = 'private'; -$params['tpl'] = $rowTpl; -$params['tvPrefix'] = ''; -$params['tvList'] = $TvFields; -$params['display'] = $ListItems; -//filters -if ($showUnpublished == yes) { -$params['showNoPublish'] = '1'; -} -if ($hideFolders == yes) { -$wherehideFolders = 'isfolder=0'; -$params['addWhereList'] = 'isfolder=0'; -} -//user extender -$params['extender'] = 'user'; -$params['usertype'] = 'mgr'; -$params['userFields'] = 'createdby,publishedby,editedby'; - -// run DocLister -$list = $modx->runSnippet('DocLister', $params); - -//out module -$output =''; - -$output .= ''.$jsOutput.''; - -// onManagerMainFrameHeaderHTMLBlock -$evtOut = $modx->invokeEvent('OnManagerMainFrameHeaderHTMLBlock'); -$onManagerMainFrameHeaderHTMLBlock = is_array($evtOut) ? implode("\n", $evtOut) : ''; -$output .= $onManagerMainFrameHeaderHTMLBlock; - -$output .= ' -'.$cssOutput.' - - -

    - '.$modTitle.' -

    -
    -'.$button_config.' -
    -
    -'; -if ($showEmptyTrashButton == yes) { -if($modx->hasPermission('empty_trash')) { -$output .= ' -
    -'.$_style['empty_recycle_bin_empty'].' -'; -} -} -$output .= '
    -
    '; - -return $output; + if(!defined('MODX_BASE_PATH')){die('What are you doing? Get out of here!');} + //lang + // get global language + global $modx,$_lang,$_style; + //get custom language + $_LDlang = array(); + include(MODX_BASE_PATH.'assets/modules/listdoc/lang/english.php'); + if (file_exists(MODX_BASE_PATH.'assets/modules/listdoc/lang/' . $modx->config['manager_language'] . '.php')) { + include(MODX_BASE_PATH.'assets/modules/listdoc/lang/' . $modx->config['manager_language'] . '.php'); + } + //config button + $module_id = (!empty($_REQUEST["id"])) ? (int)$_REQUEST["id"] : $yourModuleId; + if($modx->hasPermission('edit_module')) { + $button_config = ' ' . $_lang["settings_config"] . ''; + } + $manager_theme = $modx->config['manager_theme']; + $confirmTheme = isset($confirmTheme) ? $confirmTheme : 'modern'; + //clean languages confirms + $confirm_delete_resource = str_replace(array('\'', '"'), '', $_lang["confirm_delete_resource"]); + $confirm_publish = str_replace(array('\'', '"'), '', $_lang["confirm_publish"]); + $confirm_unpublish = str_replace(array('\'', '"'), '', $_lang["confirm_unpublish"]); + $jsOutput = ' + + + + + + + '; + if($manager_theme == "EvoFLAT") { + $cssOutput = ' + + + + '; + } + else { + $cssOutput = ' + + + + '; + } + + //output + $WidgetOutput = isset($WidgetOutput) ? $WidgetOutput : ''; + $TvColumn = isset($TvColumn) ? $TvColumn : ''; + $tablefields = isset($tablefields) ? $tablefields : '[+longtitle+],[+description+],[+introtext+],[+documentTags+]'; + $tableheading = isset($tableheading) ? $tableheading : 'Long Title,Description,Introtext,Tags'; + + //Header create resource in parent buttons + if ($showAddButtons == yes) { + if($modx->hasPermission('edit_document')) { + $Parents = explode(",","$ParentFolder"); + foreach ($Parents as $Parent){ + if ($Parent != '0') { + $ParentT = $modx->getPageInfo($Parent,'*','pagetitle'); + $ParentTitle = $ParentT['pagetitle']; + } + else { + $ParentTitle = " Root";} + if ($editInModal == yes) { + $ParentsButtons .= '.container\',position:\'center center\',width:\'80%\',height:\'80%\',wrap:\'body\',hide:0,hover:0,overlay:1,overlayclose:1})">+ ' . $ParentTitle . ' '; + } + else { + $ParentsButtons .= " + + " . $ParentTitle . " + "; + } + } + } + } + //get Tv vars Heading Titles from Module configuration (ie: Page Title,Description,Date) + $tharr = explode(",","$tableheading"); + $tdarr = explode(",","$tablefields"); + foreach (array_combine($tharr, $tdarr) as $thval => $tdval){ + $thtdfields .= " +
  • " . $thval . ": " . $tdval . "
  • + "; + } + //get tv columns + $TvColumns = explode(",","$TvColumn"); + $TvTypes = explode(",","$TvSortType"); + foreach (array_combine($TvColumns, $TvTypes) as $TvTD => $TvType){ + $TvTDs .= ''.$TvTD.''; + $find = array('[+','+]'); + $replace = array('',''); + $getTvName = str_replace($find,$replace,$TvTD); + $TvName = $getTvName; + $TvColumnsHeaders .= ''.$TvName.' '; + } + //get date format + $dateFormat = isset($dateFormat) ? $dateFormat : 'DD MM YYYY'; + $find = array('DD','MM','YYYY'); + $replace = array('%d','%m','%Y'); + $DLdate = str_replace($find,$replace,$dateFormat); + + ////////////Columns + //ID column + $rowTpl = '@CODE: + [+id+] '; + + //Image column + if ($ImageTv != '') { + if ($ShowImageIn == column) { + $rowTpl .= '[+title+] '; + $ImageTVHead = ' '; + } + } + //Title column + $rowTpl .= '[[if? &is=`[+'.$DisplayTitle.'+]:!empty` &then=`[+'.$DisplayTitle.'+]` &else=[+title+]`]][[if? &is=`[+type+]:is:reference` &then=` `]] '; + + //Parent column and context menu + if ($showParent == yes) { + $rowTpl .= ' + + [[if? &is=`[+parent+]:not:0`&then=`[[DocInfo? &docid=`[+parent+]` &field=`pagetitle`]]`]] + '; + } + //TVs columns + $rowTpl .= $TvTDs; + + //Status column (hidden) + $rowTpl .= ' + + [[if? &is=`[+deleted+]:=:1` &then=`' . $_LDlang["deleted"] . '` &else=`[[if? &is=`[+published+]:=:1` &then=`' . $_LDlang["published"] . '` &else=`' . $_LDlang["unpublished"] . '`]]`]] + '; + + //DATE column + if ($showDate == 'createdon') { + $rowTpl .= '[+createdon:date=`' . $DLdate . '`+]'; + $dateColHead = '' . $_lang["page_data_created"] . ''; + } + else if ($showDate == 'publishedon') { + $rowTpl .= '[+publishedon:date=`' . $DLdate . '`+]'; + $dateColHead = '' . $_lang["page_data_published"] . ''; + } + else if ($showDate == 'editedon') { + $rowTpl .= '[+editedon:date=`' . $DLdate . '`+]'; + $dateColHead = '' . $_lang["page_data_edited"] . ''; + } + else {} + + //USER column + if ($showUser == 'createdby') { + $rowTpl .= '[+user.username.createdby+]'; + $userColHead = '' . $_lang["user"] . ''; + } + else if ($showUser == 'publishedby') { + $rowTpl .= '[+user.username.publishedby+]'; + $userColHead = '' . $_lang["user"] . ''; + } + else if ($showUser == 'editedby') { + $rowTpl .= '[+user.username.editedby+]'; + $userColHead = '' . $_lang["user"] . ''; + } + else {} + + $rowTpl .=''; + //Action buttons + if($modx->hasPermission('edit_document')) { + if ($editInModal == yes) { + $rowTpl .= '.container\',position:\'center center\',width:\'80%\',height:\'80%\',wrap:\'body\',hide:0,hover:0,overlay:1,overlayclose:1})">'; + } + else { + $rowTpl .= ''; + } + } + $rowTpl .= ' '; + if($modx->hasPermission('edit_document')) { + if ($showMoveButton == yes) { + $rowTpl .= ' '; + } + + //Duplicate btn href="index.php?a=94&id=[+id+]" + if ($showDuplicateButton == yes) { + $rowTpl .= ' '; + } + //Publish btn + if ($showPublishButton == yes) { + $rowTpl .= '[[if? &is=`[+deleted+]:=:0` &then=`[[if? &is=`[+published+]:=:1` &then=` + + `&else=` + + `]] + `&else=` + + `]] + '; + } + } + //add resource here btn + if ($showAddHere == yes) { + if ($editInModal == yes) { + $rowTpl .= '.container\',position:\'center center\',width:\'80%\',height:\'80%\',wrap:\'body\',hide:0,hover:0,overlay:1,overlayclose:1})">'; + } + else { + $rowTpl .= ' '; + } + } + //delete btn + if ($showDeleteButton == yes) { + if($modx->hasPermission('delete_document')) { + $rowTpl .= '[[if? &is=`[+deleted+]:=:0` &then=` + + `&else=` + + `]]'; + } + } + //overview btn + $rowTpl .= ' + + '; + //image tv + if ($ImageTv != '') { + if ($ShowImageIn == overview) { + $rowTpl .= '
    [+title+]
    '; + } + } + $rowTpl .= ' +
    + +
    + + + '; + //headers + if ($showParent == yes) { + $parentColumnHeader = ' + ' . $_lang["resource_parent"] . ' '; + } + $ImageTV = isset($ImageTV) ? $ImageTV : ''; + + //DocListerTvs + $find = array('[+','+]'); + $replace = array('',''); + $DocListerTvs = str_replace($find,$replace,$tablefields); + $DocListerTvFields = $DocListerTvs; + //DocListerTvs + $findtv = array('[+','+]'); + $replacetv = array('',''); + $TvColumnList = str_replace($find,$replace,$TvColumn); + if ($TvColumn != '') { + $TvFields = ''.$ImageTv.','.$DocListerTvFields.','.$TvColumnList.''; + $TvColumnHeader = ' + '.$TvColumn.' '; + } + else { + $TvFields = ''.$ImageTv.','.$DocListerTvFields.''; + } + $parentId = $ParentFolder; + // DocLister parameters + $params['debug'] = '0'; //enable to debug listing + $params['id'] = 'doclistwdg'; + $params['parents'] = $parentId; + $params['depth'] = $dittolevel; + $params['filters'] = 'private'; + $params['tpl'] = $rowTpl; + $params['tvPrefix'] = ''; + $params['tvList'] = $TvFields; + $params['display'] = $ListItems; + //filters + if ($showUnpublished == yes) { + $params['showNoPublish'] = '1'; + } + if ($hideFolders == yes) { + $wherehideFolders = 'isfolder=0'; + $params['addWhereList'] = 'isfolder=0'; + } + //user extender + $params['extender'] = 'user'; + $params['usertype'] = 'mgr'; + $params['userFields'] = 'createdby,publishedby,editedby'; + + // run DocLister + $list = $modx->runSnippet('DocLister', $params); + + //out module + $output =''; + + $output .= ''.$jsOutput.''; + + // onManagerMainFrameHeaderHTMLBlock + $evtOut = $modx->invokeEvent('OnManagerMainFrameHeaderHTMLBlock'); + $onManagerMainFrameHeaderHTMLBlock = is_array($evtOut) ? implode("\n", $evtOut) : ''; + $output .= $onManagerMainFrameHeaderHTMLBlock; + + $output .= ' + '.$cssOutput.' + + +

    + '.$modTitle.' +

    +
    + '.$button_config.' +
    +
    + '; + if ($showEmptyTrashButton == yes) { + if($modx->hasPermission('empty_trash')) { + $output .= ' +
    + '.$_style['empty_recycle_bin_empty'].' + '; + } + } + $output .= '
    +
    '; + + return $output;