コード例 #1
0
 /**
  * Show uploader form.
  * @return HTML string
  */
 public function getUploaderForm($isMultiple = true, $iContentId = false)
 {
     parent::getUploaderForm($isMultiple, $iContentId);
     $sForm = $this->_oTemplate->parseHtmlByName('uploader_form_html5.html', array('form_container_id' => $this->_sFormContainerId, 'errors_container_id' => $this->_sErrorsContainerId, 'uploader_instance_name' => $this->getNameJsInstanceUploader(), 'restrictions_text' => $this->getRestrictionsText(), 'div_id' => $this->_sDivId, 'content_id' => $iContentId));
     bx_import('BxTemplFunctions');
     return BxTemplFunctions::getInstance()->transBox('', $sForm);
 }
コード例 #2
0
 /**
  * Show uploader form.
  * @return HTML string
  */
 public function getUploaderForm($isMultiple = true, $iContentId = false)
 {
     parent::getUploaderForm($isMultiple, $iContentId);
     $sForm = $this->_oTemplate->parseHtmlByName('uploader_form_simple.html', array('form_container_id' => $this->_sFormContainerId, 'errors_container_id' => $this->_sErrorsContainerId, 'uploader_instance_name' => $this->getNameJsInstanceUploader(), 'restrictions_text' => $this->getRestrictionsText(), 'iframe_id' => $this->_sIframeId, 'engine' => $this->_aObject['object'], 'storage_object' => $this->_sStorageObject, 'uniq_id' => $this->_sUniqId, 'multiple' => $isMultiple, 'content_id' => $iContentId));
     bx_import('BxTemplFunctions');
     return BxTemplFunctions::getInstance()->transBox('', $sForm);
 }
コード例 #3
0
ファイル: BxBaseFormView.php プロジェクト: blas-dmx/trident
 function addCssJs()
 {
     if (isset($this->aParams['view_mode']) && $this->aParams['view_mode']) {
         if (self::$_isCssJsAddedViewMode) {
             return;
         }
         $this->oTemplate->addCss('forms.css');
         self::$_isCssJsAddedViewMode = true;
     } else {
         if (self::$_isCssJsAdded) {
             return;
         }
         $aCss = array('forms.css', 'jquery-ui/jquery-ui.css', 'timepicker-addon/jquery-ui-timepicker-addon.css');
         $aUiLangs = array('af' => 1, 'ar-DZ' => 1, 'ar' => 1, 'az' => 1, 'be' => 1, 'bg' => 1, 'bs' => 1, 'ca' => 1, 'cs' => 1, 'cy-GB' => 1, 'da' => 1, 'de' => 1, 'el' => 1, 'en-AU' => 1, 'en-GB' => 1, 'en-NZ' => 1, 'en' => 1, 'eo' => 1, 'es' => 1, 'et' => 1, 'eu' => 1, 'fa' => 1, 'fi' => 1, 'fo' => 1, 'fr-CA' => 1, 'fr-CH' => 1, 'fr' => 1, 'gl' => 1, 'he' => 1, 'hi' => 1, 'hr' => 1, 'hu' => 1, 'hy' => 1, 'id' => 1, 'is' => 1, 'it' => 1, 'ja' => 1, 'ka' => 1, 'kk' => 1, 'km' => 1, 'ko' => 1, 'ky' => 1, 'lb' => 1, 'lt' => 1, 'lv' => 1, 'mk' => 1, 'ml' => 1, 'ms' => 1, 'nb' => 1, 'nl-BE' => 1, 'nl' => 1, 'nn' => 1, 'no' => 1, 'pl' => 1, 'pt-BR' => 1, 'pt' => 1, 'rm' => 1, 'ro' => 1, 'ru' => 1, 'sk' => 1, 'sl' => 1, 'sq' => 1, 'sr-SR' => 1, 'sr' => 1, 'sv' => 1, 'ta' => 1, 'th' => 1, 'tj' => 1, 'tr' => 1, 'uk' => 1, 'vi' => 1, 'zh-CN' => 1, 'zh-HK' => 1, 'zh-TW' => 1);
         $aCalendarLangs = array('af' => 1, 'am' => 1, 'bg' => 1, 'ca' => 1, 'cs' => 1, 'da' => 1, 'de' => 1, 'el' => 1, 'es' => 1, 'et' => 1, 'eu' => 1, 'fi' => 1, 'fr' => 1, 'gl' => 1, 'he' => 1, 'hr' => 1, 'hu' => 1, 'id' => 1, 'it' => 1, 'ja' => 1, 'ko' => 1, 'lt' => 1, 'nl' => 1, 'no' => 1, 'pl' => 1, 'pt-BR' => 1, 'pt' => 1, 'ro' => 1, 'ru' => 1, 'sk' => 1, 'sr-RS' => 1, 'sr-YU' => 1, 'sv' => 1, 'th' => 1, 'tr' => 1, 'uk' => 1, 'vi' => 1, 'zh-CN' => 1, 'zh-TW' => 1);
         bx_import('BxDolLanguages');
         $sCalendarLang = BxDolLanguages::getInstance()->detectLanguageFromArray($aCalendarLangs);
         $sUiLang = BxDolLanguages::getInstance()->detectLanguageFromArray($aUiLangs);
         $aJs = array('jquery.webForms.js', 'jquery-ui/jquery.ui.core.min.js', 'jquery-ui/jquery.ui.widget.min.js', 'jquery-ui/jquery.ui.mouse.min.js', 'jquery-ui/jquery.ui.position.min.js', 'jquery-ui/jquery.ui.slider.min.js', 'jquery-ui/jquery.ui.datepicker.min.js', 'jquery-ui/i18n/jquery.ui.datepicker-' . $sUiLang . '.js', 'timepicker-addon/jquery-ui-timepicker-addon.min.js', 'timepicker-addon/jquery-ui-sliderAccess.js', 'timepicker-addon/i18n/jquery-ui-timepicker-' . $sCalendarLang . '.js');
         foreach ($this->aInputs as $aInput) {
             if (!isset($aInput['type']) || 'files' != $aInput['type'] || !isset($aInput['uploaders'])) {
                 continue;
             }
             bx_import('BxDolUploader');
             foreach ($aInput['uploaders'] as $sUploaderObject) {
                 $oUploader = BxDolUploader::getObjectInstance($sUploaderObject, $aInput['storage_object'], '');
                 if ($oUploader) {
                     $oUploader->addCssJs();
                 }
             }
         }
         $this->oTemplate->addJs($aJs);
         $this->oTemplate->addCss($aCss);
         self::$_isCssJsAdded = true;
     }
 }
コード例 #4
0
 function __construct($aObject, $sStorageObject, $sUniqId)
 {
     parent::__construct($aObject, $sStorageObject, $sUniqId);
     $this->_sIframeId = 'bx-form-input-files-' . $sUniqId . '-iframe';
     $this->_sButtonTemplate = 'uploader_button_simple.html';
 }
コード例 #5
0
$isMultiple = bx_get('m') ? true : false;
$sFormat = bx_process_input(bx_get('f'));
if ($sFormat != 'html' && $sFormat != 'json') {
    $sFormat = 'html';
}
$iContentId = bx_get('c');
if (false === $iContentId || '' === $iContentId) {
    $iContentId = false;
} else {
    $iContentId = bx_process_input($iContentId, BX_DATA_INT);
}
if (!$sUploaderObject || !$sStorageObject || !$sUniqId) {
    exit;
}
bx_import('BxDolUploader');
$oUploader = BxDolUploader::getObjectInstance($sUploaderObject, $sStorageObject, $sUniqId);
if (!$oUploader) {
    // no such uploader available
    exit;
}
$sAction = bx_process_input(bx_get('a'));
switch ($sAction) {
    case 'show_uploader_form':
        header('Content-type: text/html; charset=utf-8');
        require_once BX_DIRECTORY_PATH_INC . "design.inc.php";
        bx_import('BxDolLanguages');
        echo $oUploader->getUploaderForm($isMultiple, $iContentId);
        break;
    case 'restore_ghosts':
        header('Content-type: text/html; charset=utf-8');
        $sImagesTranscoder = bx_process_input(bx_get('img_trans'));
コード例 #6
0
 /**
  * add necessary js, css files and js translations
  */
 public function addCssJs()
 {
     parent::addCssJs();
     $this->_oTemplate->addJs('fileuploader.js');
 }
コード例 #7
0
 /**
  * Generate Select Box Element
  *
  * @param  array  $aInput
  * @return string
  */
 function genInputFiles(&$aInput, $sInfo = '', $sError = '')
 {
     $sUniqId = genRndPwd(8, false);
     $sUploaders = '';
     $oUploader = null;
     foreach ($aInput['uploaders'] as $sUploaderObject) {
         bx_import('BxDolUploader');
         $oUploader = BxDolUploader::getObjectInstance($sUploaderObject, $aInput['storage_object'], $sUniqId);
         if (!$oUploader) {
             continue;
         }
         $sGhostTemplate = false;
         if (isset($aInput['ghost_template']) && is_object($aInput['ghost_template'])) {
             // form is not submitted and ghost template is BxDolFormNested object
             $oFormNested = $aInput['ghost_template'];
             if ($oFormNested instanceof BxDolFormNested) {
                 $sGhostTemplate = $oFormNested->getCode();
             }
         } elseif (isset($aInput['ghost_template']) && is_array($aInput['ghost_template']) && isset($aInput['ghost_template']['inputs'])) {
             // form is not submitted and ghost template is form array
             bx_import('BxDolFormNested');
             $oFormNested = new BxDolFormNested($aInput['name'], $aInput['ghost_template'], $this->aParams['db']['submit_name'], $this->oTemplate);
             $sGhostTemplate = $oFormNested->getCode();
         } elseif (isset($aInput['ghost_template']) && is_array($aInput['ghost_template']) && $aInput['ghost_template']) {
             // form is submitted and ghost template is array of BxDolFormNested objects
             bx_import('BxDolFormNested');
             $sGhostTemplate = array();
             foreach ($aInput['ghost_template'] as $iFileId => $oFormNested) {
                 if (is_object($oFormNested) && $oFormNested instanceof BxDolFormNested) {
                     $sGhostTemplate[$iFileId] = $oFormNested->getCode();
                 }
             }
         } elseif (isset($aInput['ghost_template']) && is_string($aInput['ghost_template'])) {
             // ghost template is just string template, without nested form
             $sGhostTemplate = $aInput['ghost_template'];
         }
         $aParams = array('button_title' => bx_js_string($oUploader->getUploaderButtonTitle(isset($aInput['upload_buttons_titles']) ? $aInput['upload_buttons_titles'] : false)), 'content_id' => isset($aInput['content_id']) ? $aInput['content_id'] : '');
         if (isset($aInput['images_transcoder']) && $aInput['images_transcoder']) {
             $aParams['images_transcoder'] = bx_js_string($aInput['images_transcoder']);
         }
         $sUploaders .= $oUploader->getUploaderButton($sGhostTemplate, isset($aInput['multiple']) ? $aInput['multiple'] : true, $aParams);
     }
     return $this->oTemplate->parseHtmlByName('form_field_uploader.html', array('uploaders_buttons' => $sUploaders, 'info' => $sInfo, 'error' => $sError, 'id_container_errors' => $oUploader ? $oUploader->getIdContainerErrors() : '', 'id_container_result' => $oUploader ? $oUploader->getIdContainerResult() : '', 'uploader_instance_name' => $oUploader ? $oUploader->getNameJsInstanceUploader() : '', 'is_init_ghosts' => isset($aInput['init_ghosts']) && !$aInput['init_ghosts'] ? 0 : 1));
 }