/** * Use this to parse your backend page * * You will get the template located in /View/Template/{CMD}.html * You can access Cx class using $this->cx * To show messages, use \Message class * * @param \Cx\Core\Html\Sigma $template Template for current CMD * @param array $cmd CMD separated by slashes */ public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd) { $uploader = new Uploader(); $uploader->setFinishedCallback('\\Cx\\Core_Modules\\Uploader\\Model\\DefaultUploadCallback'); $uploader->setCallback('gallery.uploader'); $template->setVariable('UPLOADER_CODE', $uploader->getXHtml('Open Uploader 1')); $uploader2 = new Uploader(); $uploader2->setUploadLimit(1); $uploader2->setFinishedCallback('\\Cx\\Core_Modules\\Uploader\\Model\\DefaultUploadCallback'); $uploader2->setCallback('gallery.uploader2'); $uploader2->setType(Uploader::UPLOADER_TYPE_INLINE); $template->setVariable('UPLOADER_CODE2', $uploader2->getXHtml('Open Uploader 2')); $configurations = array(array(), array('startview' => 'sitestructure', 'views' => 'sitestructure'), array('views' => 'uploader'), array('views' => 'sitestructure'), array('views' => 'filebrowser'), array('startmediatype' => 'gallery'), array('mediatypes' => 'gallery, files'), array('multipleselect' => true), array('data-cx-Mb-Cb-Js-modalopened' => 'testfunction')); foreach ($configurations as $configuration) { $mediaBrowser = new MediaBrowser(); $mediaBrowser->setOptions($configuration); $mediaBrowser->setCallback('gallery.fancyCallback'); $template->setVariable('MEDIABROWSER_CODE', $mediaBrowser->getXHtml('MediaBrowser')); $template->setVariable('MEDIABROWSER_OPTIONS', var_export($configuration, true)); $template->setVariable('MEDIABROWSER_CODE_RAW', htmlspecialchars($mediaBrowser->getXHtml('MediaBrowser'))); $template->parse('mediabrowser_demo'); } $template->setVariable('MEDIABROWSER_FOLDER_WIDGET', new \Cx\Core_Modules\MediaBrowser\Model\Entity\FolderWidget($this->cx->getWebsiteImagesContentPath())); $template->setVariable('MEDIABROWSER_FOLDER_WIDGET_VIEW_MODE', new \Cx\Core_Modules\MediaBrowser\Model\Entity\FolderWidget($this->cx->getWebsiteImagesContentPath(), true)); }
/** * Use this to parse your backend page * * You will get the template located in /View/Template/{CMD}.html * You can access Cx class using $this->cx * To show messages, use \Message class * * @param \Cx\Core\Html\Sigma $template Template for current CMD * @param array $cmd CMD separated by slashes */ public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd) { $uploader = new Uploader(); $uploader->setFinishedCallback('\\Cx\\Core_Modules\\Uploader\\Model\\DefaultUploadCallback'); $uploader->setCallback('gallery.uploader'); $template->setVariable('UPLOADER_CODE', $uploader->getXHtml('Open Uploader 1')); $uploader2 = new Uploader(); $uploader2->setFinishedCallback('\\Cx\\Core_Modules\\Uploader\\Model\\DefaultUploadCallback'); $uploader2->setCallback('gallery.uploader2'); $uploader2->setType(Uploader::UPLOADER_TYPE_INLINE); $template->setVariable('UPLOADER_CODE2', $uploader2->getXHtml('Open Uploader 2')); $mediaBrowser = new MediaBrowser(); $mediaBrowser->setCallback('gallery.fancyCallback'); $template->setVariable('MEDIABROWSER_CODE1', $mediaBrowser->getXHtml('MediaBrowser')); $template->setVariable('MEDIABROWSER_CODE1_RAW', htmlspecialchars($mediaBrowser->getXHtml('MediaBrowser'))); $template->setVariable('MEDIABROWSER_FOLDER_WIDGET', new \Cx\Core_Modules\MediaBrowser\Model\Entity\FolderWidget($this->cx->getWebsiteImagesContentPath())); $template->setVariable('MEDIABROWSER_FOLDER_WIDGET_VIEW_MODE', new \Cx\Core_Modules\MediaBrowser\Model\Entity\FolderWidget($this->cx->getWebsiteImagesContentPath(), true)); }
/** * 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'])); }