diff --git a/Makefile b/Makefile index fc460090c..4d21c4a68 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=4.2.2 +VERSION=4.3.0 SRC=CHANGELOG inc conf utils index.php languages views op out README.md README.Notification README.Ubuntu drop-tables-innodb.sql styles js TODO LICENSE Makefile webdav install #restapi webapp diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index b480c9871..4d62581f8 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -243,7 +243,7 @@ class SeedDMS_Core_DMS { $this->convertFileTypes = array(); $this->version = '@package_version@'; if($this->version[0] == '@') - $this->version = '4.2.2'; + $this->version = '4.3.0'; } /* }}} */ function getDB() { /* {{{ */ diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index 5ce494f37..3596097b9 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,11 +12,11 @@ uwe@steinmann.cx yes - 2013-05-17 + 2013-05-22 09:21:37 - 4.2.2 - 4.2.1 + 4.3.0 + 4.3.0 stable @@ -24,7 +24,6 @@ GPL License -- admins can be added as reviewer/approver again @@ -529,5 +528,21 @@ New release - fixed bug in SeedDMS_Core_DocumentContent::addIndApp() + + 2013-05-17 + 09:21:37 + + 4.2.2 + 4.2.1 + + + stable + stable + + GPL License + +- admins can be added as reviewer/approver again + + diff --git a/inc/inc.ClassSession.php b/inc/inc.ClassSession.php index 1f92c1676..07410db18 100644 --- a/inc/inc.ClassSession.php +++ b/inc/inc.ClassSession.php @@ -77,11 +77,15 @@ class SeedDMS_Session { if (!$this->db->getResult($queryStr)) return false; $this->id = $id; - $this->data = array('userid'=>$resArr[0]['userID'], 'theme'=>$resArr[0]['theme'], 'lang'=>$resArr[0]['language'], 'id'=>$resArr[0]['id'], 'lastaccess'=>$resArr[0]['lastAccess'], 'flashmsg'=>'', 'su'=>$resArr[0]['su']); + $this->data = array('userid'=>$resArr[0]['userID'], 'theme'=>$resArr[0]['theme'], 'lang'=>$resArr[0]['language'], 'id'=>$resArr[0]['id'], 'lastaccess'=>$resArr[0]['lastAccess'], 'su'=>$resArr[0]['su']); if($resArr[0]['clipboard']) $this->data['clipboard'] = json_decode($resArr[0]['clipboard'], true); else $this->data['clipboard'] = array('docs'=>array(), 'folders'=>array()); + if($resArr[0]['splashmsg']) + $this->data['splashmsg'] = json_decode($resArr[0]['splashmsg'], true); + else + $this->data['splashmsg'] = array(); return $resArr[0]; } /* }}} */ @@ -107,6 +111,8 @@ class SeedDMS_Session { $this->data['lastaccess'] = $lastaccess; $this->data['su'] = 0; $this->data['clipboard'] = array('docs'=>array(), 'folders'=>array()); + $this->data['clipboard'] = array('type'=>'', 'msg'=>''); + $this->data['splashmsg'] = array(); return $id; } /* }}} */ @@ -238,7 +244,7 @@ class SeedDMS_Session { function setClipboard($clipboard) { /* {{{ */ /* id is only set if load() was called before */ if($this->id) { - $queryStr = "UPDATE tblSessions SET clipboard = " . json_encode($this->db->qstr($clipboard)) . " WHERE id = " . $this->db->qstr($this->id); + $queryStr = "UPDATE tblSessions SET clipboard = " . $this->db->qstr(json_encode($clipboard)) . " WHERE id = " . $this->db->qstr($this->id); if (!$this->db->getResult($queryStr)) return false; $this->data['clipboard'] = $clipboard; @@ -301,5 +307,46 @@ class SeedDMS_Session { return true; } /* }}} */ + /** + * Set splash message of session + * + * @param array $msg contains 'typ' and 'msg' + */ + function setSplashMsg($msg) { /* {{{ */ + /* id is only set if load() was called before */ + if($this->id) { + $queryStr = "UPDATE tblSessions SET splashmsg = " . $this->db->qstr(json_encode($msg)) . " WHERE id = " . $this->db->qstr($this->id); + if (!$this->db->getResult($queryStr)) + return false; + $this->data['splashmsg'] = $msg; + } + return true; + } /* }}} */ + + /** + * Set splash message of session + * + * @param array $msg contains 'typ' and 'msg' + */ + function clearSplashMsg() { /* {{{ */ + /* id is only set if load() was called before */ + if($this->id) { + $queryStr = "UPDATE tblSessions SET splashmsg = '' WHERE id = " . $this->db->qstr($this->id); + if (!$this->db->getResult($queryStr)) + return false; + $this->data['splashmsg'] = ''; + } + return true; + } /* }}} */ + + /** + * Get splash message of session + * + * @return array last splash message + */ + function getSplashMsg() { /* {{{ */ + return (array) $this->data['splashmsg']; + } /* }}} */ + } ?> diff --git a/inc/inc.Version.php b/inc/inc.Version.php index 9fd8c71db..9b59af4a9 100644 --- a/inc/inc.Version.php +++ b/inc/inc.Version.php @@ -20,7 +20,7 @@ class SeedDMS_Version { - var $_number = "4.2.2"; + var $_number = "4.3.0"; var $_string = "SeedDMS"; function SeedDMS_Version() { diff --git a/install/create_tables-innodb.sql b/install/create_tables-innodb.sql index 50f677c2c..a6c738747 100644 --- a/install/create_tables-innodb.sql +++ b/install/create_tables-innodb.sql @@ -490,6 +490,8 @@ CREATE TABLE `tblSessions` ( `theme` varchar(30) NOT NULL default '', `language` varchar(30) NOT NULL default '', `clipboard` text default '', + `su` INTEGER DEFAULT NULL, + `splashmsg` text default '', PRIMARY KEY (`id`), CONSTRAINT `tblSessions_user` FOREIGN KEY (`userID`) REFERENCES `tblUsers` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/install/create_tables-sqlite3.sql b/install/create_tables-sqlite3.sql index 4361a2283..0ba66cdc8 100644 --- a/install/create_tables-sqlite3.sql +++ b/install/create_tables-sqlite3.sql @@ -426,7 +426,9 @@ CREATE TABLE `tblSessions` ( `lastAccess` INTEGER NOT NULL default '0', `theme` varchar(30) NOT NULL default '', `language` varchar(30) NOT NULL default '', - `clipboard` text default '' + `clipboard` text default '', + `su` INTEGER DEFAULT NULL, + `splashmsg` text default '' ) ; -- -------------------------------------------------------- diff --git a/install/install.php b/install/install.php index 880efd5eb..9d4401f4c 100644 --- a/install/install.php +++ b/install/install.php @@ -116,7 +116,7 @@ function fileExistsInIncludePath($file) { /* {{{ */ * Load default settings + set */ define("SEEDDMS_INSTALL", "on"); -define("SEEDDMS_VERSION", "4.2.2"); +define("SEEDDMS_VERSION", "4.3.0"); require_once('../inc/inc.ClassSettings.php'); diff --git a/install/update-4.3.0/update-sqlite3.sql b/install/update-4.3.0/update-sqlite3.sql new file mode 100644 index 000000000..bcfb70bb5 --- /dev/null +++ b/install/update-4.3.0/update-sqlite3.sql @@ -0,0 +1,8 @@ +BEGIN; + +ALTER TABLE tblSessions ADD COLUMN `splashmsg` TEXT DEFAULT ''; + +UPDATE tblVersion set major=4, minor=3, subminor=0; + +COMMIT; + diff --git a/install/update-4.3.0/update.sql b/install/update-4.3.0/update.sql new file mode 100644 index 000000000..5335725ea --- /dev/null +++ b/install/update-4.3.0/update.sql @@ -0,0 +1,8 @@ +START TRANSACTION; + +ALTER TABLE tblSessions ADD COLUMN `splashmsg` TEXT DEFAULT ''; + +UPDATE tblVersion set major=4, minor=3, subminor=0; + +COMMIT; + diff --git a/languages/en_GB/lang.inc b/languages/en_GB/lang.inc index c66d83743..cf680d33b 100644 --- a/languages/en_GB/lang.inc +++ b/languages/en_GB/lang.inc @@ -779,6 +779,14 @@ $text = array( 'sign_out' => "Sign out", 'sign_out_user' => "Sign out user", 'space_used_on_data_folder' => "Space used on data folder", +'splash_added_to_clipboard' => "Added to clipboard", +'splash_document_locked' => "Document locked", +'splash_document_unlocked' => "Document unlocked", +'splash_folder_edited' => "Save folder changes", +'splash_invalid_folder_id' => "Invalid folder ID", +'splash_removed_from_clipboard' => "Removed from clipboard", +'splash_substituted_user' => "Substituted user", +'splash_switched_back_user' => "Switched back to original user", 'status_approval_rejected' => "Draft rejected", 'status_approved' => "Approved", 'status_approver_removed' => "Approver removed from process", diff --git a/op/op.AddToClipboard.php b/op/op.AddToClipboard.php index a52c37f9b..5c2e9641c 100644 --- a/op/op.AddToClipboard.php +++ b/op/op.AddToClipboard.php @@ -37,6 +37,8 @@ if (isset($_GET["id"]) && is_numeric($_GET["id"]) && isset($_GET['type'])) { } } +$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_added_to_clipboard'))); + /* FIXME: this does not work because the folder id is not passed */ $folderid = $_GET['folderid']; header("Location:../out/out.ViewFolder.php?folderid=".$folderid); diff --git a/op/op.EditFolder.php b/op/op.EditFolder.php index b6418a0d3..24fec6d0c 100644 --- a/op/op.EditFolder.php +++ b/op/op.EditFolder.php @@ -170,6 +170,8 @@ if(strcasecmp($sequence, "keep")) { } } +$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_folder_edited'))); + add_log_line("?folderid=".$folderid); header("Location:../out/out.ViewFolder.php?folderid=".$folderid."&showtree=".$_POST["showtree"]); diff --git a/op/op.LockDocument.php b/op/op.LockDocument.php index 48946bfb6..3706b7bfe 100644 --- a/op/op.LockDocument.php +++ b/op/op.LockDocument.php @@ -1,57 +1,59 @@ - getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } - -$documentid = $_GET["documentid"]; + +$documentid = $_GET["documentid"]; $document = $dms->getDocument($documentid); - -if (!is_object($document)) { - UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); -} - -$folder = $document->getFolder(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; - -if ($document->getAccessMode($user) < M_READWRITE) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); -} - -if ($document->isLocked()) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("document_already_locked")); -} - -if (!$document->setLocked($user)) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); + +if (!is_object($document)) { + UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } -add_log_line(); +$folder = $document->getFolder(); +$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; + +if ($document->getAccessMode($user) < M_READWRITE) { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); +} + +if ($document->isLocked()) { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("document_already_locked")); +} + +if (!$document->setLocked($user)) { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); +} + +$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_document_locked'))); + +add_log_line(); header("Location:../out/out.ViewDocument.php?documentid=".$documentid); - -?> + +?> diff --git a/op/op.RemoveFromClipboard.php b/op/op.RemoveFromClipboard.php index 171b6fd0e..ea4286f63 100644 --- a/op/op.RemoveFromClipboard.php +++ b/op/op.RemoveFromClipboard.php @@ -37,6 +37,8 @@ if (isset($_GET["id"]) && is_numeric($_GET["id"]) && isset($_GET['type'])) { } } +$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_removed_from_clipboard'))); + $folderid = $_GET['folderid']; header("Location:../out/out.ViewFolder.php?folderid=".$folderid); diff --git a/op/op.ResetSu.php b/op/op.ResetSu.php index ee519ce7d..3bf52b82d 100644 --- a/op/op.ResetSu.php +++ b/op/op.ResetSu.php @@ -25,6 +25,8 @@ include("../inc/inc.Authentication.php"); $session->resetSu(); +$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_switched_back_user'))); + add_log_line(""); header("Location: ../".(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".$settings->_rootFolderID)); diff --git a/op/op.SubstituteUser.php b/op/op.SubstituteUser.php index 8d7b128dc..7e3b16b87 100644 --- a/op/op.SubstituteUser.php +++ b/op/op.SubstituteUser.php @@ -33,6 +33,8 @@ if (!isset($_GET["userid"])) { $session->setSu($_GET['userid']); +$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_substituted_user'))); + add_log_line("?userid=".$_GET["userid"]); header("Location: ../".(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".$settings->_rootFolderID)); diff --git a/op/op.UnlockDocument.php b/op/op.UnlockDocument.php index d4ed5d5ef..55617efe6 100644 --- a/op/op.UnlockDocument.php +++ b/op/op.UnlockDocument.php @@ -1,62 +1,65 @@ - getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); -} -$documentid = $_GET["documentid"]; -$document = $dms->getDocument($documentid); - -if (!is_object($document)) { - UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); -} - -$folder = $document->getFolder(); -$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; - -if ($document->getAccessMode($user) < M_READWRITE) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); -} - -if (!$document->isLocked()) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("document_is_not_locked")); +include("../inc/inc.Language.php"); +include("../inc/inc.ClassUI.php"); +include("../inc/inc.Authentication.php"); + +if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) { + UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } - +$documentid = $_GET["documentid"]; +$document = $dms->getDocument($documentid); + +if (!is_object($document)) { + UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); +} + +$folder = $document->getFolder(); +$docPathHTML = getFolderPathHTML($folder, true). " / ".$document->getName().""; + +if ($document->getAccessMode($user) < M_READWRITE) { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); +} + +if (!$document->isLocked()) { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("document_is_not_locked")); +} + $lockingUser = $document->getLockingUser(); - -if (($lockingUser->getID() == $user->getID()) || ($document->getAccessMode($user) == M_ALL)) { - if (!$document->setLocked(false)) { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); - } -} + +if (($lockingUser->getID() == $user->getID()) || ($document->getAccessMode($user) == M_ALL)) { + if (!$document->setLocked(false)) { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured")); + } +} else { - UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); -} -add_log_line(); + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); +} + +$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_document_unlocked'))); + +add_log_line(); header("Location:../out/out.ViewDocument.php?documentid=".$documentid); - -?> + +?> diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 34a081cf0..ef1fbeb24 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -46,11 +46,30 @@ class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common { echo $this->extraheader; echo ''."\n"; echo ''."\n"; + echo ''."\n"; + echo ''."\n"; + echo ''."\n"; echo ''."\n"; echo "".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS").(strlen($title)>0 ? ": " : "").htmlspecialchars($title)."\n"; echo "\n"; echo "0 ? " class=\"".$bodyClass."\"" : "").">\n"; + if($flashmsg = $this->params['session']->getSplashMsg()) { + $this->params['session']->clearSplashMsg(); +?> + +"; print ""; print ""; + print ""; + if($subFolder->getAccessMode($user) >= M_ALL) { ?> - - - "> + + +getAccessMode($user) >= M_READWRITE) { +?> + + + + + "> +"; print ""; print "\n"; } @@ -292,11 +310,29 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style { print getOverallStatusText($status["status"]).""; print "".$version.""; print ""; + print ""; + if($document->getAccessMode($user) >= M_ALL) { ?> - - - "> + + +getAccessMode($user) >= M_READWRITE) { +?> + + + + + "> +"; print ""; print "\n"; }