From e83911a5bd07a72a2f5bc3932253d68df5d956c1 Mon Sep 17 00:00:00 2001 From: Stoyan Cheresharov Date: Wed, 11 Sep 2013 13:10:03 +0300 Subject: [PATCH] Adding the experimental --- module/CsnFileManagerExperimental/Module.php | 22 ++ module/CsnFileManagerExperimental/README.md | 3 + .../config/module.config.php | 64 ++++ .../Controller/IndexController.php | 358 ++++++++++++++++++ .../src/CsnFileManager/Form/FileFilter.php | 104 +++++ .../src/CsnFileManager/Form/FileForm.php | 47 +++ .../CsnFileManager/Form/UploadMultiForm.php | 75 ++++ .../CsnFileManager/Form/UploadSimpleForm.php | 33 ++ .../CsnFileManager/Form/UploadSingleForm.php | 61 +++ .../CsnFileManager/Form/UploadStoyanForm.php | 48 +++ .../view/csn-file-manager/index/delete.phtml | 1 + .../csn-file-manager/index/download.phtml | 1 + .../csn-file-manager/index/get-image.phtml | 1 + .../view/csn-file-manager/index/index.phtml | 32 ++ .../csn-file-manager/index/upload-multi.phtml | 19 + .../index/upload-simple.phtml | 18 + .../index/upload-single.phtml | 19 + .../view/csn-file-manager/index/upload.phtml | 18 + .../view/csn-file-manager/index/view.phtml | 2 + 19 files changed, 926 insertions(+) create mode 100644 module/CsnFileManagerExperimental/Module.php create mode 100644 module/CsnFileManagerExperimental/README.md create mode 100644 module/CsnFileManagerExperimental/config/module.config.php create mode 100644 module/CsnFileManagerExperimental/src/CsnFileManager/Controller/IndexController.php create mode 100644 module/CsnFileManagerExperimental/src/CsnFileManager/Form/FileFilter.php create mode 100644 module/CsnFileManagerExperimental/src/CsnFileManager/Form/FileForm.php create mode 100644 module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadMultiForm.php create mode 100644 module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadSimpleForm.php create mode 100644 module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadSingleForm.php create mode 100644 module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadStoyanForm.php create mode 100644 module/CsnFileManagerExperimental/view/csn-file-manager/index/delete.phtml create mode 100644 module/CsnFileManagerExperimental/view/csn-file-manager/index/download.phtml create mode 100644 module/CsnFileManagerExperimental/view/csn-file-manager/index/get-image.phtml create mode 100644 module/CsnFileManagerExperimental/view/csn-file-manager/index/index.phtml create mode 100644 module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-multi.phtml create mode 100644 module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-simple.phtml create mode 100644 module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-single.phtml create mode 100644 module/CsnFileManagerExperimental/view/csn-file-manager/index/upload.phtml create mode 100644 module/CsnFileManagerExperimental/view/csn-file-manager/index/view.phtml diff --git a/module/CsnFileManagerExperimental/Module.php b/module/CsnFileManagerExperimental/Module.php new file mode 100644 index 00000000..25301b8a --- /dev/null +++ b/module/CsnFileManagerExperimental/Module.php @@ -0,0 +1,22 @@ + array( + 'namespaces' => array( + __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, + ), + ), + ); + } +} \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/README.md b/module/CsnFileManagerExperimental/README.md new file mode 100644 index 00000000..d9b75b06 --- /dev/null +++ b/module/CsnFileManagerExperimental/README.md @@ -0,0 +1,3 @@ +This module can not work. +It is only for experiments. You can find interesting code in IndexController. +You can find a single file upload and file upload filed together with other fields. \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/config/module.config.php b/module/CsnFileManagerExperimental/config/module.config.php new file mode 100644 index 00000000..c62ccb7e --- /dev/null +++ b/module/CsnFileManagerExperimental/config/module.config.php @@ -0,0 +1,64 @@ + array( + 'invokables' => array( + 'CsnFileManager\Controller\Index' => 'CsnFileManager\Controller\IndexController', + ), + ), + 'router' => array( + 'routes' => array( + 'csn-file-manager' => array( + 'type' => 'Literal', + 'options' => array( + 'route' => '/csn-file-manager', + 'defaults' => array( + '__NAMESPACE__' => 'CsnFileManager\Controller', + 'controller' => 'Index', + 'action' => 'index', + ), + ), + 'may_terminate' => true, + 'child_routes' => array( + 'default' => array( + 'type' => 'Segment', + 'options' => array( + 'route' => '/[:controller[/:action[/:id]]]', // there is no constraints for id! + 'constraints' => array( + 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', + 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', + ), + 'defaults' => array( + ), + ), + ), + ), + ), + ), + ), + 'view_manager' => array( + 'template_path_stack' => array( + 'csn-cms' => __DIR__ . '/../view' + ), + + 'display_exceptions' => true, + ), + 'doctrine' => array( + 'driver' => array( + __NAMESPACE__ . '_driver' => array( + 'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver', + 'cache' => 'array', + 'paths' => array( + __DIR__ . '/../src/' . __NAMESPACE__ . '/Entity', + ), + ), + 'orm_default' => array( + 'drivers' => array( + __NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver', + ) + ) + ) + ), +); \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/src/CsnFileManager/Controller/IndexController.php b/module/CsnFileManagerExperimental/src/CsnFileManager/Controller/IndexController.php new file mode 100644 index 00000000..fd0d5aba --- /dev/null +++ b/module/CsnFileManagerExperimental/src/CsnFileManager/Controller/IndexController.php @@ -0,0 +1,358 @@ +getServiceLocator()->get('Config'); + $fileManagerDir = $config['file_manager']['dir']; + if ($user = $this->identity()) { + + } else { + return $this->redirect()->toRoute('home'); + } + + $this->_dir = realpath($fileManagerDir) . + DIRECTORY_SEPARATOR . + $user->getUsrId(); + } + + public function indexAction() + { + $this->init(); + $files = array(); + if (is_dir($this->_dir)) { + $handle = opendir($this->_dir); + if ($handle) { + while (false !== ($entry = readdir($handle))) { + if ($entry != "." && $entry != "..") { + $files[] = $entry; + } + } + closedir($handle); + } + } + return new ViewModel(array('files' => $files)); + } + + public function uploadAction() + { + return $this->redirect()->toRoute('csn-file-manager/default', array('controller' => 'index', 'action' => 'upload-multi')); + $this->init(); + + if (!is_dir($this->_dir)) { + mkdir($this->_dir, 0777); + } + +// $form = new FileForm(); +// $filter = new FileFilter($this->_dir); + +// $element = $form->get('file'); +// $specs = $element->getInputSpecification(); +// $filter = $form->getInputFilter(); +// echo '

Filter:

';
+//		print_r($filter);
+//		echo '
'; + + $form = new UploadSingleForm(); + +/* + $request = $this->getRequest(); + if ($request->isPost()) { + $form->setInputFilter(new RegistrationFilter($this->getServiceLocator())); + $form->setData($request->getPost()); + if ($form->isValid()) { + $this->prepareData($user); + $this->sendConfirmationEmail($user); + $this->flashMessenger()->addMessage($user->getUsrEmail()); + $entityManager->persist($user); + $entityManager->flush(); + return $this->redirect()->toRoute('auth-doctrine/default', array('controller'=>'registration', 'action'=>'registration-success')); + } + } +*/ + + return new ViewModel(array('form' => $form)); + } + + /** + * The action that uses a simple form (no filter) without moving the file to a new directory. The simplest variant. + * + * The values we are receiving. The file doesn'g get moved, but it is renamed to a random name. + * Array + * ( + * [image-file] => Array + * ( + * [name] => text2.txt + * [type] => text/plain + * [tmp_name] => C:\WINDOWS\Temp\php1452.tmp + * [error] => 0 + * [size] => 1380 + * ) + * [submit] => Upload + * ) + * @link http://framework.zend.com/manual/2.1/en/modules/zend.form.file-upload.html + * @return Zend\View\Model\ViewModel|array returns the standard things + */ + public function uploadSimpleAction() + { + $this->init(); + if (!is_dir($this->_dir)) { + mkdir($this->_dir, 0777); + } + $form = new UploadSimpleForm(); + + $request = $this->getRequest(); + if ($request->isPost()) { + // Make certain to merge the files info! + $post = array_merge_recursive( + $request->getPost()->toArray(), + $request->getFiles()->toArray() + ); + + $form->setData($post); + if ($form->isValid()) { + $data = $form->getData(); + // Form is valid, save the form! + echo '





';
+				print_r($data);
+				echo '
'; +// return $this->redirect()->toRoute('csn-file-manager'); + } + } + return new ViewModel(array('form' => $form)); + } + + /** + * The action that uses a form for uploading a single file and File Post-Redirect-Get Plugin + * + * When using other standard form inputs (i.e. text, checkbox, select, etc.) + * along with file inputs in a Form, you can encounter a situation where some + * inputs may become invalid and the user must re-select the file and re-upload. + * PHP will delete uploaded files from the temporary directory at the end of the + * request if it has not been moved away or renamed. Re-uploading a valid file each + * time another form input is invalid is inefficient and annoying to users. + * + * One strategy to get around this is to split the form into multiple forms. + * One form for the file upload inputs and another for the other standard inputs. + * + * When you cannot separate the forms, the File Post-Redirect-Get Controller Plugin + * can be used to manage the file inputs and save off valid uploads until the entire form is valid. + * + * @return Zend\View\Model\ViewModel|array returns the standard things + */ + public function uploadSingleAction() + { + $this->init(); + if (!is_dir($this->_dir)) { + mkdir($this->_dir, 0777); + } + $form = new UploadSingleForm($this->_dir, 'upload-form'); + $tempFile = null; + + $prg = $this->fileprg($form); + if ($prg instanceof \Zend\Http\PhpEnvironment\Response) { + return $prg; // Return PRG redirect response + } elseif (is_array($prg)) { + if ($form->isValid()) { + $data = $form->getData(); + // Form is valid, save the form! + echo '





';
+				print_r($data);
+				echo '
'; + //- return $this->redirect()->toRoute('upload-form/success'); + } else { + // Form not valid, but file uploads might be valid... + // Get the temporary file information to show the user in the view + $fileErrors = $form->get('image-file')->getMessages(); + if (empty($fileErrors)) { + $tempFile = $form->get('image-file')->getValue(); + } + } + } + + return array( + 'form' => $form, + 'tempFile' => $tempFile, + ); + } + + /** + * HTML5 Multi-File Uploads + * + * I will rename the files to the original names + * This is how the data looks after the upload + * Array + * ( + * [image-file] => Array + * ( + * [0] => Array + * ( + * [name] => text.txt + * [type] => text/plain + * [tmp_name] => C:\Documents and Settings\user\fmi\data\uploads\54\php1553_522f35c51564f.tmp + * [error] => 0 + * [size] => 7108 + * ) + * + * [1] => Array + * ( + * [name] => b.txt.zip + * [type] => application/octet-stream + * [tmp_name] => C:\Documents and Settings\user\fmi\data\uploads\54\php1554_522f35c515844.tmp + * [error] => 0 + * [size] => 3066 + * ) + * ) + * + * [submit] => Upload + * ) + * @link http://framework.zend.com/manual/2.1/en/modules/zend.form.file-upload.html + * @return Zend\View\Model\ViewModel|array returns the standard things + */ + public function uploadMultiAction() + { + $this->init(); + if (!is_dir($this->_dir)) { + mkdir($this->_dir, 0777); + } + $form = new UploadMultiForm($this->_dir, 'upload-form'); + + $request = $this->getRequest(); + if ($request->isPost()) { + // Make certain to merge the files info! + $post = array_merge_recursive( + $request->getPost()->toArray(), + $request->getFiles()->toArray() + ); + + $form->setData($post); + if ($form->isValid()) { + $data = $form->getData(); + // Form is valid, save the form! + $this->setFileNames($data); + // The data can be saved in the DataBase + return $this->redirect()->toRoute('csn-file-manager'); + } + } + return new ViewModel(array('form' => $form)); + } + + public function viewAction() + { + $this->init(); + $file = urldecode($this->params()->fromRoute('id')); + + $filename = $this->_dir . DIRECTORY_SEPARATOR . $file; + $contents = null; +// echo '







filename: ' . $filename . '

'; +// echo '

dir = ' . $this->_dir . '

'; + + if (file_exists($filename)) { +/* + header('Content-Description: File Transfer'); + header('Content-Type: application/octet-stream'); + header('Content-Disposition: attachment; filename='.basename($file)); + header('Content-Transfer-Encoding: binary'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length: ' . filesize($this->_dir . DIRECTORY_SEPARATOR . $file)); // $file)); + ob_clean(); + flush(); + // readfile($file); + + readfile($this->_dir . DIRECTORY_SEPARATOR . $file); + exit; +*/ + // get contents of a file into a string + // $filename = "/usr/local/something.txt"; + $handle = fopen($filename, "r"); // "r" - not r but b for Windows "b" - keeps giving me errors no file +// $handle = fopen('C:\1_phpdocumentor.png', "b"); +// $handle = fopen('C:\WINDOWS\Temp\1_phpdocumentor.png', "r"); + $contents = fread($handle, filesize($filename)); + fclose($handle); + } + return new ViewModel(array('contents' => $contents)); + } + + public function downloadAction() + { + $this->init(); + $file = urldecode($this->params()->fromRoute('id')); + $filename = $this->_dir . DIRECTORY_SEPARATOR . $file; + + if (file_exists($filename)) { + header('Content-Description: File Transfer'); + header('Content-Type: application/octet-stream'); + header('Content-Disposition: attachment; filename='.basename($file)); + header('Content-Transfer-Encoding: binary'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length: ' . filesize($filename)); // $file)); + ob_clean(); + flush(); + // readfile($file); + readfile($filename); + exit; + } + + return new ViewModel(array()); + } + + public function getImageAction() + { + $this->init(); + $file = urldecode($this->params()->fromRoute('id')); + $filename = $this->_dir . DIRECTORY_SEPARATOR . $file; + + if (file_exists($filename)) { + header('Content-Type: image/jpeg'); + ob_clean(); + flush(); + readfile($filename); + exit; + } + return new ViewModel(array()); + } + + + public function deleteAction() + { + $this->init(); + $file = urldecode($this->params()->fromRoute('id')); + $filename = $this->_dir . DIRECTORY_SEPARATOR . $file; + unlink ($filename); + return $this->redirect()->toRoute('csn-file-manager'); + return new ViewModel(array()); + } + + /** + * Change the names of the uploaded files to their original names. Since we don't keep anything in the DB + * + * @param array $data array of arrays + * @return void + */ + protected function setFileNames($data) + { + unset($data['submit']); + foreach ($data['image-file'] as $key => $file) { + rename($file['tmp_name'], $this->_dir . DIRECTORY_SEPARATOR . $file['name']); + } + } +} \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/src/CsnFileManager/Form/FileFilter.php b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/FileFilter.php new file mode 100644 index 00000000..36d4e5ae --- /dev/null +++ b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/FileFilter.php @@ -0,0 +1,104 @@ +add($filter); +/* + // self::__construct(); // parent::__construct(); - trows and error + $this->add(array( + 'name' => 'usrName', + 'required' => true, + 'filters' => array( + array('name' => 'StripTags'), + array('name' => 'StringTrim'), + ), + 'validators' => array( + array( + 'name' => 'StringLength', + 'options' => array( + 'encoding' => 'UTF-8', + 'min' => 1, + 'max' => 100, + ), + ), + array( + 'name' => 'DoctrineModule\Validator\NoObjectExists', + 'options' => array( + 'object_repository' => $sm->get('doctrine.entitymanager.orm_default')->getRepository('AuthDoctrine\Entity\User'), + 'fields' => 'usrName' + ), + ), + ), + )); + + $this->add(array( + 'name' => 'usrEmail', + 'required' => true, + 'validators' => array( + array( + 'name' => 'EmailAddress' + ), + array( + 'name' => 'DoctrineModule\Validator\NoObjectExists', + 'options' => array( + 'object_repository' => $sm->get('doctrine.entitymanager.orm_default')->getRepository('AuthDoctrine\Entity\User'), + 'fields' => 'usrEmail' + ), + ), + ), + )); + + $this->add(array( + 'name' => 'usrPassword', + 'required' => true, + 'filters' => array( + array('name' => 'StripTags'), + array('name' => 'StringTrim'), + ), + 'validators' => array( + array( + 'name' => 'StringLength', + 'options' => array( + 'encoding' => 'UTF-8', + 'min' => 6, + 'max' => 12, + ), + ), + ), + )); + + $this->add(array( + 'name' => 'usrPasswordConfirm', + 'required' => true, + 'filters' => array( + array('name' => 'StripTags'), + array('name' => 'StringTrim'), + ), + 'validators' => array( + array( + 'name' => 'StringLength', + 'options' => array( + 'encoding' => 'UTF-8', + 'min' => 6, + 'max' => 12, + ), + ), + array( + 'name' => 'Identical', + 'options' => array( + 'token' => 'usrPassword', + ), + ), + ), + )); +*/ + } +} \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/src/CsnFileManager/Form/FileForm.php b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/FileForm.php new file mode 100644 index 00000000..1ffaad8d --- /dev/null +++ b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/FileForm.php @@ -0,0 +1,47 @@ +setAttribute('method', 'post'); +/* + $this->add(array( + 'name' => 'file', + 'attributes' => array( + 'type' => 'Zend\Form\Element\File', + ), + 'options' => array( + 'label' => 'Single file input', + ), + )); +*/ + + // Single file upload + $file = new Element\File('file'); + $file->setLabel('Single file input'); + + // HTML5 multiple file upload + $multiFile = new Element\File('multi-file'); + $multiFile->setLabel('Multi file input') + ->setAttribute('multiple', true); + + // $form = new Form('my-file'); + $this->add($file) + ->add($multiFile); + + $this->add(array( + 'name' => 'submit', + 'attributes' => array( + 'type' => 'submit', + 'value' => 'Upload', + 'id' => 'submitbutton', + ), + )); + } +} \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadMultiForm.php b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadMultiForm.php new file mode 100644 index 00000000..adc6c4a6 --- /dev/null +++ b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadMultiForm.php @@ -0,0 +1,75 @@ +_dir = $dir; + $this->addElements(); + $this->addInputFilter(); + } + + public function addElements() + { + // File Input + $file = new Element\File('image-file'); + $file->setLabel('Avatar Image Upload') + ->setAttribute('id', 'image-file') + ->setAttribute('multiple', true); // That's it + $this->add($file); + + $this->add(array( + 'name' => 'submit', + 'attributes' => array( + 'type' => 'submit', + 'value' => 'Upload', + 'id' => 'submitbutton', + ), + )); + } + + /** + * Adding a RenameUpload filter to our form�s file input, with details on where the valid files should be stored + */ + public function addInputFilter() + { + $inputFilter = new InputFilter\InputFilter(); + + // File Input + $fileInput = new InputFilter\FileInput('image-file'); + $fileInput->setRequired(true); + + // You only need to define validators and filters + // as if only one file was being uploaded. All files + // will be run through the same validators and filters + // automatically. + $fileInput->getValidatorChain() + ->attachByName('filesize', array('max' => 204800)) + ->attachByName('filemimetype', array('mimeType' => 'image/png,image/x-png, image/jpeg')); +// ->attachByName('fileimagesize', array('maxWidth' => 100, 'maxHeight' => 100)); + + // All files will be renamed, i.e.: + // ./data/tmpuploads/avatar_4b3403665fea6.png, + // ./data/tmpuploads/avatar_5c45147660fb7.png + $fileInput->getFilterChain()->attachByName( + 'filerenameupload', + array( + 'target' => $this->_dir, // './data/tmpuploads/avatar.png', + 'randomize' => true, + ) + ); + $inputFilter->add($fileInput); + + $this->setInputFilter($inputFilter); + } +} \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadSimpleForm.php b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadSimpleForm.php new file mode 100644 index 00000000..b7cb9945 --- /dev/null +++ b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadSimpleForm.php @@ -0,0 +1,33 @@ +addElements(); + } + + public function addElements() + { + // File Input + $file = new Element\File('image-file'); + $file->setLabel('Avatar Image Upload') + ->setAttribute('id', 'image-file'); + $this->add($file); + + $this->add(array( + 'name' => 'submit', + 'attributes' => array( + 'type' => 'submit', + 'value' => 'Upload', + 'id' => 'submitbutton', + ), + )); + } +} \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadSingleForm.php b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadSingleForm.php new file mode 100644 index 00000000..4a831d17 --- /dev/null +++ b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadSingleForm.php @@ -0,0 +1,61 @@ +_dir = $dir; + $this->addElements(); + $this->addInputFilter(); + } + + public function addElements() + { + // File Input + $file = new Element\File('image-file'); + $file->setLabel('Avatar Image Upload') + ->setAttribute('id', 'image-file'); + $this->add($file); + + $this->add(array( + 'name' => 'submit', + 'attributes' => array( + 'type' => 'submit', + 'value' => 'Upload', + 'id' => 'submitbutton', + ), + )); + } + + /** + * Adding a RenameUpload filter to our form�s file input, with details on where the valid files should be stored + */ + public function addInputFilter() + { + $inputFilter = new InputFilter\InputFilter(); + + // File Input + $fileInput = new InputFilter\FileInput('image-file'); + $fileInput->setRequired(true); + $fileInput->getFilterChain()->attachByName( + 'filerenameupload', + array( + 'target' => $this->_dir, // './data/tmpuploads/avatar.png', + 'randomize' => true, // false, // true, + ) + ); + $inputFilter->add($fileInput); + + $this->setInputFilter($inputFilter); + } +} \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadStoyanForm.php b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadStoyanForm.php new file mode 100644 index 00000000..d6e1dbb9 --- /dev/null +++ b/module/CsnFileManagerExperimental/src/CsnFileManager/Form/UploadStoyanForm.php @@ -0,0 +1,48 @@ +setAttribute('method', 'post'); +/* + $this->add(array( + 'name' => 'file', + 'attributes' => array( + 'type' => 'Zend\Form\Element\File', + ), + 'options' => array( + 'label' => 'Single file input', + ), + )); +*/ + + // Single file upload + $file = new Element\File('file'); + $file->setLabel('Single file input'); + + // HTML5 multiple file upload + $multiFile = new Element\File('multi-file'); + $multiFile->setLabel('Multi file input') + ->setAttribute('multiple', true); + + // $form = new Form('my-file'); + $this->add($file) + ->add($multiFile); + + $this->add(array( + 'name' => 'submit', + 'attributes' => array( + 'type' => 'submit', + 'value' => 'Upload', + 'id' => 'submitbutton', + ), + )); + } +} \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/view/csn-file-manager/index/delete.phtml b/module/CsnFileManagerExperimental/view/csn-file-manager/index/delete.phtml new file mode 100644 index 00000000..3ac50625 --- /dev/null +++ b/module/CsnFileManagerExperimental/view/csn-file-manager/index/delete.phtml @@ -0,0 +1 @@ +

delete.phtml

\ No newline at end of file diff --git a/module/CsnFileManagerExperimental/view/csn-file-manager/index/download.phtml b/module/CsnFileManagerExperimental/view/csn-file-manager/index/download.phtml new file mode 100644 index 00000000..77b51867 --- /dev/null +++ b/module/CsnFileManagerExperimental/view/csn-file-manager/index/download.phtml @@ -0,0 +1 @@ +

download.phtml

\ No newline at end of file diff --git a/module/CsnFileManagerExperimental/view/csn-file-manager/index/get-image.phtml b/module/CsnFileManagerExperimental/view/csn-file-manager/index/get-image.phtml new file mode 100644 index 00000000..58fa35b3 --- /dev/null +++ b/module/CsnFileManagerExperimental/view/csn-file-manager/index/get-image.phtml @@ -0,0 +1 @@ +

get-image.phtml

\ No newline at end of file diff --git a/module/CsnFileManagerExperimental/view/csn-file-manager/index/index.phtml b/module/CsnFileManagerExperimental/view/csn-file-manager/index/index.phtml new file mode 100644 index 00000000..b49baede --- /dev/null +++ b/module/CsnFileManagerExperimental/view/csn-file-manager/index/index.phtml @@ -0,0 +1,32 @@ +





+headTitle($title); +?> +

escapeHtml($title); ?>

+

+ Upload +

+ + + + + + + + + + + + + +
Name  
+ Get + View + Download + Delete +
\ No newline at end of file diff --git a/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-multi.phtml b/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-multi.phtml new file mode 100644 index 00000000..28989e10 --- /dev/null +++ b/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-multi.phtml @@ -0,0 +1,19 @@ +





+headTitle($title); +?> +

escapeHtml($title); ?>

+

tempFile; ?>

+form; +$form->setAttribute('action', $this->url('csn-file-manager/default', array('controller' => 'index', 'action' => 'upload-multi'))); +$form->prepare(); + +echo $this->form()->openTag($form); +// echo $this->formRow($form->get('file')); +// echo $this->formRow($form->get('multi-file'));image-file +echo $this->formRow($form->get('image-file')); +echo $this->formSubmit($form->get('submit')); +echo $this->form()->closeTag(); +?> \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-simple.phtml b/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-simple.phtml new file mode 100644 index 00000000..d10813c0 --- /dev/null +++ b/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-simple.phtml @@ -0,0 +1,18 @@ +





+headTitle($title); +?> +

escapeHtml($title); ?>

+form; +$form->setAttribute('action', $this->url('csn-file-manager/default', array('controller' => 'index', 'action' => 'upload-simple'))); +$form->prepare(); + +echo $this->form()->openTag($form); +// echo $this->formRow($form->get('file')); +// echo $this->formRow($form->get('multi-file'));image-file +echo $this->formRow($form->get('image-file')); +echo $this->formSubmit($form->get('submit')); +echo $this->form()->closeTag(); +?> \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-single.phtml b/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-single.phtml new file mode 100644 index 00000000..bef7f23f --- /dev/null +++ b/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload-single.phtml @@ -0,0 +1,19 @@ +





+headTitle($title); +?> +

escapeHtml($title); ?>

+

tempFile; ?>

+form; +$form->setAttribute('action', $this->url('csn-file-manager/default', array('controller' => 'index', 'action' => 'upload-single'))); +$form->prepare(); + +echo $this->form()->openTag($form); +// echo $this->formRow($form->get('file')); +// echo $this->formRow($form->get('multi-file'));image-file +echo $this->formRow($form->get('image-file')); +echo $this->formSubmit($form->get('submit')); +echo $this->form()->closeTag(); +?> \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload.phtml b/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload.phtml new file mode 100644 index 00000000..53d020cc --- /dev/null +++ b/module/CsnFileManagerExperimental/view/csn-file-manager/index/upload.phtml @@ -0,0 +1,18 @@ +





+headTitle($title); +?> +

escapeHtml($title); ?>

+form; +$form->setAttribute('action', $this->url('csn-file-manager/default', array('controller' => 'index', 'action' => 'upload'))); +$form->prepare(); + +echo $this->form()->openTag($form); +// echo $this->formRow($form->get('file')); +// echo $this->formRow($form->get('multi-file'));image-file +echo $this->formRow($form->get('image-file')); +echo $this->formSubmit($form->get('submit')); +echo $this->form()->closeTag(); +?> \ No newline at end of file diff --git a/module/CsnFileManagerExperimental/view/csn-file-manager/index/view.phtml b/module/CsnFileManagerExperimental/view/csn-file-manager/index/view.phtml new file mode 100644 index 00000000..5d504c9a --- /dev/null +++ b/module/CsnFileManagerExperimental/view/csn-file-manager/index/view.phtml @@ -0,0 +1,2 @@ +"; \ No newline at end of file