From ecc800fc24c7b52e0fc5aaa1c1213c33afab95f2 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 29 Apr 2013 18:22:47 +0200 Subject: [PATCH 001/234] add border around preview images --- styles/bootstrap/application.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/styles/bootstrap/application.css b/styles/bootstrap/application.css index fcbd6ba52..d3a0df5be 100644 --- a/styles/bootstrap/application.css +++ b/styles/bootstrap/application.css @@ -2,6 +2,14 @@ body { /* Add top padding for full-width layout */ padding-top: 60px; } img.mimeicon { + -moz-border-bottom-colors: none; + -moz-border-image: none; + -moz-border-left-colors: none; + -moz-border-right-colors: none; + -moz-border-top-colors: none; + border-color: #CCCCCC #AAAAAA #999999 #CCCCCC; + border-style: solid; + border-width: 1px 2px 2px 1px; } .list-action a { From 9f7b665c4820b2a1b9a8b4c9f0f056918e7de02d Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 29 Apr 2013 19:30:25 +0200 Subject: [PATCH 002/234] create preview from document files as well a preview image can now be created from a document content or a document file. --- SeedDMS_Preview/Preview/Previewer.php | 58 ++++++++++++++++++--------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/SeedDMS_Preview/Preview/Previewer.php b/SeedDMS_Preview/Preview/Previewer.php index 9b7e86d67..9f5aaf2f6 100644 --- a/SeedDMS_Preview/Preview/Previewer.php +++ b/SeedDMS_Preview/Preview/Previewer.php @@ -50,27 +50,50 @@ class SeedDMS_Preview_Previewer { $this->width = intval($width); } - function createPreview($documentcontent, $width=0) { /* {{{ */ + /** + * Retrieve the physical filename of the preview image on disk + * + * @param object $object document content or document file + * @param integer $width width of preview image + * @return string file name of preview image + */ + protected function getFileName($object, $width) { /* }}} */ + $document = $object->getDocument(); + $dir = $this->previewDir.'/'.$document->getDir(); + switch(get_class($object)) { + case "SeedDMS_Core_DocumentContent": + $target = $dir.'p'.$object->getVersion().'-'.$width.'.png'; + break; + case "SeedDMS_Core_DocumentFile": + $target = $dir.'f'.$object->getID().'-'.$width.'.png'; + break; + default: + return false; + } + return $target; + } /* }}} */ + + public function createPreview($object, $width=0) { /* {{{ */ if($width == 0) $width = $this->width; else $width = intval($width); if(!$this->previewDir) return false; - $document = $documentcontent->getDocument(); + $document = $object->getDocument(); $dir = $this->previewDir.'/'.$document->getDir(); if(!is_dir($dir)) { if (!SeedDMS_Core_File::makeDir($dir)) { return false; } } - $file = $document->_dms->contentDir.$documentcontent->getPath(); + $file = $document->_dms->contentDir.$object->getPath(); if(!file_exists($file)) return false; - $target = $dir.'p'.$documentcontent->getVersion().'-'.$width.'.png'; - if(!file_exists($target)) { + $target = $this->getFileName($object, $width); + if($target !== false && !file_exists($target)) { $cmd = ''; - switch($documentcontent->getMimeType()) { + switch($object->getMimeType()) { case "image/png": case "image/gif": case "image/jpeg": @@ -89,46 +112,43 @@ class SeedDMS_Preview_Previewer { } /* }}} */ - function hasPreview($documentcontent, $width=0) { /* {{{ */ + public function hasPreview($object, $width=0) { /* {{{ */ if($width == 0) $width = $this->width; else $width = intval($width); if(!$this->previewDir) return false; - $document = $documentcontent->getDocument(); - $dir = $this->previewDir.'/'.$document->getDir(); - $target = $dir.'p'.$documentcontent->getVersion().'-'.$width.'.png'; - if(file_exists($target)) { + $target = $this->getFileName($object, $width); + if($target && file_exists($target)) { return true; } return false; } /* }}} */ - function getPreview($documentcontent, $width=0) { /* {{{ */ + public function getPreview($object, $width=0) { /* {{{ */ if($width == 0) $width = $this->width; else $width = intval($width); if(!$this->previewDir) return false; - $document = $documentcontent->getDocument(); - $dir = $this->previewDir.'/'.$document->getDir(); - $target = $dir.'p'.$documentcontent->getVersion().'-'.$width.'.png'; - if(file_exists($target)) { + + $target = $this->getFileName($object, $width); + if($target && file_exists($target)) { readfile($target); } } /* }}} */ - function deletePreview($document, $documentcontent) { /* {{{ */ + public function deletePreview($document, $object, $width=0) { /* {{{ */ if($width == 0) $width = $this->width; else $width = intval($width); if(!$this->previewDir) return false; - $dir = $this->previewDir.'/'.$document->getDir(); - $target = $dir.'p'.$documentcontent->getVersion().'-'.$width.'.png'; + + $target = $this->getFileName($object, $width); } /* }}} */ } ?> From c3eb4d629cb31e782ef50391e3b8f30e91bdca87 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 29 Apr 2013 19:32:00 +0200 Subject: [PATCH 003/234] create preview from document file too pass url parameter 'file' instead of 'version' --- op/op.Preview.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/op/op.Preview.php b/op/op.Preview.php index 8ae43c7f0..aa50245e8 100644 --- a/op/op.Preview.php +++ b/op/op.Preview.php @@ -46,18 +46,26 @@ if ($document->getAccessMode($user) < M_READ) { exit; } -$version = $_GET["version"]; -if (!isset($version) || !is_numeric($version) || intval($version)<1) { +if(isset($_GET['version'])) { + $version = $_GET["version"]; + if (!is_numeric($version) || intval($version)<1) + exit; + $object = $document->getContentByVersion($version); +} elseif(isset($_GET['file'])) { + $file = $_GET['file']; + if (!is_numeric($file) || intval($file)<1) + exit; + $object = $document->getDocumentFile($file); +} else { exit; } -$content = $document->getContentByVersion($version); -if (!is_object($content)) { +if (!is_object($object)) { exit; } $previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $_GET["width"]); header('Content-Type: image/png'); -$previewer->getPreview($content); +$previewer->getPreview($object); ?> From 1f4dde6b59cd2acc2e239739272f44c492f997b4 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 29 Apr 2013 19:32:55 +0200 Subject: [PATCH 004/234] show preview of document files too --- views/bootstrap/class.ViewDocument.php | 32 ++++++++++++++++++-------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index dcbea99fa..90853dc3a 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -875,13 +875,19 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { $responsibleUser = $file->getUser(); print ""; - print ""; + print ""; + $previewer->createPreview($file); + if ($viewonlinefiletypes && in_array(strtolower($file->getFileType()), $viewonlinefiletypes)) + print "getID()."\">"; + else + print "getID()."\">"; + if($previewer->hasPreview($file)) { + print("getID()."&file=".$file->getID()."&width=100\" title=\"".htmlspecialchars($file->getMimeType())."\">"); + } else { + print "getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; + } + print ""; + print ""; print "
    \n"; print "
  • ".htmlspecialchars($file->getName())."
  • \n"; @@ -895,10 +901,16 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { print "".htmlspecialchars($file->getComment()).""; - print ""; + print "
      "; if (($document->getAccessMode($user) == M_ALL)||($file->getUserID()==$user->getID())) - print "
      getID()."\" />
      "; - print ""; + print "
    • getID()."\">".getMLText("delete")."
    • "; + print "
    "; print ""; } From 7f3afd614ed59360f69b7ad8763371e628417f1f Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 29 Apr 2013 19:34:58 +0200 Subject: [PATCH 005/234] new version 1.1.0 --- SeedDMS_Preview/package.xml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/SeedDMS_Preview/package.xml b/SeedDMS_Preview/package.xml index d90d1ccd1..f5e466917 100644 --- a/SeedDMS_Preview/package.xml +++ b/SeedDMS_Preview/package.xml @@ -11,11 +11,11 @@ uwe@steinmann.cx yes - 2012-11-20 - + 2013-04-29 + - 1.0.0 - 1.0.0 + 1.1.0 + 1.1.0 stable @@ -23,7 +23,7 @@ GPL License -initial version +preview image can also be created from a document file (SeedDMS_Core_DocumentFile) @@ -52,6 +52,20 @@ initial version + 2012-11-20 + + + 1.0.0 + 1.0.0 + + + stable + stable + + GPL License + + initial version + From fdb82c7abb6f8687d2d09eb6b6d966d1ec12c848 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 29 Apr 2013 19:52:11 +0200 Subject: [PATCH 006/234] use better icon for version information download --- views/bootstrap/class.ViewDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 90853dc3a..e0c0b4699 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -383,7 +383,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { print "
  • getVersion()."\">".getMLText("edit_attributes")."
  • "; } - print "
  • ".getMLText("versioning_info")."
  • "; + print "
  • ".getMLText("versioning_info")."
  • "; print "
"; echo ""; From 72d04d3059011421c170d30864f2f10b93187e5a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 29 Apr 2013 19:52:41 +0200 Subject: [PATCH 007/234] add entries for 4.3.0 --- CHANGELOG | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f5baaa13b..b57170b56 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +-------------------------------------------------------------------------------- + Changes in version 4.3.0 +-------------------------------------------------------------------------------- +- lots of clean in user interface +- create preview images for attachted document files + -------------------------------------------------------------------------------- Changes in version 4.2.1 -------------------------------------------------------------------------------- From 034d7d6fd25c68dae1bafd806d45a477131320cf Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 29 Apr 2013 19:56:44 +0200 Subject: [PATCH 008/234] remove entry from 4.3.0 because it was done in 4.2.1 --- CHANGELOG | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 16c463f7e..86a20cbd0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,6 @@ -------------------------------------------------------------------------------- Changes in version 4.3.0 -------------------------------------------------------------------------------- -- lots of clean in user interface - create preview images for attachted document files -------------------------------------------------------------------------------- From 058c5f2749dfd6114da4b80bfbd4da6a2d0d9e33 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 30 Apr 2013 17:02:03 +0200 Subject: [PATCH 009/234] expiration date of document can be set --- op/op.EditDocument.php | 35 ++++++++++++++++++++++++++ views/bootstrap/class.EditDocument.php | 12 +++++++++ 2 files changed, 47 insertions(+) diff --git a/op/op.EditDocument.php b/op/op.EditDocument.php index fb961229c..aee70d04c 100644 --- a/op/op.EditDocument.php +++ b/op/op.EditDocument.php @@ -161,6 +161,41 @@ if (($oldcomment = $document->getComment()) != $comment) { } } +$expires = false; +if ($_POST["expires"] != "false") { + if($_POST["expdate"]) { + $tmp = explode('-', $_POST["expdate"]); + $expires = mktime(0,0,0, $tmp[1], $tmp[0], $tmp[2]); + } else { + $expires = mktime(0,0,0, $_POST["expmonth"], $_POST["expday"], $_POST["expyear"]); + } +} + +if ($expires) { + if($document->setExpires($expires)) { + if($notifier) { + $notifyList = $document->getNotifyList(); + $folder = $document->getFolder(); + // Send notification to subscribers. + $subject = "expiry_changed_email_subject"; + $message = "expiry_changed_email_body"; + $params = array(); + $params['name'] = $document->getName(); + $params['folder_path'] = $folder->getFolderPathPlain(); + $params['username'] = $user->getFullName(); + $params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$document->getID(); + $params['sitename'] = $settings->_siteName; + $params['http_root'] = $settings->_httpRoot; + $notifier->toList($user, $notifyList["users"], $subject, $message, $params); + foreach ($notifyList["groups"] as $grp) { + $notifier->toGroup($user, $grp, $subject, $message, $params); + } + } + } else { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); + } +} + if (($oldkeywords = $document->getKeywords()) != $keywords) { if($document->setKeywords($keywords)) { } diff --git a/views/bootstrap/class.EditDocument.php b/views/bootstrap/class.EditDocument.php index aaec2b129..498280cfd 100644 --- a/views/bootstrap/class.EditDocument.php +++ b/views/bootstrap/class.EditDocument.php @@ -107,6 +107,18 @@ function checkForm() + + : + + + + +   + + + getAccessMode($user) > M_READ) { print ""; From 9400a962a8b17157ffa429726db3bbf0b02f8701 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 30 Apr 2013 17:23:24 +0200 Subject: [PATCH 010/234] maySetExpires() doesn't check if version modification is enabled this makes no sense because a expiration date can only be set for a document and not for the version --- inc/inc.ClassAccessOperation.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/inc/inc.ClassAccessOperation.php b/inc/inc.ClassAccessOperation.php index 434066bec..2c7502357 100644 --- a/inc/inc.ClassAccessOperation.php +++ b/inc/inc.ClassAccessOperation.php @@ -129,16 +129,13 @@ class SeedDMS_AccessOperation { * Check if expiration date may be set * * This check can only be done for documents. Setting the documents - * expiration date is only allowed if version modification is turned on in - * the settings and the document has not been obsoleted. - * The admin may set the expiration date even if is - * disallowed in the settings. + * expiration date is only allowed if the document has not been obsoleted. */ function maySetExpires() { /* {{{ */ if(get_class($this->obj) == 'SeedDMS_Core_Document') { $latestContent = $this->obj->getLatestContent(); $status = $latestContent->getStatus(); - if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]!=S_OBSOLETE)) { + if ((($this->obj->getAccessMode($this->user) == M_ALL) || $this->user->isAdmin()) && ($status["status"]!=S_OBSOLETE)) { return true; } } From f2a37f3e0e774d1149938a70e54cf965881c18f7 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 30 Apr 2013 17:24:45 +0200 Subject: [PATCH 011/234] remove link on current version for setting the expiration date the expiration date can only be set for the document --- views/bootstrap/class.ViewDocument.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 6d1588c85..e1057ad9a 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -381,9 +381,11 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { } } } + /* if($accessop->maySetExpires()) { print "
  • ".getMLText("set_expiry")."
  • "; } + */ if($accessop->mayEditComment()) { print "
  • getVersion()."\">".getMLText("edit_comment")."
  • "; } From 26ae06b1ef1cdc434347813e8e098fdff367f329 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 30 Apr 2013 17:41:32 +0200 Subject: [PATCH 012/234] set expiration date to currently set value --- views/bootstrap/class.EditDocument.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/views/bootstrap/class.EditDocument.php b/views/bootstrap/class.EditDocument.php index 1b616a5e8..c4611db44 100644 --- a/views/bootstrap/class.EditDocument.php +++ b/views/bootstrap/class.EditDocument.php @@ -71,6 +71,11 @@ function checkForm() contentHeading(getMLText("edit_document_props")); $this->contentContainerStart(); + + if($document->expires()) + $expdate = date('d-m-Y', $document->getExpires()); + else + $expdate = ''; ?>
    @@ -111,7 +116,7 @@ function checkForm() : - +