theme = $theme; $this->params = $params; $this->imgpath = '../views/'.$theme.'/images/'; $this->extraheader = array('js'=>'', 'css'=>''); $this->footerjs = array(); } /** * Add javascript to an internal array which is output at the * end of the page within a document.ready() function. * * @param string $script javascript to be added */ function addFooterJS($script) { /* {{{ */ $this->footerjs[] = $script; } /* }}} */ function htmlStartPage($title="", $bodyClass="") { /* {{{ */ if(1 || method_exists($this, 'js')) { /* We still need unsafe-eval, because printDocumentChooserHtml and * printFolderChooserHtml will include a javascript file with ajax * which is evaled by jquery * 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+ */ $csp_rules = "script-src 'self' 'unsafe-eval';"; // style-src 'self';"; foreach (array("X-WebKit-CSP", "X-Content-Security-Policy", "Content-Security-Policy") as $csp) { header($csp . ": " . $csp_rules); } } echo "\n"; echo "\n\n"; echo "\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; if($this->extraheader['css']) echo $this->extraheader['css']; // echo ''."\n"; echo ''."\n"; if($this->extraheader['js']) echo $this->extraheader['js']; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; if($this->params['session'] && $this->params['session']->getSu()) { ?> params['sitename'])); echo "".(strlen($sitename)>0 ? $sitename : "SeedDMS").(strlen($title)>0 ? ": " : "").htmlspecialchars($title)."\n"; echo "\n"; echo "0 ? " class=\"".$bodyClass."\"" : "").">\n"; if($this->params['session'] && $flashmsg = $this->params['session']->getSplashMsg()) { $this->params['session']->clearSplashMsg(); echo "
".$flashmsg['msg']."
\n"; } } /* }}} */ function htmlAddHeader($head, $type='js') { /* {{{ */ $this->extraheader[$type] .= $head; } /* }}} */ function htmlEndPage($nofooter=false) { /* {{{ */ if(!$nofooter) { $this->footNote(); if($this->params['showmissingtranslations']) { $this->missingḺanguageKeys(); } } echo ''."\n"; echo ''."\n"; foreach(array('de', 'es', 'ca', 'nl', 'fi', 'cs', 'it', 'fr', 'sv', 'sl', 'pt-BR', 'zh-CN', 'zh-TW') as $lang) echo ''."\n"; echo ''."\n"; echo ''."\n"; if($this->footerjs) { echo ""; } if(method_exists($this, 'js')) echo ''."\n"; echo "\n\n"; } /* }}} */ function missingḺanguageKeys() { /* {{{ */ global $MISSING_LANG, $LANG; if($MISSING_LANG) { echo '
'."\n"; echo "

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

"; echo "
"; echo ""; echo "\n"; foreach($MISSING_LANG as $key=>$lang) { echo ""; } echo "
Keyengl. TextYour translation
".$key."".$LANG['en_GB'][$key]."
"; echo "
There are missing translations on this page!
Please check the bottom of the page.
\n"; } } /* }}} */ function footNote() { /* {{{ */ echo "
\n"; echo '
'."\n"; echo '
'."\n"; echo '
'."\n"; if ($this->params['printdisclaimer']){ echo "
".getMLText("disclaimer")."
"; } if (isset($this->params['footnote']) && strlen((string)$this->params['footnote'])>0) { echo "
".(string)$this->params['footnote']."
"; } echo "
\n"; echo "
\n"; echo "
\n"; echo "
\n"; return; } /* }}} */ function contentStart() { /* {{{ */ echo "
\n"; echo "
\n"; } /* }}} */ function contentEnd() { /* {{{ */ echo "
\n"; echo "
\n"; } /* }}} */ function globalBanner() { /* {{{ */ echo "
\n"; echo " \n"; echo "
\n"; } /* }}} */ /** * Returns the html needed for the clipboard list in the menu * * This function renders the clipboard in a way suitable to be * used as a menu * * @param array $clipboard clipboard containing two arrays for both * documents and folders. * @return string html code */ function menuClipboard($clipboard) { /* {{{ */ if ($this->params['user']->isGuest() || (count($clipboard['docs']) + count($clipboard['folders'])) == 0) { return ''; } $content = ''; $content .= " \n"; return $content; } /* }}} */ function globalNavigation($folder=null) { /* {{{ */ echo "
\n"; echo "
\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " params['rootfolderid']."\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."\n"; if(isset($this->params['user']) && $this->params['user']) { echo "
\n"; echo " \n"; if($this->params['enableclipboard']) { echo "
"; echo $this->menuClipboard($this->params['session']->getClipboard()); echo "
"; } echo " \n"; echo "
"; if ($folder!=null && is_object($folder) && !strcasecmp(get_class($folder), "SeedDMS_Core_Folder")) { echo " getID()."\" />"; } echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; if($this->params['defaultsearchmethod'] == 'fulltext') echo " "; // if($this->params['enablefullsearch']) { // echo " "; // } // echo " "; echo "
\n"; echo "
\n"; } echo "
\n"; echo "
\n"; echo "
\n"; return; } /* }}} */ function getFolderPathHTML($folder, $tagAll=false, $document=null) { /* {{{ */ $path = $folder->getPath(); $txtpath = ""; for ($i = 0; $i < count($path); $i++) { $txtpath .= "
  • "; if ($i +1 < count($path)) { $txtpath .= "getID()."&showtree=".showtree()."\" rel=\"folder_".$path[$i]->getID()."\" class=\"table-row-folder\" formtoken=\"".createFormKey('movefolder')."\">". htmlspecialchars($path[$i]->getName()).""; } else { $txtpath .= ($tagAll ? "getID()."&showtree=".showtree()."\">". htmlspecialchars($path[$i]->getName())."" : htmlspecialchars($path[$i]->getName())); } $txtpath .= " /
  • "; } if($document) $txtpath .= "
  • getId()."\">".htmlspecialchars($document->getName())."
  • "; return ''; } /* }}} */ function pageNavigation($pageTitle, $pageType=null, $extra=null) { /* {{{ */ if ($pageType!=null && strcasecmp($pageType, "noNav")) { echo "
    \n"; echo "
    \n"; echo "
    \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; switch ($pageType) { case "view_folder": $this->folderNavigationBar($extra); break; case "view_document": $this->documentNavigationBar($extra); break; case "my_documents": $this->myDocumentsNavigationBar(); break; case "my_account": $this->accountNavigationBar(); break; case "admin_tools": $this->adminToolsNavigationBar(); break; case "calendar"; $this->calendarNavigationBar($extra); break; } echo "
    \n"; echo "
    \n"; echo "
    \n"; if($pageType == "view_folder" || $pageType == "view_document") echo $pageTitle."\n"; } else { echo "".$pageTitle."\n"; } return; } /* }}} */ private function folderNavigationBar($folder) { /* {{{ */ if (!is_object($folder) || strcasecmp(get_class($folder), "SeedDMS_Core_Folder")) { echo "\n"; return; } $accessMode = $folder->getAccessMode($this->params['user']); $folderID = $folder->getID(); echo "".getMLText("folder")."\n"; echo "
    \n"; echo "\n"; echo "
    \n"; return; } /* }}} */ private function documentNavigationBar($document) { /* {{{ */ $accessMode = $document->getAccessMode($this->params['user']); $docid=".php?documentid=" . $document->getID(); echo "".getMLText("document")."\n"; echo "
    \n"; echo "\n"; echo "
    \n"; return; } /* }}} */ private function accountNavigationBar() { /* {{{ */ echo "".getMLText("my_account")."\n"; echo "
    \n"; echo "\n"; echo "
    \n"; return; } /* }}} */ private function myDocumentsNavigationBar() { /* {{{ */ echo "".getMLText("my_documents")."\n"; echo "
    \n"; echo "\n"; echo "
    \n"; return; } /* }}} */ private function adminToolsNavigationBar() { /* {{{ */ echo " ".getMLText("admin_tools")."\n"; echo "
    \n"; echo " \n"; echo " \n"; if($this->params['enablefullsearch']) { echo " \n"; } echo " \n"; echo " \n"; echo "
      \n"; echo "
    \n"; echo "
    \n"; return; } /* }}} */ private function calendarNavigationBar($d){ /* {{{ */ $ds="&day=".$d[0]."&month=".$d[1]."&year=".$d[2]; echo "".getMLText("calendar")."\n"; echo "
    \n"; echo "\n"; echo "
    \n"; return; } /* }}} */ function pageList($pageNumber, $totalPages, $baseURI, $params) { /* {{{ */ $maxpages = 25; // skip pages when more than this is shown $range = 5; // pages left and right of current page if (!is_numeric($pageNumber) || !is_numeric($totalPages) || $totalPages<2) { return; } // Construct the basic URI based on the $_GET array. One could use a // regular expression to strip out the pg (page number) variable to // achieve the same effect. This seems to be less haphazard though... $resultsURI = $baseURI; $first=true; foreach ($params as $key=>$value) { // Don't include the page number in the basic URI. This is added in // during the list display loop. if (!strcasecmp($key, "pg")) { continue; } if (is_array($value)) { foreach ($value as $subkey=>$subvalue) { $resultsURI .= ($first ? "?" : "&").$key."%5B".$subkey."%5D=".$subvalue; $first = false; } } else { $resultsURI .= ($first ? "?" : "&").$key."=".$value; } $first = false; } echo "
    "; echo "
      "; if($totalPages <= $maxpages) { for ($i = 1; $i <= $totalPages; $i++) { echo "
    • ".$i."
    • "; } } else { if($pageNumber-$range > 1) $start = $pageNumber-$range; else $start = 2; if($pageNumber+$range < $totalPages) $end = $pageNumber+$range; else $end = $totalPages-1; /* Move start or end to always show 2*$range items */ $diff = $end-$start-2*$range; if($diff < 0) { if($start > 2) $start += $diff; if($end < $totalPages-1) $end -= $diff; } if($pageNumber > 1) echo "
    • «
    • "; echo "
    • 1
    • "; if($start > 2) echo "
    • ...
    • "; for($j=$start; $j<=$end; $j++) echo "
    • ".$j."
    • "; if($end < $totalPages-1) echo "
    • ...
    • "; if($end < $totalPages) echo "
    • ".$totalPages."
    • "; if($pageNumber < $totalPages) echo "
    • »
    • "; } if ($totalPages>1) { echo "
    • ".getMLText("all_pages")."
    • "; } echo "
    "; echo "
    "; return; } /* }}} */ function contentContainer($content) { /* {{{ */ echo "
    \n"; echo $content; echo "
    \n"; return; } /* }}} */ function contentContainerStart($class='') { /* {{{ */ 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 "\n"; } print " \n"; print " \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 ""; } /* }}} */ 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"; print "getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />"; print "".getMLText("folder")."…\n"; 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"; print ""; print ""; print "".getMLText("category")."…\n"; 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 ""; } else { if (strlen($objvalue) > 80) { echo ''; } else { echo "getId()."]\" value=\"".htmlspecialchars($objvalue)."\" />"; } } break; } } /* }}} */ function printDropFolderChooserHtml($formName, $dropfolderfile="", $showfolders=0) { /* {{{ */ print "
    \n"; print ""; print ""; print "".getMLText("choose_target_file")."…\n"; 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 "
    "; $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 ''; } /* }}} */ /** * Output left-arrow with link which takes over a number of ids into * a select box. * * Clicking in the button will preset the comma seperated list of ids * in data-ref as options in the select box with name $name * * @param string $name id of select box * @param array $ids list of option values */ function printSelectPresetButtonHtml($name, $ids) { /* {{{ */ ?> " data-ref="" data-ids=""> $(document).ready( function() { $('.selectpreset_btn').click(function(ev){ ev.preventDefault(); if (typeof $(ev.currentTarget).data('ids') != 'undefined') { target = $(ev.currentTarget).data('ref'); // Use attr() instead of data() because data() converts to int which cannot be split items = $(ev.currentTarget).attr('data-ids'); arr = items.split(","); for(var i in arr) { $("#"+target+" option[value='"+arr[i]+"']").attr("selected", "selected"); } $("#"+target).trigger("chosen:updated"); } }); }); 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 ""; echo ""; echo ""; echo ""; } ?>
    ,
    "; switch ($rec["type"]) { case 0: // individual. $required = $dms->getUser($rec["required"]); if (!is_object($required)) { $reqName = getMLText("unknown_user")." '".$rec["required"]."'"; } else { $reqName = htmlspecialchars($required->getFullName()." (".$required->getLogin().")"); } break; case 1: // Approver is a group. $required = $dms->getGroup($rec["required"]); if (!is_object($required)) { $reqName = getMLText("unknown_group")." '".$rec["required"]."'"; } else { $reqName = "".htmlspecialchars($required->getName()).""; } break; } echo $reqName; echo ""; echo "".$rec['date']." - "; $updateuser = $dms->getUser($rec["userID"]); if(!is_object($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 "
    "; switch($type) { case "review": echo getReviewStatusText($rec["status"]); break; case "approval": echo getApprovalStatusText($rec["status"]); break; default: } echo "
    $value) { $used = (int) ($value/$max*100.0+0.5); $free = 100-$used; } else { $free = 0; $used = 100; } $html = '
    '; return $html; } /* }}} */ /** * Output a timeline for a document * * @param object $document document */ protected function printTimelineJs($timelineurl, $height=300, $start='', $end='', $skip=array()) { /* {{{ */ if(!$timelineurl) return; ?> var timeline; var data; // specify options var options = { 'width': '100%', 'height': '100%', 'editable': false, 'selectable': true, 'style': 'box', 'locale': 'params['session']->getLanguage() ?>' }; function onselect() { var sel = timeline.getSelection(); if (sel.length) { if (sel[0].row != undefined) { var row = sel[0].row; console.log(timeline.getItem(sel[0].row)); item = timeline.getItem(sel[0].row); $('div.ajax').trigger('update', {documentid: item.docid, version: item.version, statusid: item.statusid, statuslogid: item.statuslogid, fileid: item.fileid}); } } } $(document).ready(function () { // Instantiate our timeline object. timeline = new links.Timeline(document.getElementById('timeline'), options); links.events.addListener(timeline, 'select', onselect); $.getJSON( '', function(data) { $.each( data, function( key, val ) { val.start = new Date(val.start); }); timeline.draw(data); } ); });
    \n"; $this->printTimelineJs($timelineurl, $height, $start, $end, $skip); echo ""; $this->printTimelineHtml($height); } /* }}} */ } ?>