* @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ /** * Include parent class */ require_once("class.Bootstrap.php"); /** * Class which outputs the html page for EditDocument view * * @category DMS * @package SeedDMS * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann * @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ class SeedDMS_View_EditDocument extends SeedDMS_Bootstrap_Style { function js() { /* {{{ */ $strictformcheck = $this->params['strictformcheck']; header('Content-Type: application/javascript'); $this->printKeywordChooserJs('form1'); ?> $(document).ready( function() { $("#form1").validate({ invalidHandler: function(e, validator) { noty({ text: (validator.numberOfInvalids() == 1) ? "".replace('#', validator.numberOfInvalids()) : "".replace('#', validator.numberOfInvalids()), type: 'error', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', timeout: 1500, }); }, messages: { name: "", comment: "", keywords: "" } }); $('#presetexpdate').on('change', function(ev){ if($(this).val() == 'date') $('#control_expdate').show(); else $('#control_expdate').hide(); }); }); params['dms']; $user = $this->params['user']; $folder = $this->params['folder']; $document = $this->params['document']; $attrdefs = $this->params['attrdefs']; $strictformcheck = $this->params['strictformcheck']; $nodocumentformfields = $this->params['nodocumentformfields']; $orderby = $this->params['orderby']; $this->htmlAddHeader(''."\n", 'js'); $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); $this->globalNavigation($folder); $this->contentStart(); $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); $this->contentHeading(getMLText("edit_document_props")); $this->contentContainerStart(); if($document->expires()) $expdate = date('Y-m-d', $document->getExpires()); else $expdate = ''; ?>
formField( getMLText("name"), array( 'element'=>'input', 'type'=>'text', 'name'=>'name', 'value'=>htmlspecialchars($document->getName()), 'required'=>true ) ); if(!$nodocumentformfields || !in_array('comment', $nodocumentformfields)) { $this->formField( getMLText("comment"), array( 'element'=>'textarea', 'name'=>'comment', 'rows'=>4, 'cols'=>80, 'value'=>htmlspecialchars($document->getComment()), 'required'=>$strictformcheck ) ); } else { $this->formField( null, array( 'element'=>'input', 'type'=>'hidden', 'name'=>'comment', 'value'=>htmlspecialchars($document->getComment()), ) ); } if(!$nodocumentformfields || !in_array('keywords', $nodocumentformfields)) { $this->formField( getMLText("keywords"), $this->getKeywordChooserHtml('form1', $document->getKeywords()) ); } else { $this->formField( null, array( 'element'=>'input', 'type'=>'hidden', 'name'=>'keywords', 'value'=>htmlspecialchars($document->getKeywords()), ) ); } 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) { $this->formField( null, array( 'element'=>'input', 'type'=>'hidden', 'name'=>'categories[]', 'value'=>htmlspecialchars($category->getId()), ) ); } } if(!$nodocumentformfields || !in_array('expires', $nodocumentformfields)) { $options = array(); $options[] = array('never', getMLText('does_not_expire')); $options[] = array('date', getMLText('expire_by_date'), $expdate != ''); $options[] = array('1w', getMLText('expire_in_1w')); $options[] = array('1m', getMLText('expire_in_1m')); $options[] = array('1y', getMLText('expire_in_1y')); $options[] = array('2y', getMLText('expire_in_2y')); $this->formField( getMLText("preset_expires"), array( 'element'=>'select', 'id'=>'presetexpdate', 'name'=>'presetexpdate', 'options'=>$options ) ); $this->formField( getMLText("expires"), $this->getDateChooser($expdate, "expdate", $this->params['session']->getLanguage()) ); } else { $this->formField( null, array( 'element'=>'input', 'type'=>'hidden', 'name'=>'expdate', 'value'=>$expdate, ) ); } if(!$nodocumentformfields || !in_array('sequence', $nodocumentformfields)) { if ($folder->getAccessMode($user) > M_READ) { $this->formField(getMLText("sequence"), $this->getSequenceChooser($folder->getDocuments('s'), $document->getID()).($orderby != 's' ? "
".getMLText('order_by_sequence_off') : '')); } } if($attrdefs) { foreach($attrdefs as $attrdef) { $arr = $this->callHook('editDocumentAttribute', $document, $attrdef); if(is_array($arr)) { if($arr) { $this->formField($arr[0], $arr[1]); } } elseif(is_string($arr)) { echo $arr; } else { $this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $document->getAttribute($attrdef))); } } } $arrs = $this->callHook('addDocumentAttributes', $document); if(is_array($arrs)) { foreach($arrs as $arr) { $this->formField($arr[0], $arr[1]); } } elseif(is_string($arr)) { echo $arr; } $this->formSubmit(" ".getMLText('save')); ?>
contentContainerEnd(); $this->contentEnd(); $this->htmlEndPage(); } /* }}} */ } ?>