Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //sysop command line stuffs, using Deuce's str_cmds.js with a lightbar menu
- //-megaloyeti
- load("frame.js");
- load("tree.js");
- load("str_cmds.js"); //contains the string command functions
- var window = new Frame(1,1,80,24,BG_BLACK|WHITE);
- var info_frame = new Frame(36,7,26,10,BG_BLACK|YELLOW,window);
- var menu_frame = new Frame(18,7,17,10,BG_GREEN|YELLOW,window);
- var menu = new Tree(menu_frame, "TREE");
- menu.colors = {fg:WHITE,bg:BG_BLUE,lfg:LIGHTGREEN,lbg:BG_BLACK,cfg:LIGHTGREEN,cbg:BG_BLACK,dfg:DARKGRAY,kfg:YELLOW,tfg:CYAN,hfg:GREEN,hbg:BG_BLACK,xfg:LIGHTGREEN};
- menu.addItem("Error Log",error_log);
- menu.addItem("Guru Log", guru_log);
- menu.addItem("Change User",chuser);
- //menu.addItem("ANSI Capture",anscap);
- menu.addItem("List File",list);
- menu.addItem("Edit File", edit);
- menu.addItem("Log Today",tlog);
- menu.addItem("Log Yesterday",ylog);
- menu.addItem("System Stats",sys_stat);
- //menu.addItem("Node Stats", node_stat); //needs prompt for node #
- menu.addItem("Execute", exec);
- //menu.addItem("Execute Binary", nexec); //error opening C, dunno what this is/does/means
- menu.addItem("User Editor",uedit);
- var a; // temp var, boolean for runIt main loop
- var b; // temp var, boolean for exit to menu
- var cmd; // var for user command record
- var key; // var for keystroke record
- var help; // var for help string
- var title; // var for highlighted menu item text
- run_me();
- function run_me() {
- a = true;
- window.open();
- window.putmsg("Press 'Q' to Quit")
- menu.open();
- info_frame.top();
- info_frame.word_wrap = true;
- menu_frame.top();
- while(a) {
- info_frame.clear();
- info_frame.gotoxy(1,1);
- info_frame.putmsg(get_Help());
- window.cycle();
- cmd = console.inkey(K_NOECHO,5);
- switch(cmd){
- case "q":
- case "Q":
- a = false;
- break;
- default:
- key = menu.getcmd(cmd);
- if(key === undefined) break;
- break;
- }
- console.gotoxy(80,24);
- }
- }
- function get_Help(){
- title = menu.currentItem.text;
- switch(title){
- case "System Stats":
- help = title + ":\r\nDisplays current system stats";
- break;
- case "Error Log":
- help = title + ":\r\nDisplay current error log and optionally delete it as well as optionally clearing all nodes error counters.";
- break;
- case "Guru Log":
- help = title + ":\r\nDisplay and optionally clear current guru log.";
- break;
- case "Change User":
- help = title + ":\r\nBecome a different user.";
- break;
- case "ANSI capture":
- help = title + ":\r\nToggles ANSI capture.";
- break;
- case "List File":
- help = title + ":\r\nDisplays a specified file.";
- break;
- case "Edit File":
- help = title + ":\r\nEdits a specified file using your message editor.";
- break;
- case "Log Today":
- help = title + ":\r\nDisplays today's activity log.";
- break;
- case "Log Yesterday":
- help = title + ":\r\nDisplays yesterday's activity log.";
- break;
- case "Node Stats":
- help = title + ":\r\nDisplays the current node stats for node #.";
- break;
- case "Execute":
- help = title + ":\r\nExecutes command with I/O redirected.";
- break;
- case "Execute Binary":
- help = title + ":\r\nExecutres command with I/O redirected and assuming it's a native binary.";
- break;
- case "User Editor":
- help = title + ":\r\nEdit user profiles.";
- break;
- default:
- help = title + ":";
- break;
- }
- return help;
- };
- function sys_stat(){
- console.clear();
- console.home();
- bbs.sys_stats();
- console.crlf();
- console.write("Press 'X' to Exit");
- //generic exit loop//
- b = true;
- while(b) {
- cmd = console.inkey(K_NOECHO,5);
- switch(cmd){
- case "x":
- case "X":
- b = false;
- break;
- default:
- break;
- }
- }
- window.invalidate();
- }
- function error_log(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("ERR");
- //generic exit loop//
- console.write("Press 'X' to Exit");
- b = true;
- while(b) {
- cmd = console.inkey(K_NOECHO,5);
- switch(cmd){
- case "x":
- case "X":
- b = false;
- break;
- default:
- break;
- }
- }
- console.clear();
- window.invalidate();
- };
- function guru_log(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("GURU");
- //generic exit loop//
- console.write("Press 'X' to Exit");
- b = true;
- while(b) {
- cmd = console.inkey(K_NOECHO,5);
- switch(cmd){
- case "x":
- case "X":
- b = false;
- break;
- default:
- break;
- }
- }
- console.clear();
- window.invalidate();
- };
- function chuser(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("CHUSER");
- window.invalidate();
- };
- function anscap(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("ANSCAP");
- window.invalidate();
- };
- function list(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("LIST");
- window.invalidate();
- };
- function edit(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("EDIT");
- window.invalidate();
- };
- function tlog(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("LOG");
- //generic exit loop//
- console.write("Press 'X' to Exit");
- b = true;
- while(b) {
- cmd = console.inkey(K_NOECHO,5);
- switch(cmd){
- case "x":
- case "X":
- b = false;
- break;
- default:
- break;
- }
- }
- console.clear();
- window.invalidate();
- };
- function ylog(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("YLOG");
- //generic exit loop//
- console.write("Press 'X' to Exit");
- b = true;
- while(b) {
- cmd = console.inkey(K_NOECHO,5);
- switch(cmd){
- case "x":
- case "X":
- b = false;
- break;
- default:
- break;
- }
- }
- console.clear();
- window.invalidate();
- };
- function node_stat(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("NS");
- window.invalidate();
- };
- function exec(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("EXEC");
- window.invalidate();
- };
- function nexec(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("NEXEC");
- window.invalidate();
- };
- function uedit(){
- console.clear();
- console.home();
- console.attributes=BG_BLACK|WHITE;
- str_cmds("UEDIT");
- window.invalidate();
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement