Exemplo n.º 1
0
    public function generateInner()
    {
        $js = "!{$this->popupName}.start();";
        $text = $this->getText();
        if ($text == '' || !$text) {
            $button = new MButtonIcon($js);
            $button->setIcon('managerIconButtonNew');
        } else {
            if ($text == 'hidden') {
                $button = new MLabel('');
            } else {
                $button = new MButton('', $text, $js);
            }
        }
        $html = $button->generate();
        $action = MAction::getHref($this->action);
        $jsCode = <<<HERE
        {$this->popupName}.setContext({
             name    : '{$this->popupName}',
             action  : '{$action}',
             related : '{$this->related}',
             filter  : '{$this->filter}',
             field   : '{$this->name}'
        });
HERE;
        $this->page->addJsCode("{$this->popupName} = new Manager.FormPopup();");
        $this->page->addJsCode($jsCode);
        $this->inner = new MDiv('', $html, '');
    }
Exemplo n.º 2
0
    public function generate()
    {
        $id = $this->getId();
        $url = MAction::getHref($this->url);
        $onload = <<<HERE
var {$id} = manager.addWindow('{$id}');
manager.getWindow('{$id}').setHref('{$url}');

HERE;
        $this->page->addJsCode($onload);
        return '';
    }
Exemplo n.º 3
0
 public static function generate($control, $action)
 {
     $isAction = MAction::isAction($action);
     if ($isAction) {
         if (!$control->hasEvent('onClick') && !$control->hasEvent('click')) {
             $control->addEvent('click', MAction::getOnClick($action, $control->getId(), $control->target));
         }
         return '';
     } else {
         return MAction::getHref($action);
     }
 }
Exemplo n.º 4
0
 public function generateInner()
 {
     $id = $this->getId();
     $value = $this->getValue();
     $numFields = count($this->fields);
     // fields
     $fields = '';
     $n = 1;
     $ref = '';
     $totalWidth = 0;
     foreach ($this->fields as $f) {
         $ref .= ($ref ? ',' : '') . $f->getName();
         $f->form = $this->form;
         $f->setLabel(htmlspecialchars($f->label));
         //$f->formMode = 2;
         $fields[] = $f;
         $totalWidth += $width[] = $f->width ?: '15';
         $n++;
     }
     $btnInsert = new MButton("{$id}_btnInsert", 'Inserir', "!{$id}_ajaxInsert();");
     $actionInsert = MAction::getHref($this->actionInsert);
     $this->page->addJsCode("{$id}_ajaxInsert = function() {  manager.doAjaxText('{$actionInsert}', '{$id}_divGrid', '{$id}_btnInsert') };");
     $fields[] = $btnInsert;
     $field = new MContentPane("{$id}_divGrid");
     $select = $field;
     $btnDelete = new MButton("{$id}_btnDelete", 'Remover selecionados', "!{$id}_ajaxDelete();");
     $actionDelete = MAction::getHref($this->actionDelete);
     $this->page->addJsCode("{$id}_ajaxDelete = function() {  manager.doAjaxText('{$actionDelete}', '{$id}_divGrid', '{$id}_btnDelete') };");
     // layout
     $t = array();
     $array[] = new MDiv('', new MHContainer("{$id}_containerFields", $fields));
     $array[] = new MDiv('', $select);
     $array[] = new MDiv('', $btnDelete);
     $container = new MVContainer('', $array);
     $group = new MBaseGroup('', $this->getCaption(), $container);
     if (strpos($this->actionGrid, Manager::getBaseURL()) !== false) {
         $actionGrid = $this->actionGrid;
     } else {
         $actionGrid = MAction::getHref($this->actionGrid . ($value ? '/' . $value : ''));
     }
     $this->page->onLoad(MUI::set("{$id}_divGrid", 'href', $actionGrid) . ';');
     $div = new MDiv($this->name, $group);
     $div->attributes = clone $this->attributes;
     $div->style = clone $this->style;
     $div->setClass('mGridField');
     $this->inner = array($div);
     return $this->inner;
 }
Exemplo n.º 5
0
    public function generateInner()
    {
        $this->label = $this->label ? '&nbsp;' : '';
        if (!$this->readonly) {
            $button = new MButtonFind("!{$this->lookupName}.start();");
            $action = MAction::getHref($this->action);
            $jsCode = <<<HERE
        {$this->lookupName}.setContext({
             name    : '{$this->lookupName}',
             action  : '{$action}',
             related : '{$this->related}',
             filter  : '{$this->filter}',
             form    : '{$this->getFormId()}',
             field   : '{$this->name}',
             autocomplete : '{$this->autocomplete}'
        });
HERE;
            $this->page->addJsCode("{$this->lookupName} = new Manager.Lookup();");
            $this->page->addJsCode($jsCode);
        } else {
            $button = new MButtonFind('!return false;');
        }
        //        $content[] = $button->generate();
        //        $html = $this->painter->generateToString($content);
        //        $this->inner = new MDiv('', $html, '');
        $this->inner = $button;
    }
Exemplo n.º 6
0
 public function generateInner()
 {
     $id = $this->getId();
     $value = $this->getValue();
     $numFields = count($this->fields);
     // fields
     $fields = '';
     $n = 1;
     $ref = '';
     $totalWidth = 0;
     foreach ($this->fields as $f) {
         $fieldList .= ($fieldList ? ',' : '') . $f->getId();
         $f->form = $this->form;
         $f->setLabel(htmlspecialchars($f->label));
         //$f->formMode = 2;
         $fields[] = $f;
         $totalWidth += $width[] = $f->property->size ?: '15';
         $n++;
     }
     $btnInsert = new MButton("{$id}_btnInsert", 'Inserir', "!{$id}.insert();");
     //$fields[] = $btnInsert;
     $divGrid = new MContentPane("{$id}_divGrid");
     $btnDelete = new MButton("{$id}_btnDelete", 'Remover', "!{$id}.delete();");
     //$fields[] = $btnDelete;
     // layout
     $t = array();
     $array[] = new MHiddenField("{$id}_data");
     $array[] = new MDiv('', new MHContainer("{$id}_containerFields", $fields));
     $array[] = new MDiv('', $divGrid);
     $container = new MVContainer('', $array);
     $group = new MBaseGroup('', $this->getCaption(), $container);
     $actionGrid = MAction::getHref($this->actionGrid . '/' . $value);
     $div = new MDiv($this->name, $group, 'mGridField');
     $this->inner = array($div);
     $this->page->addDojoRequire("manager.GridInput");
     $this->page->addJsCode("var {$id} = Manager.GridInput('{$id}','{$fieldList}','{$actionGrid}');");
     $this->page->onLoad("{$id}.loadData({$this->data});");
     return $this->inner;
 }