Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2022-08-12 10:53:32 +02:00
commit a0db4bcc6d
41 changed files with 476 additions and 331 deletions

View File

@ -234,7 +234,11 @@
Changes in version 5.1.27 Changes in version 5.1.27
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- fix adding new attribute definition if object type is 'all' - fix adding new attribute definition if object type is 'all'
- EmptyFolder runs callbacks to remove objects from index and remove preview images
- skip internal conversion service for images if imagick extension is missing - skip internal conversion service for images if imagick extension is missing
- running the controller will always call the hooks preRun and postRun
- add tabs on ViewFolder page
- link behind logo in header can be set in extension
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.26 Changes in version 5.1.26

View File

@ -89,7 +89,7 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
$attribute = date('Y-m-d', makeTsFromDate($attribute)); $attribute = date('Y-m-d', makeTsFromDate($attribute));
break; break;
} }
if(!$attrdef->validate($attribute)) { if(!$attrdef->validate($attribute, null, true)) {
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute); $this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
return false; return false;
} }

View File

@ -30,119 +30,180 @@ class SeedDMS_Controller_DocumentAccess extends SeedDMS_Controller_Common {
$settings = $this->params['settings']; $settings = $this->params['settings'];
$action = $this->params['action']; $action = $this->params['action'];
// Change owner ----------------------------------------------------------- return null;
if ($action == "setowner") { }
if(false === $this->callHook('preSetOwner', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetOwner_failed';
return null;
}
$newowner = $this->params['newowner'];
$oldowner = $document->getOwner();
if($document->setOwner($newowner)) {
if(false === $this->callHook('postSetOwner', $document, $oldowner)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_postSetOwner_failed';
return null;
}
}
} elseif ($action == "notinherit") {
if(false === $this->callHook('preSetNotInherit', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetNotInherit_failed';
return null;
}
/* Get default access before access is not longer inherited. This // Change owner -----------------------------------------------------------
* will return the default access from the parent folder. public function setowner() {
*/ $dms = $this->params['dms'];
$defAccess = $document->getDefaultAccess(); $user = $this->params['user'];
if(!$document->setInheritAccess(false)) { $folder = $this->params['folder'];
return false; $document = $this->params['document'];
} $settings = $this->params['settings'];
if(!$document->setDefaultAccess($defAccess)) { if(false === $this->callHook('preSetOwner', $document)) {
return false; if(empty($this->errormsg))
} $this->errormsg = 'hook_preSetOwner_failed';
return null;
//copy ACL of parent folder }
$mode = $this->params['mode']; $newowner = $this->params['newowner'];
if ($mode == "copy") { $oldowner = $document->getOwner();
$accessList = $folder->getAccessList(); if($document->setOwner($newowner)) {
foreach ($accessList["users"] as $userAccess) if(false === $this->callHook('postSetOwner', $document, $oldowner)) {
$document->addAccess($userAccess->getMode(), $userAccess->getUserID(), true);
foreach ($accessList["groups"] as $groupAccess)
$document->addAccess($groupAccess->getMode(), $groupAccess->getGroupID(), false);
}
if(false === $this->callHook('postSetNotInherit', $document)) {
if(empty($this->errormsg)) if(empty($this->errormsg))
$this->errormsg = 'hook_postSetNotInherit_failed'; $this->errormsg = 'hook_postSetOwner_failed';
return null; return null;
} }
} elseif ($action == "inherit") {
if(false === $this->callHook('preSetInherit', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetInherit_failed';
return null;
}
if(!$document->clearAccessList() || !$document->setInheritAccess(true)) {
return false;
}
if(false === $this->callHook('postSetInherit', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_postSetInherit_failed';
return null;
}
} elseif ($action == "setdefault") {
if(false === $this->callHook('preSetDefault', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetDefault_failed';
return null;
}
$mode = $this->params['mode'];
if(!$document->setDefaultAccess($mode)) {
return false;
}
if(false === $this->callHook('postSetDefault', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_postSetDefault_failed';
return null;
}
} elseif ($action == "editaccess") {
$mode = $this->params['mode'];
$userid = $this->params['userid'];
$groupid = $this->params['groupid'];
if ($userid) {
$document->changeAccess($mode, $userid, true);
}
elseif ($groupid) {
$document->changeAccess($mode, $groupid, false);
}
} elseif ($action == "delaccess") {
$userid = $this->params['userid'];
$groupid = $this->params['groupid'];
if ($userid) {
$document->removeAccess($userid, true);
}
elseif ($groupid) {
$document->removeAccess($groupid, false);
}
} elseif ($action == "addaccess") {
$mode = $this->params['mode'];
$userid = $this->params['userid'];
$groupid = $this->params['groupid'];
if ($userid && $userid != -1) {
$document->addAccess($mode, $userid, true);
}
elseif ($groupid && $groupid != -1) {
$document->addAccess($mode, $groupid, false);
}
} }
return true;
}
public function notinherit() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
if(false === $this->callHook('preSetNotInherit', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetNotInherit_failed';
return null;
}
/* Get default access before access is not longer inherited. This
* will return the default access from the parent folder.
*/
$defAccess = $document->getDefaultAccess();
if(!$document->setInheritAccess(false)) {
return false;
}
if(!$document->setDefaultAccess($defAccess)) {
return false;
}
//copy ACL of parent folder
$mode = $this->params['mode'];
if ($mode == "copy") {
$accessList = $folder->getAccessList();
foreach ($accessList["users"] as $userAccess)
$document->addAccess($userAccess->getMode(), $userAccess->getUserID(), true);
foreach ($accessList["groups"] as $groupAccess)
$document->addAccess($groupAccess->getMode(), $groupAccess->getGroupID(), false);
}
if(false === $this->callHook('postSetNotInherit', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_postSetNotInherit_failed';
return null;
}
return true;
}
public function inherit() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
if(false === $this->callHook('preSetInherit', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetInherit_failed';
return null;
}
if(!$document->clearAccessList() || !$document->setInheritAccess(true)) {
return false;
}
if(false === $this->callHook('postSetInherit', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_postSetInherit_failed';
return null;
}
return true;
}
public function setdefault() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
if(false === $this->callHook('preSetDefault', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_preSetDefault_failed';
return null;
}
$mode = $this->params['mode'];
if(!$document->setDefaultAccess($mode)) {
return false;
}
if(false === $this->callHook('postSetDefault', $document)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_postSetDefault_failed';
return null;
}
return true;
}
public function editaccess() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
$mode = $this->params['mode'];
$userid = $this->params['userid'];
$groupid = $this->params['groupid'];
if ($userid) {
$document->changeAccess($mode, $userid, true);
}
elseif ($groupid) {
$document->changeAccess($mode, $groupid, false);
}
return true;
}
public function delaccess() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
$userid = $this->params['userid'];
$groupid = $this->params['groupid'];
if ($userid) {
$document->removeAccess($userid, true);
}
elseif ($groupid) {
$document->removeAccess($groupid, false);
}
return true;
}
public function addaccess() {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
$document = $this->params['document'];
$settings = $this->params['settings'];
$mode = $this->params['mode'];
$userid = $this->params['userid'];
$groupid = $this->params['groupid'];
if ($userid && $userid != -1) {
$document->addAccess($mode, $userid, true);
}
elseif ($groupid && $groupid != -1) {
$document->addAccess($mode, $groupid, false);
}
return true; return true;
} }
} }

View File

@ -125,7 +125,7 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
$attribute = date('Y-m-d', makeTsFromDate($attribute)); $attribute = date('Y-m-d', makeTsFromDate($attribute));
break; break;
} }
if(!$attrdef->validate($attribute, $document, true)) { if(!$attrdef->validate($attribute, $document, false)) {
$this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute); $this->errormsg = getAttributeValidationError($attrdef->getValidationError(), $attrdef->getName(), $attribute);
return false; return false;
} }

View File

@ -59,7 +59,7 @@ class SeedDMS_Controller_EditFolder extends SeedDMS_Controller_Common {
$attribute = date('Y-m-d', makeTsFromDate($attribute)); $attribute = date('Y-m-d', makeTsFromDate($attribute));
break; break;
} }
if(!$attrdef->validate($attribute, $folder, true)) { if(!$attrdef->validate($attribute, $folder, false)) {
$this->errormsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute); $this->errormsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
return false; return false;
} }

View File

@ -22,96 +22,93 @@
*/ */
class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common { class SeedDMS_Controller_Preview extends SeedDMS_Controller_Common {
public function run() { public function version() {
global $theme;
$dms = $this->params['dms']; $dms = $this->params['dms'];
$type = $this->params['type'];
$settings = $this->params['settings']; $settings = $this->params['settings'];
$conversionmgr = $this->params['conversionmgr']; $conversionmgr = $this->params['conversionmgr'];
switch($type) { $version = $this->params['version'];
case "version": $document = $this->params['document'];
$version = $this->params['version']; $width = $this->params['width'];
$document = $this->params['document']; if($version < 1) {
$width = $this->params['width']; $content = $this->callHook('documentLatestContent', $document);
if($version < 1) { if($content === null)
$content = $this->callHook('documentLatestContent', $document); $content = $document->getLatestContent();
if($content === null) } else {
$content = $document->getLatestContent(); $content = $this->callHook('documentContent', $document, $version);
} else { if($content === null)
$content = $this->callHook('documentContent', $document, $version); $content = $document->getContentByVersion($version);
if($content === null)
$content = $document->getContentByVersion($version);
}
if (!is_object($content)) {
$this->errormsg = 'invalid_version';
return false;
}
/* set params['content'] for compatiblity with older extensions which
* expect the content in the controller
*/
$this->params['content'] = $content;
if(null === $this->callHook('version')) {
if($width)
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $width, $settings->_cmdTimeout);
else
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
if($conversionmgr)
$previewer->setConversionMgr($conversionmgr);
else
$previewer->setConverters($settings->_converters['preview']);
$previewer->setXsendfile($settings->_enableXsendfile);
if(!$previewer->hasPreview($content)) {
add_log_line("");
if(!$previewer->createPreview($content)) {
add_log_line("", PEAR_LOG_ERR);
}
}
if(!$previewer->hasPreview($content)) {
header('Content-Type: image/svg+xml');
readfile('../views/'.$theme.'/images/empty.svg');
exit;
}
header('Content-Type: image/png');
$previewer->getPreview($content);
}
break;
case "file":
$object = $this->params['object'];
$document = $this->params['document'];
$width = $this->params['width'];
if (!is_object($object)) {
$this->errormsg = 'invalid_version';
return false;
}
if(null === $this->callHook('file')) {
if($width)
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $width, $settings->_cmdTimeout);
else
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
if($conversionmgr)
$previewer->setConversionMgr($conversionmgr);
else
$previewer->setConverters($settings->_converters['preview']);
$previewer->setXsendfile($settings->_enableXsendfile);
if(!$previewer->hasPreview($object)) {
add_log_line("");
if(!$previewer->createPreview($object)) {
add_log_line("", PEAR_LOG_ERR);
}
}
if(!$previewer->hasPreview($object)) {
header('Content-Type: image/svg+xml');
readfile('../views/'.$theme.'/images/empty.svg');
exit;
}
header('Content-Type: image/png');
$previewer->getPreview($object);
}
break;
} }
return true; if (!is_object($content)) {
} $this->errormsg = 'invalid_version';
return false;
}
/* set params['content'] for compatiblity with older extensions which
* expect the content in the controller
*/
$this->params['content'] = $content;
if(null === $this->callHook('version')) {
if($width)
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $width, $settings->_cmdTimeout);
else
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
if($conversionmgr)
$previewer->setConversionMgr($conversionmgr);
else
$previewer->setConverters($settings->_converters['preview']);
$previewer->setXsendfile($settings->_enableXsendfile);
if(!$previewer->hasPreview($content)) {
add_log_line("");
if(!$previewer->createPreview($content)) {
add_log_line("", PEAR_LOG_ERR);
}
}
if(!$previewer->hasPreview($content)) {
return false;
}
header('Content-Type: image/png');
$previewer->getPreview($content);
return true;
}
} /* }}} */
public function file() {
$dms = $this->params['dms'];
$settings = $this->params['settings'];
$conversionmgr = $this->params['conversionmgr'];
$object = $this->params['object'];
$document = $this->params['document'];
$width = $this->params['width'];
if (!is_object($object)) {
$this->errormsg = 'invalid_version';
return false;
}
if(null === $this->callHook('file')) {
if($width)
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $width, $settings->_cmdTimeout);
else
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
if($conversionmgr)
$previewer->setConversionMgr($conversionmgr);
else
$previewer->setConverters($settings->_converters['preview']);
$previewer->setXsendfile($settings->_enableXsendfile);
if(!$previewer->hasPreview($object)) {
add_log_line("");
if(!$previewer->createPreview($object)) {
add_log_line("", PEAR_LOG_ERR);
}
}
if(!$previewer->hasPreview($object)) {
return false;
}
header('Content-Type: image/png');
$previewer->getPreview($object);
return true;
}
} /* }}} */
} }

View File

@ -30,7 +30,7 @@ class Controller {
* @return object an object of a class implementing the view * @return object an object of a class implementing the view
*/ */
static function factory($class, $params=array()) { /* {{{ */ static function factory($class, $params=array()) { /* {{{ */
global $settings, $session, $extMgr; global $settings, $session, $extMgr, $request;
if(!$class) { if(!$class) {
return null; return null;
} }
@ -57,6 +57,7 @@ class Controller {
$controller->setParam('getVars', $_GET); $controller->setParam('getVars', $_GET);
$controller->setParam('requestVars', $_REQUEST); $controller->setParam('requestVars', $_REQUEST);
$controller->setParam('session', $session); $controller->setParam('session', $session);
$controller->setParam('request', $request);
$controller->setParam('settings', $settings); $controller->setParam('settings', $settings);
return $controller; return $controller;
} }

View File

@ -41,38 +41,56 @@ class SeedDMS_Controller_Common {
*/ */
protected $lasthookresult; protected $lasthookresult;
function __construct($params) { public function __construct($params) {
$this->params = $params; $this->params = $params;
$this->error = 0; $this->error = 0;
$this->errormsg = ''; $this->errormsg = '';
} }
/** /**
* Call methods with name in $get['action'] * Call method with name in $get['action']
* *
* @params array $get $_GET or $_POST variables * Until 5.1.26 (6.0.19) this method took the name of the
* controller method to run from the element 'action' passed
* in the array $get. Since 5.1.27 (6.0.20) a PSR7 Request
* object is available in the controller and used to get the
* action.
*
* @params array $get $_GET or $_POST variables (since 5.1.27 this is no longer used)
* @return mixed return value of called method * @return mixed return value of called method
*/ */
function __invoke($get=array()) { public function __invoke($get=array()) {
if(!$this->callHook('preRun', get_class($this), isset($get['action']) ? $get['action'] : 'run', $get)) { $action = null;
if(isset($get['action']) && $get['action']) { if(!$action = $this->getParam('action')) {
if(method_exists($this, $get['action'])) { $request = $this->getParam('request');
return $this->{$get['action']}(); if($request) {
if($request->isMethod('get'))
$action = $request->query->get('action');
elseif($request->isMethod('post'))
$action = $request->request->get('action');
}
}
if(!$this->callHook('preRun', get_class($this), $action ? $action : 'run')) {
if($action) {
if(method_exists($this, $action)) {
return $this->{$action}();
} else { } else {
echo "Missing action '".$get['action']."'"; echo "Missing action '".$action."'";
return false; return false;
} }
} else } else
return $this->run(); return $this->run();
} else {
return false;
} }
$this->callHook('postRun', get_class($this), isset($get['action']) ? $get['action'] : 'run', $get); $this->callHook('postRun', get_class($this), $action ? $action : 'run');
} }
function setParams($params) { public function setParams($params) {
$this->params = $params; $this->params = $params;
} }
function setParam($name, $value) { public function setParam($name, $value) {
$this->params[$name] = $value; $this->params[$name] = $value;
} }
@ -86,7 +104,7 @@ class SeedDMS_Controller_Common {
* @param string $name name of parameter * @param string $name name of parameter
* @return mixed value of parameter or null if parameter does not exist * @return mixed value of parameter or null if parameter does not exist
*/ */
function getParam($name) { public function getParam($name) {
return isset($this->params[$name]) ? $this->params[$name] : null; return isset($this->params[$name]) ? $this->params[$name] : null;
} }
@ -96,7 +114,7 @@ class SeedDMS_Controller_Common {
* @param string $name name of parameter * @param string $name name of parameter
* @return boolean true if parameter exists otherwise false * @return boolean true if parameter exists otherwise false
*/ */
function hasParam($name) { public function hasParam($name) {
return isset($this->params[$name]) ? true : false; return isset($this->params[$name]) ? true : false;
} }
@ -105,12 +123,12 @@ class SeedDMS_Controller_Common {
* *
* @param string $name name of parameter * @param string $name name of parameter
*/ */
function unsetParam($name) { public function unsetParam($name) {
if(isset($this->params[$name])) if(isset($this->params[$name]))
unset($this->params[$name]); unset($this->params[$name]);
} }
function run() { public function run() {
} }
/** /**

View File

@ -46,7 +46,7 @@ class UI extends UI_Default {
* @return object an object of a class implementing the view * @return object an object of a class implementing the view
*/ */
static function factory($theme, $class='', $params=array()) { /* {{{ */ static function factory($theme, $class='', $params=array()) { /* {{{ */
global $settings, $dms, $user, $session, $extMgr; global $settings, $dms, $user, $session, $extMgr, $request;
if(!$class) { if(!$class) {
$class = 'Bootstrap'; $class = 'Bootstrap';
$class = 'Style'; $class = 'Style';
@ -128,6 +128,7 @@ class UI extends UI_Default {
$view->setParam('theme', $theme); $view->setParam('theme', $theme);
$view->setParam('class', $class); $view->setParam('class', $class);
$view->setParam('session', $session); $view->setParam('session', $session);
$view->setParam('request', $request);
// $view->setParam('settings', $settings); // $view->setParam('settings', $settings);
$view->setParam('sitename', $settings->_siteName); $view->setParam('sitename', $settings->_siteName);
$view->setParam('rootfolderid', $settings->_rootFolderID); $view->setParam('rootfolderid', $settings->_rootFolderID);

View File

@ -45,17 +45,40 @@ class SeedDMS_View_Common {
$this->imgpath = '../views/'.$theme.'/images/'; $this->imgpath = '../views/'.$theme.'/images/';
} }
/**
* Call method with name in $get['action']
*
* Until 5.1.26 (6.0.19) this method took the name of the
* controller method to run from the element 'action' passed
* in the array $get. Since 5.1.27 (6.0.20) a PSR7 Request
* object is available in the controller and used to get the
* action.
*
* @params array $get $_GET or $_POST variables (since 5.1.27 this is no longer used)
* @return mixed return value of called method
*/
public function __invoke($get=array()) { public function __invoke($get=array()) {
$this->callHook('preRun', isset($get['action']) ? $get['action'] : 'show'); $action = null;
if(isset($get['action']) && $get['action']) { $request = $this->getParam('request');
if(method_exists($this, $get['action'])) { if($request) {
$this->{$get['action']}(); if($request->isMethod('get'))
} else { $action = $request->query->get('action');
echo "Missing action '".htmlspecialchars($get['action'])."'"; elseif($request->isMethod('post'))
} $action = $request->request->get('action');
} else }
$this->show(); if(!$this->callHook('preRun', get_class($this), $action ? $action : 'show')) {
$this->callHook('postRun', isset($get['action']) ? $get['action'] : 'show'); if($action) {
if(method_exists($this, $action)) {
$this->{$action}();
} else {
echo "Missing action '".htmlspecialchars($action)."'";
}
} else
$this->show();
} else {
return false;
}
$this->callHook('postRun', $action ? $action : 'show');
} }
public function setParams($params) { public function setParams($params) {
@ -78,7 +101,7 @@ class SeedDMS_View_Common {
* @param string $name name of parameter * @param string $name name of parameter
* @return boolean true if parameter exists otherwise false * @return boolean true if parameter exists otherwise false
*/ */
function hasParam($name) { public function hasParam($name) {
return isset($this->params[$name]) ? true : false; return isset($this->params[$name]) ? true : false;
} }

View File

@ -18,8 +18,11 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
use Symfony\Component\HttpFoundation\Request;
if(!empty($settings->_coreDir)) if(!empty($settings->_coreDir))
require_once($settings->_coreDir.'/Core.php'); require_once($settings->_coreDir.'/Core.php');
else else
require_once('SeedDMS/Core.php'); require_once('SeedDMS/Core.php');
$request = Request::createFromGlobals();

View File

@ -315,7 +315,7 @@ function reArrayFiles(&$file_post) {
return $file_ary; return $file_ary;
} }
if ($_FILES['userfile']) { if(!empty($_FILES['userfile'])) {
$file_ary = reArrayFiles($_FILES['userfile']); $file_ary = reArrayFiles($_FILES['userfile']);
} else { } else {
$file_ary = array(); $file_ary = array();
@ -479,7 +479,7 @@ foreach($file_ary as $file) {
$controller->setParam('maxsizeforfulltext', $settings->_maxSizeForFullText); $controller->setParam('maxsizeforfulltext', $settings->_maxSizeForFullText);
$controller->setParam('defaultaccessdocs', $settings->_defaultAccessDocs); $controller->setParam('defaultaccessdocs', $settings->_defaultAccessDocs);
if(!$document = $controller->run()) { if(!$document = $controller()) {
$err = $controller->getErrorMsg(); $err = $controller->getErrorMsg();
if(is_string($err)) if(is_string($err))
$errmsg = getMLText($err); $errmsg = getMLText($err);

View File

@ -116,7 +116,7 @@ $controller->setParam('sequence', $sequence);
$controller->setParam('attributes', $attributes); $controller->setParam('attributes', $attributes);
$controller->setParam('notificationgroups', $notgroups); $controller->setParam('notificationgroups', $notgroups);
$controller->setParam('notificationusers', $notusers); $controller->setParam('notificationusers', $notusers);
if(!$subFolder = $controller->run()) { if(!$subFolder = $controller()) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText($controller->getErrorMsg())); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText($controller->getErrorMsg()));
} else { } else {
// Send notification to subscribers. // Send notification to subscribers.

View File

@ -558,7 +558,7 @@ switch($command) {
$controller = Controller::factory('RemoveDocument', array('dms'=>$dms, 'user'=>$user)); $controller = Controller::factory('RemoveDocument', array('dms'=>$dms, 'user'=>$user));
$controller->setParam('document', $document); $controller->setParam('document', $document);
$controller->setParam('fulltextservice', $fulltextservice); $controller->setParam('fulltextservice', $fulltextservice);
if($controller->run()) { if($controller()) {
if ($notifier){ if ($notifier){
/* $document still has the data from the just deleted document, /* $document still has the data from the just deleted document,
* which is just enough to send the email. * which is just enough to send the email.
@ -840,7 +840,7 @@ switch($command) {
$controller->setParam('maxsizeforfulltext', $settings->_maxSizeForFullText); $controller->setParam('maxsizeforfulltext', $settings->_maxSizeForFullText);
$controller->setParam('defaultaccessdocs', $settings->_defaultAccessDocs); $controller->setParam('defaultaccessdocs', $settings->_defaultAccessDocs);
if(!$document = $controller->run()) { if(!$document = $controller()) {
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode(array('success'=>false, 'message'=>getMLText($controller->getErrorMsg()))); echo json_encode(array('success'=>false, 'message'=>getMLText($controller->getErrorMsg())));
exit; exit;

View File

@ -84,7 +84,7 @@ if ($action == "addattrdef") {
$controller->setParam('maxvalues', $maxvalues); $controller->setParam('maxvalues', $maxvalues);
$controller->setParam('valueset', $valueset); $controller->setParam('valueset', $valueset);
$controller->setParam('regex', $regex); $controller->setParam('regex', $regex);
if (!($newAttrdef = $controller($_POST))) { if (!($newAttrdef = $controller())) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
} }

View File

@ -43,7 +43,7 @@ if(!is_dir($settings->_cacheDir)) {
} }
$controller->setParam('post', $_POST); $controller->setParam('post', $_POST);
if(!$controller->run()) if(!$controller())
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_cleared_cache'))); $session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_cleared_cache')));
else else
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_cleared_cache'))); $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_cleared_cache')));

View File

@ -138,7 +138,7 @@ $controller->setParam('mode', $mode);
$controller->setParam('userid', $userid); $controller->setParam('userid', $userid);
$controller->setParam('groupid', $groupid); $controller->setParam('groupid', $groupid);
$controller->setParam('newowner', $newowner); $controller->setParam('newowner', $newowner);
if(!$controller->run()) { if(!$controller()) {
UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($foldername))),getMLText("error_change_access")); UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($foldername))),getMLText("error_change_access"));
} }

View File

@ -66,7 +66,7 @@ if (isset($_GET["version"])) { /* {{{ */
$controller->setParam('document', $document); $controller->setParam('document', $document);
$controller->setParam('version', $version); $controller->setParam('version', $version);
$controller->setParam('type', 'version'); $controller->setParam('type', 'version');
if(!$controller->run()) { if(!$controller()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
} }
} /* }}} */ } /* }}} */

View File

@ -82,7 +82,7 @@ if($attributes) {
$attribute = date('Y-m-d', makeTsFromDate($attribute)); $attribute = date('Y-m-d', makeTsFromDate($attribute));
break; break;
} }
if(!$attrdef->validate($attribute, $version, true)) { if(!$attrdef->validate($attribute, $version, false)) {
$errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute); $errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
} }

View File

@ -140,7 +140,7 @@ $controller->setParam('categories', $categories);
$controller->setParam('expires', $expires); $controller->setParam('expires', $expires);
$controller->setParam('sequence', $sequence); $controller->setParam('sequence', $sequence);
$controller->setParam('attributes', $attributes); $controller->setParam('attributes', $attributes);
if(!$controller->run()) { if(!$controller()) {
$err = $controller->getErrorMsg(); $err = $controller->getErrorMsg();
if(is_string($err)) if(is_string($err))
$errmsg = getMLText($err); $errmsg = getMLText($err);

View File

@ -73,7 +73,7 @@ $controller->setParam('name', isset($_POST['name']) ? $_POST['name'] : '');
$controller->setParam('comment', isset($_POST['comment']) ? $_POST['comment'] : ''); $controller->setParam('comment', isset($_POST['comment']) ? $_POST['comment'] : '');
$controller->setParam('version', isset($_POST['version']) ? $_POST['version'] : ''); $controller->setParam('version', isset($_POST['version']) ? $_POST['version'] : '');
$controller->setParam('public', isset($_POST['public']) ? $_POST['public'] : ''); $controller->setParam('public', isset($_POST['public']) ? $_POST['public'] : '');
if(!$controller->run()) { if(!$controller()) {
if($controller->getErrorMsg()) { if($controller->getErrorMsg()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $controller->getErrorMsg()); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $controller->getErrorMsg());
} }

View File

@ -89,7 +89,7 @@ $controller->setParam('name', $name);
$controller->setParam('comment', $comment); $controller->setParam('comment', $comment);
$controller->setParam('sequence', $sequence); $controller->setParam('sequence', $sequence);
$controller->setParam('attributes', $attributes); $controller->setParam('attributes', $attributes);
if(!$controller->run()) { if(!$controller()) {
$err = $controller->getErrorMsg(); $err = $controller->getErrorMsg();
if(is_string($err)) if(is_string($err))
$errmsg = getMLText($err); $errmsg = getMLText($err);

View File

@ -58,7 +58,7 @@ if ($action == "download") { /* {{{ */
// $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir); // $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$controller->setParam('extmgr', $extMgr); $controller->setParam('extmgr', $extMgr);
$controller->setParam('extname', $extname); $controller->setParam('extname', $extname);
if (!$controller($_POST)) { if (!$controller()) {
echo json_encode(array('success'=>false, 'msg'=>'Could not download extension')); echo json_encode(array('success'=>false, 'msg'=>'Could not download extension'));
} }
add_log_line(); add_log_line();
@ -67,7 +67,7 @@ elseif ($action == "refresh") { /* {{{ */
// $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir); // $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$extMgr->createExtensionConf(); $extMgr->createExtensionConf();
$controller->setParam('extmgr', $extMgr); $controller->setParam('extmgr', $extMgr);
if (!$controller($_POST)) { if (!$controller()) {
UI::exitError(getMLText("admin_tools"),$extMgr->getErrorMsg()); UI::exitError(getMLText("admin_tools"),$extMgr->getErrorMsg());
} }
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_extension_refresh'))); $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_extension_refresh')));
@ -90,7 +90,7 @@ elseif ($action == "upload") { /* {{{ */
// $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir); // $extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$controller->setParam('extmgr', $extMgr); $controller->setParam('extmgr', $extMgr);
$controller->setParam('file', $_FILES['userfile']['tmp_name']); $controller->setParam('file', $_FILES['userfile']['tmp_name']);
if (!$controller($_POST)) { if (!$controller()) {
UI::exitError(getMLText("admin_tools"),$controller->getErrorMsg()); UI::exitError(getMLText("admin_tools"),$controller->getErrorMsg());
} }
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_extension_import'))); $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_extension_import')));
@ -116,7 +116,7 @@ elseif ($action == "import") { /* {{{ */
$controller->setParam('extmgr', $extMgr); $controller->setParam('extmgr', $extMgr);
$controller->setParam('file', $file); $controller->setParam('file', $file);
$_POST['action'] = 'upload'; $_POST['action'] = 'upload';
if (!$controller($_POST)) { if (!$controller()) {
unlink($file); unlink($file);
UI::exitError(getMLText("admin_tools"),getMLText("error_occured")); UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
} }
@ -130,7 +130,7 @@ elseif ($action == "getlist") { /* {{{ */
$controller->setParam('extmgr', $extMgr); $controller->setParam('extmgr', $extMgr);
$controller->setParam('forceupdate', (isset($_POST['forceupdate']) && $_POST['forceupdate']) ? true : false); $controller->setParam('forceupdate', (isset($_POST['forceupdate']) && $_POST['forceupdate']) ? true : false);
$controller->setParam('version', $v->version()); $controller->setParam('version', $v->version());
if (!$controller($_POST)) { if (!$controller()) {
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_extension_getlist').": ".$controller->getErrorMsg(), 'timeout'=>5000)); $session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_extension_getlist').": ".$controller->getErrorMsg(), 'timeout'=>5000));
} else { } else {
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_extension_getlist'))); $session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_extension_getlist')));
@ -148,7 +148,7 @@ elseif ($action == "toggle") { /* {{{ */
} }
$controller->setParam('extmgr', $extMgr); $controller->setParam('extmgr', $extMgr);
$controller->setParam('extname', $extname); $controller->setParam('extname', $extname);
if (!$controller($_POST)) { if (!$controller()) {
echo json_encode(array('success'=>false, 'msg'=>getMLText('extinsion_toggle_error'))); echo json_encode(array('success'=>false, 'msg'=>getMLText('extinsion_toggle_error')));
} else { } else {
if($settings->extensionIsDisabled($extname)) if($settings->extensionIsDisabled($extname))

View File

@ -88,7 +88,7 @@ $controller->setParam('lang', $lang);
$controller->setParam('sesstheme', $sesstheme); $controller->setParam('sesstheme', $sesstheme);
$controller->setParam('referuri', $referuri); $controller->setParam('referuri', $referuri);
$controller->setParam('session', $session); $controller->setParam('session', $session);
if(!$controller->run()) { if(!$controller()) {
$session = null; $session = null;
add_log_line("login failed", PEAR_LOG_ERR); add_log_line("login failed", PEAR_LOG_ERR);
_printMessage(getMLText($controller->getErrorMsg()), getMLText($controller->getErrorMsg())."\n"); _printMessage(getMLText($controller->getErrorMsg()), getMLText($controller->getErrorMsg())."\n");

View File

@ -53,7 +53,7 @@ if(isset($_COOKIE['mydms_session'])) {
$controller->setParam('user', $user); $controller->setParam('user', $user);
$controller->setParam('session', $session); $controller->setParam('session', $session);
$controller->run(); $controller();
} }
//Forward to Login-page //Forward to Login-page

View File

@ -60,7 +60,7 @@ if(isset($_GET['version'])) {
$controller->setParam('version', $version); $controller->setParam('version', $version);
$controller->setParam('type', 'version'); $controller->setParam('type', 'version');
$controller->setParam('conversionmgr', $conversionmgr); $controller->setParam('conversionmgr', $conversionmgr);
if(!$controller->run()) { if(!$controller()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
} }
exit; exit;

View File

@ -55,16 +55,16 @@ if ($document->getAccessMode($user) < M_READ) {
} }
$controller->setParam('conversionmgr', $conversionmgr); $controller->setParam('conversionmgr', $conversionmgr);
$controller->setParam('width', !empty($_GET["width"]) ? $_GET["width"] : null);
$controller->setParam('document', $document);
if(isset($_GET['version'])) { if(isset($_GET['version'])) {
$version = $_GET["version"]; $version = $_GET["version"];
if (!is_numeric($version)) if (!is_numeric($version))
exit; exit;
$controller->setParam('width', !empty($_GET["width"]) ? $_GET["width"] : null); $controller->setParam('action', 'version');
$controller->setParam('document', $document);
$controller->setParam('version', $version); $controller->setParam('version', $version);
$controller->setParam('type', 'version'); if(!$controller()) {
if(!$controller->run()) {
header('Content-Type: image/svg+xml'); header('Content-Type: image/svg+xml');
readfile('../views/'.$theme.'/images/empty.svg'); readfile('../views/'.$theme.'/images/empty.svg');
exit; exit;
@ -75,11 +75,9 @@ if(isset($_GET['version'])) {
if (!is_numeric($file) || intval($file)<1) if (!is_numeric($file) || intval($file)<1)
exit; exit;
$object = $document->getDocumentFile($file); $object = $document->getDocumentFile($file);
$controller->setParam('width', !empty($_GET["width"]) ? $_GET["width"] : null); $controller->setParam('action', 'file');
$controller->setParam('document', $document);
$controller->setParam('object', $object); $controller->setParam('object', $object);
$controller->setParam('type', 'file'); if(!$controller()) {
if(!$controller->run()) {
header('Content-Type: image/svg+xml'); header('Content-Type: image/svg+xml');
readfile('../views/'.$theme.'/images/empty.svg'); readfile('../views/'.$theme.'/images/empty.svg');
exit; exit;
@ -88,29 +86,3 @@ if(isset($_GET['version'])) {
} else { } else {
exit; exit;
} }
/* From here on old code which isn't used anymore
if (!is_object($object)) {
exit;
}
if(!empty($_GET["width"]))
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $_GET["width"]);
else
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
$previewer->setConverters($settings->_converters['preview']);
$previewer->setXsendfile($settings->_enableXsendfile);
if(!$previewer->hasPreview($object)) {
add_log_line("");
if(!$previewer->createPreview($object)) {
}
}
if(!$previewer->hasPreview($object)) {
header('Content-Type: image/svg+xml');
readfile('../views/'.$theme.'/images/empty.svg');
exit;
}
header('Content-Type: image/png');
$previewer->getPreview($object);
*/
?>

View File

@ -82,7 +82,7 @@ $docname = $document->getName();
$controller->setParam('document', $document); $controller->setParam('document', $document);
$controller->setParam('fulltextservice', $fulltextservice); $controller->setParam('fulltextservice', $fulltextservice);
if(!$controller($_POST)) { if(!$controller()) {
if ($controller->getErrorMsg() != '') if ($controller->getErrorMsg() != '')
$errormsg = $controller->getErrorMsg(); $errormsg = $controller->getErrorMsg();
else else

View File

@ -80,7 +80,7 @@ $nl = array(
$controller->setParam('folder', $folder); $controller->setParam('folder', $folder);
$controller->setParam('fulltextservice', $fulltextservice); $controller->setParam('fulltextservice', $fulltextservice);
if(!$controller->run()) { if(!$controller()) {
UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($foldername))),getMLText("error_remove_folder")); UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($foldername))),getMLText("error_remove_folder"));
} }

View File

@ -79,7 +79,7 @@ if (count($document->getContent())==1) {
$controller->setParam('document', $document); $controller->setParam('document', $document);
$controller->setParam('fulltextservice', $fulltextservice); $controller->setParam('fulltextservice', $fulltextservice);
if(!$controller->run()) { if(!$controller()) {
if ($controller->getErrorMsg() != '') if ($controller->getErrorMsg() != '')
$errormsg = $controller->getErrorMsg(); $errormsg = $controller->getErrorMsg();
else else

View File

@ -66,7 +66,7 @@ $oldowner = $document->getOwner();
$controller->setParam('document', $document); $controller->setParam('document', $document);
$controller->setParam('newuser', $newuser); $controller->setParam('newuser', $newuser);
if(!$controller->run()) { if(!$controller()) {
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("error_transfer_document")); UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("error_transfer_document"));
} }

View File

@ -349,7 +349,7 @@ default:
$attribute = date('Y-m-d', makeTsFromDate($attribute)); $attribute = date('Y-m-d', makeTsFromDate($attribute));
break; break;
} }
if(!$attrdef->validate($attribute)) { if(!$attrdef->validate($attribute, null, true)) {
$errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute); $errmsg = getAttributeValidationText($attrdef->getValidationError(), $attrdef->getName(), $attribute);
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())), $errmsg);
} }
@ -380,7 +380,7 @@ default:
$controller->setParam('workflow', $workflow); $controller->setParam('workflow', $workflow);
$controller->setParam('initialdocumentstatus', $settings->_initialDocumentStatus); $controller->setParam('initialdocumentstatus', $settings->_initialDocumentStatus);
if(!$content = $controller->run()) { if(!$content = $controller()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg())); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText($controller->getErrorMsg()));
} else { } else {
if($controller->hasHook('cleanUpDocument')) { if($controller->hasHook('cleanUpDocument')) {

View File

@ -43,7 +43,7 @@ $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user)); $controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
$controller->setParam('group', $group); $controller->setParam('group', $group);
if(!$controller->run()) { if(!$controller()) {
if ($controller->getErrorMsg() != '') if ($controller->getErrorMsg() != '')
$errormsg = $controller->getErrorMsg(); $errormsg = $controller->getErrorMsg();
else else

View File

@ -60,7 +60,7 @@ if(isset($_GET["version"])) { /* {{{ */
$controller->setParam('document', $document); $controller->setParam('document', $document);
$controller->setParam('version', intval($version)); $controller->setParam('version', intval($version));
$controller->setParam('type', 'version'); $controller->setParam('type', 'version');
if(!$controller->run()) { if(!$controller()) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version"));
} }
} /* }}} */ } /* }}} */

View File

@ -99,6 +99,7 @@ if($view) {
$view->setParam('offset', $offset); $view->setParam('offset', $offset);
$view->setParam('limit', $limit); $view->setParam('limit', $limit);
$view->setParam('onepage', $settings->_onePageMode); // do most navigation by reloading areas of pages with ajax $view->setParam('onepage', $settings->_onePageMode); // do most navigation by reloading areas of pages with ajax
$view->setParam('currenttab', 'folderinfo');
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -12,7 +12,7 @@ function usage() { /* {{{ */
echo " seeddms-indexer [-h] [-v] [-c] [--config <file>]".PHP_EOL; echo " seeddms-indexer [-h] [-v] [-c] [--config <file>]".PHP_EOL;
echo PHP_EOL; echo PHP_EOL;
echo "Description:".PHP_EOL; echo "Description:".PHP_EOL;
echo " This program recreates the full text index of SeedDMS.".PHP_EOL; echo " This program recreates or updates the full text index of SeedDMS.".PHP_EOL;
echo PHP_EOL; echo PHP_EOL;
echo "Options:".PHP_EOL; echo "Options:".PHP_EOL;
echo " -h, --help: print usage information and exit.".PHP_EOL; echo " -h, --help: print usage information and exit.".PHP_EOL;
@ -42,6 +42,10 @@ if(isset($options['v']) || isset($options['verѕion'])) {
exit(0); exit(0);
} }
$config['log'] = true;
$config['verbosity'] = 3;
$config['stats'] = true;
/* Set alternative config file */ /* Set alternative config file */
if(isset($options['config'])) { if(isset($options['config'])) {
define('SEEDDMS_CONFIG_FILE', $options['config']); define('SEEDDMS_CONFIG_FILE', $options['config']);
@ -56,20 +60,21 @@ if(isset($options['c'])) {
} }
include($myincpath."/inc/inc.Settings.php"); include($myincpath."/inc/inc.Settings.php");
if(empty($options['no-log'])) if(empty($options['no-log'])) {
$config['log'] = false;
include($myincpath."/inc/inc.LogInit.php"); include($myincpath."/inc/inc.LogInit.php");
}
include($myincpath."/inc/inc.Init.php"); include($myincpath."/inc/inc.Init.php");
include($myincpath."/inc/inc.Extension.php"); include($myincpath."/inc/inc.Extension.php");
include($myincpath."/inc/inc.DBInit.php"); include($myincpath."/inc/inc.DBInit.php");
function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
global $settings, $themes; global $settings, $themes, $config, $stats;
$index = $fulltextservice->Indexer(); $index = $fulltextservice->Indexer();
$lucenesearch = $fulltextservice->Search(); $lucenesearch = $fulltextservice->Search();
// echo $themes->black($indent."D ".$folder->getName()).PHP_EOL; $prefix = $themes->black(($config['verbosity'] >= 3 ? $indent : '')."D ".$folder->getId().":".$folder->getName()." ");
echo $themes->black($indent."D ".$folder->getId().":".$folder->getName()." ");
if(($numdocs == 0) || !($hit = $lucenesearch->getFolder($folder->getId()))) { if(($numdocs == 0) || !($hit = $lucenesearch->getFolder($folder->getId()))) {
try { try {
$idoc = $fulltextservice->IndexedDocument($folder, true); $idoc = $fulltextservice->IndexedDocument($folder, true);
@ -81,9 +86,10 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
} }
} }
$index->addDocument($idoc); $index->addDocument($idoc);
echo $themes->green(" (Folder added)").PHP_EOL; echo $prefix.$themes->green(" (Folder added)").PHP_EOL;
$stats['folder']['add']++;
} catch(Exception $e) { } catch(Exception $e) {
echo $themes->error(" (Timeout)").PHP_EOL; echo $prefix.$themes->error(" (Timeout)").PHP_EOL;
} }
} else { } else {
try { try {
@ -92,7 +98,9 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
$created = 0; $created = 0;
} }
if($created >= $folder->getDate()) { if($created >= $folder->getDate()) {
echo $themes->italic(" (Folder unchanged)").PHP_EOL; if($config['verbosity'] >= 3)
echo $prefix.$themes->italic(" (Folder unchanged)").PHP_EOL;
$stats['folder']['unchanged']++;
} else { } else {
$index->delete($hit->id); $index->delete($hit->id);
try { try {
@ -105,9 +113,10 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
} }
} }
$index->addDocument($idoc); $index->addDocument($idoc);
echo $themes->green(" (Folder updated)").PHP_EOL; echo $prefix.$themes->green(" (Folder updated)").PHP_EOL;
$stats['folder']['update']++;
} catch(Exception $e) { } catch(Exception $e) {
echo $themes->error(" (Timeout)").PHP_EOL; echo $prefix.$themes->error(" (Timeout)").PHP_EOL;
} }
} }
} }
@ -119,7 +128,7 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
$documents = $folder->getDocuments(); $documents = $folder->getDocuments();
foreach($documents as $document) { foreach($documents as $document) {
echo $themes->black($indent." ".$document->getId().":".$document->getName()." "); $prefix = $themes->black(($config['verbosity'] >= 3 ? $indent : '')." ".$document->getId().":".$document->getName()." ");
if(($numdocs == 0) || !($hit = $lucenesearch->getDocument($document->getId()))) { if(($numdocs == 0) || !($hit = $lucenesearch->getDocument($document->getId()))) {
try { try {
$idoc = $fulltextservice->IndexedDocument($document, true); $idoc = $fulltextservice->IndexedDocument($document, true);
@ -131,9 +140,10 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
} }
} }
$index->addDocument($idoc); $index->addDocument($idoc);
echo $themes->green(" (Document added)").PHP_EOL; echo $prefix.$themes->green(" (Document added)").PHP_EOL;
$stats['document']['add']++;
} catch(Exception $e) { } catch(Exception $e) {
echo $themes->error(" (Timeout)").PHP_EOL; echo $prefix.$themes->error(" (Timeout)").PHP_EOL;
} }
} else { } else {
try { try {
@ -143,7 +153,9 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
} }
$content = $document->getLatestContent(); $content = $document->getLatestContent();
if($created >= $content->getDate()) { if($created >= $content->getDate()) {
echo $themes->italic(" (Document unchanged)").PHP_EOL; if($config['verbosity'] >= 3)
echo $prefix.$themes->italic(" (Document unchanged)").PHP_EOL;
$stats['document']['unchanged']++;
} else { } else {
$index->delete($hit->id); $index->delete($hit->id);
try { try {
@ -156,9 +168,10 @@ function tree($dms, $fulltextservice, $folder, $indent='', $numdocs) { /* {{{ */
} }
} }
$index->addDocument($idoc); $index->addDocument($idoc);
echo $themes->green(" (Document updated)").PHP_EOL; echo $prefix.$themes->green(" (Document updated)").PHP_EOL;
$stats['document']['update']++;
} catch(Exception $e) { } catch(Exception $e) {
echo $themes->error(" (Timeout)").PHP_EOL; echo $prefix.$themes->error(" (Timeout)").PHP_EOL;
} }
} }
} }
@ -173,6 +186,12 @@ if(!$index) {
exit(1); exit(1);
} }
$stats['folder']['add'] = 0;
$stats['folder']['unchanged'] = 0;
$stats['folder']['update'] = 0;
$stats['document']['add'] = 0;
$stats['document']['unchanged'] = 0;
$stats['document']['update'] = 0;
$numdocs = $fulltextservice->Indexer()->count(); $numdocs = $fulltextservice->Indexer()->count();
$folder = $dms->getFolder($settings->_rootFolderID); $folder = $dms->getFolder($settings->_rootFolderID);
/* if numdocs is 0, then there is no need to check if a document/folder is already /* if numdocs is 0, then there is no need to check if a document/folder is already
@ -182,3 +201,13 @@ tree($dms, $fulltextservice, $folder,'', $numdocs);
$index->commit(); $index->commit();
$index->optimize(); $index->optimize();
echo PHP_EOL;
echo $themes->black("Documents").PHP_EOL;
echo $themes->black(" added: ".$stats['document']['add']).PHP_EOL;
echo $themes->black(" updated: ".$stats['document']['update']).PHP_EOL;
echo $themes->black(" unchanged: ".$stats['document']['unchanged']).PHP_EOL;
echo $themes->black("Folders").PHP_EOL;
echo $themes->black(" added: ".$stats['folder']['add']).PHP_EOL;
echo $themes->black(" updated: ".$stats['folder']['update']).PHP_EOL;
echo $themes->black(" unchanged: ".$stats['folder']['unchanged']).PHP_EOL;

View File

@ -31,7 +31,7 @@ class SeedDMS_Theme_Style extends SeedDMS_View_Common {
function __construct($params, $theme='bootstrap') { function __construct($params, $theme='bootstrap') {
parent::__construct($params, $theme); parent::__construct($params, $theme);
$this->extraheader = array('js'=>'', 'css'=>'', 'favicon'=>'', 'logo'=>''); $this->extraheader = array('js'=>'', 'css'=>'', 'favicon'=>'', 'logo'=>'', 'logolink'=>'');
$this->footerjs = array(); $this->footerjs = array();
$this->nonces = array(); $this->nonces = array();
} }
@ -151,7 +151,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
} /* }}} */ } /* }}} */
function htmlAddHeader($head, $type='js') { /* {{{ */ function htmlAddHeader($head, $type='js') { /* {{{ */
if($type == 'logo' || $type == 'favicon') if($type == 'logo' || $type == 'favicon' || $type == 'logolink')
$this->extraheader[$type] = $head; $this->extraheader[$type] = $head;
else else
$this->extraheader[$type] .= $head; $this->extraheader[$type] .= $head;
@ -294,8 +294,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo "<div class=\"navbar navbar-inverse navbar-fixed-top\">\n"; echo "<div class=\"navbar navbar-inverse navbar-fixed-top\">\n";
echo " <div class=\"navbar-inner\">\n"; echo " <div class=\"navbar-inner\">\n";
echo " <div class=\"container-fluid\">\n"; echo " <div class=\"container-fluid\">\n";
echo " <a href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=".(!empty($this->params['dms']) ? $this->params['dms']->getRootFolder()->getId() : '1')."\">".(!empty($this->extraheader['logo']) ? '<img id="navbar-logo" src="'.$this->extraheader['logo'].'"/>' : '<img id="navbar-logo" src="'.$this->params['settings']->_httpRoot.'views/bootstrap/images/seeddms-logo.svg"/>')."</a>"; echo " <a href=\"".(!empty($this->extraheader['logolink']) ? $this->extraheader['logolink'] : $this->params['settings']->_httpRoot."out/out.ViewFolder.php")."\">".(!empty($this->extraheader['logo']) ? '<img id="navbar-logo" src="'.$this->extraheader['logo'].'"/>' : '<img id="navbar-logo" src="'.$this->params['settings']->_httpRoot.'views/bootstrap/images/seeddms-logo.svg"/>')."</a>";
echo " <a class=\"brand\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</a>\n"; echo " <a class=\"brand\" href=\"".(!empty($this->extraheader['logolink']) ? $this->extraheader['logolink'] : $this->params['settings']->_httpRoot."out/out.ViewFolder.php")."\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</a>\n";
echo " </div>\n"; echo " </div>\n";
echo " </div>\n"; echo " </div>\n";
echo "</div>\n"; echo "</div>\n";
@ -385,8 +385,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo " <a class=\"btn btn-navbar\" href=\"".$this->params['settings']->_httpRoot."op/op.Logout.php\">\n"; echo " <a class=\"btn btn-navbar\" href=\"".$this->params['settings']->_httpRoot."op/op.Logout.php\">\n";
echo " <span class=\"fa fa-sign-out\"></span>\n"; echo " <span class=\"fa fa-sign-out\"></span>\n";
echo " </a>\n"; echo " </a>\n";
echo " <a href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=".$this->params['dms']->getRootFolder()->getId()."\">".(!empty($this->extraheader['logo']) ? '<img id="navbar-logo" src="'.$this->extraheader['logo'].'">' : '<img id="navbar-logo" src="'.$this->params['settings']->_httpRoot.'views/bootstrap/images/seeddms-logo.svg">')."</a>"; echo " <a href=\"".(!empty($this->extraheader['logolink']) ? $this->extraheader['logolink'] : $this->params['settings']->_httpRoot."out/out.ViewFolder.php")."\">".(!empty($this->extraheader['logo']) ? '<img id="navbar-logo" src="'.$this->extraheader['logo'].'">' : '<img id="navbar-logo" src="'.$this->params['settings']->_httpRoot.'views/bootstrap/images/seeddms-logo.svg">')."</a>";
echo " <a class=\"brand\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=".$this->params['dms']->getRootFolder()->getId()."\"><span class=\"hidden-phone\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</span></a>\n"; echo " <a class=\"brand\" href=\"".(!empty($this->extraheader['logolink']) ? $this->extraheader['logolink'] : $this->params['settings']->_httpRoot."out/out.ViewFolder.php")."\"><span class=\"hidden-phone\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</span></a>\n";
/* user profile menu {{{ */ /* user profile menu {{{ */
if(isset($this->params['session']) && isset($this->params['user']) && $this->params['user']) { if(isset($this->params['session']) && isset($this->params['user']) && $this->params['user']) {
@ -2551,7 +2551,7 @@ $(function() {
function printDeleteDocumentButton($document, $msg, $return=false){ /* {{{ */ function printDeleteDocumentButton($document, $msg, $return=false){ /* {{{ */
$docid = $document->getID(); $docid = $document->getID();
$content = ''; $content = '';
$content .= '<a class="delete-document-btn" rel="'.$docid.'" msg="'.getMLText($msg).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_document", array ("documentname" => $document->getName())), ENT_QUOTES).'"><i class="fa fa-remove"></i></a>'; $content .= '<a class="delete-document-btn" rel="'.$docid.'" msg="'.getMLText($msg).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_document", array ("documentname" => $document->getName())), ENT_QUOTES).'" title="'.getMLText("delete").'"><i class="fa fa-remove"></i></a>';
if($return) if($return)
return $content; return $content;
else else
@ -2625,7 +2625,7 @@ $(function() {
function printDeleteFolderButton($folder, $msg, $return=false){ /* {{{ */ function printDeleteFolderButton($folder, $msg, $return=false){ /* {{{ */
$folderid = $folder->getID(); $folderid = $folder->getID();
$content = ''; $content = '';
$content .= '<a class="delete-folder-btn" rel="'.$folderid.'" msg="'.getMLText($msg).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_folder", array ("foldername" => $folder->getName())), ENT_QUOTES).'"><i class="fa fa-remove"></i></a>'; $content .= '<a class="delete-folder-btn" rel="'.$folderid.'" msg="'.getMLText($msg).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_folder", array ("foldername" => $folder->getName())), ENT_QUOTES).'" title="'.getMLText("delete").'"><i class="fa fa-remove"></i></a>';
if($return) if($return)
return $content; return $content;
else else

View File

@ -333,7 +333,8 @@ $('body').on('click', '.order-btn', function(ev) {
} }
echo "</table>\n"; echo "</table>\n";
$infos = ob_get_clean(); $infos = ob_get_clean();
$this->printAccordion2(getMLText("folder_infos"), $infos); echo $infos;
// $this->printAccordion2(getMLText("folder_infos"), $infos);
$txt = $this->callHook('postFolderInfos', $folder); $txt = $this->callHook('postFolderInfos', $folder);
if(is_string($txt)) if(is_string($txt))
echo $txt; echo $txt;
@ -575,6 +576,7 @@ $('body').on('click', '.order-btn', function(ev) {
$previewconverters = $this->params['previewConverters']; $previewconverters = $this->params['previewConverters'];
$timeout = $this->params['timeout']; $timeout = $this->params['timeout'];
$xsendfile = $this->params['xsendfile']; $xsendfile = $this->params['xsendfile'];
$currenttab = $this->params['currenttab'];
$folderid = $folder->getId(); $folderid = $folder->getId();
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile); $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -634,15 +636,36 @@ $('body').on('click', '.order-btn', function(ev) {
$this->rowStart(); $this->rowStart();
$this->columnStart(8); $this->columnStart(8);
} }
// $this->folderInfos();
?> ?>
<ul class="nav nav-pills" id="folderinfotab" role="tablist">
<li class="nav-item <?php if(!$currenttab || $currenttab == 'folderinfo') echo 'active'; ?>"><a class="nav-link <?php if(!$currenttab || $currenttab == 'folderinfo') echo 'active'; ?>" data-target="#folderinfo" data-toggle="tab" role="button"><?php printMLText('folder_infos'); ?></a></li>
<?php
$tabs = $this->callHook('extraTabs', $folder);
if($tabs) {
foreach($tabs as $tabid=>$tab) {
echo '<li class="nav-item '.($currenttab == $tabid ? 'active' : '').'"><a class="nav-link '.($currenttab == $tabid ? 'active' : '').'" data-target="#'.$tabid.'" data-toggle="tab" role="button">'.$tab['title'].'</a></li>';
}
}
?>
</ul>
<div class="tab-content">
<div class="tab-pane <?php if(!$currenttab || $currenttab == 'folderinfo') echo 'active'; ?>" id="folderinfo" role="tabpanel">
<div class="ajax" data-view="ViewFolder" data-action="folderInfos" data-no-spinner="true" <?php echo ($folder ? "data-query=\"folderid=".$folder->getID()."\"" : "") ?>></div> <div class="ajax" data-view="ViewFolder" data-action="folderInfos" data-no-spinner="true" <?php echo ($folder ? "data-query=\"folderid=".$folder->getID()."\"" : "") ?>></div>
</div>
<?php
if($tabs) {
foreach($tabs as $tabid=>$tab) {
echo '<div class="tab-pane '.($currenttab == $tabid ? 'active' : '').'" id="'.$tabid.'" role="tabpanel">';
echo $tab['content'];
echo "</div>\n";
}
}
?>
</div>
<?php <?php
if ($enableDropUpload/* && $folder->getAccessMode($user) >= M_READWRITE*/) { if ($enableDropUpload/* && $folder->getAccessMode($user) >= M_READWRITE*/) {
$this->columnEnd(); $this->columnEnd();
$this->columnStart(4); $this->columnStart(4);
// $this->dropUpload();
?> ?>
<div class="ajax" data-view="ViewFolder" data-action="dropUpload" data-no-spinner="true" <?php echo ($folder ? "data-query=\"folderid=".$folder->getID()."\"" : "") ?>></div> <div class="ajax" data-view="ViewFolder" data-action="dropUpload" data-no-spinner="true" <?php echo ($folder ? "data-query=\"folderid=".$folder->getID()."\"" : "") ?>></div>
<?php <?php

View File

@ -822,6 +822,15 @@ function onAddClipboard(ev) { /* {{{ */
target_type = droptarget.split("_")[0]; target_type = droptarget.split("_")[0];
target_id = droptarget.split("_")[1]; target_id = droptarget.split("_")[1];
} }
var afterupload = obj.data('afterupload');
if(afterupload) {
afteruploadfunc = eval(afterupload);
} else {
afteruploadfunc = function() {
if(target_id == seeddms_folder)
$("div.ajax[data-action='folderList']").trigger('update', {folderid: seeddms_folder});
}
}
if(target_type == 'folder' && target_id) { if(target_type == 'folder' && target_id) {
for (var i = 0; i < files.length; i++) { for (var i = 0; i < files.length; i++) {
if(files[i].size <= maxFileSize) { if(files[i].size <= maxFileSize) {
@ -844,10 +853,7 @@ function onAddClipboard(ev) { /* {{{ */
statusbar.parent().show(); statusbar.parent().show();
var status = new SeedDMSUpload.createStatusbar(statusbar); var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size); status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status,function(){ SeedDMSUpload.sendFileToServer(fd,status,afteruploadfunc);
if(target_id == seeddms_folder)
$("div.ajax[data-action='folderList']").trigger('update', {folderid: seeddms_folder});
});
} else { } else {
noty({ noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>', text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',

View File

@ -31,7 +31,7 @@ class SeedDMS_Theme_Style extends SeedDMS_View_Common {
function __construct($params, $theme='bootstrap') { function __construct($params, $theme='bootstrap') {
parent::__construct($params, $theme); parent::__construct($params, $theme);
$this->extraheader = array('js'=>'', 'css'=>'', 'favicon'=>'', 'logo'=>''); $this->extraheader = array('js'=>'', 'css'=>'', 'favicon'=>'', 'logo'=>'', 'logolink'=>'');
$this->footerjs = array(); $this->footerjs = array();
$this->nonces = array(); $this->nonces = array();
} }
@ -151,7 +151,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
} /* }}} */ } /* }}} */
function htmlAddHeader($head, $type='js') { /* {{{ */ function htmlAddHeader($head, $type='js') { /* {{{ */
if($type == 'logo' || $type == 'favicon') if($type == 'logo' || $type == 'favicon' || $type == 'logolink')
$this->extraheader[$type] = $head; $this->extraheader[$type] = $head;
else else
$this->extraheader[$type] .= $head; $this->extraheader[$type] .= $head;
@ -306,7 +306,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
function globalBanner() { /* {{{ */ function globalBanner() { /* {{{ */
echo "<nav class=\"navbar navbar-expand-lg navbar-dark bg-dark fixed-top\">\n"; echo "<nav class=\"navbar navbar-expand-lg navbar-dark bg-dark fixed-top\">\n";
echo " <a class=\"navbar-brand\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php\">".(!empty($this->extraheader['logo']) ? '<img id="navbar-logo" src="'.$this->extraheader['logo'].'"/>' : '<img id="navbar-logo" src="'.$this->params['settings']->_httpRoot.'views/bootstrap4/images/seeddms-logo.svg"/>')." <span class=\"d-none d-md-inline-block ml-4\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</span></a>\n"; echo " <a class=\"navbar-brand\" href=\"".(!empty($this->extraheader['logolink']) ? $this->extraheader['logolink'] : $this->params['settings']->_httpRoot."out/out.ViewFolder.php")."\">".(!empty($this->extraheader['logo']) ? '<img id="navbar-logo" src="'.$this->extraheader['logo'].'"/>' : '<img id="navbar-logo" src="'.$this->params['settings']->_httpRoot.'views/bootstrap4/images/seeddms-logo.svg"/>')." <span class=\"d-none d-md-inline-block ml-4\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</span></a>\n";
echo "</nav>\n"; echo "</nav>\n";
} /* }}} */ } /* }}} */
@ -314,7 +314,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
$dms = $this->params['dms']; $dms = $this->params['dms'];
$accessobject = $this->params['accessobject']; $accessobject = $this->params['accessobject'];
echo "<nav class=\"navbar navbar-expand-lg navbar-dark bg-dark border-bottom fixed-top\">\n"; echo "<nav class=\"navbar navbar-expand-lg navbar-dark bg-dark border-bottom fixed-top\">\n";
echo " <a class=\"navbar-brand\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=".$this->params['dms']->getRootFolder()->getId()."\">".(!empty($this->extraheader['logo']) ? '<img id="navbar-logo" src="'.$this->extraheader['logo'].'">' : '<img id="navbar-logo" src="'.$this->params['settings']->_httpRoot.'views/bootstrap4/images/seeddms-logo.svg">')." <span class=\"d-none d-md-inline-block ml-4\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</span></a>\n"; echo " <a class=\"navbar-brand\" href=\"".(!empty($this->extraheader['logolink']) ? $this->extraheader['logolink'] : $this->params['settings']->_httpRoot."out/out.ViewFolder.php")."\">".(!empty($this->extraheader['logo']) ? '<img id="navbar-logo" src="'.$this->extraheader['logo'].'">' : '<img id="navbar-logo" src="'.$this->params['settings']->_httpRoot.'views/bootstrap4/images/seeddms-logo.svg">')." <span class=\"d-none d-md-inline-block ml-4\">".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS")."</span></a>\n";
if(isset($this->params['user']) && $this->params['user']) { if(isset($this->params['user']) && $this->params['user']) {
/* search form {{{ */ /* search form {{{ */
@ -2520,7 +2520,7 @@ $(function() {
function printDeleteDocumentButton($document, $msg, $return=false){ /* {{{ */ function printDeleteDocumentButton($document, $msg, $return=false){ /* {{{ */
$docid = $document->getID(); $docid = $document->getID();
$content = ''; $content = '';
$content .= '<a class="delete-document-btn" rel="'.$docid.'" msg="'.getMLText($msg).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_document", array ("documentname" => $document->getName())), ENT_QUOTES).'"><i class="fa fa-remove"></i></a>'; $content .= '<a class="delete-document-btn" rel="'.$docid.'" msg="'.getMLText($msg).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_document", array ("documentname" => $document->getName())), ENT_QUOTES).'" title="'.getMLText("delete").'"><i class="fa fa-remove"></i></a>';
if($return) if($return)
return $content; return $content;
else else
@ -2600,7 +2600,7 @@ $(function() {
function printDeleteFolderButton($folder, $msg, $return=false){ /* {{{ */ function printDeleteFolderButton($folder, $msg, $return=false){ /* {{{ */
$folderid = $folder->getID(); $folderid = $folder->getID();
$content = ''; $content = '';
$content .= '<a class="delete-folder-btn" rel="'.$folderid.'" msg="'.getMLText($msg).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_folder", array ("foldername" => $folder->getName())), ENT_QUOTES).'"><i class="fa fa-remove"></i></a>'; $content .= '<a class="delete-folder-btn" rel="'.$folderid.'" msg="'.getMLText($msg).'" confirmmsg="'.htmlspecialchars(getMLText("confirm_rm_folder", array ("foldername" => $folder->getName())), ENT_QUOTES).'" title="'.getMLText("delete").'"><i class="fa fa-remove"></i></a>';
if($return) if($return)
return $content; return $content;
else else

View File

@ -853,6 +853,15 @@ function onAddClipboard(ev) { /* {{{ */
target_type = droptarget.split("_")[0]; target_type = droptarget.split("_")[0];
target_id = droptarget.split("_")[1]; target_id = droptarget.split("_")[1];
} }
var afterupload = obj.data('afterupload');
if(afterupload) {
afteruploadfunc = eval(afterupload);
} else {
afteruploadfunc = function() {
if(target_id == seeddms_folder)
$("div.ajax[data-action='folderList']").trigger('update', {folderid: seeddms_folder});
}
}
if(target_type == 'folder' && target_id) { if(target_type == 'folder' && target_id) {
for (var i = 0; i < files.length; i++) { for (var i = 0; i < files.length; i++) {
if(files[i].size <= maxFileSize) { if(files[i].size <= maxFileSize) {
@ -875,10 +884,7 @@ function onAddClipboard(ev) { /* {{{ */
statusbar.parent().show(); statusbar.parent().show();
var status = new SeedDMSUpload.createStatusbar(statusbar); var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size); status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status,function(){ SeedDMSUpload.sendFileToServer(fd,status,afteruploadfunc);
if(target_id == seeddms_folder)
$("div.ajax[data-action='folderList']").trigger('update', {folderid: seeddms_folder});
});
} else { } else {
noty({ noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>', text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',