extraheader = array('js'=>'', 'css'=>''); $this->footerjs = array(); } /** * Add javascript to an internal array which is output at the * end of the page within a document.ready() function. * * @param string $script javascript to be added */ function addFooterJS($script) { /* {{{ */ $this->footerjs[] = $script; } /* }}} */ function htmlStartPage($title="", $bodyClass="", $base="", $httpheader=array()) { /* {{{ */ if(1 || method_exists($this, 'js')) { /* We still need unsafe-eval, because printDocumentChooserHtml and * printFolderChooserHtml will include a javascript file with ajax * which is evaluated by jquery * worker-src blob: is needed for cytoscape * X-WebKit-CSP is deprecated, Chrome understands Content-Security-Policy * since version 25+ * X-Content-Security-Policy is deprecated, Firefox understands * Content-Security-Policy since version 23+ * 'worker-src blob:' is needed for cytoscape */ $csp_rules = "script-src 'self' 'unsafe-eval';"; $csp_rules .= "worker-src blob:;"; //$csp_rules .= "style-src 'self';"; /* Do not allow to embed myself into frames on foreigns pages */ $csp_rules .= "frame-ancestors 'self';"; foreach (array("X-WebKit-CSP", "X-Content-Security-Policy", "Content-Security-Policy") as $csp) { header($csp . ": " . $csp_rules); } } header('X-Content-Type-Options: nosniff'); header('Strict-Transport-Security: max-age=15768000'); if($httpheader) { foreach($httpheader as $name=>$value) { header($name . ": " . $value); } } $hookObjs = $this->getHookObjects('SeedDMS_View_Bootstrap'); foreach($hookObjs as $hookObj) { if (method_exists($hookObj, 'startPage')) { $hookObj->startPage($this); } } echo "\n"; echo "\n\n"; echo "\n"; echo ''."\n"; if($base) echo ''."\n"; elseif($this->baseurl) echo ''."\n"; $sitename = trim(strip_tags($this->params['sitename'])); if($this->params['session']) echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; // echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; if($this->extraheader['css']) echo $this->extraheader['css']; if(method_exists($this, 'css')) echo ''."\n"; echo ''."\n"; if($this->extraheader['js']) echo $this->extraheader['js']; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; // echo ''."\n"; echo ''."\n"; if($this->params['session'] && $this->params['session']->getSu()) { ?> ".(strlen($sitename)>0 ? $sitename : "SeedDMS").(strlen($title)>0 ? ": " : "").htmlspecialchars($title)."\n"; echo "\n"; echo "0 ? " class=\"".$bodyClass."\"" : "").">\n"; if($this->params['session'] && $flashmsg = $this->params['session']->getSplashMsg()) { $this->params['session']->clearSplashMsg(); echo "
".$flashmsg['msg']."
\n"; } echo "

".getMLText('recent_uploads')."

\n"; foreach($hookObjs as $hookObj) { if (method_exists($hookObj, 'startBody')) { $hookObj->startBody($this); } } } /* }}} */ function htmlAddHeader($head, $type='js') { /* {{{ */ $this->extraheader[$type] .= $head; } /* }}} */ function htmlEndPage($nofooter=false) { /* {{{ */ if(!$nofooter) { $hookObjs = $this->getHookObjects('SeedDMS_View_Bootstrap'); $html = $this->footNote(); foreach($hookObjs as $hookObj) { if (method_exists($hookObj, 'footNote')) { $html = $hookObj->footNote($this, $html); } } echo $html; if($this->params['showmissingtranslations']) { $this->missingLanguageKeys(); } } echo ''."\n"; echo ''."\n"; foreach(array('de', 'es', 'ar', 'el', 'bg', 'ru', 'hr', 'hu', 'ko', 'pl', 'ro', 'sk', 'tr', 'uk', 'ca', 'nl', 'fi', 'cs', 'it', 'fr', 'sv', 'sl', 'pt-BR', 'zh-CN', 'zh-TW') as $lang) echo ''."\n"; echo ''."\n"; echo ''."\n"; parse_str($_SERVER['QUERY_STRING'], $tmp); $tmp['action'] = 'webrootjs'; echo ''."\n"; echo ''."\n"; if($this->params['enablemenutasks'] && isset($this->params['user']) && $this->params['user']) { $this->addFooterJS('checkTasks();'); } if($this->params['enabledropfolderlist'] && isset($this->params['user']) && $this->params['user']) { $this->addFooterJS('updateDropFolder();'); } if($this->footerjs) { $jscode = "$(document).ready(function () {\n"; foreach($this->footerjs as $script) { $jscode .= $script."\n"; } $jscode .= "});\n"; $hashjs = md5($jscode); if(!is_dir($this->params['cachedir'].'/js')) { SeedDMS_Core_File::makeDir($this->params['cachedir'].'/js'); } if(is_dir($this->params['cachedir'].'/js')) { file_put_contents($this->params['cachedir'].'/js/'.$hashjs.'.js', $jscode); } $tmp['action'] = 'footerjs'; $tmp['hash'] = $hashjs; echo ''."\n"; } if(method_exists($this, 'js')) { parse_str($_SERVER['QUERY_STRING'], $tmp); $tmp['action'] = 'js'; echo ''."\n"; } echo "\n\n"; } /* }}} */ function webrootjs() { /* {{{ */ header('Content-Type: application/javascript'); echo "var seeddms_absbaseprefix=\"".$this->params['absbaseprefix']."\";\n"; echo "var seeddms_webroot=\"".$this->params['settings']->_httpRoot."\";\n"; /* Place the current folder id in a js variable, just in case some js code * needs it, e.g. for reloading parts of the page via ajax. */ if(!empty($_REQUEST['folderid'])) echo "var seeddms_folder=".(int) $_REQUEST['folderid'].";\n"; else echo "var seeddms_folder=0;\n"; } /* }}} */ function footerjs() { /* {{{ */ header('Content-Type: application/javascript'); if(file_exists($this->params['cachedir'].'/js/'.$_GET['hash'].'.js')) { readfile($this->params['cachedir'].'/js/'.$_GET['hash'].'.js'); } } /* }}} */ function missingLanguageKeys() { /* {{{ */ global $MISSING_LANG, $LANG; if($MISSING_LANG) { echo '
'."\n"; echo '
'."\n"; echo '
'."\n"; echo "

This page contains missing translations in the selected language. Please help to improve SeedDMS and provide the translation.

"; echo "
"; echo ""; echo "\n"; foreach($MISSING_LANG as $key=>$lang) { echo ""; } echo "
Keyengl. TextYour translation
".$key."".(isset($LANG['en_GB'][$key]) ? $LANG['en_GB'][$key] : '')."
"; echo "
There are missing translations on this page!
Please check the bottom of the page.
\n"; echo "
\n"; echo "
\n"; } } /* }}} */ function footNote() { /* {{{ */ $html = "
\n"; $html .= '
'."\n"; $html .= '
'."\n"; $html .= '
'."\n"; if ($this->params['printdisclaimer']){ $html .= "
".getMLText("disclaimer")."
"; } if (isset($this->params['footnote']) && strlen((string)$this->params['footnote'])>0) { $html .= "
".(string)$this->params['footnote']."
"; } $html .= "
\n"; $html .= "
\n"; $html .= "
\n"; $html .= "
\n"; return $html; } /* }}} */ function contentStart() { /* {{{ */ echo "
\n"; echo "
\n"; } /* }}} */ function contentEnd() { /* {{{ */ echo "
\n"; echo "
\n"; } /* }}} */ function globalBanner() { /* {{{ */ echo "
\n"; echo " \n"; echo "
\n"; } /* }}} */ function globalNavigation($folder=null) { /* {{{ */ $dms = $this->params['dms']; echo "
\n"; echo "
\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " params['rootfolderid']."\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."\n"; if(isset($this->params['user']) && $this->params['user']) { echo "
\n"; echo " \n"; if($this->params['enablemenutasks'] && !$this->params['user']->isGuest()) { echo "
"; echo "
"; // echo "
    \n"; // echo "
  • \n"; // echo $this->menuTasks(array('review'=>array(), 'approval'=>array(), 'receipt'=>array(), 'revision'=>array())); // echo "
  • \n"; // echo "
\n"; echo "
"; //$this->addFooterJS('checkTasks();'); } if($this->params['dropfolderdir'] && $this->params['enabledropfolderlist']) { echo "
"; echo "
isType('folder')) echo " data-query=\"folderid=".$folder->getID()."\""; echo ">
"; echo "
"; } if($this->params['enablesessionlist']) { echo "
"; echo "
"; echo "
"; } if($this->params['enableclipboard']) { echo "
"; echo "
getID() : 0)."\">
"; echo "
"; } echo "
    \n"; $menuitems = array(); if ($this->params['enablecalendar']) $menuitems['calendar'] = array('link'=>'../out/out.Calendar.php?mode='.$this->params['calendardefaultview'], 'label'=>"calendar"); if ($this->params['user']->isAdmin()) $menuitems['admintools'] = array('link'=>'../out/out.AdminTools.php', 'label'=>"admin_tools"); if($this->params['enablehelp']) { $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $menuitems['help'] = array('link'=>'../out/out.Help.php?context='.$tmp[1], 'label'=>"help"); } /* Check if hook exists because otherwise callHook() will override $menuitems */ foreach($hookObjs as $hookObj) { if (method_exists($hookObj, 'globalNavigationBar')) { $menuitems = $hookObj->globalNavigationBar($this, $menuitems); } } foreach($menuitems as $menuitem) { if(!empty($menuitem['children'])) { echo "
  • \n"; echo " ".getMLText($menuitem['label'])." \n"; echo " \n"; } else { echo "
  • ".getMLText($menuitem['label'])."
  • "; } } echo "
\n"; echo "
"; if ($folder!=null && is_object($folder) && $folder->isType('folder')) { echo " getID()."\" />"; } echo " "; echo " params['defaultsearchmethod'] == 'fulltext' ? "" : "id=\"searchfield\"")." data-provide=\"typeahead\" type=\"search\" style=\"width: 150px;\" placeholder=\"".getMLText("search")."\"/>"; if($this->params['defaultsearchmethod'] == 'fulltext') echo " "; // if($this->params['enablefullsearch']) { // echo " "; // } // echo " "; echo "
\n"; echo "
\n"; } echo "
\n"; echo "
\n"; echo "
\n"; return; } /* }}} */ function getFolderPathHTML($folder, $tagAll=false, $document=null) { /* {{{ */ $path = $folder->getPath(); $txtpath = ""; for ($i = 0; $i < count($path); $i++) { $txtpath .= "
  • "; if ($i +1 < count($path)) { $txtpath .= "getID()."&showtree=".showtree()."\" data-droptarget=\"folder_".$path[$i]->getID()."\" rel=\"folder_".$path[$i]->getID()."\" class=\"table-row-folder droptarget\" data-uploadformtoken=\"".createFormKey('')."\" formtoken=\"".createFormKey('')."\">". htmlspecialchars($path[$i]->getName()).""; } else { $txtpath .= ($tagAll ? "getID()."&showtree=".showtree()."\">". htmlspecialchars($path[$i]->getName())."" : htmlspecialchars($path[$i]->getName())); } $txtpath .= " /
  • "; } if($document) $txtpath .= "
  • getId()."\">".htmlspecialchars($document->getName())."
  • "; return ''; } /* }}} */ function pageNavigation($pageTitle, $pageType=null, $extra=null) { /* {{{ */ if ($pageType!=null && strcasecmp($pageType, "noNav")) { echo "
    \n"; echo "
    \n"; echo "
    \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; switch ($pageType) { case "view_folder": $this->folderNavigationBar($extra); break; case "view_document": $this->documentNavigationBar($extra); break; case "my_documents": $this->myDocumentsNavigationBar(); break; case "my_account": $this->accountNavigationBar(); break; case "admin_tools": $this->adminToolsNavigationBar(); break; case "calendarold"; $this->calendarOldNavigationBar($extra); break; case "calendar"; $this->calendarNavigationBar($extra); break; default: if($this->hasHook('pageNavigationBar')) { $menubar = $this->callHook('pageNavigationBar', $pageType, $extra); if(is_string($menubar)) echo $menubar; } } echo "
    \n"; echo "
    \n"; echo "
    \n"; if($pageType == "view_folder" || $pageType == "view_document") echo $pageTitle."\n"; } else { echo "".$pageTitle."\n"; } return; } /* }}} */ protected function showNavigationBar($menuitems) { /* {{{ */ foreach($menuitems as $menuitem) { if(!empty($menuitem['children'])) { echo "
  • \n"; echo " ".getMLText($menuitem['label'])." \n"; echo " \n"; } else { echo "
  • ".getMLText($menuitem['label'])."
  • "; } } } /* }}} */ private function folderNavigationBar($folder) { /* {{{ */ $dms = $this->params['dms']; if (!is_object($folder) || !$folder->isType('folder')) { echo "\n"; return; } $accessMode = $folder->getAccessMode($this->params['user']); $folderID = $folder->getID(); echo "".getMLText("folder")."\n"; echo "
    \n"; echo "
      \n"; $menuitems = array(); if ($accessMode == M_READ && !$this->params['user']->isGuest()) { $menuitems['edit_folder_notify'] = array('link'=>"../out/out.FolderNotify.php?folderid=".$folderID."&showtree=".showtree(), 'label'=>'edit_folder_notify'); } else if ($accessMode >= M_READWRITE) { $menuitems['add_subfolder'] = array('link'=>"../out/out.AddSubFolder.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>'add_subfolder'); $menuitems['add_document'] = array('link'=>"../out/out.AddDocument.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>'add_document'); if(0 && $this->params['enablelargefileupload']) $menuitems['add_multiple_documents'] = array('link'=>"../out/out.AddMultiDocument.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>'add_multiple_documents'); $menuitems['edit_folder_props'] = array('link'=>"../out/out.EditFolder.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>'edit_folder_props'); if ($folderID != $this->params['rootfolderid'] && $folder->getParent()) $menuitems['move_folder'] = array('link'=>"../out/out.MoveFolder.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>'move_folder'); if ($accessMode == M_ALL) { if ($folderID != $this->params['rootfolderid'] && $folder->getParent()) $menuitems['rm_folder'] = array('link'=>"../out/out.RemoveFolder.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>'rm_folder'); } if ($accessMode == M_ALL) { $menuitems['edit_folder_access'] = array('link'=>"../out/out.FolderAccess.php?folderid=".$folderID."&showtree=".showtree(), 'label'=>'edit_folder_access'); } $menuitems['edit_existing_notify'] = array('link'=>"../out/out.FolderNotify.php?folderid=". $folderID ."&showtree=". showtree(), 'label'=>'edit_existing_notify'); } if ($this->params['user']->isAdmin() && $this->params['enablefullsearch']) { $menuitems['index_folder'] = array('link'=>"../out/out.Indexer.php?folderid=". $folderID."&showtree=".showtree(), 'label'=>'index_folder'); } /* Check if hook exists because otherwise callHook() will override $menuitems */ if($this->hasHook('folderNavigationBar')) $menuitems = $this->callHook('folderNavigationBar', $folder, $menuitems); self::showNavigationBar($menuitems); echo "
    \n"; echo "
    \n"; return; } /* }}} */ private function documentNavigationBar($document) { /* {{{ */ $accessMode = $document->getAccessMode($this->params['user']); $docid=".php?documentid=" . $document->getID(); echo "".getMLText("document")."\n"; echo "
    \n"; echo "
      \n"; $menuitems = array(); if ($accessMode >= M_READWRITE) { if (!$document->isLocked()) { $menuitems['update_document'] = array('link'=>"../out/out.UpdateDocument".$docid, 'label'=>'update_document'); $menuitems['lock_document'] = array('link'=>"../op/op.LockDocument".$docid, 'label'=>'lock_document'); $menuitems['edit_document_props'] = array('link'=>"../out/out.EditDocument".$docid , 'label'=>'edit_document_props'); $menuitems['move_document'] = array('link'=>"../out/out.MoveDocument".$docid, 'label'=>'move_document'); } else { $lockingUser = $document->getLockingUser(); if (($lockingUser->getID() == $this->params['user']->getID()) || ($document->getAccessMode($this->params['user']) == M_ALL)) { $menuitems['update_document'] = array('link'=>"../out/out.UpdateDocument".$docid, 'label'=>'update_document'); $menuitems['unlock_document'] = array('link'=>"../op/op.UnlockDocument".$docid, 'label'=>'unlock_document'); $menuitems['edit_document_props'] = array('link'=>"../out/out.EditDocument".$docid, 'label'=>'edit_document_props'); $menuitems['move_document'] = array('link'=>"../out/out.MoveDocument".$docid, 'label'=>'move_document'); } } if($this->params['accessobject']->maySetExpires()) { $menuitems['expires'] = array('link'=>"../out/out.SetExpires".$docid, 'label'=>'expires'); } } if ($accessMode == M_ALL) { $menuitems['rm_document'] = array('link'=>"../out/out.RemoveDocument".$docid, 'label'=>'rm_document'); $menuitems['edit_document_access'] = array('link'=>"../out/out.DocumentAccess". $docid, 'label'=>'edit_document_access'); } if ($accessMode >= M_READ && !$this->params['user']->isGuest()) { $menuitems['edit_existing_notify'] = array('link'=>"../out/out.DocumentNotify". $docid, 'label'=>'edit_existing_notify'); } if ($this->params['user']->isAdmin()) { $menuitems['transfer_document'] = array('link'=>"../out/out.TransferDocument". $docid, 'label'=>'transfer_document'); } /* Check if hook exists because otherwise callHook() will override $menuitems */ if($this->hasHook('documentNavigationBar')) $menuitems = $this->callHook('documentNavigationBar', $document, $menuitems); /* Do not use $this->callHook() because $menuitems must be returned by the hook * or left unchanged */ /* $hookObjs = $this->getHookObjects(); foreach($hookObjs as $hookObj) { if (method_exists($hookObj, 'documentNavigationBar')) { $menuitems = $hookObj->documentNavigationBar($this, $document, $menuitems); } } */ self::showNavigationBar($menuitems); echo "
    \n"; echo "
    \n"; return; } /* }}} */ private function accountNavigationBar() { /* {{{ */ echo "".getMLText("my_account")."\n"; echo "
    \n"; echo "
      \n"; $menuitems = array(); if ($this->params['user']->isAdmin() || !$this->params['disableselfedit']) $menuitems['edit_user_details'] = array('link'=>"../out/out.EditUserData.php", 'label'=>'edit_user_details'); if (!$this->params['user']->isAdmin()) $menuitems['edit_default_keywords'] = array('link'=>"../out/out.UserDefaultKeywords.php", 'label'=>'edit_default_keywords'); $menuitems['edit_notify'] = array('link'=>"../out/out.ManageNotify.php", 'label'=>'edit_existing_notify'); if ($this->params['enableusersview']){ $menuitems['users'] = array('link'=>"../out/out.UsrView.php", 'label'=>'users'); $menuitems['groups'] = array('link'=>"../out/out.GroupView.php", 'label'=>'groups'); } /* Check if hook exists because otherwise callHook() will override $menuitems */ if($this->hasHook('accountNavigationBar')) $menuitems = $this->callHook('accountNavigationBar', $menuitems); self::showNavigationBar($menuitems); echo "
    \n"; echo "
    \n"; return; } /* }}} */ private function myDocumentsNavigationBar() { /* {{{ */ echo "".getMLText("my_documents")."\n"; echo "
    \n"; echo "
      \n"; $menuitems = array(); $menuitems['inprocess'] = array('link'=>"../out/out.MyDocuments.php?inProcess=1", 'label'=>'documents_in_process'); $menuitems['all_documents'] = array('link'=>"../out/out.MyDocuments.php", 'label'=>'all_documents'); if($this->params['workflowmode'] == 'traditional' || $this->params['workflowmode'] == 'traditional_only_approval') { $menuitems['review_summary'] = array('link'=>"../out/out.ReviewSummary.php", 'label'=>'review_summary'); $menuitems['approval_summary'] = array('link'=>"../out/out.ApprovalSummary.php", 'label'=>'approval_summary'); } else { $menuitems['workflow_summary'] = array('link'=>"../out/out.WorkflowSummary.php", 'label'=>'workflow_summary'); } /* Check if hook exists because otherwise callHook() will override $menuitems */ if($this->hasHook('mydocumentsNavigationBar')) $menuitems = $this->callHook('mydocumentsNavigationBar', $menuitems); self::showNavigationBar($menuitems); echo "
    \n"; echo "
    \n"; return; } /* }}} */ private function adminToolsNavigationBar() { /* {{{ */ echo " ".getMLText("admin_tools")."\n"; echo "
    \n"; echo "
      \n"; $menuitems = array(); $menuitems['user_group_management'] = array('link'=>"#", 'label'=>'user_group_management'); $menuitems['user_group_management']['children']['user_management'] = array('link'=>"../out/out.UsrMgr.php", 'label'=>'user_management'); $menuitems['user_group_management']['children']['group_management'] = array('link'=>"../out/out.GroupMgr.php", 'label'=>'group_management'); $menuitems['user_group_management']['children']['user_list'] = array('link'=>"../out/out.UserList.php", 'label'=>'user_list'); $menuitems['definitions'] = array('link'=>"#", 'label'=>'definitions'); $menuitems['definitions']['children']['default_keywords'] = array('link'=>"../out/out.DefaultKeywords.php", 'label'=>'global_default_keywords'); $menuitems['definitions']['children']['document_categories'] = array('link'=>"../out/out.Categories.php", 'label'=>'global_document_categories'); $menuitems['definitions']['children']['attribute_definitions'] = array('link'=>"../out/out.AttributeMgr.php", 'label'=>'global_attributedefinitions'); if($this->params['workflowmode'] == 'advanced') { $menuitems['definitions']['children']['workflows'] = array('link'=>"../out/out.WorkflowMgr.php", 'label'=>'global_workflows'); $menuitems['definitions']['children']['workflow_states'] = array('link'=>"../out/out.WorkflowStatesMgr.php", 'label'=>'global_workflow_states'); $menuitems['definitions']['children']['workflow_actions'] = array('link'=>"../out/out.WorkflowActionsMgr.php", 'label'=>'global_workflow_actions'); } if($this->params['enablefullsearch']) { $menuitems['fulltext'] = array('link'=>"#", 'label'=>'fullsearch'); $menuitems['fulltext']['children']['update_fulltext_index'] = array('link'=>"../out/out.Indexer.php", 'label'=>'update_fulltext_index'); $menuitems['fulltext']['children']['create_fulltext_index'] = array('link'=>"../out/out.CreateIndex.php", 'label'=>'create_fulltext_index'); $menuitems['fulltext']['children']['fulltext_info'] = array('link'=>"../out/out.IndexInfo.php", 'label'=>'fulltext_info'); } $menuitems['backup_log_management'] = array('link'=>"#", 'label'=>'backup_log_management'); $menuitems['backup_log_management']['children'][] = array('link'=>"../out/out.BackupTools.php", 'label'=>'backup_tools'); if ($this->params['logfileenable']) $menuitems['backup_log_management']['children'][] = array('link'=>"../out/out.LogManagement.php", 'label'=>'log_management'); $menuitems['misc'] = array('link'=>"#", 'label'=>'misc'); $menuitems['misc']['children']['import_fs'] = array('link'=>"../out/out.ImportFS.php", 'label'=>'import_fs'); $menuitems['misc']['children']['folders_and_documents_statistic'] = array('link'=>"../out/out.Statistic.php", 'label'=>'folders_and_documents_statistic'); $menuitems['misc']['children']['charts'] = array('link'=>"../out/out.Charts.php", 'label'=>'charts'); $menuitems['misc']['children']['timeline'] = array('link'=>"../out/out.Timeline.php", 'label'=>'timeline'); $menuitems['misc']['children']['objectcheck'] = array('link'=>"../out/out.ObjectCheck.php", 'label'=>'objectcheck'); $menuitems['misc']['children']['documents_expired'] = array('link'=>"../out/out.ExpiredDocuments.php", 'label'=>'documents_expired'); $menuitems['misc']['children']['extension_manager'] = array('link'=>"../out/out.ExtensionMgr.php", 'label'=>'extension_manager'); $menuitems['misc']['children']['clear_cache'] = array('link'=>"../out/out.ClearCache.php", 'label'=>'clear_cache'); $menuitems['misc']['children']['version_info'] = array('link'=>"../out/out.Info.php", 'label'=>'version_info'); /* Check if hook exists because otherwise callHook() will override $menuitems */ if($this->hasHook('admintoolsNavigationBar')) $menuitems = $this->callHook('admintoolsNavigationBar', $menuitems); self::showNavigationBar($menuitems); echo "
    \n"; echo "
      \n"; echo "
    \n"; echo "
    \n"; return; } /* }}} */ private function calendarOldNavigationBar($d){ /* {{{ */ $ds="&day=".$d[0]."&month=".$d[1]."&year=".$d[2]; echo "".getMLText("calendar")."\n"; echo "
    \n"; echo "\n"; echo "
    \n"; return; } /* }}} */ private function calendarNavigationBar($d){ /* {{{ */ echo "".getMLText("calendar")."\n"; echo "
    \n"; echo "
      \n"; $menuitems = array(); if (!$this->params['user']->isGuest()) $menuitems['addevent'] = array('link'=>"../out/out.AddEvent.php", 'label'=>'add_event'); /* Check if hook exists because otherwise callHook() will override $menuitems */ if($this->hasHook('calendarNavigationBar')) $menuitems = $this->callHook('calendarNavigationBar', $menuitems); self::showNavigationBar($menuitems); echo "
    \n"; echo "
    \n"; return; } /* }}} */ function pageList($pageNumber, $totalPages, $baseURI, $params) { /* {{{ */ $maxpages = 25; // skip pages when more than this is shown $range = 5; // pages left and right of current page if (!is_numeric($pageNumber) || !is_numeric($totalPages) || $totalPages<2) { return; } // Construct the basic URI based on the $_GET array. One could use a // regular expression to strip out the pg (page number) variable to // achieve the same effect. This seems to be less haphazard though... $resultsURI = $baseURI; $first=true; foreach ($params as $key=>$value) { // Don't include the page number in the basic URI. This is added in // during the list display loop. if (!strcasecmp($key, "pg")) { continue; } if (is_array($value)) { foreach ($value as $subkey=>$subvalue) { $resultsURI .= ($first ? "?" : "&").$key."%5B".$subkey."%5D=".urlencode($subvalue); $first = false; } } else { $resultsURI .= ($first ? "?" : "&").$key."=".urlencode($value); } $first = false; } echo "
    "; echo "
      "; if($totalPages <= $maxpages) { for ($i = 1; $i <= $totalPages; $i++) { echo "
    • ".$i."
    • "; } } else { if($pageNumber-$range > 1) $start = $pageNumber-$range; else $start = 2; if($pageNumber+$range < $totalPages) $end = $pageNumber+$range; else $end = $totalPages-1; /* Move start or end to always show 2*$range items */ $diff = $end-$start-2*$range; if($diff < 0) { if($start > 2) $start += $diff; if($end < $totalPages-1) $end -= $diff; } if($pageNumber > 1) echo "
    • «
    • "; echo "
    • 1
    • "; if($start > 2) echo "
    • ...
    • "; for($j=$start; $j<=$end; $j++) echo "
    • ".$j."
    • "; if($end < $totalPages-1) echo "
    • ...
    • "; if($end < $totalPages) echo "
    • ".$totalPages."
    • "; if($pageNumber < $totalPages) echo "
    • »
    • "; } if ($totalPages>1) { echo "
    • ".getMLText("all_pages")."
    • "; } echo "
    "; echo "
    "; return; } /* }}} */ function contentContainer($content) { /* {{{ */ echo "
    \n"; echo $content; echo "
    \n"; return; } /* }}} */ function contentContainerStart($class='', $id='') { /* {{{ */ echo "
    \n"; return; } /* }}} */ function contentContainerEnd() { /* {{{ */ echo "
    \n"; return; } /* }}} */ function contentHeading($heading, $noescape=false) { /* {{{ */ if($noescape) echo "".$heading."\n"; else echo "".htmlspecialchars($heading)."\n"; return; } /* }}} */ function contentSubHeading($heading, $first=false) { /* {{{ */ // echo "
    ".htmlspecialchars($heading)."
    \n"; echo "
    ".$heading."
    "; return; } /* }}} */ function formField($title, $value, $params=array()) { /* {{{ */ if($title !== null) { echo "
    "; echo " "; echo "
    "; } if(isset($params['field_wrap'][0])) echo $params['field_wrap'][0]; if(is_string($value)) { echo $value; } elseif(is_array($value)) { switch($value['element']) { case 'select': echo '"; if(isset($value['options']) && is_array($value['options'])) { foreach($value['options'] as $val) { echo ''; } } echo ''; break; case 'textarea': echo '".(!empty($value['value']) ? $value['value'] : '').""; break; case 'input': default: echo '"; break; } } if(isset($params['field_wrap'][1])) echo $params['field_wrap'][1]; if($title !== null) { echo "
    "; echo "
    "; } return; } /* }}} */ function formSubmit($value, $name='') { /* {{{ */ echo "
    \n"; echo "\n"; echo "
    \n"; } /* }}} */ function getMimeIcon($fileType) { /* {{{ */ // for extension use LOWER CASE only $icons = array(); $icons["txt"] = "text-x-preview.svg"; $icons["text"] = "text-x-preview.svg"; $icons["tex"] = "text-x-preview.svg"; $icons["doc"] = "office-document.svg"; $icons["dot"] = "office-document.svg"; $icons["docx"] = "office-document.svg"; $icons["dotx"] = "office-document.svg"; $icons["rtf"] = "office-document.svg"; $icons["xls"] = "office-spreadsheet.svg"; $icons["xlt"] = "office-spreadsheet.svg"; $icons["xlsx"] = "office-spreadsheet.svg"; $icons["xltx"] = "office-spreadsheet.svg"; $icons["ppt"] = "office-presentation.svg"; $icons["pot"] = "office-presentation.svg"; $icons["pptx"] = "office-presentation.svg"; $icons["potx"] = "office-presentation.svg"; $icons["exe"] = "executable.svg"; $icons["html"] = "web.svg"; $icons["htm"] = "web.svg"; $icons["gif"] = "image.svg"; $icons["jpg"] = "image.svg"; $icons["jpeg"] = "image.svg"; $icons["bmp"] = "image.svg"; $icons["png"] = "image.svg"; $icons["tif"] = "image.svg"; $icons["tiff"] = "image.svg"; $icons["log"] = "text-x-preview.svg"; $icons["midi"] = "audio.svg"; $icons["pdf"] = "gnome-mime-application-pdf.svg"; $icons["wav"] = "audio.svg"; $icons["mp3"] = "audio.svg"; $icons["opus"] = "audio.svg"; $icons["c"] = "text-x-preview.svg"; $icons["cpp"] = "text-x-preview.svg"; $icons["h"] = "text-x-preview.svg"; $icons["java"] = "text-x-preview.svg"; $icons["py"] = "text-x-preview.svg"; $icons["tar"] = "package.svg"; $icons["gz"] = "package.svg"; $icons["7z"] = "package.svg"; $icons["bz"] = "package.svg"; $icons["bz2"] = "package.svg"; $icons["tgz"] = "package.svg"; $icons["zip"] = "package.svg"; $icons["rar"] = "package.svg"; $icons["mpg"] = "video.svg"; $icons["avi"] = "video.svg"; $icons["webm"] = "video.svg"; $icons["mkv"] = "video.svg"; $icons["ods"] = "office-spreadsheet.svg"; $icons["ots"] = "office-spreadsheet.svg"; $icons["sxc"] = "office-spreadsheet.svg"; $icons["stc"] = "office-spreadsheet.svg"; $icons["odt"] = "office-document.svg"; $icons["ott"] = "office-document.svg"; $icons["sxw"] = "office-document.svg"; $icons["stw"] = "office-document.svg"; $icons["odp"] = "office-presentation.svg"; $icons["otp"] = "office-presentation.svg"; $icons["sxi"] = "office-presentation.svg"; $icons["sti"] = "office-presentation.svg"; $icons["odg"] = "office-drawing.svg"; $icons["otg"] = "office-drawing.svg"; $icons["sxd"] = "office-drawing.svg"; $icons["std"] = "office-drawing.svg"; $icons["odf"] = "ooo_formula.png"; $icons["sxm"] = "ooo_formula.png"; $icons["smf"] = "ooo_formula.png"; $icons["mml"] = "ooo_formula.png"; $icons["folder"] = "folder.svg"; $icons["default"] = "text-x-preview.svg"; //"default.png"; $ext = strtolower(substr($fileType, 1)); if (isset($icons[$ext])) { return $this->imgpath.$icons[$ext]; } else { return $this->imgpath.$icons["default"]; } } /* }}} */ function printFileChooserJs() { /* {{{ */ ?> $(document).ready(function() { $(document).on('change', '.btn-file :file', function() { var input = $(this), numFiles = input.get(0).files ? input.get(0).files.length : 1, label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); input.trigger('fileselect', [numFiles, label]); }); $(document).on('fileselect', '.upload-file .btn-file :file', function(event, numFiles, label) { var input = $(this).parents('.input-append').find(':text'), log = numFiles > 1 ? numFiles + ' files selected' : label; if( input.length ) { input.val(log); } else { // if( log ) alert(log); } }); });
    '.getMLText("browse").'…
    '; return $html; } /* }}} */ function printFileChooser($varname='userfile', $multiple=false, $accept='') { /* {{{ */ echo self::getFileChooserHtml($varname, $multiple, $accept); } /* }}} */ function printDateChooser($defDate = '', $varName, $lang='', $dateformat='yyyy-mm-dd') { /* {{{ */ echo self::getDateChooser($defDate, $varName, $lang, $dateformat); } /* }}} */ function getDateChooser($defDate = '', $varName, $lang='', $dateformat='yyyy-mm-dd') { /* {{{ */ $content = ' '; return $content; } /* }}} */ function __printDateChooser($defDate = -1, $varName) { /* {{{ */ if ($defDate == -1) $defDate = mktime(); $day = date("d", $defDate); $month = date("m", $defDate); $year = date("Y", $defDate); print " \n"; print " \n"; print ""; } /* }}} */ function printSequenceChooser($objArr, $keepID = -1) { /* {{{ */ echo $this->getSequenceChooser($objArr, $keepID); } /* }}} */ function getSequenceChooser($objArr, $keepID = -1) { /* {{{ */ if (count($objArr) > 0) { $max = $objArr[count($objArr)-1]->getSequence() + 1; $min = $objArr[0]->getSequence() - 1; } else { $max = 1.0; } $content = ""; return $content; } /* }}} */ function getDocumentChooserHtml($formName) { /* {{{ */ $content = ''; $content .= ""; $content .= "\n"; $content .= ' '; return $content; } /* }}} */ function printDocumentChooserHtml($formName) { /* {{{ */ echo self::getDocumentChooserHtml($formName); } /* }}} */ function printDocumentChooserJs($formName) { /* {{{ */ ?> function documentSelected(id, name) { $('#docid').val(id); $('#choosedocsearch').val(name); $('#docChooser').modal('hide'); } function folderSelected(id, name) { } printDocumentChooserHtml($formName); ?> getID() : "") ."\">"; $content .= "
    \n"; $content .= "getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" target=\"".$formid."\"/>"; $content .= ""; $content .= "".getMLText("folder")."…\n"; $content .= "
    \n"; $content .= ' '; return $content; } /* }}} */ function printFolderChooserHtml($form, $accessMode, $exclude = -1, $default = false, $formname = '') { /* {{{ */ echo self::getFolderChooserHtml($form, $accessMode, $exclude, $default, $formname); } /* }}} */ function printFolderChooserJs($form) { /* {{{ */ ?> function folderSelected(id, name) { $('#targetid').val(id); $('#choosefoldersearch').val(name); $('#folderChooser').modal('hide'); } $(document).ready(function() { $('#clearfolder').click(function(ev) { $('#choosefoldersearch').val(''); $('#targetid').val(''); }); }); printFolderChooserHtml($form, $accessMode, $exclude, $default, $formname); ?> getId(); $names[] = htmlspecialchars($cat->getName()); } } print ""; print "
    \n"; print ""; print ""; print "".getMLText("category")."…\n"; print "
    \n"; ?> params['strictformcheck']; $content = ''; $content .= ' '; return $content; } /* }}} */ function printKeywordChooserJs($formName) { /* {{{ */ ?> $(document).ready(function() { $('#acceptkeywords').click(function(ev) { acceptKeywords(); }); }); printKeywordChooserHtml($formName, $keywords, $fieldname); ?> getType()) { case SeedDMS_Core_AttributeDefinition::type_boolean: $content .= "getId()."]\" value=\"\" />"; $content .= "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"1\" ".(($attribute && $attribute->getValue()) ? 'checked' : '')." />"; break; case SeedDMS_Core_AttributeDefinition::type_date: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; $content .= ' '; break; case SeedDMS_Core_AttributeDefinition::type_email: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; $content .= "getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').' data-rule-email="true"'." />"; break; case SeedDMS_Core_AttributeDefinition::type_float: $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; $content .= "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '')." data-rule-number=\"true\"/>"; break; default: if($valueset = $attrdef->getValueSetAsArray()) { $content .= "getId()."]\" value=\"\"/>"; $content .= ""; } else { $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : ''; if(strlen($objvalue) > 80) { $content .= ""; } else { $content .= "getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"".htmlspecialchars($objvalue)."\"".((!$norequire && $attrdef->getMinValues() > 0) ? ' required' : '').($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_int ? ' data-rule-digits="true"' : '')." />"; } } break; } return $content; } /* }}} */ function printDropFolderChooserHtml($formName, $dropfolderfile="", $showfolders=0) { /* {{{ */ echo self::getDropFolderChooserHtml($formName, $dropfolderfile, $showfolders); } /* }}} */ function getDropFolderChooserHtml($formName, $dropfolderfile="", $showfolders=0) { /* {{{ */ $content = "
    \n"; $content .= ""; $content .= ""; $content .= "".($showfolders ? getMLText("choose_target_folder"): getMLText("choose_target_file"))."…\n"; $content .= "
    \n"; $content .= ' '; return $content; } /* }}} */ function printDropFolderChooserJs($formName, $showfolders=0) { /* {{{ */ ?> /* Set up a callback which is called when a folder in the tree is selected */ modalDropfolderChooser = $('#dropfolderChooser'); function fileSelected(name, form) { // $('#dropfolderfile').val(name); $('#dropfolderfile'+form).val(name); modalDropfolderChooser.modal('hide'); } function folderSelected(name, form) { // $('#dropfolderfile').val(name); $('#dropfolderfile'+form).val(name); modalDropfolderChooser.modal('hide'); } $(document).ready(function() { $('#clearfilename').click(function(ev) { $('#dropfolderfile').val(''); }); }); printDropFolderChooserHtml($formName, $dropfolderfile, $showfolders); ?> imgpath.$img) ) { return $this->imgpath.$img; // } return ""; } /* }}} */ function getCountryFlag($lang) { /* {{{ */ switch($lang) { case "en_GB": return 'flags/gb.png'; break; default: return 'flags/'.substr($lang, 0, 2).'.png'; } } /* }}} */ function printImgPath($img) { /* {{{ */ print $this->getImgPath($img); } /* }}} */ function infoMsg($msg) { /* {{{ */ echo "
    \n"; echo $msg; echo "
    \n"; } /* }}} */ function warningMsg($msg) { /* {{{ */ echo "
    \n"; echo $msg; echo "
    \n"; } /* }}} */ function errorMsg($msg) { /* {{{ */ echo "
    \n"; echo $msg; echo "
    \n"; } /* }}} */ function successMsg($msg) { /* {{{ */ echo "
    \n"; echo $msg; echo "
    \n"; } /* }}} */ function ___exitError($pagetitle, $error, $noexit=false, $plain=false) { /* {{{ */ /* This is just a hack to prevent creation of js files in an error * case, because they will contain this error page again. It would be much * better, if there was extra error() function similar to show() and calling * $view() after setting the action to 'error'. This would also allow to * set separate error pages for each view. */ if(!$noexit && isset($_REQUEST['action'])) { if(in_array($_REQUEST['action'], array('js', 'footerjs'))) { exit; } if($_REQUEST['action'] == 'webrootjs') { $this->webrootjs(); exit; } } if(!$plain) { $this->htmlStartPage($pagetitle); $this->globalNavigation(); $this->contentStart(); } print "
    "; print "

    ".getMLText('error')."!

    "; print htmlspecialchars($error); print "
    "; print "
    "; $this->contentEnd(); $this->htmlEndPage(); add_log_line(" UI::exitError error=".$error." pagetitle=".$pagetitle, PEAR_LOG_ERR); if($noexit) return; exit; } /* }}} */ function printNewTreeNavigation($folderid=0, $accessmode=M_READ, $showdocs=0, $formid='form1', $expandtree=0, $orderby='') { /* {{{ */ $this->printNewTreeNavigationHtml($folderid, $accessmode, $showdocs, $formid, $expandtree, $orderby); ?> \n"; echo "
    \n"; } /* }}} */ /** * Create a tree of folders using jqtree. * * The tree can contain folders only or include documents. * * @param integer $folderid current folderid. If set the tree will be * folded out and the all folders in the path will be visible * @param integer $accessmode use this access mode when retrieving folders * and documents shown in the tree * @param boolean $showdocs set to true if tree shall contain documents * as well. * @param integer $expandtree level to which the tree shall be opened * @param boolean $partialtree set to true if the given folder is the start folder */ function printNewTreeNavigationJs($folderid=0, $accessmode=M_READ, $showdocs=0, $formid='form1', $expandtree=0, $orderby='', $partialtree=false) { /* {{{ */ function jqtree($path, $folder, $user, $accessmode, $showdocs=1, $expandtree=0, $orderby='', $level=0) { /* {{{ */ $orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc'); if($path/* || $expandtree>=$level*/) { if($path) $pathfolder = array_shift($path); $children = array(); if($expandtree) { $subfolders = $folder->getSubFolders(isset($orderby[0]) ? $orderby[0] : '', $orderdir); $subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, $accessmode); } else { $subfolders = array($pathfolder); } foreach($subfolders as $subfolder) { $node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>(1 && ($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs))) ? true : false, 'is_folder'=>true); if(/*$expandtree>=$level ||*/ $pathfolder->getID() == $subfolder->getID()) { $node['children'] = jqtree($path, $subfolder, $user, $accessmode, $showdocs, $expandtree, $orderby, $level+1); if($showdocs) { $documents = $subfolder->getDocuments(isset($orderby[0]) ? $orderby[0] : '', $orderdir); $documents = SeedDMS_Core_DMS::filterAccess($documents, $user, $accessmode); foreach($documents as $document) { $node2 = array('label'=>$document->getName(), 'id'=>$document->getID(), 'load_on_demand'=>false, 'is_folder'=>false); $node['children'][] = $node2; } } } $children[] = $node; } return $children; } else { $subfolders = $folder->getSubFolders(isset($orderby[0]) ? $orderby[0] : '', $orderdir); $subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, $accessmode); $children = array(); foreach($subfolders as $subfolder) { $node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs)) ? true : false, 'is_folder'=>true); $children[] = $node; } return $children; } return array(); } /* }}} */ $orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc'); if($folderid) { $folder = $this->params['dms']->getFolder($folderid); if(!$partialtree) { $path = $folder->getPath(); } /* Get the first folder (root folder) of path */ $folder = array_shift($path); $node = array('label'=>$folder->getName(), 'id'=>$folder->getID(), 'load_on_demand'=>false, 'is_folder'=>true); if(!$folder->hasSubFolders()) { $node['load_on_demand'] = true; $node['children'] = array(); } else { $node['children'] = jqtree($path, $folder, $this->params['user'], $accessmode, $showdocs, 1 /*$expandtree*/, $orderby, 0); if($showdocs) { $documents = $folder->getDocuments(isset($orderby[0]) ? $orderby[0] : '', $orderdir); $documents = SeedDMS_Core_DMS::filterAccess($documents, $this->params['user'], $accessmode); foreach($documents as $document) { $node2 = array('label'=>$document->getName(), 'id'=>$document->getID(), 'load_on_demand'=>false, 'is_folder'=>false); $node['children'][] = $node2; } } } /* Nasty hack to remove the highest folder */ if(isset($this->params['remove_root_from_tree']) && $this->params['remove_root_from_tree']) { foreach($node['children'] as $n) $tree[] = $n; } else { $tree[] = $node; } } else { $root = $this->params['dms']->getFolder($this->params['rootfolderid']); $tree = array(array('label'=>$root->getName(), 'id'=>$root->getID(), 'load_on_demand'=>false, 'is_folder'=>true)); } ?> var data = ; $(function() { const $tree = $('#jqtree'); $tree.tree({ // saveState: false, selectable: true, data: data, saveState: 'jqtree', openedIcon: $(''), closedIcon: $(''), _onCanSelectNode: function(node) { if(node.is_folder) { folderSelected(node.id, node.name); } else documentSelected(node.id, node.name); }, autoOpen: false, drapAndDrop: true, onCreateLi: function(node, $li) { // Add 'icon' span before title if(node.is_folder) $li.find('.jqtree-title').before(' ').attr('rel', 'folder_' + node.id).attr('formtoken', '').attr('data-uploadformtoken', ''); else $li.find('.jqtree-title').before(' '); } }); // Unfold node for currently selected folder $('#jqtree').tree('selectNode', $('#jqtree').tree('getNodeById', ), false, true); $('#jqtree').on( 'tree.click', function(event) { var node = event.node; if(!node) return; $('#jqtree').tree('openNode', node); // event.preventDefault(); if(node.is_folder) { if(typeof node.fetched == 'undefined') { node.fetched = true; $(this).tree('loadDataFromUrl', node, function () { $(this).tree('openNode', node); }); } folderSelected(node.id, node.name); } else documentSelected(node.id, node.name); } ); $('#jqtree').on( 'tree.contextmenu', function(event) { // The clicked node is 'event.node' var node = event.node; if(typeof node.fetched == 'undefined') { node.fetched = true; $(this).tree('loadDataFromUrl', node); } $(this).tree('openNode', node); } ); $("#jqtree").on('dragenter', function (e) { attr_rel = $(e.srcElement).attr('rel'); if(typeof attr_rel == 'undefined') return; target_type = attr_rel.split("_")[0]; target_id = attr_rel.split("_")[1]; var node = $(this).tree('getNodeById', parseInt(target_id)); if(typeof node.fetched == 'undefined') { node.fetched = true; $(this).tree('loadDataFromUrl', node, function() {$(this).tree('openNode', node);}); } }); }); params['dms']; $user = $this->params['user']; $folder = $dms->getFolder($folderid); if (!is_object($folder)) return ''; $subfolders = $folder->getSubFolders($orderby); $subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, M_READ); $tree = array(); foreach($subfolders as $subfolder) { $loadondemand = $subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs); $level = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>$loadondemand, 'is_folder'=>true); if(!$subfolder->hasSubFolders()) $level['children'] = array(); $tree[] = $level; } if($showdocs) { $documents = $folder->getDocuments($orderby); $documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ); foreach($documents as $document) { $level = array('label'=>$document->getName(), 'id'=>$document->getID(), 'load_on_demand'=>false, 'is_folder'=>false); $tree[] = $level; } } header('Content-Type: application/json'); echo json_encode($tree); } /* }}} */ function printTreeNavigation($folderid, $showtree){ /* {{{ */ if ($showtree==1){ $this->contentHeading("", true); $this->contentContainerStart(); ?> printNewTreeNavigation($folderid, M_READ, 0, ''); $this->contentContainerEnd(); } else { $this->contentHeading("", true); } } /* }}} */ /** * Print clipboard in div container * * @param array clipboard */ function printClipboard($clipboard, $previewer){ /* {{{ */ echo "
    \n"; $this->contentHeading(getMLText("clipboard").'', true); echo "
    \n"; ?>
    \n"; echo "
    \n"; } /* }}} */ /** * Print button with link for deleting a document * * This button is used in document listings (e.g. on the ViewFolder page) * for deleting a document. In seeddms version < 4.3.9 this was just a * link to the out/out.RemoveDocument.php page which asks for confirmation * an than calls op/op.RemoveDocument.php. Starting with version 4.3.9 * the button just opens a small popup asking for confirmation and than * calls the ajax command 'deletedocument'. The ajax call is called * in the click function of 'button.removedocument'. That button needs * to have two attributes: 'rel' for the id of the document, and 'msg' * for the message shown by notify if the document could be deleted. * * @param object $document document to be deleted * @param string $msg message shown in case of successful deletion * @param boolean $return return html instead of printing it * @return string html content if $return is true, otherwise an empty string */ function printDeleteDocumentButton($document, $msg, $return=false){ /* {{{ */ $docid = $document->getID(); $content = ''; $content .= ' $document->getName())), ENT_QUOTES).'">'; if($return) return $content; else echo $content; return ''; } /* }}} */ function printDeleteDocumentButtonJs(){ /* {{{ */ echo " $(document).ready(function () { // $('.delete-document-btn').click(function(ev) { $('body').on('click', 'a.delete-document-btn', function(ev){ ev.stopPropagation(); id = $(ev.currentTarget).attr('rel'); confirmmsg = $(ev.currentTarget).attr('confirmmsg'); msg = $(ev.currentTarget).attr('msg'); formtoken = '".createFormKey('removedocument')."'; bootbox.dialog(confirmmsg, [{ \"label\" : \" ".getMLText("rm_document")."\", \"class\" : \"btn-danger\", \"callback\": function() { $.get('../op/op.Ajax.php', { command: 'deletedocument', id: id, formtoken: formtoken }, function(data) { if(data.success) { $('#table-row-document-'+id).hide('slow'); noty({ text: msg, type: 'success', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', timeout: 1500, }); } else { noty({ text: data.message, type: 'error', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', timeout: 3500, }); } }, 'json' ); } }, { \"label\" : \"".getMLText("cancel")."\", \"class\" : \"btn-cancel\", \"callback\": function() { } }]); }); }); "; } /* }}} */ /** * Print button with link for deleting a folder * * This button works like document delete button * {@link SeedDMS_Bootstrap_Style::printDeleteDocumentButton()} * * @param object $folder folder to be deleted * @param string $msg message shown in case of successful deletion * @param boolean $return return html instead of printing it * @return string html content if $return is true, otherwise an empty string */ function printDeleteFolderButton($folder, $msg, $return=false){ /* {{{ */ $folderid = $folder->getID(); $content = ''; $content .= ' $folder->getName())), ENT_QUOTES).'">'; if($return) return $content; else echo $content; return ''; } /* }}} */ function printDeleteFolderButtonJs(){ /* {{{ */ echo " $(document).ready(function () { // $('.delete-folder-btn').click(function(ev) { $('body').on('click', 'a.delete-folder-btn', function(ev){ ev.stopPropagation(); id = $(ev.currentTarget).attr('rel'); confirmmsg = $(ev.currentTarget).attr('confirmmsg'); msg = $(ev.currentTarget).attr('msg'); formtoken = '".createFormKey('removefolder')."'; bootbox.dialog(confirmmsg, [{ \"label\" : \" ".getMLText("rm_folder")."\", \"class\" : \"btn-danger\", \"callback\": function() { $.get('../op/op.Ajax.php', { command: 'deletefolder', id: id, formtoken: formtoken }, function(data) { if(data.success) { $('#table-row-folder-'+id).hide('slow'); noty({ text: msg, type: 'success', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', timeout: 1500, }); } else { noty({ text: data.message, type: 'error', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', timeout: 3500, }); } }, 'json' ); } }, { \"label\" : \"".getMLText("cancel")."\", \"class\" : \"btn-cancel\", \"callback\": function() { } }]); }); }); "; } /* }}} */ function printLockButton($document, $msglock, $msgunlock, $return=false) { /* {{{ */ $docid = $document->getID(); if($document->isLocked()) { $icon = 'unlock'; $msg = $msgunlock; $title = 'unlock_document'; } else { $icon = 'lock'; $msg = $msglock; $title = 'lock_document'; } $content = ''; $content .= ''; if($return) return $content; else echo $content; return ''; } /* }}} */ /** * Output left-arrow with link which takes over a number of ids into * a select box. * * Clicking in the button will preset the comma seperated list of ids * in data-ref as options in the select box with name $name * * @param string $name id of select box * @param array $ids list of option values */ function getSelectPresetButtonHtml($name, $ids) { /* {{{ */ return ''; } /* }}} */ /** * Output left-arrow with link which takes over a number of ids into * a select box. * * Clicking in the button will preset the comma seperated list of ids * in data-ref as options in the select box with name $name * * @param string $name id of select box * @param array $ids list of option values */ function printSelectPresetButtonHtml($name, $ids) { /* {{{ */ echo self::getSelectPresetButtonHtml($name, $ids); } /* }}} */ /** * Javascript code for select preset button */ function printSelectPresetButtonJs() { /* {{{ */ ?> $(document).ready( function() { $('.selectpreset_btn').click(function(ev){ ev.preventDefault(); if (typeof $(ev.currentTarget).data('ids') != 'undefined') { target = $(ev.currentTarget).data('ref'); // Use attr() instead of data() because data() converts to int which cannot be split items = $(ev.currentTarget).attr('data-ids'); arr = items.split(","); for(var i in arr) { $("#"+target+" option[value='"+arr[i]+"']").attr("selected", "selected"); } // $("#"+target).trigger("chosen:updated"); $("#"+target).trigger("change"); } }); }); '; } /* }}} */ /** * Output left-arrow with link which takes over a string into * a input field. * * Clicking on the button will preset the string * in data-ref the value of the input field with name $name * * @param string $name id of select box * @param string $text text */ function printInputPresetButtonHtml($name, $text, $sep='') { /* {{{ */ echo self::getInputPresetButtonHtml($name, $text, $sep); } /* }}} */ /** * Javascript code for input preset button * This code workѕ for input fields and single select fields */ function printInputPresetButtonJs() { /* {{{ */ ?> $(document).ready( function() { $('.inputpreset_btn').click(function(ev){ ev.preventDefault(); if (typeof $(ev.currentTarget).data('text') != 'undefined') { target = $(ev.currentTarget).data('ref'); value = $(ev.currentTarget).data('text'); sep = $(ev.currentTarget).data('sep'); if(sep) { // Use attr() instead of data() because data() converts to int which cannot be split arr = value.split(sep); for(var i in arr) { $("#"+target+" option[value='"+arr[i]+"']").attr("selected", "selected"); } } else { $("#"+target).val(value); } } }); }); return ''; $(document).ready( function() { $('.checkboxpreset_btn').click(function(ev){ ev.preventDefault(); if (typeof $(ev.currentTarget).data('text') != 'undefined') { target = $(ev.currentTarget).data('ref'); value = $(ev.currentTarget).data('text'); if(value) { $("#"+target).attr('checked', ''); } else { $("#"+target).removeAttribute('checked'); } } }); }); getID().'" msg="'.getMLText($msg).'" attrvalue="'.htmlspecialchars($value, ENT_QUOTES).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_attr_value", array ("attrdefname" => $attrdef->getName())), ENT_QUOTES).'">'; if($return) return $content; else echo $content; return ''; } /* }}} */ function printDeleteAttributeValueButtonJs(){ /* {{{ */ echo " $(document).ready(function () { // $('.delete-attribute-value-btn').click(function(ev) { $('body').on('click', 'a.delete-attribute-value-btn', function(ev){ id = $(ev.currentTarget).attr('rel'); confirmmsg = $(ev.currentTarget).attr('confirmmsg'); attrvalue = $(ev.currentTarget).attr('attrvalue'); msg = $(ev.currentTarget).attr('msg'); formtoken = '".createFormKey('removeattrvalue')."'; bootbox.dialog(confirmmsg, [{ \"label\" : \" ".getMLText("rm_attr_value")."\", \"class\" : \"btn-danger\", \"callback\": function() { $.post('../op/op.AttributeMgr.php', { action: 'removeattrvalue', attrdefid: id, attrvalue: attrvalue, formtoken: formtoken }, function(data) { if(data.success) { $('#table-row-attrvalue-'+id).hide('slow'); noty({ text: msg, type: 'success', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', timeout: 1500, }); } else { noty({ text: data.message, type: 'error', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', timeout: 3500, }); } }, 'json' ); } }, { \"label\" : \"".getMLText("cancel")."\", \"class\" : \"btn-cancel\", \"callback\": function() { } }]); }); }); "; } /* }}} */ function printClickDocumentJs() { /* {{{ */ $onepage = $this->params['onepage']; if($onepage) { ?> /* catch click on a document row in the list folders and documents */ $('body').on('click', '[id^=\"table-row-document\"] td:nth-child(2)', function(ev) { attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3]; window.location = '../out/out.ViewDocument.php?documentid=' + attr_id; }); params['onepage']; if($onepage) { ?> /* catch click on a document row in the list folders and documents */ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) { attr_id = $(ev.currentTarget).parent().data('target-id'); if(typeof attr_id == 'undefined') attr_id = $(ev.currentTarget).parent().attr('id').split('-')[3]; window.location = '../out/out.ViewFolder.php?folderid=' + attr_id; }); getID(); return "getName(), ENT_QUOTES)."\">"; } /* }}} */ function documentListRowEnd($document) { /* {{{ */ return "\n"; } /* }}} */ /** * Return HTML of a single row in the document list table * * @param object $document * @param object $previewer * @param boolean $skipcont set to true if embrasing tr shall be skipped */ function documentListRow($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $showtree = $this->params['showtree']; $workflowmode = $this->params['workflowmode']; $previewwidth = $this->params['previewWidthList']; $enableClipboard = $this->params['enableclipboard']; $onepage = $this->params['onepage']; $content = ''; $owner = $document->getOwner(); $comment = $document->getComment(); if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; $docID = $document->getID(); if(!$skipcont) $content .= $this->documentListRowStart($document); if($version) { $latestContent = $this->callHook('documentContent', $document, $version); if($latestContent === null) $latestContent = $document->getContentByVersion($version); } else { $latestContent = $this->callHook('documentLatestContent', $document); if($latestContent === null) $latestContent = $document->getLatestContent(); } if($latestContent) { $previewer->createPreview($latestContent); $version = $latestContent->getVersion(); $status = $latestContent->getStatus(); $needwkflaction = false; if($workflowmode == 'advanced') { $workflow = $latestContent->getWorkflow(); if($workflow) { $needwkflaction = $latestContent->needsWorkflowAction($user); } } /* Retrieve attacheѕ files */ $files = $document->getDocumentFiles($latestContent->getVersion()); $files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files); /* Retrieve linked documents */ $links = $document->getDocumentLinks(); $links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links); /* Retrieve reverse linked documents */ $revlinks = $document->getReverseDocumentLinks(); $revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks); $content .= ""; if (file_exists($dms->contentDir . $latestContent->getPath())) { $content .= ""; if($previewer->hasPreview($latestContent)) { $content .= "getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; } else { $content .= "getMimeIcon($latestContent->getFileType())."\" ".($previewwidth ? "width=\"".$previewwidth."\"" : "")."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; } $content .= ""; } else $content .= "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; $content .= ""; $content .= ""; if($onepage) $content .= "".htmlspecialchars($document->getName()) . ""; else $content .= "" . htmlspecialchars($document->getName()) . ""; if(isset($extracontent['below_title'])) $content .= $extracontent['below_title']; $content .= "
    ".getMLText('owner').": ".htmlspecialchars($owner->getFullName()).", ".getMLText('creation_date').": ".date('Y-m-d', $document->getDate()).", ".getMLText('version')." ".$version." - ".date('Y-m-d', $latestContent->getDate())."".($document->expires() ? ", ".getMLText('expires').": ".getReadableDate($document->getExpires())."" : "").""; if($comment) { $content .= "
    ".htmlspecialchars($comment).""; } if(!empty($extracontent['bottom_title'])) $content .= $extracontent['bottom_title']; $content .= "\n"; $content .= ""; $attentionstr = ''; if ( $document->isLocked() ) { $attentionstr .= "getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> "; } if ( $needwkflaction ) { $attentionstr .= "getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> "; } if($attentionstr) $content .= $attentionstr."
    "; $content .= ""; if(count($files)) $content .= count($files)." ".getMLText("linked_files")."
    "; if(count($links) || count($revlinks)) $content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."
    "; if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') { $workflowstate = $latestContent->getWorkflowState(); $content .= 'getName()).'">'.htmlspecialchars($workflowstate->getName()).''; } else { $content .= getOverallStatusText($status["status"]); } $content .= "
    "; // $content .= "".$version.""; $content .= ""; $content .= "
    "; if($document->getAccessMode($user) >= M_ALL) { $content .= $this->printDeleteDocumentButton($document, 'splash_rm_document', true); } else { $content .= ''; } if($document->getAccessMode($user) >= M_READWRITE) { $content .= ''; } else { $content .= ''; } if($document->getAccessMode($user) >= M_READWRITE) { $content .= $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true); } if($enableClipboard) { $content .= ''; } $content .= "
    "; $content .= ""; } if(!$skipcont) $content .= $this->documentListRowEnd($document); return $content; } /* }}} */ /** * Start the row for a folder in list of documents and folders * * This method creates the starting tr tag for a new table row containing * a folder list entry. The tr tag contains various attributes which are * used for removing the table line and to make drap&drop work. * * id=table-row-folder- : used for identifying the row when removing the table * row after deletion of the folder by clicking on the delete button in that table * row. * data-droptarget=folder_ : identifies the folder represented by this row * when it used as a target of the drag&drop operation. * If an element (either a file or a dragged item) is dropped on this row, the * data-droptarget will be evaluated to identify the underlying dms object. * Dropping a file on a folder will upload that file into the folder. Droping * an item (which is currently either a document or a folder) from the page will * move that item into the folder. * rel=folder_ : This data is put into drag data when a drag starts. When the * item is dropped on some other item this data will identify the source object. * The attributes data-droptarget and rel are usually equal. At least there is * currently no scenario where they are different. * formtoken= : token made of key 'movefolder' * formtoken is also placed in the drag data just like the value of attibute 'rel'. * This is always set to a value made of 'movefolder'. * data-uploadformtoken= : token made of key 'adddocument' * class=table-row-folder : The class must have a class named 'table-row-folder' in * order to be draggable and to extract the drag data from the attributes 'rel' and * 'formtoken' * * @param object $folder * @return string starting tr tag for a table */ function folderListRowStart($folder, $class='') { /* {{{ */ return "getID()."\" draggable=\"true\" data-droptarget=\"folder_".$folder->getID()."\" rel=\"folder_".$folder->getID()."\" class=\"folder table-row-folder droptarget".($class ? ' '.$class : '')."\" data-uploadformtoken=\"".createFormKey('')."\" formtoken=\"".createFormKey('')."\" data-name=\"".htmlspecialchars($folder->getName(), ENT_QUOTES)."\">"; } /* }}} */ function folderListRowEnd($folder) { /* {{{ */ return "\n"; } /* }}} */ function folderListRow($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; // $folder = $this->params['folder']; $showtree = $this->params['showtree']; $enableRecursiveCount = $this->params['enableRecursiveCount']; $maxRecursiveCount = $this->params['maxRecursiveCount']; $enableClipboard = $this->params['enableclipboard']; $onepage = $this->params['onepage']; $owner = $subFolder->getOwner(); $comment = $subFolder->getComment(); if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; $content = ''; if(!$skipcont) $content .= $this->folderListRowStart($subFolder); $content .= "getID()."&showtree=".$showtree."\">getMimeIcon(".folder")."\" width=\"24\" height=\"24\" border=0>\n"; if($onepage) $content .= "" . "getId()."\">".htmlspecialchars($subFolder->getName()).""; else $content .= "getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . ""; $content .= "
    ".getMLText('owner').": ".htmlspecialchars($owner->getFullName()).", ".getMLText('creation_date').": ".date('Y-m-d', $subFolder->getDate()).""; if($comment) { $content .= "
    ".htmlspecialchars($comment).""; } if(isset($extracontent['bottom_title'])) $content .= $extracontent['bottom_title']; $content .= "\n"; // $content .= "".htmlspecialchars($owner->getFullName()).""; $content .= ""; if($enableRecursiveCount) { if($user->isAdmin()) { /* No need to check for access rights in countChildren() for * admin. So pass 0 as the limit. */ $cc = $subFolder->countChildren($user, 0); $content .= $cc['folder_count']." ".getMLText("folders")."
    ".$cc['document_count']." ".getMLText("documents"); } else { $cc = $subFolder->countChildren($user, $maxRecursiveCount); if($maxRecursiveCount > 5000) $rr = 100.0; else $rr = 10.0; $content .= (!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ".getMLText("folders")."
    ".(!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents"); } } else { /* FIXME: the following is very inefficient for just getting the number of * subfolders and documents. Making it more efficient is difficult, because * the access rights need to be checked. */ $subsub = $subFolder->getSubFolders(); $subsub = SeedDMS_Core_DMS::filterAccess($subsub, $user, M_READ); $subdoc = $subFolder->getDocuments(); $subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ); $content .= count($subsub)." ".getMLText("folders")."
    ".count($subdoc)." ".getMLText("documents"); } $content .= "
    "; // $content .= ""; $content .= ""; $content .= "
    "; $subFolderAccessMode = $subFolder->getAccessMode($user); if($subFolderAccessMode >= M_ALL) { $content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true); } else { $content .= ''; } if($subFolderAccessMode >= M_READWRITE) { $content .= ''; } else { $content .= ''; } if($enableClipboard) { $content .= ''; } $content .= "
    "; $content .= ""; if(!$skipcont) $content .= $this->folderListRowEnd($subFolder); return $content; } /* }}} */ function show(){ /* {{{ */ parent::show(); } /* }}} */ function error(){ /* {{{ */ parent::error(); $dms = $this->params['dms']; $user = $this->params['user']; $pagetitle = $this->params['pagetitle']; $errormsg = $this->params['errormsg']; $plain = $this->params['plain']; $noexit = $this->params['noexit']; if(!$plain) { $this->htmlStartPage($pagetitle); $this->globalNavigation(); $this->contentStart(); } print "
    "; print "

    ".getMLText('error')."!

    "; print htmlspecialchars($errormsg); print "
    "; print "
    "; $this->contentEnd(); $this->htmlEndPage(); add_log_line(" UI::exitError error=".$errormsg." pagetitle=".$pagetitle, PEAR_LOG_ERR); if($noexit) return; exit; } /* }}} */ /** * Return HTML Template for jumploader * * @param string $uploadurl URL where post data is send * @param integer $folderid id of folder where document is saved * @param integer $maxfiles maximum number of files allowed to upload * @param array $fields list of post fields */ function getFineUploaderTemplate() { /* {{{ */ return ' '; } /* }}} */ /** * Output HTML Code for Fine Uploader * * @param string $uploadurl URL where post data is send * @param integer $folderid id of folder where document is saved * @param integer $maxfiles maximum number of files allowed to upload * @param array $fields list of post fields */ function printFineUploaderHtml($prefix='userfile') { /* {{{ */ echo self::getFineUploaderHtml($prefix); } /* }}} */ /** * Get HTML Code for Fine Uploader * * @param string $uploadurl URL where post data is send * @param integer $folderid id of folder where document is saved * @param integer $maxfiles maximum number of files allowed to upload * @param array $fields list of post fields */ function getFineUploaderHtml($prefix='userfile') { /* {{{ */ $html = '
    '; return $html; } /* }}} */ /** * Output Javascript Code for fine uploader * * @param string $uploadurl URL where post data is send * @param integer $folderid id of folder where document is saved * @param integer $maxfiles maximum number of files allowed to upload * @param array $fields list of post fields */ function printFineUploaderJs($uploadurl, $partsize=0, $maxuploadsize=0, $multiple=true, $prefix='userfile', $formname='form1') { /* {{{ */ ?> $(document).ready(function() { uploader = new qq.FineUploader({ debug: false, autoUpload: false, multiple: , element: $('#-fine-uploader')[0], template: 'qq-template', request: { endpoint: '' }, 0 ? ' validation: { sizeLimit: '.$maxuploadsize.' }, ' : ''); ?> chunking: { enabled: true, mandatory: true }, messages: { sizeError: '{file} is too large, maximum file size is {sizeLimit}.' }, callbacks: { onComplete: function(id, name, json, xhr) { }, onAllComplete: function(succeeded, failed) { var uuids = Array(); var names = Array(); for (var i = 0; i < succeeded.length; i++) { uuids.push(this.getUuid(succeeded[i])) names.push(this.getName(succeeded[i])) } $('#-fine-uploader-uuids').val(uuids.join(';')); $('#-fine-uploader-names').val(names.join(';')); /* Run upload only if all files could be uploaded */ if(succeeded.length > 0 && failed.length == 0) document.getElementById('').submit(); }, onError: function(id, name, reason, xhr) { noty({ text: reason, type: 'error', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', timeout: 3500, }); } } }); }); params['dms']; $document = $latestContent->getDocument(); ?> getReviewStatus(10); break; case "approval": $statusList = $latestContent->getApprovalStatus(10); break; default: $statusList = array(); } foreach($statusList as $rec) { echo ""; echo ""; echo ""; echo ""; echo ""; } ?>
    ,
    "; switch ($rec["type"]) { case 0: // individual. $required = $dms->getUser($rec["required"]); if (!is_object($required)) { $reqName = getMLText("unknown_user")." '".$rec["required"]."'"; } else { $reqName = htmlspecialchars($required->getFullName()." (".$required->getLogin().")"); } break; case 1: // Approver is a group. $required = $dms->getGroup($rec["required"]); if (!is_object($required)) { $reqName = getMLText("unknown_group")." '".$rec["required"]."'"; } else { $reqName = "".htmlspecialchars($required->getName()).""; } break; } echo $reqName; echo ""; echo "".$rec['date']." - "; $updateuser = $dms->getUser($rec["userID"]); if(!is_object($updateuser)) echo getMLText("unknown_user"); else echo htmlspecialchars($updateuser->getFullName()." (".$updateuser->getLogin().")"); echo ""; if($rec['comment']) echo "
    ".htmlspecialchars($rec['comment']); switch($type) { case "review": if($rec['file']) { echo "
    "; echo "getID()."&reviewlogid=".$rec['reviewLogID']."\" class=\"btn btn-mini\"> ".getMLText('download').""; } break; case "approval": if($rec['file']) { echo "
    "; echo "getID()."&approvelogid=".$rec['approveLogID']."\" class=\"btn btn-mini\"> ".getMLText('download').""; } break; } echo "
    "; switch($type) { case "review": echo getReviewStatusText($rec["status"]); break; case "approval": echo getApprovalStatusText($rec["status"]); break; default: } echo "
    $value) { $used = (int) ($value/$max*100.0+0.5); $free = 100-$used; } else { $free = 0; $used = 100; } $html = '
    '; return $html; } /* }}} */ /** * Output a timeline for a document * * @param object $document document */ protected function printTimelineJs($timelineurl, $height=300, $start='', $end='', $skip=array()) { /* {{{ */ if(!$timelineurl) return; ?> var timeline; var data; // specify options var options = { 'width': '100%', 'height': '100%', 'editable': false, 'selectable': true, 'style': 'box', 'locale': 'params['session']->getLanguage() ?>' }; function onselect() { var sel = timeline.getSelection(); if (sel.length) { if (sel[0].row != undefined) { var row = sel[0].row; console.log(timeline.getItem(sel[0].row)); item = timeline.getItem(sel[0].row); $('div.ajax').trigger('update', {documentid: item.docid, version: item.version, statusid: item.statusid, statuslogid: item.statuslogid, fileid: item.fileid}); } } } $(document).ready(function () { // Instantiate our timeline object. timeline = new links.Timeline(document.getElementById('timeline'), options); links.events.addListener(timeline, 'select', onselect); $.getJSON( '', function(data) { $.each( data, function( key, val ) { val.start = new Date(val.start); }); timeline.draw(data); } ); });
    \n"; $this->printTimelineJs($timelineurl, $height, $start, $end, $skip); echo ""; $this->printTimelineHtml($height); } /* }}} */ public function printPopupBox($title, $content, $ret=false) { /* {{{ */ $id = md5(uniqid()); /* $this->addFooterJS(' $("body").on("click", "span.openpopupbox", function(e) { $(""+$(e.target).data("href")).toggle(); // $("div.popupbox").toggle(); }); '); */ $html = ' '.$title.' '; if($ret) return $html; else echo $html; } /* }}} */ protected function printAccordion($title, $content) { /* {{{ */ $id = substr(md5(uniqid()), 0, 4); ?>