From 2462e97e817bbb5b5f75748df2040af1d6421fbc Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Sat, 6 Mar 2021 11:26:43 +0100 Subject: [PATCH] rename IOClient to GPClient --- {IOMail => GPClient}/README.md | 0 GPClient/assets/scheme.html | 5 + {IOMail => GPClient}/build/debug/README.md | 0 GPClient/build/debug/main.js | 214 ++++++++++++++++++ GPClient/build/debug/package.json | 16 ++ GPClient/build/debug/scheme.html | 5 + {IOMail => GPClient}/build/release/IOMail.zip | Bin GPClient/coffees/main.coffee | 155 +++++++++++++ GPClient/package.json | 16 ++ {IOMail => GPClient}/project.json | 2 +- IOMail/assets/scheme.html | 5 - IOMail/build/debug/main.js | 1 - IOMail/build/debug/package.json | 16 -- IOMail/build/debug/scheme.html | 5 - IOMail/coffees/main.coffee | 9 - IOMail/package.json | 16 -- 16 files changed, 412 insertions(+), 53 deletions(-) rename {IOMail => GPClient}/README.md (100%) create mode 100644 GPClient/assets/scheme.html rename {IOMail => GPClient}/build/debug/README.md (100%) create mode 100644 GPClient/build/debug/main.js create mode 100644 GPClient/build/debug/package.json create mode 100644 GPClient/build/debug/scheme.html rename {IOMail => GPClient}/build/release/IOMail.zip (100%) create mode 100644 GPClient/coffees/main.coffee create mode 100644 GPClient/package.json rename {IOMail => GPClient}/project.json (85%) delete mode 100644 IOMail/assets/scheme.html delete mode 100644 IOMail/build/debug/main.js delete mode 100644 IOMail/build/debug/package.json delete mode 100644 IOMail/build/debug/scheme.html delete mode 100644 IOMail/coffees/main.coffee delete mode 100644 IOMail/package.json diff --git a/IOMail/README.md b/GPClient/README.md similarity index 100% rename from IOMail/README.md rename to GPClient/README.md diff --git a/GPClient/assets/scheme.html b/GPClient/assets/scheme.html new file mode 100644 index 0000000..90c61c9 --- /dev/null +++ b/GPClient/assets/scheme.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/IOMail/build/debug/README.md b/GPClient/build/debug/README.md similarity index 100% rename from IOMail/build/debug/README.md rename to GPClient/build/debug/README.md diff --git a/GPClient/build/debug/main.js b/GPClient/build/debug/main.js new file mode 100644 index 0000000..ddbaf1e --- /dev/null +++ b/GPClient/build/debug/main.js @@ -0,0 +1,214 @@ +(function() { + var ClientDialog, ClientListDialog, GPClient; + + ClientDialog = class ClientDialog extends this.OS.GUI.BasicDialog { + constructor() { + super("ClientDialog", ClientDialog.scheme); + } + + main() { + var el, i, inputs, len; + super.main(); + inputs = $(this.scheme).find("input[type=text]"); + if (this.data) { + for (i = 0, len = inputs.length; i < len; i++) { + el = inputs[i]; + if (this.data[el.name]) { + el.value = this.data[el.name]; + } + } + } + this.find("btncancel").onbtclick = () => { + return this.quit(); + }; + return this.find("btnok").onbtclick = (e) => { + var data, j, len1; + data = {}; + for (j = 0, len1 = inputs.length; j < len1; j++) { + el = inputs[j]; + if (el.value === "") { + return this.notify(__("Please enter all the fields")); + } + data[el.name] = el.value; + } + if (this.handle) { + this.handle(data); + } + return this.quit(); + }; + } + + }; + + ClientDialog.scheme = ` + +
+ +
+ + +
+ + +
+ + +
+
+
+
+
`; + + + ClientListDialog = class ClientListDialog extends this.OS.GUI.BasicDialog { + constructor() { + super("ClientListDialog", ClientListDialog.scheme); + } + + main() { + super.main(); + this.clist = this.find("client-list"); + this.clist.buttons = [ + { + text: "", + iconclass: "fa fa-plus-circle", + onbtclick: (e) => { + return this.openDialog(new ClientDialog(), + { + title: __("Add new client") + }).then((data) => { + //console.log(data) + this.parent.setting.clients.push(data); + return this.clist.data = this.parent.setting.clients; + }); + } + }, + { + text: "", + iconclass: "fa fa-minus-circle", + onbtclick: (e) => { + var index, + item; + item = this.clist.selectedItem; + index = this.clist.selected; + if (!item) { + return; + } + return this.ask({ + text: __("Do you realy want to delete: `{0}`", + item.data.text) + }).then((d) => { + if (!d) { + return; + } + this.parent.setting.clients.splice(index, + 1); + return this.clist.data = this.parent.setting.clients; + }); + } + }, + { + text: "", + iconclass: "fa fa-pencil-square-o", + onbtclick: (e) => { + var item; + item = this.clist.selectedItem; + if (!item) { + return; + } + return this.openDialog(new ClientDialog(), + { + title: __("Add new client"), + text: item.data.text, + url: item.data.url + }).then((data) => { + //console.log(data) + if (!data) { + return; + } + item.data.text = data.text; + item.data.url = data.url; + return this.clist.data = this.parent.setting.clients; + }); + } + } + ]; + this.find("btnswitch").onbtclick = (e) => { + var item; + item = this.clist.selectedItem; + if (!item) { + return; + } + this.parent.setting.curl = item.data.url; + this.parent.setting.cname = item.data.text; + this.parent.switchClient(); + return this.quit(); + }; + return this.clist.data = this.parent.setting.clients; + } + + }; + + ClientListDialog.scheme = ` + + +
+ +
+ +`; + + GPClient = class GPClient extends this.OS.application.BaseApplication { + constructor(args) { + super("GPClient", args); + } + + main() { + if (!this.setting.clients) { + this.setting.clients = []; + } + this.container = this.find("container"); + this.bindKey("CTRL-M", () => { + return this.openDialog(new ClientListDialog(), { + title: __("Client Manager") + }); + }); + return this.switchClient(); + } + + switchClient() { + if (this.setting.curl) { + this.container.src = this.setting.curl; + return this.scheme.apptitle = this.setting.cname; + } else { + return this.notify(__("No client selected, manager client in menu Options > Client manager")); + } + } + + menu() { + return [ + { + text: "__(Options)", + nodes: [ + { + text: "__(Client manager)", + shortcut: "C-M" + } + ], + onchildselect: (e) => { + return this.openDialog(new ClientListDialog(), + { + title: __("Client Manager") + }); + } + } + ]; + } + + }; + + GPClient.singleton = true; + + this.OS.register("GPClient", GPClient); + +}).call(this); diff --git a/GPClient/build/debug/package.json b/GPClient/build/debug/package.json new file mode 100644 index 0000000..5fb1e98 --- /dev/null +++ b/GPClient/build/debug/package.json @@ -0,0 +1,16 @@ +{ + "pkgname": "GPClient", + "app":"GPClient", + "name":"Generic Purpose client", + "description":"Generic Purpose client", + "info":{ + "author": "Xuan Sang LE", + "email": "mrsang@iohub.dev" + }, + "version":"0.1.0-a", + "category":"Internet", + "iconclass":"fa fa-globe", + "mimes":["none"], + "dependencies":[], + "locale": {} +} \ No newline at end of file diff --git a/GPClient/build/debug/scheme.html b/GPClient/build/debug/scheme.html new file mode 100644 index 0000000..90c61c9 --- /dev/null +++ b/GPClient/build/debug/scheme.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/IOMail/build/release/IOMail.zip b/GPClient/build/release/IOMail.zip similarity index 100% rename from IOMail/build/release/IOMail.zip rename to GPClient/build/release/IOMail.zip diff --git a/GPClient/coffees/main.coffee b/GPClient/coffees/main.coffee new file mode 100644 index 0000000..59f2411 --- /dev/null +++ b/GPClient/coffees/main.coffee @@ -0,0 +1,155 @@ +class ClientDialog extends this.OS.GUI.BasicDialog + constructor: () -> + super "ClientDialog", ClientDialog.scheme + + main: () -> + super.main() + + inputs = $(@scheme).find("input[type=text]") + + if @data + for el in inputs + el.value = @data[el.name] if @data[el.name] + + @find("btncancel").onbtclick = () => @quit() + + @find("btnok").onbtclick = (e) => + data = {} + for el in inputs + return @notify __("Please enter all the fields") if el.value is "" + data[el.name] = el.value + + @handle data if @handle + @quit() + +ClientDialog.scheme = """ + + +
+ +
+ + +
+ + +
+ + +
+
+
+
+
+""" +# + +class ClientListDialog extends this.OS.GUI.BasicDialog + constructor: () -> + super "ClientListDialog", ClientListDialog.scheme + + main: () -> + super.main() + @clist = @find("client-list") + @clist.buttons = [ + { + text: "", + iconclass: "fa fa-plus-circle", + onbtclick: (e) => + @openDialog(new ClientDialog(), { + title: __("Add new client") + }) + .then (data) => + #console.log(data) + @parent.setting.clients.push(data) + @clist.data = @parent.setting.clients + + }, + { + text: "", + iconclass: "fa fa-minus-circle", + onbtclick: (e) => + item = @clist.selectedItem + index = @clist.selected + return unless item + @ask({ text:__("Do you realy want to delete: `{0}`", item.data.text)}) + .then (d) => + return unless d + @parent.setting.clients.splice(index,1) + @clist.data = @parent.setting.clients + }, + { + text: "", + iconclass: "fa fa-pencil-square-o", + onbtclick: (e) => + item = @clist.selectedItem + return unless item + @openDialog(new ClientDialog(), { + title: __("Add new client"), + text: item.data.text, + url: item.data.url + }) + .then (data) => + #console.log(data) + return unless data + item.data.text = data.text + item.data.url = data.url + @clist.data = @parent.setting.clients + } + ] + @find("btnswitch").onbtclick = (e) => + item = @clist.selectedItem + return unless item + @parent.setting.curl = item.data.url + @parent.setting.cname = item.data.text + @parent.switchClient() + @quit() + @clist.data = @parent.setting.clients + +ClientListDialog.scheme = """ + + + +
+ +
+ + +""" +class GPClient extends this.OS.application.BaseApplication + constructor: ( args ) -> + super "GPClient", args + + main: () -> + @setting.clients = [] unless @setting.clients + @container = @find("container") + @bindKey "CTRL-M", () => + @openDialog new ClientListDialog(), { + title: __("Client Manager") + } + @switchClient() + + switchClient: () -> + if @setting.curl + @container.src = @setting.curl + @scheme.apptitle = @setting.cname + else + @notify __("No client selected, manager client in menu Options > Client manager") + + menu: () -> + [ + { + text: "__(Options)", + nodes: [ + { text: "__(Client manager)", shortcut: "C-M"} + ], + onchildselect: (e) => + @openDialog new ClientListDialog(), { + title: __("Client Manager") + } + } + ] + +GPClient.singleton = true + +this.OS.register "GPClient", GPClient \ No newline at end of file diff --git a/GPClient/package.json b/GPClient/package.json new file mode 100644 index 0000000..5fb1e98 --- /dev/null +++ b/GPClient/package.json @@ -0,0 +1,16 @@ +{ + "pkgname": "GPClient", + "app":"GPClient", + "name":"Generic Purpose client", + "description":"Generic Purpose client", + "info":{ + "author": "Xuan Sang LE", + "email": "mrsang@iohub.dev" + }, + "version":"0.1.0-a", + "category":"Internet", + "iconclass":"fa fa-globe", + "mimes":["none"], + "dependencies":[], + "locale": {} +} \ No newline at end of file diff --git a/IOMail/project.json b/GPClient/project.json similarity index 85% rename from IOMail/project.json rename to GPClient/project.json index 87ea05b..cd18b37 100644 --- a/IOMail/project.json +++ b/GPClient/project.json @@ -1,5 +1,5 @@ { - "name": "IOMail", + "name": "GPClient", "css": [], "javascripts": [], "coffees": ["coffees/main.coffee"], diff --git a/IOMail/assets/scheme.html b/IOMail/assets/scheme.html deleted file mode 100644 index a712243..0000000 --- a/IOMail/assets/scheme.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/IOMail/build/debug/main.js b/IOMail/build/debug/main.js deleted file mode 100644 index 50af420..0000000 --- a/IOMail/build/debug/main.js +++ /dev/null @@ -1 +0,0 @@ -(function(){var i;(i=class extends this.OS.application.BaseApplication{constructor(i){super("IOMail",i)}main(){}}).singleton=!0,this.OS.register("IOMail",i)}).call(this); \ No newline at end of file diff --git a/IOMail/build/debug/package.json b/IOMail/build/debug/package.json deleted file mode 100644 index b6be60d..0000000 --- a/IOMail/build/debug/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "pkgname": "IOMail", - "app":"IOMail", - "name":"IOHub mail", - "description":"IOHub mail", - "info":{ - "author": "", - "email": "" - }, - "version":"0.1.0-a", - "category":"Other", - "iconclass":"fa fa-envelope", - "mimes":["none"], - "dependencies":[], - "locale": {} -} \ No newline at end of file diff --git a/IOMail/build/debug/scheme.html b/IOMail/build/debug/scheme.html deleted file mode 100644 index a712243..0000000 --- a/IOMail/build/debug/scheme.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/IOMail/coffees/main.coffee b/IOMail/coffees/main.coffee deleted file mode 100644 index 831efc6..0000000 --- a/IOMail/coffees/main.coffee +++ /dev/null @@ -1,9 +0,0 @@ -class IOMail extends this.OS.application.BaseApplication - constructor: ( args ) -> - super "IOMail", args - - main: () -> - -IOMail.singleton = true - -this.OS.register "IOMail", IOMail \ No newline at end of file diff --git a/IOMail/package.json b/IOMail/package.json deleted file mode 100644 index b6be60d..0000000 --- a/IOMail/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "pkgname": "IOMail", - "app":"IOMail", - "name":"IOHub mail", - "description":"IOHub mail", - "info":{ - "author": "", - "email": "" - }, - "version":"0.1.0-a", - "category":"Other", - "iconclass":"fa fa-envelope", - "mimes":["none"], - "dependencies":[], - "locale": {} -} \ No newline at end of file