mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-10-16 21:12:29 +00:00
do not add items ot sequence chooser, if number of documents/folders is greater than 50
This commit is contained in:
parent
a00655932b
commit
19c70d5588
|
@ -241,7 +241,7 @@ console.log(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$nodocumentformfields || !in_array('sequence', $nodocumentformfields)) {
|
if(!$nodocumentformfields || !in_array('sequence', $nodocumentformfields)) {
|
||||||
$this->formField(getMLText("sequence"), $this->getSequenceChooser($folder->getDocuments('s')).($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
|
$this->formField(getMLText("sequence"), $this->getSequenceChooser($folder, 'd').($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
|
||||||
} else {
|
} else {
|
||||||
$minmax = $folder->getDocumentsMinMax();
|
$minmax = $folder->getDocumentsMinMax();
|
||||||
if($this->params['defaultposition'] == 'start') {
|
if($this->params['defaultposition'] == 'start') {
|
||||||
|
|
|
@ -98,7 +98,7 @@ $(document).ready( function() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if(!$nofolderformfields || !in_array('sequence', $nofolderformfields)) {
|
if(!$nofolderformfields || !in_array('sequence', $nofolderformfields)) {
|
||||||
$this->formField(getMLText("sequence"), $this->getSequenceChooser($folder->getSubFolders('s')).($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
|
$this->formField(getMLText("sequence"), $this->getSequenceChooser($folder, 'f').($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
|
||||||
} else {
|
} else {
|
||||||
$minmax = $folder->getFoldersMinMax();
|
$minmax = $folder->getFoldersMinMax();
|
||||||
if($this->params['defaultposition'] == 'start') {
|
if($this->params['defaultposition'] == 'start') {
|
||||||
|
|
|
@ -1598,17 +1598,43 @@ $(document).ready(function() {
|
||||||
print "</select>";
|
print "</select>";
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function printSequenceChooser($objArr, $keepID = -1) { /* {{{ */
|
function printSequenceChooser($parent, $type, $keepID = -1) { /* {{{ */
|
||||||
echo $this->getSequenceChooser($objArr, $keepID);
|
echo $this->getSequenceChooser($parent, $type, $keepID);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function getSequenceChooser($objArr, $keepID = -1) { /* {{{ */
|
/**
|
||||||
if (count($objArr) > 0) {
|
* Return html code for sequence chooser
|
||||||
$max = $objArr[count($objArr)-1]->getSequence() + 1;
|
*
|
||||||
$min = $objArr[0]->getSequence() - 1;
|
* This method will return the html code of the ѕelect menu for setting
|
||||||
|
* the ѕequence number of a document or folder. The select menu will contain
|
||||||
|
* a list of all siblings to select to positon relative to a sibling.
|
||||||
|
* For performance reasons the select menu will not contain any siblings
|
||||||
|
* if the number of siblings is greater than 50.
|
||||||
|
*
|
||||||
|
* @param $parent object parent folder of new or updated document/folder
|
||||||
|
* @param $type string type of new object 'f'=folder, 'd'=document
|
||||||
|
* @param $keepID integer id of current object
|
||||||
|
*/
|
||||||
|
function getSequenceChooser($parent, $type, $keepID = -1) { /* {{{ */
|
||||||
|
$objArr = [];
|
||||||
|
if($type == 'd') {
|
||||||
|
if(($c = $parent->hasDocuments()) < 50)
|
||||||
|
$objArr = $parent->getDocuments('s');
|
||||||
|
$minmax = $parent->getDocumentsMinMax();
|
||||||
|
} elseif($type = 'f') {
|
||||||
|
if(($c = $parent->hasSubFolders()) < 50)
|
||||||
|
$objArr = $parent->getSubFolders('s');
|
||||||
|
$minmax = $parent->getFoldersMinMax();
|
||||||
|
} else
|
||||||
|
return '';
|
||||||
|
|
||||||
|
if ($objArr) {
|
||||||
|
$min = $minmax['min']-1.0;
|
||||||
|
$max = $minmax['max']+1.0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$max = 1.0;
|
$min = (float) $minmax['min'];
|
||||||
|
$max = $minmax['max']+1.0;
|
||||||
}
|
}
|
||||||
$content = "<select name=\"sequence\">\n";
|
$content = "<select name=\"sequence\">\n";
|
||||||
if ($keepID != -1) {
|
if ($keepID != -1) {
|
||||||
|
@ -1616,7 +1642,7 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
if($this->params['defaultposition'] != 'start')
|
if($this->params['defaultposition'] != 'start')
|
||||||
$content .= " <option value=\"".$max."\">" . getMLText("seq_end");
|
$content .= " <option value=\"".$max."\">" . getMLText("seq_end");
|
||||||
if (count($objArr) > 0) {
|
if ($c > 0) {
|
||||||
$content .= " <option value=\"".$min."\">" . getMLText("seq_start");
|
$content .= " <option value=\"".$min."\">" . getMLText("seq_start");
|
||||||
}
|
}
|
||||||
if($this->params['defaultposition'] == 'start')
|
if($this->params['defaultposition'] == 'start')
|
||||||
|
|
|
@ -201,7 +201,7 @@ $(document).ready( function() {
|
||||||
}
|
}
|
||||||
if(!$nodocumentformfields || !in_array('sequence', $nodocumentformfields)) {
|
if(!$nodocumentformfields || !in_array('sequence', $nodocumentformfields)) {
|
||||||
if ($folder->getAccessMode($user) > M_READ) {
|
if ($folder->getAccessMode($user) > M_READ) {
|
||||||
$this->formField(getMLText("sequence"), $this->getSequenceChooser($folder->getDocuments('s'), $document->getID()).($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
|
$this->formField(getMLText("sequence"), $this->getSequenceChooser($folder, 'd', $document->getID()).($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($attrdefs) {
|
if($attrdefs) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ $(document).ready(function() {
|
||||||
$parent = ($folder->getID() == $rootfolderid) ? false : $folder->getParent();
|
$parent = ($folder->getID() == $rootfolderid) ? false : $folder->getParent();
|
||||||
if(!$nofolderformfields || !in_array('sequence', $nofolderformfields)) {
|
if(!$nofolderformfields || !in_array('sequence', $nofolderformfields)) {
|
||||||
if ($parent && $parent->getAccessMode($user) > M_READ) {
|
if ($parent && $parent->getAccessMode($user) > M_READ) {
|
||||||
$this->formField(getMLText("sequence"), $this->getSequenceChooser($parent->getSubFolders('s'), $folder->getID()).($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
|
$this->formField(getMLText("sequence"), $this->getSequenceChooser($parent, 'f', $folder->getID()).($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($attrdefs) {
|
if($attrdefs) {
|
||||||
|
|
|
@ -1627,17 +1627,43 @@ $(document).ready(function() {
|
||||||
print "</select>";
|
print "</select>";
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function printSequenceChooser($objArr, $keepID = -1) { /* {{{ */
|
function printSequenceChooser($parent, $type, $keepID = -1) { /* {{{ */
|
||||||
echo $this->getSequenceChooser($objArr, $keepID);
|
echo $this->getSequenceChooser($parent, $type, $keepID);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function getSequenceChooser($objArr, $keepID = -1) { /* {{{ */
|
/**
|
||||||
if (count($objArr) > 0) {
|
* Return html code for sequence chooser
|
||||||
$max = $objArr[count($objArr)-1]->getSequence() + 1;
|
*
|
||||||
$min = $objArr[0]->getSequence() - 1;
|
* This method will return the html code of the ѕelect menu for setting
|
||||||
|
* the ѕequence number of a document or folder. The select menu will contain
|
||||||
|
* a list of all siblings to select to positon relative to a sibling.
|
||||||
|
* For performance reasons the select menu will not contain any siblings
|
||||||
|
* if the number of siblings is greater than 50.
|
||||||
|
*
|
||||||
|
* @param $parent object parent folder of new or updated document/folder
|
||||||
|
* @param $type string type of new object 'f'=folder, 'd'=document
|
||||||
|
* @param $keepID integer id of current object
|
||||||
|
*/
|
||||||
|
function getSequenceChooser($parent, $type, $keepID = -1) { /* {{{ */
|
||||||
|
$objArr = [];
|
||||||
|
if($type == 'd') {
|
||||||
|
if(($c = $parent->hasDocuments()) < 50)
|
||||||
|
$objArr = $parent->getDocuments('s');
|
||||||
|
$minmax = $parent->getDocumentsMinMax();
|
||||||
|
} elseif($type = 'f') {
|
||||||
|
if(($c = $parent->hasSubFolders()) < 50)
|
||||||
|
$objArr = $parent->getSubFolders('s');
|
||||||
|
$minmax = $parent->getFoldersMinMax();
|
||||||
|
} else
|
||||||
|
return '';
|
||||||
|
|
||||||
|
if ($objArr) {
|
||||||
|
$min = $minmax['min']-1.0;
|
||||||
|
$max = $minmax['max']+1.0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$max = 1.0;
|
$min = (float) $minmax['min'];
|
||||||
|
$max = $minmax['max']+1.0;
|
||||||
}
|
}
|
||||||
$content = "<select class=\"form-control\" name=\"sequence\">\n";
|
$content = "<select class=\"form-control\" name=\"sequence\">\n";
|
||||||
if ($keepID != -1) {
|
if ($keepID != -1) {
|
||||||
|
@ -1645,7 +1671,7 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
if($this->params['defaultposition'] != 'start')
|
if($this->params['defaultposition'] != 'start')
|
||||||
$content .= " <option value=\"".$max."\">" . getMLText("seq_end");
|
$content .= " <option value=\"".$max."\">" . getMLText("seq_end");
|
||||||
if (count($objArr) > 0) {
|
if ($c > 0) {
|
||||||
$content .= " <option value=\"".$min."\">" . getMLText("seq_start");
|
$content .= " <option value=\"".$min."\">" . getMLText("seq_start");
|
||||||
}
|
}
|
||||||
if($this->params['defaultposition'] == 'start')
|
if($this->params['defaultposition'] == 'start')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user