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

This commit is contained in:
Uwe Steinmann 2018-03-21 15:30:32 +01:00
commit 095e471f8b
11 changed files with 133 additions and 19 deletions

View File

@ -105,6 +105,7 @@
- do not list empty groups as reviewer/approver
- fix sending notification when document attributes change
- sending notification when folder attributes change
- check if converters are set in out/out.ViewDocument.php at all (Closes #394)
--------------------------------------------------------------------------------
Changes in version 5.1.6

View File

@ -0,0 +1,81 @@
<?php
/**
* Implementation of ExtensionMgr controller
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2018 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Class which does the busines logic for managing extensions
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2018 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_Controller_ExtensionMgr extends SeedDMS_Controller_Common {
public function refresh() { /* {{{ */
$dms = $this->params['dms'];
$extmgr = $this->params['extmgr'];
$extmgr->createExtensionConf();
return true;
} /* }}} */
public function download() { /* {{{ */
$dms = $this->params['dms'];
$settings = $this->params['settings'];
$extmgr = $this->params['extmgr'];
$extname = $this->params['extname'];
$filename = $extmgr->createArchive($extname, $GLOBALS['EXT_CONF'][$extname]['version']);
if(null === $this->callHook('download')) {
if(file_exists($filename)) {
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));
header("Content-Disposition: attachment; filename=\"" . utf8_basename($filename) . "\"; filename*=UTF-8''".utf8_basename($filename));
header("Content-Type: application/zip");
header("Cache-Control: must-revalidate");
sendFile($filename);
}
}
return true;
} /* }}} */
public function upload() { /* {{{ */
$dms = $this->params['dms'];
$extmgr = $this->params['extmgr'];
$file = $this->params['file'];
if($extmgr->updateExtension($file))
$extmgr->createExtensionConf();
else
return false;
return true;
} /* }}} */
public function getlist() { /* {{{ */
$dms = $this->params['dms'];
$extmgr = $this->params['extmgr'];
$forceupdate = $this->params['forceupdate'];
$version = $this->params['version'];
if(!$extmgr->updateExtensionList($version, $forceupdate)) {
$this->errormsg = $extmgr->getErrorMsg();
return false;
}
return true;
} /* }}} */
}

View File

@ -1,2 +1,9 @@
Changes in version 1.0.1
==========================
- added this changelog file
Changes in version 1.0.0
==========================
- Initial version

View File

@ -2,9 +2,9 @@
$EXT_CONF['example'] = array(
'title' => 'Example Extension',
'description' => 'This sample extension demonstrates the use of various hooks',
'disable' => true,
'version' => '1.0.0',
'releasedate' => '2013-05-03',
'disable' => false,
'version' => '1.0.1',
'releasedate' => '2018-03-21',
'author' => array('name'=>'Uwe Steinmann', 'email'=>'uwe@steinmann.cx', 'company'=>'MMK GmbH'),
'config' => array(
'input_field' => array(

View File

@ -60,7 +60,8 @@ class SeedDMS_Extension_Mgr {
/**
* Compare two version
*
* This functions compares two version in the format x.x.x
* This functions compares two version in the format x.x.x with x being
* an integer
*
* @param string $ver1
* @param string $ver2
@ -107,7 +108,7 @@ class SeedDMS_Extension_Mgr {
$this->createExtensionConf();
}
include($this->getExtensionsConfFile());
if($EXT_CONF) {
if(!empty($EXT_CONF)) {
$this->extconf = $EXT_CONF;
}
}
@ -372,10 +373,18 @@ class SeedDMS_Extension_Mgr {
*
* @param boolean $force force download even if file already exists
*/
public function updateExtensionList($force=false) { /* {{{ */
public function updateExtensionList($version='', $force=false) { /* {{{ */
if($this->reposurl) {
if(!file_exists($this->cachedir."/repository.json") || $force) {
$file = file_get_contents($this->reposurl);
$file = @file_get_contents($this->reposurl.($version ? '?seeddms_version='.$version : ''));
if(is_array($http_response_header)) {
$parts=explode(' ',$http_response_header[0]);
if(count($parts)>1) //HTTP/1.0 <code> <text>
if(intval($parts[1]) != 200) {
$this->errmsgs[] = 'Getting extension list returned http code ('.$parts[1].')';
return false;
}
}
file_put_contents($this->cachedir."/repository.json", $file);
}
return true;

View File

@ -16,7 +16,7 @@ require_once "inc.ClassExtBase.php";
require_once "inc.Version.php";
require_once "inc.Utils.php";
$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir);
$extMgr = new SeedDMS_Extension_Mgr($settings->_rootDir."/ext", $settings->_cacheDir, $settings->_repositoryUrl);
$EXT_CONF = $extMgr->getExtensionConfiguration();
$version = new SeedDMS_Version;

View File

@ -95,7 +95,7 @@ elseif ($action == "import") { /* {{{ */
if(!$_POST['url']) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
}
$reposurl = 'http://seeddms.steinmann.cx/repository';
$reposurl = $settings->_repositoryUrl;
$content = file_get_contents($reposurl."/".$_POST['url']);
$file = tempnam(sys_get_temp_dir(), '');
file_put_contents($file, $content);
@ -113,6 +113,19 @@ elseif ($action == "import") { /* {{{ */
add_log_line();
header("Location:../out/out.ExtensionMgr.php?currenttab=".$currenttab);
} /* }}} */
elseif ($action == "getlist") { /* {{{ */
$v = new SeedDMS_Version();
$controller->setParam('extmgr', $extMgr);
$controller->setParam('forceupdate', (isset($_POST['forceupdate']) && $_POST['forceupdate']) ? true : false);
$controller->setParam('version', $v->version());
if (!$controller($_POST)) {
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('error_extension_getlist').$controller->getErrorMsg(), 'timeout'=>5000));
} else {
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_extension_getlist')));
}
add_log_line();
header("Location:../out/out.ExtensionMgr.php?currenttab=".$currenttab);
} /* }}} */
?>

View File

@ -42,11 +42,6 @@ if(isset($_GET['currenttab']))
else
$currenttab = 'installed';
if(isset($_GET['forceupdate']) && $_GET['forceupdate']==1)
$extmgr->updateExtensionList(true);
else
$extmgr->updateExtensionList();
if($view) {
$view->setParam('httproot', $settings->_httpRoot);
$view->setParam('extdir', $settings->_rootDir."/ext");

View File

@ -82,9 +82,9 @@ if($view) {
$view->setParam('workflowmode', $settings->_workflowMode);
$view->setParam('previewWidthList', $settings->_previewWidthList);
$view->setParam('previewWidthDetail', $settings->_previewWidthDetail);
$view->setParam('previewConverters', $settings->_converters['preview']);
$view->setParam('previewConverters', isset($settings->_converters['preview']) ? $settings->_converters['preview'] : array());
$view->setParam('pdfConverters', isset($settings->_converters['pdf']) ? $settings->_converters['pdf'] : array());
$view->setParam('checkOutDir', $settings->_checkOutDir);
$view->setParam('pdfConverters', isset($settings->_converters['pdf']) ? $settings->_converters['pdf'] : null);
$view->setParam('showFullPreview', $settings->_showFullPreview);
$view->setParam('convertToPdf', $settings->_convertToPdf);
$view->setParam('currenttab', isset($_GET['currenttab']) ? $_GET['currenttab'] : "");

View File

@ -123,7 +123,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo "<body".(strlen($bodyClass)>0 ? " class=\"".$bodyClass."\"" : "").">\n";
if($this->params['session'] && $flashmsg = $this->params['session']->getSplashMsg()) {
$this->params['session']->clearSplashMsg();
echo "<div class=\"splash\" data-type=\"".$flashmsg['type']."\">".$flashmsg['msg']."</div>\n";
echo "<div class=\"splash\" data-type=\"".$flashmsg['type']."\"".(!empty($flashmsg['timeout']) ? ' data-timeout="'.$flashmsg['timeout'].'"': '').">".$flashmsg['msg']."</div>\n";
}
foreach($hookObjs as $hookObj) {
if (method_exists($hookObj, 'startBody')) {

View File

@ -140,7 +140,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style {
echo "<img src=\"".$httproot."ext/".$extname."/".$extconf['icon']."\" alt=\"".$extname."\" title=\"".$extname."\">";
echo "</td>";
echo "<td>".$extconf['title'];
if($extconf['changelog'] && file_exists($extdir."/".$extname."/".$extconf['changelog'])) {
if(!empty($extconf['changelog']) && file_exists($extdir."/".$extname."/".$extconf['changelog'])) {
echo $this->printPopupBox("<i class=\"icon-reorder\"></i>", '<div style="white-space: pre-wrap; font-family: monospace; padding: 0px;">'.file_get_contents($extdir."/".$extname."/".$extconf['changelog'])."</div>", true);
}
echo "<br /><small>".$extconf['description']."</small>";
@ -215,7 +215,15 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Bootstrap_Style {
}
echo "</tbody></table>\n";
?>
<div><a href="?forceupdate=1&currenttab=repository" class="btn btn-delete"><?= getMLText('force_update')?></a></div>
<div>
<form method="post" action="../op/op.ExtensionMgr.php">
<?= createHiddenFieldWithKey('extensionmgr'); ?>
<input type="hidden" name="action" value="getlist" />
<input type="hidden" name="currenttab" value="repository" />
<input type="hidden" name="forceupdate" value="1" />
<button type="submit" class="btn btn-delete"><i class="icon-refresh"></i> <?= getMLText('force_update')?></button>
</form>
</div>
</div>
</div>
</div>