From aecd7a9083a94c9150af299442eca8e5e83972f4 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 17 Apr 2013 11:15:19 +0200 Subject: [PATCH 01/37] solved conflict with branch seeddms-4.1.3 --- inc/inc.Version.php | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/inc/inc.Version.php b/inc/inc.Version.php index b3d600c09..c80d812bc 100644 --- a/inc/inc.Version.php +++ b/inc/inc.Version.php @@ -1,4 +1,3 @@ -<<<<<<< HEAD -======= -_string .", ". $this->_number; - } -} -?> ->>>>>>> seeddms-4.1.3 From 59ed4ff9cc49bb39e423584b4383c3cff015bb16 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 17 Apr 2013 12:02:22 +0200 Subject: [PATCH 02/37] group can be set when adding/editing user --- op/op.UsrMgr.php | 46 +++++++++++++++++++++++++------- views/bootstrap/class.UsrMgr.php | 28 ++++++++++++++++--- 2 files changed, 60 insertions(+), 14 deletions(-) diff --git a/op/op.UsrMgr.php b/op/op.UsrMgr.php index f9f733bb1..ff3ce9edb 100644 --- a/op/op.UsrMgr.php +++ b/op/op.UsrMgr.php @@ -63,22 +63,28 @@ if ($action == "adduser") { $newUser = $dms->addUser($login, md5($pwd), $name, $email, $settings->_language, $settings->_theme, $comment, $role, $isHidden, $isDisabled, $pwdexpiration); if ($newUser) { + /* Set user image if uploaded */ if (isset($_FILES["userfile"]) && is_uploaded_file($_FILES["userfile"]["tmp_name"]) && $_FILES["userfile"]["size"] > 0 && $_FILES['userfile']['error']==0) { $userfiletype = $_FILES["userfile"]["type"]; $userfilename = $_FILES["userfile"]["name"]; $lastDotIndex = strrpos(basename($userfilename), "."); $fileType = substr($userfilename, $lastDotIndex); - if ($fileType != ".jpg" && $filetype != ".jpeg") - { + if ($fileType != ".jpg" && $filetype != ".jpeg") { UI::exitError(getMLText("admin_tools"),getMLText("only_jpg_user_images")); - } - else - { + } else { resizeImage($_FILES["userfile"]["tmp_name"]); $newUser->setImage($_FILES["userfile"]["tmp_name"], $userfiletype); } } + + /* Set groups if set */ + if(isset($_POST["groups"]) && $_POST["groups"]) { + foreach($_POST["groups"] as $groupid) { + $group = $dms->getGroup($groupid); + $group->addUser($newUser); + } + } } else UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); @@ -259,6 +265,26 @@ else if ($action == "edituser") { if (isset($_POST["grpApprovers"])) foreach ($_POST["grpApprovers"] as $appID) $editedUser->setMandatoryApprover($appID,true); + /* Updates groups */ + if(isset($_POST["groups"])) + $newgroups = $_POST["groups"]; + else + $newgroups = array(); + $oldgroups = array(); + foreach($editedUser->getGroups() as $k) + $oldgroups[] = $k->getID(); + + $addgroups = array_diff($newgroups, $oldgroups); + foreach($addgroups as $groupid) { + $group = $dms->getGroup($groupid); + $group->addUser($editedUser); + } + $delgroups = array_diff($oldgroups, $newgroups); + foreach($delgroups as $groupid) { + $group = $dms->getGroup($groupid); + $group->removeUser($editedUser); + } + add_log_line(".php&action=edituser&userid=".$userid); } @@ -271,19 +297,19 @@ function resizeImage($imageFile) { // and the output quality is low. Now uses the function imagecreatetruecolor(), // though, so at least the pictures are in colour. - // Originalbild einlesen + // read original image $origImg = imagecreatefromjpeg($imageFile); $width = imagesx($origImg); $height = imagesy($origImg); - // Thumbnail im Speicher erzeugen + // Create thumbnail in memory $newHeight = 150; $newWidth = ($width/$height) * $newHeight; $newImg = imagecreatetruecolor($newWidth, $newHeight); - // Verkleinern + // resize imagecopyresized($newImg, $origImg, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); - // In File speichern + // save to file imagejpeg($newImg, $imageFile); - // Aufräumen + // Clean up imagedestroy($origImg); imagedestroy($newImg); diff --git a/views/bootstrap/class.UsrMgr.php b/views/bootstrap/class.UsrMgr.php index d56605523..dc1e4dfc1 100644 --- a/views/bootstrap/class.UsrMgr.php +++ b/views/bootstrap/class.UsrMgr.php @@ -169,6 +169,16 @@ function showUser(selectObj) { : + + : + + : @@ -198,7 +208,7 @@ function showUser(selectObj) {
:
- : + + : + + : isHidden() ? " checked='checked'" : "");?>> @@ -423,7 +443,7 @@ function showUser(selectObj) {
:
- : - getMandatoryApprovers(); foreach ($users as $usr) { @@ -466,7 +486,7 @@ function showUser(selectObj) {
:
- Date: Wed, 17 Apr 2013 12:04:40 +0200 Subject: [PATCH 03/37] added entry for Bug #39 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index bfd4b2045..0539b1cc9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ - return to same tab on LogManagement page as before removing a log file (Bug #30) - new bootstrap datepicker with localization (Bug #36) +- users can assigned to a group when edited or added (Bug #39) -------------------------------------------------------------------------------- Changes in version 4.1.3 From 27441496129e74e237ff193d1f44cc7cb02a09ac Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 18 Apr 2013 13:35:38 +0200 Subject: [PATCH 04/37] icon for showing required attention --- out/images/attention.gif | Bin 0 -> 994 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 out/images/attention.gif diff --git a/out/images/attention.gif b/out/images/attention.gif new file mode 100644 index 0000000000000000000000000000000000000000..ae87ca9c6f65777896fe6a18879e254dc946dcbb GIT binary patch literal 994 zcmZ?wbhEHb6krfw_}<8Hb)oIQ-*5l@e)s;}r!Ti+{{4P+ZL!_I-|w$3vio`~;@_Vy z|NgxH|L^C&U(YZ1NdNu${L*BXgBi^Ket&*@vE%FQn7a!#zupY_aH;3Z&G0WbV?JE& z|8TMC?nd|bub;m-(fDMG+l%d%zus?sb2R$X^{}V=JO2IobY)J^i~UJ==Bak)sxUU_?a)0b-jPj_eh2O4yu@cH5L_itWb?36j2!}jCZ zl)t||{(L#*^~u72e?EV_()#Uo)bCG+j}>zMdOh#Q^C=gnM?T--^66U0?=O$fw~9UA z8}sQ}#DnF!uTO`6ygv8M^<{s5+&?r(&L_)x-@Sfye~I>&Td|+6hu@r`e5OwD z^|{qAkC%SC6Z7fDl!tqo{{4RQ=FXn?@4qmNf&mHv#h)yU3=EA7Iw1Q&d4hpsKLazT zjK_ur2OXGQen=E-c+jFQz0XAEhT}OQbG=hOJXe Date: Thu, 18 Apr 2013 13:36:11 +0200 Subject: [PATCH 05/37] add method needsWorkflowAction($user) This method checks if the document content needs a action from the given user to trigger a transition --- SeedDMS_Core/Core/inc.ClassDocument.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index f50d78cbf..65d36b083 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -3610,6 +3610,31 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ return $workflowlog; } /* }}} */ + /** + * Check if the document content needs an action by a user + * + * This method will return true if document content is in a transition + * which can be triggered by the given user. + * + * @param SeedDMS_Core_User $user + * @return boolean true is action is needed + */ + function needsWorkflowAction($user) { /* {{{ */ + $needwkflaction = false; + if($this->_workflow) { + if (!$this->_workflowState) + $this->getWorkflowState(); + $workflowstate = $this->_workflowState; + $transitions = $this->_workflow->getNextTransitions($workflowstate); + foreach($transitions as $transition) { + if($this->triggerWorkflowTransitionIsAllowed($user, $transition)) { + $needwkflaction = true; + } + } + } + return $needwkflaction; + } /* }}} */ + } /* }}} */ From 2d8096d11d0256aa3b3319bf65efe40699dc0441 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 18 Apr 2013 13:37:08 +0200 Subject: [PATCH 06/37] add phrase 'needs_workflow_action' --- languages/en_GB/lang.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/languages/en_GB/lang.inc b/languages/en_GB/lang.inc index a18773a46..9fbde407a 100644 --- a/languages/en_GB/lang.inc +++ b/languages/en_GB/lang.inc @@ -399,6 +399,7 @@ $text = array( 'my_account' => "My Account", 'my_documents' => "My Documents", 'name' => "Name", +'needs_workflow_action' => "This document requires your attention. Please check the workflow tab.", 'new_attrdef' => "Add attribute defintion", 'new_default_keyword_category' => "Add category", 'new_default_keywords' => "Add keywords", From 6d86898c11a684ee5e92c37e0f409a5fbc267a79 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 18 Apr 2013 13:37:28 +0200 Subject: [PATCH 07/37] pass $settings->_workflowMode to view --- out/out.ViewFolder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/out/out.ViewFolder.php b/out/out.ViewFolder.php index 55229e0ff..43b2ed4f0 100644 --- a/out/out.ViewFolder.php +++ b/out/out.ViewFolder.php @@ -62,6 +62,7 @@ if($view) { $view->setParam('enableClipboard', false /*$settings->_enableClipboard */); $view->setParam('showtree', showtree()); $view->setParam('cachedir', $settings->_cacheDir); + $view->setParam('workflowmode', $settings->_workflowMode); $view->setParam('enableRecursiveCount', $settings->_enableRecursiveCount); $view->setParam('maxRecursiveCount', $settings->_maxRecursiveCount); $view->show(); From 57c58a09c7cce68f0ff0e30f11da30f0d404332f Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 18 Apr 2013 13:38:02 +0200 Subject: [PATCH 08/37] place a message on the page if document has a waiting workflow transition --- views/bootstrap/class.ViewDocument.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 9318f9ff0..bb7c2e32b 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -105,6 +105,22 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { $links = $document->getDocumentLinks(); $links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links); + /* Retrieve latest content */ + $latestContent = $document->getLatestContent(); + $needwkflaction = false; + if($workflowmode == 'traditional') { + } else { + $workflow = $latestContent->getWorkflow(); + if($workflow) { + $workflowstate = $latestContent->getWorkflowState(); + $transitions = $workflow->getNextTransitions($workflowstate); + $needwkflaction = $latestContent->needsWorkflowAction($user); + } + } + + if($needwkflaction) { + $this->infoMsg(getMLText('needs_workflow_action')); + } ?> contentContainerEnd(); $this->htmlEndPage(); From 9a6b4ffc341095de24149ccd5ff1c1919033a495 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 19 Apr 2013 23:23:49 +0200 Subject: [PATCH 32/37] add style for #admin-tools --- styles/bootstrap/application.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/styles/bootstrap/application.css b/styles/bootstrap/application.css index 46cea9938..f9675e25e 100644 --- a/styles/bootstrap/application.css +++ b/styles/bootstrap/application.css @@ -10,6 +10,12 @@ img.mimeicon { padding: 2px; } +#admin-tools i { + font-size: 300%; + line-height: 110%; + min-height: 100px; +} + @media (max-width: 480px) { .nav-tabs > li { float:none; From d4e6eb67842f011a0671512df0592d2eb6f817d8 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 22 Apr 2013 10:15:35 +0200 Subject: [PATCH 33/37] support for sqlite3 database update --- install/update-4.1.0/update-sqlite3.sql | 5 ++++ install/update-4.2.0/update-sqlite3.sql | 8 +++++++ install/update.php | 31 +++++++++++++++---------- 3 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 install/update-4.1.0/update-sqlite3.sql create mode 100644 install/update-4.2.0/update-sqlite3.sql diff --git a/install/update-4.1.0/update-sqlite3.sql b/install/update-4.1.0/update-sqlite3.sql new file mode 100644 index 000000000..6cc1c4ed1 --- /dev/null +++ b/install/update-4.1.0/update-sqlite3.sql @@ -0,0 +1,5 @@ +BEGIN; + +UPDATE tblVersion set major=4, minor=1, subminor=0; + +COMMIT; diff --git a/install/update-4.2.0/update-sqlite3.sql b/install/update-4.2.0/update-sqlite3.sql new file mode 100644 index 000000000..70ea78a65 --- /dev/null +++ b/install/update-4.2.0/update-sqlite3.sql @@ -0,0 +1,8 @@ +BEGIN; + +ALTER TABLE tblSessions ADD COLUMN `su` INTEGER DEFAULT NULL; + +UPDATE tblVersion set major=4, minor=2, subminor=0; + +COMMIT; + diff --git a/install/update.php b/install/update.php index 55905e5bd..afc7e3e46 100644 --- a/install/update.php +++ b/install/update.php @@ -41,6 +41,7 @@ UI::htmlStartPage('Database update'); UI::contentHeading("SeedDMS Installation for version ".$_GET['version']); UI::contentContainerStart(); +$sqlfile = "update.sql"; switch($settings->_dbDriver) { case 'mysql': case 'mysqli': @@ -49,6 +50,8 @@ switch($settings->_dbDriver) { break; case 'sqlite': $dsn = $settings->_dbDriver.":".$settings->_dbDatabase; + if(file_exists('update-'.$_GET['version'].'/update-sqlite3.sql')) + $sqlfile = "update-sqlite3.sql"; break; } $db = new PDO($dsn, $settings->_dbUser, $settings->_dbPass); @@ -61,22 +64,26 @@ $res = $db->query('select * from tblVersion'); if($rec = $res->fetch(PDO::FETCH_ASSOC)) { if($_GET['version'] > $rec['major'].'.'.$rec['minor'].'.'.$rec['subminor']) { - $queries = file_get_contents('update-'.$_GET['version'].'/update.sql'); - $queries = explode(";", $queries); + if(file_exists('update-'.$_GET['version'].'/'.$sqlfile)) { + $queries = file_get_contents('update-'.$_GET['version'].'/'.$sqlfile); + $queries = explode(";", $queries); - // execute queries - if($queries) { - echo "

Updating database schema

"; - foreach($queries as $query) { - $query = trim($query); - if (!empty($query)) { - echo $query."
"; - if(false === $db->exec($query)) { - $e = $db->ErrorInfo(); - $errorMsg .= $e[2] . "
"; + // execute queries + if($queries) { + echo "

Updating database schema

"; + foreach($queries as $query) { + $query = trim($query); + if (!empty($query)) { + echo $query."
"; + if(false === $db->exec($query)) { + $e = $db->ErrorInfo(); + $errorMsg .= $e[2] . "
"; + } } } } + } else { + echo "

SQL file for update missing!

"; } } else { echo "

Database schema already up to date.

"; From e8e58b6bae8c1f6370621c6d7f5cf4fb86bb1af1 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 22 Apr 2013 10:26:48 +0200 Subject: [PATCH 34/37] fix sql statement to create session --- inc/inc.ClassSession.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/inc.ClassSession.php b/inc/inc.ClassSession.php index 32738b7ac..03542d798 100644 --- a/inc/inc.ClassSession.php +++ b/inc/inc.ClassSession.php @@ -97,7 +97,7 @@ class SeedDMS_Session { $id = md5($id); $lastaccess = time(); $queryStr = "INSERT INTO tblSessions (id, userID, lastAccess, theme, language, su) ". - "VALUES ('".$id."', ".$data['userid'].", ".$lastaccess.", '".$data['theme']."', '".$data['lang']."')"; + "VALUES ('".$id."', ".$data['userid'].", ".$lastaccess.", '".$data['theme']."', '".$data['lang']."', 0)"; if (!$this->db->getResult($queryStr)) { return false; } From 7bb38d555192e409bf2a02e8e54fbb578e9bef79 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 22 Apr 2013 10:30:24 +0200 Subject: [PATCH 35/37] update date and time --- SeedDMS_Core/package.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index b1abfc574..818489229 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,8 +12,8 @@ uwe@steinmann.cx yes - 2013-04-16 - + 2013-04-22 + 4.2.0 4.2.0 From 80387d9a1784d4fb8f0c53df82d88dda37ed2b2f Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 22 Apr 2013 10:31:16 +0200 Subject: [PATCH 36/37] add entry for sqlite3 update --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 69a2e35f9..ca1a4d85d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ -------------------------------------------------------------------------------- Changes in version 4.2.0 -------------------------------------------------------------------------------- +- sqlite3 database can be updated - use awesome font for icons - currently logged in user can be changed temporarily if being admin - count documents/folders recursively for output in folder list (Bug #43) From da2562ce6d4bc46ff28e3f3be7c6e6acddf25df5 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 22 Apr 2013 10:34:48 +0200 Subject: [PATCH 37/37] add missing update script --- install/update-4.2.0/update.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 install/update-4.2.0/update.sql diff --git a/install/update-4.2.0/update.sql b/install/update-4.2.0/update.sql new file mode 100644 index 000000000..6b45d5563 --- /dev/null +++ b/install/update-4.2.0/update.sql @@ -0,0 +1,8 @@ +START TRANSACTION; + +ALTER TABLE tblSessions ADD COLUMN `su` INTEGER DEFAULT NULL; + +UPDATE tblVersion set major=4, minor=2, subminor=0; + +COMMIT; +