* @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 AddFile 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_AddFile extends SeedDMS_Theme_Style { function js() { /* {{{ */ $enablelargefileupload = $this->params['enablelargefileupload']; $partitionsize = $this->params['partitionsize']; $maxuploadsize = $this->params['maxuploadsize']; header('Content-Type: application/javascript; charset=UTF-8'); if($enablelargefileupload) $this->printFineUploaderJs('../op/op.UploadChunks.php', $partitionsize, $maxuploadsize); $this->printFileChooserJs(); ?> $(document).ready( function() { /* The fineuploader validation is actually checking all fields that can contain * a file to be uploaded. First checks if an alternative input field is set, * second loops through the list of scheduled uploads, checking if at least one * file will be submitted. */ jQuery.validator.addMethod("fineuploader", function(value, element, params) { uploader = params[0]; arr = uploader.getUploads(); for(var i in arr) { if(arr[i].status == 'submitted') return true; } return false; }, ""); $("#form1").validate({ debug: false, ignore: ":hidden:not(.do_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, }); }, highlight: function(e, errorClass, validClass) { $(e).parent().parent().removeClass(validClass).addClass(errorClass); }, unhighlight: function(e, errorClass, validClass) { $(e).parent().parent().removeClass(errorClass).addClass(validClass); }, submitHandler: function(form) { userfileuploader.uploadStoredFiles(); }, rules: { fineuploaderuuids: { fineuploader: [ userfileuploader ] } 'userfile[]': { required: true } }, messages: { name: "", comment: "", 'userfile[]': "" }, errorPlacement: function( error, element ) { if ( element.is( ":file" ) ) { error.appendTo( element.parent().parent().parent()); } else { error.appendTo( element.parent()); } } }); }); params['dms']; $user = $this->params['user']; $folder = $this->params['folder']; $document = $this->params['document']; $strictformcheck = $this->params['strictformcheck']; $enablelargefileupload = $this->params['enablelargefileupload']; $maxuploadsize = $this->params['maxuploadsize']; $this->htmlAddHeader(''."\n", 'js'); if($enablelargefileupload) { $this->htmlAddHeader(''."\n", 'js'); $this->htmlAddHeader($this->getFineUploaderTemplate(), '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("linked_files")); $mus2 = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize")); if($maxuploadsize && $maxuploadsize < $mus2) $msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($maxuploadsize); else $msg = getMLText("max_upload_size").": ".SeedDMS_Core_File::format_filesize($mus2); $this->warningMsg($msg); $this->contentContainerStart(); ?>
formField( getMLText("local_file"), ($enablelargefileupload ? $this->getFineUploaderHtml() : $this->getFileChooserHtml('userfile[]', false)) ); $options = array(); $options[] = array("", getMLText('document')); $versions = $document->getContent(); foreach($versions as $version) { $options[] = array($version->getVersion(), getMLText('version')." ".$version->getVersion()); } $this->formField( getMLText("version"), array( 'element'=>'select', 'id'=>'version', 'name'=>'version', 'options'=>$options ) ); $this->formField( getMLText("name"), array( 'element'=>'input', 'type'=>'text', 'id'=>'name', 'name'=>'name', ) ); $this->formField( getMLText("comment"), array( 'element'=>'textarea', 'id'=>'comment', 'name'=>'comment', 'rows'=>4, 'cols'=>80, 'required'=>$strictformcheck ) ); if ($document->getAccessMode($user) >= M_READWRITE) { $this->formField( getMLText("document_link_public"), array( 'element'=>'input', 'type'=>'checkbox', 'id'=>'public', 'name'=>'public', 'value'=>'true', 'checked'=>true, ) ); } $this->formSubmit(getMLText('add')); ?>
contentContainerEnd(); $this->contentEnd(); $this->htmlEndPage(); } /* }}} */ } ?>