Example #1
0
    /**
     * Vložení skriptu
     */
    function finalize()
    {
        $grid_id = $this->getTagID();
        if ($this->getTagProperty('columnsAutoSize')) {
            $this->options['onSuccess'] = 'function() { addGrid($("#' . $grid_id . '"), this)}';
            //Patch Grid Responisive
            $grid_js = '
        var grids=[];
            $(window).resize(function() {
                //Resize all the grids on the page
                //Only resize the ones whoes size has actually changed...
                for(var i in grids) {
                    if(grids[i].width!=grids[i].$grid.width()) {
                        sizeGrid(grids[i]);
                    }
                }
            });';
            $grid_js .= '
            //Keep track of all grid elements and current sizes
            function addGrid($table, grid) {
                var $grid = $table.closest(\'.flexigrid\');
                var data = {$table:$table, $grid:$grid, grid:grid, width:$grid.width()};
                grids.push(data);
                sizeGrid(data);
            }';
            $grid_js .= '
            //Make all cols with auto size fill remaining width..
            function sizeGrid(data) {
                //Auto size the middle col.
                var totalWidth = data.$grid.outerWidth()-15; //15 padding - not found where this is set

                var fixedWidth = 0;
                var fluidCols = [];
                for(var i=0; i<data.grid.colModel.length; i++ ) {
                    if( !isNaN(data.grid.colModel[i].width) ) {
                        fixedWidth+=data.$table.find(\'tr:eq(\'+i+\') td:eq(\'+i+\'):visible\').outerWidth(true);
                    } else {
                        fluidCols.push(i);
                    }
                }

                var newWidth = (totalWidth-fixedWidth)/fluidCols.length;
                for(var i in fluidCols) {
                    data.grid.g.colresize = { n:fluidCols[i], nw:newWidth };
                    data.grid.g.dragEnd( );
                }

                data.width = data.$grid.width();
            }';
        } else {
            $grid_js = '';
        }
        if ($this->select) {
            $this->options['query'] = current($this->select);
            $this->options['qtype'] = key($this->select);
        }
        if ($this->dblclk2edit) {
            $this->options['onDoubleClick'] = 'function(g) {
                    var id = $(g).attr(\'id\');
                    id = id.substring(id.lastIndexOf(\'row\')+3);
                    $(location).attr(\'href\',\'' . $this->dataSource->keyword . '.php?' . $this->dataSource->getMyKeyColumn() . '=\' +id);

            }';
        }
        $this->options['getGridClass'] = 'function(g) { this.g=g; return g; }';
        EaseShared::webPage()->addJavaScript("\n" . '$(\'#' . $grid_id . '\').flexigrid({ ' . EaseJQueryPart::partPropertiesToString($this->options) . ' }); ' . $grid_js, null, true);
    }
Example #2
0
 /**
  * Přidá do stránky javascript pro skrývání oblasti stavových zpráv
  */
 public function finalize()
 {
     EaseJQueryPart::jQueryze($this);
     $this->includeJavaScript('js/slideupmessages.js');
 }
 /**
  * Volba ikony pro host
  *
  * @param IEHost $host
  */
 public function __construct($host)
 {
     parent::__construct();
     EaseJQueryPart::jQueryze($this);
     $icodirs = array('' => '');
     $icoBox = $this->addItem(new EaseTWBPanel(_('Vyber Ikonu')));
     $icoBox->setTagCss('width: 100%;');
     $icodir = self::$webdir . self::$icodir;
     $d = dir($icodir);
     if (is_object($d)) {
         while (false !== ($entry = $d->read())) {
             if (is_dir(self::$webdir . self::$icodir . '/' . $entry)) {
                 if ($entry[0] == '.') {
                     continue;
                 }
                 $icodirs[$entry] = $entry;
             }
         }
         $d->close();
     }
     $iconTabs = $icoBox->addItem(new EaseTWBTabs('IconTabs'));
     foreach ($icodirs as $subicodir) {
         $default = false;
         $icons = new EaseContainer();
         $customIcos = self::$webdir . self::$icodir . $subicodir;
         $d = dir($customIcos);
         if (is_object($d)) {
             while (false !== ($entry = $d->read())) {
                 if (!is_dir($customIcos . '/' . $entry)) {
                     if (strstr($entry, '.gd2') || $entry[0] == '.') {
                         continue;
                     }
                     if ($entry == 'custom') {
                         list($userid, $imgname) = explode('-', $entry);
                         if ($userid != $host->owner->getId()) {
                             continue;
                         }
                         $default = true;
                     }
                     $hostIcon = new EaseHtmlImgTag(self::$webprefix . self::$icodir . '/' . $subicodir . '/' . $entry);
                     $hostIcon->setTagClass('host_icon');
                     if ($host->getDataValue('icon_image') == 'custom/' . $entry) {
                         $hostIcon->setTagCss('border: 3px red solid;');
                     }
                     $icons->addItem(new EaseHtmlATag('?action=newicon&host_id=' . $host->getId() . '&newicon=' . $subicodir . '/' . $entry, $hostIcon));
                 }
             }
             $d->close();
         }
         if (!$subicodir) {
             $subicodir = 'ico';
         }
         $iconTabs->addTab($subicodir, $icons, $default);
     }
     $uplBox = $this->addItem(new EaseTWBPanel(_('Nahraj vlastní'), 'info'));
     $uplBox->setTagCss('width: 100%;');
     $icoupform = $uplBox->addItem(new EaseTWBForm('icoUp', null, 'POST', null, array('enctype' => 'multipart/form-data')));
     $icoupform->addItem(new EaseHtmlEmTag(_('Obrázek typu GIF,PNG nebo JPG, nejlépe 40x40 px')));
     $icoupform->addItem(new EaseTWBFormGroup(_('Ikona ze souboru'), new EaseHtmlInputFileTag('icofile'), '', _('Soubor v počítači')));
     $icoupform->addItem(new EaseTWBFormGroup(_('Ikona z adresy'), new EaseHtmlInputTextTag('icourl'), '', _('Soubor na internetu')));
     $icoupform->addItem(new EaseTWBFormGroup(_('Titulek obrázku'), new EaseHtmlInputTextTag('icon_image_alt'), '', _('nepovinné')));
     $icoupform->addItem(new EaseTWSubmitButton(_('Odeslat')));
     $icoupform->addItem(new EaseHtmlInputHiddenTag('host_id', $host->getId()));
 }