示例#1
0
 /**
  * Shows the UploadForm
  *
  * @global    ADONewConnection
  * @global    array
  */
 function showUploadForm()
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG;
     /**
      * Uploader button handling
      */
     //paths we want to remember for handling the uploaded files
     $paths = array('path' => ASCMS_GALLERY_PATH, 'webPath' => ASCMS_GALLERY_WEB_PATH);
     $uploader = new Uploader();
     //        $comboUp = \Cx\Core_Modules\Upload\Controller\UploadFactory::getInstance()->newUploader('exposedCombo');
     $uploader->setFinishedCallback(array(ASCMS_MODULE_PATH . '/Gallery/Controller/GalleryManager.class.php', '\\Cx\\Modules\\Gallery\\Controller\\GalleryManager', 'uploadFinished'));
     $uploader->setData($paths);
     $uploader->addClass('uploadbutton');
     $uploader->setOptions(array('allowed-extensions' => array('jpg', 'gif', 'png')));
     $uploader->setCallback('finishedGalleryUpload');
     //set instance name to combo_uploader so we are able to catch the instance with js
     //        $comboUp->setJsInstanceName('exposed_combo_uploader');
     $redirectUrl = \Cx\Core\Csrf\Controller\Csrf::enhanceURI('index.php?cmd=Gallery&act=validate_form');
     $this->_objTpl->loadTemplateFile('module_gallery_upload_images.html', true, true);
     $this->_objTpl->setVariable(array('COMBO_UPLOADER_CODE' => $uploader->getXHtml($_ARRAYLANG['TXT_GALLERY_MENU_UPLOAD_FORM_SUBMIT']), 'REDIRECT_URL' => $redirectUrl));
     //end of uploader button handling
     //get enabled filetypes
     $strEnabledTypes = '';
     if ($this->boolGifEnabled == true) {
         $strEnabledTypes .= 'GIF ';
     }
     if ($this->boolJpgEnabled == true) {
         $strEnabledTypes .= 'JPG ';
     }
     if ($this->boolPngEnabled == true) {
         $strEnabledTypes .= 'PNG ';
     }
     $objResult = $objDatabase->Execute('SELECT         *
                                                 FROM         ' . DBPREFIX . 'module_gallery_pictures
                                                 WHERE         validated="0"
                                                 ORDER BY     lastedit ASC');
     while (!$objResult->EOF) {
         $this->_objTpl->setVariable('GALLERY_UPLOADED_IMAGE', '<img src="' . $this->strImageWebPath . $objResult->fields['path'] . '" class="galleryImageVisible" />');
         $this->_objTpl->parse('uploadedImages');
         $objResult->MoveNext();
     }
     if ($objResult->_numOfRows == 0) {
         $this->_objTpl->setVariable('GALLERY_ALREADY_UPLOADED_IMAGES', 'confirmImages');
     }
     $this->_objTpl->setVariable(array('TXT_TITLE' => $_ARRAYLANG['TXT_GALLERY_MENU_UPLOAD_FORM'], 'TXT_GALLERY_UPLOAD_CONFIRM_IMAGES' => $_ARRAYLANG['TXT_GALLERY_UPLOAD_CONFIRM_IMAGES'], 'TXT_GALLERY_UPLOAD_IMAGES' => $_ARRAYLANG['TXT_GALLERY_UPLOAD_IMAGES'], 'TXT_GALLERY_UPLOAD_HELP' => $_ARRAYLANG['TXT_GALLERY_UPLOAD_HELP'], 'TXT_IMAGENUMBER' => $_ARRAYLANG['TXT_GALLERY_UPLOAD_FORM_IMAGE_NUMBER'], 'TXT_ENABLED_IMAGE_TYPE' => $_ARRAYLANG['TXT_GALLERY_FORMAT_SUPPORT'] . ' ' . $strEnabledTypes . '. ' . $_ARRAYLANG['TXT_GALLERY_NO_UPLOAD'], 'TXT_BUTTON_SUBMIT' => $_ARRAYLANG['TXT_GALLERY_MENU_UPLOAD_FORM_SUBMIT']));
 }
 /**
  * Shows the UploadForm
  *
  * @global    ADONewConnection
  * @global    array
  */
 function showUploadForm()
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG;
     /**
      * Uploader button handling
      */
     //paths we want to remember for handling the uploaded files
     $paths = array('path' => ASCMS_GALLERY_PATH, 'webPath' => ASCMS_GALLERY_WEB_PATH);
     $uploader = new Uploader();
     //        $comboUp = \Cx\Core_Modules\Upload\Controller\UploadFactory::getInstance()->newUploader('exposedCombo');
     $uploader->setFinishedCallback(array(ASCMS_MODULE_PATH . '/Gallery/Controller/GalleryManager.class.php', '\\Cx\\Modules\\Gallery\\Controller\\GalleryManager', 'uploadFinished'));
     $uploader->setData($paths);
     $uploader->addClass('uploadbutton');
     $uploader->setCallback('finishedGalleryUpload');
     //set instance name to combo_uploader so we are able to catch the instance with js
     //        $comboUp->setJsInstanceName('exposed_combo_uploader');
     $redirectUrl = \Cx\Core\Csrf\Controller\Csrf::enhanceURI('index.php?cmd=Gallery&act=validate_form');
     $this->_objTpl->loadTemplateFile('module_gallery_upload_images.html', true, true);
     $this->_objTpl->setVariable(array('COMBO_UPLOADER_CODE' => $uploader->getXHtml($_ARRAYLANG['TXT_GALLERY_MENU_UPLOAD_FORM_SUBMIT']), 'REDIRECT_URL' => $redirectUrl));
     //end of uploader button handling
     //get enabled filetypes
     $strEnabledTypes = '';
     if ($this->boolGifEnabled == true) {
         $strEnabledTypes .= 'GIF ';
     }
     if ($this->boolJpgEnabled == true) {
         $strEnabledTypes .= 'JPG ';
     }
     if ($this->boolPngEnabled == true) {
         $strEnabledTypes .= 'PNG ';
     }
     $this->_objTpl->setVariable(array('TXT_TITLE' => $_ARRAYLANG['TXT_GALLERY_MENU_UPLOAD_FORM'], 'TXT_GALLERY_UPLOAD_CONFIRM_IMAGES' => $_ARRAYLANG['TXT_GALLERY_UPLOAD_CONFIRM_IMAGES'], 'TXT_GALLERY_UPLOAD_IMAGES' => $_ARRAYLANG['TXT_GALLERY_UPLOAD_IMAGES'], 'TXT_GALLERY_UPLOAD_HELP' => $_ARRAYLANG['TXT_GALLERY_UPLOAD_HELP'], 'TXT_IMAGENUMBER' => $_ARRAYLANG['TXT_GALLERY_UPLOAD_FORM_IMAGE_NUMBER'], 'TXT_ENABLED_IMAGE_TYPE' => $_ARRAYLANG['TXT_GALLERY_FORMAT_SUPPORT'] . ' ' . $strEnabledTypes . '. ' . $_ARRAYLANG['TXT_GALLERY_NO_UPLOAD'], 'TXT_BUTTON_SUBMIT' => $_ARRAYLANG['TXT_GALLERY_MENU_UPLOAD_FORM_SUBMIT']));
 }