Ejemplo n.º 1
0
    public function render_html_onStart()
    {
        // TODO localizzare il javascript
        $this->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile('jquery-simplemodal/jquery.simplemodal.1.4.1.min.js'));
        $this->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile('progressBar/progressBar.js'));
        $this->addOutputCode(org_glizy_helpers_CSS::linkCoreCSSfile2('progressBar/progressBar.css'), 'head');
        $this->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile('formWithAjaxSteps.js?v=' . GLZ_CORE_VERSION));
        parent::render_html_onStart();
        $ajaxUrl = $this->getAttribute('controllerName') ? $this->getAjaxUrl() : '';
        $output = <<<EOD
<div id="progress_bar" class="js-glizycms-FormEditWithAjaxSteps ui-progress-bar ui-container" data-ajaxurl="{$ajaxUrl}">
  <div class="ui-progress" style="width: 0%;">
    <span class="ui-label" style="display:none;"><b class="value">0%</b></span>
  </div>
</div>
EOD;
        $this->addOutputCode($output);
    }
Ejemplo n.º 2
0
    private function addTinyMCE($attachToElement)
    {
        if ($this->getAttribute('htmlEditor') === true) {
            $rootComponent =& $this->getRootComponent();
            if (!org_glizy_ObjectValues::get('org.glizy.JS.TinyMCE', 'add', false)) {
                org_glizy_ObjectValues::set('org.glizy.JS.TinyMCE', 'add', true);
                $rootComponent->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile('tiny_mce.js?v=' . GLZ_CORE_VERSION, 'tiny_mce/', false), 'head');
                $rootComponent->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile('Glizy_tiny_mce.js?v=' . GLZ_CORE_VERSION), 'head', true);
                $jsCode = 'Glizy.tinyCSS = "' . __Config::get('TINY_MCE_CSS') . '";';
                $jsCode .= 'Glizy.tinyMCE_plugins = "' . __Config::get('TINY_MCE_DEF_PLUGINS') . '";';
                $jsCode .= 'Glizy.tinyMCE_btn1 = "' . __Config::get('TINY_MCE_BUTTONS1') . '";';
                $jsCode .= 'Glizy.tinyMCE_btn2 = "' . __Config::get('TINY_MCE_BUTTONS2') . '";';
                $jsCode .= 'Glizy.tinyMCE_btn3 = "' . __Config::get('TINY_MCE_BUTTONS3') . '";';
                if (__Config::get('TINY_MCE_PLUGINS') != '') {
                    $jsCode .= 'Glizy.tinyMCE_plugins .= ",' . __Config::get('TINY_MCE_PLUGINS') . '";';
                }
                $rootComponent->addOutputCode(org_glizy_helpers_JS::JScode($jsCode), 'head');
            }
            if (!is_null($this->getAttribute('adm:tinyMCEplugin'))) {
                $pluginsNames = explode(',', $this->getAttribute('adm:tinyMCEplugin'));
                $pluginsPaths = array();
                for ($i = 0; $i < count($pluginsNames); $i++) {
                    $pos = strrpos($pluginsNames[$i], "/");
                    if ($pos !== false) {
                        $pluginsPaths[] = '../../../../../../' . $pluginsNames[$i];
                        $pluginsNames[$i] = substr($pluginsNames[$i], $pos + 1);
                    } else {
                        $pluginsPaths[] = $pluginsNames[$i];
                    }
                }
                if (count($pluginsPaths)) {
                    $jsCode = 'Glizy.tinyMCE_plugins += ",' . implode(',', $pluginsPaths) . '";';
                    $jsCode .= 'Glizy.tinyMCE_pluginsNames += ",' . implode(',', $pluginsNames) . '";';
                    $rootComponent->addOutputCode(org_glizy_helpers_JS::JScode($jsCode), 'head');
                }
            }
            if ($attachToElement) {
                $id = $this->getId();
                $jsCode = <<<EOD
jQuery(function(){
\tvar options = Glizy.tinyMCE_options;
\toptions.mode = "exact";
\toptions.elements = '{$id}';
\ttinyMCE.init( options );
});
EOD;
                //$this->addOutputCode(org_glizy_helpers_JS::JScode( $jsCode ));
            }
        }
    }
Ejemplo n.º 3
0
 function addJScoreLibraries()
 {
     if (!org_glizy_ObjectValues::get('org.glizy.JS.Core', 'add', false) && __Config::get('GLIZY_ADD_CORE_JS')) {
         org_glizy_ObjectValues::set('org.glizy.JS.Core', 'add', true);
         $this->addJSLibCore();
         if (__Config::get('DEBUG')) {
             $this->_rootComponent->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile('dejavu/strict/dejavu.js?v=' . GLZ_CORE_VERSION), 'head');
         } else {
             $this->_rootComponent->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile('dejavu/loose/dejavu.min.js?v=' . GLZ_CORE_VERSION), 'head');
         }
         $this->_rootComponent->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile('Glizy.js?v=' . GLZ_CORE_VERSION), 'head');
         $filename = $this->getLanguage() . '.js';
         if (!file_exists(__DIR__ . "/../../../../static/js/locale/" . $filename)) {
             $filename = 'en.js';
         }
         $this->_rootComponent->addOutputCode(org_glizy_helpers_JS::linkCoreJSfile($filename, 'locale/'), 'head');
     }
 }