Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2022-02-12 19:48:56 +01:00
commit f93af56f52
16 changed files with 574 additions and 351 deletions

View File

@ -2,7 +2,7 @@ VERSION=$(shell php -r 'include("inc/inc.Version.php"); $$v=new SeedDMS_Version(
SRC=CHANGELOG inc conf utils index.php .htaccess languages op out controllers doc TODO LICENSE webdav install restapi pdfviewer
VIEWS ?= bootstrap bootstrap4
NODISTFILES=utils/importmail.php utils/seedddms-importmail utils/remote-email-upload utils/remote-upload utils/da-bv-reminder.php utils/seeddms-da-bv-reminder .svn .gitignore
NODISTFILES=utils/importmail.php utils/seedddms-importmail utils/remote-email-upload utils/remote-upload utils/da-bv-reminder.php utils/seeddms-da-bv-reminder utils/relodge.php utils/seeddms-relodge .svn .gitignore
PHPDOC=~/Downloads/phpDocumentor.phar

View File

@ -83,7 +83,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
* @param array $attachments list of attachments
* @return false or -1 in case of error, otherwise true
*/
function toIndividual($sender, $recipient, $subject, $messagekey, $params=array(), $attachments=array()) { /* {{{ */
function toIndividual($sender, $recipient, $subject, $messagekey, $params=array(), $attachments=array(), $images=array()) { /* {{{ */
if(is_object($recipient) && $recipient->isType('user') && !$recipient->isDisabled() && $recipient->getEmail()!="") {
$to = $recipient->getEmail();
$lang = $recipient->getLanguage();
@ -157,6 +157,19 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify {
if($bodyhtml)
$mime->setHTMLBody($bodyhtml);
if($images) {
foreach($images as $image) {
if(!$mime->addHTMLImage(
$image['file'],
$image['mimetype'],
isset($image['name']) ? $image['name'] : '',
isset($image['isfile']) ? $image['isfile'] : true
)) {
return false;
}
}
}
if($attachments) {
foreach($attachments as $attachment) {
if(!$mime->addAttachment(

View File

@ -1237,7 +1237,7 @@ class SeedDMS_NotificationService {
/* Send mail to old owner only if the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $oldowner()->getID() && false === SeedDMS_Core_DMS::inList($oldowner(), $notifyList['users']))
if($user->getID() != $oldowner->getID() && false === SeedDMS_Core_DMS::inList($oldowner, $notifyList['users']))
$this->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
}
} /* }}} */
@ -1266,7 +1266,7 @@ class SeedDMS_NotificationService {
/* Send mail to old owner only if the currently logged in user is not the
* owner and the owner is not already in the list of notifiers.
*/
if($user->getID() != $oldowner()->getID() && false === SeedDMS_Core_DMS::inList($oldowner(), $notifyList['users']))
if($user->getID() != $oldowner->getID() && false === SeedDMS_Core_DMS::inList($oldowner, $notifyList['users']))
$this->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER);
}
} /* }}} */

View File

@ -330,6 +330,7 @@ class RestapiController { /* {{{ */
$dms = $this->container->dms;
$userobj = $this->container->userobj;
$id = $args['id'];
if($id == 0) {
return $response->withJson(array('success'=>true, 'message'=>'id is 0', 'data'=>''), 200);
}
@ -1308,6 +1309,7 @@ class RestapiController { /* {{{ */
$dms = $this->container->dms;
$userobj = $this->container->userobj;
$settings = $this->container->config;
$conversionmgr = $this->container->conversionmgr;
if(!ctype_digit($args['id'])) {
return $response->withJson(array('success'=>false, 'message'=>'Invalid parameter', 'data'=>''), 400);
@ -1328,6 +1330,10 @@ class RestapiController { /* {{{ */
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $args['width']);
else
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
if($conversionmgr)
$previewer->setConversionMgr($conversionmgr);
else
$previewer->setConverters($settings->_converters['preview']);
if(!$previewer->hasPreview($object))
$previewer->createPreview($object);
@ -2425,6 +2431,7 @@ class Auth { /* {{{ */
$container = $app->getContainer();
$container['dms'] = $dms;
$container['config'] = $settings;
$container['conversionmgr'] = $conversionmgr;
$app->add(new Auth($container));
// Make CORS preflighted request possible

View File

@ -122,9 +122,9 @@ if(isset($options['f'])) {
exit(1);
}
$mimetype = '';
$mymimetype = '';
if(isset($options['t'])) {
$mimetype = $options['t'];
$mymimetype = $options['t'];
}
$reqversion = 0;
@ -248,8 +248,8 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) {
if(is_readable($filename)) {
if(filesize($filename)) {
$finfo = new finfo(FILEINFO_MIME_TYPE);
if(!$mimetype) {
$mimetype = $finfo->file($filename);
if(!$mymimetype) {
$mymimetype = $finfo->file($filename);
}
$filetype = "." . pathinfo($filename, PATHINFO_EXTENSION);
} else {
@ -304,20 +304,11 @@ $filetmp = $filename;
$reviewers = array();
$approvers = array();
if($settings->_enableFullSearch) {
$index = $indexconf['Indexer']::open($settings->_luceneDir);
$indexconf['Indexer']::init($settings->_stopWordsFile);
} else {
$index = null;
$indexconf = null;
}
if($folder) {
$controller = Controller::factory('AddDocument', array('dms'=>$dms, 'user'=>$user));
$controller->setParam('documentsource', 'script');
$controller->setParam('folder', $folder);
$controller->setParam('index', $index);
$controller->setParam('indexconf', $indexconf);
$controller->setParam('fulltextservice', $fulltextservice);
$controller->setParam('name', $name);
$controller->setParam('comment', $comment);
$controller->setParam('expires', $expires);
@ -327,7 +318,7 @@ if($folder) {
$controller->setParam('userfiletmp', $filetmp);
$controller->setParam('userfilename', basename($filename));
$controller->setParam('filetype', $filetype);
$controller->setParam('userfiletype', $mimetype);
$controller->setParam('userfiletype', $mymimetype);
$minmax = $folder->getDocumentsMinMax();
if($settings->_defaultDocPosition == 'start')
$controller->setParam('sequence', $minmax['min'] - 1);

View File

@ -87,10 +87,9 @@ if(isset($options['sections'])) {
$sections = explode(',', $options['sections']);
}
$folderid = 0;
if(isset($options['folder'])) {
$folderid = intval($options['folder']);
} else {
$folderid = $settings->_rootFolderID;
}
$skiproot = false;
@ -477,6 +476,10 @@ include($myincpath."/inc/inc.DBInit.php");
include($myincpath."/inc/inc.ClassSettings.php");
include($myincpath."/inc/inc.Acl.php");
if(!$folderid) {
$folderid = $settings->_rootFolderID;
}
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<dms dbversion=\"".implode('.', array_slice($dms->getDBVersion(), 1, 3))."\" date=\"".date('Y-m-d H:i:s')."\">\n";

View File

@ -134,13 +134,8 @@ $(document).ready( function() {
}
if($res['folders'] || $res['docs']) {
print "<table id=\"viewfolder-table\" class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
print $this->folderListHeader();
print "<tbody>\n";
foreach($res['folders'] as $subFolder) {
echo $this->folderListRow($subFolder);
}

View File

@ -1234,6 +1234,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
(!empty($value['class']) ? ' class="'.$value['class'].'"' : '').
(!empty($value['rows']) ? ' rows="'.$value['rows'].'"' : '').
(!empty($value['cols']) ? ' cols="'.$value['cols'].'"' : '').
(!empty($value['placeholder']) ? ' placeholder="'.$value['placeholder'].'"' : '').
(!empty($value['required']) ? ' required="required"' : '').">".(!empty($value['value']) ? $value['value'] : '')."</textarea>";
break;
case 'plain':
@ -1243,6 +1244,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
default:
switch($value['type']) {
default:
if(!empty($value['addon']))
echo "<span class=\"input-append\">";
echo '<input'.
(!empty($value['type']) ? ' type="'.$value['type'].'"' : '').
(!empty($value['id']) ? ' id="'.$value['id'].'"' : '').
@ -1258,6 +1261,10 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
foreach($value['attributes'] as $a)
echo ' '.$a[0].'="'.$a[1].'"';
echo "/>";
if(!empty($value['addon'])) {
echo '<span class="add-on">'.$value['addon'].'</span>';
echo "</span>\n";
}
break;
}
break;
@ -1413,8 +1420,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
* @return string
*/
function getModalBoxLink($config) { /* {{{ */
$content = '';
$content .= "<a data-target=\"#".$config['target']."\"".(isset($config['remote']) ? " href=\"".$config['remote']."\"" : "")." role=\"button\" class=\"".(isset($config['class']) ? $config['class'] : "btn")."\" data-toggle=\"modal\"";
// $content = '';
// $content .= "<a data-target=\"#".$config['target']."\"".(isset($config['remote']) ? " href=\"".$config['remote']."\"" : "")." role=\"button\" class=\"".(isset($config['class']) ? $config['class'] : "btn")."\" data-toggle=\"modal\"";
$attrs = self::getModalBoxLinkAttributes($config);
$content = '<a';
if($attrs) {
@ -2952,6 +2959,44 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
return $belowtitle;
} /* }}} */
public function folderListHeaderImage() { /* {{{ */
$folder = $this->getParam('folder');
$onepage = $this->params['onepage'];
$parent = ($folder && $onepage) ? $folder->getParent() : null;
$headcol = ($parent ? '<button class="btn btn-mini btn-secondary btn-sm" id="goto-parent" data-parentid="'.$parent->getID().'"><i class="fa fa-arrow-up"></i></button>' : '')."</th>\n";
return $headcol;
} /* }}} */
public function folderListHeaderName() { /* {{{ */
$folder = $this->getParam('folder');
$headcol = getMLText("name");
if($folder) {
$folderid = $folder->getId();
$orderby = $this->params['orderby'];
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
$headcol .= " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"||$orderby=="na"?"&orderby=nd":"&orderby=n")."\" data-orderby=\"".($orderby=="n"||$orderby=="na"?"nd":"n")."\"title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
$headcol .= " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="s"||$orderby=="sa"?"&orderby=sd":"&orderby=s")."\" data-orderby=\"".($orderby=="s"||$orderby=="sa"?"sd":"s")."\" title=\"".getMLText("sort_by_sequence")."\">".($orderby=="s"||$orderby=="sa"?' <i class="fa fa-sort-numeric-asc selected"></i>':($orderby=="sd"?' <i class="fa fa-sort-numeric-desc selected"></i>':' <i class="fa fa-sort-numeric-asc"></i>'))."</a>";
$headcol .= " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="d"||$orderby=="da"?"&orderby=dd":"&orderby=d")."\" data-orderby=\"".($orderby=="d"||$orderby=="da"?"dd":"d")."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="fa fa-sort-amount-asc selected"></i>':($orderby=="dd"?' <i class="fa fa-sort-amount-desc selected"></i>':' <i class="fa fa-sort-amount-asc"></i>'))."</a>";
}
return $headcol;
} /* }}} */
public function folderListHeader() { /* {{{ */
$content = "<table id=\"viewfolder-table\" class=\"table table-condensed table-sm table-hover\">";
$content .= "<thead>\n<tr>\n";
$headcols = array();
$headcols['image'] = $this->folderListHeaderImage();
$headcols['name'] = $this->folderListHeaderName();
if($ec = $this->callHook('folderListHeaderExtraColumns'))
$headcols = array_merge($headcols, $ec);
$headcols['status'] = getMLText("status");
$headcols['action'] = getMLText("action");
foreach($headcols as $headcol)
$content .= "<th>".$headcol."</th>\n";
$content .= "</tr>\n</thead>\n";
return $content;
} /* }}} */
/**
* Start the row for a folder in list of documents and folders
*
@ -2967,6 +3012,96 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
return "</tr>\n";
} /* }}} */
function documentListRowStatus($latestContent) { /* {{{ */
$user = $this->params['user'];
$workflowmode = $this->params['workflowmode'];
$document = $latestContent->getDocument();
$status = $latestContent->getStatus();
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
}
$needwkflaction = false;
if($workflowmode == 'advanced') {
$workflow = $latestContent->getWorkflow();
if($workflow) {
$needwkflaction = $latestContent->needsWorkflowAction($user);
}
}
if ( $needwkflaction ) {
$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> ";
}
$content = '';
if($attentionstr)
$content .= $attentionstr."<br />";
$content .= "<small>";
/* 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);
if(count($files))
$content .= count($files)." ".getMLText("linked_files")."<br />";
if(count($links) || count($revlinks))
$content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."<br />";
if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') {
if($workflowstate = $latestContent->getWorkflowState())
$content .= '<span title="'.getOverallStatusText($status["status"]).': '.($workflow ? htmlspecialchars($workflow->getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').'</span>';
} else {
$content .= getOverallStatusText($status["status"]);
}
$content .= "</small>";
return $content;
} /* }}} */
function documentListRowAction($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */
$user = $this->params['user'];
$enableClipboard = $this->params['enableclipboard'];
$accessop = $this->params['accessobject'];
$onepage = $this->params['onepage'];
$content = '';
$content .= "<div class=\"list-action\">";
if(!empty($extracontent['begin_action_list']))
$content .= $extracontent['begin_action_list'];
if($accessop->check_view_access('RemoveDocument')) {
if($document->getAccessMode($user) >= M_ALL) {
$content .= $this->printDeleteDocumentButton($document, 'splash_rm_document', true);
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-remove"></i></span>';
}
}
$docID = $document->getID();
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.EditDocument.php?documentid='.$docID.'" title="'.getMLText("edit_document_props").'"><i class="fa fa-edit"></i></a>';
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-edit"></i></span>';
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true);
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= $this->printAccessButton($document, true);
}
if($enableClipboard) {
$content .= '<a class="addtoclipboard" rel="D'.$docID.'" msg="'.getMLText('splash_added_to_clipboard').'" title="'.getMLText("add_to_clipboard").'"><i class="fa fa-copy"></i></a>';
}
if($onepage)
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewDocument.php?documentid='.$docID.'" title="'.getMLText("view_document").'"><i class="fa fa-eye"></i></a>';
if(!empty($extracontent['end_action_list']))
$content .= $extracontent['end_action_list'];
$content .= "</div>";
return $content;
} /* }}} */
/**
* Return HTML of a single row in the document list table
*
@ -3007,26 +3142,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$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);
if($ec = $this->callHook('documentListRowExtraContent', $document, $latestContent))
$extracontent = array_merge($extracontent, $ec);
$content .= "<td>";
if (file_exists($dms->contentDir . $latestContent->getPath())) {
@ -3072,27 +3190,13 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= $extracontent['bottom_title'];
$content .= "</td>\n";
if(!empty($extracontent['columns'])) {
foreach($extracontent['columns'] as $col)
$content .= '<td>'.$col.'</td>';
}
$content .= "<td nowrap>";
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
}
if ( $needwkflaction ) {
$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> ";
}
if($attentionstr)
$content .= $attentionstr."<br />";
$content .= "<small>";
if(count($files))
$content .= count($files)." ".getMLText("linked_files")."<br />";
if(count($links) || count($revlinks))
$content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."<br />";
if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') {
$workflowstate = $latestContent->getWorkflowState();
$content .= '<span title="'.getOverallStatusText($status["status"]).': '.($workflow ? htmlspecialchars($workflow->getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').'</span>';
} else {
$content .= getOverallStatusText($status["status"]);
}
$content .= $this->documentListRowStatus($latestContent);
if($accessop->check_view_access($this, array('action'=>'receptionBar')) /*$owner->getID() == $user->getID()*/ && $receiptStatus = $latestContent->getReceiptStatus()) {
$rstat = array('-1'=>0, '0'=>0, '1'=>0, '-2'=>0);
$allcomments = array('-1'=>array(), '1'=>array());
@ -3119,35 +3223,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= "</small></td>";
// $content .= "<td>".$version."</td>";
$content .= "<td>";
$content .= "<div class=\"list-action\">";
if(!empty($extracontent['begin_action_list']))
$content .= $extracontent['begin_action_list'];
if($accessop->check_view_access('RemoveDocument')) {
if($document->getAccessMode($user) >= M_ALL) {
$content .= $this->printDeleteDocumentButton($document, 'splash_rm_document', true);
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-remove"></i></span>';
}
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.EditDocument.php?documentid='.$docID.'" title="'.getMLText("edit_document_props").'"><i class="fa fa-edit"></i></a>';
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-edit"></i></span>';
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true);
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= $this->printAccessButton($document, true);
}
if($enableClipboard) {
$content .= '<a class="addtoclipboard" rel="D'.$docID.'" msg="'.getMLText('splash_added_to_clipboard').'" title="'.getMLText("add_to_clipboard").'"><i class="fa fa-copy"></i></a>';
}
if($onepage)
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewDocument.php?documentid='.$docID.'" title="'.getMLText("view_document").'"><i class="fa fa-eye"></i></a>';
if(!empty($extracontent['end_action_list']))
$content .= $extracontent['end_action_list'];
$content .= "</div>";
$content .= $this->documentListRowAction($document, $previewer, $skipcont, $version, $extracontent);
$content .= "</td>";
if(!$skipcont)
$content .= $this->documentListRowEnd($document);
@ -3195,6 +3271,50 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
return "</tr>\n";
} /* }}} */
function folderListRowAction($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'];
$accessop = $this->params['accessobject'];
$onepage = $this->params['onepage'];
$content = '';
$content .= "<div class=\"list-action\">";
if(!empty($extracontent['begin_action_list']))
$content .= $extracontent['begin_action_list'];
$subFolderAccessMode = $subFolder->getAccessMode($user);
if ($accessop->check_view_access('RemoveFolder')) {
if($subFolderAccessMode >= M_ALL) {
$content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true);
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-remove"></i></span>';
}
}
if ($accessop->check_view_access('EditFolder')) {
if($subFolderAccessMode >= M_READWRITE) {
$content .= '<a class_="btn btn-mini" href="'.$this->params['settings']->_httpRoot.'out/out.EditFolder.php?folderid='.$subFolder->getID().'" title="'.getMLText("edit_folder_props").'"><i class="fa fa-edit"></i></a>';
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-edit"></i></span>';
}
}
if($subFolderAccessMode >= M_READWRITE) {
$content .= $this->printAccessButton($subFolder, true);
}
if($enableClipboard) {
$content .= '<a class="addtoclipboard" rel="F'.$subFolder->getID().'" msg="'.getMLText('splash_added_to_clipboard').'" title="'.getMLText("add_to_clipboard").'"><i class="fa fa-copy"></i></a>';
}
if($onepage)
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewFolder.php?folderid='.$subFolder->getID().'" title="'.getMLText("view_folder").'"><i class="fa fa-eye"></i></a>';
if(!empty($extracontent['end_action_list']))
$content .= $extracontent['end_action_list'];
$content .= "</div>";
return $content;
} /* }}} */
function folderListRow($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -3213,6 +3333,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$comment = $subFolder->getComment();
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
if($ec = $this->callHook('folderListRowExtraContent', $subFolder))
$extracontent = array_merge($extracontent, $ec);
$content = '';
if(!$skipcont)
$content .= $this->folderListRowStart($subFolder);
@ -3259,37 +3382,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= count($subsub)." ".getMLText("folders")."<br />".count($subdoc)." ".getMLText("documents");
}
$content .= "</small></td>";
// $content .= "<td></td>";
$content .= "<td>";
$content .= "<div class=\"list-action\">";
if(!empty($extracontent['begin_action_list']))
$content .= $extracontent['begin_action_list'];
$subFolderAccessMode = $subFolder->getAccessMode($user);
if ($accessop->check_view_access('RemoveFolder')) {
if($subFolderAccessMode >= M_ALL) {
$content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true);
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-remove"></i></span>';
}
}
if ($accessop->check_view_access('EditFolder')) {
if($subFolderAccessMode >= M_READWRITE) {
$content .= '<a class_="btn btn-mini" href="'.$this->params['settings']->_httpRoot.'out/out.EditFolder.php?folderid='.$subFolder->getID().'" title="'.getMLText("edit_folder_props").'"><i class="fa fa-edit"></i></a>';
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-edit"></i></span>';
}
}
if($subFolderAccessMode >= M_READWRITE) {
$content .= $this->printAccessButton($subFolder, true);
}
if($enableClipboard) {
$content .= '<a class="addtoclipboard" rel="F'.$subFolder->getID().'" msg="'.getMLText('splash_added_to_clipboard').'" title="'.getMLText("add_to_clipboard").'"><i class="fa fa-copy"></i></a>';
}
if($onepage)
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewFolder.php?folderid='.$subFolder->getID().'" title="'.getMLText("view_folder").'"><i class="fa fa-eye"></i></a>';
if(!empty($extracontent['end_action_list']))
$content .= $extracontent['end_action_list'];
$content .= "</div>";
$content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent);
$content .= "</td>";
if(!$skipcont)
$content .= $this->folderListRowEnd($subFolder);

View File

@ -49,18 +49,11 @@ class SeedDMS_View_Calendar extends SeedDMS_Theme_Style {
$xsendfile = $this->params['xsendfile'];
if($document) {
// $this->contentHeading(getMLText("timeline_selected_item"));
print "<table id=\"viewfolder-table\" class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
echo $this->documentListRow($document, $previewer);
echo "</tbody>\n</table>\n";
print $this->folderListHeader();
print "<tbody>\n";
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
echo $this->documentListRow($document, $previewer);
echo "</tbody>\n</table>\n";
}
if($event) {
// print_r($event);

View File

@ -70,13 +70,8 @@ $(document).ready( function() {
$documents = $selcat->getDocumentsByCategory(10);
if($documents) {
print "<table id=\"viewfolder-table\" class=\"table\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
print $this->folderListHeader();
print "<tbody>\n";
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
foreach($documents as $doc) {
echo $this->documentListRow($doc, $previewer);

View File

@ -171,6 +171,20 @@ function typeahead() { /* {{{ */
echo json_encode($recs);
} /* }}} */
public function folderListHeaderName() { /* {{{ */
$orderby = $this->params['orderby'];
$fullsearch = $this->params['fullsearch'];
parse_str($_SERVER['QUERY_STRING'], $tmp);
$tmp['orderby'] = ($orderby=="n"||$orderby=="na") ? "nd" : "n";
$headcol = getMLText("name");
if(!$fullsearch) {
$headcol .= $orderby." <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
$tmp['orderby'] = ($orderby=="d"||$orderby=="da") ? "dd" : "d";
$headcol .= " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="fa fa-sort-amount-asc selected"></i>':($orderby=="dd"?' <i class="fa fa-sort-amount-desc selected"></i>':' <i class="fa fa-sort-amount-asc"></i>'))."</a>";
}
return $headcol;
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -715,93 +729,79 @@ function typeahead() { /* {{{ */
// $this->contentContainerStart();
$txt = $this->callHook('searchListHeader', $orderby, 'asc');
if(is_string($txt))
if(is_string($txt)) {
echo $txt;
else {
parse_str($_SERVER['QUERY_STRING'], $tmp);
$tmp['orderby'] = ($orderby=="n"||$orderby=="na") ? "nd" : "n";
} elseif(is_array($txt)) {
print "<table class=\"table table-condensed table-sm table-hover\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name");
if(!$fullsearch) {
print $orderby." <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
$tmp['orderby'] = ($orderby=="d"||$orderby=="da") ? "dd" : "d";
print " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="fa fa-sort-amount-asc selected"></i>':($orderby=="dd"?' <i class="fa fa-sort-amount-desc selected"></i>':' <i class="fa fa-sort-amount-asc"></i>'))."</a>";
}
print "</th>\n";
//print "<th>".getMLText("attributes")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach($txt as $headcol)
echo "<th>".$headcol."</th>\n";
print "</tr>\n</thead>\n";
} else {
echo $this->folderListHeader(null, 'search');
}
print "<tbody>\n";
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
$previewer->setConverters($previewconverters);
foreach ($entries as $entry) {
if($entry->isType('document')) {
$txt = $this->callHook('documentListItem', $entry, $previewer, false, 'search');
$document = $entry;
if($lc = $document->getLatestContent())
$previewer->createPreview($lc);
$lcattributes = $lc ? $lc->getAttributes() : null;
$attrstr = '';
if($lcattributes) {
$attrstr .= "<table class=\"table table-condensed table-sm\">\n";
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
foreach($lcattributes as $lcattribute) {
$arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute);
if(is_array($arr)) {
$attrstr .= "<tr>";
$attrstr .= "<td>".$arr[0].":</td>";
$attrstr .= "<td>".$arr[1]."</td>";
$attrstr .= "</tr>";
} elseif(is_string($arr)) {
$attrstr .= $arr;
} else {
$attrdef = $lcattribute->getAttributeDefinition();
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."</td></tr>\n";
// TODO: better use printAttribute()
// $this->printAttribute($lcattribute);
}
}
$attrstr .= "</table>\n";
}
$docattributes = $document->getAttributes();
if($docattributes) {
$attrstr .= "<table class=\"table table-condensed table-sm\">\n";
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
foreach($docattributes as $docattribute) {
$arr = $this->callHook('showDocumentAttribute', $document, $docattribute);
if(is_array($arr)) {
$attrstr .= "<tr>";
$attrstr .= "<td>".$arr[0].":</td>";
$attrstr .= "<td>".$arr[1]."</td>";
$attrstr .= "</tr>";
} elseif(is_string($arr)) {
$attrstr .= $arr;
} else {
$attrdef = $docattribute->getAttributeDefinition();
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $docattribute->getValueAsArray()))."</td></tr>\n";
}
}
$attrstr .= "</table>\n";
}
$extracontent = array();
$extracontent['below_title'] = $this->getListRowPath($document);
if($attrstr)
$extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-sm btn-secondary">'.getMLText('attributes').'</span>', $attrstr, true);
$txt = $this->callHook('documentListItem', $entry, $previewer, false, 'search', $extracontent);
if(is_string($txt))
echo $txt;
else {
$document = $entry;
$owner = $document->getOwner();
if($lc = $document->getLatestContent())
$previewer->createPreview($lc);
if (in_array(3, $searchin))
$comment = $this->markQuery(htmlspecialchars($document->getComment()));
else
$comment = htmlspecialchars($document->getComment());
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
$lcattributes = $lc ? $lc->getAttributes() : null;
$attrstr = '';
if($lcattributes) {
$attrstr .= "<table class=\"table table-condensed table-sm\">\n";
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
foreach($lcattributes as $lcattribute) {
$arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute);
if(is_array($arr)) {
$attrstr .= "<tr>";
$attrstr .= "<td>".$arr[0].":</td>";
$attrstr .= "<td>".$arr[1]."</td>";
$attrstr .= "</tr>";
} elseif(is_string($arr)) {
$attrstr .= $arr;
} else {
$attrdef = $lcattribute->getAttributeDefinition();
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."</td></tr>\n";
// TODO: better use printAttribute()
// $this->printAttribute($lcattribute);
}
}
$attrstr .= "</table>\n";
}
$docattributes = $document->getAttributes();
if($docattributes) {
$attrstr .= "<table class=\"table table-condensed table-sm\">\n";
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
foreach($docattributes as $docattribute) {
$arr = $this->callHook('showDocumentAttribute', $document, $docattribute);
if(is_array($arr)) {
$attrstr .= "<tr>";
$attrstr .= "<td>".$arr[0].":</td>";
$attrstr .= "<td>".$arr[1]."</td>";
$attrstr .= "</tr>";
} elseif(is_string($arr)) {
$attrstr .= $arr;
} else {
$attrdef = $docattribute->getAttributeDefinition();
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $docattribute->getValueAsArray()))."</td></tr>\n";
}
}
$attrstr .= "</table>\n";
}
$extracontent = array();
$extracontent['below_title'] = $this->getListRowPath($document);
if($attrstr)
$extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-sm btn-secondary">'.getMLText('attributes').'</span>', $attrstr, true);
print $this->documentListRow($document, $previewer, false, 0, $extracontent);
}
} elseif($entry->isType('folder')) {
@ -810,12 +810,6 @@ function typeahead() { /* {{{ */
echo $txt;
else {
$folder = $entry;
$owner = $folder->getOwner();
if (in_array(2, $searchin)) {
$folderName = $this->markQuery(htmlspecialchars($folder->getName()), "i");
} else {
$folderName = htmlspecialchars($folder->getName());
}
$attrstr = '';
$folderattributes = $folder->getAttributes();

View File

@ -47,14 +47,8 @@ class SeedDMS_View_Timeline extends SeedDMS_Theme_Style {
$xsendfile = $this->params['xsendfile'];
if($document && $version) {
// $this->contentHeading(getMLText("timeline_selected_item"));
print "<table id=\"viewfolder-table\" class=\"table table-condensed table-sm\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
print $this->folderListHeader();
print "<tbody>\n";
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile);
$extracontent = array();
$extracontent['below_title'] = $this->getListRowPath($document);

View File

@ -382,7 +382,6 @@ $('body').on('click', '.order-btn', function(ev) {
if($documents === null)
$documents = $folder->getDocuments($orderby[0], $orderdir);
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
$parent = $onepage ? $folder->getParent() : null;
$txt = $this->callHook('folderListPreContent', $folder, $subFolders, $documents);
if(is_string($txt))
@ -390,23 +389,18 @@ $('body').on('click', '.order-btn', function(ev) {
$i = 0;
if ((count($subFolders) > 0)||(count($documents) > 0)){
$txt = $this->callHook('folderListHeader', $folder, $orderby, $orderdir);
if(is_string($txt))
if(is_string($txt)) {
echo $txt;
else {
} elseif(is_array($txt)) {
print "<table id=\"viewfolder-table\" class=\"table table-condensed table-sm table-hover\">";
print "<thead>\n<tr>\n";
print "<th>".($parent ? '<button class="btn btn-mini btn-secondary btn-sm" id="goto-parent" data-parentid="'.$parent->getID().'"><i class="fa fa-arrow-up"></i></button>' : '')."</th>\n";
print "<th>".getMLText("name");
print " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"||$orderby=="na"?"&orderby=nd":"&orderby=n")."\" data-orderby=\"".($orderby=="n"||$orderby=="na"?"nd":"n")."\"title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
print " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="s"||$orderby=="sa"?"&orderby=sd":"&orderby=s")."\" data-orderby=\"".($orderby=="s"||$orderby=="sa"?"sd":"s")."\" title=\"".getMLText("sort_by_sequence")."\">".($orderby=="s"||$orderby=="sa"?' <i class="fa fa-sort-numeric-asc selected"></i>':($orderby=="sd"?' <i class="fa fa-sort-numeric-desc selected"></i>':' <i class="fa fa-sort-numeric-asc"></i>'))."</a>";
print " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="d"||$orderby=="da"?"&orderby=dd":"&orderby=d")."\" data-orderby=\"".($orderby=="d"||$orderby=="da"?"dd":"d")."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="fa fa-sort-amount-asc selected"></i>':($orderby=="dd"?' <i class="fa fa-sort-amount-desc selected"></i>':' <i class="fa fa-sort-amount-asc"></i>'))."</a>";
print "</th>\n";
// print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
// print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach($txt as $headcol)
echo "<th>".$headcol."</th>\n";
print "</tr>\n</thead>\n";
} else {
echo $this->folderListHeader();
}
print "<tbody>\n";
foreach($subFolders as $subFolder) {
if(!$maxItemsPerPage || $i < $maxItemsPerPage) {

View File

@ -492,6 +492,7 @@ $(document).ready( function() {
}
}
initMost();
SeedDMSAjax.run(view, action);
});
}); /* }}} */
@ -542,6 +543,7 @@ $(document).ready( function() {
}
}
initMost();
SeedDMSAjax.run(view, action);
});
}); /* }}} */
@ -1366,3 +1368,27 @@ $(document).ready(function() { /* {{{ */
timeOutId = setTimeout(SeedDMSTask.run, timeout);
}
}( window.SeedDMSTask = window.SeedDMSTask || {}, jQuery )); /* }}} */
(function( SeedDMSAjax, $, undefined ) { /* {{{ */
var tasks = Array(
{name: 'test', view: 'null', action: null, func:
test = function() {
console.log('Run in SeedDMSAjax');
}
}
);
SeedDMSAjax.add = function(task) {
tasks.push(task);
}
SeedDMSAjax.run = function(view, action) {
for(let task of tasks) {
//console.log('Checking for '+view+':'+action);
if(task.view == null || (task.view == view && task.action == null) || (task.view == view && task.action == action)) {
//console.log('Running '+task.name+' after update for '+view+':'+action);
task.func();
}
}
}
}( window.SeedDMSAjax = window.SeedDMSAjax || {}, jQuery )); /* }}} */

View File

@ -151,7 +151,10 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
} /* }}} */
function htmlAddHeader($head, $type='js') { /* {{{ */
$this->extraheader[$type] .= $head;
if($type == 'logo' || $type == 'favicon')
$this->extraheader[$type] = $head;
else
$this->extraheader[$type] .= $head;
} /* }}} */
function htmlAddJsHeader($script) { /* {{{ */
@ -1160,6 +1163,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo "</div>";
break;
default:
if(!empty($value['addon']))
echo '<div class="input-group date">';
echo '<input'.
(!empty($value['type']) ? ' type="'.$value['type'].'"' : '').
(!empty($value['id']) ? ' id="'.$value['id'].'"' : '').
@ -1175,6 +1180,12 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
foreach($value['attributes'] as $a)
echo ' '.$a[0].'="'.$a[1].'"';
echo "/>";
if(!empty($value['addon'])) {
echo '<div class="input-group-append">';
echo '<span class="input-group-text">'.$value['addon'].'</span>';
echo '</div>';
echo '</div>';
}
break;
}
break;
@ -1330,8 +1341,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
* @return string
*/
function getModalBoxLink($config) { /* {{{ */
$content = '';
$content .= "<a data-target=\"#".$config['target']."\"".(isset($config['remote']) ? " href=\"".$config['remote']."\"" : "")." role=\"button\" class=\"".(isset($config['class']) ? $config['class'] : "btn btn-secondary")."\" data-toggle=\"modal\"";
// $content = '';
// $content .= "<a data-target=\"#".$config['target']."\"".(isset($config['remote']) ? " href=\"".$config['remote']."\"" : "")." role=\"button\" class=\"".(isset($config['class']) ? $config['class'] : "btn btn-secondary")."\" data-toggle=\"modal\"";
$attrs = self::getModalBoxLinkAttributes($config);
$content = '<a';
if($attrs) {
@ -2932,6 +2943,44 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
return $belowtitle;
} /* }}} */
public function folderListHeaderImage() { /* {{{ */
$folder = $this->getParam('folder');
$onepage = $this->params['onepage'];
$parent = ($folder && $onepage) ? $folder->getParent() : null;
$headcol = ($parent ? '<button class="btn btn-mini btn-secondary btn-sm" id="goto-parent" data-parentid="'.$parent->getID().'"><i class="fa fa-arrow-up"></i></button>' : '')."</th>\n";
return $headcol;
} /* }}} */
public function folderListHeaderName() { /* {{{ */
$folder = $this->getParam('folder');
$headcol = getMLText("name");
if($folder) {
$folderid = $folder->getId();
$orderby = $this->params['orderby'];
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
$headcol .= " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"||$orderby=="na"?"&orderby=nd":"&orderby=n")."\" data-orderby=\"".($orderby=="n"||$orderby=="na"?"nd":"n")."\"title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
$headcol .= " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="s"||$orderby=="sa"?"&orderby=sd":"&orderby=s")."\" data-orderby=\"".($orderby=="s"||$orderby=="sa"?"sd":"s")."\" title=\"".getMLText("sort_by_sequence")."\">".($orderby=="s"||$orderby=="sa"?' <i class="fa fa-sort-numeric-asc selected"></i>':($orderby=="sd"?' <i class="fa fa-sort-numeric-desc selected"></i>':' <i class="fa fa-sort-numeric-asc"></i>'))."</a>";
$headcol .= " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="d"||$orderby=="da"?"&orderby=dd":"&orderby=d")."\" data-orderby=\"".($orderby=="d"||$orderby=="da"?"dd":"d")."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="fa fa-sort-amount-asc selected"></i>':($orderby=="dd"?' <i class="fa fa-sort-amount-desc selected"></i>':' <i class="fa fa-sort-amount-asc"></i>'))."</a>";
}
return $headcol;
} /* }}} */
public function folderListHeader() { /* {{{ */
$content = "<table id=\"viewfolder-table\" class=\"table table-condensed table-sm table-hover\">";
$content .= "<thead>\n<tr>\n";
$headcols = array();
$headcols['image'] = $this->folderListHeaderImage();
$headcols['name'] = $this->folderListHeaderName();
if($ec = $this->callHook('folderListHeaderExtraColumns'))
$headcols = array_merge($headcols, $ec);
$headcols['status'] = getMLText("status");
$headcols['action'] = getMLText("action");
foreach($headcols as $headcol)
$content .= "<th>".$headcol."</th>\n";
$content .= "</tr>\n</thead>\n";
return $content;
} /* }}} */
/**
* Start the row for a folder in list of documents and folders
*
@ -2953,6 +3002,96 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
return "</tr>\n";
} /* }}} */
function documentListRowStatus($latestContent) { /* {{{ */
$user = $this->params['user'];
$workflowmode = $this->params['workflowmode'];
$document = $latestContent->getDocument();
$status = $latestContent->getStatus();
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
}
$needwkflaction = false;
if($workflowmode == 'advanced') {
$workflow = $latestContent->getWorkflow();
if($workflow) {
$needwkflaction = $latestContent->needsWorkflowAction($user);
}
}
if ( $needwkflaction ) {
$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> ";
}
$content = '';
if($attentionstr)
$content .= $attentionstr."<br />";
$content .= "<small>";
/* 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);
if(count($files))
$content .= count($files)." ".getMLText("linked_files")."<br />";
if(count($links) || count($revlinks))
$content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."<br />";
if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') {
if($workflowstate = $latestContent->getWorkflowState())
$content .= '<span title="'.getOverallStatusText($status["status"]).': '.($workflow ? htmlspecialchars($workflow->getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').'</span>';
} else {
$content .= getOverallStatusText($status["status"]);
}
$content .= "</small>";
return $content;
} /* }}} */
function documentListRowAction($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */
$user = $this->params['user'];
$enableClipboard = $this->params['enableclipboard'];
$accessop = $this->params['accessobject'];
$onepage = $this->params['onepage'];
$content = '';
$content .= "<div class=\"list-action\">";
if(!empty($extracontent['begin_action_list']))
$content .= $extracontent['begin_action_list'];
if($accessop->check_view_access('RemoveDocument')) {
if($document->getAccessMode($user) >= M_ALL) {
$content .= $this->printDeleteDocumentButton($document, 'splash_rm_document', true);
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-remove"></i></span>';
}
}
$docID = $document->getID();
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.EditDocument.php?documentid='.$docID.'" title="'.getMLText("edit_document_props").'"><i class="fa fa-edit"></i></a>';
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-edit"></i></span>';
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true);
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= $this->printAccessButton($document, true);
}
if($enableClipboard) {
$content .= '<a class="addtoclipboard" rel="D'.$docID.'" msg="'.getMLText('splash_added_to_clipboard').'" title="'.getMLText("add_to_clipboard").'"><i class="fa fa-copy"></i></a>';
}
if($onepage)
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewDocument.php?documentid='.$docID.'" title="'.getMLText("view_document").'"><i class="fa fa-eye"></i></a>';
if(!empty($extracontent['end_action_list']))
$content .= $extracontent['end_action_list'];
$content .= "</div>";
return $content;
} /* }}} */
/**
* Return HTML of a single row in the document list table
*
@ -2993,26 +3132,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$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);
if($ec = $this->callHook('documentListRowExtraContent', $document, $latestContent))
$extracontent = array_merge($extracontent, $ec);
$content .= "<td>";
if (file_exists($dms->contentDir . $latestContent->getPath())) {
@ -3058,27 +3180,13 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= $extracontent['bottom_title'];
$content .= "</td>\n";
if(!empty($extracontent['columns'])) {
foreach($extracontent['columns'] as $col)
$content .= '<td>'.$col.'</td>';
}
$content .= "<td nowrap>";
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
}
if ( $needwkflaction ) {
$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> ";
}
if($attentionstr)
$content .= $attentionstr."<br />";
$content .= "<small>";
if(count($files))
$content .= count($files)." ".getMLText("linked_files")."<br />";
if(count($links) || count($revlinks))
$content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."<br />";
if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') {
$workflowstate = $latestContent->getWorkflowState();
$content .= '<span title="'.getOverallStatusText($status["status"]).': '.($workflow ? htmlspecialchars($workflow->getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').'</span>';
} else {
$content .= getOverallStatusText($status["status"]);
}
$content .= $this->documentListRowStatus($latestContent);
if($accessop->check_view_access($this, array('action'=>'receptionBar')) /*$owner->getID() == $user->getID()*/ && $receiptStatus = $latestContent->getReceiptStatus()) {
$rstat = array('-1'=>0, '0'=>0, '1'=>0, '-2'=>0);
$allcomments = array('-1'=>array(), '1'=>array());
@ -3105,35 +3213,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= "</small></td>";
// $content .= "<td>".$version."</td>";
$content .= "<td>";
$content .= "<div class=\"list-action\">";
if(!empty($extracontent['begin_action_list']))
$content .= $extracontent['begin_action_list'];
if($accessop->check_view_access('RemoveDocument')) {
if($document->getAccessMode($user) >= M_ALL) {
$content .= $this->printDeleteDocumentButton($document, 'splash_rm_document', true);
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-remove"></i></span>';
}
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.EditDocument.php?documentid='.$docID.'" title="'.getMLText("edit_document_props").'"><i class="fa fa-edit"></i></a>';
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-edit"></i></span>';
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true);
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= $this->printAccessButton($document, true);
}
if($enableClipboard) {
$content .= '<a class="addtoclipboard" rel="D'.$docID.'" msg="'.getMLText('splash_added_to_clipboard').'" title="'.getMLText("add_to_clipboard").'"><i class="fa fa-copy"></i></a>';
}
if($onepage)
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewDocument.php?documentid='.$docID.'" title="'.getMLText("view_document").'"><i class="fa fa-eye"></i></a>';
if(!empty($extracontent['end_action_list']))
$content .= $extracontent['end_action_list'];
$content .= "</div>";
$content .= $this->documentListRowAction($document, $previewer, $skipcont, $version, $extracontent);
$content .= "</td>";
if(!$skipcont)
$content .= $this->documentListRowEnd($document);
@ -3181,6 +3261,50 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
return "</tr>\n";
} /* }}} */
function folderListRowAction($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'];
$accessop = $this->params['accessobject'];
$onepage = $this->params['onepage'];
$content = '';
$content .= "<div class=\"list-action\">";
if(!empty($extracontent['begin_action_list']))
$content .= $extracontent['begin_action_list'];
$subFolderAccessMode = $subFolder->getAccessMode($user);
if ($accessop->check_view_access('RemoveFolder')) {
if($subFolderAccessMode >= M_ALL) {
$content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true);
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-remove"></i></span>';
}
}
if ($accessop->check_view_access('EditFolder')) {
if($subFolderAccessMode >= M_READWRITE) {
$content .= '<a class_="btn btn-mini" href="'.$this->params['settings']->_httpRoot.'out/out.EditFolder.php?folderid='.$subFolder->getID().'" title="'.getMLText("edit_folder_props").'"><i class="fa fa-edit"></i></a>';
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-edit"></i></span>';
}
}
if($subFolderAccessMode >= M_READWRITE) {
$content .= $this->printAccessButton($subFolder, true);
}
if($enableClipboard) {
$content .= '<a class="addtoclipboard" rel="F'.$subFolder->getID().'" msg="'.getMLText('splash_added_to_clipboard').'" title="'.getMLText("add_to_clipboard").'"><i class="fa fa-copy"></i></a>';
}
if($onepage)
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewFolder.php?folderid='.$subFolder->getID().'" title="'.getMLText("view_folder").'"><i class="fa fa-eye"></i></a>';
if(!empty($extracontent['end_action_list']))
$content .= $extracontent['end_action_list'];
$content .= "</div>";
return $content;
} /* }}} */
function folderListRow($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -3199,6 +3323,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$comment = $subFolder->getComment();
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
if($ec = $this->callHook('folderListRowExtraContent', $subFolder))
$extracontent = array_merge($extracontent, $ec);
$content = '';
if(!$skipcont)
$content .= $this->folderListRowStart($subFolder);
@ -3245,37 +3372,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$content .= count($subsub)." ".getMLText("folders")."<br />".count($subdoc)." ".getMLText("documents");
}
$content .= "</small></td>";
// $content .= "<td></td>";
$content .= "<td>";
$content .= "<div class=\"list-action\">";
if(!empty($extracontent['begin_action_list']))
$content .= $extracontent['begin_action_list'];
$subFolderAccessMode = $subFolder->getAccessMode($user);
if ($accessop->check_view_access('RemoveFolder')) {
if($subFolderAccessMode >= M_ALL) {
$content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true);
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-remove"></i></span>';
}
}
if ($accessop->check_view_access('EditFolder')) {
if($subFolderAccessMode >= M_READWRITE) {
$content .= '<a class_="btn btn-mini" href="'.$this->params['settings']->_httpRoot.'out/out.EditFolder.php?folderid='.$subFolder->getID().'" title="'.getMLText("edit_folder_props").'"><i class="fa fa-edit"></i></a>';
} else {
$content .= '<span style="padding: 2px; color: #CCC;"><i class="fa fa-edit"></i></span>';
}
}
if($subFolderAccessMode >= M_READWRITE) {
$content .= $this->printAccessButton($subFolder, true);
}
if($enableClipboard) {
$content .= '<a class="addtoclipboard" rel="F'.$subFolder->getID().'" msg="'.getMLText('splash_added_to_clipboard').'" title="'.getMLText("add_to_clipboard").'"><i class="fa fa-copy"></i></a>';
}
if($onepage)
$content .= '<a href="'.$this->params['settings']->_httpRoot.'out/out.ViewFolder.php?folderid='.$subFolder->getID().'" title="'.getMLText("view_folder").'"><i class="fa fa-eye"></i></a>';
if(!empty($extracontent['end_action_list']))
$content .= $extracontent['end_action_list'];
$content .= "</div>";
$content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent);
$content .= "</td>";
if(!$skipcont)
$content .= $this->folderListRowEnd($subFolder);

View File

@ -523,6 +523,7 @@ $(document).ready( function() {
}
}
initMost();
SeedDMSAjax.run(view, action);
});
}); /* }}} */
@ -573,6 +574,7 @@ $(document).ready( function() {
}
}
initMost();
SeedDMSAjax.run(view, action);
});
}); /* }}} */
@ -1422,3 +1424,27 @@ $(document).ready(function() { /* {{{ */
timeOutId = setTimeout(SeedDMSTask.run, timeout);
}
}( window.SeedDMSTask = window.SeedDMSTask || {}, jQuery )); /* }}} */
(function( SeedDMSAjax, $, undefined ) { /* {{{ */
var tasks = Array(
{name: 'test', view: 'null', action: null, func:
test = function() {
console.log('Run in SeedDMSAjax');
}
}
);
SeedDMSAjax.add = function(task) {
tasks.push(task);
}
SeedDMSAjax.run = function(view, action) {
for(let task of tasks) {
//console.log('Checking for '+view+':'+action);
if(task.view == null || (task.view == view && task.action == null) || (task.view == view && task.action == action)) {
//console.log('Running '+task.name+' after update for '+view+':'+action);
task.func();
}
}
}
}( window.SeedDMSAjax = window.SeedDMSAjax || {}, jQuery )); /* }}} */