mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-31 05:11:27 +00:00 
			
		
		
		
	Merge branch 'hooks' into develop
Conflicts: Makefile
This commit is contained in:
		
						commit
						6e6fb20244
					
				
							
								
								
									
										18
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								Makefile
									
									
									
									
									
								
							|  | @ -1,7 +1,12 @@ | |||
| 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 | ||||
| SRC=CHANGELOG inc conf utils index.php languages views op out controllers README.md README.Notification README.Ubuntu drop-tables-innodb.sql styles js TODO LICENSE Makefile webdav install | ||||
| #restapi webapp
 | ||||
| 
 | ||||
| EXTENSIONS := \
 | ||||
| 	dynamic_content.tar.gz\
 | ||||
| 	login_action.tar.gz\
 | ||||
| 	example.tar.gz | ||||
| 
 | ||||
| dist: | ||||
| 	mkdir -p tmp/seeddms-$(VERSION) | ||||
| 	cp -a $(SRC) tmp/seeddms-$(VERSION) | ||||
|  | @ -25,6 +30,17 @@ webapp: | |||
| 	(cd tmp; tar --exclude=.svn -czvf ../seeddms-webapp-$(VERSION).tar.gz seeddms-webapp-$(VERSION)) | ||||
| 	rm -rf tmp | ||||
| 
 | ||||
| dynamic_content.tar.gz: ext/dynamic_content | ||||
| 	tar czvf dynamic_content.tar.gz ext/dynamic_content | ||||
| 
 | ||||
| example.tar.gz: ext/example | ||||
| 	tar czvf example.tar.gz ext/example | ||||
| 
 | ||||
| login_action.tar.gz: ext/login_action | ||||
| 	tar czvf login_action.tar.gz ext/login_action | ||||
| 
 | ||||
| extensions: $(EXTENSIONS) | ||||
| 
 | ||||
| doc: | ||||
| 	phpdoc -d SeedDMS_Core --ignore 'getusers.php,getfoldertree.php,config.php,reverselookup.php' -t html | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										45
									
								
								controllers/class.Download.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								controllers/class.Download.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | |||
| <?php | ||||
| /** | ||||
|  * Implementation of Download controller | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @license    GPL 2 | ||||
|  * @version    @version@ | ||||
|  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  Copyright (C) 2010-2013 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * Class which does the busines logic for downloading a document | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  Copyright (C) 2010-2013 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| class SeedDMS_Controller_Download extends SeedDMS_Controller_Common { | ||||
| 
 | ||||
| 	public function run() { | ||||
| 		$dms = $this->params['dms']; | ||||
| 		$type = $this->params['type']; | ||||
| 		$content = $this->params['content']; | ||||
| 
 | ||||
| 		switch($type) { | ||||
| 			case "version": | ||||
| 
 | ||||
| 				if(!$this->callHook('version')) { | ||||
| 					header("Content-Transfer-Encoding: binary"); | ||||
| 					header("Content-Length: " . filesize($dms->contentDir . $content->getPath() )); | ||||
| 					header("Content-Disposition: attachment; filename=\"" . $content->getOriginalFileName() . "\""); | ||||
| 					header("Content-Type: " . $content->getMimeType()); | ||||
| 					header("Cache-Control: must-revalidate"); | ||||
| 
 | ||||
| 					readfile($dms->contentDir . $content->getPath()); | ||||
| 				} | ||||
| 				break; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										34
									
								
								controllers/class.Login.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								controllers/class.Login.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| <?php | ||||
| /** | ||||
|  * Implementation of Login controller | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @license    GPL 2 | ||||
|  * @version    @version@ | ||||
|  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  Copyright (C) 2010-2013 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * Class which does the busines logic when logging in | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  Copyright (C) 2010-2013 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| class SeedDMS_Controller_Login extends SeedDMS_Controller_Common { | ||||
| 
 | ||||
| 	public function run() { | ||||
| 		$dms = $this->params['dms']; | ||||
| 		$user = $this->params['user']; | ||||
| 		$settings = $this->params['settings']; | ||||
| 		$session = $this->params['session']; | ||||
| 
 | ||||
| 		if($this->callHook('postLogin')) { | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										48
									
								
								controllers/class.ViewOnline.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								controllers/class.ViewOnline.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,48 @@ | |||
| <?php | ||||
| /** | ||||
|  * Implementation of ViewOnline controller | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @license    GPL 2 | ||||
|  * @version    @version@ | ||||
|  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  Copyright (C) 2010-2013 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * Class which does the busines logic for downloading a document | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  Copyright (C) 2010-2013 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| class SeedDMS_Controller_ViewOnline extends SeedDMS_Controller_Common { | ||||
| 
 | ||||
| 	public function run() { | ||||
| 		$dms = $this->params['dms']; | ||||
| 		$type = $this->params['type']; | ||||
| 		$content = $this->params['content']; | ||||
| 		$document = $content->getDocument(); | ||||
| 
 | ||||
| 		switch($type) { | ||||
| 			case "version": | ||||
| 				if(!$this->callHook('version')) { | ||||
| 					if (isset($settings->_viewOnlineFileTypes) && is_array($settings->_viewOnlineFileTypes) && in_array(strtolower($content->getFileType()), $settings->_viewOnlineFileTypes)) { | ||||
| 						header("Content-Type: " . $content->getMimeType()); | ||||
| 					} | ||||
| 					header("Content-Disposition: filename=\"" . $document->getName().$content->getFileType()) . "\""; | ||||
| 					header("Content-Length: " . filesize($dms->contentDir . $content->getPath())); | ||||
| 					header("Expires: 0"); | ||||
| 					header("Cache-Control: no-cache, must-revalidate"); | ||||
| 					header("Pragma: no-cache"); | ||||
| 
 | ||||
| 					readfile($dms->contentDir . $content->getPath()); | ||||
| 				} | ||||
| 				break; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										115
									
								
								ext/example/class.example.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								ext/example/class.example.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,115 @@ | |||
| <?php | ||||
| /*************************************************************** | ||||
| *  Copyright notice | ||||
| * | ||||
| *  (c) 2013 Uwe Steinmann <uwe@steinmann.cx> | ||||
| *  All rights reserved | ||||
| * | ||||
| *  This script is part of the SeedDMS project. The SeedDMS project is | ||||
| *  free software; you can redistribute it and/or modify | ||||
| *  it under the terms of the GNU General Public License as published by | ||||
| *  the Free Software Foundation; either version 2 of the License, or | ||||
| *  (at your option) any later version. | ||||
| * | ||||
| *  The GNU General Public License can be found at | ||||
| *  http://www.gnu.org/copyleft/gpl.html. | ||||
| * | ||||
| *  This script is distributed in the hope that it will be useful, | ||||
| *  but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| *  GNU General Public License for more details. | ||||
| * | ||||
| *  This copyright notice MUST APPEAR in all copies of the script! | ||||
| ***************************************************************/ | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * Example extension | ||||
|  * | ||||
|  * @author  Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @package SeedDMS | ||||
|  * @subpackage  example | ||||
|  */ | ||||
| class SeedDMS_ExtExample extends SeedDMS_ExtBase { | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Initialization | ||||
| 	 * | ||||
| 	 * Use this method to do some initialization like setting up the hooks | ||||
| 	 * You have access to the following global variables: | ||||
| 	 * $GLOBALS['dms'] : object representing dms | ||||
| 	 * $GLOBALS['user'] : currently logged in user | ||||
| 	 * $GLOBALS['session'] : current session | ||||
| 	 * $GLOBALS['settings'] : current global configuration | ||||
| 	 * $GLOBALS['settings']['_extensions']['example'] : configuration of this extension | ||||
| 	 * $GLOBALS['LANG'] : the language array with translations for all languages | ||||
| 	 * $GLOBALS['SEEDDMS_HOOKS'] : all hooks added so far | ||||
| 	 */ | ||||
| 	function init() { /* {{{ */ | ||||
| 		$GLOBALS['SEEDDMS_HOOKS']['view']['addDocument'][] = new SeedDMS_ExtExample_AddDocument; | ||||
| 		$GLOBALS['SEEDDMS_HOOKS']['view']['viewFolder'][] = new SeedDMS_ExtExample_ViewFolder; | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	function main() { /* {{{ */ | ||||
| 	} /* }}} */ | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Class containing methods for hooks when a document is added | ||||
|  * | ||||
|  * @author  Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @package SeedDMS | ||||
|  * @subpackage  example | ||||
|  */ | ||||
| class SeedDMS_ExtExample_AddDocument { | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Hook before adding a new document | ||||
| 	 */ | ||||
| 	function preAddDocument($view) { /* {{{ */ | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Hook after successfully adding a new document | ||||
| 	 */ | ||||
| 	function postAddDocument($view) { /* {{{ */ | ||||
| 	} /* }}} */ | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Class containing methods for hooks when a folder view is ѕhown | ||||
|  * | ||||
|  * @author  Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @package SeedDMS | ||||
|  * @subpackage  example | ||||
|  */ | ||||
| class SeedDMS_ExtExample_ViewFolder { | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Hook when showing a folder | ||||
| 	 * | ||||
| 	 * The returned string will be output after the object menu and before | ||||
| 	 * the actual content on the page | ||||
| 	 * | ||||
| 	 * @param object $view the current view object | ||||
| 	 * @return string content to be output | ||||
| 	 */ | ||||
| 	function preContent($view) { /* {{{ */ | ||||
| 		return $view->infoMsg("Content created by viewFolder::preContent hook."); | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Hook when showing a folder | ||||
| 	 * | ||||
| 	 * The returned string will be output at the end of the content area | ||||
| 	 * | ||||
| 	 * @param object $view the current view object | ||||
| 	 * @return string content to be output | ||||
| 	 */ | ||||
| 	function postContent($view) { /* {{{ */ | ||||
| 		return $view->infoMsg("Content created by viewFolder::postContent hook"); | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
							
								
								
									
										32
									
								
								ext/example/conf.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								ext/example/conf.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| <?php | ||||
| $EXT_CONF['example'] = array( | ||||
| 	'title' => 'Example Extension', | ||||
| 	'description' => 'This sample extension demonstrate the use of various hooks', | ||||
| 	'disable' => false, | ||||
| 	'version' => '1.0.0', | ||||
| 	'releasedate' => '2013-05-03', | ||||
| 	'author' => array('name'=>'Uwe Steinmann', 'email'=>'uwe@steinmann.cx', 'company'=>'MMK GmbH'), | ||||
| 	'config' => array( | ||||
| 		'input_field' => array( | ||||
| 			'title'=>'Example input field', | ||||
| 			'type'=>'input', | ||||
| 			'size'=>20, | ||||
| 		), | ||||
| 		'checkbox' => array( | ||||
| 			'title'=>'Example check box', | ||||
| 			'type'=>'checkbox', | ||||
| 		), | ||||
| 	), | ||||
| 	'constraints' => array( | ||||
| 		'depends' => array('php' => '5.4.4-', 'seeddms' => '4.3.0-'), | ||||
| 	), | ||||
| 	'icon' => 'icon.png', | ||||
| 	'class' => array( | ||||
| 		'file' => 'class.example.php', | ||||
| 		'name' => 'SeedDMS_ExtExample' | ||||
| 	), | ||||
| 	'language' => array( | ||||
| 		'file' => 'lang.php', | ||||
| 	), | ||||
| ); | ||||
| ?>
 | ||||
							
								
								
									
										
											BIN
										
									
								
								ext/example/icon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								ext/example/icon.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 845 B | 
							
								
								
									
										56
									
								
								inc/inc.ClassController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								inc/inc.ClassController.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,56 @@ | |||
| <?php | ||||
| //    SeedDMS. Document Management System
 | ||||
| //    Copyright (C) 2013 Uwe Steinmann
 | ||||
| //
 | ||||
| //    This program is free software; you can redistribute it and/or modify
 | ||||
| //    it under the terms of the GNU General Public License as published by
 | ||||
| //    the Free Software Foundation; either version 2 of the License, or
 | ||||
| //    (at your option) any later version.
 | ||||
| //
 | ||||
| //    This program is distributed in the hope that it will be useful,
 | ||||
| //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | ||||
| //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | ||||
| //    GNU General Public License for more details.
 | ||||
| //
 | ||||
| //    You should have received a copy of the GNU General Public License
 | ||||
| //    along with this program; if not, write to the Free Software
 | ||||
| //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 | ||||
| 
 | ||||
| require_once('inc.ClassControllerCommon.php'); | ||||
| 
 | ||||
| class Controller { | ||||
| 	/** | ||||
| 	 * Create a controller from a class | ||||
| 	 * | ||||
| 	 * This method will check for a class file in the controller directory | ||||
| 	 * and returns an instance of it. | ||||
| 	 * | ||||
| 	 * @param string $class name of controller class | ||||
| 	 * @param array $params parameter passed to constructor of controller class | ||||
| 	 * @return object an object of a class implementing the view | ||||
| 	 */ | ||||
| 	static function factory($class, $params=array()) { /* {{{ */ | ||||
| 		global $settings, $session, $dms, $user; | ||||
| 		if(!$class) { | ||||
| 			return null; | ||||
| 		} | ||||
| 
 | ||||
| 		$classname = "SeedDMS_Controller_".$class; | ||||
| 		$filename = "../controllers/class.".$class.".php"; | ||||
| 		if(file_exists($filename)) { | ||||
| 			require($filename); | ||||
| 			$controller = new $classname($params); | ||||
| 			/* Set some configuration parameters */ | ||||
| 			$controller->setParam('dms', $dms); | ||||
| 			$controller->setParam('user', $user); | ||||
| 			$controller->setParam('postVars', $_POST); | ||||
| 			$controller->setParam('getVars', $_GET); | ||||
| 			$controller->setParam('requestVars', $_REQUEST); | ||||
| 			$controller->setParam('session', $session); | ||||
| 			$controller->setParam('settings', $settings); | ||||
| 			return $controller; | ||||
| 		} | ||||
| 		return null; | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										51
									
								
								inc/inc.ClassControllerCommon.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								inc/inc.ClassControllerCommon.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | |||
| <?php | ||||
| //    SeedDMS. Document Management System
 | ||||
| //    Copyright (C) 2013 Uwe Steinmann
 | ||||
| //
 | ||||
| //    This program is free software; you can redistribute it and/or modify
 | ||||
| //    it under the terms of the GNU General Public License as published by
 | ||||
| //    the Free Software Foundation; either version 2 of the License, or
 | ||||
| //    (at your option) any later version.
 | ||||
| //
 | ||||
| //    This program is distributed in the hope that it will be useful,
 | ||||
| //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | ||||
| //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | ||||
| //    GNU General Public License for more details.
 | ||||
| //
 | ||||
| //    You should have received a copy of the GNU General Public License
 | ||||
| //    along with this program; if not, write to the Free Software
 | ||||
| //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 | ||||
| 
 | ||||
| class SeedDMS_Controller_Common { | ||||
| 	function __construct($params) { | ||||
| 		$this->params = $params; | ||||
| 	} | ||||
| 
 | ||||
| 	function setParams($params) { | ||||
| 		$this->params = $params; | ||||
| 	} | ||||
| 
 | ||||
| 	function setParam($name, $value) { | ||||
| 		$this->params[$name] = $value; | ||||
| 	} | ||||
| 
 | ||||
| 	function unsetParam($name) { | ||||
| 		if(isset($this->params[$name])) | ||||
| 			unset($this->params[$name]); | ||||
| 	} | ||||
| 
 | ||||
| 	function run() { | ||||
| 	} | ||||
| 
 | ||||
| 	function callHook($hook) { | ||||
| 		$tmp = explode('_', get_class($this)); | ||||
| 		if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])])) { | ||||
| 			foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])] as $hookObj) { | ||||
| 				if (method_exists($hookObj, $hook)) { | ||||
| 					return $hookObj->$hook($this); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		return false; | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										34
									
								
								inc/inc.ClassExtBase.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								inc/inc.ClassExtBase.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| <?php | ||||
| /*************************************************************** | ||||
| *  Copyright notice | ||||
| * | ||||
| *  (c) 2013 Uwe Steinmann <uwe@steinmann.cx> | ||||
| *  All rights reserved | ||||
| * | ||||
| *  This script is part of the SeedDMS project. The SeedDMS project is | ||||
| *  free software; you can redistribute it and/or modify | ||||
| *  it under the terms of the GNU General Public License as published by | ||||
| *  the Free Software Foundation; either version 2 of the License, or | ||||
| *  (at your option) any later version. | ||||
| * | ||||
| *  The GNU General Public License can be found at | ||||
| *  http://www.gnu.org/copyleft/gpl.html. | ||||
| * | ||||
| *  This script is distributed in the hope that it will be useful, | ||||
| *  but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| *  GNU General Public License for more details. | ||||
| * | ||||
| *  This copyright notice MUST APPEAR in all copies of the script! | ||||
| ***************************************************************/ | ||||
| 
 | ||||
| /** | ||||
|  * Base class for extensions | ||||
|  * | ||||
|  * @author  Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @package SeedDMS | ||||
|  */ | ||||
| class SeedDMS_ExtBase { | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
							
								
								
									
										89
									
								
								inc/inc.ClassExtensionMgr.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								inc/inc.ClassExtensionMgr.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,89 @@ | |||
| <?php | ||||
| /** | ||||
|  * Implementation of an extension management. | ||||
|  * | ||||
|  * SeedDMS can be extended by extensions. Extension usually implement | ||||
|  * hook. | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @license    GPL 2 | ||||
|  * @version    @version@ | ||||
|  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  2011 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * Class to represent an extension manager | ||||
|  * | ||||
|  * This class provides some very basic methods to manage extensions. | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @author     Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  2011 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| class SeedDMS_Extension_Mgr { | ||||
| 	/** | ||||
| 	 * @var object $db reference to database object. This must be an instance | ||||
| 	 *      of {@link SeedDMS_Core_DatabaseAccess}. | ||||
| 	 * @access protected | ||||
| 	 */ | ||||
| 	protected $db; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @var string $extdir directory where extensions are located | ||||
| 	 * @access protected | ||||
| 	 */ | ||||
| 	protected $extdir; | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @var string $cachedir directory where cached extension configuration | ||||
| 	 *      is stored | ||||
| 	 * @access protected | ||||
| 	 */ | ||||
| 	protected $cachedir; | ||||
| 
 | ||||
| 
 | ||||
| 	function __construct($db, $extdir = '', $cachedir = '') { | ||||
| 		$this->db = $db; | ||||
| 		$this->cachedir = $cachedir; | ||||
| 		$this->extdir = $extdir; | ||||
| 	} | ||||
| 
 | ||||
| 	function getExtensionsConfFile() { /* {{{ */ | ||||
| 		return $this->cachedir."/extensions.php"; | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	function createExtensionConf() { /* {{{ */ | ||||
| 		$extensions = self::getExtensions(); | ||||
| 		if($extensions) { | ||||
| 			$fp = fopen($this->cachedir."/extensions.php", "w"); | ||||
| 			foreach($extensions as $_ext) { | ||||
| 				if(file_exists($this->extdir . "/" . $_ext . "/conf.php")) { | ||||
| 					$content = file_get_contents($this->extdir . "/" . $_ext . "/conf.php"); | ||||
| 					fwrite($fp, $content); | ||||
| 				} | ||||
| 			} | ||||
| 			fclose($fp); | ||||
| 			include($this->cachedir."/extensions.php"); | ||||
| 		} | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	function getExtensions() { /* {{{ */ | ||||
| 		$extensions = array(); | ||||
| 		$handle = opendir($this->extdir); | ||||
| 		while ($entry = readdir($handle) ) { | ||||
| 			if ($entry == ".." || $entry == ".") | ||||
| 				continue; | ||||
| 			else if (is_dir($this->extdir ."/". $entry)) | ||||
| 				array_push($extensions, $entry); | ||||
| 		} | ||||
| 		closedir($handle); | ||||
| 
 | ||||
| 		asort($extensions); | ||||
| 		return $extensions; | ||||
| 	} /* }}} */ | ||||
| } | ||||
|  | @ -191,6 +191,7 @@ class Settings { /* {{{ */ | |||
| 	var $_ldapAccountDomainName = ""; | ||||
| 	var $_ldapType = 1; // 0 = ldap; 1 = AD
 | ||||
| 	var $_converters = array(); // list of commands used to convert files to text for Indexer
 | ||||
| 	var $_extensions = array(); // configuration for extensions
 | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Constructor | ||||
|  | @ -485,6 +486,17 @@ class Settings { /* {{{ */ | |||
| 			$tab = $converter->attributes(); | ||||
| 			$this->_converters[trim(strval($tab['mimeType']))] = trim(strval($converter)); | ||||
| 		} | ||||
| 
 | ||||
| 		// XML Path: /configuration/extensions
 | ||||
| 		$extensions = $xml->xpath('/configuration/extensions/extension'); | ||||
| 		$this->_extensions = array(); | ||||
| 		foreach($extensions as $extension) { | ||||
| 			$extname = strval($extension->attributes()['name']); | ||||
| 			foreach($extension->children() as $parameter) { | ||||
| 				$this->_extensions[$extname][strval($parameter->attributes()['name'])] = strval($parameter); | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		return true; | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
|  | @ -741,6 +753,29 @@ class Settings { /* {{{ */ | |||
|     } // foreach
 | ||||
| 
 | ||||
| 
 | ||||
|     // XML Path: /configuration/extensions
 | ||||
|     $extnodes = $xml->xpath('/configuration/extensions'); | ||||
| 		if(!$extnodes) { | ||||
| 			$nodeParent = $xml->xpath('/configuration'); | ||||
| 			$extnodes = $nodeParent[0]->addChild("extensions"); | ||||
| 		} else { | ||||
| 			unset($xml->extensions); | ||||
| 			$extnodes = $xml->addChild("extensions"); | ||||
| 		} | ||||
|     foreach($this->_extensions as $name => $extension) | ||||
|     { | ||||
|       // search XML node
 | ||||
| 			$extnode = $extnodes->addChild('extension'); | ||||
|       $this->setXMLAttributValue($extnode, 'name', $name); | ||||
| 			foreach($GLOBALS['EXT_CONF'][$name]['config'] as $fieldname=>$conf) { | ||||
| 				$parameter = $extnode->addChild('parameter'); | ||||
| 				$parameter[0] = isset($extension[$fieldname]) ? $extension[$fieldname] : ''; | ||||
| 				$this->setXMLAttributValue($parameter, 'name', $fieldname); | ||||
| 			} | ||||
| 
 | ||||
| 
 | ||||
|     } // foreach
 | ||||
| 
 | ||||
|     // Save
 | ||||
|     return $xml->asXML($configFilePath); | ||||
|   } /* }}} */ | ||||
|  |  | |||
|  | @ -59,6 +59,7 @@ class UI extends UI_Default { | |||
| 			/* Set some configuration parameters */ | ||||
| 			$view->setParam('refferer', $_SERVER['REQUEST_URI']); | ||||
| 			$view->setParam('session', $session); | ||||
| 			$view->setParam('settings', $settings); | ||||
| 			$view->setParam('sitename', $settings->_siteName); | ||||
| 			$view->setParam('rootfolderid', $settings->_rootFolderID); | ||||
| 			$view->setParam('disableselfedit', $settings->_disableSelfEdit); | ||||
|  |  | |||
|  | @ -56,7 +56,47 @@ class SeedDMS_View_Common { | |||
| */ | ||||
| 
 | ||||
| 	function show() { | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * Call a hook with a given name | ||||
| 	 * | ||||
| 	 * Checks if a hook with the given name and for the current view | ||||
| 	 * exists and executes it. The name of the current view is taken | ||||
| 	 * from the current class name by lower casing the first char. | ||||
| 	 * This function will execute all registered hooks in the order | ||||
| 	 * they were registered. | ||||
| 	 * | ||||
| 	 * @params string $hook name of hook | ||||
| 	 * @return mixed whatever the hook function returns | ||||
| 	 */ | ||||
| 	function callHook($hook) { | ||||
| 		$tmp = explode('_', get_class($this)); | ||||
| 		$ret = null; | ||||
| 		if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])])) { | ||||
| 			foreach($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp[2])] as $hookObj) { | ||||
| 				if (method_exists($hookObj, $hook)) { | ||||
| 					switch(func_num_args()) { | ||||
| 						case 1: | ||||
| 							$tmpret = $hookObj->$hook($this); | ||||
| 							if(is_string($tmpret)) | ||||
| 								$ret .= $tmpret; | ||||
| 							break; | ||||
| 						case 2: | ||||
| 							$tmpret = $hookObj->$hook($this, func_get_arg(1)); | ||||
| 							if(is_string($tmpret)) | ||||
| 								$ret .= $tmpret; | ||||
| 							break; | ||||
| 						case 3: | ||||
| 						default: | ||||
| 							$tmpret = $hookObj->$hook($this, func_get_arg(1), func_get_arg(2)); | ||||
| 							if(is_string($tmpret)) | ||||
| 								$ret .= $tmpret; | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		return $ret; | ||||
| 	} | ||||
| } | ||||
| ?>
 | ||||
|  |  | |||
							
								
								
									
										49
									
								
								inc/inc.Extension.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								inc/inc.Extension.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,49 @@ | |||
| <?php | ||||
| /** | ||||
|  * Initialize extensions | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @license    GPL 2 | ||||
|  * @version    @version@ | ||||
|  * @author     Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  Copyright (C) 2013 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| 
 | ||||
| require "inc.ClassExtensionMgr.php"; | ||||
| require_once "inc.ClassExtBase.php"; | ||||
| 
 | ||||
| $extMgr = new SeedDMS_Extension_Mgr($db, $settings->_rootDir."/ext", $settings->_cacheDir); | ||||
| $extconffile = $extMgr->getExtensionsConfFile(); | ||||
| if(!file_exists($extconffile)) { | ||||
| 	$extMgr->createExtensionConf(); | ||||
| } | ||||
| include($extconffile); | ||||
| 
 | ||||
| foreach($EXT_CONF as $extname=>$extconf) { | ||||
| 	if(!isset($extconf['disable']) || $extconf['disable'] == false) { | ||||
| 		$classfile = $settings->_rootDir."/ext/".$extname."/".$extconf['class']['file']; | ||||
| 		if(file_exists($classfile)) { | ||||
| 			include($classfile); | ||||
| 			$obj = new $extconf['class']['name']; | ||||
| 			if(method_exists($obj, 'init')) | ||||
| 				$obj->init(); | ||||
| 		} | ||||
| 		if(isset($extconf['language']['file'])) { | ||||
| 			$langfile = $settings->_rootDir."/ext/".$extname."/".$extconf['language']['file']; | ||||
| 			if(file_exists($langfile)) { | ||||
| 				unset($__lang); | ||||
| 				include($langfile); | ||||
| 				if($__lang) { | ||||
| 					foreach($__lang as $lang=>&$data) { | ||||
| 						if(isset($GLOBALS['LANG'][$lang])) | ||||
| 							$GLOBALS['LANG'][$lang] = array_merge($GLOBALS['LANG'][$lang], $data); | ||||
| 						else | ||||
| 							$GLOBALS['LANG'][$lang] = $data; | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -61,6 +61,39 @@ function getReadableDurationArray($secs) { | |||
| 	return $units; | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Compare two version | ||||
|  * | ||||
|  * This functions compares two version in the format x.x.x | ||||
|  * | ||||
|  * @param string $ver1 | ||||
|  * @param string $ver2 | ||||
|  * @return int -1 if $ver1 < $ver2, 0 if $ver1 == $ver2, 1 if $ver1 > $ver2 | ||||
|  */ | ||||
| function cmpVersion($ver1, $ver2) { | ||||
| 	$tmp1 = explode('.', $ver1); | ||||
| 	$tmp2 = explode('.', $ver2); | ||||
| 	if(intval($tmp1[0]) < intval($tmp2[0])) { | ||||
| 		return -1; | ||||
| 	} elseif(intval($tmp1[0]) > intval($tmp2[0])) { | ||||
| 		return 1; | ||||
| 	} else { | ||||
| 		if(intval($tmp1[1]) < intval($tmp2[1])) { | ||||
| 			return -1; | ||||
| 		} elseif(intval($tmp1[1]) > intval($tmp2[1])) { | ||||
| 			return 1; | ||||
| 		} else { | ||||
| 			if(intval($tmp1[2]) < intval($tmp2[2])) { | ||||
| 				return -1; | ||||
| 			} elseif(intval($tmp1[2]) > intval($tmp2[2])) { | ||||
| 				return 1; | ||||
| 			} else { | ||||
| 				return 0; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| //
 | ||||
| // The original string sanitizer, kept for reference.
 | ||||
| //function sanitizeString($string) {
 | ||||
|  | @ -410,4 +443,21 @@ function checkQuota() { /* {{{ */ | |||
| 
 | ||||
| 	return ($quota - $user->getUsedDiskSpace()); | ||||
| } /* }}} */ | ||||
| 
 | ||||
| function encryptData($key, $value){ | ||||
|   $text = $value; | ||||
|   $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); | ||||
|   $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); | ||||
|   $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv); | ||||
|   return $crypttext; | ||||
| } | ||||
| 
 | ||||
| function decryptData($key, $value){ | ||||
|   $crypttext = $value; | ||||
|   $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); | ||||
|   $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); | ||||
|   $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $crypttext, MCRYPT_MODE_ECB, $iv); | ||||
|   return trim($decrypttext); | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
|  |  | |||
|  | @ -27,6 +27,10 @@ class SeedDMS_Version { | |||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	function version() { | ||||
| 		return $this->_number; | ||||
| 	} | ||||
| 
 | ||||
| 	function banner() { | ||||
| 		return $this->_string .", ". $this->_number; | ||||
| 	} | ||||
|  |  | |||
|  | @ -101,6 +101,7 @@ $text = array( | |||
| 'attribute_changed_email_body' => "Attribute changed\r\nDocument: [name]\r\nVersion: [version]\r\nAttribute: [attribute]\r\nParent folder: [folder_path]\r\nUser: [username]\r\nURL: [url]", | ||||
| 'attributes' => "Attributes", | ||||
| 'august' => "August", | ||||
| 'author' => "Author", | ||||
| 'automatic_status_update' => "Automatic status change", | ||||
| 'back' => "Go back", | ||||
| 'backup_list' => "Existings backup list", | ||||
|  | @ -261,6 +262,7 @@ $text = array( | |||
| 'expiry_changed_email' => "Expiry date changed", | ||||
| 'expiry_changed_email_subject' => "[sitename]: [name] - Expiry date changed", | ||||
| 'expiry_changed_email_body' => "Expiry date changed\r\nDocument: [name]\r\nParent folder: [folder_path]\r\nUser: [username]\r\nURL: [url]", | ||||
| 'extension_manager' => "Extension manager", | ||||
| 'february' => "February", | ||||
| 'file' => "File", | ||||
| 'files_deletion' => "Files deletion", | ||||
|  | @ -602,6 +604,7 @@ $text = array( | |||
| 'settings_contentOffsetDir_desc' => "To work around limitations in the underlying file system, a new directory structure has been devised that exists within the content directory (Content Directory). This requires a base directory from which to begin. Usually leave this to the default setting, 1048576, but can  be any number or string that does not already exist within (Content Directory)", | ||||
| 'settings_coreDir' => "Core SeedDMS directory", | ||||
| 'settings_coreDir_desc' => "Path to SeedDMS_Core (optional). Leave this empty if you have installed SeedDMS_Core at a place where it can be found by PHP, e.g. Extra PHP Include-Path", | ||||
| 'settings_Extensions' => "Extensions", | ||||
| 'settings_loginFailure_desc' => "Disable account after n login failures.", | ||||
| 'settings_loginFailure' => "Login failure", | ||||
| 'settings_luceneClassDir' => "Lucene SeedDMS directory", | ||||
|  |  | |||
|  | @ -24,8 +24,9 @@ include("../inc/inc.Utils.php"); | |||
| include("../inc/inc.ClassEmail.php"); | ||||
| include("../inc/inc.DBInit.php"); | ||||
| include("../inc/inc.Language.php"); | ||||
| include("../inc/inc.ClassUI.php"); | ||||
| include("../inc/inc.Authentication.php"); | ||||
| include("../inc/inc.Extension.php"); | ||||
| include("../inc/inc.ClassUI.php"); | ||||
| 
 | ||||
| /* Check if the form data comes for a trusted request */ | ||||
| if(!checkFormKey('adddocument')) { | ||||
|  | @ -243,6 +244,14 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){ | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	if(isset($GLOBALS['SEEDDMS_HOOKS']['addDocument'])) { | ||||
| 		foreach($GLOBALS['SEEDDMS_HOOKS']['addDocument'] as $hookObj) { | ||||
| 			if (method_exists($hookObj, 'pretAddDocument')) { | ||||
| 				$hookObj->preAddDocument(array('name'=>&$name, 'comment'=>&$comment)); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	$res = $folder->addDocument($name, $comment, $expires, $user, $keywords, | ||||
| 															$cats, $userfiletmp, basename($userfilename), | ||||
| 	                            $fileType, $userfiletype, $sequence, | ||||
|  | @ -253,8 +262,8 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){ | |||
| 		UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured")); | ||||
| 	} else { | ||||
| 		$document = $res[0]; | ||||
| 		if(isset($GLOBALS['SEEDDMS_HOOKS']['postAddDocument'])) { | ||||
| 			foreach($GLOBALS['SEEDDMS_HOOKS']['postAddDocument'] as $hookObj) { | ||||
| 		if(isset($GLOBALS['SEEDDMS_HOOKS']['addDocument'])) { | ||||
| 			foreach($GLOBALS['SEEDDMS_HOOKS']['addDocument'] as $hookObj) { | ||||
| 				if (method_exists($hookObj, 'postAddDocument')) { | ||||
| 					$hookObj->postAddDocument($document); | ||||
| 				} | ||||
|  |  | |||
|  | @ -20,17 +20,21 @@ | |||
| //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 | ||||
| 
 | ||||
| include("../inc/inc.Settings.php"); | ||||
| include("../inc/inc.LogInit.php"); | ||||
| include("../inc/inc.LogInit.php"); | ||||
| include("../inc/inc.Utils.php"); | ||||
| include("../inc/inc.DBInit.php"); | ||||
| include("../inc/inc.Language.php"); | ||||
| include("../inc/inc.ClassUI.php"); | ||||
| include("../inc/inc.ClassController.php"); | ||||
| include("../inc/inc.Authentication.php"); | ||||
| include("../inc/inc.Extension.php"); | ||||
| 
 | ||||
| $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); | ||||
| $controller = Controller::factory($tmp[1]); | ||||
| 
 | ||||
| if (isset($_GET["version"])) { | ||||
| 
 | ||||
| 	// document download
 | ||||
| 	 | ||||
| 	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")); | ||||
| 	} | ||||
|  | @ -58,18 +62,10 @@ if (isset($_GET["version"])) { | |||
| 	if (!is_object($content)) { | ||||
| 		UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); | ||||
| 	} | ||||
| 	 | ||||
| 	//header("Content-Type: application/force-download; name=\"" . mydmsDecodeString($content->getOriginalFileName()) . "\"");
 | ||||
| 	header("Content-Transfer-Encoding: binary"); | ||||
| 	header("Content-Length: " . filesize($dms->contentDir . $content->getPath() )); | ||||
| 	header("Content-Disposition: attachment; filename=\"" . $content->getOriginalFileName() . "\""); | ||||
| 	//header("Expires: 0");
 | ||||
| 	header("Content-Type: " . $content->getMimeType()); | ||||
| 	//header("Cache-Control: no-cache, must-revalidate");
 | ||||
| 	header("Cache-Control: must-revalidate"); | ||||
| 	//header("Pragma: no-cache");
 | ||||
| 
 | ||||
| 	readfile($dms->contentDir . $content->getPath()); | ||||
| 	$controller->setParam('content', $content); | ||||
| 	$controller->setParam('type', 'version'); | ||||
| 	$controller->run(); | ||||
| 
 | ||||
| } elseif (isset($_GET["file"])) { | ||||
| 
 | ||||
|  | @ -219,4 +215,3 @@ if (isset($_GET["version"])) { | |||
| 
 | ||||
| add_log_line(); | ||||
| exit(); | ||||
| ?>
 | ||||
|  |  | |||
							
								
								
									
										42
									
								
								op/op.ExtensionMgr.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								op/op.ExtensionMgr.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| <?php | ||||
| //    SeedDMS. Document Management System
 | ||||
| //    Copyright (C) 2013 Uwe Steinmann
 | ||||
| //
 | ||||
| //    This program is free software; you can redistribute it and/or modify
 | ||||
| //    it under the terms of the GNU General Public License as published by
 | ||||
| //    the Free Software Foundation; either version 2 of the License, or
 | ||||
| //    (at your option) any later version.
 | ||||
| //
 | ||||
| //    This program is distributed in the hope that it will be useful,
 | ||||
| //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | ||||
| //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | ||||
| //    GNU General Public License for more details.
 | ||||
| //
 | ||||
| //    You should have received a copy of the GNU General Public License
 | ||||
| //    along with this program; if not, write to the Free Software
 | ||||
| //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 | ||||
| 
 | ||||
| include("../inc/inc.Settings.php"); | ||||
| include("../inc/inc.LogInit.php"); | ||||
| include("../inc/inc.DBInit.php"); | ||||
| include("../inc/inc.Language.php"); | ||||
| include("../inc/inc.ClassUI.php"); | ||||
| include("../inc/inc.Authentication.php"); | ||||
| require "../inc/inc.ClassExtensionMgr.php"; | ||||
| 
 | ||||
| if (!$user->isAdmin()) { | ||||
| 	UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); | ||||
| } | ||||
| 
 | ||||
| /* Check if the form data comes for a trusted request */ | ||||
| if(!checkFormKey('extensionmgr')) { | ||||
| 	UI::exitError(getMLText("admin_tools"),getMLText("invalid_request_token")); | ||||
| } | ||||
| 
 | ||||
| $extMgr = new SeedDMS_Extension_Mgr($db, $settings->_rootDir."/ext", $settings->_cacheDir); | ||||
| $extconffile = $extMgr->getExtensionsConfFile(); | ||||
| $extMgr->createExtensionConf(); | ||||
| 
 | ||||
| add_log_line(); | ||||
| header("Location:../out/out.ExtensionMgr.php"); | ||||
| ?>
 | ||||
							
								
								
									
										192
									
								
								op/op.Login.php
									
									
									
									
									
								
							
							
						
						
									
										192
									
								
								op/op.Login.php
									
									
									
									
									
								
							|  | @ -24,7 +24,9 @@ include("../inc/inc.Language.php"); | |||
| include("../inc/inc.ClassSession.php"); | ||||
| include("../inc/inc.DBInit.php"); | ||||
| include("../inc/inc.ClassUI.php"); | ||||
| include("../inc/inc.ClassController.php"); | ||||
| include("../inc/inc.ClassEmail.php"); | ||||
| include("../inc/inc.Extension.php"); | ||||
| 
 | ||||
| include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc"; | ||||
| 
 | ||||
|  | @ -40,6 +42,9 @@ function _printMessage($heading, $message) { | |||
| 	return; | ||||
| } | ||||
| 
 | ||||
| $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); | ||||
| $controller = Controller::factory($tmp[1]); | ||||
| 
 | ||||
| if (isset($_REQUEST["sesstheme"]) && strlen($_REQUEST["sesstheme"])>0 && is_numeric(array_search($_REQUEST["sesstheme"],UI::getStyles())) ) { | ||||
| 	$theme = $_REQUEST["sesstheme"]; | ||||
| } | ||||
|  | @ -65,110 +70,119 @@ if ((!isset($pwd) || strlen($pwd)==0) && ($login != $guestUser->getLogin()))  { | |||
| 	exit; | ||||
| } | ||||
| 
 | ||||
| //
 | ||||
| // LDAP Sign In
 | ||||
| //
 | ||||
| $user = false; | ||||
| 
 | ||||
| /* new code by doudoux - TO BE TESTED */ | ||||
| if (isset($settings->_ldapBaseDN)) { | ||||
| 	$ldapSearchAttribut = "uid="; | ||||
| 	$tmpDN = "uid=".$login.",".$settings->_ldapBaseDN; | ||||
| if(isset($GLOBALS['SEEDDMS_HOOKS']['authentication'])) { | ||||
| 	foreach($GLOBALS['SEEDDMS_HOOKS']['authentication'] as $authObj) { | ||||
| 		if(method_exists($authObj, 'authenticate')) { | ||||
| 			$user = $authObj->authenticate($dms, $settings, $login, $pwd); | ||||
| 			if(is_object($user)) | ||||
| 				$userid = $user->getID(); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| if (isset($settings->_ldapType)) | ||||
| { | ||||
|     if ($settings->_ldapType==1) | ||||
|     { | ||||
|         $ldapSearchAttribut = "sAMAccountName="; | ||||
|         $tmpDN = $login.'@'.$settings->_ldapAccountDomainName; | ||||
|     } | ||||
| }  | ||||
| /* end of new code */ | ||||
| if (is_bool($user)) { | ||||
| 	//
 | ||||
| 	// LDAP Sign In
 | ||||
| 	//
 | ||||
| 
 | ||||
| 
 | ||||
| $user = false; | ||||
| if (isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) { | ||||
| 	if (isset($settings->_ldapPort) && is_int($settings->_ldapPort)) { | ||||
| 		$ds = ldap_connect($settings->_ldapHost, $settings->_ldapPort); | ||||
| 	/* new code by doudoux - TO BE TESTED */ | ||||
| 	if (isset($settings->_ldapBaseDN)) { | ||||
| 		$ldapSearchAttribut = "uid="; | ||||
| 		$tmpDN = "uid=".$login.",".$settings->_ldapBaseDN; | ||||
| 	} | ||||
| 	else { | ||||
| 		$ds = ldap_connect($settings->_ldapHost); | ||||
| 	} | ||||
| 	if (!is_bool($ds)) { | ||||
| 		// Ensure that the LDAP connection is set to use version 3 protocol.
 | ||||
| 		// Required for most authentication methods, including SASL.
 | ||||
| 		ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); | ||||
| 
 | ||||
| 		// try an authenticated/anonymous bind first. If it succeeds, get the DN for the user.
 | ||||
| 		$bind = false; | ||||
| 		if (isset($settings->_ldapBindDN)) { | ||||
| 			$bind = @ldap_bind($ds, $settings->_ldapBindDN, $settings->_ldapBindPw); | ||||
| 		} else { | ||||
| 			$bind = @ldap_bind($ds); | ||||
| 	if (isset($settings->_ldapType)) { | ||||
| 		if ($settings->_ldapType==1) { | ||||
| 			$ldapSearchAttribut = "sAMAccountName="; | ||||
| 			$tmpDN = $login.'@'.$settings->_ldapAccountDomainName; | ||||
| 		} | ||||
| 		$dn = false; | ||||
| 				 | ||||
| 		/* new code by doudoux - TO BE TESTED */ | ||||
| 	        if ($bind) {         | ||||
| 	            $search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut.$login); | ||||
| 	            if (!is_bool($search)) { | ||||
| 	                $info = ldap_get_entries($ds, $search); | ||||
| 	                if (!is_bool($info) && $info["count"]>0) { | ||||
| 	                    $dn = $info[0]['dn']; | ||||
| 	                } | ||||
| 	            } | ||||
| 	        }  | ||||
| 		/* end of new code */ | ||||
| 		 | ||||
| 		/* old code */ | ||||
| 		if ($bind) { | ||||
| 			$search = ldap_search($ds, $settings->_ldapBaseDN, "uid=".$login); | ||||
| 			if (!is_bool($search)) { | ||||
| 				$info = ldap_get_entries($ds, $search); | ||||
| 				if (!is_bool($info) && $info["count"]>0) { | ||||
| 					$dn = $info[0]['dn']; | ||||
| 				} | ||||
| 	}  | ||||
| 	/* end of new code */ | ||||
| 
 | ||||
| 	if (isset($settings->_ldapHost) && strlen($settings->_ldapHost)>0) { | ||||
| 		if (isset($settings->_ldapPort) && is_int($settings->_ldapPort)) { | ||||
| 			$ds = ldap_connect($settings->_ldapHost, $settings->_ldapPort); | ||||
| 		} | ||||
| 		else { | ||||
| 			$ds = ldap_connect($settings->_ldapHost); | ||||
| 		} | ||||
| 		if (!is_bool($ds)) { | ||||
| 			// Ensure that the LDAP connection is set to use version 3 protocol.
 | ||||
| 			// Required for most authentication methods, including SASL.
 | ||||
| 			ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); | ||||
| 
 | ||||
| 			// try an anonymous bind first. If it succeeds, get the DN for the user.
 | ||||
| 			if (isset($settings->_ldapBindDN)) { | ||||
| 				$bind = @ldap_bind($ds, $settings->_ldapBindDN, $settings->_ldapBindPw); | ||||
| 			} else { | ||||
| 				$bind = @ldap_bind($ds); | ||||
| 			} | ||||
| 		} | ||||
| 		/* end of old code */ | ||||
| 
 | ||||
| 		 | ||||
| 		if (is_bool($dn)) { | ||||
| 			// This is the fallback position, in case the anonymous bind does not
 | ||||
| 			// succeed.
 | ||||
| 			$dn = false; | ||||
| 					 | ||||
| 			/* new code by doudoux - TO BE TESTED */ | ||||
| 						if ($bind) {         | ||||
| 								$search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut.$login); | ||||
| 								if (!is_bool($search)) { | ||||
| 										$info = ldap_get_entries($ds, $search); | ||||
| 										if (!is_bool($info) && $info["count"]>0) { | ||||
| 												$dn = $info[0]['dn']; | ||||
| 										} | ||||
| 								} | ||||
| 						}  | ||||
| 			/* end of new code */ | ||||
| 			 | ||||
| 			/* new code by doudoux  - TO BE TESTED */ | ||||
| 			$dn = $tmpDN; | ||||
| 			/* old code */ | ||||
| 			//$dn = "uid=".$login.",".$settings->_ldapBaseDN; 
 | ||||
| 			 | ||||
| 		} | ||||
| 		$bind = @ldap_bind($ds, $dn, $pwd); | ||||
| 		if ($bind) { | ||||
| 			// Successfully authenticated. Now check to see if the user exists within
 | ||||
| 			// the database. If not, add them in, but do not add their password.
 | ||||
| 			$user = $dms->getUserByLogin($login); | ||||
| 			if (is_bool($user) && !$settings->_restricted) { | ||||
| 				// Retrieve the user's LDAP information.
 | ||||
| 				 | ||||
| 				 | ||||
| 				/* new code by doudoux  - TO BE TESTED */ | ||||
| 				$search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut . $login);  | ||||
| 				/* old code */ | ||||
| 				//$search = ldap_search($ds, $dn, "uid=".$login);
 | ||||
| 				 | ||||
| 			if ($bind) { | ||||
| 				$search = ldap_search($ds, $settings->_ldapBaseDN, "uid=".$login); | ||||
| 				if (!is_bool($search)) { | ||||
| 					$info = ldap_get_entries($ds, $search); | ||||
| 					if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) { | ||||
| 						$user = $dms->addUser($login, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, ""); | ||||
| 					if (!is_bool($info) && $info["count"]>0) { | ||||
| 						$dn = $info[0]['dn']; | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			if (!is_bool($user)) { | ||||
| 				$userid = $user->getID(); | ||||
| 			/* end of old code */ | ||||
| 
 | ||||
| 			 | ||||
| 			if (is_bool($dn)) { | ||||
| 				// This is the fallback position, in case the anonymous bind does not
 | ||||
| 				// succeed.
 | ||||
| 				 | ||||
| 				/* new code by doudoux  - TO BE TESTED */ | ||||
| 				$dn = $tmpDN; | ||||
| 				/* old code */ | ||||
| 				//$dn = "uid=".$login.",".$settings->_ldapBaseDN; 
 | ||||
| 				 | ||||
| 			} | ||||
| 			$bind = @ldap_bind($ds, $dn, $pwd); | ||||
| 			if ($bind) { | ||||
| 				// Successfully authenticated. Now check to see if the user exists within
 | ||||
| 				// the database. If not, add them in, but do not add their password.
 | ||||
| 				$user = $dms->getUserByLogin($login); | ||||
| 				if (is_bool($user) && !$settings->_restricted) { | ||||
| 					// Retrieve the user's LDAP information.
 | ||||
| 					 | ||||
| 					 | ||||
| 					/* new code by doudoux  - TO BE TESTED */ | ||||
| 					$search = ldap_search($ds, $settings->_ldapBaseDN, $ldapSearchAttribut . $login);  | ||||
| 					/* old code */ | ||||
| 					//$search = ldap_search($ds, $dn, "uid=".$login);
 | ||||
| 					 | ||||
| 					if (!is_bool($search)) { | ||||
| 						$info = ldap_get_entries($ds, $search); | ||||
| 						if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) { | ||||
| 							$user = $dms->addUser($login, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, ""); | ||||
| 						} | ||||
| 					} | ||||
| 				} | ||||
| 				if (!is_bool($user)) { | ||||
| 					$userid = $user->getID(); | ||||
| 				} | ||||
| 			} | ||||
| 			ldap_close($ds); | ||||
| 		} | ||||
| 		ldap_close($ds); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -298,6 +312,10 @@ else if (isset($_GET["referuri"]) && strlen($_GET["referuri"])>0) { | |||
| 	$referuri = urldecode($_GET["referuri"]); | ||||
| } | ||||
| 
 | ||||
| $controller->setParam('user', $user); | ||||
| $controller->setParam('session', $session); | ||||
| $controller->run(); | ||||
| 
 | ||||
| add_log_line(); | ||||
| 
 | ||||
| if (isset($referuri) && strlen($referuri)>0) { | ||||
|  |  | |||
|  | @ -49,10 +49,30 @@ $folder = $document->getFolder(); | |||
| /* Get the notify list before removing the document */ | ||||
| $nl =	$document->getNotifyList(); | ||||
| $docname = $document->getName(); | ||||
| 
 | ||||
| $hookObjectsArr = array(); | ||||
| if (is_array($GLOBALS['SEEDDMS_HOOKS']['RemoveDocument'])) { | ||||
| 	foreach($GLOBALS['SEEDDMS_HOOKS']['RemoveDocument'] as $_classRef) { | ||||
| 		$hookObjectsArr[] = & new $_classRef; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| foreach($hookObjectsArr as $_hookObj) { | ||||
| 	if (method_exists($_hookObj, 'preRemoveDocument')) { | ||||
| 		$ret = $_hookObj->preRemoveDocument($dms, $document); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| if (!$document->remove()) { | ||||
| 	UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("error_occured")); | ||||
| } else { | ||||
| 
 | ||||
| 	foreach($hookObjectsArr as $_hookObj) { | ||||
| 		if (method_exists($_hookObj, 'postRemoveDocument')) { | ||||
| 			$_hookObj->postRemoveDocument($dms, $documentid); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/* Remove the document from the fulltext index */ | ||||
| 	if($settings->_enableFullSearch) { | ||||
| 		if(!empty($settings->_luceneClassDir)) | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ include("../inc/inc.Language.php"); | |||
| include("../inc/inc.ClassUI.php"); | ||||
| include("../inc/inc.ClassAccessOperation.php"); | ||||
| include("../inc/inc.Authentication.php"); | ||||
| include("../inc/inc.Extension.php"); | ||||
| 
 | ||||
| /** | ||||
|  * Include class to preview documents | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ include("../inc/inc.DBInit.php"); | |||
| include("../inc/inc.Language.php"); | ||||
| include("../inc/inc.ClassUI.php"); | ||||
| include("../inc/inc.Authentication.php"); | ||||
| include("../inc/inc.Extension.php"); | ||||
| 
 | ||||
| 
 | ||||
| function getBoolValue($post_name) | ||||
|  | @ -157,6 +158,9 @@ if ($action == "saveSettings") | |||
|   // SETTINGS - ADVANCED - INDEX CMD
 | ||||
|   $settings->_converters = $_POST["converters"]; | ||||
| 
 | ||||
|   // SETTINGS - EXTENSIONS
 | ||||
|   $settings->_extensions = $_POST["extensions"]; | ||||
| 
 | ||||
|   // -------------------------------------------------------------------------
 | ||||
|   // save
 | ||||
|   // -------------------------------------------------------------------------
 | ||||
|  |  | |||
|  | @ -23,10 +23,14 @@ include("../inc/inc.LogInit.php"); | |||
| include("../inc/inc.DBInit.php"); | ||||
| include("../inc/inc.Language.php"); | ||||
| include("../inc/inc.ClassUI.php"); | ||||
| include("../inc/inc.ClassController.php"); | ||||
| include("../inc/inc.Authentication.php"); | ||||
| include("../inc/inc.Extension.php"); | ||||
| 
 | ||||
| $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); | ||||
| $controller = Controller::factory($tmp[1]); | ||||
| 
 | ||||
| $documentid = $_GET["documentid"]; | ||||
| 
 | ||||
| if (!isset($documentid) || !is_numeric($documentid) || intval($documentid)<1) { | ||||
| 	UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); | ||||
| } | ||||
|  | @ -54,16 +58,9 @@ if(isset($_GET["version"])) { | |||
| 		UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); | ||||
| 	} | ||||
| 
 | ||||
| 	if (isset($settings->_viewOnlineFileTypes) && is_array($settings->_viewOnlineFileTypes) && in_array(strtolower($content->getFileType()), $settings->_viewOnlineFileTypes)) { | ||||
| 		header("Content-Type: " . $content->getMimeType()); | ||||
| 	} | ||||
| 	header("Content-Disposition: filename=\"" . $document->getName().$content->getFileType()) . "\""; | ||||
| 	header("Content-Length: " . filesize($dms->contentDir . $content->getPath())); | ||||
| 	header("Expires: 0"); | ||||
| 	header("Cache-Control: no-cache, must-revalidate"); | ||||
| 	header("Pragma: no-cache"); | ||||
| 
 | ||||
| 	readfile($dms->contentDir . $content->getPath()); | ||||
| 	$controller->setParam('content', $content); | ||||
| 	$controller->setParam('type', 'version'); | ||||
| 	$controller->run(); | ||||
| } elseif(isset($_GET["file"])) { | ||||
| 	$fileid = $_GET["file"]; | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										40
									
								
								out/out.ExtensionMgr.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								out/out.ExtensionMgr.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,40 @@ | |||
| <?php | ||||
| //    SeedDMS. Document Management System
 | ||||
| //    Copyright (C) 2013 Uwe Steinmann
 | ||||
| //
 | ||||
| //    This program is free software; you can redistribute it and/or modify
 | ||||
| //    it under the terms of the GNU General Public License as published by
 | ||||
| //    the Free Software Foundation; either version 2 of the License, or
 | ||||
| //    (at your option) any later version.
 | ||||
| //
 | ||||
| //    This program is distributed in the hope that it will be useful,
 | ||||
| //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | ||||
| //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | ||||
| //    GNU General Public License for more details.
 | ||||
| //
 | ||||
| //    You should have received a copy of the GNU General Public License
 | ||||
| //    along with this program; if not, write to the Free Software
 | ||||
| //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 | ||||
| 
 | ||||
| include("../inc/inc.Version.php"); | ||||
| include("../inc/inc.Settings.php"); | ||||
| include("../inc/inc.DBInit.php"); | ||||
| include("../inc/inc.Language.php"); | ||||
| include("../inc/inc.ClassUI.php"); | ||||
| include("../inc/inc.Authentication.php"); | ||||
| include("../inc/inc.Extension.php"); | ||||
| 
 | ||||
| if (!$user->isAdmin()) { | ||||
| 	UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); | ||||
| } | ||||
| 
 | ||||
| $v = new SeedDMS_Version; | ||||
| 
 | ||||
| $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); | ||||
| $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'httproot'=>$settings->_httpRoot, 'version'=>$v)); | ||||
| if($view) { | ||||
| 	$view->show(); | ||||
| 	exit; | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
|  | @ -21,6 +21,7 @@ include("../inc/inc.DBInit.php"); | |||
| include("../inc/inc.Language.php"); | ||||
| include("../inc/inc.ClassUI.php"); | ||||
| include("../inc/inc.Authentication.php"); | ||||
| include("../inc/inc.Extension.php"); | ||||
| 
 | ||||
| if (!$user->isAdmin()) { | ||||
| 	UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); | ||||
|  |  | |||
|  | @ -26,6 +26,7 @@ include("../inc/inc.Language.php"); | |||
| include("../inc/inc.ClassUI.php"); | ||||
| include("../inc/inc.ClassAccessOperation.php"); | ||||
| include("../inc/inc.Authentication.php"); | ||||
| include("../inc/inc.Extension.php"); | ||||
| 
 | ||||
| /** | ||||
|  * Include class to preview documents | ||||
|  |  | |||
|  | @ -23,6 +23,7 @@ include("../inc/inc.Utils.php"); | |||
| include("../inc/inc.DBInit.php"); | ||||
| include("../inc/inc.Language.php"); | ||||
| include("../inc/inc.Authentication.php"); | ||||
| include("../inc/inc.Extension.php"); | ||||
| include("../inc/inc.ClassUI.php"); | ||||
| 
 | ||||
| /** | ||||
|  | @ -61,6 +62,7 @@ if($view) { | |||
| 	$view->setParam('enableFolderTree', $settings->_enableFolderTree); | ||||
| 	$view->setParam('enableClipboard', $settings->_enableClipboard); | ||||
| 	$view->setParam('showtree', showtree()); | ||||
| 	$view->setParam('settings', $settings); | ||||
| 	$view->setParam('cachedir', $settings->_cacheDir); | ||||
| 	$view->setParam('workflowmode', $settings->_workflowMode); | ||||
| 	$view->setParam('enableRecursiveCount', $settings->_enableRecursiveCount); | ||||
|  |  | |||
|  | @ -93,7 +93,8 @@ class SeedDMS_View_AdminTools extends SeedDMS_Bootstrap_Style { | |||
| 	</div> | ||||
| 	<p></p> | ||||
| 	<div class="row-fluid"> | ||||
| 		<a href="../out/out.Settings.php" class="span3 btn btn-medium"><i class="icon-cogs"></i><br /><?php echo getMLText("settings")?></a>
 | ||||
| 		<a href="../out/out.Settings.php" class="span3 btn btn-medium"><i class="icon-wrench"></i><br /><?php echo getMLText("settings")?></a>
 | ||||
| 		<a href="../out/out.ExtensionMgr.php" class="span3 btn btn-medium"><i class="icon-cogs"></i><br /><?php echo getMLText("extension_manager")?></a>
 | ||||
| 	</div> | ||||
| 	</div> | ||||
| <?php | ||||
|  |  | |||
|  | @ -77,7 +77,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);; | |||
|       dismissQueue: true, | ||||
|   		layout: 'topRight', | ||||
|   		theme: 'defaultTheme', | ||||
| 			timeout: 1500, | ||||
| 			timeout: <?php echo isset($flashmsg['duration']) && is_numeric($flashmsg['duration']) ? $flashmsg['duration'] : ($flashmsg['type'] == "error" ? "3000" : "1500"); ?>,
 | ||||
| 			_template: '<div class="noty_message alert alert-block alert-error"><span class="noty_text"></span><div class="noty_close"></div></div>' | ||||
|   	}); | ||||
| 		</script> | ||||
|  | @ -281,7 +281,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);; | |||
| 			echo "   <a class=\"btn btn-navbar\" data-toggle=\"collapse\" data-target=\".col2\">\n"; | ||||
| 			echo " 		<span class=\"icon-bar\"></span>\n"; | ||||
| 			echo " 		<span class=\"icon-bar\"></span>\n"; | ||||
| 			echo " 		<span class=\"icon-bar\"></span></a>\n"; | ||||
| 			echo " 		<span class=\"icon-bar\"></span>\n"; | ||||
| 			echo "   </a>\n"; | ||||
| 			switch ($pageType) { | ||||
| 				case "view_folder": | ||||
| 					$this->folderNavigationBar($extra); | ||||
|  | @ -487,6 +488,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);; | |||
| 		echo "     <ul class=\"dropdown-menu\" role=\"menu\">\n"; | ||||
| 		echo "      <li id=\"first\"><a href=\"../out/out.Statistic.php\">".getMLText("folders_and_documents_statistic")."</a></li>\n"; | ||||
| 		echo "      <li><a href=\"../out/out.ObjectCheck.php\">".getMLText("objectcheck")."</a></li>\n"; | ||||
| 		echo "      <li><a href=\"../out/out.ExtensionMgr.php\">".getMLText("extension_manager")."</a></li>\n"; | ||||
| 		echo "      <li><a href=\"../out/out.Info.php\">".getMLText("version_info")."</a></li>\n"; | ||||
| 		echo "     </ul>\n"; | ||||
| 		echo "    </li>\n"; | ||||
|  | @ -1122,35 +1124,40 @@ $(function() { | |||
| 				//echo "<tr><th colspan=\"3\">Documents</th></tr>\n";
 | ||||
| 				foreach($clipboard['docs'] as $docid) { | ||||
| 					if($document = $dms->getDocument($docid)) { | ||||
| 						$comment = $document->getComment(); | ||||
| 						if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; | ||||
| 						if($latestContent = $document->getLatestContent()) { | ||||
| 							$previewer->createPreview($latestContent); | ||||
| 							$version = $latestContent->getVersion(); | ||||
| 							$status = $latestContent->getStatus(); | ||||
| 							 | ||||
| 							print "<tr>"; | ||||
| 						$txt = $this->callHook('documentClipboardItem', $document, $previewer); | ||||
| 						if(is_string($txt)) | ||||
| 							echo $txt; | ||||
| 						else { | ||||
| 							$comment = $document->getComment(); | ||||
| 							if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; | ||||
| 							if($latestContent = $document->getLatestContent()) { | ||||
| 								$previewer->createPreview($latestContent); | ||||
| 								$version = $latestContent->getVersion(); | ||||
| 								$status = $latestContent->getStatus(); | ||||
| 								 | ||||
| 								print "<tr>"; | ||||
| 
 | ||||
| 							if (file_exists($dms->contentDir . $latestContent->getPath())) { | ||||
| 								print "<td><a rel=\"document_".$docid."\" draggable=\"true\" ondragstart=\"onDragStartDocument(event);\" href=\"../op/op.Download.php?documentid=".$docid."&version=".$version."\">"; | ||||
| 								if($previewer->hasPreview($latestContent)) { | ||||
| 									print "<img class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; | ||||
| 								} else { | ||||
| 									print "<img class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; | ||||
| 								if (file_exists($dms->contentDir . $latestContent->getPath())) { | ||||
| 									print "<td><a rel=\"document_".$docid."\" draggable=\"true\" ondragstart=\"onDragStartDocument(event);\" href=\"../op/op.Download.php?documentid=".$docid."&version=".$version."\">"; | ||||
| 									if($previewer->hasPreview($latestContent)) { | ||||
| 										print "<img class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; | ||||
| 									} else { | ||||
| 										print "<img class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; | ||||
| 									} | ||||
| 									print "</a></td>"; | ||||
| 								} else | ||||
| 									print "<td><img class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></td>"; | ||||
| 								 | ||||
| 								print "<td><a href=\"out.ViewDocument.php?documentid=".$docid."&showtree=".showtree()."\">" . htmlspecialchars($document->getName()) . "</a>"; | ||||
| 								if($comment) { | ||||
| 									print "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>"; | ||||
| 								} | ||||
| 								print "</a></td>"; | ||||
| 							} else | ||||
| 								print "<td><img class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></td>"; | ||||
| 							 | ||||
| 							print "<td><a href=\"out.ViewDocument.php?documentid=".$docid."&showtree=".showtree()."\">" . htmlspecialchars($document->getName()) . "</a>"; | ||||
| 							if($comment) { | ||||
| 								print "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>"; | ||||
| 								print "</td>\n"; | ||||
| 								print "<td>\n"; | ||||
| 								print "<div class=\"list-action\"><a href=\"../op/op.RemoveFromClipboard.php?folderid=".$this->params['folder']->getID()."&id=".$docid."&type=document\" title=\"".getMLText('rm_from_clipboard')."\"><i class=\"icon-remove\"></i></a></div>"; | ||||
| 								print "</td>\n"; | ||||
| 								print "</tr>"; | ||||
| 							} | ||||
| 							print "</td>\n"; | ||||
| 							print "<td>\n"; | ||||
| 							print "<div class=\"list-action\"><a href=\"../op/op.RemoveFromClipboard.php?folderid=".$this->params['folder']->getID()."&id=".$docid."&type=document\" title=\"".getMLText('rm_from_clipboard')."\"><i class=\"icon-remove\"></i></a></div>"; | ||||
| 							print "</td>\n"; | ||||
| 							print "</tr>"; | ||||
| 						} | ||||
| 					} | ||||
| 				} | ||||
|  | @ -1462,5 +1469,9 @@ mayscript> | |||
| <p id="fileList"></p> | ||||
| <?php | ||||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	function show(){ /* {{{ */ | ||||
| 		parent::show(); | ||||
| 	} /* }}} */ | ||||
| } | ||||
| ?>
 | ||||
|  |  | |||
							
								
								
									
										97
									
								
								views/bootstrap/class.ExtensionMgr.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								views/bootstrap/class.ExtensionMgr.php
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,97 @@ | |||
| <?php | ||||
| /** | ||||
|  * Implementation of ExtensionMgr view | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @license    GPL 2 | ||||
|  * @version    @version@ | ||||
|  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  Copyright (C) 2013 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| 
 | ||||
| /** | ||||
|  * Include parent class | ||||
|  */ | ||||
| require_once("class.Bootstrap.php"); | ||||
| 
 | ||||
| /** | ||||
|  * Class which outputs the html page for ExtensionMgr view | ||||
|  * | ||||
|  * @category   DMS | ||||
|  * @package    SeedDMS | ||||
|  * @author     Uwe Steinmann <uwe@steinmann.cx> | ||||
|  * @copyright  Copyright (C) 2013 Uwe Steinmann | ||||
|  * @version    Release: @package_version@ | ||||
|  */ | ||||
| class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style { | ||||
| 
 | ||||
| 	function show() { /* {{{ */ | ||||
| 		$dms = $this->params['dms']; | ||||
| 		$user = $this->params['user']; | ||||
| 		$httproot = $this->params['httproot']; | ||||
| 		$version = $this->params['version']; | ||||
| 
 | ||||
| 		$this->htmlStartPage(getMLText("admin_tools")); | ||||
| 		$this->globalNavigation(); | ||||
| 		$this->contentStart(); | ||||
| 		$this->pageNavigation(getMLText("admin_tools"), "admin_tools"); | ||||
| 		$this->contentContainerStart(); | ||||
| 		echo "<table class=\"table table-condensed\">\n"; | ||||
| 		print "<thead>\n<tr>\n"; | ||||
| 		print "<th></th>\n";	 | ||||
| 		print "<th>".getMLText('name')."</th>\n";	 | ||||
| 		print "<th>".getMLText('version')."</th>\n";	 | ||||
| 		print "<th>".getMLText('author')."</th>\n";	 | ||||
| 		print "</tr></thead>\n"; | ||||
| 		$errmsgs = array(); | ||||
| 		foreach($GLOBALS['EXT_CONF'] as $extname=>$extconf) { | ||||
| 			if(!isset($extconf['disable']) || $extconf['disable'] == false) { | ||||
| 				/* check dependency on specific seeddms version */ | ||||
| 				if(isset($extconf['constraints']['depends']['seeddms'])) { | ||||
| 					$tmp = explode('-', $extconf['constraints']['depends']['seeddms'], 2); | ||||
| 					if(cmpVersion($tmp[0], $version->version()) > 0 || ($tmp[1] && cmpVersion($tmp[1], $version->version()) < 0)) | ||||
| 						$errmsgs[] = sprintf("Incorrect SeedDMS version (needs version %s)", $extconf['constraints']['depends']['seeddms']); | ||||
| 				} else { | ||||
| 					$errmsgs[] = "Missing dependency on SeedDMS"; | ||||
| 				} | ||||
| 
 | ||||
| 				/* check dependency on specific php version */ | ||||
| 				if(isset($extconf['constraints']['depends']['php'])) { | ||||
| 					$tmp = explode('-', $extconf['constraints']['depends']['php'], 2); | ||||
| 					if(cmpVersion($tmp[0], phpversion()) > 0 || ($tmp[1] && cmpVersion($tmp[1], phpversion()) < 0)) | ||||
| 						$errmsgs[] = sprintf("Incorrect PHP version (needs version %s)", $extconf['constraints']['depends']['php']); | ||||
| 				} else { | ||||
| 					$errmsgs[] = "Missing dependency on PHP"; | ||||
| 				} | ||||
| 				if($errmsgs) | ||||
| 					echo "<tr class=\"error\">"; | ||||
| 				else | ||||
| 					echo "<tr class=\"success\">"; | ||||
| 			} else | ||||
| 				echo "<tr class=\"warning\">"; | ||||
| 			echo "<td>"; | ||||
| 			if($extconf['icon']) | ||||
| 				echo "<img src=\"".$httproot."ext/".$extname."/".$extconf['icon']."\">"; | ||||
| 			echo "</td>"; | ||||
| 			echo "<td>".$extconf['title']."<br /><small>".$extconf['description']."</small>"; | ||||
| 			if($errmsgs) | ||||
| 				echo "<div><img src=\"".$this->getImgPath("attention.gif")."\"> ".implode('<br />', $errmsgs)."</div>"; | ||||
| 			echo "</td>"; | ||||
| 			echo "<td>".$extconf['version']."<br /><small>".$extconf['releasedate']."</small></td>"; | ||||
| 			echo "<td><a href=\"mailto:".$extconf['author']['email']."\">".$extconf['author']['name']."</a><br /><small>".$extconf['author']['company']."</small></td>"; | ||||
| 			echo "</tr>\n"; | ||||
| 		} | ||||
| 		echo "</table>\n"; | ||||
| ?>
 | ||||
| <form action="../op/op.ExtensionMgr.php" name="form1" method="post"> | ||||
|   <?php echo createHiddenFieldWithKey('extensionmgr'); ?>
 | ||||
| 	<p><button type="submit" class="btn"><i class="icon-refresh"></i> <?php printMLText("refresh");?></button></p>
 | ||||
| </form> | ||||
| <?php | ||||
| 		$this->contentContainerEnd(); | ||||
| 		$this->htmlEndPage(); | ||||
| 	} /* }}} */ | ||||
| } | ||||
| ?>
 | ||||
|  | @ -32,6 +32,7 @@ require_once("class.Bootstrap.php"); | |||
| class SeedDMS_View_RemoveDocument extends SeedDMS_Bootstrap_Style { | ||||
| 
 | ||||
| 	function show() { /* {{{ */ | ||||
| 		parent::show(); | ||||
| 		$dms = $this->params['dms']; | ||||
| 		$user = $this->params['user']; | ||||
| 		$folder = $this->params['folder']; | ||||
|  |  | |||
|  | @ -327,95 +327,100 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style { | |||
| 			$previewer = new SeedDMS_Preview_Previewer($cachedir, 40); | ||||
| 			foreach ($entries as $entry) { | ||||
| 				if(get_class($entry) == 'SeedDMS_Core_Document') { | ||||
| 					$document = $entry; | ||||
| 					$owner = $document->getOwner(); | ||||
| 					$lc = $document->getLatestContent(); | ||||
| 					$version = $lc->getVersion(); | ||||
| 					$previewer->createPreview($lc); | ||||
| 					$txt = $this->callHook('documentListItem', $entry, $previewer); | ||||
| 					if(is_string($txt)) | ||||
| 						echo $txt; | ||||
| 					else { | ||||
| 						$document = $entry; | ||||
| 						$owner = $document->getOwner(); | ||||
| 						$lc = $document->getLatestContent(); | ||||
| 						$version = $lc->getVersion(); | ||||
| 						$previewer->createPreview($lc); | ||||
| 
 | ||||
| 					if (in_array(3, $searchin)) | ||||
| 						$comment = $this->markQuery(htmlspecialchars($document->getComment())); | ||||
| 					else | ||||
| 						$comment = htmlspecialchars($document->getComment()); | ||||
| 					if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; | ||||
| 					print "<tr>"; | ||||
| 					//print "<td><img src=\"../out/images/file.gif\" class=\"mimeicon\"></td>";
 | ||||
| 					if (in_array(2, $searchin)) { | ||||
| 						$docName = $this->markQuery(htmlspecialchars($document->getName()), "i"); | ||||
| 					} else { | ||||
| 						$docName = htmlspecialchars($document->getName()); | ||||
| 					} | ||||
| 					print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">"; | ||||
| 					if($previewer->hasPreview($lc)) { | ||||
| 						print "<img class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$lc->getVersion()."&width=40\" title=\"".htmlspecialchars($lc->getMimeType())."\">"; | ||||
| 					} else { | ||||
| 						print "<img class=\"mimeicon\" src=\"".$this->getMimeIcon($lc->getFileType())."\" title=\"".htmlspecialchars($lc->getMimeType())."\">"; | ||||
| 					} | ||||
| 					print "</a></td>"; | ||||
| 					print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">/"; | ||||
| 					$folder = $document->getFolder(); | ||||
| 					$path = $folder->getPath(); | ||||
| 					for ($i = 1; $i  < count($path); $i++) { | ||||
| 						print htmlspecialchars($path[$i]->getName())."/"; | ||||
| 					} | ||||
| 					print $docName; | ||||
| 					print "</a>"; | ||||
| 				print "<br /><span style=\"font-size: 85%; font-style: italic; color: #666; \">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $document->getDate())."</b>, ".getMLText('version')." <b>".$version."</b> - <b>".date('Y-m-d', $lc->getDate())."</b></span>"; | ||||
| 					if($comment) { | ||||
| 						print "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>"; | ||||
| 					} | ||||
| 					print "</td>"; | ||||
| 
 | ||||
| 					print "<td>"; | ||||
| 					print "<ul class=\"unstyled\">\n"; | ||||
| 					$lcattributes = $lc->getAttributes(); | ||||
| 					if($lcattributes) { | ||||
| 						foreach($lcattributes as $lcattribute) { | ||||
| 							$attrdef = $lcattribute->getAttributeDefinition(); | ||||
| 							print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($lcattribute->getValue())."</li>\n"; | ||||
| 						if (in_array(3, $searchin)) | ||||
| 							$comment = $this->markQuery(htmlspecialchars($document->getComment())); | ||||
| 						else | ||||
| 							$comment = htmlspecialchars($document->getComment()); | ||||
| 						if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; | ||||
| 						print "<tr>"; | ||||
| 						//print "<td><img src=\"../out/images/file.gif\" class=\"mimeicon\"></td>";
 | ||||
| 						if (in_array(2, $searchin)) { | ||||
| 							$docName = $this->markQuery(htmlspecialchars($document->getName()), "i"); | ||||
| 						} else { | ||||
| 							$docName = htmlspecialchars($document->getName()); | ||||
| 						} | ||||
| 					} | ||||
| 					print "</ul>\n"; | ||||
| 					print "<ul class=\"unstyled\">\n"; | ||||
| 					$docttributes = $document->getAttributes(); | ||||
| 					if($docttributes) { | ||||
| 						foreach($docttributes as $docttribute) { | ||||
| 							$attrdef = $docttribute->getAttributeDefinition(); | ||||
| 							print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($docttribute->getValue())."</li>\n"; | ||||
| 						print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">"; | ||||
| 						if($previewer->hasPreview($lc)) { | ||||
| 							print "<img class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$lc->getVersion()."&width=40\" title=\"".htmlspecialchars($lc->getMimeType())."\">"; | ||||
| 						} else { | ||||
| 							print "<img class=\"mimeicon\" src=\"".$this->getMimeIcon($lc->getFileType())."\" title=\"".htmlspecialchars($lc->getMimeType())."\">"; | ||||
| 						} | ||||
| 					} | ||||
| 					print "</ul>\n"; | ||||
| 					print "</td>"; | ||||
| 						print "</a></td>"; | ||||
| 						print "<td><a class=\"standardText\" href=\"../out/out.ViewDocument.php?documentid=".$document->getID()."\">/"; | ||||
| 						$folder = $document->getFolder(); | ||||
| 						$path = $folder->getPath(); | ||||
| 						for ($i = 1; $i  < count($path); $i++) { | ||||
| 							print htmlspecialchars($path[$i]->getName())."/"; | ||||
| 						} | ||||
| 						print $docName; | ||||
| 						print "</a>"; | ||||
| 					print "<br /><span style=\"font-size: 85%; font-style: italic; color: #666; \">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $document->getDate())."</b>, ".getMLText('version')." <b>".$version."</b> - <b>".date('Y-m-d', $lc->getDate())."</b></span>"; | ||||
| 						if($comment) { | ||||
| 							print "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>"; | ||||
| 						} | ||||
| 						print "</td>"; | ||||
| 
 | ||||
| 					$display_status=$lc->getStatus(); | ||||
| 					print "<td>".getOverallStatusText($display_status["status"]). "</td>"; | ||||
| 					print "<td>"; | ||||
| 					print "<div class=\"list-action\">"; | ||||
| 					if($document->getAccessMode($user) >= M_ALL) { | ||||
| ?>
 | ||||
|      <a class_="btn btn-mini" href="../out/out.RemoveDocument.php?documentid=<?php echo $document->getID(); ?>"><i class="icon-remove"></i></a> | ||||
| <?php | ||||
| 					} else { | ||||
| ?>
 | ||||
|      <span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span> | ||||
| <?php | ||||
| 					} | ||||
| 					if($document->getAccessMode($user) >= M_READWRITE) { | ||||
| ?>
 | ||||
|      <a href="../out/out.EditDocument.php?documentid=<?php echo $document->getID(); ?>"><i class="icon-edit"></i></a> | ||||
| <?php | ||||
| 					} else { | ||||
| ?>
 | ||||
|      <span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span> | ||||
| <?php | ||||
| 					} | ||||
| ?>
 | ||||
|      <a class="addtoclipboard" rel="<?php echo "D".$document->getID(); ?>" msg="<?php printMLText('splash_added_to_clipboard'); ?>" _href="../op/op.AddToClipboard.php?documentid=<?php echo $document->getID(); ?>&type=document&id=<?php echo $document->getID(); ?>&refferer=<?php echo urlencode($this->params['refferer']); ?>" title="<?php printMLText("add_to_clipboard");?>"><i class="icon-copy"></i></a> | ||||
| <?php | ||||
| 					print "</div>"; | ||||
| 					print "</td>"; | ||||
| 						print "<td>"; | ||||
| 						print "<ul class=\"unstyled\">\n"; | ||||
| 						$lcattributes = $lc->getAttributes(); | ||||
| 						if($lcattributes) { | ||||
| 							foreach($lcattributes as $lcattribute) { | ||||
| 								$attrdef = $lcattribute->getAttributeDefinition(); | ||||
| 								print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($lcattribute->getValue())."</li>\n"; | ||||
| 							} | ||||
| 						} | ||||
| 						print "</ul>\n"; | ||||
| 						print "<ul class=\"unstyled\">\n"; | ||||
| 						$docttributes = $document->getAttributes(); | ||||
| 						if($docttributes) { | ||||
| 							foreach($docttributes as $docttribute) { | ||||
| 								$attrdef = $docttribute->getAttributeDefinition(); | ||||
| 								print "<li>".htmlspecialchars($attrdef->getName()).": ".htmlspecialchars($docttribute->getValue())."</li>\n"; | ||||
| 							} | ||||
| 						} | ||||
| 						print "</ul>\n"; | ||||
| 						print "</td>"; | ||||
| 
 | ||||
| 					print "</tr>\n"; | ||||
| 						$display_status=$lc->getStatus(); | ||||
| 						print "<td>".getOverallStatusText($display_status["status"]). "</td>"; | ||||
| 						print "<td>"; | ||||
| 						print "<div class=\"list-action\">"; | ||||
| 						if($document->getAccessMode($user) >= M_ALL) { | ||||
| 	?>
 | ||||
| 			 <a class_="btn btn-mini" href="../out/out.RemoveDocument.php?documentid=<?php echo $document->getID(); ?>"><i class="icon-remove"></i></a> | ||||
| 	<?php | ||||
| 						} else { | ||||
| 	?>
 | ||||
| 			 <span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span> | ||||
| 	<?php | ||||
| 						} | ||||
| 						if($document->getAccessMode($user) >= M_READWRITE) { | ||||
| 	?>
 | ||||
| 			 <a href="../out/out.EditDocument.php?documentid=<?php echo $document->getID(); ?>"><i class="icon-edit"></i></a> | ||||
| 	<?php | ||||
| 						} else { | ||||
| 	?>
 | ||||
| 			 <span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span> | ||||
| 	<?php | ||||
| 						} | ||||
| 	?>
 | ||||
| 			 <a class="addtoclipboard" rel="<?php echo "D".$document->getID(); ?>" msg="<?php printMLText('splash_added_to_clipboard'); ?>" _href="../op/op.AddToClipboard.php?documentid=<?php echo $document->getID(); ?>&type=document&id=<?php echo $document->getID(); ?>&refferer=<?php echo urlencode($this->params['refferer']); ?>" title="<?php printMLText("add_to_clipboard");?>"><i class="icon-copy"></i></a> | ||||
| 	<?php | ||||
| 						print "</div>"; | ||||
| 						print "</td>"; | ||||
| 
 | ||||
| 						print "</tr>\n"; | ||||
| 					} | ||||
| 				} elseif(get_class($entry) == 'SeedDMS_Core_Folder') { | ||||
| 					$folder = $entry; | ||||
| 					$owner = $folder->getOwner(); | ||||
|  |  | |||
|  | @ -58,6 +58,7 @@ if(!is_writeable($settings->_configFilePath)) { | |||
| 	  <li class="active"><a data-target="#site" data-toggle="tab"><?php printMLText('settings_Site'); ?></a></li>
 | ||||
| 	  <li><a data-target="#system" data-toggle="tab"><?php printMLText('settings_System'); ?></a></li>
 | ||||
| 	  <li><a data-target="#advanced" data-toggle="tab"><?php printMLText('settings_Advanced'); ?></a></li>
 | ||||
| 	  <li><a data-target="#extensions" data-toggle="tab"><?php printMLText('settings_Extensions'); ?></a></li>
 | ||||
| 	</ul> | ||||
| 
 | ||||
| 	<div class="tab-content"> | ||||
|  | @ -524,6 +525,42 @@ if(!is_writeable($settings->_configFilePath)) { | |||
|     </table> | ||||
| <?php		$this->contentContainerEnd(); ?>
 | ||||
|   </div> | ||||
| 
 | ||||
| 	  <div class="tab-pane" id="extensions"> | ||||
| <?php		$this->contentContainerStart(); ?>
 | ||||
|     <table class="table-condensed"> | ||||
|       <!-- | ||||
|         -- SETTINGS - ADVANCED - DISPLAY | ||||
|       --> | ||||
| <?php | ||||
| 				foreach($GLOBALS['EXT_CONF'] as $extname=>$extconf) { | ||||
| ?>
 | ||||
|       <tr ><td><b><?php echo $extconf['title'];?></b></td></tr>
 | ||||
| <?php | ||||
| 					foreach($extconf['config'] as $confkey=>$conf) { | ||||
| ?>
 | ||||
|       <tr title="<?php echo $extconf['title'];?>"> | ||||
|         <td><?php echo $conf['title'];?>:</td><td>
 | ||||
| <?php | ||||
| 						switch($conf['type']) { | ||||
| 							case 'checkbox': | ||||
| ?>
 | ||||
|         <input type="checkbox" name="<?php echo "extensions[".$extname."][".$confkey."]"; ?>" value="1" <?php if(isset($settings->_extensions[$extname][$confkey]) && $settings->_extensions[$extname][$confkey]) echo 'checked'; ?> />
 | ||||
| <?php | ||||
| 								break; | ||||
| 							default: | ||||
| ?>
 | ||||
|         <input type="text" name="<?php echo "extensions[".$extname."][".$confkey."]"; ?>" title="<?php echo isset($conf['help']) ? $conf['help'] : ''; ?>" value="<?php if(isset($settings->_extensions[$extname][$confkey])) echo $settings->_extensions[$extname][$confkey]; ?>" size="<?php echo $conf['size']; ?>" /> | ||||
| <?php | ||||
| 						} | ||||
| ?>
 | ||||
|       </td></tr> | ||||
| <?php | ||||
| 					} | ||||
| 				} | ||||
| ?>
 | ||||
| 		</table> | ||||
| 	</div> | ||||
|   </div> | ||||
| <?php | ||||
| if(is_writeable($settings->_configFilePath)) { | ||||
|  |  | |||
|  | @ -72,6 +72,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { | |||
| 	} /* }}} */ | ||||
| 
 | ||||
| 	function show() { /* {{{ */ | ||||
| 		parent::show(); | ||||
| 		$dms = $this->params['dms']; | ||||
| 		$user = $this->params['user']; | ||||
| 		$folder = $this->params['folder']; | ||||
|  |  | |||
|  | @ -90,7 +90,14 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style { | |||
| 
 | ||||
| 		$this->globalNavigation($folder); | ||||
| 		$this->contentStart(); | ||||
| 		$this->pageNavigation($this->getFolderPathHTML($folder), "view_folder", $folder); | ||||
| 		$txt = $this->callHook('folderMenu', $folder); | ||||
| 		if(is_string($txt)) | ||||
| 			echo $txt; | ||||
| 		else { | ||||
| 			$this->pageNavigation($this->getFolderPathHTML($folder), "view_folder", $folder); | ||||
| 		} | ||||
| 
 | ||||
| 		echo $this->callHook('preContent'); | ||||
| 
 | ||||
| 		echo "<div class=\"row-fluid\">\n"; | ||||
| 
 | ||||
|  | @ -120,68 +127,76 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style { | |||
| 				} else { | ||||
| 					$this->contentHeading("<a href=\"../out/out.ViewFolder.php?folderid=". $folderid."&showtree=1\"><i class=\"icon-plus-sign\"></i></a>", true); | ||||
| 				} | ||||
| 				if ($enableClipboard) $this->printClipboard($this->params['session']->getClipboard()); | ||||
| 				echo "</div>\n"; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		echo $this->callHook('leftContent'); | ||||
| 
 | ||||
| 		if ($enableClipboard) $this->printClipboard($this->params['session']->getClipboard()); | ||||
| 		echo "</div>\n"; | ||||
| 		echo "<div class=\"span".$RightColumnSpan."\">\n"; | ||||
| 
 | ||||
| 		$this->contentHeading(getMLText("folder_infos")); | ||||
| 		$txt = $this->callHook('folderInfo', $folder); | ||||
| 		if(is_string($txt)) | ||||
| 			echo $txt; | ||||
| 		else { | ||||
| 			$this->contentHeading(getMLText("folder_infos")); | ||||
| 
 | ||||
| 		$owner = $folder->getOwner(); | ||||
| 		$this->contentContainerStart(); | ||||
| 		echo "<table class=\"table-condensed\">\n"; | ||||
| 		if($user->isAdmin()) { | ||||
| 			echo "<tr>"; | ||||
| 			echo "<td>".getMLText("id").":</td>\n"; | ||||
| 			echo "<td>".htmlspecialchars($folder->getID())."</td>\n"; | ||||
| 			echo "</tr>"; | ||||
| 		} | ||||
| 		echo "<tr>"; | ||||
| 		echo "<td>".getMLText("owner").":</td>\n"; | ||||
| 		echo "<td><a href=\"mailto:".htmlspecialchars($owner->getEmail())."\">".htmlspecialchars($owner->getFullName())."</a></td>\n"; | ||||
| 		echo "</tr>"; | ||||
| 		if($folder->getComment()) { | ||||
| 			echo "<tr>"; | ||||
| 			echo "<td>".getMLText("comment").":</td>\n"; | ||||
| 			echo "<td>".htmlspecialchars($folder->getComment())."</td>\n"; | ||||
| 			echo "</tr>"; | ||||
| 		} | ||||
| 
 | ||||
| 		if($user->isAdmin()) { | ||||
| 			if($folder->inheritsAccess()) { | ||||
| 			$owner = $folder->getOwner(); | ||||
| 			$this->contentContainerStart(); | ||||
| 			echo "<table class=\"table-condensed\">\n"; | ||||
| 			if($user->isAdmin()) { | ||||
| 				echo "<tr>"; | ||||
| 				echo "<td>".getMLText("access_mode").":</td>\n"; | ||||
| 				echo "<td>"; | ||||
| 				echo getMLText("inherited"); | ||||
| 				echo "</tr>"; | ||||
| 			} else { | ||||
| 				echo "<tr>"; | ||||
| 				echo "<td>".getMLText('default_access').":</td>"; | ||||
| 				echo "<td>".$this->getAccessModeText($folder->getDefaultAccess())."</td>"; | ||||
| 				echo "</tr>"; | ||||
| 				echo "<tr>"; | ||||
| 				echo "<td>".getMLText('access_mode').":</td>"; | ||||
| 				echo "<td>"; | ||||
| 				$this->printAccessList($folder); | ||||
| 				echo "</td>"; | ||||
| 				echo "<td>".getMLText("id").":</td>\n"; | ||||
| 				echo "<td>".htmlspecialchars($folder->getID())."</td>\n"; | ||||
| 				echo "</tr>"; | ||||
| 			} | ||||
| 		} | ||||
| 		$attributes = $folder->getAttributes(); | ||||
| 		if($attributes) { | ||||
| 			foreach($attributes as $attribute) { | ||||
| 				$attrdef = $attribute->getAttributeDefinition(); | ||||
| 		?>
 | ||||
| 				<tr> | ||||
| 				<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
 | ||||
| 				<td><?php echo htmlspecialchars($attribute->getValue()); ?></td>
 | ||||
| 				</tr> | ||||
| 		<?php | ||||
| 			echo "<tr>"; | ||||
| 			echo "<td>".getMLText("owner").":</td>\n"; | ||||
| 			echo "<td><a href=\"mailto:".htmlspecialchars($owner->getEmail())."\">".htmlspecialchars($owner->getFullName())."</a></td>\n"; | ||||
| 			echo "</tr>"; | ||||
| 			if($folder->getComment()) { | ||||
| 				echo "<tr>"; | ||||
| 				echo "<td>".getMLText("comment").":</td>\n"; | ||||
| 				echo "<td>".htmlspecialchars($folder->getComment())."</td>\n"; | ||||
| 				echo "</tr>"; | ||||
| 			} | ||||
| 
 | ||||
| 			if($user->isAdmin()) { | ||||
| 				if($folder->inheritsAccess()) { | ||||
| 					echo "<tr>"; | ||||
| 					echo "<td>".getMLText("access_mode").":</td>\n"; | ||||
| 					echo "<td>"; | ||||
| 					echo getMLText("inherited"); | ||||
| 					echo "</tr>"; | ||||
| 				} else { | ||||
| 					echo "<tr>"; | ||||
| 					echo "<td>".getMLText('default_access').":</td>"; | ||||
| 					echo "<td>".$this->getAccessModeText($folder->getDefaultAccess())."</td>"; | ||||
| 					echo "</tr>"; | ||||
| 					echo "<tr>"; | ||||
| 					echo "<td>".getMLText('access_mode').":</td>"; | ||||
| 					echo "<td>"; | ||||
| 					$this->printAccessList($folder); | ||||
| 					echo "</td>"; | ||||
| 					echo "</tr>"; | ||||
| 				} | ||||
| 			} | ||||
| 			$attributes = $folder->getAttributes(); | ||||
| 			if($attributes) { | ||||
| 				foreach($attributes as $attribute) { | ||||
| 					$attrdef = $attribute->getAttributeDefinition(); | ||||
| 			?>
 | ||||
| 					<tr> | ||||
| 					<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
 | ||||
| 					<td><?php echo htmlspecialchars($attribute->getValue()); ?></td>
 | ||||
| 					</tr> | ||||
| 			<?php | ||||
| 				} | ||||
| 			} | ||||
| 			echo "</table>\n"; | ||||
| 			$this->contentContainerEnd(); | ||||
| 		} | ||||
| 		echo "</table>\n"; | ||||
| 		$this->contentContainerEnd(); | ||||
| 
 | ||||
| 		$this->contentHeading(getMLText("folder_contents")); | ||||
| 
 | ||||
|  | @ -205,166 +220,174 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style { | |||
| 
 | ||||
| 
 | ||||
| 		foreach($subFolders as $subFolder) { | ||||
| 
 | ||||
| 			$owner = $subFolder->getOwner(); | ||||
| 			$comment = $subFolder->getComment(); | ||||
| 			if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; | ||||
| 			$subsub = $subFolder->getSubFolders(); | ||||
| 			$subsub = SeedDMS_Core_DMS::filterAccess($subsub, $user, M_READ); | ||||
| 			$subdoc = $subFolder->getDocuments(); | ||||
| 			$subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ); | ||||
| 			 | ||||
| 			print "<tr rel=\"folder_".$subFolder->getID()."\" class=\"folder\" ondragover=\"allowDrop(event)\" ondrop=\"onDrop(event)\">"; | ||||
| 		//	print "<td><img src=\"images/folder_closed.gif\" width=18 height=18 border=0></td>";
 | ||||
| 			print "<td><a rel=\"folder_".$subFolder->getID()."\" draggable=\"true\" ondragstart=\"onDragStartFolder(event);\" href=\"out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\"><img draggable=\"false\" src=\"".$this->imgpath."folder.png\" width=\"24\" height=\"24\" border=0></a></td>\n"; | ||||
| 			print "<td><a href=\"out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . "</a>"; | ||||
| 			print "<br /><span style=\"font-size: 85%; font-style: italic; color: #666;\">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $subFolder->getDate())."</b></span>"; | ||||
| 			if($comment) { | ||||
| 				print "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>"; | ||||
| 			} | ||||
| 			print "</td>\n"; | ||||
| //			print "<td>".htmlspecialchars($owner->getFullName())."</td>";
 | ||||
| 			print "<td colspan=\"1\" nowrap><small>"; | ||||
| 			if($enableRecursiveCount) { | ||||
| 				if($user->isAdmin()) { | ||||
| 					/* No need to check for access rights in countChildren() for | ||||
| 					 * admin. So pass 0 as the limit. | ||||
| 					 */ | ||||
| 					$cc = $subFolder->countChildren($user, 0); | ||||
| 					print $cc['folder_count']." ".getMLText("folders")."<br />".$cc['document_count']." ".getMLText("documents"); | ||||
| 				} else { | ||||
| 					$cc = $subFolder->countChildren($user, $maxRecursiveCount); | ||||
| 					if($maxRecursiveCount > 5000) | ||||
| 						$rr = 100.0; | ||||
| 					else | ||||
| 						$rr = 10.0; | ||||
| 					print (!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ".getMLText("folders")."<br />".(!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents"); | ||||
| 				} | ||||
| 			} else { | ||||
| 				print count($subsub)." ".getMLText("folders")."<br />".count($subdoc)." ".getMLText("documents"); | ||||
| 			} | ||||
| 			print "</small></td>"; | ||||
| //			print "<td></td>";
 | ||||
| 			print "<td>"; | ||||
| 			print "<div class=\"list-action\">"; | ||||
| 			if($subFolder->getAccessMode($user) >= M_ALL) { | ||||
| ?>
 | ||||
|      <a class_="btn btn-mini" href="../out/out.RemoveFolder.php?folderid=<?php echo $subFolder->getID(); ?>"><i class="icon-remove"></i></a> | ||||
| <?php | ||||
| 			} else { | ||||
| ?>
 | ||||
|      <span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span> | ||||
| <?php | ||||
| 			} | ||||
| 			if($subFolder->getAccessMode($user) >= M_READWRITE) { | ||||
| ?>
 | ||||
|      <a class_="btn btn-mini" href="../out/out.EditFolder.php?folderid=<?php echo $subFolder->getID(); ?>"><i class="icon-edit"></i></a> | ||||
| <?php | ||||
| 			} else { | ||||
| ?>
 | ||||
|      <span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span> | ||||
| <?php | ||||
| 			} | ||||
| ?>
 | ||||
|      <a class="addtoclipboard" rel="<?php echo "F".$subFolder->getID(); ?>" msg="<?php printMLText('splash_added_to_clipboard'); ?>" _href="../op/op.AddToClipboard.php?folderid=<?php echo $folder->getID(); ?>&type=folder&id=<?php echo $subFolder->getID(); ?>" title="<?php printMLText("add_to_clipboard");?>"><i class="icon-copy"></i></a> | ||||
| <?php | ||||
| 			print "</div>"; | ||||
| 			print "</td>"; | ||||
| 			print "</tr>\n"; | ||||
| 		} | ||||
| 
 | ||||
| 		$previewer = new SeedDMS_Preview_Previewer($cachedir, 40); | ||||
| 		foreach($documents as $document) { | ||||
| 
 | ||||
| 			$owner = $document->getOwner(); | ||||
| 			$comment = $document->getComment(); | ||||
| 			if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; | ||||
| 			$docID = $document->getID(); | ||||
| 			if($latestContent = $document->getLatestContent()) { | ||||
| 				$previewer->createPreview($latestContent); | ||||
| 				$version = $latestContent->getVersion(); | ||||
| 				$status = $latestContent->getStatus(); | ||||
| 				$needwkflaction = false; | ||||
| 				if($workflowmode == 'advanced') { | ||||
| 					$workflow = $latestContent->getWorkflow(); | ||||
| 					if($workflow) { | ||||
| 						$needwkflaction = $latestContent->needsWorkflowAction($user); | ||||
| 					} | ||||
| 				} | ||||
| 			$txt = $this->callHook('folderListItem', $subFolder); | ||||
| 			if(is_string($txt)) | ||||
| 				echo $txt; | ||||
| 			else { | ||||
| 				$owner = $subFolder->getOwner(); | ||||
| 				$comment = $subFolder->getComment(); | ||||
| 				if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; | ||||
| 				$subsub = $subFolder->getSubFolders(); | ||||
| 				$subsub = SeedDMS_Core_DMS::filterAccess($subsub, $user, M_READ); | ||||
| 				$subdoc = $subFolder->getDocuments(); | ||||
| 				$subdoc = SeedDMS_Core_DMS::filterAccess($subdoc, $user, M_READ); | ||||
| 				 | ||||
| 				/* Retrieve attacheѕ files */ | ||||
| 				$files = $document->getDocumentFiles(); | ||||
| 
 | ||||
| 				/* Retrieve linked documents */ | ||||
| 				$links = $document->getDocumentLinks(); | ||||
| 				$links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links); | ||||
| 
 | ||||
| 				print "<tr>"; | ||||
| 
 | ||||
| 				if (file_exists($dms->contentDir . $latestContent->getPath())) { | ||||
| 					print "<td><a rel=\"document_".$docID."\" draggable=\"true\" ondragstart=\"onDragStartDocument(event);\" href=\"../op/op.Download.php?documentid=".$docID."&version=".$version."\">"; | ||||
| 					if($previewer->hasPreview($latestContent)) { | ||||
| 						print "<img draggable=\"false\" class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; | ||||
| 					} else { | ||||
| 						print "<img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; | ||||
| 					} | ||||
| 					print "</a></td>"; | ||||
| 				} else | ||||
| 					print "<td><img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></td>"; | ||||
| 				 | ||||
| 				print "<td><a href=\"out.ViewDocument.php?documentid=".$docID."&showtree=".$showtree."\">" . htmlspecialchars($document->getName()) . "</a>"; | ||||
| 				print "<br /><span style=\"font-size: 85%; font-style: italic; color: #666; \">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $document->getDate())."</b>, ".getMLText('version')." <b>".$version."</b> - <b>".date('Y-m-d', $latestContent->getDate())."</b></span>"; | ||||
| 				print "<tr rel=\"folder_".$subFolder->getID()."\" class=\"folder\" ondragover=\"allowDrop(event)\" ondrop=\"onDrop(event)\">"; | ||||
| 			//	print "<td><img src=\"images/folder_closed.gif\" width=18 height=18 border=0></td>";
 | ||||
| 				print "<td><a rel=\"folder_".$subFolder->getID()."\" draggable=\"true\" ondragstart=\"onDragStartFolder(event);\" href=\"out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\"><img draggable=\"false\" src=\"".$this->imgpath."folder.png\" width=\"24\" height=\"24\" border=0></a></td>\n"; | ||||
| 				print "<td><a href=\"out.ViewFolder.php?folderid=".$subFolder->getID()."&showtree=".$showtree."\">" . htmlspecialchars($subFolder->getName()) . "</a>"; | ||||
| 				print "<br /><span style=\"font-size: 85%; font-style: italic; color: #666;\">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $subFolder->getDate())."</b></span>"; | ||||
| 				if($comment) { | ||||
| 					print "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>"; | ||||
| 				} | ||||
| 				print "</td>\n"; | ||||
| //				print "<td>".htmlspecialchars($owner->getFullName())."</td>";
 | ||||
| 				print "<td nowrap>"; | ||||
| 				$attentionstr = ''; | ||||
| 				if ( $document->isLocked() ) { | ||||
| 					$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> "; | ||||
| 	//			print "<td>".htmlspecialchars($owner->getFullName())."</td>";
 | ||||
| 				print "<td colspan=\"1\" nowrap><small>"; | ||||
| 				if($enableRecursiveCount) { | ||||
| 					if($user->isAdmin()) { | ||||
| 						/* No need to check for access rights in countChildren() for | ||||
| 						 * admin. So pass 0 as the limit. | ||||
| 						 */ | ||||
| 						$cc = $subFolder->countChildren($user, 0); | ||||
| 						print $cc['folder_count']." ".getMLText("folders")."<br />".$cc['document_count']." ".getMLText("documents"); | ||||
| 					} else { | ||||
| 						$cc = $subFolder->countChildren($user, $maxRecursiveCount); | ||||
| 						if($maxRecursiveCount > 5000) | ||||
| 							$rr = 100.0; | ||||
| 						else | ||||
| 							$rr = 10.0; | ||||
| 						print (!$cc['folder_precise'] ? '~'.(round($cc['folder_count']/$rr)*$rr) : $cc['folder_count'])." ".getMLText("folders")."<br />".(!$cc['document_precise'] ? '~'.(round($cc['document_count']/$rr)*$rr) : $cc['document_count'])." ".getMLText("documents"); | ||||
| 					} | ||||
| 				} else { | ||||
| 					print count($subsub)." ".getMLText("folders")."<br />".count($subdoc)." ".getMLText("documents"); | ||||
| 				} | ||||
| 				if ( $needwkflaction ) { | ||||
| 					$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": "."\"> "; | ||||
| 				} | ||||
| 				if($attentionstr) | ||||
| 					print $attentionstr."<br />"; | ||||
| 				print "<small>"; | ||||
| 				if(count($files)) | ||||
| 					print count($files)." ".getMLText("linked_files")."<br />"; | ||||
| 				if(count($links)) | ||||
| 					print count($links)." ".getMLText("linked_documents")."<br />"; | ||||
| 				print getOverallStatusText($status["status"])."</small></td>"; | ||||
| //				print "<td>".$version."</td>";
 | ||||
| 				print "</small></td>"; | ||||
| 	//			print "<td></td>";
 | ||||
| 				print "<td>"; | ||||
| 				print "<div class=\"list-action\">"; | ||||
| 				if($document->getAccessMode($user) >= M_ALL) { | ||||
| ?>
 | ||||
|      <a class_="btn btn-mini" href="../out/out.RemoveDocument.php?documentid=<?php echo $docID; ?>"><i class="icon-remove"></i></a> | ||||
| <?php | ||||
| 				if($subFolder->getAccessMode($user) >= M_ALL) { | ||||
| 	?>
 | ||||
| 			 <a class_="btn btn-mini" href="../out/out.RemoveFolder.php?folderid=<?php echo $subFolder->getID(); ?>"><i class="icon-remove"></i></a> | ||||
| 	<?php | ||||
| 				} else { | ||||
| ?>
 | ||||
|      <span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span> | ||||
| <?php | ||||
| 	?>
 | ||||
| 			 <span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span> | ||||
| 	<?php | ||||
| 				} | ||||
| 				if($document->getAccessMode($user) >= M_READWRITE) { | ||||
| ?>
 | ||||
|      <a href="../out/out.EditDocument.php?documentid=<?php echo $docID; ?>"><i class="icon-edit"></i></a> | ||||
| <?php | ||||
| 				if($subFolder->getAccessMode($user) >= M_READWRITE) { | ||||
| 	?>
 | ||||
| 			 <a class_="btn btn-mini" href="../out/out.EditFolder.php?folderid=<?php echo $subFolder->getID(); ?>"><i class="icon-edit"></i></a> | ||||
| 	<?php | ||||
| 				} else { | ||||
| ?>
 | ||||
|      <span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span> | ||||
| <?php | ||||
| 	?>
 | ||||
| 			 <span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span> | ||||
| 	<?php | ||||
| 				} | ||||
| ?>
 | ||||
|      <a class="addtoclipboard" rel="<?php echo "D".$docID; ?>" msg="<?php printMLText('splash_added_to_clipboard'); ?>" _href="../op/op.AddToClipboard.php?folderid=<?php echo $folder->getID(); ?>&type=document&id=<?php echo $docID; ?>" title="<?php printMLText("add_to_clipboard");?>"><i class="icon-copy"></i></a> | ||||
| <?php | ||||
| 	?>
 | ||||
| 			 <a class="addtoclipboard" rel="<?php echo "F".$subFolder->getID(); ?>" msg="<?php printMLText('splash_added_to_clipboard'); ?>" _href="../op/op.AddToClipboard.php?folderid=<?php echo $folder->getID(); ?>&type=folder&id=<?php echo $subFolder->getID(); ?>" title="<?php printMLText("add_to_clipboard");?>"><i class="icon-copy"></i></a> | ||||
| 	<?php | ||||
| 				print "</div>"; | ||||
| 				print "</td>"; | ||||
| 				print "</tr>\n"; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		$previewer = new SeedDMS_Preview_Previewer($cachedir, 40); | ||||
| 		foreach($documents as $document) { | ||||
| 			$txt = $this->callHook('documentListItem', $document, $previewer); | ||||
| 			if(is_string($txt)) | ||||
| 				echo $txt; | ||||
| 			else { | ||||
| 				$owner = $document->getOwner(); | ||||
| 				$comment = $document->getComment(); | ||||
| 				if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; | ||||
| 				$docID = $document->getID(); | ||||
| 				if($latestContent = $document->getLatestContent()) { | ||||
| 					$previewer->createPreview($latestContent); | ||||
| 					$version = $latestContent->getVersion(); | ||||
| 					$status = $latestContent->getStatus(); | ||||
| 					$needwkflaction = false; | ||||
| 					if($workflowmode == 'advanced') { | ||||
| 						$workflow = $latestContent->getWorkflow(); | ||||
| 						if($workflow) { | ||||
| 							$needwkflaction = $latestContent->needsWorkflowAction($user); | ||||
| 						} | ||||
| 					} | ||||
| 					 | ||||
| 					/* Retrieve attacheѕ files */ | ||||
| 					$files = $document->getDocumentFiles(); | ||||
| 
 | ||||
| 					/* Retrieve linked documents */ | ||||
| 					$links = $document->getDocumentLinks(); | ||||
| 					$links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links); | ||||
| 
 | ||||
| 					print "<tr>"; | ||||
| 
 | ||||
| 					if (file_exists($dms->contentDir . $latestContent->getPath())) { | ||||
| 						print "<td><a rel=\"document_".$docID."\" draggable=\"true\" ondragstart=\"onDragStartDocument(event);\" href=\"../op/op.Download.php?documentid=".$docID."&version=".$version."\">"; | ||||
| 						if($previewer->hasPreview($latestContent)) { | ||||
| 							print "<img draggable=\"false\" class=\"mimeicon\" width=\"40\"src=\"../op/op.Preview.php?documentid=".$document->getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; | ||||
| 						} else { | ||||
| 							print "<img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; | ||||
| 						} | ||||
| 						print "</a></td>"; | ||||
| 					} else | ||||
| 						print "<td><img draggable=\"false\" class=\"mimeicon\" src=\"".$this->getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\"></td>"; | ||||
| 					 | ||||
| 					print "<td><a href=\"out.ViewDocument.php?documentid=".$docID."&showtree=".$showtree."\">" . htmlspecialchars($document->getName()) . "</a>"; | ||||
| 					print "<br /><span style=\"font-size: 85%; font-style: italic; color: #666; \">".getMLText('owner').": <b>".htmlspecialchars($owner->getFullName())."</b>, ".getMLText('creation_date').": <b>".date('Y-m-d', $document->getDate())."</b>, ".getMLText('version')." <b>".$version."</b> - <b>".date('Y-m-d', $latestContent->getDate())."</b></span>"; | ||||
| 					if($comment) { | ||||
| 						print "<br /><span style=\"font-size: 85%;\">".htmlspecialchars($comment)."</span>"; | ||||
| 					} | ||||
| 					print "</td>\n"; | ||||
| 	//				print "<td>".htmlspecialchars($owner->getFullName())."</td>";
 | ||||
| 					print "<td nowrap>"; | ||||
| 					$attentionstr = ''; | ||||
| 					if ( $document->isLocked() ) { | ||||
| 						$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> "; | ||||
| 					} | ||||
| 					if ( $needwkflaction ) { | ||||
| 						$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": "."\"> "; | ||||
| 					} | ||||
| 					if($attentionstr) | ||||
| 						print $attentionstr."<br />"; | ||||
| 					print "<small>"; | ||||
| 					if(count($files)) | ||||
| 						print count($files)." ".getMLText("linked_files")."<br />"; | ||||
| 					if(count($links)) | ||||
| 						print count($links)." ".getMLText("linked_documents")."<br />"; | ||||
| 					print getOverallStatusText($status["status"])."</small></td>"; | ||||
| 	//				print "<td>".$version."</td>";
 | ||||
| 					print "<td>"; | ||||
| 					print "<div class=\"list-action\">"; | ||||
| 					if($document->getAccessMode($user) >= M_ALL) { | ||||
| 	?>
 | ||||
| 			 <a class_="btn btn-mini" href="../out/out.RemoveDocument.php?documentid=<?php echo $docID; ?>"><i class="icon-remove"></i></a> | ||||
| 	<?php | ||||
| 					} else { | ||||
| 	?>
 | ||||
| 			 <span style="padding: 2px; color: #CCC;"><i class="icon-remove"></i></span> | ||||
| 	<?php | ||||
| 					} | ||||
| 					if($document->getAccessMode($user) >= M_READWRITE) { | ||||
| 	?>
 | ||||
| 			 <a href="../out/out.EditDocument.php?documentid=<?php echo $docID; ?>"><i class="icon-edit"></i></a> | ||||
| 	<?php | ||||
| 					} else { | ||||
| 	?>
 | ||||
| 			 <span style="padding: 2px; color: #CCC;"><i class="icon-edit"></i></span> | ||||
| 	<?php | ||||
| 					} | ||||
| 	?>
 | ||||
| 			 <a class="addtoclipboard" rel="<?php echo "D".$docID; ?>" msg="<?php printMLText('splash_added_to_clipboard'); ?>" _href="../op/op.AddToClipboard.php?folderid=<?php echo $folder->getID(); ?>&type=document&id=<?php echo $docID; ?>" title="<?php printMLText("add_to_clipboard");?>"><i class="icon-copy"></i></a> | ||||
| 	<?php | ||||
| 					print "</div>"; | ||||
| 					print "</td>"; | ||||
| 					print "</tr>\n"; | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		if ((count($subFolders) > 0)||(count($documents) > 0)) echo "</tbody>\n</table>\n"; | ||||
| 
 | ||||
| 
 | ||||
|  | @ -372,6 +395,8 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style { | |||
| 
 | ||||
| 		$this->contentEnd(); | ||||
| 
 | ||||
| 		echo $this->callHook('postContent'); | ||||
| 
 | ||||
| 		$this->htmlEndPage(); | ||||
| 	} /* }}} */ | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann