diff --git a/workflow/engine/classes/model/OauthAccessTokens.php b/workflow/engine/classes/model/OauthAccessTokens.php index b586fcd5f..00dd38941 100644 --- a/workflow/engine/classes/model/OauthAccessTokens.php +++ b/workflow/engine/classes/model/OauthAccessTokens.php @@ -1,12 +1,11 @@ toArray(BasePeer::TYPE_FIELDNAME); + $this->fromArray($arrayField, BasePeer::TYPE_FIELDNAME); + $this->setNew(false); + + return $arrayField; + } else { + throw (new Exception("The row \"$oauthAccessTokenId\" in table OAUTH_ACCESS_TOKENS doesn't exist!")); + } + } catch (Exception $e) { + throw $e; + } + } + + public function update($arrayData) + { + $cnn = Propel::getConnection(OauthAccessTokensPeer::DATABASE_NAME); + + try { + $cnn->begin(); + + $this->load($arrayData["ACCESS_TOKEN"]); + $this->fromArray($arrayData, BasePeer::TYPE_FIELDNAME); + + if ($this->validate()) { + if (isset($arrayData["CLIENT_ID"])) { + $this->setClientId($arrayData["CLIENT_ID"]); + } + + if (isset($arrayData["USER_ID"])) { + $this->setUserId($arrayData["USER_ID"]); + } + + if (isset($arrayData["EXPIRES"])) { + $this->setExpires($arrayData["EXPIRES"]); + } + + if (isset($arrayData["SCOPE"])) { + $this->setScope($arrayData["SCOPE"]); + } + + $result = $this->save(); + $result = ($result == 0)? (($contentResult > 0)? 1 : 0) : $result; + + $cnn->commit(); + + return $result; + } else { + $cnn->rollback(); + + throw (new Exception("Failed Validation in class \"" . get_class($this) . "\".")); + } + } catch (Exception $e) { + $cnn->rollback(); + + throw $e; + } + } + + public function remove($oauthAccessTokenId) + { + $cnn = Propel::getConnection(OauthAccessTokensPeer::DATABASE_NAME); + + try { + $oclient = OauthAccessTokensPeer::retrieveByPK($oauthAccessTokenId); + + if (!is_null($oclient)) { + $cnn->begin(); + + $result = $oclient->delete(); + $cnn->commit(); + + return $result; + } else { + throw (new Exception("The row \"$oauthAccessTokenId\" in table OAUTH_ACCESS_TOKENS doesn't exist!")); + } + } catch (Exception $e) { + $cnn->rollback(); + + throw $e; + } + } + + public function getAll($arrayFilterData = array(), $sortField = "", $sortDir = "", $start = 0, $limit = 25) + { + //SQL + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(OauthAccessTokensPeer::ACCESS_TOKEN); + $criteria->addSelectColumn(OauthAccessTokensPeer::CLIENT_ID); + $criteria->addSelectColumn(OauthAccessTokensPeer::USER_ID); + $criteria->addSelectColumn(OauthAccessTokensPeer::EXPIRES); + $criteria->addSelectColumn(OauthAccessTokensPeer::SCOPE); + $criteria->addSelectColumn(OauthClientsPeer::CLIENT_NAME); + $criteria->addSelectColumn(OauthClientsPeer::CLIENT_DESCRIPTION); + + $criteria->addJoin(OauthAccessTokensPeer::CLIENT_ID, OauthClientsPeer::CLIENT_ID, Criteria::LEFT_JOIN); + + if ($arrayFilterData && isset($arrayFilterData["USER_ID"]) && $arrayFilterData["USER_ID"] != "") { + $criteria->add(OauthAccessTokensPeer::USER_ID, $arrayFilterData["USER_ID"], Criteria::EQUAL); + } + + if ($sortField && $sortField != "") { + switch ($sortField) { + case "CLIENT_NAME": + case "CLIENT_DESCRIPTION": + $sortField = OauthClientsPeer::TABLE_NAME . "." . $sortField; + break; + default: + $sortField = OauthAccessTokensPeer::TABLE_NAME . "." . $sortField; + break; + } + } else { + $sortField = OauthClientsPeer::CLIENT_NAME; + } + + if ($sortDir && $sortDir == "DESC") { + $criteria->addDescendingOrderByColumn($sortField); + } else { + $criteria->addAscendingOrderByColumn($sortField); + } + + //Number records total + $criteriaCount = clone $criteria; + $criteriaCount->clearSelectColumns(); + $criteriaCount->addSelectColumn("COUNT(" . OauthAccessTokensPeer::ACCESS_TOKEN . ") AS NUM_REC"); + + $rsCriteriaCount = OauthAccessTokensPeer::doSelectRS($criteriaCount); + $rsCriteriaCount->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + $rsCriteriaCount->next(); + $row = $rsCriteriaCount->getRow(); + + $numRecTotal = $row["NUM_REC"]; + + //SQL + if ($start && $limit && $limit > 0) { + $criteria->setOffset($start); + $criteria->setLimit($limit); + } + + $rsCriteria = OauthAccessTokensPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + $arrayData = array(); + + while ($rsCriteria->next()) { + $arrayData[] = $rsCriteria->getRow(); + } + + return array("numRecTotal" => $numRecTotal, "data" => $arrayData); + } +} + +// OauthAccessTokens -} // OauthAccessTokens diff --git a/workflow/engine/classes/model/OauthClients.php b/workflow/engine/classes/model/OauthClients.php index 3d7862c17..448101ea1 100644 --- a/workflow/engine/classes/model/OauthClients.php +++ b/workflow/engine/classes/model/OauthClients.php @@ -1,12 +1,11 @@ toArray(BasePeer::TYPE_FIELDNAME); + $this->fromArray($arrayField, BasePeer::TYPE_FIELDNAME); + $this->setNew(false); + + return $arrayField; + } else { + throw (new Exception("The row \"$oauthClientId\" in table OAUTH_CLIENTS doesn't exist!")); + } + } catch (Exception $e) { + throw $e; + } + } + + public function create($arrayData) + { + $cnn = Propel::getConnection(OauthClientsPeer::DATABASE_NAME); + + try { + $cnn->begin(); + + $id = G::generateCode(32, "ALPHA"); + $secret = G::generateUniqueID(); + + $this->setClientId($id); + $this->setClientSecret($secret); + $this->setClientName($arrayData["CLIENT_NAME"]); + $this->setClientDescription($arrayData["CLIENT_DESCRIPTION"]); + $this->setClientWebsite($arrayData["CLIENT_WEBSITE"]); + $this->setRedirectUri($arrayData["REDIRECT_URI"]); + $this->setUsrUid($arrayData["USR_UID"]); + + if ($this->validate()) { + $result = $this->save(); + $cnn->commit(); + + return array("CLIENT_ID" => $id, "CLIENT_SECRET" => $secret); + } else { + $cnn->rollback(); + + throw (new Exception("Failed Validation in class \"" . get_class($this) . "\".")); + } + } catch (Exception $e) { + $cnn->rollback(); + + throw $e; + } + } + + public function update($arrayData) + { + $cnn = Propel::getConnection(OauthClientsPeer::DATABASE_NAME); + + try { + $cnn->begin(); + + $this->load($arrayData["CLIENT_ID"]); + $this->fromArray($arrayData, BasePeer::TYPE_FIELDNAME); + + if ($this->validate()) { + if (isset($arrayData["CLIENT_NAME"])) { + $this->setClientName($arrayData["CLIENT_NAME"]); + } + + if (isset($arrayData["CLIENT_DESCRIPTION"])) { + $this->setClientDescription($arrayData["CLIENT_DESCRIPTION"]); + } + + if (isset($arrayData["CLIENT_WEBSITE"])) { + $this->setClientWebsite($arrayData["CLIENT_WEBSITE"]); + } + + if (isset($arrayData["REDIRECT_URI"])) { + $this->setRedirectUri($arrayData["REDIRECT_URI"]); + } + + $result = $this->save(); + $result = ($result == 0)? (($contentResult > 0)? 1 : 0) : $result; + + $cnn->commit(); + + return $result; + } else { + $cnn->rollback(); + + throw (new Exception("Failed Validation in class \"" . get_class($this) . "\".")); + } + } catch (Exception $e) { + $cnn->rollback(); + + throw $e; + } + } + + public function remove($oauthClientId) + { + $cnn = Propel::getConnection(OauthClientsPeer::DATABASE_NAME); + + try { + $oclient = OauthClientsPeer::retrieveByPK($oauthClientId); + + if (!is_null($oclient)) { + $cnn->begin(); + + $result = $oclient->delete(); + $cnn->commit(); + + return $result; + } else { + throw (new Exception("The row \"$oauthClientId\" in table OAUTH_CLIENTS doesn't exist!")); + } + } catch (Exception $e) { + $cnn->rollback(); + + throw $e; + } + } + + public function getAll($arrayFilterData = array(), $sortField = "", $sortDir = "", $start = 0, $limit = 25) + { + //SQL + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(OauthClientsPeer::CLIENT_ID); + $criteria->addSelectColumn(OauthClientsPeer::CLIENT_SECRET); + $criteria->addSelectColumn(OauthClientsPeer::CLIENT_NAME); + $criteria->addSelectColumn(OauthClientsPeer::CLIENT_DESCRIPTION); + $criteria->addSelectColumn(OauthClientsPeer::CLIENT_WEBSITE); + $criteria->addSelectColumn(OauthClientsPeer::REDIRECT_URI); + $criteria->addSelectColumn(OauthClientsPeer::USR_UID); + + if ($arrayFilterData && isset($arrayFilterData["USR_UID"]) && $arrayFilterData["USR_UID"] != "") { + $criteria->add(OauthClientsPeer::USR_UID, $arrayFilterData["USR_UID"], Criteria::EQUAL); + } + + if ($arrayFilterData && isset($arrayFilterData["SEARCH"]) && $arrayFilterData["SEARCH"] != "") { + //$criteria->add( + // $criteria->getNewCriterion(OauthClientsPeer::CLIENT_NAME, "%" . $arrayFilterData["SEARCH"] . "%", Criteria::LIKE)->addOr( + // $criteria->getNewCriterion(OauthClientsPeer::CLIENT_DESCRIPTION, "%" . $arrayFilterData["SEARCH"] . "%", Criteria::LIKE))->addOr( + // $criteria->getNewCriterion(OauthClientsPeer::CLIENT_WEBSITE, "%" . $arrayFilterData["SEARCH"] . "%", Criteria::LIKE))->addOr( + // $criteria->getNewCriterion(OauthClientsPeer::REDIRECT_URI, "%" . $arrayFilterData["SEARCH"] . "%", Criteria::LIKE)) + //); + $criteria->add( + $criteria->getNewCriterion(OauthClientsPeer::CLIENT_NAME, "%" . $arrayFilterData["SEARCH"] . "%", Criteria::LIKE)->addOr( + $criteria->getNewCriterion(OauthClientsPeer::CLIENT_DESCRIPTION, "%" . $arrayFilterData["SEARCH"] . "%", Criteria::LIKE)) + ); + } + + $sortField = ($sortField && $sortField != "")? OauthClientsPeer::TABLE_NAME . "." . $sortField : OauthClientsPeer::CLIENT_NAME; + + if ($sortDir && $sortDir == "DESC") { + $criteria->addDescendingOrderByColumn($sortField); + } else { + $criteria->addAscendingOrderByColumn($sortField); + } + + //Number records total + $criteriaCount = clone $criteria; + $criteriaCount->clearSelectColumns(); + $criteriaCount->addSelectColumn("COUNT(" . OauthClientsPeer::CLIENT_ID . ") AS NUM_REC"); + + $rsCriteriaCount = OauthClientsPeer::doSelectRS($criteriaCount); + $rsCriteriaCount->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + $rsCriteriaCount->next(); + $row = $rsCriteriaCount->getRow(); + + $numRecTotal = $row["NUM_REC"]; + + //SQL + if ($start && $limit && $limit > 0) { + $criteria->setOffset($start); + $criteria->setLimit($limit); + } + + $rsCriteria = OauthClientsPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + $arrayData = array(); + + while ($rsCriteria->next()) { + $arrayData[] = $rsCriteria->getRow(); + } + + return array("numRecTotal" => $numRecTotal, "data" => $arrayData); + } +} + +// OauthClients -} // OauthClients diff --git a/workflow/engine/methods/oauth2/accessTokenSetup.php b/workflow/engine/methods/oauth2/accessTokenSetup.php new file mode 100644 index 000000000..5d56c4fd4 --- /dev/null +++ b/workflow/engine/methods/oauth2/accessTokenSetup.php @@ -0,0 +1,17 @@ + "view_processes", "label" => "View Processes"), + array("value" => "edit_processes", "label" => "Edit Processes") +); + +$headPublisher = &headPublisher::getSingleton(); +$headPublisher->addContent("oauth2" . PATH_SEP . "accessTokenSetup"); //Adding a HTML file .html +$headPublisher->addExtJsScript("oauth2" . PATH_SEP . "accessTokenSetup", false); //Adding a JavaScript file .js +$headPublisher->assign("CONFIG", $config); +$headPublisher->assign("SCOPE", $arrayScope); + +G::RenderPage("publish", "extJs"); + diff --git a/workflow/engine/methods/oauth2/accessTokenSetupAjax.php b/workflow/engine/methods/oauth2/accessTokenSetupAjax.php new file mode 100644 index 000000000..eb9adb559 --- /dev/null +++ b/workflow/engine/methods/oauth2/accessTokenSetupAjax.php @@ -0,0 +1,63 @@ + $oauthAccessTokenId, + "SCOPE" => $scope + ); + + $oatoken = new OauthAccessTokens(); + $result = $oatoken->update($arrayData); + + $response["status"] = "OK"; + } catch (Exception $e) { + $response["status"] = "ERROR"; + $response["message"] = $e->getMessage(); + } + break; + case "DEL": + $oauthAccessTokenId = $_POST["oauthAccessTokenId"]; + + try { + $oatoken = new OauthAccessTokens(); + $result = $oatoken->remove($oauthAccessTokenId); + + $response["status"] = "OK"; + } catch (Exception $e) { + $response["status"] = "ERROR"; + $response["message"] = $e->getMessage(); + } + break; + case "LST": + $pageSize = $_POST["pageSize"]; + + $sortField = (isset($_POST["sort"]))? $_POST["sort"]: ""; + $sortDir = (isset($_POST["dir"]))? $_POST["dir"]: ""; + $start = (isset($_POST["start"]))? $_POST["start"]: 0; + $limit = (isset($_POST["limit"]))? $_POST["limit"]: $pageSize; + + try { + $oatoken = new OauthAccessTokens(); + $result = $oatoken->getAll(array("USER_ID" => $_SESSION["USER_LOGGED"]), $sortField, $sortDir, $start, $limit); + + $response["status"] = "OK"; + $response["success"] = true; + $response["resultTotal"] = $result["numRecTotal"]; + $response["resultRoot"] = $result["data"]; + } catch (Exception $e) { + $response["status"] = "ERROR"; + $response["message"] = $e->getMessage(); + } + break; +} + +echo G::json_encode($response); + diff --git a/workflow/engine/methods/oauth2/clientSetup.php b/workflow/engine/methods/oauth2/clientSetup.php new file mode 100644 index 000000000..dd49910c9 --- /dev/null +++ b/workflow/engine/methods/oauth2/clientSetup.php @@ -0,0 +1,12 @@ +addContent("oauth2" . PATH_SEP . "clientSetup"); //Adding a HTML file .html +$headPublisher->addExtJsScript("oauth2" . PATH_SEP . "clientSetup", false); //Adding a JavaScript file .js +$headPublisher->assign("CONFIG", $config); +$headPublisher->assign("CREATE_CLIENT", (isset($_GET["create_app"]))? 1 : 0); + +G::RenderPage("publish", "extJs"); + diff --git a/workflow/engine/methods/oauth2/clientSetupAjax.php b/workflow/engine/methods/oauth2/clientSetupAjax.php new file mode 100644 index 000000000..890cb660c --- /dev/null +++ b/workflow/engine/methods/oauth2/clientSetupAjax.php @@ -0,0 +1,97 @@ + "", + "CLIENT_NAME" => $name, + "CLIENT_DESCRIPTION" => $description, + "CLIENT_WEBSITE" => $webSite, + "REDIRECT_URI" => $redirectUri, + "USR_UID" => $_SESSION["USER_LOGGED"] + ); + + $oclient = new OauthClients(); + $result = $oclient->create($arrayData); + + $response["status"] = "OK"; + $response["data"] = $result; + } catch (Exception $e) { + $response["status"] = "ERROR"; + $response["message"] = $e->getMessage(); + } + break; + case "UPD": + $oauthClientId = $_POST["oauthClientId"]; + $name = $_POST["name"]; + $description = $_POST["description"]; + $webSite = $_POST["webSite"]; + $redirectUri = $_POST["redirectUri"]; + + try { + $arrayData = array( + "CLIENT_ID" => $oauthClientId, + "CLIENT_NAME" => $name, + "CLIENT_DESCRIPTION" => $description, + "CLIENT_WEBSITE" => $webSite, + "REDIRECT_URI" => $redirectUri, + "USR_UID" => $_SESSION["USER_LOGGED"] + ); + + $oclient = new OauthClients(); + $result = $oclient->update($arrayData); + + $response["status"] = "OK"; + } catch (Exception $e) { + $response["status"] = "ERROR"; + $response["message"] = $e->getMessage(); + } + break; + case "DEL": + $oauthClientId = $_POST["oauthClientId"]; + + try { + $oclient = new OauthClients(); + $result = $oclient->remove($oauthClientId); + + $response["status"] = "OK"; + } catch (Exception $e) { + $response["status"] = "ERROR"; + $response["message"] = $e->getMessage(); + } + break; + case "LST": + $pageSize = $_POST["pageSize"]; + $search = $_POST["search"]; + + $sortField = (isset($_POST["sort"]))? $_POST["sort"]: ""; + $sortDir = (isset($_POST["dir"]))? $_POST["dir"]: ""; + $start = (isset($_POST["start"]))? $_POST["start"]: 0; + $limit = (isset($_POST["limit"]))? $_POST["limit"]: $pageSize; + + try { + $oclient = new OauthClients(); + $result = $oclient->getAll(array("USR_UID" => $_SESSION["USER_LOGGED"], "SEARCH" => $search), $sortField, $sortDir, $start, $limit); + + $response["status"] = "OK"; + $response["success"] = true; + $response["resultTotal"] = $result["numRecTotal"]; + $response["resultRoot"] = $result["data"]; + } catch (Exception $e) { + $response["status"] = "ERROR"; + $response["message"] = $e->getMessage(); + } + break; +} + +echo G::json_encode($response); + diff --git a/workflow/engine/methods/users/userMain.php b/workflow/engine/methods/users/userMain.php new file mode 100644 index 000000000..a700ba780 --- /dev/null +++ b/workflow/engine/methods/users/userMain.php @@ -0,0 +1,8 @@ +addContent("users" . PATH_SEP . "userMain"); //Adding a html file .html +$headPublisher->addExtJsScript("users" . PATH_SEP . "userMain", true); //Adding a javascript file .js +$headPublisher->assign("CREATE_CLIENT", (isset($_GET["create_app"]))? 1 : 0); + +G::RenderPage("publish", "extJs"); + diff --git a/workflow/engine/templates/oauth2/accessTokenSetup.html b/workflow/engine/templates/oauth2/accessTokenSetup.html new file mode 100644 index 000000000..5b48e8983 --- /dev/null +++ b/workflow/engine/templates/oauth2/accessTokenSetup.html @@ -0,0 +1,2 @@ +
+ diff --git a/workflow/engine/templates/oauth2/accessTokenSetup.js b/workflow/engine/templates/oauth2/accessTokenSetup.js new file mode 100644 index 000000000..ea35bdc83 --- /dev/null +++ b/workflow/engine/templates/oauth2/accessTokenSetup.js @@ -0,0 +1,434 @@ +Ext.namespace("accessTokenSetup"); + +accessTokenSetup.application = { + init: function () + { + var OACCESSTOKENOPTION = ""; + var loadMaskData = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING_GRID")}); + + function oauthAccessTokenProcessAjax(option, oauthAccessTokenId) + { + //Message + var msg = ""; + + switch (option) { + case "UPD": + msg = "Update data..."; + break; + case "DEL": + msg = "Delete data..."; + break; + //case "LST": + // break; + } + + var loadMaskAux = new Ext.LoadMask(Ext.getBody(), {msg: msg}); + loadMaskAux.show(); + + //Data + var p; + + switch (option) { + case "UPD": + var arrayCheckbox = Ext.getCmp("chkgrpScope").getValue(); + var scope = ""; + + for (var i = 0; i <= arrayCheckbox.length - 1; i++) { + scope = scope + ((scope != "")? " " : "") + arrayCheckbox[i].value; + } + + p = { + option: option, + oauthAccessTokenId: oauthAccessTokenId, + scope: scope + }; + break; + case "DEL": + p = { + option: option, + oauthAccessTokenId: oauthAccessTokenId + }; + break; + //case "LST": + // break; + } + + Ext.Ajax.request({ + url: "../oauth2/accessTokenSetupAjax", + method: "POST", + params: p, + + success: function (response, opts) + { + var dataResponse = Ext.util.JSON.decode(response.responseText); + + switch (option) { + case "UPD": + case "DEL": + if (dataResponse.status) { + if (dataResponse.status == "OK") { + pagingData.moveFirst(); + } else { + Ext.MessageBox.alert(_("ID_ALERT"), dataResponse.message); + } + } + break; + //case "LST": + // break; + } + + loadMaskAux.hide(); + }, + failure: function (response, opts) + { + loadMaskAux.hide(); + } + }); + } + + function oauthAccessTokenSetForm(option, oauthAccessTokenId) + { + switch (option) { + case "UPD": + var record = grdpnlMain.getSelectionModel().getSelected(); + + if (typeof(record) != "undefined") { + Ext.getCmp("oauthAccessTokenId").setValue(record.get("ACCESS_TOKEN")); //oauthAccessTokenId + Ext.getCmp("lblClientName").setText(record.get("CLIENT_NAME")); + + winData.setTitle("Edit Application"); + winData.show(); + + Ext.getCmp("btnSubmit").btnEl.dom.innerHTML = "Edit Application"; + + for (var i = 0; i <= SCOPE.length - 1; i++) { + Ext.getCmp("chkgrpScope").setValue("chk" + SCOPE[i].value, false) + } + + var arrayScope = record.get("SCOPE").split(" "); + + for (var i = 0; i <= arrayScope.length - 1; i++) { + Ext.getCmp("chkgrpScope").setValue("chk" + arrayScope[i], true); + } + } + break; + } + } + + //Variables + var pageSize = parseInt(CONFIG.pageSize); + + //Stores + var storeData = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: "../oauth2/accessTokenSetupAjax", + method: "POST" + }), + + //baseParams: {"option": "LST", "pageSize": pageSize}, + + reader: new Ext.data.JsonReader({ + totalProperty: "resultTotal", + root: "resultRoot", + fields: [ + {name: "ACCESS_TOKEN", type: "string"}, + {name: "CLIENT_ID", type: "string"}, + {name: "USER_ID", type: "string"}, + {name: "EXPIRES", type: "string"}, + {name: "SCOPE", type: "string"}, + {name: "CLIENT_NAME", type: "string"}, + {name: "CLIENT_DESCRIPTION", type: "string"} + ] + }), + + //autoLoad: true, //First call + remoteSort: true, + + listeners: { + beforeload: function (store, opt) + { + loadMaskData.show(); + + this.baseParams = { + option: "LST", + pageSize: pageSize + }; + }, + load: function (store, record, opt) + { + loadMaskData.hide(); + } + } + }); + + var storePageSize = new Ext.data.SimpleStore({ + fields: ["size"], + data: [["20"], ["30"], ["40"], ["50"], ["100"]], + autoLoad: true + }); + + var chkgrpScopeItems = []; + + for (var i = 0; i <= SCOPE.length - 1; i++) { + chkgrpScopeItems.push( + { + xtype: "checkbox", + id: "chk" + SCOPE[i].value, + name: "chk" + SCOPE[i].value, + value: SCOPE[i].value, + boxLabel: SCOPE[i].label + } + ); + } + + //Components + var winData = new Ext.Window({ + layout: "fit", + width: 400, + height: 250, + //title: "", + modal: true, + resizable: false, + closeAction: "hide", + + items: [ + new Ext.FormPanel({ + id: "frmOauthAccessToken", + + frame: true, + labelAlign: "right", + labelWidth: 160, + autoWidth: true, + autoScroll: false, + + defaults: {width: 200}, + + items: [ + { + xtype: "hidden", + id: "oauthAccessTokenId", + name: "oauthAccessTokenId", + }, + { + xtype: "label", + id: "lblClientName", + + fieldLabel: "Application" + }, + { + xtype: "checkboxgroup", + id: "chkgrpScope", + name: "chkgrpScope", + + fieldLabel: "This Application Can Perform", + columns: 1, + items: chkgrpScopeItems + } + ] + }) + ], + buttons: [ + { + id: "btnSubmit", + //text: "", + handler: function () + { + oauthAccessTokenProcessAjax(OACCESSTOKENOPTION, Ext.getCmp("oauthAccessTokenId").getValue()); + + winData.hide(); + } + }, + { + text: _("ID_CANCEL"), + handler: function () + { + winData.hide(); + } + } + ] + }); + + 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"]); + + pagingData.pageSize = pageSize; + pagingData.moveFirst(); + } + } + }); + + var pagingData = new Ext.PagingToolbar({ + id: "pagingData", + + pageSize: pageSize, + store: storeData, + displayInfo: true, + displayMsg: "Displaying data " + "{" + "0" + "}" + " - " + "{" + "1" + "}" + " of " + "{" + "2" + "}", + emptyMsg: "No data to display", + items: ["-", "Page size:", cboPageSize] + }); + + var cmodel = new Ext.grid.ColumnModel({ + defaults: { + sortable: true + }, + + columns: [ + {id: "ACCESS_TOKEN", dataIndex: "ACCESS_TOKEN", hidden: true, hideable: false}, + {id: "CLIENT_ID", dataIndex: "CLIENT_ID", hidden: true, hideable: false}, + {id: "CLIENT_NAME", dataIndex: "CLIENT_NAME", header: "Application", width: 200, align: "left"}, + {id: "CLIENT_DESCRIPTION", dataIndex: "CLIENT_DESCRIPTION", header: "Description", width: 250, align: "left"}, + {id: "USER_ID", dataIndex: "USER_ID", hidden: true, hideable: false}, + {id: "EXPIRES", dataIndex: "EXPIRES", hidden: true, hideable: false}, + {id: "SCOPE", dataIndex: "SCOPE", hidden: true, hideable: false}, + { + id: "ACTION", + dataIndex: "ACCESS_TOKEN", + header: "", + sortable: false, + menuDisabled: true, + hideable: false, + //width: 75, + //align: "center", + renderer: function (value, metaData, record, rowIndex, colIndex, store) + { + var id1 = Ext.id(); + var id2 = Ext.id(); + + setTimeout( + function () + { + var btn1 = new Ext.Button({ + text: "Edit", + iconCls: "button_menu_ext ss_sprite ss_pencil", + renderTo: id1, + + handler: function () + { + var sm = grdpnlMain.getSelectionModel(); + sm.selectRow(rowIndex, true); + + var record = grdpnlMain.getSelectionModel().getSelected(); + + if (typeof(record) != "undefined") { + OACCESSTOKENOPTION = "UPD"; + + oauthAccessTokenSetForm(OACCESSTOKENOPTION, record.get("ACCESS_TOKEN")); + } + } + }); + + var btn2 = new Ext.Button({ + text: "Delete", + iconCls: "button_menu_ext ss_sprite ss_cross", + renderTo: id2, + + handler: function () + { + var sm = grdpnlMain.getSelectionModel(); + sm.selectRow(rowIndex, true); + + var record = grdpnlMain.getSelectionModel().getSelected(); + + if (typeof(record) != "undefined") { + Ext.MessageBox.confirm( + _("ID_CONFIRM"), + "Do you want to delete selected Application?", + function (btn) + { + if (btn == "yes") { + OACCESSTOKENOPTION = "DEL"; + + oauthAccessTokenProcessAjax(OACCESSTOKENOPTION, record.get("ACCESS_TOKEN")); + } + } + ); + } + } + }); + }, + 5 + ); + + return "
"; + } + } + ] + }); + + var smodel = new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + // + } + }); + + var grdpnlMain = new Ext.grid.GridPanel({ + id: "grdpnlMain", + + store: storeData, + colModel: cmodel, + selModel: smodel, + + columnLines: true, + viewConfig: {forceFit: true}, //Expand all columns + enableColumnResize: true, + enableHdMenu: true, //Menu of the column + + //tbar: ["->", txtSearch, btnTextClear, btnSearch], + //bbar: pagingData, + + //style: "margin: 0 auto 0 auto;", + //width: 550, + //height: 450, + title: "
" + "Applications" + "
", + border: false, + + listeners: { + afterrender: function (grid) + { + var btn = new Ext.Button({ + text: " " + "Setup My Applications", + iconCls: "button_menu_ext ss_sprite ss_cog", + renderTo: "divClientSetup", + + handler: function () + { + location.href = "clientSetup"; + } + }); + } + } + }); + + //Menu context + + //Initialize events + cboPageSize.setValue(pageSize); + + grdpnlMain.store.load(); + + //Load all panels + var viewport = new Ext.Viewport({ + layout: "fit", + autoScroll: false, + items: [grdpnlMain] + }); + } +} + +Ext.onReady(accessTokenSetup.application.init, accessTokenSetup.application); + diff --git a/workflow/engine/templates/oauth2/clientSetup.html b/workflow/engine/templates/oauth2/clientSetup.html new file mode 100644 index 000000000..281c6866c --- /dev/null +++ b/workflow/engine/templates/oauth2/clientSetup.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/workflow/engine/templates/oauth2/clientSetup.js b/workflow/engine/templates/oauth2/clientSetup.js new file mode 100644 index 000000000..4ddafcd56 --- /dev/null +++ b/workflow/engine/templates/oauth2/clientSetup.js @@ -0,0 +1,701 @@ +Ext.namespace("clientSetup"); + +clientSetup.application = { + init: function () + { + var OCLIENTOPTION = ""; + var loadMaskData = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING_GRID")}); + + function oauthClientProcessAjax(option, oauthClientId) + { + //Message + var msg = ""; + + switch (option) { + case "INS": + msg = "Insert data..."; + break; + case "UPD": + msg = "Update data..."; + break; + case "DEL": + msg = "Delete data..."; + break; + //case "LST": + // break; + } + + var loadMaskAux = new Ext.LoadMask(Ext.getBody(), {msg: msg}); + loadMaskAux.show(); + + //Data + var p; + + switch (option) { + case "INS": + p = { + option: option, + name: Ext.getCmp("txtName").getValue(), + description: Ext.getCmp("txtDescription").getValue(), + webSite: Ext.getCmp("txtWebSite").getValue(), + redirectUri: Ext.getCmp("txtRedirectUri").getValue() + }; + break; + case "UPD": + p = { + option: option, + oauthClientId: oauthClientId, + name: Ext.getCmp("txtName").getValue(), + description: Ext.getCmp("txtDescription").getValue(), + webSite: Ext.getCmp("txtWebSite").getValue(), + redirectUri: Ext.getCmp("txtRedirectUri").getValue() + }; + break; + case "DEL": + p = { + option: option, + oauthClientId: oauthClientId + }; + break; + //case "LST": + // break; + } + + Ext.Ajax.request({ + url: "../oauth2/clientSetupAjax", + method: "POST", + params: p, + + success: function (response, opts) + { + var dataResponse = Ext.util.JSON.decode(response.responseText); + + switch (option) { + case "INS": + case "UPD": + case "DEL": + if (dataResponse.status) { + if (dataResponse.status == "OK") { + pagingData.moveFirst(); + + switch (option) { + case "INS": + dataResponse.data.CLIENT_NAME = Ext.getCmp("txtName").getValue(); + + insertSuccessView(dataResponse.data); + break; + } + } else { + Ext.MessageBox.alert(_("ID_ALERT"), dataResponse.message); + } + } + break; + //case "LST": + // break; + } + + loadMaskAux.hide(); + }, + failure: function (response, opts) + { + loadMaskAux.hide(); + } + }); + } + + function oauthClientSetForm(option, oauthClientId) + { + switch (option) { + case "INS": + Ext.getCmp("oauthClientId").setValue(""); + Ext.getCmp("txtName").setValue(""); + Ext.getCmp("txtDescription").setValue(""); + Ext.getCmp("txtWebSite").setValue(""); + Ext.getCmp("txtRedirectUri").setValue(""); + + Ext.getCmp("txtName").allowBlank = true; + + winData.setTitle("New Application"); + winData.show(); + + Ext.getCmp("btnSubmit").btnEl.dom.innerHTML = "Register Application"; + + Ext.getCmp("txtName").allowBlank = false; + break; + case "UPD": + var record = grdpnlMain.getSelectionModel().getSelected(); + + if (typeof(record) != "undefined") { + Ext.getCmp("oauthClientId").setValue(record.get("CLIENT_ID")); //oauthClientId + Ext.getCmp("txtName").setValue(record.get("CLIENT_NAME")); + Ext.getCmp("txtDescription").setValue(record.get("CLIENT_DESCRIPTION")); + Ext.getCmp("txtWebSite").setValue(record.get("CLIENT_WEBSITE")); + Ext.getCmp("txtRedirectUri").setValue(record.get("REDIRECT_URI")); + + Ext.getCmp("txtName").allowBlank = true; + + winData.setTitle("Edit Application"); + winData.show(); + + Ext.getCmp("btnSubmit").btnEl.dom.innerHTML = "Edit Application"; + + Ext.getCmp("txtName").allowBlank = false; + } + break; + } + } + + function insertSuccessView(data) + { + var html = "Your application \"" + data.CLIENT_NAME + "\" was registered successfully!" + "

"; + html = html + "

" + "Application Credentials" + "


"; + html = html + "  * " + "Client ID" + ": " + data.CLIENT_ID + "
"; + html = html + "  * " + "Client Secret" + ": " + data.CLIENT_SECRET + "

"; + html = html + "

" + "Next Steps" + "


"; + html = html + "  * " + "Make authorize requests" + "
"; + html = html + "  * " + "Get access tokens" + "
"; + + var formItems = Ext.getCmp("frmInsertSuccessView").form.items; + formItems.items[0].setValue(html); + + winInsertSuccess.show(); + } + + function detailView() + { + var record = grdpnlMain.getSelectionModel().getSelected(); + + if (typeof(record) != "undefined") { + var html = "Your application \"" + record.get("CLIENT_NAME") + "\"" + "

"; + html = html + "

" + "Application Details" + "


"; + html = html + "  * " + "Description" + ": " + record.get("CLIENT_DESCRIPTION") + "
"; + html = html + "  * " + "Web Site" + ": " + record.get("CLIENT_WEBSITE") + "
"; + html = html + "  * " + "Callback URL" + ": " + record.get("REDIRECT_URI") + "

"; + html = html + "

" + "Application Credentials" + "


"; + html = html + "  * " + "Client ID" + ": " + record.get("CLIENT_ID") + "
"; + html = html + "  * " + "Client Secret" + ": " + record.get("CLIENT_SECRET") + "

"; + + var formItems = Ext.getCmp("frmDetailView").form.items; + formItems.items[0].setValue(html); + + winDetail.show(); + } + } + + function onMnuContext(grid, rowIndex, e) + { + e.stopEvent(); + + var coords = e.getXY(); + + mnuContext.showAt([coords[0], coords[1]]); + } + + //Variables + var pageSize = parseInt(CONFIG.pageSize); + + //Stores + var storeData = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: "../oauth2/clientSetupAjax", + method: "POST" + }), + + //baseParams: {"option": "LST", "pageSize": pageSize}, + + reader: new Ext.data.JsonReader({ + totalProperty: "resultTotal", + root: "resultRoot", + fields: [ + {name: "CLIENT_ID", type: "string"}, + {name: "CLIENT_SECRET", type: "string"}, + {name: "CLIENT_NAME", type: "string"}, + {name: "CLIENT_DESCRIPTION", type: "string"}, + {name: "CLIENT_WEBSITE", type: "string"}, + {name: "REDIRECT_URI", type: "string"}, + {name: "USR_UID", type: "string"} + ] + }), + + //autoLoad: true, //First call + remoteSort: true, + + listeners: { + beforeload: function (store, opt) + { + loadMaskData.show(); + + btnEdit.setDisabled(true); + btnDelete.setDisabled(true); + btnDetail.setDisabled(true); + + this.baseParams = { + option: "LST", + pageSize: pageSize, + search: Ext.getCmp("txtSearch").getValue() + }; + }, + load: function (store, record, opt) + { + loadMaskData.hide(); + + if (CREATE_CLIENT == 1) { + OCLIENTOPTION = "INS"; + CREATE_CLIENT = 0; + + oauthClientSetForm(OCLIENTOPTION, ""); + } + } + } + }); + + var storePageSize = new Ext.data.SimpleStore({ + fields: ["size"], + data: [["20"], ["30"], ["40"], ["50"], ["100"]], + autoLoad: true + }); + + //Components + var winData = new Ext.Window({ + layout: "fit", + width: 550, + height: 475, + //title: "", + modal: true, + resizable: false, + closeAction: "hide", + + items: [ + new Ext.FormPanel({ + id: "frmOauthClient", + + frame: true, + labelAlign: "right", + labelWidth: 80, + autoWidth: true, + //height: 395, + autoScroll: false, + + defaults: {width: 425}, + + items: [ + { + xtype: "hidden", + id: "oauthClientId", + name: "oauthClientId", + }, + { + xtype: "textfield", + id: "txtName", + name: "txtName", + + fieldLabel: "Name" + }, + { + xtype: "label", + + fieldLabel: " ", + labelSeparator: "", + + html: "" + "Your application name. This is used to attribute the source in user-facing authorization screens. 32 characters max." + "
" + }, + { + xtype: "textarea", + id: "txtDescription", + name: "txtDescription", + + fieldLabel: "Description", + height: 55 + }, + { + xtype: "label", + + fieldLabel: " ", + labelSeparator: "", + + html: "" + "Your application description, which will be shown in user-facing authorization screens. Between 10 and 200 characters max." + "
" + }, + { + xtype: "textfield", + id: "txtWebSite", + name: "txtWebSite", + + fieldLabel: "Web Site", + vtype: "url" + }, + { + xtype: "label", + + fieldLabel: " ", + labelSeparator: "", + + html: "" + "Your application's publicly accessible home page, where users can go to download, make use of, or find out more information about your application. This fully-qualified URL is used in the source attribution for request created by your application and will be shown in user-facing authorization screens. (If you don't have a URL yet, just put a placeholder here but remember to change it later.)" + "
" + }, + { + xtype: "textfield", + id: "txtRedirectUri", + name: "txtRedirectUri", + + fieldLabel: "Callback URL", + vtype: "url" + }, + { + xtype: "label", + + fieldLabel: " ", + labelSeparator: "", + + html: "" + "here should we return after successfully authenticating? For @Anywhere applications, only the domain specified in the callback will be used. OAuth 1.0a applications should explicitly specify their oauth_callback URL on the request token step, regardless of the value given here. To restrict your application from using callbacks, leave this field blank." + "" + } + ] + }) + ], + buttons: [ + { + id: "btnSubmit", + //text: "", + handler: function () + { + if (Ext.getCmp("frmOauthClient").getForm().isValid()) { + oauthClientProcessAjax(OCLIENTOPTION, Ext.getCmp("oauthClientId").getValue()); + + Ext.getCmp("txtName").allowBlank = true; + + winData.hide(); + } else { + Ext.MessageBox.alert(_("ID_INVALID_DATA"), _("ID_CHECK_FIELDS_MARK_RED")); + } + } + }, + { + text: _("ID_CANCEL"), + handler: function () + { + Ext.getCmp("txtName").allowBlank = true; + + winData.hide(); + } + } + ] + }); + + var winInsertSuccess = new Ext.Window({ + layout: "fit", + width: 450, + height: 300, + title: "Registration Success", + modal: true, + resizable: false, + closeAction: "hide", + + items: [ + new Ext.FormPanel({ + id: "frmInsertSuccessView", + + frame: true, + labelAlign: "right", + labelWidth: 1, + autoWidth: true, + //height: 395, + autoScroll: true, + items: [ + { + xtype: "displayfield", + fieldLabel: "" + } + ] + }) + ] + }); + + var winDetail = new Ext.Window({ + layout: "fit", + width: 450, + height: 300, + title: "Detail", + modal: true, + resizable: false, + closeAction: "hide", + + items: [ + new Ext.FormPanel({ + id: "frmDetailView", + + frame: true, + labelAlign: "right", + labelWidth: 1, + autoWidth: true, + //height: 395, + autoScroll: true, + items: [ + { + xtype: "displayfield", + fieldLabel: "" + } + ] + }) + ] + }); + + var btnNew = new Ext.Action({ + id: "btnNew", + + text: _("ID_NEW"), + iconCls: "button_menu_ext ss_sprite ss_add", + + handler: function () + { + OCLIENTOPTION = "INS"; + + oauthClientSetForm(OCLIENTOPTION, ""); + } + }); + + var btnEdit = new Ext.Action({ + id: "btnEdit", + + text: _("ID_EDIT"), + iconCls: "button_menu_ext ss_sprite ss_pencil", + + handler: function () + { + var record = grdpnlMain.getSelectionModel().getSelected(); + + if (typeof(record) != "undefined") { + OCLIENTOPTION = "UPD"; + + oauthClientSetForm(OCLIENTOPTION, record.get("CLIENT_ID")); + } + } + }); + + var btnDelete = new Ext.Action({ + id: "btnDelete", + + text: _("ID_DELETE"), + iconCls: "button_menu_ext ss_sprite ss_cross", + + handler: function () + { + var record = grdpnlMain.getSelectionModel().getSelected(); + + if (typeof(record) != "undefined") { + Ext.MessageBox.confirm( + _("ID_CONFIRM"), + "Do you want to delete selected Application?", + function (btn) + { + if (btn == "yes") { + OCLIENTOPTION = "DEL"; + + oauthClientProcessAjax(OCLIENTOPTION, record.get("CLIENT_ID")); + } + } + ); + } + } + }); + + var btnDetail = new Ext.Action({ + id: "btnDetail", + + text: _("ID_DETAIL"), + iconCls: "button_menu_ext ss_sprite ss_zoom", + + handler: function () + { + detailView(); + } + }); + + var btnSearch = new Ext.Action({ + id: "btnSearch", + + text: _("ID_SEARCH"), + + handler: function () + { + pagingData.moveFirst(); + } + }); + + var txtSearch = new Ext.form.TextField({ + id: "txtSearch", + + emptyText: _("ID_ENTER_SEARCH_TERM"), + width: 150, + allowBlank: true, + + listeners: { + specialkey: function (f, e) + { + if (e.getKey() == e.ENTER) { + pagingData.moveFirst(); + } + } + } + }); + + 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"]); + + pagingData.pageSize = pageSize; + pagingData.moveFirst(); + } + } + }); + + var pagingData = new Ext.PagingToolbar({ + id: "pagingData", + + pageSize: pageSize, + store: storeData, + displayInfo: true, + displayMsg: "Displaying data " + "{" + "0" + "}" + " - " + "{" + "1" + "}" + " of " + "{" + "2" + "}", + emptyMsg: "No data to display", + items: ["-", "Page size:", cboPageSize] + }); + + var cmodel = new Ext.grid.ColumnModel({ + defaults: { + sortable: true + }, + + columns: [ + {id: "CLIENT_ID", dataIndex: "CLIENT_ID", hidden: true, hideable: false}, + {id: "CLIENT_SECRET", dataIndex: "CLIENT_SECRET", hidden: true, hideable: false}, + {id: "CLIENT_NAME", dataIndex: "CLIENT_NAME", header: "Name", width: 200, align: "left"}, + {id: "CLIENT_DESCRIPTION", dataIndex: "CLIENT_DESCRIPTION", header: "Description", width: 250, align: "left"}, + {id: "CLIENT_WEBSITE", dataIndex: "CLIENT_WEBSITE", hidden: true, hideable: false}, + {id: "REDIRECT_URI", dataIndex: "REDIRECT_URI", hidden: true, hideable: false}, + {id: "USR_UID", dataIndex: "USR_UID", hidden: true, hideable: false} + ] + }); + + var smodel = new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function (sm) + { + btnEdit.setDisabled(false); + btnDelete.setDisabled(false); + btnDetail.setDisabled(false); + }, + rowdeselect: function (sm) + { + btnEdit.setDisabled(true); + btnDelete.setDisabled(true); + btnDetail.setDisabled(true); + } + } + }); + + var grdpnlMain = new Ext.grid.GridPanel({ + id: "grdpnlMain", + + store: storeData, + colModel: cmodel, + selModel: smodel, + + columnLines: true, + viewConfig: {forceFit: true}, //Expand all columns + enableColumnResize: true, + enableHdMenu: true, //Menu of the column + //autoExpandColumn: "CLIENT_DESCRIPTION", + + //tbar: [btnNew, "-", btnEdit, btnDelete, "-", btnDetail, "->", txtSearch, btnTextClear, btnSearch], + tbar: [btnNew, "-", btnEdit, btnDelete, "-", btnDetail], + //bbar: pagingData, + + //style: "margin: 0 auto 0 auto;", + //width: 550, + //height: 450, + title: "
" + "My Applications" + "
", + border: false, + + listeners: { + afterrender: function (grid) + { + var btn = new Ext.Button({ + text: " " + "Applications", + iconCls: "button_menu_ext ss_sprite ss_arrow_left", + renderTo: "divAccessTokenSetup", + + handler: function () + { + location.href = "accessTokenSetup"; + } + }); + }, + rowdblclick: function (grid, rowIndex, evt) + { + var record = grdpnlMain.getSelectionModel().getSelected(); + + if (typeof(record) != "undefined") { + OCLIENTOPTION = "UPD"; + + oauthClientSetForm(OCLIENTOPTION, record.get("CLIENT_ID")); + } + } + } + }); + + //Menu context + var mnuContext = new Ext.menu.Menu({ + id: "mnuContext", + + items: [btnEdit, btnDelete, "-", btnDetail] + }); + + //Initialize events + grdpnlMain.on( + "rowcontextmenu", + function (grid, rowIndex, evt) + { + var sm = grid.getSelectionModel(); + sm.selectRow(rowIndex, sm.isSelected(rowIndex)); + }, + this + ); + + grdpnlMain.addListener("rowcontextmenu", onMnuContext, this); + + cboPageSize.setValue(pageSize); + + grdpnlMain.store.load(); + + //Load all panels + var viewport = new Ext.Viewport({ + layout: "fit", + autoScroll: false, + items: [grdpnlMain] + }); + } +} + +Ext.onReady(clientSetup.application.init, clientSetup.application); + diff --git a/workflow/engine/templates/users/userMain.html b/workflow/engine/templates/users/userMain.html new file mode 100644 index 000000000..281c6866c --- /dev/null +++ b/workflow/engine/templates/users/userMain.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/workflow/engine/templates/users/userMain.js b/workflow/engine/templates/users/userMain.js new file mode 100644 index 000000000..b4f506cf4 --- /dev/null +++ b/workflow/engine/templates/users/userMain.js @@ -0,0 +1,74 @@ +Ext.namespace("userMain"); + +userMain.application = { + init: function () + { + var treepnlMenu = new Ext.tree.TreePanel({ + id: "treepnlMenu", + region: "west", + + //title: "", + width: 240, + collapsible: true, + collapseMode: "mini", + hideCollapseTool: true, + split: true, + rootVisible: false, + loader: new Ext.tree.TreeLoader(), + root: new Ext.tree.AsyncTreeNode({ + expanded: true, + children: [ + { + id: "nodeInfo", + text: "Personal Information", + leaf: true, + url: "../users/usersInit" + + }, + { + id: "nodeApplication", + text: "Applications", + leaf: true, + url: "../oauth2/accessTokenSetup" + } + ] + }), + listeners: { + click: function (node, evt) + { + document.getElementById("iframe").src = node.attributes.url; + }, + afterrender: function (treepnl) + { + var index = (CREATE_CLIENT == 1)? 1 : 0; + + var node = treepnl.getRootNode().childNodes[index]; + node.select(); + + setTimeout(function () { document.getElementById("iframe").src = (CREATE_CLIENT == 1)? "../oauth2/clientSetup?create_app" : node.attributes.url; }, 5); + } + } + }); + + var viewport = new Ext.Viewport({ + layout: "border", + items: [ + treepnlMenu, + { + xtype: "iframepanel", + id: "iframepnlIframe", + region: "center", + + frameConfig: { + name: "iframe", + id: "iframe" + }, + deferredRender: false + } + ] + }); + } +} + +Ext.onReady(userMain.application.init, userMain.application); + diff --git a/workflow/engine/templates/users/usersLoad.php b/workflow/engine/templates/users/usersLoad.php index 00511e2bd..b85953d3f 100644 --- a/workflow/engine/templates/users/usersLoad.php +++ b/workflow/engine/templates/users/usersLoad.php @@ -12,7 +12,7 @@ } - @@ -21,7 +21,7 @@ h = getStyle(document.getElementById('pm_menu'),'top'); h = h.replace("px", ""); h = parseInt(h) + 18; - if ( document.getElementById('pm_submenu') ) + if ( document.getElementById('pm_submenu') ) document.getElementById('pm_submenu').style.display = 'none'; document.documentElement.style.overflowY = 'hidden'; function autoResizeScreen()