/** * Document Manager Module * * Purpose: Allows for the bulk management of key document settings. * Author: Garry Nutting (Mark Kaplan - Menu Index functionalty, Luke Stokes - Document Permissions concept) * For: MODx CMS (www.modxcms.com) * Date:29/09/2006 Version: 1.6 * */ global $theme; global $table; global $_lang; global $siteURL; $basePath = $modx->config['base_path']; $siteURL = $modx->config['site_url']; /** CONFIGURATION SETTINGS **/ //-- set to false to hide the 'Select Tree' option $showTree = false; /** END CONFIGURATION SETTINGS **/ //-- include language file $manager_language = $modx->config['manager_language']; $sql = "SELECT setting_name, setting_value FROM ".$modx->getFullTableName('user_settings')." WHERE setting_name='manager_language' AND user=" . $modx->getLoginUserID(); $rs = $modx->db->query($sql); if ($modx->db->getRecordCount($rs) > 0) { $row = $modx->db->getRow($rs); $manager_language = $row['setting_value']; } include_once $basePath.'assets/modules/docmanager/lang/english.inc.php'; if($manager_language!="english") { if (file_exists($basePath.'assets/modules/docmanager/lang/'.$manager_language.'.inc.php')) { include_once $basePath.'assets/modules/docmanager/lang/'.$manager_language.'.inc.php'; } } //-- get theme $tb_prefix = $modx->db->config['table_prefix']; $theme = $modx->db->select('setting_value', '`' . $tb_prefix . 'system_settings`', 'setting_name=\'manager_theme\'', ''); $theme = $modx->db->getRow($theme); $theme = ($theme['setting_value'] <> '') ? '/' . $theme['setting_value'] : ''; //-- setup initial vars $table = $modx->getFullTableName('site_content'); $output = ''; $error = ''; //-- include php files include_once $basePath.'manager/includes/controls/datagrid.class.php'; include_once $basePath.'assets/modules/docmanager/includes/interaction.inc.php'; include_once $basePath.'assets/modules/docmanager/includes/process.inc.php'; //-- get POST vars $tabAction = (isset ($_POST['tabAction'])) ? $_POST['tabAction'] : ''; // get action for active tab $intType = (isset($_POST['opcode']) && $_POST['opcode'] == 'range') ? 'range' : 'tree'; // get interaction type //-- Menu Index if ($tabAction == 'sortMenu' || isset($_POST['sortableListsSubmitted'])) { $id= isset($_POST['new_parent'])? $_POST['new_parent']: 0; $actionkey = isset($_POST['actionkey'])? $_POST['actionkey']: 0; if(isset($_POST['sortableListsSubmitted'])) {$actionkey =1;} include_once $basePath.'assets/modules/docmanager/includes/SLLists.class.php'; } //-- process POST actions if required if ($tabAction == 'change_template') { $output .= changeTemplate($intType, $_POST['pids'], $_POST['newvalue']); return $output; } elseif($tabAction == 'change_tv') { $output .= changeTemplateVariables($intType, $_POST['pids']); return $output; } elseif ($tabAction == 'pushDocGroup' || $tabAction == 'pullDocGroup' ) { $output.=changeDocGroups($intType, $_POST['pids'],$_POST['newvalue'],$tabAction); return $output; } elseif ((isset($_POST['actionkey'])) && $tabAction == 'sortMenu' || isset($_POST['sortableListsSubmitted']) ) { $output .= ' config['manager_direction'] == 'rtl' ? 'dir="rtl"' : '').' lang="'.$modx->config['manager_lang_attribute'].'" xml:lang="'.$modx->config['manager_lang_attribute'].'"> '; $output.= sortMenu($id); return $output; } elseif ($tabAction == 'changeOther') { $output.= changeOther($intType, $_POST['pids']); return $output; } //-- render tabbed output //--- HEAD $output .= ' config['manager_direction'] == 'rtl' ? 'dir="rtl"' : '').' lang="'.$modx->config['manager_lang_attribute'].'" xml:lang="'.$modx->config['manager_lang_attribute'].'"> '.$_lang['DM_module_title'].' '; $output.= buttonCSS(); $output.='

' . $_lang['DM_module_title'] . '
'; //--- TABS $output.= '
 ' . $_lang['DM_action_title'] . '
'; //--- template $output.= '

' . $_lang['DM_change_template'] . '

'; $output.=showTemplate(); $output.='
'; //--- template variables $output.= '

' . $_lang['DM_template_variables']. '

'; $output.=showTemplateVariables(); $output.='
'; //--- document permissions $output.= '

' . $_lang['DM_doc_permissions']. '

'; $output.=showDocGroups(); $output.='
'; //--- sort menu $output.= '

' . $_lang['DM_sort_menu'] . '

'; $output.= showSortMenu(); $output.='
'; //--- show Other $output.= '

' . $_lang['DM_other'] . '

'; $output.= showOther(); $output.= showAdjustDates(); $output.= showAdjustAuthors(); $output.='
'; $output.= showInteraction($showTree); //-- send output $output.=''; return $output;