We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12151
    • 115 Posts
    Greetings

    I love Doc Manager, especially the Sort Menu Items pane, but sometimes it’s frustrating when you’re trying to sort a long list and there are several documents set as either Unpublished or Hidden from Menu. So I applied a simple hack to the code so that the document list is shown using standard MODx styles for Unpublished and Hidden from Menu, thereby making it much easier to sort the list. If anyone else would like to do the same here’s the quick and dirty (applies to doc manager that ships with MODx 1.0.2)

    modules/docmanager/classes/dm_backend.class.php

    line 42 in function showSortList: add the fields published, hidemenu to the select clause, thus:

    $query = 'SELECT id, pagetitle, parent, menuindex, published, hidemenu FROM '. $this->modx->getFullTableName('site_content') .' WHERE parent=' . $id . ' ORDER BY menuindex ASC';


    line 70 in function showSortList: change the foreach statement to the following:

    foreach ($resource as $item) {
    	$strClass = "sort";
    	if($item['published']==0) $strClass .= " unpublishedNode";
    	if($item['hidemenu']==1) $strClass .= " notInMenuNode";
    	$this->dm->ph['sort.options'] .= '<li id="item_' . $item['id'] . '" class="'.$strClass.'">' . $item['pagetitle'] . '</li>';
    }


    I hope this helps some of you and perhaps this is simple enough to add into the next version of Doc Manager?