mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 08:55:54 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
54dabfed93
|
@ -139,6 +139,46 @@ class SeedDMS_Controller_Common {
|
|||
$this->errormsg = $msg;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Return a list of hook classes for the current class
|
||||
*
|
||||
* Hooks are associated to a controller class. Calling a hook with
|
||||
* SeedDMS_View_Common::callHook() will run through a list of
|
||||
* controller classes searching for the hook. This method returns this
|
||||
* list.
|
||||
*
|
||||
* If a controller is implemented in SeedDMS_View_Example which inherits
|
||||
* from SeedDMS_Theme_Style which again inherits from SeedDMS_View_Common,
|
||||
* then this method will return an array with the elments:
|
||||
* 'Example', 'Style', 'Common'. If SeedDMS_View_Example also sets
|
||||
* the class property 'controllerAliasName', then this value will be added
|
||||
* to the beginning of the list.
|
||||
*
|
||||
* When a hook is called, it will run through this list and checks
|
||||
* if $GLOBALS['SEEDDMS_HOOKS']['controller'][<element>] exists and contains
|
||||
* an instanciated class. This class must implement the hook.
|
||||
*
|
||||
* @return array list of controller class names.
|
||||
*/
|
||||
protected function getHookClassNames() { /* {{{ */
|
||||
$tmps = array();
|
||||
/* the controllerAliasName can be set in the controller to specify a different name
|
||||
* than extracted from the class name.
|
||||
*/
|
||||
if(property_exists($this, 'controllerAliasName') && !empty($this->controllerAliasName)) {
|
||||
$tmps[] = $this->controllerAliasName;
|
||||
}
|
||||
$tmp = explode('_', get_class($this));
|
||||
$tmps[] = $tmp[2];
|
||||
foreach(class_parents($this) as $pc) {
|
||||
$tmp = explode('_', $pc);
|
||||
$tmps[] = $tmp[2];
|
||||
}
|
||||
/* Run array_unique() in case the parent class has the same suffix */
|
||||
$tmps = array_unique($tmps);
|
||||
return $tmps;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Call all hooks registered for a controller
|
||||
*
|
||||
|
@ -190,17 +230,7 @@ class SeedDMS_Controller_Common {
|
|||
* null if no hook was called
|
||||
*/
|
||||
function callHook($hook) { /* {{{ */
|
||||
$tmps = array();
|
||||
$tmp = explode('_', get_class($this));
|
||||
$tmps[] = $tmp[2];
|
||||
foreach(class_parents($this) as $pc) {
|
||||
$tmp = explode('_', $pc);
|
||||
$tmps[] = $tmp[2];
|
||||
}
|
||||
// $tmp = explode('_', get_parent_class($this));
|
||||
// $tmps[] = $tmp[2];
|
||||
/* Run array_unique() in case the parent class has the same suffix */
|
||||
$tmps = array_unique($tmps);
|
||||
$tmps = $this->getHookClassNames();
|
||||
foreach($tmps as $tmp)
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp)])) {
|
||||
$this->lasthookresult = null;
|
||||
|
@ -242,7 +272,7 @@ class SeedDMS_Controller_Common {
|
|||
* null if no hook was called
|
||||
*/
|
||||
function hasHook($hook) { /* {{{ */
|
||||
$tmp = explode('_', get_class($this));
|
||||
$tmps = $this->getHookClassNames();
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['controller'][lcfirst($tmp[2])] as $hookObj) {
|
||||
if (method_exists($hookObj, $hook)) {
|
||||
|
|
|
@ -95,6 +95,46 @@ class SeedDMS_View_Common {
|
|||
public function show() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of hook classes for the current class
|
||||
*
|
||||
* Hooks are associated to a view class. Calling a hook with
|
||||
* SeedDMS_View_Common::callHook() will run through a list of
|
||||
* view classes searching for the hook. This method returns this
|
||||
* list.
|
||||
*
|
||||
* If a view is implemented in SeedDMS_View_Example which inherits
|
||||
* from SeedDMS_Theme_Style which again inherits from SeedDMS_View_Common,
|
||||
* then this method will return an array with the elments:
|
||||
* 'Example', 'Style', 'Common'. If SeedDMS_View_Example also sets
|
||||
* the class property 'viewAliasName', then this value will be added
|
||||
* to the beginning of the list.
|
||||
*
|
||||
* When a hook is called, it will run through this list and checks
|
||||
* if $GLOBALS['SEEDDMS_HOOKS']['view'][<element>] exists and contains
|
||||
* an instanciated class. This class must implement the hook.
|
||||
*
|
||||
* @return array list of view class names.
|
||||
*/
|
||||
protected function getHookClassNames() { /* {{{ */
|
||||
$tmps = array();
|
||||
/* the viewAliasName can be set in the view to specify a different name
|
||||
* than extracted from the class name.
|
||||
*/
|
||||
if(property_exists($this, 'viewAliasName') && !empty($this->viewAliasName)) {
|
||||
$tmps[] = $this->viewAliasName;
|
||||
}
|
||||
$tmp = explode('_', get_class($this));
|
||||
$tmps[] = $tmp[2];
|
||||
foreach(class_parents($this) as $pc) {
|
||||
$tmp = explode('_', $pc);
|
||||
$tmps[] = $tmp[2];
|
||||
}
|
||||
/* Run array_unique() in case the parent class has the same suffix */
|
||||
$tmps = array_unique($tmps);
|
||||
return $tmps;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Call a hook with a given name
|
||||
*
|
||||
|
@ -113,15 +153,7 @@ class SeedDMS_View_Common {
|
|||
* function returns
|
||||
*/
|
||||
public function callHook($hook) { /* {{{ */
|
||||
$tmps = array();
|
||||
$tmp = explode('_', get_class($this));
|
||||
$tmps[] = $tmp[2];
|
||||
foreach(class_parents($this) as $pc) {
|
||||
$tmp = explode('_', $pc);
|
||||
$tmps[] = $tmp[2];
|
||||
}
|
||||
/* Run array_unique() in case the parent class has the same suffix */
|
||||
$tmps = array_unique($tmps);
|
||||
$tmps = $this->getHookClassNames();
|
||||
$ret = null;
|
||||
foreach($tmps as $tmp)
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp)])) {
|
||||
|
@ -174,6 +206,9 @@ class SeedDMS_View_Common {
|
|||
* ?>
|
||||
* </code>
|
||||
*
|
||||
* The method does not return hooks for parent classes nor does it
|
||||
* evaluate the viewAliasName property.
|
||||
*
|
||||
* @params string $classname name of class (current class if left empty)
|
||||
* @return array list of hook objects registered for the class
|
||||
*/
|
||||
|
@ -197,14 +232,7 @@ class SeedDMS_View_Common {
|
|||
* null if no hook was called
|
||||
*/
|
||||
public function hasHook($hook) { /* {{{ */
|
||||
$tmps = array();
|
||||
$tmp = explode('_', get_class($this));
|
||||
$tmps[] = $tmp[2];
|
||||
$tmp = explode('_', get_parent_class($this));
|
||||
$tmps[] = $tmp[2];
|
||||
/* Run array_unique() in case the parent class has the same suffix */
|
||||
$tmps = array_unique($tmps);
|
||||
$ret = null;
|
||||
$tmps = $this->getHookClassNames();
|
||||
foreach($tmps as $tmp) {
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp)])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['view'][lcfirst($tmp)] as $hookObj) {
|
||||
|
|
|
@ -74,10 +74,12 @@ $(document).ready( function() {
|
|||
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
|
||||
$this->globalNavigation($folder);
|
||||
$this->contentStart();
|
||||
// $this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
|
||||
$this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder);
|
||||
/*
|
||||
?>
|
||||
<div class="ajax" data-view="ViewFolder" data-action="navigation" data-no-spinner="true" <?php echo ($folder ? "data-query=\"folderid=".$folder->getID()."\"" : "") ?>></div>
|
||||
<?php
|
||||
*/
|
||||
$this->contentHeading(getMLText("add_subfolder"));
|
||||
$this->contentContainerStart();
|
||||
?>
|
||||
|
|
|
@ -79,12 +79,8 @@ class SeedDMS_Theme_Style extends SeedDMS_View_Common {
|
|||
header($name . ": " . $value);
|
||||
}
|
||||
}
|
||||
$hookObjs = $this->getHookObjects('SeedDMS_View_Bootstrap');
|
||||
foreach($hookObjs as $hookObj) {
|
||||
if (method_exists($hookObj, 'startPage')) {
|
||||
$hookObj->startPage($this);
|
||||
}
|
||||
}
|
||||
if($this->hasHook('startPage'))
|
||||
$this->callHook('startPage');
|
||||
echo "<!DOCTYPE html>\n";
|
||||
echo "<html lang=\"en\">\n<head>\n";
|
||||
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
|
||||
|
@ -147,11 +143,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
|||
echo "<div class=\"splash\" data-type=\"".$flashmsg['type']."\"".(!empty($flashmsg['timeout']) ? ' data-timeout="'.$flashmsg['timeout'].'"': '').">".$flashmsg['msg']."</div>\n";
|
||||
}
|
||||
echo "<div class=\"statusbar-container\"><h1>".getMLText('recent_uploads')."</h1></div>\n";
|
||||
foreach($hookObjs as $hookObj) {
|
||||
if (method_exists($hookObj, 'startBody')) {
|
||||
$hookObj->startBody($this);
|
||||
}
|
||||
}
|
||||
if($this->hasHook('startBody'))
|
||||
$this->callHook('startBody');
|
||||
} /* }}} */
|
||||
|
||||
function htmlAddHeader($head, $type='js') { /* {{{ */
|
||||
|
@ -166,13 +159,9 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
|||
|
||||
function htmlEndPage($nofooter=false) { /* {{{ */
|
||||
if(!$nofooter) {
|
||||
$hookObjs = $this->getHookObjects('SeedDMS_View_Bootstrap');
|
||||
$html = $this->footNote();
|
||||
foreach($hookObjs as $hookObj) {
|
||||
if (method_exists($hookObj, 'footNote')) {
|
||||
$html = $hookObj->footNote($this, $html);
|
||||
}
|
||||
}
|
||||
if($this->hasHook('footNote'))
|
||||
$html = $this->callHook('footNote', $html);
|
||||
echo $html;
|
||||
if($this->params['showmissingtranslations']) {
|
||||
$this->missingLanguageKeys();
|
||||
|
@ -400,12 +389,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
|||
$menuitems['my_account'] = array('link'=>"../out/out.MyAccount.php", 'label'=>'my_account');
|
||||
if ($accessobject->check_view_access('TransmittalMgr'))
|
||||
$menuitems['my_transmittals'] = array('link'=>"../out/out.TransmittalMgr.php", 'label'=>'my_transmittals');
|
||||
$hookObjs = $this->getHookObjects('SeedDMS_View_Bootstrap');
|
||||
foreach($hookObjs as $hookObj) {
|
||||
if (method_exists($hookObj, 'userMenuItems')) {
|
||||
$menuitems = $hookObj->userMenuItems($this, $menuitems);
|
||||
}
|
||||
}
|
||||
if($this->hasHook('userMenuItems'))
|
||||
$menuitems = $this->callHook('userMenuItems', $menuitems);
|
||||
if($menuitems) {
|
||||
foreach($menuitems as $menuitem) {
|
||||
echo "<li><a href=\"".$menuitem['link']."\">".getMLText($menuitem['label'])."</a></li>";
|
||||
|
@ -507,11 +492,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
|||
$menuitems['help'] = array('link'=>'../out/out.Help.php?context='.$tmp[1], 'label'=>"help");
|
||||
}
|
||||
/* Check if hook exists because otherwise callHook() will override $menuitems */
|
||||
foreach($hookObjs as $hookObj) {
|
||||
if (method_exists($hookObj, 'globalNavigationBar')) {
|
||||
$menuitems = $hookObj->globalNavigationBar($this, $menuitems);
|
||||
}
|
||||
}
|
||||
if($this->hasHook('globalNavigationBar'))
|
||||
$menuitems = $this->callHook('globalNavigationBar', $menuitems);
|
||||
foreach($menuitems as $menuitem) {
|
||||
if(!empty($menuitem['children'])) {
|
||||
echo " <li class=\"dropdown\">\n";
|
||||
|
|
|
@ -59,7 +59,7 @@ class SeedDMS_View_Info extends SeedDMS_Theme_Style {
|
|||
$this->columnStart(6);
|
||||
$this->contentHeading(getMLText("seeddms_info"));
|
||||
$seedextensions = $extmgr->getExtensionConfiguration();
|
||||
echo "<table class=\"table table-condensed\">\n";
|
||||
echo "<table class=\"table table-condensed table-sm\">\n";
|
||||
echo "<thead>\n<tr>\n";
|
||||
echo "<th>".getMLText("name");
|
||||
echo "</th>\n";
|
||||
|
@ -76,7 +76,7 @@ class SeedDMS_View_Info extends SeedDMS_Theme_Style {
|
|||
$this->columnStart(6);
|
||||
if($user->isAdmin()) {
|
||||
$this->contentHeading(getMLText("php_info"));
|
||||
echo "<table class=\"table table-condensed\">\n";
|
||||
echo "<table class=\"table table-condensed table-sm\">\n";
|
||||
echo "<thead>\n<tr>\n";
|
||||
echo "<th>".getMLText("name");
|
||||
echo "</th>\n";
|
||||
|
@ -87,7 +87,7 @@ class SeedDMS_View_Info extends SeedDMS_Theme_Style {
|
|||
|
||||
$this->contentHeading(getMLText("installed_php_extensions"));
|
||||
$phpextensions = get_loaded_extensions(false);
|
||||
echo "<table class=\"table table-condensed\">\n";
|
||||
echo "<table class=\"table table-condensed table-sm\">\n";
|
||||
echo "<thead>\n<tr>\n";
|
||||
echo "<th>".getMLText("name");
|
||||
echo "</th>\n";
|
||||
|
@ -97,7 +97,7 @@ class SeedDMS_View_Info extends SeedDMS_Theme_Style {
|
|||
echo "</tbody>\n</table>\n";
|
||||
|
||||
$this->contentHeading(getMLText("missing_php_extensions"));
|
||||
echo "<table class=\"table table-condensed\">\n";
|
||||
echo "<table class=\"table table-condensed table-sm\">\n";
|
||||
echo "<thead>\n<tr>\n";
|
||||
echo "<th>".getMLText("name");
|
||||
echo "</th>\n";
|
||||
|
@ -107,11 +107,11 @@ class SeedDMS_View_Info extends SeedDMS_Theme_Style {
|
|||
echo "<tr><td>".$extname."</td><td>"."</td></tr>\n";
|
||||
echo "</tbody>\n</table>\n";
|
||||
|
||||
$this->contentHeading(getMLText("missing_php_functions"));
|
||||
echo "<table class=\"table table-condensed\">\n";
|
||||
$this->contentHeading(getMLText("missing_php_functions_and_classes"));
|
||||
echo "<table class=\"table table-condensed table-sm\">\n";
|
||||
echo "<thead>\n<tr>\n";
|
||||
echo "<th>".getMLText("name");
|
||||
echo "<th>".getMLText("missing_func_note");
|
||||
echo "<th>".getMLText("missing_func_class_note");
|
||||
echo "</th>\n";
|
||||
echo "</tr>\n</thead>\n<tbody>\n";
|
||||
foreach(array('proc_open') as $funcname) {
|
||||
|
@ -119,12 +119,17 @@ class SeedDMS_View_Info extends SeedDMS_Theme_Style {
|
|||
echo "<tr><td>".$funcname."</td><td>".getMLText('func_'.$funcname."_missing")."</td></tr>";
|
||||
}
|
||||
}
|
||||
foreach(array('finfo') as $classname) {
|
||||
if(!class_exists($classname)) {
|
||||
echo "<tr><td>".$classname."</td><td>".getMLText('class_'.$classname."_missing")."</td></tr>";
|
||||
}
|
||||
}
|
||||
echo "</tbody>\n</table>\n";
|
||||
|
||||
if(function_exists('apache_get_modules')) {
|
||||
$this->contentHeading(getMLText("installed_apache_extensions"));
|
||||
$apacheextensions = apache_get_modules();
|
||||
echo "<table class=\"table table-condensed\">\n";
|
||||
echo "<table class=\"table table-condensed table-sm\">\n";
|
||||
echo "<thead>\n<tr>\n";
|
||||
echo "<th>".getMLText("name");
|
||||
echo "</th>\n";
|
||||
|
|
|
@ -36,6 +36,11 @@ require_once("SeedDMS/Preview.php");
|
|||
*/
|
||||
class SeedDMS_View_ViewFolder extends SeedDMS_Theme_Style {
|
||||
|
||||
/**
|
||||
* set a different name which is used to specify the hooks.
|
||||
*/
|
||||
//public $viewAliasName = '';
|
||||
|
||||
function data() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
|
@ -565,7 +570,7 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
|
||||
//$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
|
||||
|
||||
echo $this->callHook('startPage');
|
||||
// echo $this->callHook('startPage');
|
||||
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
|
||||
$this->globalNavigation($folder);
|
||||
$this->contentStart();
|
||||
|
|
Loading…
Reference in New Issue
Block a user