Skip to content
Snippets Groups Projects
Commit 8a3a7986 authored by rswindell's avatar rswindell
Browse files

Beautification of the Global Option and Area Options menus.

Some objectification of the edit_area() and edit_globals() functions, these
2 functions really should be merged since they appear to be mostly just a
copy/paste of one another. :-(
parent a4b368f1
No related branches found
No related tags found
No related merge requests found
...@@ -80,7 +80,7 @@ function set_location(obj) ...@@ -80,7 +80,7 @@ function set_location(obj)
case 1: case 1:
dir = null; dir = null;
while(dir !== undefined) { while(dir !== undefined) {
dir = uifc.input(WIN_SAV|WIN_MID, "Path", tickit.gcfg.path === undefined ? '' : tickit.gcfg.path, 1024, K_EDIT); dir = uifc.input(WIN_SAV|WIN_MID, "Path", obj.path === undefined ? '' : obj.path, 1024, K_EDIT);
if (dir != undefined) { if (dir != undefined) {
if (file_isdir(dir)) { if (file_isdir(dir)) {
delete obj.dir; delete obj.dir;
...@@ -199,6 +199,8 @@ function edit_uploader(obj) ...@@ -199,6 +199,8 @@ function edit_uploader(obj)
obj.uploader = tmp; obj.uploader = tmp;
} }
const menu_fmt = "%-20s %s";
function edit_area(obj, name) function edit_area(obj, name)
{ {
var cmd = 0; var cmd = 0;
...@@ -208,12 +210,12 @@ function edit_area(obj, name) ...@@ -208,12 +210,12 @@ function edit_area(obj, name)
var ctx = new uifc.list.CTX(); var ctx = new uifc.list.CTX();
while(obj && cmd >= 0) { while(obj && cmd >= 0) {
var menu = ["AKA Matching : "+(obj.akamatching === true ? "Yes" : "No"), var menu = [format(menu_fmt, "AKA Matching", (obj.akamatching === true ? "Yes" : "No")),
"Force Replace : "+(obj.forcereplace === true ? "Yes" : "No"), format(menu_fmt, "Force Replace", (obj.forcereplace === true ? "Yes" : "No")),
"Source Address : "+(obj.sourceaddress === undefined ? "" : obj.sourceaddress), format(menu_fmt, "Source Address", (obj.sourceaddress === undefined ? "" : obj.sourceaddress)),
"Uploader Name : "+(obj.uploader === undefined ? "" : obj.uploader), format(menu_fmt, "Uploader Name", (obj.uploader === undefined ? "" : obj.uploader)),
"Location : ", format(menu_fmt, "Location", (obj.path === undefined ? obj.dir : obj.path)),
"Links : "]; "Links..."];
cmd = uifc.list(WIN_SAV|WIN_ACT|WIN_BOT|WIN_RHT, name+" Options", menu, ctx); cmd = uifc.list(WIN_SAV|WIN_ACT|WIN_BOT|WIN_RHT, name+" Options", menu, ctx);
switch(cmd) { switch(cmd) {
case 0: case 0:
...@@ -311,7 +313,7 @@ function import_areas(libname) ...@@ -311,7 +313,7 @@ function import_areas(libname)
file.close(); file.close();
} }
function edit_globals() function edit_globals(obj)
{ {
var cmd = 0; var cmd = 0;
...@@ -321,47 +323,47 @@ function edit_globals() ...@@ -321,47 +323,47 @@ function edit_globals()
var ctx = new uifc.list.CTX(); var ctx = new uifc.list.CTX();
while(cmd >= 0) { while(cmd >= 0) {
var menu = ["AKA Matching : "+(tickit.gcfg.akamatching === true ? "Yes" : "No"), var menu = [format(menu_fmt, "AKA Matching", (obj.akamatching === true ? "Yes" : "No")),
"Force Replace : "+(tickit.gcfg.forcereplace === true ? "Yes" : "No"), format(menu_fmt, "Force Replace", (obj.forcereplace === true ? "Yes" : "No")),
"Ignore Password: "+(tickit.gcfg.ignorepassword === true ? "Yes" : "No"), format(menu_fmt, "Ignore Password", (obj.ignorepassword === true ? "Yes" : "No")),
"Secure Only : "+(tickit.gcfg.secureonly === true ? "Yes" : "No"), format(menu_fmt, "Secure Only", (obj.secureonly === true ? "Yes" : "No")),
"Source Address : "+(tickit.gcfg.sourceaddress === undefined ? "" : tickit.gcfg.sourceaddress), format(menu_fmt, "Source Address", (obj.sourceaddress === undefined ? "" : obj.sourceaddress)),
"Uploader Name : "+(tickit.gcfg.uploader === undefined ? "" : tickit.gcfg.uploader), format(menu_fmt, "Uploader Name", (obj.uploader === undefined ? "" : obj.uploader)),
"Location : ", format(menu_fmt, "Location", (obj.path === undefined ? obj.dir : obj.path)),
"Links : "]; "Links..."];
cmd = uifc.list(WIN_ACT|WIN_ESC|WIN_MID|WIN_SAV, "Global Options", menu, ctx); cmd = uifc.list(WIN_ACT|WIN_ESC|WIN_MID|WIN_SAV, "Global Options", menu, ctx);
switch(cmd) { switch(cmd) {
case 0: case 0:
set_akamatching(tickit.gcfg); set_akamatching(obj);
break; break;
case 1: case 1:
set_forcereplace(tickit.gcfg); set_forcereplace(obj);
break; break;
case 2: case 2:
set_ignorepassword(tickit.gcfg); set_ignorepassword(obj);
break; break;
case 3: case 3:
set_secureonly(tickit.gcfg); set_secureonly(obj);
break; break;
case 4: case 4:
select_sourceaddress(tickit.gcfg); select_sourceaddress(obj);
break; break;
case 5: case 5:
edit_uploader(tickit.gcfg); edit_uploader(obj);
break; break;
case 6: case 6:
set_location(tickit.gcfg); set_location(obj);
break; break;
case 7: case 7:
if (tickit.gcfg.links === undefined) if (obj.links === undefined)
links = []; links = [];
else else
links = tickit.gcfg.links.split(/,/); links = obj.links.split(/,/);
tmp = edit_links(links); tmp = edit_links(links);
if (tmp.length === 0) if (tmp.length === 0)
delete tickit.gcfg.links; delete obj.links;
else else
tickit.gcfg.links = tmp.join(','); obj.links = tmp.join(',');
break; break;
case -1: case -1:
break; break;
...@@ -392,7 +394,7 @@ function main() ...@@ -392,7 +394,7 @@ function main()
cmd = uifc.list(WIN_ORG|WIN_ACT|WIN_MID|WIN_ESC, "TickIT Options", menu, ctx); cmd = uifc.list(WIN_ORG|WIN_ACT|WIN_MID|WIN_ESC, "TickIT Options", menu, ctx);
switch(cmd) { switch(cmd) {
case 0: case 0:
edit_globals(); edit_globals(tickit.gcfg);
break; break;
case 1: case 1:
edit_areas(); edit_areas();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment