diff --git a/gulliver/bin/tasks/templates/pluginApplication.html.tpl b/gulliver/bin/tasks/templates/pluginApplication.html.tpl new file mode 100644 index 000000000..1e7fb11ca --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginApplication.html.tpl @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginApplication.js.tpl b/gulliver/bin/tasks/templates/pluginApplication.js.tpl new file mode 100644 index 000000000..375bf32a6 --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginApplication.js.tpl @@ -0,0 +1,248 @@ +Ext.namespace("{className}"); + +{className}.application = { + init:function(){ + storeUserProcess = function (n, r, i) { + var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Load users..."}); + myMask.show(); + + Ext.Ajax.request({ + url: "{className}ApplicationAjax", + method: "POST", + params: {"option": "LST", "pageSize": n, "limit": r, "start": i}, + + success:function (result, request) { + storeUser.loadData(Ext.util.JSON.decode(result.responseText)); + myMask.hide(); + }, + failure:function (result, request) { + myMask.hide(); + Ext.MessageBox.alert("Alert", "Failure users load"); + } + }); + }; + + onMnuContext = function(grid, rowIndex,e) { + e.stopEvent(); + var coords = e.getXY(); + mnuContext.showAt([coords[0], coords[1]]); + }; + + //Variables declared in html file + var pageSize = parseInt(CONFIG.pageSize); + var message = CONFIG.message; + + //stores + var storeUser = new Ext.data.Store({ + proxy:new Ext.data.HttpProxy({ + url: "{className}ApplicationAjax", + method: "POST" + }), + + //baseParams: {"option": "LST", "pageSize": pageSize}, + + reader:new Ext.data.JsonReader({ + root: "resultRoot", + totalProperty: "resultTotal", + fields: [{name: "ID"}, + {name: "NAME"}, + {name: "AGE"}, + {name: "BALANCE"} + ] + }), + + //autoLoad: true, //First call + + listeners:{ + beforeload:function (store) { + this.baseParams = {"option": "LST", "pageSize": pageSize}; + } + } + }); + + var storePageSize = new Ext.data.SimpleStore({ + fields: ["size"], + data: [["15"], ["25"], ["35"], ["50"], ["100"]], + autoLoad: true + }); + + // + var btnNew = new Ext.Action({ + id: "btnNew", + + text: "New", + iconCls: "button_menu_ext ss_sprite ss_add", + + handler: function() { + Ext.MessageBox.alert("Alert", message); + } + }); + + var btnEdit = new Ext.Action({ + id: "btnEdit", + + text: "Edit", + iconCls: "button_menu_ext ss_sprite ss_pencil", + disabled: true, + + handler: function() { + Ext.MessageBox.alert("Alert", message); + } + }); + + var btnDelete = new Ext.Action({ + id: "btnDelete", + + text: "Delete", + iconCls: "button_menu_ext ss_sprite ss_delete", + disabled: true, + + handler: function() { + Ext.MessageBox.alert("Alert", message); + } + }); + + var btnSearch = new Ext.Action({ + id: "btnSearch", + + text: "Search", + + handler: function() { + Ext.MessageBox.alert("Alert", message); + } + }); + + var mnuContext = new Ext.menu.Menu({ + id: "mnuContext", + + items: [btnEdit, btnDelete] + }); + + var txtSearch = new Ext.form.TextField({ + id: "txtSearch", + + emptyText: "Enter search term", + width: 150, + allowBlank: true, + + listeners:{ + specialkey: function (f, e) { + if (e.getKey() == e.ENTER) { + Ext.MessageBox.alert("Alert", message); + } + } + } + }); + + var btnTextClear = new Ext.Action({ + id: "btnTextClear", + + text: "X", + ctCls: "pm_search_x_button", + handler: function() { + txtSearch.reset(); + } + }); + + var cboPageSize = new Ext.form.ComboBox({ + id: "cboPageSize", + + mode: "local", + triggerAction: "all", + store: storePageSize, + valueField: "size", + displayField: "size", + width: 50, + editable: false, + + listeners:{ + select: function (combo, record, index) { + pageSize = parseInt(record.data["size"]); + + pagingUser.pageSize = pageSize; + pagingUser.moveFirst(); + } + } + }); + + var pagingUser = new Ext.PagingToolbar({ + id: "pagingUser", + + pageSize: pageSize, + store: storeUser, + displayInfo: true, + displayMsg: "Displaying users " + "{" + "0" + "}" + " - " + "{" + "1" + "}" + " of " + "{" + "2" + "}", + emptyMsg: "No roles to display", + items: ["-", "Page size:", cboPageSize] + }); + + var cmodel = new Ext.grid.ColumnModel({ + defaults: { + width:50, + sortable:true + }, + columns:[{id: "ID", dataIndex: "ID", hidden: true}, + {header: "Name", dataIndex: "NAME", align: "left"}, + {header: "Age", dataIndex: "AGE", width: 25, align: "center"}, + {header: "Balance", dataIndex: "BALANCE", width: 25, align: "left"} + ] + }); + + var smodel = new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function (sm) { + btnEdit.enable(); + btnDelete.enable(); + }, + rowdeselect: function (sm) { + btnEdit.disable(); + btnDelete.disable(); + } + } + }); + + var grdpnlUser = new Ext.grid.GridPanel({ + id: "grdpnlUser", + + store: storeUser, + colModel: cmodel, + selModel: smodel, + + columnLines: true, + viewConfig: {forceFit: true}, + enableColumnResize: true, + enableHdMenu: true, //Menu of the column + + tbar: [btnNew, "-", btnEdit, btnDelete, "-", "->", txtSearch, btnTextClear, btnSearch], + bbar: pagingUser, + + style: "margin: 0 auto 0 auto;", + width: 550, + height: 450, + title: "Users", + + renderTo: "divMain", + + listeners:{ + } + }); + + //Initialize events + storeUserProcess(pageSize, pageSize, 0); + + grdpnlUser.on("rowcontextmenu", + function (grid, rowIndex, evt) { + var sm = grid.getSelectionModel(); + sm.selectRow(rowIndex, sm.isSelected(rowIndex)); + }, + this + ); + + grdpnlUser.addListener("rowcontextmenu", onMnuContext, this); + + cboPageSize.setValue(pageSize); + } +} + +Ext.onReady({className}.application.init, {className}.application); \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginApplication.php.tpl b/gulliver/bin/tasks/templates/pluginApplication.php.tpl new file mode 100644 index 000000000..308e10b0a --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginApplication.php.tpl @@ -0,0 +1,33 @@ +addContent("{className}/{className}Application"); //Adding a html file .html + $oHeadPublisher->addExtJsScript("{className}/{className}Application", false); //Adding a javascript file .js + $oHeadPublisher->assign("CONFIG", $config); + + G::RenderPage("publish", "extJs"); +} catch (Exception $e) { + $G_PUBLISH = new Publisher; + + $aMessage["MESSAGE"] = $e->getMessage(); + $G_PUBLISH->AddContent("xmlform", "xmlform", "{className}/messageShow", "", $aMessage); + G::RenderPage("publish", "blank"); +} +?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginApplication2.html.tpl b/gulliver/bin/tasks/templates/pluginApplication2.html.tpl new file mode 100644 index 000000000..1e7fb11ca --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginApplication2.html.tpl @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginApplication2.js.tpl b/gulliver/bin/tasks/templates/pluginApplication2.js.tpl new file mode 100644 index 000000000..a94957b0f --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginApplication2.js.tpl @@ -0,0 +1,270 @@ +Ext.namespace("{className}"); + +{className}.application2 = { + init:function(){ + var storeGraphicType = new Ext.data.ArrayStore({ + idIndex: 0, + fields: ["id", "value"], + data: [["chartcol", "Column Chart"], + ["chartpie", "Pie Chart"], + ["chartlin", "Line Chart"] + ] + }); + + var storeCboAppStatus = new Ext.data.ArrayStore({ + idIndex: 0, + fields: ["id", "value"], + data: [["ALL", "ALL"], + ["DRAFT", "DRAFT"], + ["TO_DO", "TO DO"], + ["COMPLETED", "COMPLETED"] + ] + }); + + var storeCboAppdelStatus = new Ext.data.ArrayStore({ + idIndex: 0, + fields: ["id", "value"], + data: [["ALL", "ALL"], + ["OPEN", "OPEN"], + ["CLOSED", "CLOSED"] + ] + }); + + var storeCboOption = new Ext.data.ArrayStore({ + idIndex:0, + fields: ["id", "value"], + data: [["Y", "Year"], + ["m", "Month"], + ["d", "Day"] + ] + }); + + // + var cboGraphicType = new Ext.form.ComboBox({ + id: "cboGraphicType", + + valueField: "id", + displayField: "value", + value: "chartcol", + store: storeGraphicType, + + triggerAction: "all", + mode: "local", + editable: false, + + width: 150, + fieldLabel: "Graphic Type", + + listeners:{select:function (combo, record, index) { Ext.MessageBox.alert("Alert", "Event select in Ext.form.ComboBox"); }} + }); + + var radiog1 = new Ext.form.RadioGroup({ + id: "radiog1", + + //fieldLabel: "Status", + + items: [{name:"radiog1", inputValue:"1", checked:true, boxLabel:"Status"}, //inputValue works as string + {name:"radiog1", inputValue:"2", boxLabel:"Status Delegation"} + ], + + listeners: { + change:function (r, newValue) { + Ext.getCmp("pnlCboAppStatus").setVisible(false); + Ext.getCmp("pnlCboAppdelStatus").setVisible(false); + + if (newValue.inputValue == 1) { + Ext.getCmp("pnlCboAppStatus").setVisible(true); + } + else { + Ext.getCmp("pnlCboAppdelStatus").setVisible(true); + } + } + } + }); + + var pnlCboAppStatus = new Ext.Panel({ + id: "pnlCboAppStatus", + + border: false, + + items:[ + {xtype: "form", + + labelWidth: 115, + border: false, + + items:[ + {xtype: "combo", + id: "cboAppStatus", + + valueField: "id", + displayField:"value", + value: "ALL", + store: storeCboAppStatus, + + triggerAction: "all", + mode: "local", + editable: false, + + width: 150, + fieldLabel: "Status" + } + ] + } + ] + }); + + var pnlCboAppdelStatus = new Ext.Panel({ + id: "pnlCboAppdelStatus", + + border: false, + + items: [ + {xtype: "form", + + labelWidth: 115, + border: false, + + items: [ + {xtype: "combo", + id: "cboAppdelStatus", + + valueField: "id", + displayField:"value", + value: "ALL", + store: storeCboAppdelStatus, + + triggerAction: "all", + mode: "local", + editable: false, + + width: 150, + fieldLabel: "Status Delegation" + } + ] + } + ] + }); + + var cboOption = new Ext.form.ComboBox({ + id: "cboOption", + + valueField: "id", + displayField: "value", + value: "m", + store: storeCboOption, + + triggerAction: "all", + mode: "local", + editable: false, + + width: 150, + fieldLabel: "Option", + + listeners: {select:function (combo, record, index) { Ext.MessageBox.alert("Alert", "Event select in Ext.form.ComboBox"); }} + }); + + var txtDate = new Ext.form.DateField({ + id: "txtDate", + + value: new Date(2011, 0, 1), //january = 0, february = 1, ... + width: 150, + //format: "Y-m-d H:i:s", + format: "Y-m-d", + editable: false, + fieldLabel: "Date Start" + }); + + var btnSubmit = new Ext.Button({ + id: "btnSubmit", + + text: "Submit", + //anchor: "95%", + + handler: function () { + Ext.MessageBox.alert("Alert", "Event handler in Ext.Button"); + } + }); + + //------------------------------------------------------------------------------------------------------------------ + var tbarMain = new Ext.Toolbar({ + id: "tbarMain", + + items: [{text: "< Back"}, + "-", + "->", //Right + "-", + {text: "Home"} + ] + }); + + var frmHistory = new Ext.FormPanel({ + id: "frmHistory", + + labelWidth: 115, //The width of labels in pixels + bodyStyle: "padding:0.5em;", + border: false, + + //title: "Data", + items: [cboGraphicType, radiog1, pnlCboAppStatus, pnlCboAppdelStatus, cboOption, txtDate], + + buttonAlign: "right", + buttons: [btnSubmit, + {text:"Reset", + handler: function () { + frmHistory.getForm().reset(); + } + } + ] + }); + + var pnlWest = new Ext.Panel({ + id: "pnlWest", + + region: "west", + collapsible: true, + split: true, + margins: {top:3, right:3, bottom:3, left:3}, + width: 380, + + title: "Data", + items: [frmHistory] + }); + + var pnlCenter = new Ext.Panel({ + id: "pnlCenter", + + region:"center", + margins: {top:3, right:3, bottom:3, left:0}, + bodyStyle: "padding:25px 25px 25px 25px;", + + html: "Application2" + //items: [] + }); + + //------------------------------------------------------------------------------------------------------------------ + Ext.getCmp("pnlCboAppStatus").setVisible(true); + Ext.getCmp("pnlCboAppdelStatus").setVisible(false); + + //------------------------------------------------------------------------------------------------------------------ + var pnlMain=new Ext.Panel({ + id: "pnlMain", + + layout: "border", + defaults: {autoScroll: true}, + border: false, + + title: "Application2", + tbar: tbarMain, + items: [pnlWest, pnlCenter] + }); + + //LOAD ALL PANELS + var viewport = new Ext.Viewport({ + layout: "fit", + items:[pnlMain] + }); + } +} + +Ext.onReady({className}.application2.init, {className}.application2); \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginApplication2.php.tpl b/gulliver/bin/tasks/templates/pluginApplication2.php.tpl new file mode 100644 index 000000000..320f44c6e --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginApplication2.php.tpl @@ -0,0 +1,16 @@ +addContent("{className}/{className}Application2"); //Adding a html file .html. + $oHeadPublisher->addExtJsScript("{className}/{className}Application2", false); //Adding a javascript file .js + + G::RenderPage("publish", "extJs"); +} catch (Exception $e) { + $G_PUBLISH = new Publisher; + + $aMessage["MESSAGE"] = $e->getMessage(); + $G_PUBLISH->AddContent("xmlform", "xmlform", "{className}/messageShow", "", $aMessage); + G::RenderPage("publish", "blank"); +} +?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginApplication3.html.tpl b/gulliver/bin/tasks/templates/pluginApplication3.html.tpl new file mode 100644 index 000000000..1e7fb11ca --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginApplication3.html.tpl @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginApplication3.js.tpl b/gulliver/bin/tasks/templates/pluginApplication3.js.tpl new file mode 100644 index 000000000..84a75ea78 --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginApplication3.js.tpl @@ -0,0 +1,26 @@ +Ext.namespace("{className}"); + +{className}.application3 = { + init:function(){ + var pnlCenter=new Ext.Panel({ + id:"pnlCenter", + + region:"center", + border: false, + title: "Application3", + html: " Content3" + }); + + var pnlMain=new Ext.Panel({ + id: "pnlMain", + + layout: "border", + height: 150, + items:[pnlCenter], + + renderTo: "divMain" + }); + } +} + +Ext.onReady({className}.application3.init, {className}.application3); \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginApplication3.php.tpl b/gulliver/bin/tasks/templates/pluginApplication3.php.tpl new file mode 100644 index 000000000..575befe8a --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginApplication3.php.tpl @@ -0,0 +1,16 @@ +addContent("{className}/{className}Application3"); //Adding a html file .html. + $oHeadPublisher->addExtJsScript("{className}/{className}Application3", false); //Adding a javascript file .js + + G::RenderPage("publish", "extJs"); +} catch (Exception $e) { + $G_PUBLISH = new Publisher; + + $aMessage["MESSAGE"] = $e->getMessage(); + $G_PUBLISH->AddContent("xmlform", "xmlform", "{className}/messageShow", "", $aMessage); + G::RenderPage("publish", "blank"); +} +?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginApplicationAjax.php.tpl b/gulliver/bin/tasks/templates/pluginApplicationAjax.php.tpl new file mode 100644 index 000000000..1a402722c --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginApplicationAjax.php.tpl @@ -0,0 +1,36 @@ + $ii + 10, "NAME" => $userName[$ii], "AGE" => rand(20, 40), "BALANCE" => rand(100, 255)); + } + + return (array(count($user), array_slice($user, $i, $r))); +} + +try { + $option = $_POST["option"]; + + switch ($option) { + case "LST": $pageSize = $_POST["pageSize"]; + + $limit = isset($_POST["limit"])? $_POST["limit"] : $pageSize; + $start = isset($_POST["start"])? $_POST["start"] : 0; + + list($userNum, $user) = userGet($limit, $start); + + //echo "{success: " . true . ", resultTotal: " . count($user) . ", resultRoot: " . G::json_encode($user) . "}"; + echo json_encode(array("success" => true, "resultTotal" => $userNum, "resultRoot" => $user)); + break; + } +} catch (Exception $e) { + echo null; +} +?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginClass.tpl b/gulliver/bin/tasks/templates/pluginClass.tpl index 797dac413..d41c978a2 100755 --- a/gulliver/bin/tasks/templates/pluginClass.tpl +++ b/gulliver/bin/tasks/templates/pluginClass.tpl @@ -4,9 +4,8 @@ * */ - class {className}Class extends PMPlugin { - - function __construct ( ) { + class {className}Class extends PMPlugin { + function __construct() { set_include_path( PATH_PLUGINS . '{className}' . PATH_SEPARATOR . get_include_path() @@ -17,37 +16,45 @@ { } + function getFieldsForPageSetup() + { + } + + function updateFieldsForPageSetup() + { + } + //here we are defining the available charts, the dashboard setup will call this function to know the charts - function getAvailableCharts( ) { - return array ( - '{className}Chart', - ); + function getAvailableCharts() { + return array( + '{className}Chart', + ); } - function getChart( $chartName ) { + function getChart($chartName) { $prePath = '/sys' . SYS_SYS . '/' . SYS_LANG . '/blank/'; - $obj = new StdClass(); - switch ($chartName) { - case '{className}Chart': - $obj->title = '{className} Chart - Per Forum'; - break; - } + $obj = new StdClass(); + switch ($chartName) { + case '{className}Chart': + $obj->title = '{className} Chart - Per Forum'; + break; + } $obj->height = 220; $obj->open->image = $prePath . '{className}/drawChart?chart=' . $chartName . "&u="; - return $obj; + return $obj; } - /* definition of all charts */ - /* that definition comes in two parts : - /* 1. the getXX () function to get the data from the databases - /* 2. the XX () function to draw the graph - */ + /* definition of all charts */ + /* that definition comes in two parts : + /* 1. the getXX() function to get the data from the databases + /* 2. the XX() function to draw the graph + */ - /** chart {className} ***/ - function get{className}Chart ( ) { + /** chart {className} ***/ + function get{className}Chart() { $dataSet = array(); - $past1months = mktime(0, 0, 0, date("m") -1 , date("d"), date("Y")); + $past1months = mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")); $con = Propel::getConnection('workflow'); $sql = "select CON_VALUE, COUNT(*) AS CANT from APPLICATION LEFT JOIN CONTENT ON ( CON_CATEGORY = 'PRO_TITLE' AND CON_ID = PRO_UID AND CON_LANG = 'en' ) GROUP BY CON_VALUE" ; @@ -55,77 +62,76 @@ $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); $rs->next(); $row = $rs->getRow(); - while ( is_array ( $row ) ) { - if ( strlen ( trim ($row['CON_VALUE']) ) > 0 ) { - $label[] = $row['CON_VALUE']; - $data[] = $row['CANT']; - } - $rs->next(); - $row = $rs->getRow(); + while (is_array($row)) { + if (strlen(trim($row['CON_VALUE'])) > 0) { + $label[] = $row['CON_VALUE']; + $data[] = $row['CANT']; + } + $rs->next(); + $row = $rs->getRow(); } $dataSet['data'] = $data; $dataSet['label'] = $label; $max = 1; - foreach ( $dataSet['data'] as $k => $val ) if ( $val > $max ) $max = $val; - $aux = intval($max / 6 ) * 6 + 6; - $dataSet['max'] = $aux; + foreach ($dataSet['data'] as $k => $val ) if ($val > $max) $max = $val; + $aux = intval($max / 6) * 6 + 6; + $dataSet['max'] = $aux; return $dataSet; } - function {className}Chart( ) { + function {className}Chart() { G::LoadThirdParty("libchart/classes", "libchart" ); $chart = new VerticalBarChart(430, 220); $dataSet = $this->get{className}Chart(); - $dataPostSet = new XYDataSet(); - $dataTopicSet = new XYDataSet(); - foreach ( $dataSet['label'] as $key => $label ) { - $dataPostSet->addPoint(new Point( $label, $dataSet['data'][$key] )) ; - } + $dataPostSet = new XYDataSet(); + $dataTopicSet = new XYDataSet(); + foreach ($dataSet['label'] as $key => $label) { + $dataPostSet->addPoint(new Point($label, $dataSet['data'][$key])) ; + } - $chart->setDataSet($dataPostSet); + $chart->setDataSet($dataPostSet); $chart->setTitle( " Posts by Week " ); $chart->render(); } - //here we are defining the available charts, the dashboard setup will call this function to know the charts - function getAvailableReports( ) { - return array ( - array ( 'uid'=>'{className}Report_1', 'title'=>'{className} Test Report (users)' ), - //array ( 'uid'=>'{className}Report_2', 'title'=>'{className} Test Report (groups)' ) - ); + function getAvailableReports() { + return array ( + array('uid' => '{className}Report_1', 'title' => '{className} Test Report (users)'), + //array('uid' => '{className}Report_2', 'title' => '{className} Test Report (groups)') + ); } - function getReport( $reportName ) { - $obj = new StdClass(); - switch ( $reportName ) { - case '{className}Report_1': - $obj->title = '{className} Test Report (users)'; - break; - case '{className}Report_2': - $obj->title = '{className} Test Report (users)'; - break; - default: - $obj->title = 'default ....'; - break; - } - return $obj; + function getReport($reportName) { + $obj = new StdClass(); + switch ($reportName) { + case '{className}Report_1': + $obj->title = '{className} Test Report (users)'; + break; + case '{className}Report_2': + $obj->title = '{className} Test Report (users)'; + break; + default: + $obj->title = 'default ....'; + break; + } + return $obj; } function {className}Report_1() { - global $G_PUBLISH; + global $G_PUBLISH; require_once 'classes/model/Users.php'; $sDelimiter = DBAdapter::getStringDelimiter(); $aUsers = array(); - $aUsers[] = array('USR_UID' => 'char', - 'USR_NAME' => 'char', - 'USR_FIRSTNAME' => 'char', + $aUsers[] = array('USR_UID' => 'char', + 'USR_NAME' => 'char', + 'USR_FIRSTNAME' => 'char', 'USR_LASTNAME' => 'char', 'USR_EMAIL' => 'char', 'USR_ROLE' => 'char',); @@ -136,15 +142,15 @@ $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); $rs->next(); $row = $rs->getRow(); - while ( is_array ( $row ) ) { - $aUsers[] = array('USR_UID' => $row['USR_UID'], - 'USR_NAME' => $row['USR_USERNAME'], - 'USR_FIRSTNAME' => $row['USR_FIRSTNAME'], - 'USR_LASTNAME' => $row['USR_LASTNAME'], - 'USR_EMAIL' => $row['USR_EMAIL'], - 'USR_ROLE' => $row['USR_ROLE']); - $rs->next(); - $row = $rs->getRow(); + while (is_array($row)) { + $aUsers[] = array('USR_UID' => $row['USR_UID'], + 'USR_NAME' => $row['USR_USERNAME'], + 'USR_FIRSTNAME' => $row['USR_FIRSTNAME'], + 'USR_LASTNAME' => $row['USR_LASTNAME'], + 'USR_EMAIL' => $row['USR_EMAIL'], + 'USR_ROLE' => $row['USR_ROLE']); + $rs->next(); + $row = $rs->getRow(); } global $_DBArray; @@ -158,9 +164,8 @@ $G_PUBLISH = new Publisher; $G_PUBLISH->AddContent('propeltable', 'paged-table', '{className}/report', $oCriteria); G::RenderPage('publish'); - return 1; + return 1; } - - - - } \ No newline at end of file + + } +?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginDelete.tpl b/gulliver/bin/tasks/templates/pluginDelete.tpl index 9cd02264a..5772a7378 100755 --- a/gulliver/bin/tasks/templates/pluginDelete.tpl +++ b/gulliver/bin/tasks/templates/pluginDelete.tpl @@ -1,38 +1,36 @@ - ${phpName} = str_replace ( '"', '', $aux[$index++] ); + ${phpName} = str_replace('"', '', $aux[$index++]); - require_once ( PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); + require_once (PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); $pluginObj = new {pluginName}Class (); - require_once ( "classes/model/{className}.php" ); + require_once ("classes/model/{className}.php"); //if exists the row in the database propel will update it, otherwise will insert. - $tr = {className}Peer::retrieveByPK( {keylist} ); + $tr = {className}Peer::retrieveByPK({keylist}); - if ( ( is_object ( $tr ) && get_class ($tr) == '{className}' ) ) { + if ((is_object($tr) && get_class($tr) == '{className}')) { - $fields['{name}'] = $tr->get{phpName}(); - $fields['LABEL_{name}'] = $tr->get{phpName}(); + $fields['{name}'] = $tr->get{phpName}(); + $fields['LABEL_{name}'] = $tr->get{phpName}(); } else - $fields = array(); + $fields = array(); $G_MAIN_MENU = '{projectName}'; $G_SUB_MENU = '{phpClassName}'; $G_ID_MENU_SELECTED = '{menuId}'; $G_ID_SUB_MENU_SELECTED = '{menuId}'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', '{phpFolderName}/{phpClassName}Delete', '', $fields, '{phpClassName}DeleteExec' ); - G::RenderPage('publish'); + $G_PUBLISH->AddContent('xmlform', 'xmlform', '{phpFolderName}/{phpClassName}Delete', '', $fields, '{phpClassName}DeleteExec'); + G::RenderPage('publish'); ?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginDeleteExec.tpl b/gulliver/bin/tasks/templates/pluginDeleteExec.tpl index d68b55e34..a8bb5bd43 100755 --- a/gulliver/bin/tasks/templates/pluginDeleteExec.tpl +++ b/gulliver/bin/tasks/templates/pluginDeleteExec.tpl @@ -1,31 +1,29 @@ - ${phpName} = $form['{name}']; - + - require_once ( PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); - $pluginObj = new {pluginName}Class (); + require_once (PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); + $pluginObj = new {pluginName}Class (); - require_once ( "classes/model/{className}.php" ); + require_once ("classes/model/{className}.php"); //if exists the row in the database propel will update it, otherwise will insert. - $tr = {className}Peer::retrieveByPK( {keylist} ); - if ( ( is_object ( $tr ) && get_class ($tr) == '{className}' ) ) { + $tr = {className}Peer::retrieveByPK({keylist}); + if ((is_object($tr) && get_class($tr) == '{className}')) { $tr->delete(); } - G::Header('location: {phpClassName}List'); - + G::Header('location: {phpClassName}List'); } - catch ( Exception $e ) { + catch (Exception $e) { $G_PUBLISH = new Publisher; $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publish', 'blank' ); - } - \ No newline at end of file + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); + G::RenderPage('publish', 'blank'); + } + \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginDrawChart.php.tpl b/gulliver/bin/tasks/templates/pluginDrawChart.php.tpl index 31c485ebb..0fad4c41c 100755 --- a/gulliver/bin/tasks/templates/pluginDrawChart.php.tpl +++ b/gulliver/bin/tasks/templates/pluginDrawChart.php.tpl @@ -1,14 +1,14 @@ { $chartType }(); - die; + if (method_exists($chartsObj, $chartType)) { + $chartsObj->{$chartType}(); + die; } \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginEdit.tpl b/gulliver/bin/tasks/templates/pluginEdit.tpl index ae199b4df..5ea3ca63c 100755 --- a/gulliver/bin/tasks/templates/pluginEdit.tpl +++ b/gulliver/bin/tasks/templates/pluginEdit.tpl @@ -1,22 +1,21 @@ - - ${phpName} = str_replace ( '"', '', $aux[{index}] ); + ${phpName} = str_replace('"', '', $aux[{index}]); - require_once ( PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); - $pluginObj = new {pluginName}Class (); + require_once (PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); + $pluginObj = new {pluginName}Class(); - require_once ( "classes/model/{className}.php" ); + require_once ("classes/model/{className}.php"); //if exists the row in the database propel will update it, otherwise will insert. - $tr = {className}Peer::retrieveByPK( {keylist} ); + $tr = {className}Peer::retrieveByPK({keylist}); - if ( ( is_object ( $tr ) && get_class ($tr) == '{className}' ) ) { + if ((is_object($tr) && get_class($tr) == '{className}')) { - $fields['{name}'] = $tr->get{phpName}(); + $fields['{name}'] = $tr->get{phpName}(); } else @@ -27,8 +26,7 @@ $G_ID_MENU_SELECTED = '{menuId}'; $G_ID_SUB_MENU_SELECTED = '{menuId}'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', '{phpFolderName}/{phpClassName}Edit', '', $fields, '{phpClassName}Save' ); - G::RenderPage('publish'); + $G_PUBLISH->AddContent('xmlform', 'xmlform', '{phpFolderName}/{phpClassName}Edit', '', $fields, '{phpClassName}Save'); + G::RenderPage('publish'); ?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginList.tpl b/gulliver/bin/tasks/templates/pluginList.tpl index c0cdef5a5..7af61bf5f 100755 --- a/gulliver/bin/tasks/templates/pluginList.tpl +++ b/gulliver/bin/tasks/templates/pluginList.tpl @@ -1,36 +1,35 @@ - require_once ( PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); - $pluginObj = new {pluginName}Class (); + require_once (PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); + $pluginObj = new {pluginName}Class(); - require_once ( "classes/model/{className}.php" ); + require_once ("classes/model/{className}.php"); - $Criteria = new Criteria('workflow'); - $Criteria->clearSelectColumns ( ); + $Criteria = new Criteria('workflow'); + $Criteria->clearSelectColumns(); - $Criteria->addSelectColumn ( {className}Peer::{name} ); + $Criteria->addSelectColumn({className}Peer::{name}); - $Criteria->add ( {phpClassName}Peer::{firstKey}, "xx" , CRITERIA::NOT_EQUAL ); + $Criteria->add({phpClassName}Peer::{firstKey}, "xx", CRITERIA::NOT_EQUAL); - $G_PUBLISH->AddContent('propeltable', 'paged-table', '{phpFolderName}/{phpClassName}List', $Criteria , array(),''); - G::RenderPage('publish'); - + $G_PUBLISH->AddContent('propeltable', 'paged-table', '{phpFolderName}/{phpClassName}List', $Criteria, array(), ''); + G::RenderPage('publish'); } - catch ( Exception $e ) { + catch (Exception $e) { $G_PUBLISH = new Publisher; $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publish', 'blank' ); - } + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); + G::RenderPage('publish', 'blank'); + } diff --git a/gulliver/bin/tasks/templates/pluginMainFile.tpl b/gulliver/bin/tasks/templates/pluginMainFile.tpl index 590af9cb9..4c63d19e2 100755 --- a/gulliver/bin/tasks/templates/pluginMainFile.tpl +++ b/gulliver/bin/tasks/templates/pluginMainFile.tpl @@ -1,33 +1,36 @@ sFriendlyName = '{className} Plugin'; - $this->sDescription = 'Autogenerated plugin for class {className}'; - $this->sPluginFolder = '{className}'; - $this->sSetupPage = '{className}'; - $this->iVersion = 0.78; - //$this->iPMVersion = 2425; - $this->aWorkspaces = null; - //$this->aWorkspaces = array('os'); - return $res; + $res = parent::PMPlugin($sNamespace, $sFilename); + $this->sFriendlyName = "{className} Plugin"; + $this->sDescription = "Autogenerated plugin for class {className}"; + $this->sPluginFolder = "{className}"; + $this->sSetupPage = "setup"; + $this->iVersion = 1; + //$this->iPMVersion = 2425; + $this->aWorkspaces = null; + //$this->aWorkspaces = array("os"); + return $res; } function setup() { - $this->setCompanyLogo ('/plugin/{className}/{className}.png'); + $this->setCompanyLogo("/plugin/{className}/{className}.png"); - $this->registerMenu( 'setup', 'menu{className}.php'); + $this->registerMenu("processmaker", "menu{className}.php"); + + $this->registerMenu("cases", "menuCases{className}.php"); + - $this->registerMenu( 'processmaker', 'menu{className}OnTransit.php'); + //$this->registerMenu("processmaker", "menu{className}OnTransit.php"); - $this->registerStep( '{GUID}', 'step{className}', '{className} external step' ); + $this->registerStep("{GUID}", "step{className}Application", "{className} external step"); $this->registerDashboard(); @@ -39,7 +42,7 @@ class {className}Plugin extends PMPlugin $this->registerPmFunction(); - $this->redirectLogin( 'PROCESSMAKER_{className}', 'users/users_List' ); + $this->redirectLogin("PROCESSMAKER_{className}", "users/users_List"); } @@ -48,18 +51,18 @@ class {className}Plugin extends PMPlugin $RBAC = RBAC::getSingleton() ; $RBAC->initRBAC(); $roleData = array(); - $roleData['ROL_UID'] = G::GenerateUniqueId(); - $roleData['ROL_PARENT'] = ''; - $roleData['ROL_SYSTEM'] = '00000000000000000000000000000002'; - $roleData['ROL_CODE'] = 'PROCESSMAKER_{className}'; - $roleData['ROL_CREATE_DATE'] = date('Y-m-d H:i:s'); - $roleData['ROL_UPDATE_DATE'] = date('Y-m-d H:i:s'); - $roleData['ROL_STATUS'] = '1'; - $RBAC->createRole ( $roleData ); - $RBAC->createPermision ('PM_{className}' ); + $roleData["ROL_UID"] = G::GenerateUniqueId(); + $roleData["ROL_PARENT"] = ""; + $roleData["ROL_SYSTEM"] = "00000000000000000000000000000002"; + $roleData["ROL_CODE"] = "PROCESSMAKER_{className}"; + $roleData["ROL_CREATE_DATE"] = date("Y-m-d H:i:s"); + $roleData["ROL_UPDATE_DATE"] = date("Y-m-d H:i:s"); + $roleData["ROL_STATUS"] = "1"; + $RBAC->createRole($roleData); + $RBAC->createPermision("PM_{className}"); } } -$oPluginRegistry =& PMPluginRegistry::getSingleton(); -$oPluginRegistry->registerPlugin('{className}', __FILE__); +$oPluginRegistry = &PMPluginRegistry::getSingleton(); +$oPluginRegistry->registerPlugin("{className}", __FILE__); diff --git a/gulliver/bin/tasks/templates/pluginMenu.tpl b/gulliver/bin/tasks/templates/pluginMenu.tpl index d0902fa95..418285790 100755 --- a/gulliver/bin/tasks/templates/pluginMenu.tpl +++ b/gulliver/bin/tasks/templates/pluginMenu.tpl @@ -1,5 +1,5 @@ AddIdRawOption('{menuId}', '{phpClassName}/{phpClassName}List', "{className}" ); +global $G_TMP_MENU; +$G_TMP_MENU->AddIdRawOption("{menuId}_MNU_01", "{phpClassName}/{phpClassName}Application", "{className} - application1"); ?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginMenuCases.tpl b/gulliver/bin/tasks/templates/pluginMenuCases.tpl new file mode 100644 index 000000000..0c09c8871 --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginMenuCases.tpl @@ -0,0 +1,83 @@ +Id as $index => $value) { + if ($index == 3) { //Option CASES_INBOX + $tmpId[$index + $k] = "{menuId}_MNUCASE_01"; + $tmpTypes[$index + $k] = "plugins"; + $tmpEnabled[$index + $k] = 1; + $tmpOptions[$index + $k] = "../{phpClassName}/{phpClassName}Application"; //link + $tmpLabels[$index + $k] = "{className} application1"; + $tmpJS[$index + $k] = null; + $tmpIcons[$index + $k] = null; + $tmpEClass[$index + $k] = null; + + $k = 1; + } + + $tmpId[$index + $k] = $G_TMP_MENU->Id[$index]; + $tmpTypes[$index + $k] = $G_TMP_MENU->Types[$index]; + $tmpEnabled[$index + $k] = $G_TMP_MENU->Enabled[$index]; + $tmpOptions[$index + $k] = $G_TMP_MENU->Options[$index]; //link + $tmpLabels[$index + $k] = $G_TMP_MENU->Labels[$index]; + $tmpJS[$index + $k] = $G_TMP_MENU->JS[$index]; + $tmpIcons[$index + $k] = $G_TMP_MENU->Icons[$index]; + $tmpEClass[$index + $k] = $G_TMP_MENU->ElementClass[$index]; + + $i = $index + $k; +} + +$i = $i + 1; + +$tmpId[$i] = "{menuId}_MNUCASE_02"; +$tmpTypes[$i] = "blockHeader"; +$tmpEnabled[$i] = 1; +$tmpOptions[$i] = null; //link +$tmpLabels[$i] = "{className} application2"; +$tmpJS[$i] = null; +$tmpIcons[$i] = null; +$tmpEClass[$i] = null; + +$i = $i + 1; + +$tmpId[$i] = "{menuId}_MNUCASE_03"; +$tmpTypes[$i] = "plugins"; +$tmpEnabled[$i] = 1; +$tmpOptions[$i] = "../{phpClassName}/{phpClassName}Application2"; //link +$tmpLabels[$i] = "{className} application2"; +$tmpJS[$i] = null; +$tmpIcons[$i] = null; +$tmpEClass[$i] = null; + +$i = $i + 1; + +$tmpId[$i] = "{menuId}_MNUCASE_04"; +$tmpTypes[$i] = "blockHeaderNoChild"; +$tmpEnabled[$i] = 1; +$tmpOptions[$i] = "../{phpClassName}/{phpClassName}Application3"; //link +$tmpLabels[$i] = "{className} application3"; +$tmpJS[$i] = null; +$tmpIcons[$i] = null; +$tmpEClass[$i] = null; + +$G_TMP_MENU->Id = $tmpId; +$G_TMP_MENU->Types = $tmpTypes; +$G_TMP_MENU->Enabled = $tmpEnabled; +$G_TMP_MENU->Options = $tmpOptions; //link +$G_TMP_MENU->Labels = $tmpLabels; +$G_TMP_MENU->JS = $tmpJS; +$G_TMP_MENU->Icons = $tmpIcons; +$G_TMP_MENU->ElementClass = $tmpEClass; +?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginMessageShow.xml.tpl b/gulliver/bin/tasks/templates/pluginMessageShow.xml.tpl new file mode 100644 index 000000000..3dfac434e --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginMessageShow.xml.tpl @@ -0,0 +1,9 @@ + + + + <en>Error</en> + + + + + \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginNew.tpl b/gulliver/bin/tasks/templates/pluginNew.tpl index 6175cde29..dbff424e3 100755 --- a/gulliver/bin/tasks/templates/pluginNew.tpl +++ b/gulliver/bin/tasks/templates/pluginNew.tpl @@ -1,20 +1,19 @@ - require_once ( PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); - $pluginObj = new {pluginName}Class (); + require_once (PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); + $pluginObj = new {pluginName}Class(); - require_once ( "classes/model/{className}.php" ); + require_once ("classes/model/{className}.php"); //if exists the row in the database propel will update it, otherwise will insert. -// $tr = {phpClassName}Peer::retrieveByPK( {keylist} ); -// if ( ( is_object ( $tr ) && get_class ($tr) == '{phpClassName}' ) ) { -// } -// else -// $fields = array(); -// $fields['ITM_UID'] = $ItmUid; + //$tr = {phpClassName}Peer::retrieveByPK( {keylist} ); + //if ((is_object($tr) && get_class($tr) == '{phpClassName}')) { + //} + //else + // $fields = array(); + //$fields['ITM_UID'] = $ItmUid; @@ -30,8 +29,7 @@ $G_ID_MENU_SELECTED = '{menuId}'; $G_ID_SUB_MENU_SELECTED = '{menuId}'; - $G_PUBLISH = new Publisher; - $G_PUBLISH->AddContent('xmlform', 'xmlform', '{phpFolderName}/{phpClassName}Edit', '', $fields, '{phpClassName}Save' ); - G::RenderPage('publish'); + $G_PUBLISH->AddContent('xmlform', 'xmlform', '{phpFolderName}/{phpClassName}Edit', '', $fields, '{phpClassName}Save'); + G::RenderPage('publish'); ?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginPaged-table.html.tpl b/gulliver/bin/tasks/templates/pluginPaged-table.html.tpl index f7a0c2419..13e35e7e3 100755 --- a/gulliver/bin/tasks/templates/pluginPaged-table.html.tpl +++ b/gulliver/bin/tasks/templates/pluginPaged-table.html.tpl @@ -2,73 +2,73 @@ - -
- - -
- - {title} - - - - -
{content}
- - - - +
- - - - - - - - - {value} - - - - - + - - - + {title} +
- {header} -
- -
  - {noRecordsFound}
  -
+ + + +
{content}
+ + + + + + + + + + + + + + {value} + + + + + - - - - - - + + + + + + + + + + + + -
+ {header} +
- - - - - - - -
- {labels:ID_ROWS} {firstRow}-{lastRow}/{totalRows}  - - {first}{prev}{next}{last} - {labels:ID_PAGE} {currentPage}/{totalPages}
-
  + {noRecordsFound}
  +
+ + + + + + + +
+ {labels:ID_ROWS} {firstRow}-{lastRow}/{totalRows}  + + {first}{prev}{next}{last} + {labels:ID_PAGE} {currentPage}/{totalPages}
+
+
-
+ + +
diff --git a/gulliver/bin/tasks/templates/pluginPropel.ini.tpl b/gulliver/bin/tasks/templates/pluginPropel.ini.tpl index 731546490..246a7f395 100755 --- a/gulliver/bin/tasks/templates/pluginPropel.ini.tpl +++ b/gulliver/bin/tasks/templates/pluginPropel.ini.tpl @@ -26,7 +26,7 @@ propel.datadump.mapper.from = *schema.xml propel.datadump.mapper.to = *data.xml ; builder settings -;_propel.builder.peer.class = addon.propel.builder.SfPeerBuilder +;_propel.builder.peer.class = addon.propel.builder.SfPeerBuilder ;propel.builder.object.class = addon.propel.builder.SfObjectBuilder ;propel.builder.objectstub.class = addon.propel.builder.SfExtensionObjectBuilder diff --git a/gulliver/bin/tasks/templates/pluginPropel.mysql.ini.tpl b/gulliver/bin/tasks/templates/pluginPropel.mysql.ini.tpl index 3ca99ab16..820ea5bb0 100755 --- a/gulliver/bin/tasks/templates/pluginPropel.mysql.ini.tpl +++ b/gulliver/bin/tasks/templates/pluginPropel.mysql.ini.tpl @@ -26,7 +26,7 @@ propel.datadump.mapper.from = *schema.xml propel.datadump.mapper.to = *data.xml ; builder settings -;_propel.builder.peer.class = addon.propel.builder.SfPeerBuilder +;_propel.builder.peer.class = addon.propel.builder.SfPeerBuilder ;propel.builder.object.class = addon.propel.builder.SfObjectBuilder ;propel.builder.objectstub.class = addon.propel.builder.SfExtensionObjectBuilder diff --git a/gulliver/bin/tasks/templates/pluginReport.xml.tpl b/gulliver/bin/tasks/templates/pluginReport.xml.tpl index 5e7f5e46d..a02bd409e 100755 --- a/gulliver/bin/tasks/templates/pluginReport.xml.tpl +++ b/gulliver/bin/tasks/templates/pluginReport.xml.tpl @@ -1,12 +1,13 @@ - Uid + Name + First Name @@ -22,5 +23,4 @@ Role - \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginSave.tpl b/gulliver/bin/tasks/templates/pluginSave.tpl index 49b04f787..b70e06d4b 100755 --- a/gulliver/bin/tasks/templates/pluginSave.tpl +++ b/gulliver/bin/tasks/templates/pluginSave.tpl @@ -1,53 +1,52 @@ - - ${phpName} = $form['{name}']; + + ${phpName} = $form['{name}']; - require_once ( PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); - $pluginObj = new {pluginName}Class (); + require_once (PATH_PLUGINS . '{pluginName}' . PATH_SEP . 'class.{pluginName}.php'); + $pluginObj = new {pluginName}Class(); - require_once ( "classes/model/{className}.php" ); + require_once ("classes/model/{className}.php"); - //if exists the row in the database propel will update it, otherwise will insert. - $tr = {className}Peer::retrieveByPK( {keylist} ); - if ( ! ( is_object ( $tr ) && get_class ($tr) == '{className}' ) ) { - $tr = new {className}(); - } + //if exists the row in the database propel will update it, otherwise will insert. + $tr = {className}Peer::retrieveByPK( {keylist} ); + if (!(is_object($tr) && get_class($tr) == '{className}')) { + $tr = new {className}(); + } - $tr->set{phpName}( ${phpName} ); + $tr->set{phpName}( ${phpName} ); - if ($tr->validate() ) { - // we save it, since we get no validation errors, or do whatever else you like. - $res = $tr->save(); - } - else { - // Something went wrong. We can now get the validationFailures and handle them. - $msg = ''; - $validationFailuresArray = $tr->getValidationFailures(); - foreach($validationFailuresArray as $objValidationFailure) { - $msg .= $objValidationFailure->getMessage() . "
"; - } - //return array ( 'codError' => -100, 'rowsAffected' => 0, 'message' => $msg ); - } - //return array ( 'codError' => 0, 'rowsAffected' => $res, 'message' => ''); + if ($tr->validate()) { + //we save it, since we get no validation errors, or do whatever else you like. + $res = $tr->save(); + } + else { + //Something went wrong. We can now get the validationFailures and handle them. + $msg = ''; + $validationFailuresArray = $tr->getValidationFailures(); + foreach($validationFailuresArray as $objValidationFailure) { + $msg .= $objValidationFailure->getMessage() . "
"; + } + //return array('codError' => -100, 'rowsAffected' => 0, 'message' => $msg); + } + //return array('codError' => 0, 'rowsAffected' => $res, 'message' => ''); //to do: uniform coderror structures for all classes - //if ( $res['codError'] < 0 ) { - // G::SendMessageText ( $res['message'] , 'error' ); - //} - G::Header('location: {phpClassName}List'); - + //if ($res['codError'] < 0) { + // G::SendMessageText($res['message'] , 'error'); + //} + G::Header('location: {phpClassName}List'); } - catch ( Exception $e ) { + catch (Exception $e) { $G_PUBLISH = new Publisher; $aMessage['MESSAGE'] = $e->getMessage(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publish', 'blank' ); - } - \ No newline at end of file + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); + G::RenderPage('publish', 'blank'); + } + \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginSetup.xml.tpl b/gulliver/bin/tasks/templates/pluginSetup.xml.tpl new file mode 100644 index 000000000..1b288222a --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginSetup.xml.tpl @@ -0,0 +1,19 @@ + + + + {className} plugin setup page + + + + Edit this page for customize the plugin + + + + Save + + \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginStepApplication.html.tpl b/gulliver/bin/tasks/templates/pluginStepApplication.html.tpl new file mode 100644 index 000000000..1e7fb11ca --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginStepApplication.html.tpl @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginStepApplication.js.tpl b/gulliver/bin/tasks/templates/pluginStepApplication.js.tpl new file mode 100644 index 000000000..1dbdb4fd2 --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginStepApplication.js.tpl @@ -0,0 +1,99 @@ +Ext.namespace("step{className}"); + +step{className}.application = { + init:function(){ + storeApplicationProcess = function () { + var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Load application data..."}); + myMask.show(); + + Ext.Ajax.request({ + url: "../{className}/step{className}ApplicationAjax", + method: "POST", + + success:function (result, request) { + storeApplication.loadData(Ext.util.JSON.decode(result.responseText)); + myMask.hide(); + }, + failure:function (result, request) { + myMask.hide(); + Ext.MessageBox.alert("Alert", "Failure application data load"); + } + }); + }; + + //stores + var storeApplication = new Ext.data.Store({ + proxy:new Ext.data.HttpProxy({ + url: "../{className}/step{className}ApplicationAjax", + method: "POST" + }), + + //baseParams: , + + reader:new Ext.data.JsonReader({ + root: "resultRoot", + totalProperty: "resultTotal", + fields: [{name: "VARIABLE"}, + {name: "VALUE"} + ] + }), + + //autoLoad: true, //First call + + listeners:{ + beforeload:function (store) { + } + } + }); + + // + var cmodel = new Ext.grid.ColumnModel({ + defaults: { + width:50, + sortable:true + }, + columns:[{header: "Variable", dataIndex: "VARIABLE", width: 25}, + {header: "Value", dataIndex: "VALUE"} + ] + }); + + var grdpnlApplication = new Ext.grid.GridPanel({ + id: "grdpnlUser", + + store: storeApplication, + colModel: cmodel, + + columnLines: true, + viewConfig: {forceFit: true}, + enableColumnResize: true, + enableHdMenu: false, //Menu of the column + + tbar: [new Ext.Action({ + text: " < " + CONFIG.previousStepLabel + " ", + handler: function() { + window.location.href = CONFIG.previousStep; + } + }), + "->", + new Ext.Action({ + text: " " + CONFIG.nextStepLabel + " > ", + handler: function() { + window.location.href = CONFIG.nextStep; + } + }) + ], + + style: "margin: 0 auto 0 auto;", + width: 550, + height: 350, + title: "Application data", + + renderTo: "divMain" + }); + + //Initialize events + storeApplicationProcess(); + } +} + +Ext.onReady(step{className}.application.init, step{className}.application); \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginStepApplication.php.tpl b/gulliver/bin/tasks/templates/pluginStepApplication.php.tpl new file mode 100644 index 000000000..a763be264 --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginStepApplication.php.tpl @@ -0,0 +1,27 @@ +addContent("{className}/step{className}Application"); //Adding a html file .html. + $oHeadPublisher->addExtJsScript("{className}/step{className}Application", false); //Adding a javascript file .js + $oHeadPublisher->assign("CONFIG", $config); + + G::RenderPage("publish", "extJs"); + exit(0); +} catch (Exception $e) { + echo $e->getMessage(); + exit(0); +} +?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginStepApplicationAjax.php.tpl b/gulliver/bin/tasks/templates/pluginStepApplicationAjax.php.tpl new file mode 100644 index 000000000..d331d3055 --- /dev/null +++ b/gulliver/bin/tasks/templates/pluginStepApplicationAjax.php.tpl @@ -0,0 +1,26 @@ +loadCase($_SESSION["APPLICATION"]); + $aData = $aFields["APP_DATA"]; + + $aResult = array(); + + foreach ($aData as $index => $value) { + $aResult[] = array("VARIABLE" => $index, "VALUE" => $value); + } + + //echo "{success: " . true . ", resultTotal: " . count($aResult) . ", resultRoot: " . G::json_encode($aResult) . "}"; + echo json_encode(array("success" => true, "resultTotal" => count($aResult), "resultRoot" => $aResult)); +} catch (Exception $e) { + echo null; +} +?> \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginXmlform.tpl b/gulliver/bin/tasks/templates/pluginXmlform.tpl index 713bba6a4..1855390a5 100755 --- a/gulliver/bin/tasks/templates/pluginXmlform.tpl +++ b/gulliver/bin/tasks/templates/pluginXmlform.tpl @@ -1,6 +1,5 @@ - {className} form @@ -19,5 +18,4 @@ save - \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginXmlformDelete.tpl b/gulliver/bin/tasks/templates/pluginXmlformDelete.tpl index 1f352dfee..c541384db 100755 --- a/gulliver/bin/tasks/templates/pluginXmlformDelete.tpl +++ b/gulliver/bin/tasks/templates/pluginXmlformDelete.tpl @@ -1,23 +1,20 @@ - - + Delete {className} - - + {label} -<{name} type="hidden" colWidth='{size}' > +<{name} type="hidden" colWidth='{size}'> - + - + delete - \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginXmlformEdit.tpl b/gulliver/bin/tasks/templates/pluginXmlformEdit.tpl index 21aa7f225..cf8b11f8f 100755 --- a/gulliver/bin/tasks/templates/pluginXmlformEdit.tpl +++ b/gulliver/bin/tasks/templates/pluginXmlformEdit.tpl @@ -1,31 +1,28 @@ - - + {className} form - -<{name} type="hidden" colWidth='{size}' > +<{name} type="hidden" colWidth='{size}'> {label} -<{name} type="{type}" size='{size}' maxlength='{maxlength}' > +<{name} type="{type}" size='{size}' maxlength='{maxlength}'> {label} - + - + - + save - \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginXmlformList.tpl b/gulliver/bin/tasks/templates/pluginXmlformList.tpl index d307b891c..02205fc99 100755 --- a/gulliver/bin/tasks/templates/pluginXmlformList.tpl +++ b/gulliver/bin/tasks/templates/pluginXmlformList.tpl @@ -2,22 +2,20 @@ - -<{name} type="text" colWidth='{size}' > +<{name} type="text" colWidth='{size}'> {label} - + - + Edit - + - + Delete - \ No newline at end of file diff --git a/gulliver/bin/tasks/templates/pluginXmlformOptions.tpl b/gulliver/bin/tasks/templates/pluginXmlformOptions.tpl index afcf639e8..398450539 100755 --- a/gulliver/bin/tasks/templates/pluginXmlformOptions.tpl +++ b/gulliver/bin/tasks/templates/pluginXmlformOptions.tpl @@ -1,8 +1,6 @@ - <{phpClassName}New type="private" defaultValue="../{phpClassName}/{phpClassName}New"/> - \ No newline at end of file