Merge branch 'develop' into seeddms-5.1.x

This commit is contained in:
Uwe Steinmann 2016-04-18 20:56:09 +02:00
commit 6ad8c5a10f
14 changed files with 165 additions and 109 deletions

View File

@ -39,13 +39,21 @@ class SeedDMS_Download_Mgr {
*/ */
protected $items; protected $items;
/**
* @var array $extracols list of arrays with extra columns per item
* @access protected
*/
protected $extracols;
function __construct($tmpdir = '') { function __construct($tmpdir = '') {
$this->tmpdir = $tmpdir; $this->tmpdir = $tmpdir;
$this->items = array(); $this->items = array();
$this->extracols = array();
} }
public function addItem($item) { /* {{{ */ public function addItem($item, $extracols) { /* {{{ */
$this->items[$item->getID()] = $item; $this->items[$item->getID()] = $item;
$this->extracols[$item->getID()] = $extracols;
} /* }}} */ } /* }}} */
public function createToc($file) { /* {{{ */ public function createToc($file) { /* {{{ */
@ -113,9 +121,9 @@ class SeedDMS_Download_Mgr {
$sheet->setCellValueByColumnAndRow($tcol++, $l, getReviewStatusText($r["status"])); $sheet->setCellValueByColumnAndRow($tcol++, $l, getReviewStatusText($r["status"]));
$l++; $l++;
} }
$col = $tcol;
$l--; $l--;
} }
$col += 4;
if($approvalStatus) { if($approvalStatus) {
foreach ($approvalStatus as $r) { foreach ($approvalStatus as $r) {
switch ($r["type"]) { switch ($r["type"]) {
@ -144,9 +152,13 @@ class SeedDMS_Download_Mgr {
$sheet->setCellValueByColumnAndRow($tcol++, $k, getApprovalStatusText($r["status"])); $sheet->setCellValueByColumnAndRow($tcol++, $k, getApprovalStatusText($r["status"]));
$k++; $k++;
} }
$col = $tcol;
$k--; $k--;
} }
$col += 4;
if(isset($this->extracols[$item->getID()]) && $this->extracols[$item->getID()]) {
foreach($this->extracols[$item->getID()] as $column)
$sheet->setCellValueByColumnAndRow($col++, $i, $column);
}
$i = max($l, $k); $i = max($l, $k);
$i++; $i++;
} }

View File

@ -33,7 +33,7 @@ if (!$user->isAdmin()) {
if($settings->_backupDir && file_exists($settings->_backupDir)) if($settings->_backupDir && file_exists($settings->_backupDir))
$basedir = $settings->_backupDir; $basedir = $settings->_backupDir;
else else
$basedir = $setting->_contentDir; $basedir = $settings->_contentDir;
$v = new SeedDMS_Version; $v = new SeedDMS_Version;
$dump_name = $basedir.date('Y-m-d\TH:i:s')."_".$v->_number.".sql"; $dump_name = $basedir.date('Y-m-d\TH:i:s')."_".$v->_number.".sql";

View File

@ -27,6 +27,10 @@ include("../inc/inc.Language.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
} }
@ -60,8 +64,6 @@ if($settings->_libraryFolder) {
$libfolder = null; $libfolder = null;
} }
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) { if($view) {
$view->setParam('folder', $folder); $view->setParam('folder', $folder);
$view->setParam('strictformcheck', $settings->_strictFormCheck); $view->setParam('strictformcheck', $settings->_strictFormCheck);
@ -75,6 +77,7 @@ if($view) {
$view->setParam('presetexpiration', $settings->_presetExpirationDate); $view->setParam('presetexpiration', $settings->_presetExpirationDate);
$view->setParam('sortusersinlist', $settings->_sortUsersInList); $view->setParam('sortusersinlist', $settings->_sortUsersInList);
$view->setParam('orderby', $settings->_sortFoldersDefault); $view->setParam('orderby', $settings->_sortFoldersDefault);
$view->setParam('accessobject', $accessop);
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -28,6 +28,10 @@ include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
} }
@ -40,12 +44,11 @@ if ($folder->getAccessMode($user) < M_READWRITE) {
UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("access_denied")); UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("access_denied"));
} }
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) { if($view) {
$view->setParam('folder', $folder); $view->setParam('folder', $folder);
$view->setParam('strictformcheck', $settings->_strictFormCheck); $view->setParam('strictformcheck', $settings->_strictFormCheck);
$view->setParam('orderby', $settings->_sortFoldersDefault); $view->setParam('orderby', $settings->_sortFoldersDefault);
$view->setParam('accessobject', $accessop);
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -25,6 +25,10 @@ include("../inc/inc.ClassUI.php");
include("../inc/inc.Calendar.php"); include("../inc/inc.Calendar.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if ($user->isGuest()) { if ($user->isGuest()) {
UI::exitError(getMLText("edit_event"),getMLText("access_denied")); UI::exitError(getMLText("edit_event"),getMLText("access_denied"));
} }
@ -42,11 +46,10 @@ if (($user->getID()!=$event["userID"])&&(!$user->isAdmin())){
UI::exitError(getMLText("edit_event"),getMLText("access_denied")); UI::exitError(getMLText("edit_event"),getMLText("access_denied"));
} }
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) { if($view) {
$view->setParam('event', $event); $view->setParam('event', $event);
$view->setParam('strictformcheck', $settings->_strictFormCheck); $view->setParam('strictformcheck', $settings->_strictFormCheck);
$view->setParam('accessobject', $accessop);
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -26,6 +26,10 @@ include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
} }
@ -41,14 +45,13 @@ if ($folder->getAccessMode($user) < M_READWRITE) {
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all)); $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all));
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) { if($view) {
$view->setParam('folder', $folder); $view->setParam('folder', $folder);
$view->setParam('attrdefs', $attrdefs); $view->setParam('attrdefs', $attrdefs);
$view->setParam('strictformcheck', $settings->_strictFormCheck); $view->setParam('strictformcheck', $settings->_strictFormCheck);
$view->setParam('rootfolderid', $settings->_rootFolderID); $view->setParam('rootfolderid', $settings->_rootFolderID);
$view->setParam('orderby', $settings->_sortFoldersDefault); $view->setParam('orderby', $settings->_sortFoldersDefault);
$view->setParam('accessobject', $accessop);
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -27,6 +27,10 @@ include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
} }
@ -43,13 +47,12 @@ if ($folder->getAccessMode($user) < M_ALL) {
$allUsers = $dms->getAllUsers(); $allUsers = $dms->getAllUsers();
$allGroups = $dms->getAllGroups(); $allGroups = $dms->getAllGroups();
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) { if($view) {
$view->setParam('folder', $folder); $view->setParam('folder', $folder);
$view->setParam('allusers', $allUsers); $view->setParam('allusers', $allUsers);
$view->setParam('allgroups', $allGroups); $view->setParam('allgroups', $allGroups);
$view->setParam('rootfolderid', $settings->_rootFolderID); $view->setParam('rootfolderid', $settings->_rootFolderID);
$view->setParam('accessobject', $accessop);
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -29,6 +29,7 @@ include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user)); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
@ -51,6 +52,7 @@ if($view) {
$view->setParam('allusers', $allUsers); $view->setParam('allusers', $allUsers);
$view->setParam('allgroups', $allGroups); $view->setParam('allgroups', $allGroups);
$view->setParam('strictformcheck', $settings->_strictFormCheck); $view->setParam('strictformcheck', $settings->_strictFormCheck);
$view->setParam('accessobject', $accessop);
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -27,6 +27,10 @@ include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
} }
@ -62,11 +66,10 @@ if(isset($_GET['targetid']) && $_GET['targetid']) {
$target = null; $target = null;
} }
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) { if($view) {
$view->setParam('folder', $folder); $view->setParam('folder', $folder);
$view->setParam('target', $target); $view->setParam('target', $target);
$view->setParam('accessobject', $accessop);
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -26,6 +26,10 @@ include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id")); UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
} }
@ -44,10 +48,9 @@ if ($folder->getAccessMode($user) < M_ALL) {
UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("access_denied")); UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("access_denied"));
} }
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) { if($view) {
$view->setParam('folder', $folder); $view->setParam('folder', $folder);
$view->setParam('accessobject', $accessop);
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -360,7 +360,7 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
$pageNumber = (int) $_GET["pg"]; $pageNumber = (int) $_GET["pg"];
} }
elseif (!strcasecmp($_GET["pg"], "all")) { elseif (!strcasecmp($_GET["pg"], "all")) {
// $limit = 0; $pageNumber = "all";
} }
} }
@ -393,90 +393,58 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
} }
} }
} }
if(isset($_GET['export']) && $_GET['export']) {
include("../inc/inc.ClassDownloadMgr.php");
$downmgr = new SeedDMS_Download_Mgr();
foreach($entries as $entry) {
if(get_class($entry) == $dms->getClassname('document')) {
$downmgr->addItem($entry->getLatestContent());
}
}
$filename = tempnam('/tmp', '');
if(isset($_GET['includecontent']) && $_GET['includecontent']) {
$downmgr->createArchive($filename);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));
header("Content-Disposition: attachment; filename=\"export-" .date('Y-m-d') . ".zip\"");
header("Content-Type: application/zip");
header("Cache-Control: must-revalidate");
} else {
$downmgr->createToc($filename);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));
header("Content-Disposition: attachment; filename=\"export-" .date('Y-m-d') . ".xls\"");
header("Content-Type: application/vnd.ms-excel");
header("Cache-Control: must-revalidate");
}
readfile($filename);
unlink($filename);
exit;
}
$totalPages = (int) (count($entries)/$limit); $totalPages = (int) (count($entries)/$limit);
if(count($entries)%$limit) if(count($entries)%$limit)
$totalPages++; $totalPages++;
if (!isset($_GET["pg"]) || strcasecmp($_GET["pg"], "all"))
$entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
// }}} // }}}
} }
// -------------- Output results -------------------------------------------- // -------------- Output results --------------------------------------------
if(count($entries) == 1) { $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$entry = $entries[0]; $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if(get_class($entry) == $dms->getClassname('document')) { $accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
header('Location: ../out/out.ViewDocument.php?documentid='.$entry->getID()); if($view) {
exit; $view->setParam('accessobject', $accessop);
} elseif(get_class($entry) == $dms->getClassname('folder')) { $view->setParam('query', $query);
header('Location: ../out/out.ViewFolder.php?folderid='.$entry->getID()); $view->setParam('searchhits', $entries);
exit; $view->setParam('totalpages', $totalPages);
} $view->setParam('pagenumber', $pageNumber);
} else { $view->setParam('limit', $limit);
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $view->setParam('searchtime', $searchTime);
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'query'=>$query, 'searchhits'=>$entries, 'totalpages'=>$totalPages, 'pagenumber'=>$pageNumber, 'searchtime'=>$searchTime, 'urlparams'=>$_GET, 'cachedir'=>$settings->_cacheDir)); $view->setParam('urlparams', $_GET);
if($view) { $view->setParam('cachedir', $settings->_cacheDir);
$view->setParam('totaldocs', $dcount /*resArr['totalDocs']*/); $view->setParam('totaldocs', $dcount /*resArr['totalDocs']*/);
$view->setParam('totalfolders', $fcount /*resArr['totalFolders']*/); $view->setParam('totalfolders', $fcount /*resArr['totalFolders']*/);
$view->setParam('fullsearch', (isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSearch) ? true : false); $view->setParam('fullsearch', (isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSearch) ? true : false);
$view->setParam('mode', isset($mode) ? $mode : ''); $view->setParam('mode', isset($mode) ? $mode : '');
$view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod); $view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod);
$view->setParam('resultmode', isset($resultmode) ? $resultmode : ''); $view->setParam('resultmode', isset($resultmode) ? $resultmode : '');
$view->setParam('searchin', isset($searchin) ? $searchin : array()); $view->setParam('searchin', isset($searchin) ? $searchin : array());
$view->setParam('startfolder', isset($startFolder) ? $startFolder : null); $view->setParam('startfolder', isset($startFolder) ? $startFolder : null);
$view->setParam('owner', $owner); $view->setParam('owner', $owner);
$view->setParam('startdate', isset($startdate) ? $startdate : array()); $view->setParam('startdate', isset($startdate) ? $startdate : array());
$view->setParam('stopdate', isset($stopdate) ? $stopdate : array()); $view->setParam('stopdate', isset($stopdate) ? $stopdate : array());
$view->setParam('expstartdate', isset($expstartdate) ? $expstartdate : array()); $view->setParam('expstartdate', isset($expstartdate) ? $expstartdate : array());
$view->setParam('expstopdate', isset($expstopdate) ? $expstopdate : array()); $view->setParam('expstopdate', isset($expstopdate) ? $expstopdate : array());
$view->setParam('creationdate', isset($creationdate) ? $creationdate : ''); $view->setParam('creationdate', isset($creationdate) ? $creationdate : '');
$view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: ''); $view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: '');
$view->setParam('status', isset($status) ? $status : array()); $view->setParam('status', isset($status) ? $status : array());
$view->setParam('categories', isset($categories) ? $categories : ''); $view->setParam('categories', isset($categories) ? $categories : '');
$view->setParam('attributes', isset($attributes) ? $attributes : ''); $view->setParam('attributes', isset($attributes) ? $attributes : '');
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all)); $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all));
$view->setParam('attrdefs', $attrdefs); $view->setParam('attrdefs', $attrdefs);
$allCats = $dms->getDocumentCategories(); $allCats = $dms->getDocumentCategories();
$view->setParam('allcategories', $allCats); $view->setParam('allcategories', $allCats);
$allUsers = $dms->getAllUsers($settings->_sortUsersInList); $allUsers = $dms->getAllUsers($settings->_sortUsersInList);
$view->setParam('allusers', $allUsers); $view->setParam('allusers', $allUsers);
$view->setParam('workflowmode', $settings->_workflowMode); $view->setParam('workflowmode', $settings->_workflowMode);
$view->setParam('enablefullsearch', $settings->_enableFullSearch); $view->setParam('enablefullsearch', $settings->_enableFullSearch);
$view->setParam('previewWidthList', $settings->_previewWidthList); $view->setParam('previewWidthList', $settings->_previewWidthList);
$view->setParam('previewconverters', $settings->_converters['preview']); $view->setParam('previewconverters', $settings->_converters['preview']);
$view->setParam('timeout', $settings->_cmdTimeout); $view->setParam('timeout', $settings->_cmdTimeout);
$view($_GET); $view($_GET);
exit; exit;
}
} }
?> ?>

View File

@ -25,16 +25,19 @@ include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if ($user->isGuest()) { if ($user->isGuest()) {
UI::exitError(getMLText("edit_default_keywords"),getMLText("access_denied")); UI::exitError(getMLText("edit_default_keywords"),getMLText("access_denied"));
} }
$categories = $dms->getAllUserKeywordCategories($user->getID()); $categories = $dms->getAllUserKeywordCategories($user->getID());
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) { if($view) {
$view->setParam('categories', $categories); $view->setParam('categories', $categories);
$view->setParam('accessobject', $accessop);
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -25,6 +25,9 @@ include("../inc/inc.ClassUI.php");
include("../inc/inc.Calendar.php"); include("../inc/inc.Calendar.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!isset($_GET["id"])){ if (!isset($_GET["id"])){
UI::exitError(getMLText("event_details"),getMLText("error_occured")); UI::exitError(getMLText("event_details"),getMLText("error_occured"));
} }
@ -34,10 +37,9 @@ if (is_bool($event)&&!$event){
UI::exitError(getMLText("event_details"),getMLText("error_occured")); UI::exitError(getMLText("event_details"),getMLText("error_occured"));
} }
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) { if($view) {
$view->setParam('event', $event); $view->setParam('event', $event);
$view->setParam('accessobject', $accessop);
$view($_GET); $view($_GET);
exit; exit;
} }

View File

@ -49,18 +49,60 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */ function js() { /* {{{ */
header('Content-Type: application/javascript'); header('Content-Type: application/javascript');
?>
$(document).ready( function() {
$('#export').on('click', function(e) {
e.preventDefault();
window.location.href = $(this).attr('href')+'&includecontent='+($('#includecontent').prop('checked') ? '1' : '0');
});
});
<?php
$this->printFolderChooserJs("form1"); $this->printFolderChooserJs("form1");
$this->printDeleteFolderButtonJs(); $this->printDeleteFolderButtonJs();
$this->printDeleteDocumentButtonJs(); $this->printDeleteDocumentButtonJs();
} /* }}} */ } /* }}} */
function export() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$entries = $this->params['searchhits'];
include("../inc/inc.ClassDownloadMgr.php");
$downmgr = new SeedDMS_Download_Mgr();
foreach($entries as $entry) {
if(get_class($entry) == $dms->getClassname('document')) {
$extracols = $this->callHook('extraDownloadColumns', $entry);
$downmgr->addItem($entry->getLatestContent(), $extracols);
}
}
$filename = tempnam('/tmp', '');
if(isset($_GET['includecontent']) && $_GET['includecontent']) {
$downmgr->createArchive($filename);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));
header("Content-Disposition: attachment; filename=\"export-" .date('Y-m-d') . ".zip\"");
header("Content-Type: application/zip");
header("Cache-Control: must-revalidate");
} else {
$downmgr->createToc($filename);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));
header("Content-Disposition: attachment; filename=\"export-" .date('Y-m-d') . ".xls\"");
header("Content-Type: application/vnd.ms-excel");
header("Cache-Control: must-revalidate");
}
readfile($filename);
unlink($filename);
} /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
$fullsearch = $this->params['fullsearch']; $fullsearch = $this->params['fullsearch'];
$totaldocs = $this->params['totaldocs']; $totaldocs = $this->params['totaldocs'];
$totalfolders = $this->params['totalfolders']; $totalfolders = $this->params['totalfolders'];
$limit = $this->params['limit'];
$attrdefs = $this->params['attrdefs']; $attrdefs = $this->params['attrdefs'];
$allCats = $this->params['allcategories']; $allCats = $this->params['allcategories'];
$allUsers = $this->params['allusers']; $allUsers = $this->params['allusers'];
@ -92,6 +134,20 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
$previewconverters = $this->params['previewconverters']; $previewconverters = $this->params['previewconverters'];
$timeout = $this->params['timeout']; $timeout = $this->params['timeout'];
if(count($entries) == 1) {
$entry = $entries[0];
if(get_class($entry) == $dms->getClassname('document')) {
header('Location: ../out/out.ViewDocument.php?documentid='.$entry->getID());
exit;
} elseif(get_class($entry) == $dms->getClassname('folder')) {
header('Location: ../out/out.ViewFolder.php?folderid='.$entry->getID());
exit;
}
}
if ($pageNumber != 'all')
$entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js'); $this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("search_results")); $this->htmlStartPage(getMLText("search_results"));
@ -249,17 +305,9 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
<td><?= getMLText('content') ?></td><td><label class="checkbox inline"><input id="includecontent" type="checkbox" name="includecontent" value="1"> <?php printMLText("include_content"); ?></label></td> <td><?= getMLText('content') ?></td><td><label class="checkbox inline"><input id="includecontent" type="checkbox" name="includecontent" value="1"> <?php printMLText("include_content"); ?></label></td>
</tr> </tr>
<tr> <tr>
<td></td><td><a id="export" class="btn" href="<?= $_SERVER['REQUEST_URI']."&export=1" ?>"><i class="icon-download"></i> Export</a></td> <td></td><td><a id="export" class="btn" href="<?= $_SERVER['REQUEST_URI']."&action=export" ?>"><i class="icon-download"></i> Export</a></td>
</tr> </tr>
</table> </table>
<script>
$(document).ready( function() {
$('#export').on('click', function(e) {
e.preventDefault();
window.location.href = $(this).attr('href')+'&includecontent='+($('#includecontent').prop('checked') ? '1' : '0');
});
});
</script>
</div> </div>
</div> </div>
</div> </div>