mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 08:55:54 +00:00
do not allow to select category if no categories exists
This commit is contained in:
parent
14d8a1bd91
commit
004af591a9
|
@ -223,23 +223,25 @@ console.log(params);
|
|||
getMLText("keywords"),
|
||||
$this->getKeywordChooserHtml('adddocform')
|
||||
);
|
||||
if(!$nodocumentformfields || !in_array('categories', $nodocumentformfields)) {
|
||||
$options = array();
|
||||
$categories = $dms->getDocumentCategories();
|
||||
foreach($categories as $category) {
|
||||
$options[] = array($category->getID(), $category->getName());
|
||||
}
|
||||
$this->formField(
|
||||
getMLText("categories"),
|
||||
array(
|
||||
'element'=>'select',
|
||||
'class'=>'chzn-select',
|
||||
'name'=>'categories[]',
|
||||
'multiple'=>true,
|
||||
'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))),
|
||||
'options'=>$options
|
||||
)
|
||||
);
|
||||
if($categories) {
|
||||
if(!$nodocumentformfields || !in_array('categories', $nodocumentformfields)) {
|
||||
$options = array();
|
||||
foreach($categories as $category) {
|
||||
$options[] = array($category->getID(), $category->getName());
|
||||
}
|
||||
$this->formField(
|
||||
getMLText("categories"),
|
||||
array(
|
||||
'element'=>'select',
|
||||
'class'=>'chzn-select',
|
||||
'name'=>'categories[]',
|
||||
'multiple'=>true,
|
||||
'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))),
|
||||
'options'=>$options
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
if(!$nodocumentformfields || !in_array('sequence', $nodocumentformfields)) {
|
||||
$this->formField(getMLText("sequence"), $this->getSequenceChooser($folder->getDocuments('s')).($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
|
||||
|
|
|
@ -134,35 +134,37 @@ $(document).ready( function() {
|
|||
)
|
||||
);
|
||||
}
|
||||
if(!$nodocumentformfields || !in_array('categories', $nodocumentformfields)) {
|
||||
$options = array();
|
||||
$categories = $dms->getDocumentCategories();
|
||||
foreach($categories as $category) {
|
||||
$options[] = array($category->getID(), $category->getName(), in_array($category, $document->getCategories()));
|
||||
}
|
||||
$this->formField(
|
||||
getMLText("categories"),
|
||||
array(
|
||||
'element'=>'select',
|
||||
'class'=>'chzn-select',
|
||||
'name'=>'categories[]',
|
||||
'multiple'=>true,
|
||||
'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))),
|
||||
'options'=>$options
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$categories = $document->getCategories();
|
||||
foreach($categories as $category) {
|
||||
if($categories) {
|
||||
if(!$nodocumentformfields || !in_array('categories', $nodocumentformfields)) {
|
||||
$options = array();
|
||||
foreach($categories as $category) {
|
||||
$options[] = array($category->getID(), $category->getName(), in_array($category, $document->getCategories()));
|
||||
}
|
||||
$this->formField(
|
||||
null,
|
||||
getMLText("categories"),
|
||||
array(
|
||||
'element'=>'input',
|
||||
'type'=>'hidden',
|
||||
'element'=>'select',
|
||||
'class'=>'chzn-select',
|
||||
'name'=>'categories[]',
|
||||
'value'=>htmlspecialchars($category->getId()),
|
||||
'multiple'=>true,
|
||||
'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))),
|
||||
'options'=>$options
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$categories = $document->getCategories();
|
||||
foreach($categories as $category) {
|
||||
$this->formField(
|
||||
null,
|
||||
array(
|
||||
'element'=>'input',
|
||||
'type'=>'hidden',
|
||||
'name'=>'categories[]',
|
||||
'value'=>htmlspecialchars($category->getId()),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$nodocumentformfields || !in_array('expires', $nodocumentformfields)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user