Beispiel #1
0
 function _addJsCode()
 {
     if (!org_glizy_ObjectValues::get('org.glizy.googleMap', 'add', false)) {
         $rootComponent = $this->getRootComponent();
         $rootComponent->addOutputCode(org_glizy_helpers_JS::linkJSfile('http://maps.google.com/maps/api/js?sensor=false'), 'head');
     }
 }
Beispiel #2
0
 function render()
 {
     parent::render();
     $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/d3.v3.min.js'));
     $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/dagre-d3.min.js'));
     $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/graphlib-dot.min.js'));
 }
Beispiel #3
0
 /**
  * Render
  *
  * @return	string
  * @access	public
  */
 function render($outputMode = NULL, $skipChilds = false)
 {
     $this->_application->_rootComponent->addOutputCode(org_glizy_helpers_JS::JScode('if ( typeof(Glizy) == "undefined" ) Glizy = {}; Glizy.baseUrl ="' . GLZ_HOST . '"; Glizy.ajaxUrl = "ajax.php?pageId=' . $this->_application->getPageId() . '&ajaxTarget=' . $this->getId() . '&action=";'), 'head');
     $t = '';
     $this->applyOutputFilters('pre', $t);
     $this->renderChilds($outputMode);
     return $this->_render();
 }
Beispiel #4
0
 public function render($outputMode = NULL, $skipChilds = false)
 {
     parent::render($outputMode, $skipChilds);
     if (!org_glizy_ObjectValues::get('org.glizycms.js', 'jsTree', false)) {
         org_glizy_ObjectValues::set('org.glizycms.js', 'jsTree', true);
         $this->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery-jstree/jquery.jstree.js'));
         $this->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery-jstree/jquery.cookie.js'));
     }
 }
Beispiel #5
0
    /**
     * Render
     *
     * @return	void
     * @access	public
     */
    function render_html()
    {
        $folder = $this->getAttribute('folder');
        $src = $this->getAttribute('src');
        $type = $this->getAttribute('type');
        $language = $this->_application->getLanguage();
        $language2 = $language . '-' . strtoupper($language);
        $src = str_replace(array('##LANG##', '##LANG2##'), array($language, $language2), $src);
        if ($folder) {
            if (!org_glizy_ObjectValues::get('org.glizy.JS', 'run', false)) {
                org_glizy_ObjectValues::set('org.glizy.JS', 'run', true);
                $pageType = $this->_application->getPageType();
                $state = __Request::get('action', '');
                $params = __Request::getAllAsArray();
                unset($params['__params__']);
                unset($params['__routingName__']);
                unset($params['__routingPattern__']);
                unset($params['__url__']);
                unset($params['__back__url__']);
                $params = json_encode($params);
                $jsCode = <<<EOD
var GlizyApp = {};
GlizyApp.pages = {};
jQuery( function(){
\tif ( typeof( GlizyApp.pages[ '{$pageType}' ] ) != 'undefined' )
\t{
\t\tGlizyApp.pages[ '{$pageType}' ]( '{$state}', {$params} );
\t}
})
EOD;
                $this->addOutputCode(org_glizy_helpers_JS::JScode($jsCode), 'head');
            }
            // include tutta una cartella
            $jsFileName = $this->includeFolder($folder);
            if ($this->getAttribute('inline')) {
                $js = file_get_contents($jsFileName);
                if (strpos($js, '<script') !== false) {
                    $this->addOutputCode($js);
                } else {
                    $this->addOutputCode(org_glizy_helpers_JS::JScode($js, $type));
                }
            } else {
                $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jsFileName . (__Config::get('DEBUG') ? '?' . microtime(true) : ''), null, $type));
            }
        } else {
            if ($src) {
                $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($src, null, $type));
            } else {
                $this->addOutputCode(org_glizy_helpers_JS::JScode($this->replaceLocale($this->getText()), $type));
            }
        }
    }
Beispiel #6
0
 public function render_html_onStart()
 {
     if ($this->getAttribute('mode') == 'container') {
         $this->addOutputCode('<iframe id="js-glizycmsPageEdit" src="" data-emptysrc="' . $this->emptySrc . '" data-editsrc="' . $this->editSrc . '"></iframe>');
         $corePath = __Paths::get('CORE');
         $jQueryPath = $corePath . 'classes/org/glizycms/js/jquery/';
         $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.min.js'));
         $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.default.css'));
     } else {
         $this->addOutputCode('<div id="message-box"></div>');
         parent::render_html_onStart();
     }
 }
    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);
    }
Beispiel #8
0
    function render_html()
    {
        parent::render_html();
        if (!$this->getAttribute('readOnly')) {
            $id = $this->getId();
            $format = $this->getAttribute('showTime') ? 'GlizyLocale.datetime.format' : 'GlizyLocale.date.format';
            $minView = $this->getAttribute('showTime') ? '' : 'minView: \'month\',';
            $jsCode = <<<EOD
\$(function () {
\t\$("#{$id}").datetimepicker({
            language: 'it',
            format: {$format},
            {$minView}
            autoclose: true,
            todayHighlight: true
        });
});
EOD;
            $this->_parent->addOutputCode(org_glizy_helpers_JS::JScode($jsCode));
        }
    }
Beispiel #9
0
    public function render_html()
    {
        $graphCode = '';
        $entityTypeId = $this->getAttribute('entityTypeId') ? $this->getAttribute('entityTypeId') : __Request::get('entityTypeId');
        $documentId = $this->getAttribute('documentId') ? $this->getAttribute('documentId') : __Request::get('document_id');
        if ($entityTypeId && $documentId) {
            $graphCode = $this->getDocumentGraph($entityTypeId, $documentId);
        }
        if (empty($graphCode)) {
            return;
        }
        $title = __T('Relations');
        $id = $this->getId();
        $graphCode = <<<EOD
digraph "" {
    {$graphCode}
}
EOD;
        $graphCode = str_replace(array("\r", "\n"), '', addslashes($graphCode));
        $html .= <<<EOD
<article class="box collapsible big">
    <h1>{$title}</h1>
    <button data-toggle="collapse" class="show-content-box" type="button" data-target="#{$id}"></button>
    <div id="{$id}" style="text-align: center;">
        <svg width="800" height="600">
          <g transform="translate(20, 20)"/>
        </svg>
    </div>
</article>
<script>
        function tryDraw() {
            var result;
            try {
                result = graphlibDot.parse('{$graphCode}');
            } catch (e) {
                alert('Errore di caricamento del grafo!');
                throw e;
            }

            if (result) {
                var svg = d3.select("svg");
                var svgGroup = svg.append('g');
                var renderer = new dagreD3.Renderer();
                var layout = renderer.run(result, svgGroup);

                //var parentWidth = parseInt(\$(svg).parent().css('width').replace('px', '')) - 250;
                var parentWidth = 800;
                svg.attr('width', parentWidth);
                svg.attr('height', layout.graph().height + 250);
                var xCenterOffset = (svg.attr('width') - layout.graph().width) / 2;
                svgGroup.attr('transform', 'translate(' + xCenterOffset + ', 100)');
            }
        }

        function fixBaseTagProblem() {
            \$('g[class^="edgePaths"]').find('path').each(function() {
                \$(this).attr('marker-end', 'url(' + window.location + '#arrowhead)');
            });
        }

        function selectRootNode() {
            \$('div[class="main-node"]').parent().parent().parent().parent().children('rect').attr('class', 'main-node');
        }

        \$(window).bind('load', function() {
            tryDraw();
            fixBaseTagProblem();
            selectRootNode();
            \$('.collapsible').children('div').addClass('collapse');
        });
</script>
EOD;
        if ($this->getAttribute('addGraphJsLibs.js')) {
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/d3.v3.js'), 'head');
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/dagre-d3.js'), 'head');
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/graphlib-dot.min.js'), 'head');
        }
        $this->addOutputCode($html);
    }
Beispiel #10
0
 /**
  * Render
  *
  * @return	void
  * @access	public
  */
 function render($outputMode = NULL, $skipChilds = false)
 {
     $this->_application->_rootComponent->addOutputCode(org_glizy_helpers_JS::JScode('if (typeof(Glizy)!=\'object\') Glizy = {}; Glizy.baseUrl ="' . GLZ_HOST . '"; Glizy.ajaxUrl = "ajax.php?pageId=' . $this->_application->getPageId() . '&ajaxTarget=' . $this->getId() . '&action=";'), 'head');
     return parent::render($outputMode, $skipChilds);
 }
Beispiel #11
0
    public function render_html()
    {
        $graphCode = '';
        $entityTypeId = $this->getAttribute('entityTypeId') ? $this->getAttribute('entityTypeId') : __Request::get('entityTypeId');
        $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.Entity', 'all');
        if ($it->count()) {
            $visited = array();
            $edges = array();
            foreach ($it as $ar) {
                if (!in_array($ar->getId(), array_keys($visited))) {
                    $graphCode .= $this->getGraph($ar->getId(), $visited, $edges, true);
                }
            }
        }
        $graphCode = <<<EOD
digraph "" {
    {$graphCode}
}
EOD;
        $graphCode = str_replace(array("\r", "\n"), '', addslashes($graphCode));
        $html .= <<<EOD
<div style="text-align: center;">
    <svg width="800" height="600">
      <g transform="translate(20, 20)"/>
    </svg>
</div>
        <style>
        svg {
            overflow: hidden;
        }
        
        /* Stile testo delle entità */
        g.nodes tspan {
            font-family: Helvetica, sans-serif;
            font-size: 14px;
        }
        /* Stile testo delle entità in HTML */
        g.nodes div {
            white-space: nowrap;
            padding: 4px;
            font-family: Helvetica, sans-serif;
            font-size: 13px;
        }
        
        /* Stile testo delle entità principali in HTML */
        div.main-node {
            padding: 2px 7px 2px 7px;
            font-family: Helvetica, sans-serif;
            font-size: 14px;
        }
        
        /* Stile testo delle relazioni */
        g.edgeLabels tspan {
            
        }

        /* Stile riquadro delle entità */
        .node rect {
            stroke: #cfced3;
            stroke-width: 2px;
            fill: none;
        }

        /* Stile delle frecce */
        .edgePath path {
            stroke: black;
            stroke-width: 1.5px;
            fill: none;
        }
        </style>
<script>
        function tryDraw() {
            var result;
            try {
                result = graphlibDot.parse('{$graphCode}');
            } catch (e) {
                alert('Errore di caricamento del grafo!');
                throw e;
            }

            if (result) {
                var svg = d3.select("svg");
                var svgGroup = svg.append('g');

                var renderer = new dagreD3.Renderer();

                var layout = renderer.run(result, svgGroup);

                var parentWidth = parseInt(\$(svg).parent().css('width').replace('px', '')) - 250;
                svg.attr('width', parentWidth);
                svg.attr('height', layout.graph().height + 250);
                var xCenterOffset = (svg.attr('width') - layout.graph().width) / 2;
                svgGroup.attr('transform', 'translate(' + xCenterOffset + ', 100)');
            }
        }
        
        function fixBaseTagProblem() {
            \$('g[class^="edgePaths"]').find('path').each(function() {
                \$(this).attr('marker-end', 'url(' + window.location + '#arrowhead)');
            });
        }
        
        function adjustEntityContainers() {
            \$('foreignObject').each(function() {
                var width = parseInt(\$(this).attr('width'));
                \$(this).attr('width', width + 25);
            });
        }

        \$(window).bind('load', function() {
            tryDraw();
            fixBaseTagProblem();
            adjustEntityContainers();
        });
</script>
EOD;
        if ($this->getAttribute('addGraphJsLibs.js')) {
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/d3.v3.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/dagre-d3.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/graphlib-dot.min.js'));
        }
        $this->addOutputCode($html);
    }
Beispiel #12
0
 static function linkJSfile($url, $compress = NULL, $type = 'text/javascript')
 {
     $url = org_glizy_helpers_JS::getCompressedUrl($url, $compress);
     $output = '<script type="' . $type . '" src="' . $url . '"></script>';
     return $output;
 }
Beispiel #13
0
 protected function loadSiteProperties()
 {
     $menu = $this->_application->getCurrentMenu();
     $siteProp = $this->_application->getSiteProperty();
     $title = org_glizy_ObjectValues::get('org.glizy.og', 'title', $menu->title);
     $description = org_glizy_ObjectValues::get('org.glizy.og', 'description', $menu->description);
     $keywords = org_glizy_ObjectValues::get('org.glizy.og', 'keywords', $menu->keywords);
     $this->addOutputCode($title . ' - ' . $siteProp['title'], 'docTitle');
     $this->addOutputCode($title . ' - ' . $siteProp['title'], 'doctitle');
     // NOTE: per compatibilità
     $this->addOutputCode($title, 'metadata_title');
     $this->addOutputCode($description, 'metadata_description');
     $this->addOutputCode($keywords, 'metadata_keywords');
     $this->addOutputCode($siteProp['copyright'], 'copyright');
     $this->addOutputCode($siteProp['address'], 'address');
     $slideShowSpeed = ((int) $siteProp['slideShow'] ?: 5) * 1000;
     $this->addOutputCode(org_glizy_helpers_JS::JScode('if (typeof(Glizy)!=\'object\') Glizy = {}; Glizy.slideShowSpeed = ' . $slideShowSpeed . ';'), 'head');
     $reg = __T(strlen($menu->creationDate) <= 10 || preg_match('/00:00:00|12:00:00 AM/', $menu->creationDate) ? 'GLZ_DATE_FORMAT' : 'GLZ_DATETIME_FORMAT');
     $updateText = org_glizy_locale_Locale::get('MW_FOOTER', glz_defaultDate2locale($reg, $menu->creationDate), glz_defaultDate2locale($reg, $menu->modificationDate));
     $this->addOutputCode($updateText, 'docUpdate');
 }
Beispiel #14
0
 public function render_html_onEnd($value = '')
 {
     parent::render_html_onEnd($value);
     $language = $this->_application->getLanguage();
     $language = $language . '-' . strtoupper($language);
     $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('APPLICATION') . 'classes/movio/modules/ontologybuilder/views/js/locale/' . $language . '.js'));
     $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('APPLICATION') . 'classes/movio/modules/ontologybuilder/views/js/EntityFormEditEntitySelect.js'));
 }
Beispiel #15
0
    public function render()
    {
        if (is_object($this->_content) && $this->_content->image && $this->_content->hotspots) {
            $media = org_glizycms_mediaArchive_MediaManager::getMediaById($this->_content->image);
            $speakingUrlManager = $this->_application->retrieveProxy('org.glizycms.speakingUrl.Manager');
            if (is_object($media)) {
                $id = $this->getId();
                $imageInfo = $media->getImageInfo();
                $width = $imageInfo['width'];
                $height = $imageInfo['height'];
                $attributes = array();
                $attributes['src'] = $media->getFileName(true);
                $attributes['width'] = $imageInfo['width'];
                $attributes['height'] = $imageInfo['height'];
                $attributes['alt'] = $media->title;
                $attributes['title'] = $media->title;
                $image = '<img ' . $this->_renderAttributes($attributes) . ' />';
                $hotspots = '';
                foreach ($this->_content->hotspots as $h) {
                    $attributes = array();
                    $attributes['id'] = $id . '-' . $h->id;
                    $attributes['class'] = 'movio-hotspot' . ($h->form == 'circle' ? '-circle' : '');
                    $attributes['style'] = 'display: block; top: ' . $h->top . 'px; left: ' . $h->left . 'px; height: ' . $h->height . 'px; width: ' . $h->width . 'px;';
                    if ($h->description) {
                        $attributes['data-tooltip'] = glz_encodeOutput($h->description);
                    }
                    $link = '';
                    if ($h->type = 'linkEx' && $h->src) {
                        $link = __Link::formatLink($h->src);
                    } else {
                        if ($h->type = 'link' && $h->srcInt) {
                            $link = __Link::formatInternalLink($speakingUrlManager->makeUrl($h->srcInt));
                        }
                    }
                    if ($link) {
                        $link = str_replace('<a ', '<a style="text-indent: -9999px; height: ' . $h->height . 'px; width: ' . $h->width . 'px; display: block;"', $link);
                    }
                    // <a target="_blank" style="height: 148px; width: 186px; display: block;" href="www.google.com" class="hotspot-circle"></a>
                    $hotspots .= '<div ' . $this->_renderAttributes($attributes) . '>' . $link . '</div>';
                }
                $css = trim('movio-hotspotContainer ' . $this->getAttribute('cssClass'));
                $output = <<<EOD
<div id="{$id}" class="{$css}">
    {$image}
    <div class="movio-imageHotspot-scale">
    {$hotspots}
    </div>
</div>
<script src="static/jquery/jquery-transform/jquery.transform2d.js"></script>
<script>
jQuery( function(){
    \$('div.movio-hotspotContainer').find('div[data-tooltip!=""]').qtip({
        content: {
            attr: 'data-tooltip'
        },
        position: {
                    my: 'bottom left',
                    at: 'bottom left',
                    target: 'mouse'
                },
        style: {
            classes: 'qtip-bootstrap'
        }
    });
    var img = \$('div.movio-hotspotContainer img').first();
    var scale = img.width() / parseInt(img.attr('width'));
    \$('.movio-imageHotspot-scale').css('transform', 'scale('+scale+','+scale+')');
});
</script>
EOD;
                $this->addOutputCode($output);
                $this->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery.qtip/jquery.qtip.min.js'), 'head');
                $this->addOutputCode(org_glizy_helpers_CSS::linkStaticCSSfile('jquery/jquery.qtip/jquery.qtip.min.css'), 'head');
            }
        }
    }
Beispiel #16
0
    public function render_html()
    {
        $graphCode = '';
        $entityTypeId = $this->getAttribute('entityTypeId') ? $this->getAttribute('entityTypeId') : __Request::get('entityTypeId');
        if ($entityTypeId) {
            $visited = array();
            $edges = array();
            $graphCode = $this->getGraph($entityTypeId, $visited, $edges);
        }
        if (!$this->getAttribute('generateLinks')) {
            $this->language = $this->_application->getEditingLanguage();
            $this->localeService = $this->_application->retrieveProxy('movio.modules.ontologybuilder.service.LocaleService');
            $html = '<form id="myForm" method="post" class="form-horizontal row-fluid" >';
            $html .= '<label for="entityTypeId" class="control-label required">' . __T('Entity') . '</label>';
            $html .= '<select id="entityTypeId" name="entityTypeId">';
            $it = org_glizy_objectFactory::createModelIterator('movio.modules.ontologybuilder.models.Entity', 'all');
            foreach ($it as $ar) {
                $selected = __Request::get('entityTypeId') == $ar->getId() ? 'selected="selected"' : '';
                $html .= '<option value="' . $ar->getId() . '" ' . $selected . '>' . $this->localeService->getTranslation($this->language, $ar->entity_name) . '</option>';
            }
            $html .= '</select>';
            $html .= '<input class="submit btn btn-primary" type="submit" value="' . __T('Draw') . '">';
            $html .= '</form>';
        }
        $graphCode = <<<EOD
digraph "" {
    {$graphCode}
}
EOD;
        $graphCode = str_replace(array("\r", "\n"), '', addslashes($graphCode));
        $html .= <<<EOD
<div style="text-align: center; position: relative; width: 100%;">
    <svg width="800" height="600">
      <g transform="translate(20, 20)"/>
    </svg>
</div>
<script>
        function tryDraw() {
            var result;
            try {
                result = graphlibDot.parse('{$graphCode}');
            } catch (e) {
                alert('Errore di caricamento del grafo!');
                throw e;
            }

            if (result) {
                var svg = d3.select("svg");
                var svgGroup = svg.append('g');

                var renderer = new dagreD3.Renderer();

                var layout = renderer.run(result, svgGroup);

                var parentWidth = 800;
                svg.attr('width', parentWidth);
                svg.attr('height', layout.graph().height + 250);
                var xCenterOffset = (svg.attr('width') - layout.graph().width) / 2;
                svgGroup.attr('transform', 'translate(' + xCenterOffset + ', 100)');
            }
        }

        function fixBaseTagProblem() {
            \$('g[class^="edgePaths"]').find('path').each(function() {
                \$(this).attr('marker-end', 'url(' + window.location + '#arrowhead)');
            });
        }

        function selectRootNode() {
            \$('div[class="main-node"]').parent().parent().parent().parent().children('rect').attr('class', 'main-node');
        }

        \$(window).bind('load', function() {
            tryDraw();
            fixBaseTagProblem();
            selectRootNode();
        });
</script>
EOD;
        if ($this->getAttribute('addGraphJsLibs.js')) {
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/d3.v3.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/dagre-d3.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile(__Paths::get('STATIC_DIR') . 'dagre-d3/graphlib-dot.min.js'));
        }
        $this->addOutputCode($html);
    }
    function render()
    {
        $onlyFolder = __Request::get('onlyFolder');
        $onlyFirstLevel = __Request::get('onlyFirstLevel');
        $customPath = __Request::get('customPath');
        $enableDownload = __Request::get('enableDownload');
        // TODO localizzare l'interfaccia
        $this->_application->_rootComponent->addOutputCode(org_glizy_helpers_JS::JScode('if ( typeof(Glizy) == "undefined" ) Glizy = {}; Glizy.baseUrl ="' . GLZ_HOST . '"; Glizy.ajaxUrl = "ajax.php?pageId=' . $this->_application->getPageId() . '&ajaxTarget=' . $this->getId() . '&onlyFolder=' . $onlyFolder . '&customPath=' . $customPath . '&enableDownload=' . $enableDownload . '&command=";'), 'head');
        $showCopy = $this->getAttribute('copyCheckbox') && !$onlyFolder ? 'true' : 'false';
        $showFolderSelection = $onlyFolder ? 'true' : 'false';
        $showOnlyFirstLevel = $onlyFirstLevel ? 'true' : 'false';
        $output = <<<EOD
<div id="storageBrowser"></div>
<script type="text/javascript">
jQuery(document).ready(function() {
    var currentFolder = '';

    function redraw( data )
    {
        var html = '';
        if ({$showCopy}) {
            html += '<input name="copyToCMS" id="copyToCMS" type="checkbox" class="pull-left"/>';
            html += '<label for="copyToCMS" class="pull-left">Copia il file nell\\'archivio del CMS</label></br></br>';
        }

        html += '<h4>Posizione: root/'+ currentFolder+'</h4>';
        html += '<table id="dataGrid" class="storageBrowser table table-bordered table-striped">';
        html += '<thead><tr>';
        html += '<th class="icon"></th>';
        html += '<th class="filename">Nome file</th>';
        html += '<th class="size">Dimensione</th>';
        html += '<th class="date">Ultima modifica</th>';
        html += '</tr></thead>';

        var htmlDirs = '';
        var htmlFiles = '';
        jQuery( data ).each( function( index, value ){
            var rowCss = index % 2 ? 'odd' : 'even';
            if ( value.type == "dir" )
            {
                htmlDirs += '<tr class="'+rowCss+'" data-path="'+value.path+'" data-type="folder"><td class="icon folder"></td>';
                htmlDirs += '<td class="filename">'+value.name+'</td>';
                htmlDirs += '<td class="size"></td>';
                htmlDirs += '<td class="date"></td>';
                htmlDirs += '</tr>';
            }
            else
            {
                htmlFiles += '<tr class="'+rowCss+'" data-path="'+value.path+'" data-type="file"><td class="icon '+value.icon+'"></td>';
                htmlFiles += '<td class="filename">'+value.name+'</td>';
                htmlFiles += '<td class="size">'+value.size+'</td>';
                htmlFiles += '<td class="date">'+value.date+'</td>';
                htmlFiles += '</tr>';
            }
        });

        html += '<tbody>'+htmlDirs+htmlFiles+'</tbody></table>';

        if ({$showFolderSelection} && !{$showOnlyFirstLevel} ) {
            html += '<input value="Seleziona cartella" name="selectFolder" id="selectFolder" type="button" class="btn"/>';
        }
        
        jQuery('#storageBrowser').html( html );
    }

    function loadFolder() {
        jQuery.ajax({
                 type: "POST",
                 url: Glizy.ajaxUrl + "read",
                 dataType: "json",
                 data: {path: currentFolder},
                 success: function (data) {
                         // console.log( data );
                         redraw( data );
                     }
                });
    }

    jQuery( document ).on( 'click', '#storageBrowser tbody tr', function( ){
        if ( jQuery( this ).data( 'type' ) == 'folder' )
        {
            currentFolder = jQuery( this ).data( 'path' );
            if ({$showOnlyFirstLevel}) {
                parent.custom_storageBrowserSelect(currentFolder);
            } else {
                loadFolder();
            }
        }
        else
        {
            parent.custom_storageBrowserSelect( jQuery( this ).data( 'path' ) );
        }
    })

    jQuery( document ).on('change', '#copyToCMS', function () {
        parent.setCopyToCMS( jQuery( this ).attr('checked') );
    });
    
    jQuery(document).on( 'click', '#selectFolder', function( ){
        parent.custom_storageBrowserSelect( currentFolder );
    })

    jQuery( document ).on( 'hover', '#storageBrowser tbody tr', function( ){
        jQuery( this ).addClass( 'ruled' );
    }).on( 'mouseout', function( ){
        jQuery( this ).removeClass( 'ruled' );
    })

    loadFolder();
});
</script>
EOD;
        $this->addOutputCode($output);
    }
Beispiel #18
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 ));
            }
        }
    }
Beispiel #19
0
    public function render_html_onEnd($value = '')
    {
        parent::render_html_onEnd();
        $corePath = __Paths::get('CORE');
        $jQueryPath = $corePath . 'classes/org/glizycms/js/jquery/';
        $languageCode = $this->_application->getLanguage();
        $language = $languageCode . '-' . strtoupper($languageCode);
        if ($this->getAttribute('newCode')) {
            $formEditPath = $corePath . 'classes/org/glizycms/js/formEdit2/';
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($corePath . 'classes/org/glizycms/js/underscore/underscore-min.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEdit.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditStandard.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditCheckbox.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditRepeat.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditDate.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditDateTime.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.it.js'));
            $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'bootstrap-datetimepicker-master/css/datetimepicker.css'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditColorPicker.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-colorpicker/js/bootstrap-colorpicker.min.js'));
            $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'bootstrap-colorpicker/css/bootstrap-colorpicker.min.css'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditGUID.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditSelectFrom.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'select2/select2.min.js'));
            $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'select2/select2.css'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditTINYMCE.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditMediaPicker.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditFile.js'));
            //$this->addOutputCode( org_glizy_helpers_JS::linkJSfile( $jQueryPath.'fineuploader.jquery/jquery.fineuploader.js' ) );
            //$this->addOutputCode( org_glizy_helpers_CSS::linkCSSfile( $jQueryPath.'fineuploader.jquery/fineuploader.css' ) );
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'jquery.validVal-packed.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditPermission.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditPhotoGalleryCategory.js'));
            // $this->addOutputCode( org_glizy_helpers_JS::linkJSfile( $formEditPath.'GlizyFormEditGoogleMaps.js' ) );
            // $this->addOutputCode(org_glizy_helpers_JS::linkJSfile( 'http://maps.google.com/maps/api/js?sensor=false' ));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditCmsPagePicker.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditSelectPageType.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditUrl.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditModalPage.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($corePath . 'classes/org/glizycms/js/glizy-locale/' . $language . '.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.min.js'));
            $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.default.css'));
            $id = $this->getId();
            $mediaPicker = $this->getMediaPickerUrl();
            $AJAXAtion = $this->getAttribute('controllerName') ? $this->getAjaxUrl() : '';
            $customValidation = $this->getAttribute('customValidation');
            if ($customValidation) {
                $customValidation = 'customValidation: "' . $customValidation . '",';
            }
            $tinyMceUrls = json_encode($this->getTinyMceUrls());
            $jsCode = <<<EOD
jQuery(function(){
    if ( Glizy.tinyMCE_options )
    {
        Glizy.tinyMCE_options.urls = {$tinyMceUrls};
    }

    var myFormEdit = Glizy.oop.create("glizy.FormEdit", '{$id}', {
        AJAXAction: "{$AJAXAtion}",
        mediaPicker: {$mediaPicker},
        formData: {$this->data},
        {$customValidation}
        lang: GlizyLocale.FormEdit
    });
});
EOD;
        } else {
            $formEditPath = $corePath . 'classes/org/glizycms/js/formEdit/';
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($corePath . 'classes/org/glizycms/js/underscore/underscore-min.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEdit.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditTINYMCE.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditFile.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditMediaPicker.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditGoogleMaps.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditGUID.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditColorPicker.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditValuesPreset.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditDate.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditDatetime.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.it.js'));
            $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'bootstrap-datetimepicker-master/css/datetimepicker.css'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'bootstrap-colorpicker/js/bootstrap-colorpicker.min.js'));
            $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'bootstrap-colorpicker/css/bootstrap-colorpicker.min.css'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($corePath . 'classes/org/glizycms/js/glizy-locale/' . $language . '.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'dropzone/dropzone.min.js'));
            $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'dropzone/css/basic2.css'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'jquery.validVal-packed.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditCmsPagePicker.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditSelectFrom.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'select2/select2.min.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.min.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditPermission.js'));
            $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'select2/select2.css'));
            $this->addOutputCode(org_glizy_helpers_CSS::linkCSSfile($jQueryPath . 'jquery.pnotify/jquery.pnotify.default.css'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditCheckbox.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile('http://maps.google.com/maps/api/js?sensor=false'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditSelectPageType.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditPhotoGalleryCategory.js'));
            $this->addOutputCode(org_glizy_helpers_JS::linkJSfile($formEditPath . 'GlizyFormEditImageHotspot.js'));
            // $this->addOutputCode( org_glizy_helpers_JS::linkJSfile( $formEditPath.'GlizyFormEditTreeSelect.js' ) );
            // $this->addOutputCode( org_glizy_helpers_JS::linkJSfile( $jQueryPath.'fancytree/jquery.fancytree-all.min.js' ) );
            // $this->addOutputCode( org_glizy_helpers_CSS::linkCSSfile( $jQueryPath.'fancytree/skin-win7/ui.fancytree.min.css' ) );
            $id = $this->getId();
            $mediaPicker = $this->getMediaPickerUrl();
            $AJAXAtion = $this->getAttribute('controllerName') ? $this->getAjaxUrl() : '';
            $customValidation = $this->getAttribute('customValidation');
            if ($customValidation) {
                $customValidation = 'customValidation: "' . $customValidation . '",';
            }
            $tinyMceUrls = json_encode($this->getTinyMceUrls());
            $jsCode = <<<EOD
jQuery(function(){
    if ( Glizy.tinyMCE_options )
    {
        Glizy.tinyMCE_options.urls = {$tinyMceUrls};
    }

    var ajaxUrl = "{$AJAXAtion}";
    jQuery( "#{$id}" ).GlizyFormEdit({
        AJAXAction: ajaxUrl ? ajaxUrl : Glizy.ajaxUrl,
        mediaPicker: {$mediaPicker},
        formData: {$this->data},
        {$customValidation}
        lang: GlizyLocale.FormEdit
    });
});
EOD;
        }
        $this->addOutputCode(org_glizy_helpers_JS::JScode($jsCode));
    }
Beispiel #20
0
 /**
  * @param string $formName
  */
 function addValidateJsCode($formName = null)
 {
     if (!__Config::get('GLIZY_ADD_VALIDATE_JS')) {
         return;
     }
     if (!org_glizy_ObjectValues::get('org.glizy.JS.Validate', 'add', false) && __Config::get('GLIZY_ADD_JS_LIB')) {
         // Validate
         org_glizy_ObjectValues::set('org.glizy.JS.Validate', 'add', true);
         $this->addJSLibCore();
         if (file_exists(org_glizy_Paths::get('STATIC_DIR') . 'jquery/jquery.validationEngine/jquery.validationEngine-' . $this->getLanguage() . '.js')) {
             $this->_rootComponent->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery.validationEngine/jquery.validationEngine-' . $this->getLanguage() . '.js'), 'head');
         } else {
             $this->_rootComponent->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery.validationEngine/jquery.validationEngine-en.js'), 'head');
         }
         $this->_rootComponent->addOutputCode(org_glizy_helpers_JS::linkStaticJSfile('jquery/jquery.validationEngine/jquery.validationEngine.js'), 'head');
         $this->_rootComponent->addOutputCode(org_glizy_helpers_CSS::linkStaticCSSfile('jquery/jquery.validationEngine/validationEngine.jquery.css'), 'head');
     }
     if (!is_null($formName) && __Config::get('GLIZY_ADD_JS_LIB')) {
         $this->_rootComponent->addOutputCode(org_glizy_helpers_JS::JScode('jQuery(document).ready(function() { $("#' . $formName . '").validationEngine( "attach", { validationEventTrigger: "none", scroll: false, showAllErrors: false } ); });'), 'head');
         //                $this->_rootComponent->addOutputCode(org_glizy_helpers_JS::JScode( '$(document).ready(function() { $("#'.$formName.'").validationEngine(); });' ), 'head');
     }
 }