Пример #1
0
$form0 = new afExtjsForm(array('action' => '/interface/test', 'frame' => true));
$fieldset = $form0->startFieldset(array('legend' => 'Fieldset from second form'));
new afExtjsFieldDoubleTree($fieldset, array('name' => 'my_double_tree', 'label' => 'My double tree', 'help' => 'test help', 'comment' => 'comment on double tree', 'state' => 'editable', 'fromLegend' => 'Options grouped', 'toLegend' => 'Selected grouped', 'options' => $double_tree_options, 'selected' => $double_tree_selected));
new afExtjsFieldInput($fieldset, array('name' => 'my_name', 'label' => 'My Name', 'value' => 'RaduX', 'help' => "'+field.value+'", 'comment' => 'comment on the upper field', 'handlers' => array('change' => array('parameters' => 'field', 'source' => 'alert(field.value);'))));
new afExtjsFieldMultiCombo($fieldset, array('name' => 'my_multi_combo', 'label' => 'My multi combo', 'help' => "multi combo box", 'comment' => 'comment for multi combo', 'options' => array('1' => 'Value 1', '2' => 'Value 2', '3' => 'Value 3'), 'selected' => array('1', '2'), 'state' => 'editable', 'clear' => true));
$form0->endFieldset($fieldset);
new afExtjsSubmitButton($form0, array('action' => '/interface/test'));
new afExtjsResetButton($form0);
new afExtjsButton($form0, array('label' => 'Just a normal button', 'handlers' => array('click' => array('parameters' => 'field,event', 'source' => 'alert(field.name);'))));
new afExtjsLinkButton($form0, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk', 'icon' => '/images/famfamfam/cancel.png'));
new afExtjsLinkButton($form0, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk'));
$form0->end();
/**
 * A FORM IN THE COLUMN
 */
$form = new afExtjsForm(array('idxml' => 'interface/someform', 'action' => '/interface/test', 'portal' => true, 'tools' => $tools));
$form->addHelp($html);
$fieldset = $form->startFieldset(array('legend' => 'Fieldset 1', 'collapsed' => false));
/**
 * combo with button, NEW CUSTOM WIDGET FIELD, complex behaviour
 * Explanations:
 * button:text => the button text
 * button:icon => the button icon
 * 
 * window => the window that appears on button click
 * window:title => the window title
 * window:component => the window inner component, here is a form
 * window:class => the model class from where to retrieve new data for combo, after window close
 * window:method => the model method from where to retrieve new data for combo, after window close
 */
//$combo=new afExtjsFieldCombo($fieldset,array('name'=>'my_combo_button','label'=>'My combo button','help'=>"combo box with button",'comment'=>'comment for combo w button','options'=>array('a'=>'Value A','b'=>'Value B'),'selected'=>'b','button'=>array('text'=>'Trigger','icon'=>'/images/famfamfam/cancel.png'),'window'=>array('title'=>'Window Title','component'=>$form0,'className'=>'ServerPeer','methodName'=>'getAllAsOptions')));
<head>
<?php 
include_http_metas();
include_metas();
include_title();
?>
</head>

<body style="background-image: url(/appFlowerStudioPlugin/images/bg/backgrond_3.2.2.jpg);background-position: 50% 50%;background-repeat: no-repeat;">
    <!-- Page Frame -->
<?php 
$layout = new afExtjsSfGuardLayout();
/**
 * EXTJS REQUEST PASSWORD FORM
 */
$form = new afExtjsForm(array('action' => url_for('/afsAuthorize/passwordRequest')));
$fieldset = $form->startFieldset(array('legend' => 'Receive your login details by email'));
$columns = $fieldset->startColumns(array("columnWidth" => 1));
$col = $columns->startColumn(array("columnWidth" => 1));
$username = new afExtjsFieldInput($col, array('name' => 'email', 'label' => 'Email', 'value' => $sf_params->get('email'), 'help' => "Enter your email", 'comment' => 'write your email', 'width' => '150'));
$columns->endColumn($col);
$fieldset->endColumns($columns);
$form->endFieldset($fieldset);
new afExtjsSubmitButton($form, array('action' => url_for('/afsAuthorize/passwordRequest')));
new afExtjsLinkButton($form, array('url' => url_for('/afsAuthorize/index'), 'label' => 'Go to Login', 'load' => 'page'));
$form->end();
$layout->addItem('center', $form);
$tools = new afExtjsTools();
//$tools->addItem(array('id'=>'gear','handler'=>array('source'=>"Ext.Msg.alert('Message', 'The Settings tool was clicked.');")));
//$tools->addItem(array('id'=>'close','handler'=>array('parameters'=>'e,target,panel','source'=>"panel.ownerCt.remove(panel, true);")));
$layout->addCenterComponent($tools, array('title' => 'Request Password'));
 * action1
 */
$actions->addAction(array('iconCls' => 'icon-edit-record', 'tooltip' => 'Edit'));
/**
 * action2
 */
$actions->addAction(array('iconCls' => 'icon-minus', 'tooltip' => 'Delete'));
$grid->endRowActions($actions);
new afExtjsLinkButton($grid, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk'));
new afExtjsLinkButton($grid, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk', 'icon' => '/images/famfamfam/cancel.png'));
$grid->end();
$column1->addItem($grid);
/**
 * A FORM IN THE COLUMN
 */
$form = new afExtjsForm(array('action' => '/interface/test', 'title' => 'Form', 'portal' => true, 'tools' => $tools));
$fieldset = $form->startFieldset(array('legend' => 'Fieldset 1'));
$input = new afExtjsFieldInput($fieldset, array('name' => 'my_name', 'label' => 'My Name', 'value' => 'Radu', 'help' => "'+field.value+'", 'comment' => 'comment on the upper field', 'handlers' => array('change' => array('parameters' => 'field', 'source' => 'alert(field.value);'))));
$textarea = new afExtjsFieldTextarea($fieldset, array('name' => 'my_textarea', 'label' => 'My Textarea', 'value' => 'textarea', 'comment' => 'my textarea comment', 'rich' => true));
$password = new afExtjsFieldPassword($fieldset, array('name' => 'my_pass', 'label' => 'My Pass', 'value' => 'Radu', 'help' => "password", 'comment' => 'comment on the upper field'));
$form->endFieldset($fieldset);
new afExtjsSubmitButton($form, array('action' => '/interface/test'));
new afExtjsResetButton($form);
new afExtjsButton($form, array('label' => 'Just a normal button', 'handlers' => array('click' => array('parameters' => 'field,event', 'source' => 'alert(field.name);'))));
new afExtjsLinkButton($form, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk', 'icon' => '/images/famfamfam/cancel.png'));
new afExtjsLinkButton($form, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk'));
$form->end();
$column1->addItem($form);
$column1->addItem(array('title' => 'Panel 1', 'tools' => $tools, 'html' => 'test'));
$layout->endColumn($column1);
$layout->end();
Пример #4
0
/**
 * CHANGED TO a, b and c values, to see that selected works fine
 */
$multicombo = new afExtjsFieldMultiCombo($fieldset1, array('name' => 'my_multi_combo', 'label' => 'My multi combo', 'help' => "multi combo box", 'comment' => 'comment for multi combo', 'options' => array('a' => 'Value A', 'b' => 'Value B', 'c' => 'Value C'), 'selected' => array('b', 'c'), 'state' => 'editable', 'clear' => true));
$form->endFieldset($fieldset1);
new afExtjsSubmitButton($form, array('action' => '/interface/test'));
new afExtjsResetButton($form);
new afExtjsButton($form, array('label' => 'Just a normal button', 'handlers' => array('click' => array('parameters' => 'field,event', 'source' => 'alert(field.name);'))));
new afExtjsLinkButton($form, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk', 'icon' => '/images/famfamfam/cancel.png'));
new afExtjsLinkButton($form, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk'));
$form->end();
$layout->addItem('center', $form);
/**
 * SECOND FORM
 */
$form1 = new afExtjsForm(array('action' => '/interface/test'));
$fieldset = $form1->startFieldset(array('legend' => 'Fieldset from second form'));
new afExtjsFieldMultiCombo($fieldset, array('name' => 'my_multi_combo', 'label' => 'My multi combo', 'help' => "multi combo box", 'comment' => 'comment for multi combo', 'options' => array('1' => 'Value 1', '2' => 'Value 2', '3' => 'Value 3'), 'selected' => array('1', '2'), 'state' => 'editable', 'clear' => true));
$form1->endFieldset($fieldset);
new afExtjsSubmitButton($form1, array('action' => '/interface/test'));
new afExtjsResetButton($form1);
new afExtjsButton($form1, array('label' => 'Just a normal button', 'handlers' => array('click' => array('parameters' => 'field,event', 'source' => 'alert(field.name);'))));
new afExtjsLinkButton($form1, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk', 'icon' => '/images/famfamfam/cancel.png'));
new afExtjsLinkButton($form1, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk'));
$form1->end();
$layout->addItem('center', $form1);
$tools = new afExtjsTools();
$tools->addItem(array('id' => 'gear', 'handler' => array('source' => "Ext.Msg.alert('Message', 'The Settings tool was clicked.');")));
$tools->addItem(array('id' => 'close', 'handler' => array('parameters' => 'e,target,panel', 'source' => "panel.ownerCt.remove(panel, true);")));
$layout->addCenterComponent($tools, array('title' => 'Forms'));
$layout->end();
Пример #5
0
//$grid->setProxy(array('url'=>'/interface/jsonactionstree','limit'=>2/*,'stateId'=>'gdtree'*/));
//$grid->end();
//$layout->addItem('west',$grid);
/**
* ticket #659 END
*/
$layout->addItem('west', array('title' => 'Settings1', 'autoScroll' => 'true', 'border' => 'false', 'iconCls' => 'settings', 'html' => 'test2'));
/**
 * SOME DOUBLE TREE DATA
 */
$double_tree_options = array(array("text" => "Group 1", "value" => "G1", "leaf" => false, "iconCls" => "folder", "children" => array(array("text" => "Item1", "value" => "item 1", "leaf" => true, "iconCls" => "file"), array("text" => "Item2", "value" => "item 2", "leaf" => true, "iconCls" => "file"))), array("text" => "Group 2", "value" => "G2", "leaf" => false, "iconCls" => "folder", "children" => array(array("text" => "Item3", "value" => "item 3", "leaf" => true, "iconCls" => "file"), array("text" => "Item4", "value" => "item 4", "leaf" => true, "iconCls" => "file"), array("text" => "Item5", "value" => "item 5", "leaf" => true, "iconCls" => "file"))));
$double_tree_selected = array(array("text" => "Group 1", "value" => "G1", "leaf" => false, "iconCls" => "folder", "children" => array(array("text" => "Item11", "value" => "item 11", "leaf" => true, "iconCls" => "file"))));
/**
 * WINDOW FORM
 */
$form0 = new afExtjsForm(array('action' => '/interface/test', 'frame' => true));
$fieldset = $form0->startFieldset(array('legend' => 'Fieldset from second form'));
new afExtjsFieldDoubleTree($fieldset, array('name' => 'my_double_tree', 'label' => 'My double tree', 'help' => 'test help', 'comment' => 'comment on double tree', 'state' => 'editable', 'fromLegend' => 'Options grouped', 'toLegend' => 'Selected grouped', 'options' => $double_tree_options, 'selected' => $double_tree_selected));
new afExtjsFieldInput($fieldset, array('name' => 'my_name', 'label' => 'My Name', 'value' => 'RaduX', 'help' => "'+field.value+'", 'comment' => 'comment on the upper field', 'handlers' => array('change' => array('parameters' => 'field', 'source' => 'alert(field.value);'))));
new afExtjsFieldMultiCombo($fieldset, array('name' => 'my_multi_combo', 'label' => 'My multi combo', 'help' => "multi combo box", 'comment' => 'comment for multi combo', 'options' => array('1' => 'Value 1', '2' => 'Value 2', '3' => 'Value 3'), 'selected' => array('1', '2'), 'state' => 'editable', 'clear' => true));
$form0->endFieldset($fieldset);
new afExtjsSubmitButton($form0, array('action' => '/interface/test'));
new afExtjsResetButton($form0);
new afExtjsButton($form0, array('label' => 'Just a normal button', 'handlers' => array('click' => array('parameters' => 'field,event', 'source' => 'alert(field.name);'))));
new afExtjsLinkButton($form0, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk', 'icon' => '/images/famfamfam/cancel.png'));
new afExtjsLinkButton($form0, array('label' => 'www.immune.dk', 'url' => 'http://www.immune.dk'));
$form0->end();
/**
 * FIRST FORM
 */
$form = new afExtjsForm(array('action' => '/interface/test'));
Пример #6
0
    private function postProcess($build = false, $uri = null)
    {
        if ($uri) {
            $this->process["parses"][$this->iteration]["module"] = strtok($uri, "/");
            $this->process["parses"][$this->iteration]["component_name"] = strtok("/");
        }
        Console::profile('postProcess');
        /*
         * Create widgets in advanced for the text link script (widget launcher)
         */
        sfApplicationConfiguration::getActive()->loadHelpers(array("Helper", "Url", "afUrl"));
        // Update session if needed..
        $module = $this->context->getModuleName();
        $action = $this->context->getActionName();
        $this->context->getUser()->getAttributeHolder()->removeNamespace('parser/grid');
        if ($this->type === self::WIZARD) {
            if (isset($this->attribute_holder["init"])) {
                $this->context->getUser()->getAttributeHolder()->removeNamespace('parser/wizard');
            }
            self::updateSession(false, "parser/wizard", null, $this->datastore, $this->process);
        }
        if (!$build) {
            $pageHelp = $this->type !== self::WIZARD && isset($this->process["parses"][0]["extra"]) && $this->widgetHelpSettings->getWidgetHelpIsEnabled();
        } else {
            $pageHelp = null;
        }
        if ($this->multi) {
            $this->page = $this->process["parses"][0];
            unset($this->process["parses"][0]);
            if ($pageHelp) {
                $this->layout->addHelp($this->page["extra"]);
            }
            $this->layout->setTitle($this->page["title"] . (class_exists('afExtjsWidgetConfig') ? afExtjsWidgetConfig::getPostfixTitle() : ''));
        }
        if ($this->tree) {
            $this->layout->addItem('west', $this->tree);
        }
        foreach ($this->process["parses"] as $it => $parse) {
            // Parse additional scripts..
            if (array_key_exists("scripts", $parse)) {
                $this->parseScripts($parse);
            }
            /*
             * Moved the tools in this loop to have different tools on different portlets depending upon their types.
             */
            $tools = new afExtjsTools();
            // Help popup
            if ($this->widgetHelpSettings && $this->widgetHelpSettings->getPopupHelpIsEnabled()) {
                $tools->addItem(array('id' => 'help', 'qtip' => "Widget Help", 'handler' => array('parameters' => 'e,target,panel', 'source' => "afApp.loadPopupHelp(panel.idxml);")));
            }
            //Print - for grids it is added later due parameters.
            if ($parse["view"] != "list") {
                $tools->addItem(array('id' => 'print', 'qtip' => "Printer friendly version", 'handler' => array('parameters' => 'e,target,panel', 'source' => "window.open('/'+panel.idxml+'?af_format=pdf&" . $this->getQueryString() . "','print');")));
            }
            if (isset($parse['params']) && isset($parse['params']['settings'])) {
                $tools->addItem(array('id' => 'gear', 'qtip' => 'Setting', 'handler' => array('parameters' => 'e,target,panel', 'source' => "afApp.widgetPopup('" . $parse['params']['settings'] . "','Settings',panel)")));
            }
            //$tools->addItem(array('id'=>'start-reload','handler'=>array('parameter'=>'e,target,panel','source'=>'this.id="stop-reload"')));
            $tools->addItem(array('id' => 'close', 'qtip' => 'Close', 'handler' => array('parameters' => 'e,target,panel', 'source' => "var portal=panel.ownerCt.ownerCt;panel.ownerCt.remove(panel, true);portal.onWidgetDrop();")));
            /***********************************************************/
            if (!$build) {
                $widgetHelp = $this->type !== self::WIZARD && isset($parse["description"]) && $this->widgetHelpSettings->getWidgetHelpIsEnabled();
                if ($widgetHelp) {
                    if ($this->type === self::PANEL) {
                        $this->layout->addHelp($parse["description"]);
                    }
                }
            }
            if ($this->multi) {
                $current_area = $this->page["areas"][$parse["area"]];
            } else {
                $current_area = isset($parse["area"]) ? $parse["area"] : null;
            }
            $view = $parse["view"];
            $parsedgroups = array();
            if (!isset($parse["multipart"])) {
                $parse["multipart"] = false;
            }
            if ($this->multi && isset($this->page["confirm"])) {
                $this->layout->attributes['listeners']['beforerender'] = $this->layout->afExtjs->asMethod(array('parameters' => 'el', 'source' => "Ext.Msg.confirm('" . $this->page["confirm"]["title"] . "','" . $this->page["confirm"]["text"] . "', function(btn){if (btn=='yes'){ return true; }else{ window.location.href='" . $this->page["confirm"]["url"] . "';return false;} });"));
            }
            //echo "<pre>";print_r($parse);exit;
            $formoptions = $this->multi ? array("title" => $parse["title"], "fileUpload" => $parse["multipart"], "portal" => true, "tools" => $tools) : array("fileUpload" => $parse["multipart"]);
            if ($it == 1 && $this->multi && $this->type === self::WIZARD) {
                $panel = $this->layout->startColumn(array('columnWidth' => isset($current_area["attributes"]["width"]) ? $current_area["attributes"]["width"] : '0.98'));
            }
            if ($this->type == self::PAGE) {
                $action_name = preg_replace("/[0-9]+/", "", $parse["component"]);
            }
            // Determine group - Wizards
            if (!$this->openGroup && $this->tabbedWizard) {
                $this->openGroup = true;
                $wizard_group = $this->layout->startGroup();
            }
            if ($view == "edit" || $view == "show") {
                $formoptions["action"] = url_for($parse["form"]);
                $formoptions["name"] = "form" . $it;
                $formoptions["classic"] = $parse["classic"] !== "false";
                $formoptions["labelWidth"] = isset($parse['labelWidth']) ? $parse['labelWidth'] : '75';
                if ($this->type == self::PANEL) {
                    $widget = $this->context->getActionName();
                } else {
                    if ($this->type == self::PAGE) {
                        #1048 - element should have unique id
                        $widget = $action_name;
                        $formoptions["idxml"] = $parse['module'] . "/" . $action_name;
                    }
                }
                if ($this->type === self::WIZARD) {
                    //$formoptions["classic"] = true;
                }
                $form = new afExtjsForm($formoptions);
                if ($widgetHelp) {
                    if ($this->multi) {
                        $form->addHelp($parse["description"]);
                    }
                }
                foreach ($parse["fields"] as $setname => $set) {
                    $this->is_floated = array();
                    if (!isset($set["attributes"]["tabtitle"])) {
                        if (isset($tabx)) {
                            unset($tabx);
                        }
                    } else {
                        if (!isset($tabs)) {
                            $set["attributes"]["isSetting"] = $parse['isSetting'];
                            $set["attributes"]["description"] = isset($parse['description']) ? $parse['description'] : "";
                            $tabs = $form->startTabs($set["attributes"]);
                        }
                    }
                    // Fieldset
                    if ($parse["isgrouped"]) {
                        if (!$this->tabbedWizard) {
                            $attributes = array("legend" => $set["attributes"]["title"], "collapsed" => $set["attributes"]["collapsed"]);
                        } else {
                            $attributes = array();
                        }
                        $this->is_floated[] = !$this->tabbedWizard ? $this->isFloatedSet($set) : false;
                        if ($this->is_floated[0]) {
                            $attrs = array("columnWidth" => sprintf("%1.2f", (double) 1 / $this->is_floated[0]), 'labelAlign' => 'top');
                        } else {
                            $attrs = array('columnWidth' => 1, 'labelAlign' => 'left');
                        }
                    } else {
                        $attributes = array();
                        $fieldset = $form;
                        $set = $parse["fields"];
                        $attrs = array('columnWidth' => 1, 'labelAlign' => 'left');
                    }
                    if (isset($set["attributes"]["tabtitle"])) {
                        $tabattrs = array('title' => $set["attributes"]["tabtitle"], 'height' => $set["attributes"]["tabHeight"], "iconCls" => $set["attributes"]["tabIconCls"]);
                        if ($set["attributes"]["tabIcon"] && file_exists($this->root . "/web" . $set["attributes"]["tabIcon"])) {
                            $tabattrs["icon"] = $set["attributes"]["tabIcon"];
                            unset($tabattrs["iconCls"]);
                        }
                        $tabx = $tabs->startTab($tabattrs);
                        $fieldset = $tabx->startFieldset($attributes);
                    } else {
                        $fieldset = $form->startFieldSet($attributes);
                    }
                    if ($parse["isgrouped"]) {
                        $columns = $fieldset->startColumns();
                    }
                    // Field data
                    foreach ($set as $name => $data) {
                        $rcf = new ReConfigureFields($data);
                        $data = $rcf->getField();
                        if ($parse["isgrouped"]) {
                            $columnx = $columns->startColumn($attrs);
                        }
                        if ($name == "attributes" || !is_array($data)) {
                            continue;
                        }
                        // Convert to attributes field's children's default values here!
                        $this->childToAttribute($data, $it);
                        $attributes = $data["attributes"];
                        $attributes['labelStyle'] = 'width:' . $parse['labelWidth'] . 'px;font-size:11px;font-weight:bold;padding:0 3px 3px 0;';
                        // Put validators into af_formcfg.
                        if (isset($data['validators'])) {
                            $form->addValidator($name, $data['validators']);
                        }
                        $classname = $attributes["type"];
                        // Add file types for af_formcfg
                        $form->addFieldType($name, $classname);
                        if ($setname == $name) {
                            $this->process["parses"][$it]["fields"][$name]["attributes"] = $attributes;
                        } else {
                            $this->process["parses"][$it]["fields"][$setname][$name]["attributes"] = $attributes;
                        }
                        if ($attributes["type"] == "link") {
                            continue;
                        } else {
                            if ($attributes["type"] == "radio" || $attributes["type"] == "checkbox" && $this->isInGroup($attributes["name"])) {
                                $groupname = $attributes["group"];
                                if (!in_array($groupname, $parsedgroups)) {
                                    // Radio and Checkbox groups
                                    $radiogroup = $fieldset->startGroup($attributes["type"], $parse["groups"][$groupname]["attributes"]);
                                    foreach ($parse["groups"][$groupname]["members"] as $key => $member) {
                                        $elem = $this->shiftItem($member);
                                        $this->childToAttribute($elem, $it);
                                        $attributes = $elem["attributes"];
                                        $attributes["name"] = $groupname;
                                        $tmp_name = "afExtjsField" . ucfirst($classname);
                                        if ($view == "edit") {
                                            $obj = new $tmp_name($radiogroup, $attributes);
                                        } else {
                                            $this->showAttributes($attributes);
                                            $obj = new afExtjsFieldStatic($radiogroup, $attributes);
                                        }
                                    }
                                    $fieldset->endGroup($radiogroup);
                                    $parsedgroups[] = $groupname;
                                }
                            } else {
                                if ($attributes["type"] == "linkButton" || $attributes["type"] == "button") {
                                    $attributes["url"] = $attributes["action"];
                                    $tmp_name = "afExtjs" . ucfirst($classname);
                                    $obj = new $tmp_name($form, $attributes);
                                } else {
                                    if ($attributes["type"] == "date" || $attributes["type"] == "datetime") {
                                        $classname = "dateTime";
                                        if (!isset($attributes["dateFormat"])) {
                                            $attributes["dateFormat"] = "Y-m-d";
                                        }
                                    }
                                    if ($attributes["type"] == "multicombo" || $attributes["type"] == "doublemulticombo" || $attributes["type"] == "itemSelectorAutoSuggest" || $attributes["type"] == "doubletree") {
                                        switch ($attributes["type"]) {
                                            case "multicombo":
                                                $classname = "multiCombo";
                                                break;
                                            case "doublemulticombo":
                                                $classname = "doubleMultiCombo";
                                                break;
                                            case "doubletree":
                                                $classname = "doubleTree";
                                                break;
                                        }
                                        $attributes["clear"] = true;
                                        if (!isset($attributes["selected"])) {
                                            $attributes["selected"] = array();
                                        } else {
                                            if (!is_array($attributes["selected"]) && $classname != "doubleTree") {
                                                $attributes["selected"] = explode(",", $attributes["selected"]);
                                            }
                                        }
                                    }
                                    if ($attributes["type"] == "textarea" && $attributes["rich"] == "false") {
                                        $attributes["rich"] = false;
                                    }
                                    if ($attributes["type"] != "include") {
                                        $tmp_name = "afExtjsField" . ucfirst($classname);
                                        if ($view == "edit" || $attributes["type"] == "doubletree") {
                                            if ($tmp_name == 'afExtjsFieldCombo') {
                                                $obj = new $tmp_name(isset($columnx) ? $columnx : $form, $attributes, $data);
                                            } else {
                                                $obj = new $tmp_name(isset($columnx) ? $columnx : $form, $attributes);
                                            }
                                            /*
                                            if(isset($attributes["window"])) {
                                            	//$obj = new afExtjsFieldCombo($fieldset,array('name'=>'my_combo_button','label'=>'My combo button','help'=>"combo box with button",'comment'=>'comment for combo w button','options'=>array('a'=>'Value A','b'=>'Value B'),'selected'=>'b','button'=>array('text'=>'Trigger','icon'=>'/images/famfamfam/cancel.png'),'window'=>array('title'=>'Window Title','component'=>$this->getForm(),'className'=>'ServerPeer','methodName'=>'getAllAsOptions')));
                                            	//$columnx = $columns->startColumn(array('columnWidth'=>5,'labelAlign'=> 'left'));
                                            	//$obj = new afExtjsFieldCombo($columnx,array('name'=>'my_combo_button','label'=>'My combo button','help'=>"combo box with button",'comment'=>'comment for combo w button','options'=>array('a'=>'Value A','b'=>'Value B'),'selected'=>'b','button'=>array('text'=>'Trigger','icon'=>'/images/famfamfam/cancel.png'),'window'=>array('title'=>'Window Title','component'=>$this->getForm(),'className'=>'ServerPeer','methodName'=>'getAllAsOptions')));
                                            	//$obj = new afExtjsFieldCombo($columnx,$attributes);							
                                            } else {
                                            	
                                            	;	
                                            
                                            }
                                            */
                                        } else {
                                            if ($attributes["type"] != "file") {
                                                $this->showAttributes($attributes);
                                                $obj = new afExtjsFieldStatic(isset($columnx) ? $columnx : $form, $attributes);
                                            }
                                        }
                                    } else {
                                        $prs = new XmlParser(self::PANEL, false, false, false, false, $attributes["url"]);
                                        if (isset($columnx)) {
                                            $columnx->addMember($prs->getResult());
                                        } else {
                                            $form->addMember($prs->getResult());
                                        }
                                    }
                                }
                            }
                        }
                        if ($parse["isgrouped"]) {
                            $columns->endColumn($columnx);
                        }
                        if (isset($attributes["break"]) && $attributes["break"] == "true") {
                            $attrs["columnWidth"] = 1;
                            $columnx = $columns->startColumn($attrs);
                            $columns->endColumn($columnx);
                            $this->is_floated[] = $this->isFloatedSet($set, Util::arraySum($this->is_floated));
                            if (!$this->is_floated[sizeof($this->is_floated) - 1]) {
                                $this->is_floated[sizeof($this->is_floated) - 1] = 1;
                            }
                            $attrs["columnWidth"] = sprintf("%1.2f", (double) 1 / $this->is_floated[sizeof($this->is_floated) - 1]);
                        }
                    }
                    if ($parse["isgrouped"]) {
                        $fieldset->endColumns($columns);
                        if (isset($tabx)) {
                            $tabx->endFieldSet($fieldset);
                            $tabs->endTab($tabx);
                        } else {
                            $form->endFieldSet($fieldset);
                        }
                    } else {
                        break;
                    }
                }
                if ($view == "edit") {
                    if ($this->type !== self::WIZARD && $parse["submit"] !== "false") {
                        if (!$this->multisubmit) {
                            $form_params = null;
                            if (isset($parse["redirect"])) {
                                if ($parse["redirect"]) {
                                    $form_params = array("redirect" => $parse["redirect"], "message" => "");
                                }
                            }
                            $obj = new afExtjsSubmitButton($form, array("action" => $formoptions["action"], "label" => $parse["submitlabel"], "params" => $form_params));
                        } else {
                            $this->formaction = $formoptions["action"];
                        }
                        if ((!isset($parse['isSetting']) || $parse['isSetting'] === "false") && $parse["resetable"] !== "false") {
                            $obj = new afExtjsResetButton($form, array("action" => $formoptions["action"], "text" => $parse["resetlabel"]));
                        }
                    }
                }
                if (isset($parse["actions"]) && $this->type !== self::WIZARD) {
                    foreach ($parse["actions"] as $aname => $action) {
                        if (!self::toggleAction($aname, $action)) {
                            continue;
                        }
                        if (array_key_exists("handlers", $action)) {
                            ExtEvent::attachAll($action);
                        }
                        $action["attributes"]["label"] = ucfirst($action["attributes"]["name"]);
                        $action["attributes"]["name"] = $this->view . $this->iteration . "_" . $action["attributes"]["name"];
                        $action["attributes"]["url"] = url_for($action["attributes"]["url"]);
                        //$temp_grid = new afExtjsGrid();
                        //$params = $temp_grid->getListenerParams($action,"action");
                        // TODO:foo
                        if ($action["attributes"]["post"] === "true") {
                            $this->prepareButton($form, $action['attributes']);
                        } else {
                            if ($action["attributes"]["updater"] === "true") {
                                $updater = new afExtjsUpdater(array('url' => $action["attributes"]["url"], 'width' => 500));
                                $action["attributes"]["handlers"]["click"] = array('parameters' => 'field,event', 'source' => $updater->privateName . '.start();');
                                $obj = new afExtjsButton($form, $action['attributes']);
                            } else {
                                $obj = $this->prepareButton($form, $action['attributes']);
                            }
                        }
                    }
                }
                if (isset($parse["moreactions"]) && $this->type !== self::WIZARD) {
                    foreach ($parse["moreactions"] as $aname => $action) {
                        if (!self::toggleAction($aname, $action)) {
                            continue;
                        }
                        if (isset($action["handlers"])) {
                            ExtEvent::attachAll($action);
                        }
                        $parameterForButton = ExtEvent::getButtonParams($action, "moreactions", $this->view . $this->iteration, $parse["select"]);
                        $form->addMenuActionsItem($parameterForButton);
                    }
                }
                if (isset($tabs)) {
                    $form->endTabs($tabs);
                }
                if (array_key_exists("scripts", $parse)) {
                    $form->addScripts($parse["scripts"]);
                }
                if (!$this->multisubmit) {
                    $form->end();
                }
                $this->forms[] = $form;
                if ($this->type == self::PAGE && $current_area["attributes"]["type"] == "content") {
                    $this->addPortal($form, $parse["module"] . "/" . $parse["component"]);
                }
                if ($build) {
                    $this->result = $form;
                    return $form;
                }
                if (!$this->multi) {
                    $this->layout->addItem($this->area_types[$current_area], $form);
                    if ($this->area_types[$current_area] == "center") {
                        $this->layout->addCenterComponent($tools, array('title' => $parse["title"] . (class_exists('afExtjsWidgetConfig') ? afExtjsWidgetConfig::getPostfixTitle() : ''), "idxml" => $this->panelIdXml));
                    }
                } else {
                    if ($current_area["attributes"]["type"] == "content") {
                        if ($this->type != self::PAGE) {
                            $panel->addItem($form);
                        }
                    } else {
                        $this->layout->addItem($this->area_types[$current_area["attributes"]["type"]], $form);
                    }
                }
            } else {
                if ($view == "html") {
                    if (!isset($parse["options"])) {
                        $parse["options"]["autoScroll"] = true;
                        $parse["options"]["border"] = false;
                        $parse["options"]["header"] = true;
                        $parse["options"]["autoHeight"] = true;
                        $parse["options"]["autoEnd"] = false;
                    }
                    $plugins = afExtjsWidgets::getReloadPlugin($parse);
                    if ($this->multi) {
                        if (isset($action_name)) {
                            $idxml = $parse["module"] . "/" . $action_name;
                        } else {
                            $idxml = false;
                        }
                        $pn = new afExtjsPanel(array('plugins' => $plugins, 'title' => $parse["title"], 'autoScroll' => $parse["options"]["autoScroll"], 'border' => $parse["options"]["border"], 'header' => $parse["options"]["header"], 'style' => '', 'autoHeight' => $parse["options"]["autoHeight"], 'autoEnd' => $parse["options"]["autoEnd"], 'portal' => true, 'tools' => $tools, 'idxml' => $idxml));
                        if (isset($parse["description"])) {
                            $html = $parse["description"];
                            if ($this->widgetHelpSettings->getWidgetHelpIsEnabled()) {
                                $pn->addHelp($html);
                            }
                        }
                        $pn->addMember(self::defineHtmlComponent($parse['params']));
                        /*if(isset($parse["actions"])) {
                        	
                        			foreach($parse["actions"] as $aname => $action) {
                        				
                        				if(!self::toggleAction($aname,$action)) {
                        					continue;
                        				}
                        				
                        				if(isset($action["handlers"])) {
                        					ExtEvent::attachAll($action);
                        				}
                        				
                        				$parameterForButton = ExtEvent::getButtonParams($action,"actions",$this->view.$this->iteration,$parse["select"]);			
                        				$obj = new afExtjsButton($pn,$parameterForButton);
                        			}
                        		}*/
                        if (isset($parse["moreactions"])) {
                            foreach ($parse["moreactions"] as $aname => $action) {
                                if (!self::toggleAction($aname, $action)) {
                                    continue;
                                }
                                if (isset($action["handlers"])) {
                                    ExtEvent::attachAll($action);
                                }
                                $parameterForButton = ExtEvent::getButtonParams($action, "moreactions", $this->view . $this->iteration, false);
                                $pn->addMenuActionsItem($parameterForButton);
                            }
                        }
                        $pn->end();
                        if ($this->type != self::PAGE) {
                            $panel->addItem($pn);
                        }
                        if ($build) {
                            $this->result = $pn;
                            return $pn;
                        }
                        //radu
                        if ($this->type == self::PAGE && $current_area["attributes"]["type"] == "content") {
                            $this->addPortal($pn, $parse["module"] . "/" . $action_name);
                        }
                    } else {
                        $pn = new afExtjsPanel(array('plugins' => $plugins, 'title' => $parse["title"], 'autoScroll' => $parse["options"]["autoScroll"], 'border' => $parse["options"]["border"], 'header' => $parse["options"]["header"], 'style' => '', 'autoHeight' => $parse["options"]["autoHeight"], 'autoEnd' => $parse["options"]["autoEnd"], 'portal' => true));
                        $pn->addMember(self::defineHtmlComponent($parse['params']));
                        /*if(isset($parse["actions"])) {
                        	
                        			foreach($parse["actions"] as $aname => $action) {
                        				
                        				if(!self::toggleAction($aname,$action)) {
                        					continue;
                        				}
                        				
                        				if(isset($action["handlers"])) {
                        					ExtEvent::attachAll($action);
                        				}
                        				
                        				$parameterForButton = ExtEvent::getButtonParams($action,"actions",$this->view.$this->iteration,false);			
                        				$obj = new afExtjsButton($pn,$parameterForButton);
                        			}
                        		}
                        		*/
                        if (isset($parse["moreactions"])) {
                            foreach ($parse["moreactions"] as $aname => $action) {
                                if (!self::toggleAction($aname, $action)) {
                                    continue;
                                }
                                if (isset($action["handlers"])) {
                                    ExtEvent::attachAll($action);
                                }
                                $parameterForButton = ExtEvent::getButtonParams($action, "moreactions", $this->view . $this->iteration, false);
                                $pn->addMenuActionsItem($parameterForButton);
                            }
                        }
                        $pn->end();
                        if ($build) {
                            $this->result = $pn;
                            return $pn;
                        }
                        $this->layout->addItem("center", $pn);
                        $this->layout->addCenterComponent($tools, array('title' => $parse["title"] . (class_exists('afExtjsWidgetConfig') ? afExtjsWidgetConfig::getPostfixTitle() : ''), "idxml" => $this->panelIdXml));
                    }
                } else {
                    if ($view == "info") {
                        $form = new afExtjsForm($formoptions);
                        if (isset($parse["settitle"])) {
                            $legend = $parse["settitle"];
                        } else {
                            $legend = "Default";
                        }
                        $attributes = array("legend" => $legend, "collapsed" => false);
                        $fieldset = $form->startFieldSet($attributes);
                        if (isset($parse["actions"])) {
                            foreach ($parse["actions"] as $aname => $action) {
                                if (!self::toggleAction($aname, $action)) {
                                    continue;
                                }
                                $action["attributes"]["label"] = ucfirst($action["attributes"]["name"]);
                                $action["attributes"]["name"] = $this->view . $this->iteration . "_" . $action["attributes"]["name"];
                                $action["attributes"]["url"] = url_for($action["attributes"]["url"]);
                                $obj = $this->prepareButton($form, $action['attributes']);
                            }
                        }
                        $attributes = array('name' => 'msg', 'label' => 'Message:', 'value' => $parse["message"], 'comment' => '', 'submitValue' => false);
                        $obj = new afExtjsFieldStatic($fieldset, $attributes);
                        $form->endFieldSet($fieldset);
                        $form->end();
                        if ($build) {
                            return $form;
                        }
                        if (!$this->multi) {
                            $this->layout->addItem('center', $form);
                            $this->layout->addCenterComponent($tools, array('title' => $parse["title"] . (class_exists('afExtjsWidgetConfig') ? afExtjsWidgetConfig::getPostfixTitle() : '')));
                        } else {
                            if ($this->type != self::PAGE) {
                                $panel->addItem($form);
                            } else {
                                if ($current_area["attributes"]["type"] == "content") {
                                    $this->addPortal($form, $parse["module"] . "/" . $action_name);
                                }
                            }
                        }
                    } else {
                        if ($view == "list") {
                            if (isset($parse["params"]["name"])) {
                                $formoptions['name'] = $parse["params"]["name"];
                            }
                            if (isset($parse["remoteSort"])) {
                                $formoptions["remoteSort"] = $parse["remoteSort"] == "false" ? false : true;
                            }
                            if (isset($parse["pagerTemplate"])) {
                                $formoptions["pagerTemplate"] = $parse["pagerTemplate"];
                            }
                            if (isset($this->page) && is_array($this->page)) {
                                foreach ($this->page["areas"]["content"]["tabs"] as $thisTab) {
                                    if (isset($thisTab["components"][$parse["component"]]) && isset($thisTab["components"][$parse["component"]]["bindForm"])) {
                                        $formoptions["bindForm"] = $thisTab["components"][$parse["component"]]["bindForm"];
                                    }
                                }
                            }
                            if (!isset($formoptions["bindForm"])) {
                                $formoptions["bindForm"] = -1;
                            }
                            $formoptions["autoHeight"] = true;
                            $formoptions["clearGrouping"] = false;
                            $formoptions["frame"] = false;
                            $formoptions["tree"] = $parse["tree"] == "false" ? false : true;
                            $formoptions["select"] = $parse["select"] == "false" ? false : true;
                            $formoptions["pager"] = $parse["pager"] == "false" ? false : true;
                            $formoptions["border"] = $parse["border"] == "false" ? false : true;
                            $formoptions["portal"] = $parse["portal"] == "false" ? false : true;
                            //$formoptions["id"] = strtolower(str_replace(" ","_",$parse['title']));
                            $formoptions["remoteLoad"] = ArrayUtil::isTrue($parse, 'remoteLoad');
                            $formoptions["remoteFilter"] = isset($parse['remoteFilter']) ? true : false;
                            $formoptions["expandButton"] = isset($parse['expandButton']) ? true : false;
                            $formoptions["path"] = $this->context->getModuleName() . "/" . $this->context->getActionName();
                            if ($parse['action'] != '') {
                                $formoptions['action'] = $parse['action'];
                            }
                            if ($this->type == self::PAGE) {
                                $formoptions["idxml"] = $parse["module"] . "/" . $action_name;
                            }
                            if (isset($parse["plugin"])) {
                                $formoptions["plugin"] = $parse["plugin"];
                            }
                            if (isset($parse["iconCls"])) {
                                $formoptions["iconCls"] = $parse["iconCls"];
                            }
                            if (isset($parse["bodyStyle"])) {
                                $formoptions["bodyStyle"] = $parse["bodyStyle"];
                            }
                            if (is_array($current_area) && $this->area_types[$current_area["attributes"]["type"]] == "south" || $current_area == "footer") {
                                $formoptions["title"] = "";
                            }
                            if (!isset($formoptions["title"])) {
                                if ($current_area == "footer") {
                                    $formoptions["title"] = " ";
                                } else {
                                    if (isset($parse["title"])) {
                                        $formoptions["title"] = $parse["title"];
                                    }
                                }
                            }
                            if ($formoptions["tree"]) {
                                $formoptions["root_title"] = isset($parse["title"]) ? $parse["title"] : "root";
                            }
                            if (is_array($current_area) && $this->area_types[$current_area["attributes"]["type"]] == "west" || $current_area == "sidebar") {
                                $formoptions["tools"] = null;
                            }
                            $formoptions['datasource'] = $parse['datasource'];
                            // Add the select fields in grid if it has moreactions..............
                            if (isset($parse["moreactions"])) {
                                $formoptions['select'] = "true";
                            }
                            //..................................................................
                            $formoptions['plugins'][] = afExtjsWidgets::getReloadPlugin($parse);
                            $grid = new afExtjsGrid($formoptions);
                            if (!$build && $widgetHelp) {
                                if ($this->multi) {
                                    $grid->addHelp($parse["description"]);
                                }
                            }
                            foreach ($parse["fields"] as $colname => $column) {
                                unset($column["attributes"]["id"]);
                                $column["attributes"]["hidden"] = ArrayUtil::isTrue($column['attributes'], 'hidden');
                                if (isset($column["attributes"]["qtip"]) && $column["attributes"]["qtip"] == "false") {
                                    $column["attributes"]["qtip"] = false;
                                }
                                $grid->addColumn($column["attributes"]);
                            }
                            $grid->setProxy(self::getProxyAttributes($parse));
                            if (isset($parse["rowactions"])) {
                                $actions = $grid->startRowActions(array('header' => 'Actions'));
                                $cnt = 1;
                                foreach ($parse["rowactions"] as $action_name => $action) {
                                    self::addConfirmation($action_name, $action['attributes']);
                                    self::fillTooltip($action["attributes"]);
                                    if (isset($parse["form"]) && $action["attributes"]["url"] === "/#") {
                                        $parse["rowactions"][$action_name]["attributes"]["url"] = $parse["form"] . "#";
                                    }
                                    if (isset($action["attributes"]["condition"])) {
                                        $parse["conditions"]["rowaction" . $cnt] = $action["attributes"]["condition"];
                                    }
                                    $parameterForRowAction = ExtEvent::getButtonParams($action, "rowactions", $this->view . $this->iteration, $parse["select"], $grid);
                                    $actions->addAction($action["attributes"]);
                                    $cnt++;
                                }
                                $grid->endRowActions($actions);
                            }
                            /**
                             * ticket 1140
                             */
                            //Check for more actions....................................................
                            $export_config = sfConfig::get('app_parser_export');
                            if (isset($export_config["enabled"]) && $export_config["enabled"] === true && $parse["exportable"] == "true") {
                                $exportConfig = array();
                                if (isset($parse["pager"]) && $parse["pager"] === "true") {
                                    //$grid->addMenuActionsItem(array('label'=>'Export Page as CSV', 'icon'=>'/images/famfamfam/database_save.png','listeners'=>array('click'=> array('parameters'=>'','source'=>'window.location.href='.$grid->getFileExportJsUrl('page')))));
                                    $exportConfig['csv']['current'] = 'window.location.href=' . $grid->getFileExportJsUrl('page');
                                }
                                if ($parse["tree"] === "false") {
                                    $confirmFunction = '
								Ext.Msg.show({
								   title:"Confirmation Required",
								   msg: "Are you sure you want export ' . sfConfig::get("app_parser_max_items") . ' items? This may take a while..",
								   buttons: Ext.Msg.YESNO,
								   fn: function(buttonId){if(buttonId == "yes"){' . 'window.location.href=' . $grid->getFileExportJsUrl('all') . '}},
								   icon: Ext.MessageBox.QUESTION								   
								});
							';
                                    //$grid->addMenuActionsItem(array('label'=>'Export first '.sfConfig::get("app_parser_max_items").' rows as CSV', 'confirmMsg' => 'foo', 'icon'=>'/images/famfamfam/database_save.png','listeners'=>array('click'=> array('parameters'=>'','source'=>$confirmFunction))));
                                    $exportConfig['csv']['firstx'] = $confirmFunction;
                                }
                                if ($formoptions["select"]) {
                                    $noItemsSelectedFunction = '								
							if(!' . $grid->privateName . '.getSelectionModel().getCount()){
								Ext.Msg.alert("No items selected","Please select at least one item");
								return;
							}
						';
                                    if (!ArrayUtil::isTrue($parse, 'remoteLoad')) {
                                        /*$grid->addMenuActionsItem(array('label'=>'Export Selected as CSV', 'forceSelection' => "true",
                                        		'icon'=>'/images/famfamfam/database_save.png','listeners'=>array('click'=> array('parameters'=>'','source'=>
                                        		"frm = document.createElement('form'); field = document.createElement('input'); field.setAttribute('type','hidden'); field.setAttribute('name','selections'); field.value = ".
                                        		$grid->privateName.".getSelectionModel().getSelectionsJSON(); frm.appendChild(field); frm.action = ".$grid->getFileExportJsUrl('selected')."+'&_csrf_token=".$this->context->getRequest()->getAttribute("_csrf_token")."'; frm.method='POST'; frm.name='frm1'; document.body.appendChild(frm); ".$noItemsSelectedFunction." frm.submit();"))));*/
                                        $exportConfig['csv']['selected'] = "frm = document.createElement('form'); field = document.createElement('input'); field.setAttribute('type','hidden'); field.setAttribute('name','selections'); field.value = " . $grid->privateName . ".getSelectionModel().getSelectionsJSON(); frm.appendChild(field); frm.action = " . $grid->getFileExportJsUrl('selected') . "+'&_csrf_token=" . $this->context->getRequest()->getAttribute("_csrf_token") . "'; frm.method='POST'; frm.name='frm1'; document.body.appendChild(frm); " . $noItemsSelectedFunction . " frm.submit();";
                                    }
                                }
                                /** sample example of other format type					
                                				$exportConfig['pdf']['current'] = 'handler source';
                                				$exportConfig['pdf']['selected'] = '';
                                				$exportConfig['xml']['current'] = '';
                                				$exportConfig['xml']['selected'] = '';
                                				$exportConfig['xml']['firstx'] = '';					
                                				*/
                                $grid->addMenuActionsExportButton($exportConfig);
                            }
                            if (isset($parse["moreactions"])) {
                                $parse["select"] = "true";
                                $items = array();
                                foreach ($parse["moreactions"] as $aname => $action) {
                                    if (!self::toggleAction($aname, $action)) {
                                        continue;
                                    }
                                    if (isset($action["handlers"])) {
                                        ExtEvent::attachAll($action);
                                    }
                                    $parameterForButton = ExtEvent::getButtonParams($action, "moreactions", $this->view . $this->iteration, $parse["select"], $grid);
                                    $grid->addMenuActionsItem($parameterForButton);
                                }
                            }
                            //More actions End............................................................
                            //...........................................................................
                            if (isset($parse["actions"])) {
                                foreach ($parse["actions"] as $aname => $action) {
                                    if (!self::toggleAction($aname, $action)) {
                                        continue;
                                    }
                                    if (isset($action["handlers"])) {
                                        ExtEvent::attachAll($action);
                                    }
                                    $parameterForButton = ExtEvent::getButtonParams($action, "actions", $this->view . $this->iteration, $parse["select"], $grid);
                                    $obj = new afExtjsButton($grid, $parameterForButton);
                                }
                            }
                            if ($parse["select"] != "false") {
                                $post_url = $parse["action"] != "false" && $parse["action"] != "n/a" ? "/" . $parse["action"] : "/" . $this->context->getModuleName() . "/" . $this->context->getActionName();
                                if ($parse["action"] != "false" && $parse["action"] != "n/a") {
                                    if (!$this->multisubmit) {
                                        new afExtjsButton($grid, array('label' => $parse["label"], 'icon' => $parse["icon"], 'handlers' => array('click' => array('parameters' => 'field,event', 'source' => 'Ext.Ajax.request({ url: "' . $post_url . '", 
							method:"post", params:{"selections":' . $grid->privateName . '.getSelectionModel().getSelectionsJSON()}, success:function(response, options){response=Ext.decode(response.responseText);if(response.message){Ext.Msg.alert("Success",response.message,function(){if(response.redirect){afApp.loadCenterWidget(response.redirect);}});}},failure: function(response,options) {if(response.message){Ext.Msg.alert("Failure",response.message);}}});'))));
                                    }
                                }
                            }
                            // Printing for grids..
                            $grid->updateTools($tools->addItem(array('id' => 'print', 'qtip' => "Printer friendly version", 'handler' => array('parameters' => 'e,target,panel', 'source' => "window.open(" . $grid->getFileExportJsUrl('page', 'pdf') . "+'&" . $this->getQueryString() . "','print');")), "item"));
                            // Add extra scripts..
                            if (array_key_exists("scripts", $parse)) {
                                $grid->addScripts($parse["scripts"]);
                            }
                            $grid->end();
                            if ($this->type == self::PAGE && $current_area["attributes"]["type"] == "content") {
                                $this->addPortal($grid, $parse["module"] . "/" . $parse["component"]);
                            }
                            if (is_array($current_area) && $this->area_types[$current_area["attributes"]["type"]] == "center") {
                                $this->multigrid = $grid;
                            }
                            if ($build === false) {
                                if (!$this->multi) {
                                    $this->layout->addItem($this->area_types[$current_area], $grid);
                                    if ($this->area_types[$current_area] == "center") {
                                        $this->layout->addCenterComponent($tools, array('title' => $parse["title"] . (class_exists('afExtjsWidgetConfig') ? afExtjsWidgetConfig::getPostfixTitle() : ''), "idxml" => $this->panelIdXml));
                                    }
                                } else {
                                    if ($current_area["attributes"]["type"] == "content") {
                                        if ($this->type != self::PAGE) {
                                            $panel->addItem($grid);
                                        }
                                    } else {
                                        $this->layout->addItem($this->area_types[$current_area["attributes"]["type"]], $grid);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if ($this->tabbedWizard) {
                switch ($view) {
                    case "show":
                    case "edit":
                    case "info":
                        $obj = $form;
                        break;
                    case "list":
                        $obj = $grid;
                        break;
                    case "html":
                        $obj = $pn;
                        break;
                }
                $wiztab = $this->getTabData($parse["component_name"]);
                $wizard_group->addItem($obj, array("title" => $wiztab[1], "tabTip" => $wiztab[2], "iconCls" => ""));
                if ($this->isLastGroupMember($parse["component_name"])) {
                    $this->openGroup = false;
                    $this->layout->endGroup($wizard_group);
                }
            }
        }
        if ($this->multi) {
            if ($this->type === self::WIZARD && !$this->tabbedWizard) {
                $this->layout->endColumn($panel);
            }
        }
        if ($this->multisubmit && $this->type !== self::WIZARD) {
            new afExtjsSubmitButton($this->forms[0], array('action' => $this->formaction, "label" => $parse["submitlabel"], 'afterSuccess' => '
				var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Saving additional information... <br>Please wait..."});
				myMask.show();
				Ext.Ajax.request({ url: "' . $this->multisubmit . '", method:"post", params:{"selections":' . $this->multigrid->privateName . '.getSelectionModel().getSelectionsJSON()}, success:function(response, options){response=Ext.decode(response.responseText);
if(response.message) {
	Ext.Msg.alert("Success", response.message, function(){
		if(response.redirect) {
			afApp.loadCenterWidget(response.redirect);
		}
	});
} else {
	if(response.redirect) {
		afApp.loadCenterWidget(response.redirect);
	}
}
	  	myMask.hide();
	  	},failure: function(response,options) {if(response.message){Ext.Msg.alert("Failure",response.message);myMask.hide();}}});'));
            $form->end();
        }
        // Adding layout buttons
        if ($this->type == self::WIZARD) {
            $actions = array("Previous" => 1, "Next" => 1, "Cancel" => 0, "Add new" => 1, "Finish" => 1);
            $add = "false";
            $finish = false;
            foreach ($actions as $key => $value) {
                if (isset($this->attribute_holder["last"]) && $key == "Next") {
                    continue;
                }
                if ($key == "Finish" && isset($this->page["actions"][$key])) {
                    $finish = true;
                }
                if ($key == "Add new" && isset($this->page["actions"][$key])) {
                    $add = "true";
                }
                if ($key == "Next") {
                    $icon = "/images/famfamfam/arrow_right.png";
                } else {
                    if ($key == "Previous") {
                        $icon = "/images/famfamfam/arrow_left.png";
                    } else {
                        $icon = "/images/famfamfam/accept.png";
                    }
                }
                if (isset($this->page["actions"][$key])) {
                    /*
                     * Find if grid data save request
                     */
                    $preExecute = '';
                    //$file = 'appFlowerPlugin/js/custom/'.self::isRequest($this->page["actions"][$key]["attributes"]["url"],'js').".js";
                    $file = '';
                    if (isset($this->page["actions"][$key]["attributes"]["script"])) {
                        if (file_exists(sfConfig::get('sf_root_dir') . "/plugins/appFlowerPlugin/web/js/custom/" . $this->page["actions"][$key]["attributes"]["script"] . ".js")) {
                            $file = 'appFlowerPlugin/js/custom/' . $this->page["actions"][$key]["attributes"]["script"] . ".js";
                        } else {
                            $file = '/js/custom/' . $this->page["actions"][$key]["attributes"]["script"] . ".js";
                        }
                    }
                    $preExecute = $file;
                    if ($this->page["actions"][$key]["attributes"]["post"] === "false" || !$value) {
                        new afExtjsLinkButton($this->layout, array('preExecute' => $preExecute, 'label' => $key, 'loadas' => 'page', 'url' => $this->page["actions"][$key]["attributes"]["url"], 'icon' => isset($icon) ? $icon : $this->page["actions"][$key]["attributes"]["icon"]));
                    } else {
                        $wizardSubmit = ArrayUtil::get($parse, 'params', 'wizard_submit', 'true') === 'true';
                        new afExtjsSubmitButton($this->layout, array('wizard' => $wizardSubmit, 'preExecute' => $preExecute, 'label' => $key, 'icon' => isset($icon) ? $icon : "/images/famfamfam/accept.png", 'action' => $this->page["actions"][$key]["attributes"]["url"]), $this->forms[0]);
                    }
                }
            }
            if (!$finish && isset($this->attribute_holder["last"])) {
                $id = '';
                if (isset($this->attribute_holder["id"])) {
                    $id = $this->attribute_holder["id"];
                }
                new afExtjsSubmitButton($this->layout, array('wizard' => true, 'label' => 'Finish', 'action' => "/wizard/finalize?last=" . $this->current . "&end=" . urlencode($this->attribute_holder['end']) . "&id=" . $id . "&add=" . $add), $this->forms[0]);
            }
        }
        if ($this->type == self::PAGE) {
            if ($this->portalStateObj->getLayoutType() == afPortalStatePeer::TYPE_TABBED) {
                $content = $this->portalStateObj->getContent();
                foreach ($content as $item => $itemDetails) {
                    $portalLayoutType = $this->portalStateObj->getPortalLayoutType($item);
                    $portalColumns = $this->portalStateObj->getColumns($item);
                    $portalColumnsSize = $this->portalStateObj->getColumnsSize($item);
                    ${'tab' . $item} = $this->layout->startTab(array('title' => isset($itemDetails["tabTitle"]) ? $itemDetails["tabTitle"] : $itemDetails["portalTitle"], 'portalLayoutType' => $portalLayoutType, 'portalWidgets' => $this->filterWidgets($item, $content, $this->widgets)));
                    foreach ($portalColumns as $k => $widgets) {
                        //instanciate a column
                        ${'column' . $k} = ${'tab' . $item}->startColumn(array('columnWidth' => $portalColumnsSize[$k] / 100));
                        foreach ($widgets as $widget) {
                            if (isset($this->extobjects[$widget->idxml])) {
                                ${'column' . $k}->addItem($this->extobjects[$widget->idxml]);
                            }
                        }
                        //end the instanciation of a column
                        ${'tab' . $item}->endColumn(${'column' . $k});
                    }
                    $this->layout->endTab(${'tab' . $item});
                }
            } else {
                foreach ($this->portalColumns as $k => $widgets) {
                    //instanciate a column
                    ${'column' . $k} = $this->layout->startColumn(array('columnWidth' => $this->portalColumnsSize[$k] / 100));
                    foreach ($widgets as $widget) {
                        if (isset($this->extobjects[$widget->idxml])) {
                            ${'column' . $k}->addItem($this->extobjects[$widget->idxml]);
                        }
                    }
                    //end the instanciation of a column
                    $this->layout->endColumn(${'column' . $k});
                }
            }
        }
        if ($this->multi) {
            self::$instance = null;
        }
        if ($build) {
            $this->result = $grid;
        }
        $layout_items = afExtjs::getInstance()->private;
        if (is_array($layout_items)) {
            $gridNames = $formIds = array();
            foreach ($layout_items as $privateName => $it) {
                if (preg_match("/bindForm: ([0-9]+),/", $it, $match)) {
                    $gridNames[$privateName] = trim($match[1]);
                }
                if (preg_match("/^form_[0-9a-zA-Z]+\$/", $privateName)) {
                    $formIds[] = $privateName;
                }
            }
            foreach ($gridNames as $privateName => $fid) {
                if (isset($formIds[$fid])) {
                    $layout_items[$privateName] = str_replace("bindForm: " . $fid . ",", "bindForm: '" . $formIds[$fid] . "',", $layout_items[$privateName]);
                }
            }
            afExtjs::$instance->private = $layout_items;
        }
        return true;
    }
Пример #7
0
include_title();
?>
</head>

<body style="background-image: url(/appFlowerStudioPlugin/images/bg/backgrond_3.2.2.jpg);background-position: 50% 50%;background-repeat: no-repeat;">
    <!-- Page Frame -->
    
    <script type="text/javascript" src="/appFlowerStudioPlugin/js/afStudio.js"></script> 
    <script type="text/javascript" src="/appFlowerStudioPlugin/js/components/users/afStudio.UserWindow.js"></script>
    
<?php 
$layout = new afExtjsSfGuardLayout();
/**
 * EXTJS SIGN IN FORM
 */
$form = new afExtjsForm(array('action' => '/afsAuthorize/signin', "columnWidth" => ".88"));
$fieldset = $form->startFieldset(array('legend' => 'Login', 'collapsible' => 'false'));
$columns = $fieldset->startColumns(array("columnWidth" => 1));
$col = $columns->startColumn(array("columnWidth" => 1));
$username = new afExtjsFieldInput($col, array('name' => 'signin[username]', 'label' => 'Username', 'value' => '', 'help' => "Enter the username", 'width' => '150'));
$password = new afExtjsFieldPassword($col, array('name' => 'signin[password]', 'label' => 'Password', 'value' => '', 'help' => "Enter the password", 'width' => '150'));
$captchaEnabled = in_array('sfCaptchaPlugin', sfProjectConfiguration::getActive()->getPlugins());
$remember = new afExtjsFieldCheckbox($col, array('name' => 'signin[remember]', 'label' => 'Remember', 'checked' => true));
$columns->endColumn($col);
$fieldset->endColumns($columns);
$form->endFieldset($fieldset);
new afExtjsSubmitButton($form, array('action' => '/afsAuthorize/signin'));
new afExtjsLinkButton($form, array('url' => url_for('/afsAuthorize/passwordRequest'), 'load' => 'page', 'label' => 'Forgot your password?', 'icon' => '/appFlowerStudioPlugin/images/email_go.png'));
$form->end();
$layout->addItem('center', array("columnWidth" => ".12", "frame" => false, "height" => 167, "html" => "<a href='http://www.appflower.com'><img src='/appFlowerPlugin/images/vertical_logo.png'></a>"));
$layout->addItem('center', $form);