theme = $theme; $this->params = $params; $this->imgpath = '../views/'.$theme.'/images/'; $this->extraheader = ''; } function htmlStartPage($title="", $bodyClass="") { /* {{{ */ 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) echo $this->extraheader; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; if($this->params['session'] && $this->params['session']->getSu()) { ?> ".(strlen($this->params['sitename'])>0 ? $this->params['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(); ?> extraheader .= $head; } /* }}} */ function htmlEndPage() { /* {{{ */ $this->footNote(); 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"; echo "\n\n"; } /* }}} */ function footNote() { /* {{{ */ 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"; return; } /* }}} */ function contentStart() { /* {{{ */ echo "
\n"; echo "
\n"; } /* }}} */ function contentEnd() { /* {{{ */ echo "
\n"; echo "
\n"; } /* }}} */ function globalBanner() { /* {{{ */ echo "
\n"; echo " \n"; echo "
\n"; } /* }}} */ function menuClipboard($clipboard) { /* {{{ */ $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 "
"; $clipboard = $this->params['session']->getClipboard(); if (!$this->params['user']->isGuest() && (count($clipboard['docs']) + count($clipboard['folders'])) > 0) { echo $this->menuClipboard($clipboard); } 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['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()."\" ondragover=\"allowDrop(event)\" ondrop=\"onDrop(event)\">". 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")) { if($pageType == "view_folder" || $pageType == "view_document") echo $pageTitle."\n"; echo "
    \n"; echo "
    \n"; echo "
    \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; switch ($pageType) { case "view_folder": $this->folderNavigationBar($extra); break; case "view_document": $this->documentNavigationBar($extra); break; case "my_documents": $this->myDocumentsNavigationBar(); break; case "my_account": $this->accountNavigationBar(); break; case "admin_tools": $this->adminToolsNavigationBar(); break; case "calendar"; $this->calendarNavigationBar($extra); break; } echo "
    \n"; echo "
    \n"; echo "
    \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) { /* {{{ */ 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 ""; echo "
    "; return; } /* }}} */ function contentContainer($content) { /* {{{ */ echo "
    \n"; echo $content; echo "
    \n"; return; } /* }}} */ function contentContainerStart($type='info') { /* {{{ */ //echo "
    \n"; 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 printDateChooser($defDate = -1, $varName) { /* {{{ */ if ($defDate == -1) $defDate = mktime(); $day = date("d", $defDate); $month = date("m", $defDate); $year = date("Y", $defDate); print " \n"; print " \n"; print ""; } /* }}} */ function printSequenceChooser($objArr, $keepID = -1) { /* {{{ */ if (count($objArr) > 0) { $max = $objArr[count($objArr)-1]->getSequence() + 1; $min = $objArr[0]->getSequence() - 1; } else { $max = 1.0; } print ""; } /* }}} */ function printDocumentChooser($formName) { /* {{{ */ print ""; print "\n"; ?> getID() : "") ."\">"; print "
    \n"; print "getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />"; print "".getMLText("folder")."…\n"; print "
    \n"; ?> getId(); $names[] = htmlspecialchars($cat->getName()); } } print ""; print "
    \n"; print ""; print ""; print "".getMLText("category")."…\n"; print "
    \n"; ?>
    getValueSetAsArray()) { echo ""; } else { echo "getId()."]\" value=\"".htmlspecialchars($objvalue)."\" />"; } } /* }}} */ function printDropFolderChooser($formName, $dropfolderfile="") { /* {{{ */ print "
    \n"; print ""; print ""; print "".getMLText("choose_target_file")."…\n"; print "
    \n"; ?> 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) { /* {{{ */ $this->htmlStartPage($pagetitle); $this->globalNavigation(); $this->contentStart(); print "
    "; print "

    ".getMLText('error')."!

    "; print htmlspecialchars($error); print "
    "; print "
    "; $this->htmlEndPage(); add_log_line(" UI::exitError error=".$error." pagetitle=".$pagetitle); exit; } /* }}} */ /** * Create a tree of folders using jqtree. * * The tree can contain folders only or include documents. * * @params integer $folderid current folderid. If set the tree will be * folded out and the all folders in the path will be visible * @params integer $accessmode use this access mode when retrieving folders * and documents shown in the tree * @params boolean $showdocs set to true if tree shall contain documents * as well. */ function printNewTreeNavigation($folderid=0, $accessmode=M_READ, $showdocs=0, $formid='form1', $expandtree=0) { /* {{{ */ function jqtree($path, $folder, $user, $accessmode, $showdocs=1, $expandtree=0) { if($path || $expandtree) { if($path) $pathfolder = array_shift($path); $subfolders = $folder->getSubFolders(); $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() ? true : false, 'is_folder'=>true); if($expandtree || $pathfolder->getID() == $subfolder->getID()) { if($showdocs) { $documents = $folder->getDocuments(); $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); } $children[] = $node; } return $children; } else { $subfolders = $folder->getSubFolders(); $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() ? 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); } $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)); } echo "
    \n"; ?> contentHeading("", true); $this->contentContainerStart(); ?> printNewTreeNavigation($folderid, M_READ, 0, ''); $this->contentContainerEnd(); } else { $this->contentHeading("", true); } } /* }}} */ function printClipboard($clipboard){ /* {{{ */ $dms = $this->params['dms']; $this->contentHeading(getMLText("clipboard"), true); echo "
    \n"; $clipboard = $this->params['session']->getClipboard(); // print_r($clipboard); if(!$clipboard['docs'] && !$clipboard['folders']) { print "
    ".getMLText("drag_icon_here")."
    "; } else { print ""; if($clipboard['folders']) { //echo "\n"; foreach($clipboard['folders'] as $folderid) { if($folder = $dms->getFolder($folderid)) { $comment = $folder->getComment(); if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; print "getID()."\" class=\"folder\" ondragover=\"allowDrop(event)\" ondrop=\"onDrop(event)\">"; // print ""; print "\n"; print "\n"; print "\n"; print "\n"; } } } $previewer = new SeedDMS_Preview_Previewer($this->params['cachedir'], 40); if($clipboard['docs']) { //echo "\n"; foreach($clipboard['docs'] as $docid) { 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(); print ""; if (file_exists($dms->contentDir . $latestContent->getPath())) { print ""; } else print ""; print "\n"; print "\n"; print ""; } } } } print "
    Folders
    getID()."\" draggable=\"true\" ondragstart=\"onDragStartFolder(event);\" href=\"out.ViewFolder.php?folderid=".$folder->getID()."&showtree=".showtree()."\">imgpath."folder.png\" width=\"24\" height=\"24\" border=0>getID()."&showtree=".showtree()."\">" . htmlspecialchars($folder->getName()) . ""; if($comment) { print "
    ".htmlspecialchars($comment).""; } print "
    \n"; print ""; print "
    Documents
    "; if($previewer->hasPreview($latestContent)) { print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; } else { print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; } print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">" . htmlspecialchars($document->getName()) . ""; if($comment) { print "
    ".htmlspecialchars($comment).""; } print "
    \n"; print ""; print "
    "; } echo "
    \n"; } /* }}} */ /** * 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()){ /* {{{ */ ?>