home *** CD-ROM | disk | FTP | other *** search
-
- // VIEW.SCR -- MUL/UV Maximus User Language - User View -- Version 1.00
- //
- // Script program for MUL - the Maximus User Language
- // MUL is (C) Copyright 1990-93 by CodeLand Australia
-
- char *ufile = "USER.BBS"; // Path & name of Maximus user file
- //char *ufile = "C:\\BBS\\USER.BBS"; // Path & name of Maximus user file
-
- int backch=0xB0; // Background fill character
- int bdr = 0; // Window border type
- int battr = Attr (WHITE,GREEN); // Colour - window border
- int wattr = Attr (BLACK,GREEN); // Colour - window body
- int qattr = Attr (YELLOW,GREEN); // Colour - windows headings
- int fattr = Attr (LGREY,BLACK); // Colour - window fields
- int hattr = Attr (LRED,BLACK); // Colour - highlight fields
- int mattr = Attr (YELLOW,GREEN); // Colour - menu
-
- int current_record=1; // Current record
- char buf[40]; // Search buffer
- int search_stop=0; // Search work variable
-
- main () // Main program
- {
- if (!BaseOpenR (ufile)) {
- printf ("\nERROR opening user file \"%s\"\n\n",ufile);
- exit ();
- }
-
- background (); // Display background
- view (); // Display the records
-
- Wclose (); // Close background
- BaseClose (); // Close the user base
- }
-
- background () // Display background
- {
- Wfillch (backch);
- Wopen (0,0,NumRows ()-1,NumCols ()-1,5,0,Attr (YELLOW,LGREY));
- Wfillch (0x20);
- }
-
- view () // Display the records
- {
- int key, done=0;
-
- // Open the screen window
- if (!Wopen (1,4,23,74,bdr,battr,wattr)) return;
-
- Wshadow (Attr (LGREY,BLACK));
- Hidecur (); // Hide the cursor
- write_labels (); // Write the static screen data
-
- if (!BaseRead (current_record)) { // Read first record
- Wclose (); // Close the screen window
- return;
- }
-
- write_display (); // Display first record to screen
-
- while (!done) {
- key=getxch (); // Get keyboard character code
-
- while(key) { // Allow screen write skip
- // Right arrow, Grey plus, Dn arrow
- if ( key==0x4D00 || key==0x4E2B || key==0x5000) {
- if (current_record<BaseCount ()) ++current_record;
- }
- // Left arrow, Grey minus, Up arrow
- else if ( key==0x4B00 || key==0x4A2D || key==0x4800) {
- if (current_record>1) --current_record;
- }
- // ESC, q, Q
- else if ( key==0x011B || key==0x1071 || key==0x1051) {
- ++done; break;
- }
- // Home
- else if ( key==0x4700) {
- current_record=1;
- }
- // End
- else if ( key==0x4F00) {
- current_record=BaseCount ();
- }
- // PgDn
- else if ( key==0x5100) {
- current_record=current_record+15;
- if (current_record>BaseCount ())
- current_record=BaseCount ();
- }
- // PgUp
- else if ( key==0x4900) {
- current_record=current_record-15;
- if (current_record<1)
- current_record=1;
- }
- // s, S
- else if ( key==0x1F73 || key==0x1F53) {
- current_record=search ();
- }
- // a, A
- else if ( key==0x1E61 || key==0x1E41) {
- About (6); getxch (); Wclose ();
- }
-
- if (kbhit()) key=getxch (); // Get keyboard character code
- else key=0;
- }
-
- // Update the display
- BaseRead (current_record);
- write_display ();
- }
-
- Wclose (); // Close the screen window
- }
-
- write_labels () // Write the static screen data
- {
- Wxyputs (0, 1,qattr,"Flags");
- Wxyputs (0, 8,fattr," "); Wxyputs (0,19,fattr," ");
- Wxyputs (0,28,qattr,"Index"); Wxyputs (0,34,hattr,"File Order ");
- Wxyputs (0,47,qattr,"Record of");
- Wxyprintf (0,63,hattr,"%5u",BaseCount ());
-
- Whline (1,0,69,bdr,battr); Whline(8,0,69,bdr,battr);
- Wvline( 8,57,11,bdr,battr); Whline(19,0,69,bdr,battr);
-
- Wxyputs ( 2, 1,wattr,"Name :"); Wxyputs ( 2,44,wattr,"PassWord:");
- Wxyputs ( 7, 1,wattr,"Alias:"); Wxyputs ( 4,34,wattr,"Nerd:");
- Wxyputs ( 5, 1,wattr,"City :"); Wxyputs ( 5,48,wattr,"Phone:");
- Wxyputs ( 7,28,wattr,"LCall:"); Wxyputs ( 7,52,wattr,"Access:");
- Wxyputs ( 9, 1,wattr,"Calls:"); Wxyputs ( 9,14,wattr,"Credit:");
- Wxyputs ( 9,29,wattr,"Debit:"); Wxyputs ( 9,43,wattr,"Lang:");
- Wxyputs (11, 1,wattr,"Msg. Area:"); Wxyputs (11,22,wattr,"Dnlds Today:");
- Wxyputs (11,42,wattr,"TimeToday:"); Wxyputs (12, 1,wattr,"File Area:");
- Wxyputs (12,22,wattr,"Total Dnlds:");Wxyputs (12,42,wattr,"Scrn Wdth:");
- Wxyputs (13, 1,wattr,"File Tran:"); Wxyputs (13,22,wattr,"Total Uplds:");
- Wxyputs (13,42,wattr,"Scrn Lgth:"); Wxyputs (14, 1,wattr,"File Comp:");
- Wxyputs (14,42,wattr,"Nulls :"); Wxyputs (15,22,wattr,"Action:");
- Wxyputs (16,22,wattr,"Demote:"); Wxyputs ( 9,59,wattr,"MaxEd:");
- Wxyputs (10,59,wattr,"FScnR:"); Wxyputs (11,59,wattr,"Hot K:");
- Wxyputs (12,59,wattr,"IBMch:"); Wxyputs (13,59,wattr,"More :");
- Wxyputs (14,59,wattr,"Cls: "); Wxyputs (15,59,wattr,"Ulstd:");
- Wxyputs (16,59,wattr,"ChAvl:"); Wxyputs (17,59,wattr,"UsdMx:");
- Wxyputs (18,59,wattr,"BadLg:"); Wxyputs (16, 1,wattr,"EXpiry:");
- Wxyputs (18,19,wattr,"Keys:");
- Wxyputs (17,24,wattr,"┌──────┐┌──────┐┌──────┐┌──────┐");
-
- Wxyputs (20,1,battr,"MUL/UV - Maximus User Language - User View v1.00");
- Wxyputs (20,56,battr,"S"); Wxyputs (20,57,mattr,"EARCH");
- Wxyputs (20,64,battr,"Q"); Wxyputs (20,65,mattr,"UIT");
- }
-
- write_display () // Display record to screen
- {
- if (USRflagperm) Wxyputs (0, 8,hattr,"PERMANENT");
- else Wxyputs (0, 8,hattr," ");
- if (USRflagdel) Wxyputs (0,19,hattr,"DELETED");
- else Wxyputs (0,19,hattr," ");
-
- Wxyprintf (0,54,hattr,"%5u",current_record);
-
- Wxyprintf (2, 7,fattr,"%-35s",USRname);
- Wxyprintf (2,53,fattr,"%-15s",USRpwd);
- Wxyprintf (7, 7,fattr,"%-20s",USRalias);
- Wxyprintf (5, 7,fattr,"%-35s",USRcity);
- if (USRextra) Wxyputs (5,43,hattr,"EXT");
- else Wxyputs (5,43,hattr," ");
- Wxyprintf (5,54,fattr,"%-14s",USRphone);
- Wxyputs (7,34,fattr,DateToStr (USRludate));
- Wxyputs (7,43,fattr,TimeToStr (USRlutime));
- Wxyputs (7,59,fattr,BasePrivStr (USRpriv));
-
- Wxyprintf (9,7,fattr,"%5u",USRcalls);
- Wxyprintf (9,21,fattr,"%6u",USRcredit);
- Wxyprintf (9,35,fattr,"%6u",USRdebit);
- Wxyprintf (9,48,fattr,"%8d",USRlang);
- Wxyprintf (11,11,fattr,"%-9s",USRmsg);
- Wxyprintf (11,34,fattr,"%6lu",USRdnldtoday);
- Wxyprintf (11,52,fattr,"%4u",USRtimetoday);
- Wxyprintf (12,11,fattr,"%-9s",USRfiles);
- Wxyprintf (12,34,fattr,"%6lu",USRdnld);
- Wxyprintf (12,52,fattr,"%4u",USRwidth);
- Wxyputs (13,11,fattr,BaseProtStr (USRdefprot));
- Wxyprintf (13,34,fattr,"%6lu",USRupld);
- Wxyprintf (13,52,fattr,"%4u",USRlen);
- Wxyprintf (14,11,fattr,"%9u",USRcompress);
- Wxyprintf (14,52,fattr,"%4u",USRnulls);
-
- // User flags
- Wxyputs ( 4,39,fattr,YesNo (USRflagnerd));
- Wxyputs ( 9,65,fattr,YesNo (!USRflagbored));
- Wxyputs (10,65,fattr,YesNo (USRflagfsr));
- Wxyputs (11,65,fattr,YesNo (USRflaghotkeys));
- Wxyputs (12,65,fattr,YesNo (USRflagibmchars));
- Wxyputs (13,65,fattr,YesNo (USRflagmore));
- Wxyputs (14,65,fattr,YesNo (USRflagcls));
- Wxyputs (15,65,fattr,YesNo (!USRflagnoulist));
- Wxyputs (16,65,fattr,YesNo (!USRflagnotavail));
- Wxyputs (17,65,fattr,YesNo (USRflagusedmax));
- Wxyputs (18,65,fattr,YesNo (USRflagbadlogon));
-
- Wxyputs (18, 1,fattr,BaseVideoStr (USRvideo));
- Wxyputs (18,10,fattr,BaseHelpStr (USRhelp));
- Wxyputs (18,24,fattr,BaseKeyStr (USRkeys,1));
-
- // Expiry
- if(And (USRxpflag,XP_DATE) || And (USRxpflag,XP_TIME)) {
- if(And (USRxpflag,XP_HANGUP)) {
- Wxyputs (15,29,fattr,"HangUp ");
- Wxyputs (16,29,fattr," ");
- }
- else if(And (USRxpflag,XP_DEMOTE)) {
- Wxyputs (15,29,fattr,"Demote ");
- Wxyputs (16,29,fattr,BasePrivStr (USRxppriv));
- }
- else {
- Wxyputs (15,29,fattr,"None ");
- Wxyputs (16,29,fattr," ");
- }
-
- if(And (USRxpflag,XP_DATE)) {
- Wxyputs (16, 8,fattr,"Date");
- Wxyputs (16,13,fattr,DateToStr (USRxpdate));
- }
- else if(And (USRxpflag,XP_TIME)) {
- Wxyputs (16, 8,fattr,"Time");
- Wxyprintf (16,13,fattr,"%8lu",USRxpmins);
- }
- }
- else {
- Wxyputs (15,29,fattr," ");
- Wxyputs (16,29,fattr," ");
- Wxyputs (16, 8,fattr,"None");
- Wxyputs (16,13,fattr," ");
- }
- }
-
- search () // Search for user name
- {
- int i, found=0, colr=Attr (WHITE,RED);
-
- // Open the search window
- if (!Wopen (16,21,20,59,bdr,colr,Attr (LGREY,RED))) return;
-
- Wshadow (Attr (LGREY,BLACK));
- Wxyputs (0, 1,colr,"Search Name:");
-
- if (search_stop) { // If an auto find next
-
- Wxyputs (0,22,Attr (YELLOW,LRED),"Searching");
- Wxyputs (2, 1,Attr (LGREY,BLACK)," ");
- Wxyputs (2, 1,Attr (LGREY,BLACK),buf);
-
- // Search loop
- for (i=search_stop;i<=BaseCount ();++i) {
-
- // Check for keyboard abort (SPACE)
- if (kbhit ()) if (getch ()==' ') { search_stop=0; break; }
-
- if (!(i%20))Wxyprintf (0,32,Attr (YELLOW,RED),"%4u",i);
-
- BaseRead (i); // Read the record
- if (strisocc (buf,USRname)) { // If a match found
- ++found;
- current_record=i;
- break;
- }
- }
-
- if (found) {
- Play (536,60);
- search_stop=i+1;
- if (search_stop>BaseCount ()) search_stop=0;
- }
- else { Play (268,500); search_stop=0; }
- }
- else { // Do normal search
- Wxyputs (2, 1,Attr (LGREY,BLACK)," ");
- Wgotoxy (2,1);
- Showcur ();
- if(!getns (buf,35)) {
- Hidecur ();
- if (buf[0]) { // If we have a search string
- Wxyputs (0,22,Attr (YELLOW,LRED),"Searching");
-
- // Search loop
- for (i=1;i<=BaseCount ();++i) {
-
- // Check for keyboard abort (SPACE)
- if (kbhit ()) if (getch ()==' ') break;
-
- if (!(i%20))Wxyprintf (0,32,Attr (YELLOW,RED),"%4u",i);
-
- BaseRead (i); // Read the record
- if (strisocc (buf,USRname)) {
- ++found;
- current_record=i;
- break;
- }
- }
-
- if (found) {
- Play (536,60); search_stop=i+1;
- if (search_stop>BaseCount ()) search_stop=0;
- }
- else { Play (268,500); search_stop=0; }
- }
- }
- }
-
- Hidecur (); Wclose (); // Hide cursor, close window
- return current_record;
- }
-
- // End of script
-
-