set default position of new documents/folders (Closes #381)

This commit is contained in:
Uwe Steinmann 2018-02-07 08:43:46 +01:00
parent 9531c100bd
commit 987025331d
9 changed files with 31 additions and 10 deletions

View File

@ -12,6 +12,7 @@
- list linked documents on the ViewDocument page in the way as in other document lists
- fix 2-factor authentification
- configuration variables in extension of type 'select' may have an empty option
- default position of documents/folders can be set in configuration (Closes #381)
--------------------------------------------------------------------------------
Changes in version 5.1.5

View File

@ -210,6 +210,8 @@ class Settings { /* {{{ */
var $_sortUsersInList = '';
// Sort method for forders and documents ('n' (name) or '')
var $_sortFoldersDefault = '';
// Where to insert new documents ('start' or 'end')
var $_defaultDocPosition = 'end';
// Set valid IP for admin logins
// if enabled admin can login only by specified IP addres
var $_adminIP = "";
@ -457,6 +459,7 @@ class Settings { /* {{{ */
$this->_sortUsersInList = strval($tab["sortUsersInList"]);
$this->_sortFoldersDefault = strval($tab["sortFoldersDefault"]);
$this->_expandFolderTree = intval($tab["expandFolderTree"]);
$this->_defaultDocPosition = strval($tab["defaultDocPosition"]);
// XML Path: /configuration/site/calendar
$node = $xml->xpath('/configuration/site/calendar');
@ -775,6 +778,7 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "stopWordsFile", $this->_stopWordsFile);
$this->setXMLAttributValue($node, "sortUsersInList", $this->_sortUsersInList);
$this->setXMLAttributValue($node, "sortFoldersDefault", $this->_sortFoldersDefault);
$this->setXMLAttributValue($node, "defaultDocPosition", $this->_defaultDocPosition);
// XML Path: /configuration/site/calendar
$node = $this->getXMLNode($xml, '/configuration/site', 'calendar');

View File

@ -101,6 +101,7 @@ if ($action == "saveSettings")
$settings->_stopWordsFile = $_POST["stopWordsFile"];
$settings->_sortUsersInList = $_POST["sortUsersInList"];
$settings->_sortFoldersDefault = $_POST["sortFoldersDefault"];
$settings->_defaultDocPosition = $_POST["defaultDocPosition"];
// SETTINGS - SITE - CALENDAR
$settings->_enableCalendar = getBoolValue("enableCalendar");

View File

@ -65,6 +65,7 @@ if($view) {
$view->setParam('workflowmode', $settings->_workflowMode);
$view->setParam('presetexpiration', $settings->_presetExpirationDate);
$view->setParam('sortusersinlist', $settings->_sortUsersInList);
$view->setParam('defaultposition', $settings->_defaultDocPosition);
$view->setParam('orderby', $settings->_sortFoldersDefault);
$view($_GET);
exit;

View File

@ -47,6 +47,7 @@ if ($folder->getAccessMode($user) < M_READWRITE) {
if($view) {
$view->setParam('folder', $folder);
$view->setParam('strictformcheck', $settings->_strictFormCheck);
$view->setParam('defaultposition', $settings->_defaultDocPosition);
$view->setParam('orderby', $settings->_sortFoldersDefault);
$view($_GET);
exit;

View File

@ -58,6 +58,7 @@ $accessop = new SeedDMS_AccessOperation($dms, $document, $user, $settings);
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'attrdefs'=>$attrdefs, 'strictformcheck'=>$settings->_strictFormCheck, 'orderby'=>$settings->_sortFoldersDefault));
if($view) {
$view->setParam('defaultposition', $settings->_defaultDocPosition);
$view->setParam('accessobject', $accessop);
$view($_GET);
exit;

View File

@ -52,6 +52,7 @@ if($view) {
$view->setParam('strictformcheck', $settings->_strictFormCheck);
$view->setParam('rootfolderid', $settings->_rootFolderID);
$view->setParam('orderby', $settings->_sortFoldersDefault);
$view->setParam('defaultposition', $settings->_defaultDocPosition);
$view($_GET);
exit;
}

View File

@ -988,10 +988,13 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
if ($keepID != -1) {
print " <option value=\"keep\">" . getMLText("seq_keep");
}
print " <option value=\"".$max."\">" . getMLText("seq_end");
if($this->params['defaultposition'] != 'start')
print " <option value=\"".$max."\">" . getMLText("seq_end");
if (count($objArr) > 0) {
print " <option value=\"".$min."\">" . getMLText("seq_start");
}
if($this->params['defaultposition'] == 'start')
print " <option value=\"".$max."\">" . getMLText("seq_end");
for ($i = 0; $i < count($objArr) - 1; $i++) {
if (($objArr[$i]->getID() == $keepID) || (($i + 1 < count($objArr)) && ($objArr[$i+1]->getID() == $keepID))) {
continue;

View File

@ -338,19 +338,27 @@ if(!is_writeable($settings->_configFilePath)) {
<tr title="<?php printMLText("settings_sortUsersInList_desc");?>">
<td><?php printMLText("settings_sortUsersInList");?>:</td>
<td>
<SELECT name="sortUsersInList">
<OPTION VALUE="" <?php if ($settings->_sortUsersInList=='') echo "SELECTED" ?> ><?php printMLText("settings_sortUsersInList_val_login");?></OPTION>
<OPTION VALUE="fullname" <?php if ($settings->_sortUsersInList=='fullname') echo "SELECTED" ?> ><?php printMLText("settings_sortUsersInList_val_fullname");?></OPTION>
</SELECT>
<select name="sortUsersInList">
<option value="" <?php if ($settings->_sortUsersInList=='') echo "selected" ?> ><?php printMLText("settings_sortUsersInList_val_login");?></option>
<option value="fullname" <?php if ($settings->_sortUsersInList=='fullname') echo "selected" ?> ><?php printMLText("settings_sortUsersInList_val_fullname");?></option>
</select>
</tr>
<tr title="<?php printMLText("settings_sortFoldersDefault_desc");?>">
<td><?php printMLText("settings_sortFoldersDefault");?>:</td>
<td>
<SELECT name="sortFoldersDefault">
<OPTION VALUE="u" <?php if ($settings->_sortFoldersDefault=='') echo "SELECTED" ?> ><?php printMLText("settings_sortFoldersDefault_val_unsorted");?></OPTION>
<OPTION VALUE="s" <?php if ($settings->_sortFoldersDefault=='s') echo "SELECTED" ?> ><?php printMLText("settings_sortFoldersDefault_val_sequence");?></OPTION>
<OPTION VALUE="n" <?php if ($settings->_sortFoldersDefault=='n') echo "SELECTED" ?> ><?php printMLText("settings_sortFoldersDefault_val_name");?></OPTION>
</SELECT>
<select name="sortFoldersDefault">
<option value="u" <?php if ($settings->_sortFoldersDefault=='') echo "selected" ?> ><?php printMLText("settings_sortFoldersDefault_val_unsorted");?></option>
<option value="s" <?php if ($settings->_sortFoldersDefault=='s') echo "selected" ?> ><?php printMLText("settings_sortFoldersDefault_val_sequence");?></option>
<option value="n" <?php if ($settings->_sortFoldersDefault=='n') echo "selected" ?> ><?php printMLText("settings_sortFoldersDefault_val_name");?></option>
</select>
</tr>
<tr title="<?php printMLText("settings_defaultDocPosition_desc");?>">
<td><?php printMLText("settings_defaultDocPosition");?>:</td>
<td>
<select name="defaultDocPosition">
<option value="end" <?php if ($settings->_defaultDocPosition=='end') echo "selected" ?> ><?php printMLText("settings_defaultDocPosition_val_end");?></option>
<option value="start" <?php if ($settings->_defaultDocPosition=='start') echo "selected" ?> ><?php printMLText("settings_defaultDocPosition_val_start");?></option>
</select>
</tr>
<!--