Exemplo n.º 1
0
 function execute()
 {
     if (__Request::exists('next')) {
         $pageType = $this->application->getPageType();
         list($moduleName) = explode('.', $pageType);
         __Request::set('mbTable', $moduleName);
         $builder = org_glizy_ObjectFactory::createObject('movio.modules.modulesBuilder.builder.Builder');
         $builder->executeDelete();
         org_glizy_helpers_Navigation::gotoUrl(__Link::makeUrl('link', array('pageId' => 'glizycms_contentsedit')));
     }
 }
 function executeLater_deleteModule($oldState)
 {
     if (strtolower(__Request::get('action', '')) == 'next') {
         $pageType = $this->_parent->_application->getPageType();
         list($moduleName) = explode('.', $pageType);
         __Session::set('mbTable', $moduleName);
         glz_import('movio.modules.modulesBuilder.builder.*', array('Builder.php', 'AbstractCommand.php'));
         $builder = org_glizy_ObjectFactory::createObject('movio.modules.modulesBuilder.builder.Builder');
         $builder->executeDelete();
         glz_import('org.glizy.helpers.Navigation');
         org_glizy_helpers_Navigation::gotoUrl(__Link::makeUrl('link', array('pageId' => 'SiteMap')));
     }
 }
Exemplo n.º 3
0
 private function makeUrlFromId($id, $fullLink = false)
 {
     $siteMap = $this->application->getSiteMap();
     $menu = $siteMap->getNodeById($id);
     if ($menu && $menu->isVisible) {
         $menuUrl = $menu->url;
         $menuTitle = $menu->title;
         $url = $menuUrl ? GLZ_HOST . '/' . $menuUrl : __Link::makeUrl('link', array('pageId' => $id, 'title' => $menuTitle));
         return $fullLink ? __Link::makeSimpleLink($menuTitle, $url) : $url;
     }
     // the menu isn't found or isn't visible in this language
     // redirect to home
     return $this->makeUrlFromId(__Config::get('START_PAGE'), $fullLink);
 }
Exemplo n.º 4
0
 function execute()
 {
     // TODO controllo dei permessi
     $it = org_glizy_objectFactory::createModelIterator('movio.modules.codes.models.Model');
     $result = array('items' => array());
     foreach ($it as $ar) {
         $id = $ar->getId();
         $item = array('id' => $id, 'description' => $ar->custom_code_mapping_description, 'code' => $ar->custom_code_mapping_code, 'resourceLink' => $ar->custom_code_mapping_link);
         if ($ar->custom_code_mapping_link) {
             $speakingUrlManager = $this->application->retrieveProxy('org.glizycms.speakingUrl.Manager');
             $docs = $speakingUrlManager->searchDocumentsByTerm('', $ar->custom_code_mapping_link);
             $item['resourceLinkLabel'] = $docs[0]['text'];
             $item['downloadQrCode'] = __Link::makeUrl('actionsMVC', array('action' => 'makeQRCode', 'id' => $id));
         }
         $result['items'][] = $item;
     }
     return $result;
 }
Exemplo n.º 5
0
 private function makeUrlFromId($id, $fullLink = false)
 {
     $ar = org_glizy_objectFactory::createModel($this->model);
     if ($ar->load($this->getIdFromLink($id))) {
         $siteMap = $this->application->getSiteMap();
         $menu = $siteMap->getMenuByPageType($this->pageType);
         if ($ar->document_detail_isVisible && $ar->document_detail_translated && $menu && $menu->isVisible) {
             if ($ar->keyInDataExists('url') && $ar->url) {
                 $language = $this->application->getLanguage();
                 $url = GLZ_HOST . '/' . $language . '/' . $ar->url;
             } else {
                 $url = __Link::makeUrl('movio_news', array('document_id' => $id, 'title' => $ar->title));
             }
             return $fullLink ? __Link::makeSimpleLink($ar->title, $url) : $url;
         }
     }
     // document not found, isn't visible or isn't traslated
     // go to entity page or home
     $speakingUrlManager = $this->application->retrieveProxy('org.glizycms.speakingUrl.Manager');
     return $fullLink ? '' : $speakingUrlManager->makeUrl('internal:' . ($menu ? $menu->id : __Config::get('START_PAGE')));
 }
Exemplo n.º 6
0
 function render_html()
 {
     if ($this->getAttribute('addWrapDiv')) {
         $output = '<div id="' . $this->getId() . '"><ul ' . (!is_null($this->getAttribute('cssClass')) ? ' class="' . $this->getAttribute('cssClass') . '"' : '') . '>';
     } else {
         $output = '<ul id="' . $this->getId() . '"' . (!is_null($this->getAttribute('cssClass')) ? ' class="' . $this->getAttribute('cssClass') . '"' : '') . '>';
     }
     $controller = $this->_parent;
     $queryString = $this->getAttribute('addQueryString') ? '?' . __Request::get('__back__url__') : '';
     foreach ($controller->childComponents as $c) {
         if (is_a($c, 'org_glizy_mvc_components_State')) {
             $label = $c->getAttribute('label');
             $draw = $c->getAttribute('draw');
             $aclResult = $this->evalueteAcl($c->getAttribute('acl'));
             $cssClass = trim($c->getAttribute('cssClassTab') . ($c->isCurrentState() ? ' ' . $this->getAttribute('cssClassCurrent') : ''));
             if ($cssClass) {
                 $cssClass = ' class="' . $cssClass . '"';
             }
             $id = $c->getId();
             if ($draw && !empty($label) && $aclResult) {
                 if (!empty($cssClass) && !$this->getAttribute('forceLink')) {
                     $output .= '<li' . $cssClass . '>' . $label . '</li>';
                 } else {
                     $url = $c->getAttribute('url');
                     if (is_null($url)) {
                         $url = __Link::makeUrl($this->getAttribute('routeUrl'), array('title' => $label, 'action' => $c->getStateAction()));
                     } else {
                         $url = __Link::makeUrl($url);
                     }
                     $output .= '<li' . $cssClass . '><a id="' . $id . '" href="' . $url . $queryString . '"' . $cssClass . '>' . $label . '</a></li>';
                 }
             }
         }
     }
     $output .= '</ul>';
     if ($this->getAttribute('addWrapDiv')) {
         $output .= '</div>';
     }
     $this->addOutputCode($output);
 }
Exemplo n.º 7
0
 function render_html()
 {
     if ($this->getAttribute('addWrapDiv')) {
         $output = '<div id="' . $this->getId() . '" class="clearfix"><ul ' . (!is_null($this->getAttribute('cssClass')) ? ' class="' . $this->getAttribute('cssClass') . '"' : '') . '>';
     } else {
         $output .= '<ul id="' . $this->getId() . '"' . (!is_null($this->getAttribute('cssClass')) ? ' class="' . $this->getAttribute('cssClass') . '"' : '') . '>';
     }
     for ($i = 0; $i < count($this->childComponents); $i++) {
         $label = $this->childComponents[$i]->getAttribute('label');
         $states = $this->childComponents[$i]->getStatesArray();
         $draw = $this->childComponents[$i]->getAttribute('draw');
         $cssClass = in_array($this->getState(), $states) ? ' class="active"' : '';
         $id = $this->childComponents[$i]->getId();
         if ($draw) {
             if (!empty($cssClass) && !$this->getAttribute('forceLink')) {
                 $output .= '<li' . $cssClass . '>' . $label . '</li>';
             } else {
                 $url = $this->childComponents[$i]->getAttribute('url');
                 if (is_null($url)) {
                     $url = $this->childComponents[$i]->getAttribute('routeUrl');
                     if (!is_null($url)) {
                         $url = __Link::makeUrl($url);
                     }
                 }
                 if (is_null($url)) {
                     $url = $this->changeStateUrl($states[0], true);
                 }
                 $output .= '<li' . $cssClass . '><a id="' . $id . '" href="' . $url . '">' . $label . '</a></li>';
             }
         }
     }
     $output .= '</ul>';
     if ($this->getAttribute('addWrapDiv')) {
         $output .= '</div>';
     }
     $this->addOutputCode($output);
 }
Exemplo n.º 8
0
 function changeAction($action)
 {
     $url = __Link::makeUrl('linkChangeAction', array('action' => $action));
     $url = str_replace("ajax", "index", $url);
     return $url;
 }
Exemplo n.º 9
0
    function render_html_onStart()
    {
        $tabId = $this->getId();
        $dropdownMenu = '';
        $output .= '<ul id="' . $tabId . '" class="' . $this->getAttribute('cssClass') . '">';
        for ($i = 0; $i < count($this->childComponents); $i++) {
            $visible = $this->childComponents[$i]->getAttribute('visible');
            if (!$visible) {
                continue;
            }
            $label = $this->childComponents[$i]->getAttribute('label');
            $routeUrl = $this->childComponents[$i]->getAttribute('routeUrl');
            $cssClassTab = $this->childComponents[$i]->getAttribute('cssClassTab');
            if ($this->childComponents[$i]->getAttribute('disabled')) {
                $cssClassTab .= ' disabled';
            }
            $id = $this->childComponents[$i]->getId();
            $dropdown = $this->childComponents[$i]->getAttribute('dropdown');
            if (!$dropdown) {
                $cssClassTab = $cssClassTab ? ' class="' . trim($cssClassTab) . '"' : $cssClassTab;
                if (!$routeUrl) {
                    $output .= '<li' . $cssClassTab . '><a href="#' . $id . '" data-target="#' . $id . '" data-toggle="tab">' . $label . '</a></li>';
                } else {
                    $output .= '<li' . $cssClassTab . '><a href="' . __Link::makeUrl($routeUrl) . '">' . $label . '</a></li>';
                }
            } else {
                if ($dropdown && !$dropdownMenu) {
                    $output .= '<li class="dropdown"><a href="noTranslate:#" data-toggle="dropdown" class="tab-dropdown dropdown-toggle"><span class="js-label">' . $label . '</span><span class="caret"></span></a><ul class="dropdown-menu">##dropdown##</ul></li>';
                    $dropdownMenu .= '<li><a href="#' . $id . '" data-target="#' . $id . '" data-toggle="tab">' . $label . '</a></li>';
                } else {
                    if ($dropdown && $dropdownMenu) {
                        $dropdownMenu .= '<li><a href="#' . $id . '" data-target="#' . $id . '" data-toggle="tab">' . $label . '</a></li>';
                    }
                }
            }
        }
        if ($dropdownMenu) {
            $output = str_replace('##dropdown##', $dropdownMenu, $output);
            if ($this->getAttribute('showNav')) {
                $output .= '<li class="tab-navigation"><a href="#" data-toggle="tab-prev" class="btn"><span class="fa fa-angle-double-left"></span></a></li>';
                $output .= '<li class="tab-navigation"><a href="#" data-toggle="tab-next" class="btn"><span class="fa fa-angle-double-right"></span></a></li>';
            }
        }
        $output .= '</ul>' . '<div id="' . $tabId . '_content" class="' . $this->getAttribute('paneCssClass') . '">';
        $output .= <<<EOD
<script>
jQuery(function(){
\tvar navInPanel = function(dir) {
\t\tvar activePanel = \$('#{$tabId}_content div[class="tab-pane active"]');
\t\tif (activePanel.length) {
\t\t\tvar id;
\t\t\tif (dir>0) {
\t\t\t\tid = activePanel.next().attr('id');
\t\t\t} else {
\t\t\t\tid = activePanel.prev().attr('id');
\t\t\t}
\t\t\tif (id) {
\t\t\t\t\$('#{$tabId} a[data-target="#'+id+'"]').tab('show');
\t\t\t}
\t\t}
\t}

\tvar updateNav = function() {
\t\tvar activePanel = \$('#{$tabId}_content div[class="tab-pane active"]');
\t\t\$('#{$tabId} a[data-toggle="tab-prev"]').toggleClass('disabled', !activePanel.prev().hasClass('tab-pane'));
\t\t\$('#{$tabId} a[data-toggle="tab-next"]').toggleClass('disabled', !activePanel.next().hasClass('tab-pane'));
\t}

\t\$('#{$tabId} a[data-toggle="tab"]').click(function (e) {
    \te.preventDefault();
\t\tif (\$(this).parent().hasClass('disabled') || \$(this).parent().hasClass('fake-active')) {
\t\t\treturn false;
\t\t}
    \t\$(this).tab('show');
    }).on('shown.bs.tab', function (e) {
\t\tvar target = \$(e.target);
\t\tvar dropdown = target.closest('ul.dropdown-menu').prev();
\t\tif (dropdown.length) {
\t\t\tdropdown.find('span.js-label').html(target.html());
\t\t}
\t\tupdateNav();
\t});


\t\$('#{$tabId} a[data-toggle="tab-prev"]').click(function (e) {
\t\te.preventDefault();
\t\t\$(this).blur();
\t\tnavInPanel(-1);
\t});
\t\$('#{$tabId} a[data-toggle="tab-next"]').click(function (e) {
\t\te.preventDefault();
\t\t\$(this).blur();
\t\tnavInPanel(1);
\t});

\tvar aFirst = \$('#{$tabId} a').first();
\tif (aFirst.data('toggle')==='dropdown') {
\t\taFirst.parent().find('ul a').first().tab('show');
\t} else {
\t\taFirst.tab('show');
\t}
});
</script>
EOD;
        $this->addOutputCode($output);
    }
Exemplo n.º 10
0
    function render()
    {
        if (!$this->iterator) {
            $this->addOutputCode('<p>' . $this->getAttribute('emptySearchLabel') . '</p>');
            return;
        }
        // legge le colonne da visualizzare dai figli
        // NOTA: le colonne sono gi� state lette sul process
        // ma vengono rilette perch� pu� essere variata la visibilit�
        $this->_columns = array();
        for ($i = 0; $i < count($this->childComponents); $i++) {
            $this->_columns[] = $this->childComponents[$i]->getProperties();
        }
        $addJsCode = false;
        $output = '';
        if ($this->_totalRecord > 0) {
            $class = $this->getAttribute('tableCssClass') != '' ? ' class="' . $this->getAttribute('tableCssClass') . '"' : '';
            $output .= '<table id="' . $this->getId() . '"' . $class . '>';
            if ($this->getAttribute('label') != '') {
                $output .= '<caption>' . $this->getAttribute('label') . '</caption>';
            }
            if ($this->getAttribute('drawHeader')) {
                // disegna le colonne
                $output .= '<thead>';
                $output .= '<tr>';
                //foreach ($this->_columns as $v)
                for ($i = 0; $i < count($this->_columns); $i++) {
                    $v = $this->_columns[$i];
                    if ($v['visible'] === true) {
                        $cssClass = !empty($v['cssClass']) ? ' class="' . $v['cssClass'] . '"' : '';
                        $id = !empty($v['id']) ? ' id="' . $v['id'] . '"' : '';
                        $width = !empty($v['width']) ? ' style="width: ' . $v['width'] . 'px;"' : '';
                        if (!empty($v['renderCell'])) {
                            $renderCell =& org_glizy_ObjectFactory::createObject($v['renderCell'], $this->_application);
                            if (method_exists($renderCell, 'getHeader')) {
                                $v['headerText'] = $renderCell->getHeader($v['headerText']);
                            }
                            unset($renderCell);
                        }
                        if (!empty($v['command'])) {
                            $output .= '<th' . $id . $cssClass . $width . '>';
                            if ($v['command'] == 'publish') {
                                $output .= '<input name="publishAll" value="" type="checkbox" class="js-selectall" />';
                            }
                            $output .= '</th>';
                        } else {
                            if (!$this->getAttribute('skipOrder') && $v['orderable']) {
                                $addJsCode = true;
                                $headerId = 'orderBy_' . $i;
                                $headerClass = 'DataGridHeader';
                                $headerImage = '';
                                if ($i == $this->_orderBy) {
                                    $headerId .= '_' . ($this->_orderDirection == 'ASC' ? 'DESC' : 'ASC');
                                    $headerImage = $this->_orderDirection == 'ASC' ? '<span class="ui-icon ui-icon-triangle-1-s"></span>' : '<span class="ui-icon ui-icon-triangle-1-n"></span>';
                                } else {
                                    $headerId .= '_' . $this->_orderDirection;
                                }
                                $output .= '<th' . $id . $cssClass . $width . '><a href="#" id="' . $headerId . '" class="' . $headerClass . '">' . $v['headerText'] . '</a>' . $headerImage . '</th>';
                            } else {
                                $output .= '<th' . $cssClass . $width . '>' . $v['headerText'] . '</th>';
                            }
                        }
                    }
                }
                $output .= '</tr>';
                $output .= '</thead>';
            }
            if (!$this->getAttribute('hideTotals')) {
                $output .= '<tfoot>';
                $output .= '<tr><td style="text-align: right;" colspan="' . count($this->_columns) . '">' . __T('GLZ_TOTAL_RECORDS') . ' ' . $this->_totalRecord . '</td></tr>';
                $output .= '</tfoot>';
            }
            $output .= '<tbody>';
            $key = 0;
            $tempCssClass = $this->_cssClass;
            $rowCellClass = $this->getAttribute('renderRow');
            if (!empty($rowCellClass)) {
                $rowCellClass =& org_glizy_ObjectFactory::createObject($rowCellClass, $this->_application);
            }
            foreach ($this->iterator as $ar) {
                $v = $ar->getValuesAsArray(true);
                $rowOutput = '';
                foreach ($this->_columns as $vv) {
                    if ($vv['key']) {
                        $key = $v[$vv['columnName']];
                    }
                    if ($vv['visible'] === false) {
                        continue;
                    }
                    $tempOutput = '';
                    $cssClass = '';
                    if (!empty($vv['renderCell'])) {
                        $renderCell =& org_glizy_ObjectFactory::createObject($vv['renderCell'], $this->_application);
                        if (is_object($renderCell)) {
                            $tempOutput .= $renderCell->renderCell($key, isset($v[$vv['columnName']]) ? $v[$vv['columnName']] : '', $ar, $vv['columnName']);
                            $cssClass = !empty($vv['cssClass']) ? $vv['cssClass'] : '';
                            if (method_exists($renderCell, 'getCssClass')) {
                                $cssClass = $renderCell->getCssClass($key, isset($v[$vv['columnName']]) ? $v[$vv['columnName']] : '', $v);
                            }
                        }
                    } else {
                        if (!empty($vv['command'])) {
                            $addJsCode = true;
                            if (strtolower($this->_application->getPageId()) == 'usergroups') {
                                if ($vv['command'] == 'delete' && $v['usergroup_backEndAccess']) {
                                    continue;
                                }
                            }
                            switch ($vv['command']) {
                                case 'edit':
                                    if ($this->_user->acl($vv['aclService'], $vv['command'])) {
                                        if (!is_null($this->_versionFieldName)) {
                                            if ($this->_user->acl($vv['aclService'], $vv['command'])) {
                                                $icon = org_glizy_Assets::get('ICON_EDIT');
                                                $ar =& $this->_dataProvider->getNewObject();
                                                $joinFields = $ar->getJoinFields();
                                                $result = $ar->find(array($joinFields['detailTable'] => $key, $this->_versionFieldName => 'PUBLISHED'));
                                                //$result = $ar->find(array($joinFields['detailTable'] => $key, $this->_versionFieldName => 'PUBLISHED', $this->_languageFieldName => $this->_application->getEditingLanguageId()));
                                            } else {
                                                $icon = org_glizy_Assets::get('ICON_EDITDRAFT');
                                                $result = true;
                                            }
                                            if ($result) {
                                                $tempOutput .= '<img title="' . org_glizy_locale_Locale::get('GLZ_RECORD_EDIT') . '" id="edit_' . $key . '" class="DataGridCommand" src="' . $icon . '" width="16" height="16" border="0" />';
                                            } else {
                                                $tempOutput .= '<img id="" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_EDIT_OFF') . '" width="16" height="16" border="0" />';
                                            }
                                        } else {
                                            $tempOutput .= '<img title="' . org_glizy_locale_Locale::get('GLZ_RECORD_EDIT') . '" id="edit_' . $key . '" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_EDIT') . '" width="16" height="16" border="0" />';
                                        }
                                    }
                                    break;
                                case 'editDraft':
                                    if (!is_null($this->_versionFieldName) && $this->_user->acl($vv['aclService'], $vv['command'])) {
                                        $ar =& $this->_dataProvider->getNewObject();
                                        $joinFields = $ar->getJoinFields();
                                        $result = $ar->find(array($joinFields['detailTable'] => $key, $this->_versionFieldName => 'DRAFT'));
                                        //$result = $ar->find(array($joinFields['detailTable'] => $key, $this->_versionFieldName => 'DRAFT', $this->_languageFieldName => $this->_application->getEditingLanguageId()));
                                        if ($result) {
                                            $tempOutput .= '<img title="' . org_glizy_locale_Locale::get('GLZ_RECORD_EDIT') . '" id="editDraft_' . $key . '" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_EDITDRAFT') . '" width="16" height="16" border="0" />';
                                        } else {
                                            $tempOutput .= '<img id="" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_EDITDRAFT_OFF') . '" width="16" height="16" border="0" />';
                                        }
                                    }
                                    break;
                                case 'preview':
                                    $tempOutput .= '<img title="' . org_glizy_locale_Locale::get('GLZ_RECORD_PREVIEW') . '" id="preview_' . $key . '" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_PREVIEW') . '" width="16" height="16" border="0" />';
                                    break;
                                case 'delete':
                                    if ($this->_user->acl($vv['aclService'], $vv['command'])) {
                                        $tempOutput .= '<img title="' . org_glizy_locale_Locale::get('GLZ_RECORD_DELETE') . '" id="delete_' . $key . '" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_DELETE') . '" width="16" height="16" border="0" />';
                                    }
                                    break;
                                case 'publish':
                                    if ($this->_user->acl($vv['aclService'], $vv['command'])) {
                                        $tempOutput .= '<input name="publish[]" value="' . $key . '" type="checkbox">';
                                    }
                                    break;
                            }
                        } else {
                            if (!is_null($this->_languageFieldName) && $v[$this->_languageFieldName] != $this->_application->getEditingLanguageId()) {
                                $tempOutput .= '<em>' . $v[$vv['columnName']] . '</em>';
                            } else {
                                $tempOutput .= $v[$vv['columnName']];
                            }
                        }
                    }
                    $cssClass = !empty($cssClass) ? ' class="' . $cssClass . '"' : '';
                    $rowOutput .= '<td style="text-align: ' . $vv['align'] . ';"' . $cssClass . '>' . $tempOutput . '</td>';
                }
                if (!count($tempCssClass)) {
                    $tempCssClass = $this->_cssClass;
                }
                $cssClass = array_shift($tempCssClass);
                if (!empty($rowCellClass)) {
                    $output .= $rowCellClass->renderRow($v, $cssClass);
                } else {
                    $output .= '<tr class="' . $cssClass . '" id="row_' . $key . '">';
                }
                $output .= $rowOutput . '</tr>';
            }
            $output .= '</tbody>';
            $output .= '</table>';
        } else {
            $emptyLabel = $this->getAttribute('emptyLabel');
            if (!empty($emptyLabel)) {
                $output .= '<p class="datagridEmpty">' . $emptyLabel . '</p>';
            }
        }
        $this->addOutputCode($output);
        if (!$addJsCode) {
            return;
        }
        $jsId = $this->getId();
        $jsMessage = org_glizy_locale_Locale::get('GLZ_RECORD_MSG_DELETE');
        // TODO
        // controllare che il valore di controller sia settato
        $controllerClass =& $this->getAttribute('controller');
        if (is_object($controllerClass)) {
            $jsStateUrl = $controllerClass->changeStateUrl();
            $jsStateUrl = str_replace(__Link::makeUrl('link', array('pageId' => $this->_application->getPageId())) . '?', '', $jsStateUrl);
            $jsStateUrl = __Link::removeParams(array($controllerClass->getId() . '_recordId'), $jsStateUrl);
            $jsCurrentStateUrl = $controllerClass->changeStateUrl($controllerClass->getState());
            $controllerId = $controllerClass->getid();
        } else {
            $jsStateUrl = __Link::removeParams(array($jsId . '_orderBy', $jsId . '_orderDirection'));
            $jsCurrentStateUrl = $jsStateUrl;
            $controllerId = '';
        }
        $output = '';
        $output = <<<EOD
<script language="JavaScript" type="text/JavaScript">
jQuery(document).ready(function() {
    jQuery('#{$jsId} input.js-selectall').change(function(){
        var checked = this.checked;
        \$(this).closest('table').find("input[name='publish[]']").each(function(i, el){
            el.checked = checked;
        })
    });

    jQuery(['#{$jsId} .DataGridCommand', '#{$jsId} .DataGridHeader']).each(function(index,element)
    {
        jQuery( element ).css( {cursor: 'pointer'} );
        jQuery( element ).click( function()
        {
            var command = this.id.split('_');
            var loc = "{$jsStateUrl}"+command[0]+"&{$controllerId}_recordId="+command[1];
            switch (command[0])
            {
                case 'delete':
                    this.parentNode.parentNode.oldClass2    = this.parentNode.parentNode.oldClass;
                    this.parentNode.parentNode.className2    = this.parentNode.parentNode.className;
                    this.parentNode.parentNode.className    = "ruled";
                    this.parentNode.parentNode.oldClass        = "ruled";

                    if (confirm("{$jsMessage}"))
                    {
                        location.href = loc;
                    }

                    this.parentNode.parentNode.oldClass    = this.parentNode.parentNode.oldClass2;
                    this.parentNode.parentNode.className = this.parentNode.parentNode.oldClass2;
                    break;
                case 'orderBy':
                    loc = "{$jsCurrentStateUrl}&{$jsId}_orderBy="+command[1]+"&{$jsId}_orderDirection="+command[2];
                    location.href = loc;

                default:
                    location.href = loc;
                    break;

            }
        });
    });
});
</script>
EOD;
        if (!empty($output)) {
            $this->addOutputCode($output);
        }
    }
Exemplo n.º 11
0
 function render()
 {
     $this->applyOutputFilters('pre', $this->_content);
     $output = '';
     $attributes = array();
     $attributes['id'] = $this->getId();
     // $attributes['name'] 		= $this->getAttribute('name') != '' ? $this->getAttribute('name') : $this->getOriginalId();
     $attributes['name'] = $this->getOriginalId();
     $attributes['disabled'] = $this->getAttribute('disabled') ? 'disabled' : '';
     $attributes['class'] = $this->getAttribute('cssClass');
     $attributes['type'] = $this->getAttribute('type');
     $attributes['onclick'] = $this->getAttribute('onclick');
     $routeUrl = $this->getAttribute('routeUrl');
     if ($routeUrl != '') {
         $attributes['onclick'] = 'location.href=\'' . __Link::makeUrl($routeUrl) . '\'';
         if (!is_null($this->getAttribute('confirmMessage'))) {
             $attributes['onclick'] = 'if (confirm(\'' . $this->getAttribute('confirmMessage') . '\')) ' . $attributes['onclick'] . '; else return false;';
         }
     }
     $url = $this->getAttribute('url');
     if ($url != '') {
         $attributes['onclick'] = 'location.href=\'' . $url . '\'';
     }
     $targetForm = $this->getAttribute('target');
     if (!is_null($targetForm)) {
         $this->addTranslateInfo($targetForm->getCommadFieldName(), $this->getAttribute('label'), $this->getAttribute('value'));
     } else {
         $this->addTranslateInfo($this->getAttribute('name'), $this->getAttribute('label'), $this->getAttribute('value'));
     }
     if ($this->getAttribute('tag') == 'input') {
         $attributes['value'] = glz_encodeOutput($this->getAttribute('label'));
         $output .= '<input ' . $this->_renderAttributes($attributes) . ' />';
     } else {
         $attributes['value'] = glz_encodeOutput($this->getAttribute('value'));
         if (strpos($attributes['value'], 'route:') === 0) {
             $attributes['value'] = __Link::makeUrl(str_replace('route:', '', $attributes['value']));
         }
         $output .= '<button ' . $this->_renderAttributes($attributes) . '>' . $this->getAttributeString('label') . '</button>';
     }
     $this->addOutputCode($output);
 }
Exemplo n.º 12
0
 private function makeUrlFromId($id, $fullLink = false)
 {
     $ar = org_glizy_objectFactory::createModel('movio.modules.ontologybuilder.models.EntityDocument');
     if ($ar->load($this->getIdFromLink($id))) {
         $entityTypeId = $this->getEntityTypeId($ar->document_type);
         $menu = $this->getPage($entityTypeId);
         if ($ar->document_detail_isVisible && $ar->document_detail_translated && $menu) {
             // if the document is visible and is traslated and the entity page exists
             if ($ar->keyInDataExists('url') && $ar->url) {
                 $language = $this->application->getLanguage();
                 $url = GLZ_HOST . '/' . $language . '/' . $ar->url;
             } else {
                 $url = __Link::makeUrl('showEntityDetail', array('pageId' => $menu->id, 'entityTypeId' => $entityTypeId, 'document_id' => $id, 'title' => $ar->title));
             }
             return $fullLink ? __Link::makeSimpleLink($ar->title, $url) : $url;
         }
     }
     // document not found, isn't visible or isn't traslated
     // go to entity page or home
     $speakingUrlManager = $this->application->retrieveProxy('org.glizycms.speakingUrl.Manager');
     return $speakingUrlManager->makeUrl('internal:' . ($menu ? $menu->id : __Config::get('START_PAGE')));
 }
Exemplo n.º 13
0
 function _readPageId()
 {
     $this->log("readPageId", GLZ_LOG_SYSTEM);
     // legge il pageId della pagina da visualizzare
     $this->_pageId = org_glizy_Request::get('pageId', NULL);
     if (empty($this->_pageId)) {
         $this->_pageId = org_glizy_Config::get('REMEMBER_PAGEID') ? org_glizy_Session::get('glizy.pageId', org_glizy_Config::get('START_PAGE')) : org_glizy_Config::get('START_PAGE');
     }
     if (org_glizy_Config::get('REMEMBER_PAGEID')) {
         org_glizy_Session::set('glizy.pageId', $this->_pageId);
     }
     if (!is_numeric($this->_pageId) && $this->getClassName() == 'org_glizycms_core_application_application') {
         $this->siteMapMenu =& $this->siteMap->getMenuByPageType($this->_pageId);
         $this->_pageId = $this->siteMapMenu->id;
     } else {
         $this->siteMapMenu =& $this->siteMap->getNodeById($this->_pageId);
     }
     if (!is_object($this->siteMapMenu) || !$this->siteMapMenu->isVisible) {
         $report = array();
         $report['Request'] = var_export(__Request::getAllAsArray(), true);
         $report['_SERVER'] = var_export($_SERVER, true);
         $this->log($report, GLZ_LOG_SYSTEM, 'glizy.404');
         if (!$this->getCurrentUser()->acl($this->siteMapMenu->id, "visible")) {
             org_glizy_helpers_Navigation::gotoUrl(__Link::makeUrl('link', array('pageId' => __Config::get('START_PAGE'))));
         }
         $error404Page = __Config::get('ERROR_404');
         if (!empty($error404Page)) {
             org_glizy_helpers_Navigation::gotoUrl(__Link::makeUrl('link', array('pageId' => $error404Page)));
         }
         new org_glizy_Exception(__T('GLZ_ERR_404') . '</br>' . __Request::get('pageId'), GLZ_E_404);
     }
     if (!empty($this->siteMapMenu->select)) {
         if ($this->siteMapMenu->select == '*') {
             $menu = $this->siteMapMenu->firstChild(true);
         } else {
             $menu = $this->siteMap->getNodeById($this->siteMapMenu->select);
         }
         org_glizy_helpers_Navigation::gotoUrl(__Link::makeUrl('link', array('pageId' => $menu->id)));
     }
 }
Exemplo n.º 14
0
 function changeAction($action)
 {
     $url = __Link::makeUrl('linkChangeAction', array('action' => $action));
     org_glizy_helpers_Navigation::gotoUrl($url);
 }