extraheader = array('js'=>'', 'css'=>'', 'favicon'=>'', 'logo'=>'', 'logolink'=>'');
$this->footerjs = array();
$this->nonces = 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
* 'unsafe-inline' is needed for jquery 3.6.1 when loading the remote
* content of a modal box
*/
$csp_rules = [];
$csp_rule = "script-src 'self' 'unsafe-eval' 'unsafe-inline'";
if($this->nonces) {
$csp_rule .= " 'nonce-".implode("' 'nonce-", $this->nonces)."'";
}
$csp_rules[] = $csp_rule;
$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'";
if($this->hasHook('getCspRules')) {
$csp_rules = $this->callHook('getCspRules', $csp_rules);
}
foreach (array("X-WebKit-CSP", "X-Content-Security-Policy", "Content-Security-Policy") as $csp) {
header($csp . ": " . implode('; ', $csp_rules).';');
}
}
header('X-Content-Type-Options: nosniff');
header('Strict-Transport-Security: max-age=15768000; includeSubDomains; preload');
if($httpheader) {
foreach($httpheader as $name=>$value) {
header($name . ": " . $value);
}
}
if($this->hasHook('startPage'))
$this->callHook('startPage');
echo "\n";
echo "\n
'."\n";
$this->rowStart();
$this->columnStart(12);
echo $this->errorMsg("This page contains missing translations in the selected language. Please help to improve SeedDMS and provide the translation.");
echo "
";
echo "
Key
engl. Text
Your translation
\n";
foreach($MISSING_LANG as $key=>$lang) {
echo "
';
} /* }}} */
private function folderNavigationBar($folder) { /* {{{ */
$dms = $this->params['dms'];
$accessobject = $this->params['accessobject'];
if (!is_object($folder) || !$folder->isType('folder')) {
self::showNavigationBar(array());
return;
}
$accessMode = $folder->getAccessMode($this->params['user']);
$folderID = $folder->getID();
$menuitems = array();
if ($accessMode == M_READ && !$this->params['user']->isGuest()) {
if ($accessobject->check_view_access('FolderNotify'))
$menuitems['edit_folder_notify'] = array('link'=>$this->params['settings']->_httpRoot."out/out.FolderNotify.php?folderid=".$folderID."&showtree=".showtree(), 'label'=>getMLText('edit_folder_notify'));
}
else if ($accessMode >= M_READWRITE) {
if ($accessobject->check_view_access('AddSubFolder'))
$menuitems['add_subfolder'] = array('link'=>$this->params['settings']->_httpRoot."out/out.AddSubFolder.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>getMLText('add_subfolder'));
if ($accessobject->check_view_access('AddDocument'))
$menuitems['add_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.AddDocument.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>getMLText('add_document'));
if(0 && $this->params['enablelargefileupload'])
$menuitems['add_multiple_documents'] = array('link'=>$this->params['settings']->_httpRoot."out/out.AddMultiDocument.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>getMLText('add_multiple_documents'));
$menuitems['edit_folder_props'] = array('link'=>$this->params['settings']->_httpRoot."out/out.EditFolder.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>getMLText('edit_folder_props'));
if ($folderID != $this->params['rootfolderid'] && $folder->getParent())
$menuitems['move_folder'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MoveFolder.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>getMLText('move_folder'));
if ($accessMode == M_ALL) {
if ($folderID != $this->params['rootfolderid'] && $folder->getParent())
if ($accessobject->check_view_access('RemoveFolder'))
$menuitems['rm_folder'] = array('link'=>$this->params['settings']->_httpRoot."out/out.RemoveFolder.php?folderid=". $folderID ."&showtree=".showtree(), 'label'=>getMLText('rm_folder'));
}
if ($accessMode == M_ALL) {
if ($accessobject->check_view_access('FolderAccess'))
$menuitems['edit_folder_access'] = array('link'=>$this->params['settings']->_httpRoot."out/out.FolderAccess.php?folderid=".$folderID."&showtree=".showtree(), 'label'=>getMLText('edit_folder_access'));
}
if ($accessobject->check_view_access('FolderNotify'))
$menuitems['edit_existing_notify'] = array('link'=>$this->params['settings']->_httpRoot."out/out.FolderNotify.php?folderid=". $folderID ."&showtree=". showtree(), 'label'=>getMLText('edit_existing_notify'));
}
if ($this->params['user']->isAdmin() && $this->params['enablefullsearch']) {
$menuitems['index_folder'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Indexer.php?folderid=". $folderID."&showtree=".showtree(), 'label'=>getMLText('index_folder'));
}
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'folderNavigationBar')) {
$menuitems = $hookObj->folderNavigationBar($this, $folder, $menuitems);
}
}
self::showNavigationBar($menuitems);
} /* }}} */
private function documentNavigationBar($document) { /* {{{ */
$accessobject = $this->params['accessobject'];
$accessMode = $document->getAccessMode($this->params['user']);
$docid=".php?documentid=" . $document->getID();
$menuitems = array();
if ($accessMode >= M_READWRITE) {
if (!$document->isLocked()) {
if($accessobject->check_controller_access('UpdateDocument'))
$menuitems['update_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.UpdateDocument".$docid, 'label'=>getMLText('update_document'));
if($accessobject->check_controller_access('LockDocument'))
$menuitems['lock_document'] = array('link'=>$this->params['settings']->_httpRoot."op/op.LockDocument".$docid."&formtoken=".createFormKey('lockdocument'), 'label'=>getMLText('lock_document'));
if($accessobject->check_controller_access('EditDocument'))
$menuitems['edit_document_props'] = array('link'=>$this->params['settings']->_httpRoot."out/out.EditDocument".$docid , 'label'=>getMLText('edit_document_props'));
$menuitems['move_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MoveDocument".$docid, 'label'=>getMLText('move_document'));
}
else {
$lockingUser = $document->getLockingUser();
if (($lockingUser->getID() == $this->params['user']->getID()) || ($document->getAccessMode($this->params['user']) == M_ALL)) {
if($accessobject->check_controller_access('UpdateDocument'))
$menuitems['update_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.UpdateDocument".$docid, 'label'=>getMLText('update_document'));
if($accessobject->check_controller_access('UnlockDocument'))
$menuitems['unlock_document'] = array('link'=>$this->params['settings']->_httpRoot."op/op.UnlockDocument".$docid."&formtoken=".createFormKey('unlockdocument'), 'label'=>getMLText('unlock_document'));
if($accessobject->check_controller_access('EditDocument'))
$menuitems['edit_document_props'] = array('link'=>$this->params['settings']->_httpRoot."out/out.EditDocument".$docid, 'label'=>getMLText('edit_document_props'));
$menuitems['move_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MoveDocument".$docid, 'label'=>getMLText('move_document'));
}
}
if($accessobject->maySetExpires()) {
if ($accessobject->check_view_access('SetExpires'))
$menuitems['expires'] = array('link'=>$this->params['settings']->_httpRoot."out/out.SetExpires".$docid, 'label'=>getMLText('expires'));
}
}
if ($accessMode == M_ALL) {
if ($accessobject->check_view_access('RemoveDocument'))
$menuitems['rm_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.RemoveDocument".$docid, 'label'=>getMLText('rm_document'));
if ($accessobject->check_view_access('DocumentAccess'))
$menuitems['edit_document_access'] = array('link'=>$this->params['settings']->_httpRoot."out/out.DocumentAccess". $docid, 'label'=>getMLText('edit_document_access'));
}
if ($accessMode >= M_READ && !$this->params['user']->isGuest()) {
if ($accessobject->check_view_access('DocumentNotify'))
$menuitems['edit_existing_notify'] = array('link'=>$this->params['settings']->_httpRoot."out/out.DocumentNotify". $docid, 'label'=>getMLText('edit_existing_notify'));
}
if ($accessobject->check_view_access('TransferDocument')) {
$menuitems['transfer_document'] = array('link'=>$this->params['settings']->_httpRoot."out/out.TransferDocument". $docid, 'label'=>getMLText('transfer_document'));
}
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'documentNavigationBar')) {
$menuitems = $hookObj->documentNavigationBar($this, $document, $menuitems);
}
}
self::showNavigationBar($menuitems);
} /* }}} */
private function accountNavigationBar() { /* {{{ */
$accessobject = $this->params['accessobject'];
$menuitems = array();
if ($this->params['user']->isAdmin() || !$this->params['disableselfedit'])
$menuitems['edit_user_details'] = array('link'=>$this->params['settings']->_httpRoot."out/out.EditUserData.php", 'label'=>getMLText('edit_user_details'));
if (!$this->params['user']->isAdmin())
$menuitems['edit_default_keywords'] = array('link'=>$this->params['settings']->_httpRoot."out/out.UserDefaultKeywords.php", 'label'=>getMLText('edit_default_keywords'));
if ($accessobject->check_view_access('ManageNotify'))
$menuitems['edit_notify'] = array('link'=>$this->params['settings']->_httpRoot."out/out.ManageNotify.php", 'label'=>getMLText('edit_existing_notify'));
if ($this->params['enableusersview']){
if ($accessobject->check_view_access('UsrView'))
$menuitems['users'] = array('link'=>$this->params['settings']->_httpRoot."out/out.UsrView.php", 'label'=>getMLText('users'));
if ($accessobject->check_view_access('GroupView'))
$menuitems['groups'] = array('link'=>$this->params['settings']->_httpRoot."out/out.GroupView.php", 'label'=>getMLText('groups'));
}
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'accountNavigationBar')) {
$menuitems = $hookObj->accountNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);
} /* }}} */
private function myDocumentsNavigationBar() { /* {{{ */
$accessobject = $this->params['accessobject'];
$menuitems = array();
if ($accessobject->check_view_access('MyDocuments')) {
$menuitems['inprocess'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyDocuments.php?inProcess=1", 'label'=>getMLText('documents_in_process'));
$menuitems['all_documents'] = array('link'=>$this->params['settings']->_httpRoot."out/out.MyDocuments.php", 'label'=>getMLText('all_documents'));
}
if($this->params['workflowmode'] == 'traditional' || $this->params['workflowmode'] == 'traditional_only_approval') {
if ($accessobject->check_view_access('ReviewSummary'))
$menuitems['review_summary'] = array('link'=>$this->params['settings']->_httpRoot."out/out.ReviewSummary.php", 'label'=>getMLText('review_summary'));
if ($accessobject->check_view_access('ApprovalSummary'))
$menuitems['approval_summary'] = array('link'=>$this->params['settings']->_httpRoot."out/out.ApprovalSummary.php", 'label'=>getMLText('approval_summary'));
} else {
if ($accessobject->check_view_access('WorkflowSummary'))
$menuitems['workflow_summary'] = array('link'=>$this->params['settings']->_httpRoot."out/out.WorkflowSummary.php", 'label'=>getMLText('workflow_summary'));
}
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'mydocumentsNavigationBar')) {
$menuitems = $hookObj->mydocumentsNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);
} /* }}} */
private function adminToolsNavigationBar() { /* {{{ */
$accessobject = $this->params['accessobject'];
$settings = $this->params['settings'];
$menuitems = array();
if($accessobject->check_view_access(array('UsrMgr', 'GroupMgr', 'UserList'))) {
$menuitems['user_group_management'] = array('link'=>"#", 'label'=>getMLText('user_group_management'));
if ($accessobject->check_view_access('UsrMgr'))
$menuitems['user_group_management']['children']['user_management'] = array('link'=>$this->params['settings']->_httpRoot."out/out.UsrMgr.php", 'label'=>getMLText('user_management'));
if ($accessobject->check_view_access('GroupMgr'))
$menuitems['user_group_management']['children']['group_management'] = array('link'=>$this->params['settings']->_httpRoot."out/out.GroupMgr.php", 'label'=>getMLText('group_management'));
if ($accessobject->check_view_access('UserList'))
$menuitems['user_group_management']['children']['user_list'] = array('link'=>$this->params['settings']->_httpRoot."out/out.UserList.php", 'label'=>getMLText('user_list'));
}
if($accessobject->check_view_access(array('DefaultKeywords', 'Categories', 'AttributeMgr', 'WorkflowMgr', 'WorkflowStatesMgr', 'WorkflowActionsMgr'))) {
$menuitems['definitions'] = array('link'=>"#", 'label'=>getMLText('definitions'));
if ($accessobject->check_view_access('DefaultKeywords'))
$menuitems['definitions']['children']['default_keywords'] = array('link'=>$this->params['settings']->_httpRoot."out/out.DefaultKeywords.php", 'label'=>getMLText('global_default_keywords'));
if ($accessobject->check_view_access('Categories'))
$menuitems['definitions']['children']['document_categories'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Categories.php", 'label'=>getMLText('global_document_categories'));
if ($accessobject->check_view_access('AttributeMgr'))
$menuitems['definitions']['children']['attribute_definitions'] = array('link'=>$this->params['settings']->_httpRoot."out/out.AttributeMgr.php", 'label'=>getMLText('global_attributedefinitions'));
if($this->params['workflowmode'] == 'advanced') {
if ($accessobject->check_view_access('WorkflowMgr'))
$menuitems['definitions']['children']['workflows'] = array('link'=>$this->params['settings']->_httpRoot."out/out.WorkflowMgr.php", 'label'=>getMLText('global_workflows'));
if ($accessobject->check_view_access('WorkflowStatesMgr'))
$menuitems['definitions']['children']['workflow_states'] = array('link'=>$this->params['settings']->_httpRoot."out/out.WorkflowStatesMgr.php", 'label'=>getMLText('global_workflow_states'));
if ($accessobject->check_view_access('WorkflowActionsMgr'))
$menuitems['definitions']['children']['workflow_actions'] = array('link'=>$this->params['settings']->_httpRoot."out/out.WorkflowActionsMgr.php", 'label'=>getMLText('global_workflow_actions'));
}
}
if($this->params['enablefullsearch']) {
if($accessobject->check_view_access(array('Indexer', 'CreateIndex', 'IndexInfo'))) {
$menuitems['fulltext'] = array('link'=>"#", 'label'=>getMLText('fullsearch'));
if ($accessobject->check_view_access('Indexer'))
$menuitems['fulltext']['children']['update_fulltext_index'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Indexer.php", 'label'=>getMLText('update_fulltext_index'));
if ($accessobject->check_view_access('CreateIndex'))
$menuitems['fulltext']['children']['create_fulltext_index'] = array('link'=>$this->params['settings']->_httpRoot."out/out.CreateIndex.php", 'label'=>getMLText('create_fulltext_index'));
if ($accessobject->check_view_access('IndexInfo'))
$menuitems['fulltext']['children']['fulltext_info'] = array('link'=>$this->params['settings']->_httpRoot."out/out.IndexInfo.php", 'label'=>getMLText('fulltext_info'));
}
}
if($accessobject->check_view_access(array('BackupTools', 'LogManagement'))) {
$menuitems['backup_log_management'] = array('link'=>"#", 'label'=>getMLText('backup_log_management'));
if ($accessobject->check_view_access('BackupTools'))
$menuitems['backup_log_management']['children'][] = array('link'=>$this->params['settings']->_httpRoot."out/out.BackupTools.php", 'label'=>getMLText('backup_tools'));
if ($this->params['logfileenable'])
if ($accessobject->check_view_access('LogManagement'))
$menuitems['backup_log_management']['children'][] = array('link'=>$this->params['settings']->_httpRoot."out/out.LogManagement.php", 'label'=>getMLText('log_management'));
}
if($accessobject->check_view_access(array('ImportFS', 'ImportUsers', 'Statistic', 'Charts', 'Timeline', 'ObjectCheck', 'ExtensionMgr', 'Info'))) {
$menuitems['misc'] = array('link'=>"#", 'label'=>getMLText('misc'));
if ($accessobject->check_view_access('ImportFS'))
$menuitems['misc']['children']['import_fs'] = array('link'=>$this->params['settings']->_httpRoot."out/out.ImportFS.php", 'label'=>getMLText('import_fs'));
if ($accessobject->check_view_access('ImportUsers'))
$menuitems['misc']['children']['import_users'] = array('link'=>$this->params['settings']->_httpRoot."out/out.ImportUsers.php", 'label'=>getMLText('import_users'));
if ($accessobject->check_view_access('Statistic'))
$menuitems['misc']['children']['folders_and_documents_statistic'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Statistic.php", 'label'=>getMLText('folders_and_documents_statistic'));
if ($accessobject->check_view_access('Charts'))
$menuitems['misc']['children']['charts'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Charts.php", 'label'=>getMLText('charts'));
if ($accessobject->check_view_access('Timeline'))
$menuitems['misc']['children']['timeline'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Timeline.php", 'label'=>getMLText('timeline'));
if ($accessobject->check_view_access('ObjectCheck'))
$menuitems['misc']['children']['objectcheck'] = array('link'=>$this->params['settings']->_httpRoot."out/out.ObjectCheck.php", 'label'=>getMLText('objectcheck'));
if ($accessobject->check_view_access('ExpiredDocuments'))
$menuitems['misc']['children']['documents_expired'] = array('link'=>$this->params['settings']->_httpRoot."out/out.ExpiredDocuments.php", 'label'=>getMLText('documents_expired'));
if ($accessobject->check_view_access('ExtensionMgr'))
$menuitems['misc']['children']['extension_manager'] = array('link'=>$this->params['settings']->_httpRoot."out/out.ExtensionMgr.php", 'label'=>getMLText('extension_manager'));
if ($accessobject->check_view_access('ClearCache'))
$menuitems['misc']['children']['clear_cache'] = array('link'=>$this->params['settings']->_httpRoot."out/out.ClearCache.php", 'label'=>getMLText('clear_cache'));
if ($accessobject->check_view_access('Info'))
$menuitems['misc']['children']['version_info'] = array('link'=>$this->params['settings']->_httpRoot."out/out.Info.php", 'label'=>getMLText('version_info'));
}
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'admintoolsNavigationBar')) {
$menuitems = $hookObj->admintoolsNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);
} /* }}} */
private function calendarOldNavigationBar($d){ /* {{{ */
$accessobject = $this->params['accessobject'];
$ds="&day=".$d[0]."&month=".$d[1]."&year=".$d[2];
echo "params['settings']->_httpRoot."out/out.CalendarOld.php?mode=y\" class=\"brand\">".getMLText("calendar")."\n";
echo "
\n";
return;
} /* }}} */
private function calendarNavigationBar($d){ /* {{{ */
$accessobject = $this->params['accessobject'];
$menuitems = array();
if (!$this->params['user']->isGuest())
$menuitems['addevent'] = array('link'=>$this->params['settings']->_httpRoot."out/out.AddEvent.php", 'label'=>getMLText('add_event'));
/* Do not use $this->callHook() because $menuitems must be returned by the the
* first hook and passed to next hook. $this->callHook() will just pass
* the menuitems to each single hook. Hence, the last hook will win.
*/
$hookObjs = $this->getHookObjects();
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'calendarNavigationBar')) {
$menuitems = $hookObj->calendarNavigationBar($this, $menuitems);
}
}
self::showNavigationBar($menuitems);
} /* }}} */
function pageList($pageNumber, $totalPages, $baseURI, $params, $dataparams=[]) { /* {{{ */
$maxpages = 25; // skip pages when more than this is shown
$range = 2; // 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;
unset($params['pg']);
$first=true;
if($params) {
$resultsURI .= '?'.http_build_query($params);
$first=false;
}
$datastr = '';
if($dataparams) {
$datastr .= ' ';
foreach($dataparams as $k=>$v)
$datastr .= 'data-'.$k.'="'.$v.'"';
}
echo "";
return;
} /* }}} */
function contentContainer($content) { /* {{{ */
echo "
';
}
} /* }}} */
/**
* Get attributes for a button opening a modal box
*
* @param array $config contains elements
* target: id of modal box
* remote: URL of data to be loaded into box
* @return string
*/
function getModalBoxLinkAttributes($config) { /* {{{ */
$attrs = array();
$attrs[] = array('data-target', '#'.$config['target']);
if(isset($config['remote'])) {
$attrs[] = array('href', $config['remote']);
$attrs[] = array('data-remote', $config['remote']);
}
$attrs[] = array('data-toggle', 'modal');
$attrs[] = array('role', 'button');
if(isset($config['class'])) {
if($config['class'])
$attrs[] = array('class', $config['class']);
} else
$attrs[] = array('class', 'btn');
return $attrs;
} /* }}} */
/**
* Get html for button opening a modal box
*
* @param array $config contains elements
* target: id of modal box
* remote: URL of data to be loaded into box
* title: text on button
* @return string
*/
function getModalBoxLink($config) { /* {{{ */
// $content = '';
// $content .= "$attrval)
$content .= ' '.$attrname.'="'.$attrval.'"';
}
$content .= ">".$config['title']."\n";
return $content;
} /* }}} */
/**
* Get html for a modal box with buttons
*
* @param array $config contains elements
* id: id of modal box (must match target of getModalBoxLink())
* title: title of modal box
* content: content to be shown in the body of the box. Can be left
* empty if the body is loaded from the remote link passed to the button
* to open this box.
* buttons: array of buttons, each having a title and an optional id
* @return string
*/
function getModalBox($config) { /* {{{ */
$content = '';
$content .= '
\n";
if(!$skiptree)
$content .= $this->getModalBox(
array(
'id' => 'docChooser'.$formid,
'title' => getMLText('choose_target_document'),
'buttons' => array(
array('title'=>getMLText('close'))
)
));
return $content;
} /* }}} */
function printDocumentChooserHtml($formName) { /* {{{ */
echo self::getDocumentChooserHtml($formName);
} /* }}} */
/**
* This function is deprecated. Don't use it anymore. There is a generic
* folderSelected and documentSelected function in application.js
* If you extra functions to be called then define them in your own js code
*/
function printDocumentChooserJs($form, $formname='') { /* {{{ */
if(!$formname)
$formname = "docid";
$formid = md5($formname.$form);
?>
function documentSelected(id, name) {
$('#').val(id);
$('#choosedocsearch').val(name);
$('#docChooser').modal('hide');
}
function folderSelected(id, name) {
}
printDocumentChooserHtml($form);
?>
getID() : "") ."\" data-target-highlight=\"choosefoldersearch".$formid."\">";
$content .= "
\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();
}
$html = '';
$html .= "
".getMLText('error')."!
";
$html .= htmlspecialchars($error);
$this->errorMsg($html);
if(!$plain) {
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 the subfolder is in the path then further unfold the tree. */
if(/*$expandtree>=$level ||*/ $path && ($path[0]->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 {
if($root = $this->params['dms']->getFolder($this->params['rootfolderid']))
$tree = array(array('label'=>$root->getName(), 'id'=>$root->getID(), 'load_on_demand'=>false, 'is_folder'=>true));
else
$tree = array();
}
?>
var data = ;
$(function() {
const $tree = $('#jqtree');
$tree.tree({
// saveState: false,
selectable: false,
data: data,
saveState: 'jqtree',
openedIcon: $(''),
closedIcon: $(''),
/*
_onCanSelectNode: function(node) {
if(node.is_folder) {
folderSelected= $formid ?>(node.id, node.name);
treeFolderSelected('= $formid ?>', node.id, node.name);
} else {
documentSelected= $formid ?>(node.id, node.name);
treeDocumentSelected('= $formid ?>', 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').prepend(' ').attr('data-name', node.name).attr('rel', 'folder_' + node.id).attr('formtoken', '').attr('data-uploadformtoken', '').attr('data-droptarget', 'folder_' + node.id).addClass('droptarget');
else
$li.find('.jqtree-title').prepend(' ');
}
});
// 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;
if(node.is_folder) {
$('#jqtree').tree('openNode', node);
// event.preventDefault();
if(typeof node.fetched == 'undefined') {
node.fetched = true;
$(this).tree('loadDataFromUrl', node, function () {
$(this).tree('openNode', node);
});
}
/* folderSelectedXXXX() can still be set, e.g. for the main tree
* to update the folder list.
*/
if (typeof folderSelected= $formid ?> === 'function') {
folderSelected= $formid ?>(node.id, node.name);
}
treeFolderSelected('= $formid ?>', node.id, node.name);
} else {
if (typeof documentSelected= $formid ?> === 'function') {
documentSelected= $formid ?>(node.id, node.name);
}
treeDocumentSelected('= $formid ?>', 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);
} /* }}} */
/**
* Deprecated!
*/
function __printTreeNavigation($folderid, $showtree){ /* {{{ */
if ($showtree==1){
$this->contentHeading("params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid."&showtree=0\">", true);
$this->contentContainerStart();
?>
printNewTreeNavigation($folderid, M_READ, 0, '');
$this->contentContainerEnd();
} else {
$this->contentHeading("params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid."&showtree=1\">", true);
}
} /* }}} */
/**
* Print clipboard in div container
*
* @param array clipboard
*/
function printClipboard($clipboard, $previewer){ /* {{{ */
echo "
";
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 "
";
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);
if($cc['folder_count'])
$content .= ' '.$cc['folder_count']." ";
if($cc['document_count'])
$content .= ' '.$cc['document_count'];
} else {
$cc = $subFolder->countChildren($user, $maxRecursiveCount);
if($maxRecursiveCount > 5000)
$rr = 100.0;
else
$rr = 10.0;
if($cc['folder_count'])
$content .= ' '.(!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ";
if($cc['document_count'])
$content .= ' '.(!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count']);
}
} 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);
if(count($subsub))
$content .= ' '.count($subsub)." ";
if(count($subdoc))
$content .= ' '.count($subdoc);
}
$content .= "
";
$html .= htmlspecialchars($errormsg);
$this->errorMsg($html);
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: 'params['settings']->_encryptionKey.'uploadchunks'); ?>'
},
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('= $formname ?>').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();
$accessop = $this->params['accessobject'];
?>
,
getReviewStatus(10);
break;
case "approval":
$statusList = $latestContent->getApprovalStatus(10);
break;
default:
$statusList = array();
}
foreach($statusList as $rec) {
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 "