".getMLText("calendar")." \n";
echo "\n";
return;
} /* }}} */
function pageList($pageNumber, $totalPages, $baseURI, $params) { /* {{{ */
$maxpages = 25; // skip pages when more than this is shown
$range = 5; // pages left and right of current page
if (!is_numeric($pageNumber) || !is_numeric($totalPages) || $totalPages<2) {
return;
}
// Construct the basic URI based on the $_GET array. One could use a
// regular expression to strip out the pg (page number) variable to
// achieve the same effect. This seems to be less haphazard though...
$resultsURI = $baseURI;
$first=true;
foreach ($params as $key=>$value) {
// Don't include the page number in the basic URI. This is added in
// during the list display loop.
if (!strcasecmp($key, "pg")) {
continue;
}
if (is_array($value)) {
foreach ($value as $subkey=>$subvalue) {
$resultsURI .= ($first ? "?" : "&").$key."%5B".$subkey."%5D=".$subvalue;
$first = false;
}
}
else {
$resultsURI .= ($first ? "?" : "&").$key."=".$value;
}
$first = false;
}
echo "";
return;
} /* }}} */
function contentContainer($content) { /* {{{ */
echo "\n";
echo $content;
echo "
\n";
return;
} /* }}} */
function contentContainerStart($class='') { /* {{{ */
echo "\n";
return;
} /* }}} */
function contentContainerEnd() { /* {{{ */
echo "
\n";
return;
} /* }}} */
function contentHeading($heading, $noescape=false) { /* {{{ */
if($noescape)
echo "".$heading." \n";
else
echo "".htmlspecialchars($heading)." \n";
return;
} /* }}} */
function contentSubHeading($heading, $first=false) { /* {{{ */
// echo "".htmlspecialchars($heading)."
\n";
echo "".$heading." ";
return;
} /* }}} */
function getMimeIcon($fileType) { /* {{{ */
// for extension use LOWER CASE only
$icons = array();
$icons["txt"] = "txt.png";
$icons["text"] = "txt.png";
$icons["doc"] = "word.png";
$icons["dot"] = "word.png";
$icons["docx"] = "word.png";
$icons["dotx"] = "word.png";
$icons["rtf"] = "document.png";
$icons["xls"] = "excel.png";
$icons["xlt"] = "excel.png";
$icons["xlsx"] = "excel.png";
$icons["xltx"] = "excel.png";
$icons["ppt"] = "powerpoint.png";
$icons["pot"] = "powerpoint.png";
$icons["pptx"] = "powerpoint.png";
$icons["potx"] = "powerpoint.png";
$icons["exe"] = "binary.png";
$icons["html"] = "html.png";
$icons["htm"] = "html.png";
$icons["gif"] = "image.png";
$icons["jpg"] = "image.png";
$icons["jpeg"] = "image.png";
$icons["bmp"] = "image.png";
$icons["png"] = "image.png";
$icons["tif"] = "image.png";
$icons["tiff"] = "image.png";
$icons["log"] = "log.png";
$icons["midi"] = "midi.png";
$icons["pdf"] = "pdf.png";
$icons["wav"] = "sound.png";
$icons["mp3"] = "sound.png";
$icons["c"] = "source_c.png";
$icons["cpp"] = "source_cpp.png";
$icons["h"] = "source_h.png";
$icons["java"] = "source_java.png";
$icons["py"] = "source_py.png";
$icons["tar"] = "tar.png";
$icons["gz"] = "gz.png";
$icons["7z"] = "gz.png";
$icons["bz"] = "gz.png";
$icons["bz2"] = "gz.png";
$icons["tgz"] = "gz.png";
$icons["zip"] = "gz.png";
$icons["rar"] = "gz.png";
$icons["mpg"] = "video.png";
$icons["avi"] = "video.png";
$icons["tex"] = "tex.png";
$icons["ods"] = "x-office-spreadsheet.png";
$icons["ots"] = "x-office-spreadsheet.png";
$icons["sxc"] = "x-office-spreadsheet.png";
$icons["stc"] = "x-office-spreadsheet.png";
$icons["odt"] = "x-office-document.png";
$icons["ott"] = "x-office-document.png";
$icons["sxw"] = "x-office-document.png";
$icons["stw"] = "x-office-document.png";
$icons["odp"] = "ooo_presentation.png";
$icons["otp"] = "ooo_presentation.png";
$icons["sxi"] = "ooo_presentation.png";
$icons["sti"] = "ooo_presentation.png";
$icons["odg"] = "ooo_drawing.png";
$icons["otg"] = "ooo_drawing.png";
$icons["sxd"] = "ooo_drawing.png";
$icons["std"] = "ooo_drawing.png";
$icons["odf"] = "ooo_formula.png";
$icons["sxm"] = "ooo_formula.png";
$icons["smf"] = "ooo_formula.png";
$icons["mml"] = "ooo_formula.png";
$icons["default"] = "default.png";
$ext = strtolower(substr($fileType, 1));
if (isset($icons[$ext])) {
return $this->imgpath.$icons[$ext];
}
else {
return $this->imgpath.$icons["default"];
}
} /* }}} */
function printFileChooser($varname='userfile', $multiple=false, $accept='') { /* {{{ */
?>
\n";
for ($i = 1; $i <= 31; $i++)
{
print "" . $i . " \n";
}
print " \n";
print "\n";
for ($i = 1; $i <= 12; $i++)
{
print "" . $i . " \n";
}
print " \n";
print "\n";
for ($i = $year-5 ; $i <= $year+5 ; $i++)
{
print "" . $i . " \n";
}
print " ";
} /* }}} */
function printSequenceChooser($objArr, $keepID = -1) { /* {{{ */
if (count($objArr) > 0) {
$max = $objArr[count($objArr)-1]->getSequence() + 1;
$min = $objArr[0]->getSequence() - 1;
}
else {
$max = 1.0;
}
print "\n";
if ($keepID != -1) {
print " " . getMLText("seq_keep");
}
print " " . getMLText("seq_end");
if (count($objArr) > 0) {
print " " . getMLText("seq_start");
}
for ($i = 0; $i < count($objArr) - 1; $i++) {
if (($objArr[$i]->getID() == $keepID) || (($i + 1 < count($objArr)) && ($objArr[$i+1]->getID() == $keepID))) {
continue;
}
$index = ($objArr[$i]->getSequence() + $objArr[$i+1]->getSequence()) / 2;
print " " . getMLText("seq_after", array("prevname" => htmlspecialchars($objArr[$i]->getName())));
}
print " ";
} /* }}} */
function printDocumentChooserHtml($formName) { /* {{{ */
print " ";
print "\n";
?>
function documentSelected(id, name) {
$('#docid').val(id);
$('#choosedocsearch').val(name);
$('#docChooser').modal('hide');
}
function folderSelected(id, name) {
}
printDocumentChooserHtml($formName);
?>
getID() : "") ."\">";
print "\n";
?>
function folderSelected(id, name) {
$('#targetid').val(id);
$('#choosefoldersearch').val(name);
$('#folderChooser').modal('hide');
}
printFolderChooserHtml($formName, $accessMode, $exclude, $default);
?>
getId();
$names[] = htmlspecialchars($cat->getName());
}
}
print " ";
print "\n";
?>
$('#acceptkeywords').click(function(ev) {
acceptKeywords();
});
printKeywordChooserHtml($formName, $keywords, $fieldname);
?>
getType()) {
case SeedDMS_Core_AttributeDefinition::type_boolean:
echo " getId()."]\" value=\"0\" />";
echo " getId()."]\" value=\"1\" ".($objvalue ? 'checked' : '')." />";
break;
case SeedDMS_Core_AttributeDefinition::type_date:
?>
">
getValueSetAsArray()) {
echo "getId()."]";
if($attrdef->getMultipleValues()) {
echo "[]\" multiple";
} else {
echo "\"";
}
echo ">";
if(!$attrdef->getMultipleValues()) {
echo " ";
}
foreach($valueset as $value) {
if($value) {
echo "".htmlspecialchars($value)." ";
}
}
echo " ";
} else {
if (strlen($objvalue) > 80) {
echo '';
} else {
echo " getId()."]\" value=\"".htmlspecialchars($objvalue)."\" />";
}
}
break;
}
} /* }}} */
function printDropFolderChooserHtml($formName, $dropfolderfile="", $showfolders=0) { /* {{{ */
print "\n";
?>
/* Set up a callback which is called when a folder in the tree is selected */
modalDropfolderChooser = $('#dropfolderChooser');
function fileSelected(name) {
$('#dropfolderfile').val(name);
modalDropfolderChooser.modal('hide');
}
function folderSelected(name) {
$('#dropfolderfile').val(name);
modalDropfolderChooser.modal('hide');
}
function clearFilename() {
$('#dropfolderfile').val('');
}
$('#clearfilename').click(function(ev) {
$('#dropfolderfile').val('');
});
printDropFolderChooserHtml($formName, $dropfolderfile, $showfolders);
?>
imgpath.$img) ) {
return $this->imgpath.$img;
}
return "../out/images/$img";
} /* }}} */
function printImgPath($img) { /* {{{ */
print $this->getImgPath($img);
} /* }}} */
function infoMsg($msg) { /* {{{ */
echo "\n";
echo $msg;
echo "
\n";
} /* }}} */
function warningMsg($msg) { /* {{{ */
echo "\n";
echo $msg;
echo "
\n";
} /* }}} */
function errorMsg($msg) { /* {{{ */
echo "\n";
echo $msg;
echo "
\n";
} /* }}} */
function exitError($pagetitle, $error, $noexit=false) { /* {{{ */
$this->htmlStartPage($pagetitle);
$this->globalNavigation();
$this->contentStart();
print "";
print "
".getMLText('error')."! ";
print htmlspecialchars($error);
print "";
print "".getMLText('back')."
";
$this->contentEnd();
$this->htmlEndPage();
add_log_line(" UI::exitError error=".$error." pagetitle=".$pagetitle);
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";
} /* }}} */
/**
* 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.
*/
function printNewTreeNavigationJs($folderid=0, $accessmode=M_READ, $showdocs=0, $formid='form1', $expandtree=0, $orderby='') { /* {{{ */
function jqtree($path, $folder, $user, $accessmode, $showdocs=1, $expandtree=0, $orderby='') {
if($path || $expandtree) {
if($path)
$pathfolder = array_shift($path);
$subfolders = $folder->getSubFolders($orderby);
$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);
if($expandtree || $pathfolder->getID() == $subfolder->getID()) {
if($showdocs) {
$documents = $folder->getDocuments($orderby);
$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);
$children[] = $node2;
}
}
$node['children'] = jqtree($path, $subfolder, $user, $accessmode, $showdocs, $expandtree, $orderby);
}
$children[] = $node;
}
return $children;
} else {
$subfolders = $folder->getSubFolders($orderby);
$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();
}
if($folderid) {
$folder = $this->params['dms']->getFolder($folderid);
$path = $folder->getPath();
$folder = array_shift($path);
$node = array('label'=>$folder->getName(), 'id'=>$folder->getID(), 'load_on_demand'=>true, 'is_folder'=>true);
if(!$folder->hasSubFolders()) {
$node['load_on_demand'] = false;
$node['children'] = array();
} else {
$node['children'] = jqtree($path, $folder, $this->params['user'], $accessmode, $showdocs, $expandtree, $orderby);
if($showdocs) {
$documents = $folder->getDocuments($orderby);
$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;
}
}
}
$tree[] = $node;
} else {
$root = $this->params['dms']->getFolder($this->params['rootfolderid']);
$tree = array(array('label'=>$root->getName(), 'id'=>$root->getID(), 'load_on_demand'=>true, 'is_folder'=>true));
}
?>
var data = ;
$(function() {
$('#jqtree').tree({
saveState: true,
data: data,
openedIcon: ' ',
closedIcon: ' ',
onCanSelectNode: function(node) {
if(node.is_folder)
folderSelected(node.id, node.name);
else
documentSelected(node.id, node.name);
},
autoOpen: true,
drapAndDrop: true,
onCreateLi: function(node, $li) {
// Add 'icon' span before title
if(node.is_folder)
$li.find('.jqtree-title').before(' ').attr('rel', 'folder_' + node.id).attr('formtoken', '');
else
$li.find('.jqtree-title').before(' ');
}
});
});
contentHeading(" ", true);
$this->contentContainerStart();
?>
printNewTreeNavigation($folderid, M_READ, 0, '');
$this->contentContainerEnd();
} else {
$this->contentHeading(" ", true);
}
} /* }}} */
/**
* Return clipboard content rendered as html
*
* @param array clipboard
* @return string rendered html content
*/
function mainClipboard($clipboard){ /* {{{ */
$dms = $this->params['dms'];
$content = '';
$foldercount = $doccount = 0;
if($clipboard['folders']) {
foreach($clipboard['folders'] as $folderid) {
/* FIXME: check for access rights, which could have changed after adding the folder to the clipboard */
if($folder = $dms->getFolder($folderid)) {
$comment = $folder->getComment();
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
$content .= "getID()."\" class=\"folder table-row-folder\" formtoken=\"".createFormKey('movefolder')."\">";
$content .= "getID()."&showtree=".showtree()."\"> imgpath."folder.png\" width=\"24\" height=\"24\" border=0> \n";
$content .= "getID()."&showtree=".showtree()."\">" . htmlspecialchars($folder->getName()) . " ";
if($comment) {
$content .= "".htmlspecialchars($comment)." ";
}
$content .= " \n";
$content .= "\n";
$content .= "";
$content .= " \n";
$content .= " \n";
$foldercount++;
}
}
}
$previewer = new SeedDMS_Preview_Previewer($this->params['cachedir'], 40);
if($clipboard['docs']) {
foreach($clipboard['docs'] as $docid) {
/* FIXME: check for access rights, which could have changed after adding the document to the clipboard */
if($document = $dms->getDocument($docid)) {
$comment = $document->getComment();
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
if($latestContent = $document->getLatestContent()) {
$previewer->createPreview($latestContent);
$version = $latestContent->getVersion();
$status = $latestContent->getStatus();
$content .= "";
if (file_exists($dms->contentDir . $latestContent->getPath())) {
$content .= "";
if($previewer->hasPreview($latestContent)) {
$content .= " getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
} else {
$content .= " getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
$content .= " ";
} else
$content .= " getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"> ";
$content .= "" . htmlspecialchars($document->getName()) . " ";
if($comment) {
$content .= "".htmlspecialchars($comment)." ";
}
$content .= " \n";
$content .= "\n";
$content .= "";
$content .= " \n";
$content .= " ";
$doccount++;
}
}
}
}
/* $foldercount or $doccount will only count objects which are
* actually available
*/
if($foldercount || $doccount) {
$content = "".$content;
$content .= "
";
} else {
}
$content .= "".getMLText("drag_icon_here")."
";
return $content;
} /* }}} */
/**
* Print clipboard in div container
*
* @param array clipboard
*/
function printClipboard($clipboard){ /* {{{ */
$this->contentHeading(getMLText("clipboard"), true);
echo "\n";
echo $this->mainClipboard($clipboard);
echo "
\n";
} /* }}} */
/**
* Print button with link for deleting a document
*
* This button is used in document listings (e.g. on the ViewFolder page)
* for deleting a document. In seeddms version < 4.3.9 this was just a
* link to the out/out.RemoveDocument.php page which asks for confirmation
* an than calls op/op.RemoveDocument.php. Starting with version 4.3.9
* the button just opens a small popup asking for confirmation and than
* calls the ajax command 'deletedocument'. The ajax call is called
* in the click function of 'button.removedocument'. That button needs
* to have two attributes: 'rel' for the id of the document, and 'msg'
* for the message shown by notify if the document could be deleted.
*
* @param object $document document to be deleted
* @param string $msg message shown in case of successful deletion
* @param boolean $return return html instead of printing it
* @return string html content if $return is true, otherwise an empty string
*/
function printDeleteDocumentButton($document, $msg, $return=false){ /* {{{ */
$docid = $document->getID();
$content = '';
$content .= ' $document->getName())), ENT_QUOTES).'"> ';
if($return)
return $content;
else
echo $content;
return '';
} /* }}} */
function printDeleteDocumentButtonJs(){ /* {{{ */
echo "
$(document).ready(function () {
// $('.delete-document-btn').click(function(ev) {
$('body').on('click', 'a.delete-document-btn', function(ev){
id = $(ev.currentTarget).attr('rel');
confirmmsg = $(ev.currentTarget).attr('confirmmsg');
msg = $(ev.currentTarget).attr('msg');
formtoken = '".createFormKey('removedocument')."';
bootbox.dialog(confirmmsg, [{
\"label\" : \" ".getMLText("rm_document")."\",
\"class\" : \"btn-danger\",
\"callback\": function() {
$.get('../op/op.Ajax.php',
{ command: 'deletedocument', id: id, formtoken: formtoken },
function(data) {
if(data.success) {
$('#table-row-document-'+id).hide('slow');
noty({
text: msg,
type: 'success',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
} else {
noty({
text: data.message,
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 3500,
});
}
},
'json'
);
}
}, {
\"label\" : \"".getMLText("cancel")."\",
\"class\" : \"btn-cancel\",
\"callback\": function() {
}
}]);
});
});
";
} /* }}} */
/**
* Print button with link for deleting a folder
*
* This button works like document delete button
* {@link SeedDMS_Bootstrap_Style::printDeleteDocumentButton()}
*
* @param object $folder folder to be deleted
* @param string $msg message shown in case of successful deletion
* @param boolean $return return html instead of printing it
* @return string html content if $return is true, otherwise an empty string
*/
function printDeleteFolderButton($folder, $msg, $return=false){ /* {{{ */
$folderid = $folder->getID();
$content = '';
$content .= ' $folder->getName())), ENT_QUOTES).'"> ';
if($return)
return $content;
else
echo $content;
return '';
} /* }}} */
function printDeleteFolderButtonJs(){ /* {{{ */
echo "
$(document).ready(function () {
// $('.delete-folder-btn').click(function(ev) {
$('body').on('click', 'a.delete-folder-btn', function(ev){
id = $(ev.currentTarget).attr('rel');
confirmmsg = $(ev.currentTarget).attr('confirmmsg');
msg = $(ev.currentTarget).attr('msg');
formtoken = '".createFormKey('removefolder')."';
bootbox.dialog(confirmmsg, [{
\"label\" : \" ".getMLText("rm_folder")."\",
\"class\" : \"btn-danger\",
\"callback\": function() {
$.get('../op/op.Ajax.php',
{ command: 'deletefolder', id: id, formtoken: formtoken },
function(data) {
if(data.success) {
$('#table-row-folder-'+id).hide('slow');
noty({
text: msg,
type: 'success',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
} else {
noty({
text: data.message,
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 3500,
});
}
},
'json'
);
}
}, {
\"label\" : \"".getMLText("cancel")."\",
\"class\" : \"btn-cancel\",
\"callback\": function() {
}
}]);
});
});
";
} /* }}} */
function printLockButton($document, $msglock, $msgunlock, $return=false) { /* {{{ */
$docid = $document->getID();
if($document->isLocked()) {
$icon = 'unlock';
$msg = $msgunlock;
$title = 'unlock_document';
} else {
$icon = 'lock';
$msg = $msglock;
$title = 'lock_document';
}
$content = '';
$content .= ' ';
if($return)
return $content;
else
echo $content;
return '';
} /* }}} */
/**
* Return HTML of a single row in the document list table
*
* @param object $document
* @param object $previewer
* @param boolean $skipcont set to true if embrasing tr shall be skipped
*/
function documentListRow($document, $previewer, $skipcont=false) { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$showtree = $this->params['showtree'];
$workflowmode = $this->params['workflowmode'];
$previewwidth = $this->params['previewWidthList'];
$enableClipboard = $this->params['enableclipboard'];
$content = '';
$owner = $document->getOwner();
$comment = $document->getComment();
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
$docID = $document->getID();
if(!$skipcont)
$content .= "";
if($latestContent = $document->getLatestContent()) {
$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();
/* Retrieve linked documents */
$links = $document->getDocumentLinks();
$links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links);
if (file_exists($dms->contentDir . $latestContent->getPath())) {
$content .= "";
if($previewer->hasPreview($latestContent)) {
$content .= " getID()."&version=".$latestContent->getVersion()."&width=".$previewwidth."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
} else {
$content .= " getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">";
}
$content .= " ";
} else
$content .= " getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"> ";
$content .= "" . htmlspecialchars($document->getName()) . " ";
$content .= "".getMLText('owner').": ".htmlspecialchars($owner->getFullName())." , ".getMLText('creation_date').": ".date('Y-m-d', $document->getDate())." , ".getMLText('version')." ".$version." - ".date('Y-m-d', $latestContent->getDate())." ";
if($comment) {
$content .= "".htmlspecialchars($comment)." ";
}
$content .= " \n";
// $content .= "".htmlspecialchars($owner->getFullName())." ";
$content .= "";
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= " getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
}
if ( $needwkflaction ) {
$attentionstr .= " getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": "."\"> ";
}
if($attentionstr)
$content .= $attentionstr." ";
$content .= "";
if(count($files))
$content .= count($files)." ".getMLText("linked_files")." ";
if(count($links))
$content .= count($links)." ".getMLText("linked_documents")." ";
$content .= getOverallStatusText($status["status"])." ";
// $content .= "".$version." ";
$content .= "";
$content .= "";
if($document->getAccessMode($user) >= M_ALL) {
$content .= $this->printDeleteDocumentButton($document, 'splash_rm_document', true);
} else {
$content .= '
';
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= '
';
} else {
$content .= '
';
}
if($document->getAccessMode($user) >= M_READWRITE) {
$content .= $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true);
}
if($enableClipboard) {
$content .= '
';
}
$content .= "
";
$content .= " ";
}
if(!$skipcont)
$content .= " \n";
return $content;
} /* }}} */
function folderListRow($subFolder) { /* {{{ */
$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'];
$owner = $subFolder->getOwner();
$comment = $subFolder->getComment();
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
$subsub = $subFolder->getSubFolders();
$subsub = SeedDMS_Core_DMS::filterAccess($subsub, $user, M_READ);
$subdoc = $subFolder->getDocuments();
$subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ);
$content = '';
$content .= "getID()."\" draggable=\"true\" rel=\"folder_".$subFolder->getID()."\" class=\"folder table-row-folder\" formtoken=\"".createFormKey('movefolder')."\">";
// $content .= " ";
$content .= "getID()."\" draggable=\"false\" href=\"out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\"> imgpath."folder.png\" width=\"24\" height=\"24\" border=0> \n";
$content .= "getID()."\" href=\"out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . " ";
$content .= "".getMLText('owner').": ".htmlspecialchars($owner->getFullName())." , ".getMLText('creation_date').": ".date('Y-m-d', $subFolder->getDate())." ";
if($comment) {
$content .= "".htmlspecialchars($comment)." ";
}
$content .= " \n";
// $content .= "".htmlspecialchars($owner->getFullName())." ";
$content .= "";
if($enableRecursiveCount) {
if($user->isAdmin()) {
/* No need to check for access rights in countChildren() for
* admin. So pass 0 as the limit.
*/
$cc = $subFolder->countChildren($user, 0);
$content .= $cc['folder_count']." ".getMLText("folders")." ".$cc['document_count']." ".getMLText("documents");
} else {
$cc = $subFolder->countChildren($user, $maxRecursiveCount);
if($maxRecursiveCount > 5000)
$rr = 100.0;
else
$rr = 10.0;
$content .= (!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ".getMLText("folders")." ".(!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents");
}
} else {
$content .= count($subsub)." ".getMLText("folders")." ".count($subdoc)." ".getMLText("documents");
}
$content .= " ";
// $content .= " ";
$content .= "";
$content .= "";
if($subFolder->getAccessMode($user) >= M_ALL) {
$content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true);
} else {
$content .= '
';
}
if($subFolder->getAccessMode($user) >= M_READWRITE) {
$content .= '
';
} else {
$content .= '
';
}
if($enableClipboard) {
$content .= '
';
}
$content .= "
";
$content .= " ";
$content .= " \n";
return $content;
} /* }}} */
/**
* Output HTML Code 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 printUploadApplet($uploadurl, $attributes, $maxfiles=0, $fields=array()){ /* {{{ */
?>
params['dms'];
$document = $latestContent->getDocument();
?>
,
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 " ";
echo "";
echo "".$rec['date']." - ";
$updateuser = $dms->getUser($rec["userID"]);
if(!is_object($required))
echo getMLText("unknown_user");
else
echo htmlspecialchars($updateuser->getFullName()." (".$updateuser->getLogin().")");
echo " ";
if($rec['comment'])
echo " ".htmlspecialchars($rec['comment']);
switch($type) {
case "review":
if($rec['file']) {
echo " ";
echo "getID()."&reviewlogid=".$rec['reviewLogID']."\" class=\"btn btn-mini\"> ".getMLText('download')." ";
}
break;
case "approval":
if($rec['file']) {
echo " ";
echo "getID()."&approvelogid=".$rec['approveLogID']."\" class=\"btn btn-mini\"> ".getMLText('download')." ";
}
break;
}
echo " ";
echo "";
switch($type) {
case "review":
echo getReviewStatusText($rec["status"]);
break;
case "approval":
echo getApprovalStatusText($rec["status"]);
break;
default:
}
echo " ";
echo " ";
}
?>
$value) {
$used = (int) ($value/$max*100.0+0.5);
$free = 100-$used;
} else {
$free = 0;
$used = 100;
}
$html = '
';
return $html;
} /* }}} */
/**
* Output a timeline for a document
*
* @param object $document document
*/
protected function printTimelineJs($timelineurl, $height=300, $start='', $end='', $skip=array()) { /* {{{ */
if(!$timelineurl)
return;
?>
var timeline;
var data;
// specify options
var options = {
'width': '100%',
'height': '100%',
'editable': false,
'selectable': true,
'style': 'box',
'locale': '= $this->params['session']->getLanguage() ?>'
};
function onselect() {
var sel = timeline.getSelection();
if (sel.length) {
if (sel[0].row != undefined) {
var row = sel[0].row;
console.log(timeline.getItem(sel[0].row));
item = timeline.getItem(sel[0].row);
$('div.ajax').trigger('update', {documentid: item.docid, version: item.version, statusid: item.statusid, statuslogid: item.statuslogid, fileid: item.fileid});
}
}
}
$(document).ready(function () {
// Instantiate our timeline object.
timeline = new links.Timeline(document.getElementById('timeline'), options);
links.events.addListener(timeline, 'select', onselect);
$.getJSON(
'= $timelineurl ?>',
function(data) {
$.each( data, function( key, val ) {
val.start = new Date(val.start);
});
timeline.draw(data);
}
);
});
\n";
$this->printTimelineJs($timelineurl, $height, $start, $end, $skip);
echo "";
$this->printTimelineHtml($height);
} /* }}} */
}
?>