Changeset 1024


Ignore:
Timestamp:
01/01/10 20:49:30 (12 years ago)
Author:
alno
Message:

WebIF:
changelog:

  • templates can be loaded from hdd now (httptpl to set the path). if the file does not exist on disk, a default one is used
  • furthermore you can save them to hdd by calling savetemplates.html
  • other change: moved mapping of templates to header file
Location:
branches/monitor-improvement
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/monitor-improvement/globals.h

    r1020 r1024  
    540540  char      http_pwd[65];
    541541  char      http_css[128];
     542  char      http_tpl[128];
    542543  int               http_refresh;
    543544  int       c33_port;
  • branches/monitor-improvement/oscam-config.c

    r1020 r1024  
    427427  if (!strcmp(token, "httppwd")) { strncpy(cfg->http_pwd, value, sizeof(cfg->http_pwd)-1); cfg->http_pwd[sizeof(cfg->http_pwd)-1] = '\0'; return; }
    428428  if (!strcmp(token, "httpcss")) { strncpy(cfg->http_css, value, sizeof(cfg->http_css)-1); cfg->http_css[sizeof(cfg->http_css)-1] = '\0'; return; }
     429  if (!strcmp(token, "httptpl")) { strncpy(cfg->http_tpl, value, sizeof(cfg->http_tpl)-1); cfg->http_css[sizeof(cfg->http_tpl)-1] = '\0'; return; }
    429430  if (!strcmp(token, "httprefresh")) { cfg->http_refresh=atoi(value); return; }
    430431  if (!strcmp(token, "hideclient_to")) { cfg->mon_hideclient_to=atoi(value); return; }
     
    550551    if (!strcmp(token, "socket"))   { strncpy(cfg->dvbapi_socket, value, sizeof(cfg->dvbapi_socket)-1); return; }
    551552    if (!strcmp(token, "user"))     { strncpy(cfg->dvbapi_usr, value, sizeof(cfg->dvbapi_usr)-1); return; }
    552    
     553
    553554    if (token[0] != '#')
    554555        fprintf(stderr, "Warning: keyword '%s' in dvbapi section not recognized\n",token);
     
    674675  strcpy(cfg->http_css, "");
    675676  cfg->http_refresh=0;
     677  strcpy(cfg->http_tpl, "");
    676678#ifdef CS_ANTICASC
    677679  cfg->ac_enabled=0;
  • branches/monitor-improvement/oscam-http-helpers.c

    r1019 r1024  
    129129}
    130130
     131/* Creates a path to a template file. You need to set the resultsize to the correct size of result. */
     132char *tpl_getTplPath(const char *name, const char *path, char *result, int resultsize){
     133    char *pch;
     134    if((strlen(path) + strlen(name) + 5) <= resultsize){
     135        strcpy(result, path);
     136        strcat(result, name);
     137        strcat(result, ".tpl");
     138        result[resultsize - 1] = '\0';
     139        for(pch = result + strlen(path); pch[0] != '\0'; ++pch){
     140            if(pch[0] == '/' || pch[0] == '\\') pch[0] = ' ';
     141        }
     142    } else result[0] = '\0';
     143    return result;
     144}
     145
     146/* Returns an unparsed template either from disk or from internal templates.
     147   Note: You must free() the result after using it!*/
    131148char *tpl_getUnparsedTpl(const char* name){
    132     char *tpl[]={   
    133         "HEADER",
    134         "FOOTER",
    135         "MENU",
    136         "REFRESH",
    137         "STATUS",
    138         "CLIENTSTATUSBIT",
    139         "USERCONFIGLIST",
    140         "USERCONFIGLISTBIT",
    141         "SIDTAB",
    142         "SIDTABBIT",
    143         "READERS",
    144         "READERSBIT",
    145         "ENTITLEMENTS",
    146         "READERCONFIG",
    147         "READERCONFIGSIDOKBIT",
    148         "READERCONFIGSIDNOBIT",
    149         "USEREDIT",
    150         "USEREDITRDRSELECTED",
    151         "USEREDITSIDOKBIT",
    152         "USEREDITSIDNOBIT"
    153 #ifdef CS_ANTICASC
    154         ,"USEREDITANTICASC"
    155 #endif     
    156     };
    157   int i, tplcnt = sizeof(tpl)/sizeof(char *);
     149  int i;
     150  int tplcnt = sizeof(tpl)/sizeof(char *);
     151  int tplmapcnt = sizeof(tplmap)/sizeof(char *);
     152  char *result;
     153 
    158154  for(i = 0; i < tplcnt; ++i){
    159155    if(strcmp(name, tpl[i]) == 0) break;
    160156  }
    161     switch(i){
    162         case  0: return TPLHEADER;
    163         case  1: return TPLFOOTER;
    164         case  2: return TPLMENU;
    165         case  3: return TPLREFRESH;
    166         case  4: return TPLSTATUS;
    167         case  5: return TPLCLIENTSTATUSBIT;
    168         case  6: return TPLUSERCONFIGLIST;
    169         case  7: return TPLUSERCONFIGLISTBIT;
    170         case  8: return TPLSIDTAB;
    171         case  9: return TPLSIDTABBIT;
    172         case 10: return TPLREADERS;
    173         case 11: return TPLREADERSBIT;
    174         case 12: return TPLENTITLEMENTS;
    175         case 13: return TPLREADERCONFIG;
    176         case 14: return TPLREADERCONFIGSIDOKBIT;
    177         case 15: return TPLREADERCONFIGSIDNOBIT;
    178         case 16: return TPLUSEREDIT;
    179         case 17: return TPLUSEREDITRDRSELECTED;
    180         case 18: return TPLUSEREDITSIDOKBIT;
    181         case 19: return TPLUSEREDITSIDNOBIT;
    182 #ifdef CS_ANTICASC
    183         case 20: return TPLUSEREDITANTICASC;
    184 #endif
    185         default: return "";
     157 
     158  if(strlen(cfg->http_tpl) > 0){
     159    char path[200];
     160    if(strlen(tpl_getTplPath(name, cfg->http_tpl, path, 200)) > 0 && file_exists(path)){
     161            FILE *fp;
     162            char buffer[1024];
     163            int read, allocated = 1025, size = 1;
     164            result = (char *) malloc(allocated * sizeof(char));
     165            if((fp = fopen(path,"r"))!=NULL){
     166            while((read = fread(&buffer,sizeof(char),1024,fp)) > 0){
     167                size += read;
     168                if(allocated < size) {
     169                    allocated += size + 1024;
     170                    result = (char *) realloc(result, allocated * sizeof(char));
     171                }
     172                memcpy(result, buffer, read);
     173            }
     174            result[size - 1] = '\0';
     175            fclose (fp);
     176            return result;
     177            }
     178      }
     179  }
     180    if(i >= 0 && i < tplmapcnt){
     181        int len = (strlen(tplmap[i])) + 1;
     182        result = (char *) malloc(len * sizeof(char));   
     183        memcpy(result, tplmap[i], len);
     184    } else {
     185        result = (char *) malloc(1 * sizeof(char));
     186        result[0] = '\0';
    186187  }
     188    return result;
    187189}
    188190
     
    190192   empty string if the template doesn't exist*/
    191193char *tpl_getTpl(struct templatevars *vars, const char* name){
    192     char *tpl = tpl_getUnparsedTpl(name);
    193     char *tplend = tpl + strlen(tpl);
    194     char *pch, *pch2;
     194    char *tplorg = tpl_getUnparsedTpl(name);
     195    char *tplend = tplorg + strlen(tplorg);
     196    char *pch, *pch2, *tpl=tplorg;
    195197    char varname[33];
    196198   
     
    231233        }       
    232234    }
     235    free(tplorg);
    233236    result[respos] = '\0';
    234237    tpl_addTmp(vars, result);
    235238    return result;
     239}
     240
     241/* Saves all templates to the specified paths. Existing files will be overwritten! */
     242int tpl_saveIncludedTpls(const char *path){
     243    int tplcnt = sizeof(tpl)/sizeof(char *);
     244  int tplmapcnt = sizeof(tplmap)/sizeof(char *);
     245  int i, cnt = 0;
     246  char tmp[200];
     247  FILE *fp;
     248  for(i = 0; i < tplcnt && i < tplmapcnt; ++i){
     249    if(strlen(tpl_getTplPath(tpl[i], path, tmp, 200)) > 0 && (fp = fopen(tmp,"w")) != NULL){
     250            fwrite(tplmap[i], sizeof(char), strlen(tplmap[i]), fp);
     251            fclose (fp);
     252            ++cnt;
     253        }
     254    }
     255    return cnt;
    236256}
    237257
  • branches/monitor-improvement/oscam-http.c

    r1023 r1024  
    507507        //HTTPrefresh
    508508        fprintf(f,"\t<TR><TD>Httprefresh:</TD><TD><input name=\"httprefresh\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->http_refresh);
     509        //Httptpl
     510        fprintf(f,"\t<TR><TD>Httptpl:</TD><TD><input name=\"httptpl\" type=\"text\" size=\"50\" maxlength=\"100\" value=\"%s\"></TD></TR>\r\n", cfg->http_tpl);
    509511
    510512        //Tablefoot and finish form
     
    10711073}
    10721074
     1075void send_oscam_savetpls(struct templatevars *vars, FILE *f){
     1076    if(strlen(cfg->http_tpl) > 0){
     1077        tpl_printf(vars, 0, "CNT", "%d", tpl_saveIncludedTpls(cfg->http_tpl));
     1078        tpl_addVar(vars, 0, "PATH", cfg->http_tpl);
     1079    } else tpl_addVar(vars, 0, "CNT", "0");
     1080    fputs(tpl_getTpl(vars, "SAVETEMPLATES"), f);
     1081}
     1082
    10731083int process_request(FILE *f, struct in_addr in) {
    10741084  char buf[4096];
     
    10921102            "/services.html",
    10931103            "/user_edit.html",
    1094             "/site.css"};
     1104            "/site.css",
     1105            "/savetemplates.html"};
    10951106  int pagescnt = sizeof(pages)/sizeof(char *);  // Calculate the amount of items in array
    10961107
     
    12001211        case    6: send_oscam_services(vars, f); break;
    12011212        case  7: send_oscam_user_config_edit(vars, f, &params); break;
     1213        case  9: send_oscam_savetpls(vars, f); break;
    12021214        default: send_oscam_status(vars, f); break;
    12031215      }
  • branches/monitor-improvement/oscam-http.h

    r1023 r1024  
    3232A:hover {text-decoration: none; color: red;}"
    3333
    34 #define TPLHEADER "<HTML>\n\
    35 <HEAD>\n\
    36 <TITLE>OSCAM ##CS_VERSION## build ###CS_SVN_VERSION##</TITLE>\n\
    37 <link rel=\"stylesheet\" type=\"text/css\" href=\"site.css\">\n\
    38 ##REFRESH##\
    39 </HEAD>\n\
    40 <BODY>\n\
    41 <H2>OSCAM ##CS_VERSION## build ###CS_SVN_VERSION##</H2>"
    42 #define TPLFOOTER "<HR/><H4>OSCAM Webinterface - ##CURDATE## ##CURTIME##</H4></BODY></HTML>"
    43 #define TPLREFRESH "<meta http-equiv=\"refresh\" content=\"##REFRESHTIME##\"; URL=/status.html\" />\n"
    44 #define TPLMENU "<TABLE border=0 class=\"menu\">\n\
    45 <TR>\n\
    46 <TD CLASS=\"menu\"><A HREF=\"status.html\">STATUS</TD>\n\
    47 <TD CLASS=\"menu\"><A HREF=\"config.html\">CONFIGURATION</TD>\n\
    48 <TD CLASS=\"menu\"><A HREF=\"readers.html\">READERS</TD>\n\
    49 <TD CLASS=\"menu\"><A HREF=\"userconfig.html\">USERS</TD>\n\
    50 <TD CLASS=\"menu\"><A HREF=\"services.html\">SERVICES</TD>\n\
    51 </TR>\n\
    52 </TABLE>"
    53 #define TPLSTATUS "##TPLHEADER##\
    54 ##TPLMENU##\n\
    55 <BR><BR><TABLE WIDTH=\"100%\" cellspacing=\"0\" class=\"status\">\n\
    56 <TR><TH>PID</TH><TH>Typ</TH><TH>ID</TH><TH>Label</TH><TH>AU</TH><TH>0</TH><TH>Address</TH><TH>Port</TH><TH>Protocol</TH><TH>Login</TH><TH>Login</TH><TH>Time</TH><TH>caid:srvid</TH><TH>Last Channel</TH><TH>Idle</TH><TH>CWOK</TH><TH>CWNOK</TH><TH>0</TH>\n\
    57 ##CLIENTSTATUS##\
    58 </TABLE><BR>\n\
    59 <DIV class=\"log\">\n\
    60 ##LOGHISTORY##\
    61 </DIV>\n\
    62 ##TPLFOOTER##"
    63 #define TPLCLIENTSTATUSBIT "<TR class=\"##CLIENTTYPE##\"><TD>##CLIENTPID##</TD><TD>##CLIENTTYPE##</TD><TD>##CLIENTCNR##</TD><TD>##CLIENTUSER##</TD><TD>##CLIENTCAU##</TD><TD>##CLIENTCRYPTED##</TD><TD>##CLIENTIP##</TD><TD>##CLIENTPORT##</TD><TD>##CLIENTPROTO##</TD><TD>##CLIENTLOGINDATE##</TD><TD>##CLIENTLOGINTIME##</TD><TD>##CLIENTLOGINSECS##</TD><TD>##CLIENTCAID##:##CLIENTSRVID##</TD><TD>##CLIENTSRVNAME##</TD><TD>##CLIENTIDLESECS##</TD><TD>##CWOK##</TD><TD>##CWNOK##</TD><TD>##CLIENTCON##</TD></TR>"
    64 #define TPLUSERCONFIGLIST "##TPLHEADER##\
    65 ##TPLMENU##\n\
    66 ##MESSAGE##\
    67 <BR><BR><TABLE cellspacing=\"0\" cellpadding=\"10\">\n\
    68 <TR><TH>Label</TH>\r\n\t<TH>Status</TH>\r\n\t<TH>Last Channel</TH>\r\n\t<TH>Idle (Sec)</TH>\r\n\t<TH colspan=\"2\" align=\"center\">Action</TH>\r\n</TR>\
    69 ##USERCONFIGS##\
    70 <TR>\n\
    71 \t<FORM action=\"user_edit.html\" method=\"get\">\n\
    72 \t<TD>New User:</TD>\n\
    73 \t<TD colspan=\"2\"><input name=\"user\" type=\"text\"></TD>\n\
    74 \t<TD colspan=\"3\" align=\"center\"><input type=\"submit\" value=\"Add User\"></TD>\n\
    75 \t</FORM>\n\
    76 <TR>\n\
    77 </TABLE>\n\
    78 ##TPLFOOTER##"
    79 #define TPLUSERCONFIGLISTBIT "<TR class=\"##CLASSNAME##\">\n\
    80 \t<TD>##USER##</TD>\n\t<TD>##STATUS####EXPIRED##</TD>\n\t<TD>##LASTCHANNEL##</TD>\r\n\t<TD>##IDLESECS##</TD>\n\t<TD><A HREF=\"user_edit.html?user=##USERENC##\">Edit Settings</A></TD>\n\
    81 \t<TD><A HREF=\"userconfig.html?user=##USERENC##&action=delete\">Delete User</A></TD>\n\
    82 </TR>\n"
    83 #define TPLUSEREDIT "##TPLHEADER##\
     34#define TPLHEADER "\
     35<HTML>\n\
     36  <HEAD>\n\
     37    <TITLE>OSCAM ##CS_VERSION## build ###CS_SVN_VERSION##</TITLE>\n\
     38    <link rel=\"stylesheet\" type=\"text/css\" href=\"site.css\">\n\
     39    ##REFRESH##\
     40  </HEAD>\n\
     41  <BODY>\n\
     42    <H2>OSCAM ##CS_VERSION## build ###CS_SVN_VERSION##</H2>"
     43
     44#define TPLFOOTER "\
     45  <HR/><H4>OSCAM Webinterface - ##CURDATE## ##CURTIME##</H4>\
     46  </BODY>\
     47</HTML>"
     48
     49#define TPLREFRESH "\
     50<meta http-equiv=\"refresh\" content=\"##REFRESHTIME##\"; URL=/status.html\" />\n"
     51
     52#define TPLMENU "\
     53  <TABLE border=0 class=\"menu\">\n\
     54    <TR>\n\
     55      <TD CLASS=\"menu\"><A HREF=\"status.html\">STATUS</TD>\n\
     56      <TD CLASS=\"menu\"><A HREF=\"config.html\">CONFIGURATION</TD>\n\
     57      <TD CLASS=\"menu\"><A HREF=\"readers.html\">READERS</TD>\n\
     58      <TD CLASS=\"menu\"><A HREF=\"userconfig.html\">USERS</TD>\n\
     59      <TD CLASS=\"menu\"><A HREF=\"services.html\">SERVICES</TD>\n\
     60    </TR>\n\
     61  </TABLE>"
     62
     63#define TPLSTATUS "\
     64  ##TPLHEADER##\
     65  ##TPLMENU##\n\
     66  <BR><BR>\n\
     67  <TABLE WIDTH=\"100%\" cellspacing=\"0\" class=\"status\">\n\
     68    <TR>\n\
     69      <TH>PID</TH>\n\
     70      <TH>Typ</TH>\n\
     71      <TH>ID</TH>\n\
     72      <TH>Label</TH>\n\
     73      <TH>AU</TH>\n\
     74      <TH>0</TH>\n\
     75      <TH>Address</TH>\n\
     76      <TH>Port</TH>\n\
     77      <TH>Protocol</TH>\n\
     78      <TH>Login</TH>\n\
     79      <TH>Login</TH>\n\
     80      <TH>Time</TH>\n\
     81      <TH>caid:srvid</TH>\n\
     82      <TH>Last Channel</TH>\n\
     83      <TH>Idle</TH>\n\
     84      <TH>CWOK</TH>\n\
     85      <TH>CWNOK</TH>\n\
     86      <TH>0</TH>\n\
     87    </TR>\n\
     88    ##CLIENTSTATUS##\
     89  </TABLE><BR>\n\
     90  <DIV class=\"log\">\n\
     91  ##LOGHISTORY##\
     92  </DIV>\n\
     93  ##TPLFOOTER##"
     94
     95#define TPLCLIENTSTATUSBIT "\
     96 <TR class=\"##CLIENTTYPE##\">\n\
     97  <TD>##CLIENTPID##</TD>\n\
     98  <TD>##CLIENTTYPE##</TD>\n\
     99  <TD>##CLIENTCNR##</TD>\n\
     100  <TD>##CLIENTUSER##</TD>\n\
     101  <TD>##CLIENTCAU##</TD>\n\
     102  <TD>##CLIENTCRYPTED##</TD>\n\
     103  <TD>##CLIENTIP##</TD>\n\
     104  <TD>##CLIENTPORT##</TD>\n\
     105  <TD>##CLIENTPROTO##</TD>\n\
     106  <TD>##CLIENTLOGINDATE##</TD>\n\
     107  <TD>##CLIENTLOGINTIME##</TD>\n\
     108  <TD>##CLIENTLOGINSECS##</TD>\n\
     109  <TD>##CLIENTCAID##:##CLIENTSRVID##</TD>\n\
     110  <TD>##CLIENTSRVNAME##</TD>\n\
     111  <TD>##CLIENTIDLESECS##</TD>\n\
     112  <TD>##CWOK##</TD>\n\
     113  <TD>##CWNOK##</TD>\n\
     114  <TD>##CLIENTCON##</TD>\n\
     115 </TR>\n"
     116
     117#define TPLUSERCONFIGLIST "\
     118  ##TPLHEADER##\
     119  ##TPLMENU##\n\
     120  ##MESSAGE##\
     121  <BR><BR>\
     122  <TABLE cellspacing=\"0\" cellpadding=\"10\">\n\
     123    <TR>\n\
     124      <TH>Label</TH>\n\
     125      <TH>Status</TH>\n\
     126      <TH>Last Channel</TH>\n\
     127      <TH>Idle (Sec)</TH>\n\
     128      <TH colspan=\"2\" align=\"center\">Action</TH>\n\
     129    </TR>\n\
     130    ##USERCONFIGS##\
     131    <TR>\n\
     132      <FORM action=\"user_edit.html\" method=\"get\">\n\
     133      <TD>New User:</TD>\n\
     134      <TD colspan=\"2\"><input name=\"user\" type=\"text\"></TD>\n\
     135      <TD colspan=\"3\" align=\"center\"><input type=\"submit\" value=\"Add User\"></TD>\n\
     136      </FORM>\n\
     137    <TR>\n\
     138  </TABLE>\n\
     139  ##TPLFOOTER##"
     140
     141#define TPLUSERCONFIGLISTBIT "\
     142  <TR class=\"##CLASSNAME##\">\n\
     143    <TD>##USER##</TD>\n\
     144    <TD>##STATUS####EXPIRED##</TD>\n\
     145    <TD>##LASTCHANNEL##</TD>\n\
     146    <TD>##IDLESECS##</TD>\n\
     147    <TD><A HREF=\"user_edit.html?user=##USERENC##\">Edit Settings</A></TD>\n\
     148    <TD><A HREF=\"userconfig.html?user=##USERENC##&action=delete\">Delete User</A></TD>\n\
     149  </TR>\n"
     150
     151#define TPLUSEREDIT "\
     152##TPLHEADER##\
    84153##TPLMENU##\n\
    85154##MESSAGE##\
    86155<BR><BR>\n\
    87 <form action=\"/user_edit.html\" method=\"get\">\n\
    88 <input name=\"user\" type=\"hidden\" value=\"##USERNAME##\">\n\
    89 <input name=\"action\" type=\"hidden\" value=\"execute\">\n\
    90 <TABLE cellspacing=\"0\">\n\
    91 <TH>&nbsp;</TH><TH>Edit User ##USERNAME##</TH>\n\
    92 <TR><TD>Password:</TD><TD><input name=\"pwd\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##PASSWORD##\"></TD></TR>\n\
    93 <TR><TD>Exp. Date:</TD><TD><input name=\"expdate\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##EXPDATE##\"></TD></TR>\n\
    94 <TR><TD>Group:</TD><TD><input name=\"group\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"##GROUPS##\"></TD></TR>\n\
    95 <TR><TD>Hostname:</TD><TD><input name=\"hostname\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##DYNDNS##\"></TD></TR>\n\
    96 <TR><TD>Uniq:</TD><TD><select name=\"uniq\">\n\
    97 \t<option value=\"0\" ##UNIQSELECTED0##>none</option>\n\
    98 \t<option value=\"1\" ##UNIQSELECTED1##>strict</option>\n\
    99 \t<option value=\"2\" ##UNIQSELECTED2##>per IP</option>\n\
    100 </SELECT></TD></TR>\n\
    101 <TR><TD>Sleep:</TD><TD><input name=\"sleep\" type=\"text\" size=\"4\" maxlength=\"4\" value=\"0\"></TD></TR>\n\
    102 <TR><TD>Monlevel:</TD><TD><select name=\"monlevel\">\n\
    103 \t<option value=\"0\" ##MONSELECTED0##>no access to monitor</option>\n\
    104 \t<option value=\"1\" ##MONSELECTED1##>only server and own procs</option>\n\
    105 \t<option value=\"2\" ##MONSELECTED2##>all procs, but viewing only, default</option>\n\
    106 \t<option value=\"3\" ##MONSELECTED3##>all procs, reload of oscam.user possible</option>\n\
    107 \t<option value=\"4\" ##MONSELECTED4##>complete access</option>\n\
    108 </select></TD></TR>\n\
    109 <TR><TD>AU:</TD><TD><select name=\"au\">\n\
    110 \t<option value=\" \" ##AUSELECTED##>none</option>\n\
    111 \t<option value=\"1\" ##AUTOAUSELECTED##>auto</option>\n\
    112 ##RDROPTION##\
    113 </select></TD></TR>\n\
    114 <TR><TD>Services:</TD><TD><TABLE cellspacing=\"0\" class=\"invisible\">##SIDS##</TD></TR></TABLE>\n\
    115 <TR><TD>CAID:</TD><TD><input name=\"caid\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##CAIDS##\"></TD></TR>\n\
    116 <TR><TD>Ident:</TD><TD><input name=\"ident\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##IDENTS##\"></TD></TR>\n\
    117 <TR><TD>Betatunnel:</TD><TD><input name=\"betatunnel\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##BETATUNNELS##\"></TD></TR>\n\
    118 ##TPLUSEREDITANTICASC##\
    119 <TR><TD>&nbsp;</TD><TD align=\"right\"><input type=\"submit\" value=\"Save Settings\" title=\"Save settings and reload users\"></TD></TR>\n\
    120 </TABLE>\n\
     156  <form action=\"user_edit.html\" method=\"get\">\n\
     157  <input name=\"user\" type=\"hidden\" value=\"##USERNAME##\">\n\
     158  <input name=\"action\" type=\"hidden\" value=\"execute\">\n\
     159  <TABLE cellspacing=\"0\">\n\
     160    <TR>\n\
     161      <TH>&nbsp;</TH>\n\
     162      <TH>Edit User ##USERNAME##</TH>\n\
     163    <TR>\n\
     164      <TD>Password:</TD>\n\
     165      <TD><input name=\"pwd\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##PASSWORD##\"></TD>\n\
     166    </TR>\n\
     167    <TR>\n\
     168      <TD>Exp. Date:</TD>\n\
     169      <TD><input name=\"expdate\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##EXPDATE##\"></TD>\n\
     170    </TR>\n\
     171    <TR>\n\
     172      <TD>Group:</TD>\n\
     173      <TD><input name=\"group\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"##GROUPS##\"></TD>\n\
     174    </TR>\n\
     175    <TR>\n\
     176      <TD>Hostname:</TD>\n\
     177      <TD><input name=\"hostname\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##DYNDNS##\"></TD>\n\
     178    </TR>\n\
     179    <TR>\n\
     180      <TD>Uniq:</TD>\n\
     181      <TD><select name=\"uniq\">\n\
     182        <option value=\"0\" ##UNIQSELECTED0##>none</option>\n\
     183        <option value=\"1\" ##UNIQSELECTED1##>strict</option>\n\
     184        <option value=\"2\" ##UNIQSELECTED2##>per IP</option>\n\
     185      </SELECT></TD>\n\
     186    </TR>\n\
     187    <TR>\n\
     188      <TD>Sleep:</TD>\n\
     189      <TD><input name=\"sleep\" type=\"text\" size=\"4\" maxlength=\"4\" value=\"0\"></TD>\n\
     190    </TR>\n\
     191    <TR>\n\
     192      <TD>Monlevel:</TD>\n\
     193      <TD><select name=\"monlevel\">\n\
     194        <option value=\"0\" ##MONSELECTED0##>no access to monitor</option>\n\
     195        <option value=\"1\" ##MONSELECTED1##>only server and own procs</option>\n\
     196        <option value=\"2\" ##MONSELECTED2##>all procs, but viewing only, default</option>\n\
     197        <option value=\"3\" ##MONSELECTED3##>all procs, reload of oscam.user possible</option>\n\
     198        <option value=\"4\" ##MONSELECTED4##>complete access</option>\n\
     199      </select></TD>\n\
     200    </TR>\n\
     201    <TR>\n\
     202      <TD>AU:</TD>\n\
     203      <TD><select name=\"au\">\n\
     204        <option value=\" \" ##AUSELECTED##>none</option>\n\
     205        <option value=\"1\" ##AUTOAUSELECTED##>auto</option>\n\
     206        ##RDROPTION##\
     207      </select></TD>\n\
     208    </TR>\n\
     209    <TR>\n\
     210      <TD>Services:</TD>\n\
     211      <TD>\n\
     212        <TABLE cellspacing=\"0\" class=\"invisible\">##SIDS##\
     213            </TD>\n\
     214          </TR>\n\
     215        </TABLE>\n\
     216    <TR>\n\
     217      <TD>CAID:</TD>\n\
     218      <TD><input name=\"caid\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##CAIDS##\"></TD>\n\
     219    </TR>\n\
     220    <TR>\n\
     221      <TD>Ident:</TD>\n\
     222      <TD><input name=\"ident\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##IDENTS##\"></TD>\n\
     223    </TR>\n\
     224    <TR>\n\
     225      <TD>Betatunnel:</TD>\n\
     226      <TD><input name=\"betatunnel\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##BETATUNNELS##\"></TD>\n\
     227    </TR>\n\
     228    ##TPLUSEREDITANTICASC##\
     229    <TR>\n\
     230      <TD>&nbsp;</TD>\n\
     231      <TD align=\"right\"><input type=\"submit\" value=\"Save Settings\" title=\"Save settings and reload users\"></TD>\n\
     232    </TR>\n\
     233  </TABLE>\n\
    121234</form>\n\
    122235##TPLFOOTER##"
     236
    123237#define TPLUSEREDITRDRSELECTED "\t<option value=\"##READERNAME##\" ##SELECTED##>##READERNAME##</option>"
    124 #define TPLUSEREDITSIDOKBIT "<TR><TD><INPUT NAME=\"services\" TYPE=\"CHECKBOX\" VALUE=\"##SIDLABEL##\" ##CHECKED##> ##SIDLABEL##</TD>"
    125 #define TPLUSEREDITSIDNOBIT "<TD><INPUT NAME=\"services\" TYPE=\"CHECKBOX\" VALUE=\"!##SIDLABEL##\" ##CHECKED##> !##SIDLABEL##</TD></TR>"
     238
     239#define TPLUSEREDITSIDOKBIT "\
     240          <TR>\n\
     241            <TD><INPUT NAME=\"services\" TYPE=\"CHECKBOX\" VALUE=\"##SIDLABEL##\" ##CHECKED##> ##SIDLABEL##</TD>\n"
     242
     243#define TPLUSEREDITSIDNOBIT "\
     244            <TD><INPUT NAME=\"services\" TYPE=\"CHECKBOX\" VALUE=\"!##SIDLABEL##\" ##CHECKED##> !##SIDLABEL##</TD>\n\
     245          </TR>\n"
     246
    126247#ifdef CS_ANTICASC
    127 #define TPLUSEREDITANTICASC "<TR><TD>Anticascading numusers:</TD><TD><input name=\"numusers\" type=\"text\" size=\"3\" maxlength=\"3\" value=\"##AC_USERS##\"></TD></TR>\n\
    128 <TR><TD>Anticascading penalty:</TD><TD><input name=\"penalty\" type=\"text\" size=\"3\" maxlength=\"3\" value=\"##AC_PENALTY##\"></TD></TR>"
     248# define TPLUSEREDITANTICASC "\
     249    <TR>\n\
     250      <TD>Anticascading numusers:</TD>\n\
     251      <TD><input name=\"numusers\" type=\"text\" size=\"3\" maxlength=\"3\" value=\"##AC_USERS##\"></TD>\n\
     252    </TR>\n\
     253    <TR>\n\
     254      <TD>Anticascading penalty:</TD>\n\
     255      <TD><input name=\"penalty\" type=\"text\" size=\"3\" maxlength=\"3\" value=\"##AC_PENALTY##\"></TD>\n\
     256    </TR>\n"
    129257#endif
    130 #define TPLSIDTAB "##TPLHEADER##\
    131 ##TPLMENU##\n\
    132 <BR><BR><DIV class=\"log\">\n\
    133 ##SIDTABS##\
    134 </DIV>\n\
    135 ##TPLFOOTER##"
    136 #define TPLSIDTABBIT "label=##LABEL##<BR>\n\
     258
     259#define TPLSIDTAB "\
     260  ##TPLHEADER##\
     261  ##TPLMENU##\n\
     262  <BR><BR><DIV class=\"log\">\n\
     263  ##SIDTABS##\
     264  </DIV>\n\
     265  ##TPLFOOTER##"
     266
     267#define TPLSIDTABBIT "\
     268label=##LABEL##<BR>\n\
    137269caid(##CAIDNUM##)=##CAIDS##<BR>\n\
    138270provider(##PROVIDNUM##)=##PROVIDS##<BR>\n\
    139271services(##SRVIDNUM##)=##SRVIDS##<BR><BR>\n"
    140 #define TPLREADERS "##TPLHEADER##\
     272
     273#define TPLREADERS "\
     274##TPLHEADER##\
    141275##TPLMENU##\n\
    142 <BR><BR><TABLE cellspacing=\"0\" cellpadding=\"10\">\n\
    143 <TR><TH>Reader</TH><TH>Protocol</TH><TH>Action</TH></TR>\n\
    144 ##READERLIST##\
    145 </TABLE>\n\
     276<BR><BR>\n\
     277  <TABLE cellspacing=\"0\" cellpadding=\"10\">\n\
     278    <TR>\n\
     279      <TH>Reader</TH>\n\
     280      <TH>Protocol</TH>\n\
     281      <TH>Action</TH>\n\
     282    </TR>\n\
     283    ##READERLIST##\
     284  </TABLE>\n\
    146285##TPLFOOTER##"
    147 #define TPLREADERSBIT "\t<TR><TD>##READERNAME##</TD><TD>##CTYP##</TD><TD><A HREF=\"readerconfig.html?reader=##READERNAMEENC##\">Edit Settings</A> &nbsp; <A HREF=\"entitlements.html?reader=##READERNAME##\">Show Entitlements</A></TD></TR>\n"
    148 #define TPLENTITLEMENTS "##TPLHEADER##\
     286
     287#define TPLREADERSBIT "\
     288    <TR>\n\
     289      <TD>##READERNAME##</TD>\n\
     290      <TD>##CTYP##</TD>\n\
     291      <TD><A HREF=\"readerconfig.html?reader=##READERNAMEENC##\">Edit Settings</A> &nbsp;|&nbsp; <A HREF=\"entitlements.html?reader=##READERNAME##\">Show Entitlements</A></TD>\n\
     292      </TR>\n"
     293
     294#define TPLENTITLEMENTS "\
     295##TPLHEADER##\
    149296##TPLMENU##\n\
    150 <BR><BR>Entitlements for ##READERNAME##<BR><BR>\r\n\n\
     297<BR><BR>Entitlements for ##READERNAME##<BR><BR>\n\n\
    151298<DIV class=\"log\">\n\
    152 ##LOGHISTORY##\
     299  ##LOGHISTORY##\
    153300</DIV>\n\
    154301##TPLFOOTER##"
    155 #define TPLREADERCONFIG "##TPLHEADER##\
     302
     303#define TPLREADERCONFIG "\
     304##TPLHEADER##\
    156305##TPLMENU##\n\
    157306<BR><BR>\n\
    158307##MESSAGE##\
    159 <form action=\"/readerconfig.html?action=execute\" method=\"get\"><input name=\"reader\" type=\"hidden\" value=\"##READERNAME##\">\n\
    160 <TABLE cellspacing=\"0\">\n\
    161 <TH>&nbsp;</TH><TH>Edit Reader ##READERNAME##</TH>\n\
    162 <TR><TD>Device:</TD><TD><input name=\"device\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##DEVICE####R_PORT####L_PORT##\"></TD></TR>\n\
    163 <TR><TD>Group:</TD><TD><input name=\"grp\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"##GRP##\"></TD></TR>\n\
    164 <TR><TD>Key:</TD><TD><input name=\"key\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##NCD_KEY##\"></TD></TR>\n\
    165 <TR><TD>Pincode:</TD><TD><input name=\"pincode\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##PINCODE##\"></TD></TR>\n\
    166 <TR><TD>Readnano:</TD><TD><input name=\"readnano\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##EMMFILE##\"></TD></TR>\n\
    167 <TR><TD>Services:</TD><TD><TABLE cellspacing=\"0\" class=\"invisible\">\n\
    168 ##SIDS##\
    169 </TD></TR></TABLE>\n\
    170 <TR><TD>Inactivitytimeout:</TD><TD><input name=\"inactivitytimeout\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##INACTIVITYTIMEOUT##\"></TD></TR>\n\
    171 <TR><TD>Reconnecttimeout:</TD><TD><input name=\"reconnecttimeout\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##RECEIVETIMEOUT##\"></TD></TR>\n\
    172 <TR><TD>Disableserverfilter:</TD><TD><input name=\"disableserverfilter\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##DISABLESERVERFILTER##\"></TD></TR>\n\
    173 <TR><TD>Fallback:</TD><TD><input name=\"fallback\" type=\"text\" size=\"3\" maxlength=\"3\" value=\"##FALLBACK##\"></TD></TR>\n\
    174 <TR><TD>CAID:</TD><TD><input name=\"caid\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##CAIDS##\"></TD></TR>\n\
    175 <TR><TD>Boxid:</TD><TD><input name=\"boxid\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##BOXID##\"></TD></TR>\n\
    176 </TABLE>\n\
    177 <input type=\"submit\" value=\"OK\"></form>\n\
     308  <form action=\"readerconfig.html?action=execute\" method=\"get\"><input name=\"reader\" type=\"hidden\" value=\"##READERNAME##\">\n\
     309  <TABLE cellspacing=\"0\">\n\
     310    <TR>\n\
     311      <TH>&nbsp;</TH>\n\
     312      <TH>Edit Reader ##READERNAME##</TH>\n\
     313    </TR>\n\
     314    <TR>\n\
     315      <TD>Device:</TD>\n\
     316      <TD><input name=\"device\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##DEVICE####R_PORT####L_PORT##\"></TD>\n\
     317    </TR>\n\
     318    <TR>\n\
     319      <TD>Group:</TD>\n\
     320      <TD><input name=\"grp\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"##GRP##\"></TD>\n\
     321    </TR>\n\
     322    <TR>\n\
     323      <TD>Key:</TD>\n\
     324      <TD><input name=\"key\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##NCD_KEY##\"></TD>\n\
     325    </TR>\n\
     326    <TR>\n\
     327      <TD>Pincode:</TD>\n\
     328      <TD><input name=\"pincode\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##PINCODE##\"></TD>\n\
     329    </TR>\n\
     330    <TR>\n\
     331      <TD>Readnano:</TD>\n\
     332      <TD><input name=\"readnano\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##EMMFILE##\"></TD>\n\
     333    </TR>\n\
     334    <TR>\n\
     335      <TD>Services:</TD>\n\
     336      <TD>\n\
     337        <TABLE cellspacing=\"0\" class=\"invisible\">##SIDS##\
     338            </TD>\n\
     339          </TR>\n\
     340        </TABLE>\n\
     341    <TR>\n\
     342      <TD>Inactivitytimeout:</TD>\n\
     343      <TD><input name=\"inactivitytimeout\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##INACTIVITYTIMEOUT##\"></TD>\n\
     344    </TR>\n\
     345    <TR>\n\
     346      <TD>Reconnecttimeout:</TD>\n\
     347      <TD><input name=\"reconnecttimeout\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##RECEIVETIMEOUT##\"></TD>\n\
     348    </TR>\n\
     349    <TR>\n\
     350      <TD>Disableserverfilter:</TD>\n\
     351      <TD><input name=\"disableserverfilter\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##DISABLESERVERFILTER##\"></TD>\n\
     352    </TR>\n\
     353    <TR>\n\
     354      <TD>Fallback:</TD>\n\
     355      <TD><input name=\"fallback\" type=\"text\" size=\"3\" maxlength=\"3\" value=\"##FALLBACK##\"></TD>\n\
     356    </TR>\n\
     357    <TR>\n\
     358      <TD>CAID:</TD>\n\
     359      <TD><input name=\"caid\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##CAIDS##\"></TD>\n\
     360    </TR>\n\
     361    <TR>\n\
     362      <TD>Boxid:</TD>\n\
     363      <TD><input name=\"boxid\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##BOXID##\"></TD>\n\
     364    </TR>\n\
     365  </TABLE>\n\
     366  <input type=\"submit\" value=\"OK\"></form>\n\
    178367<BR><BR>Saving not yet implemented - Nothing changes on click<BR><BR>\n\
    179368##TPLFOOTER##"
    180 #define TPLREADERCONFIGSIDOKBIT "<TR><TD><INPUT NAME=\"services\" TYPE=\"CHECKBOX\" VALUE=\"##SIDLABEL##\" ##CHECKED##> ##SIDLABEL##</TD>"
    181 #define TPLREADERCONFIGSIDNOBIT "<TD><INPUT NAME=\"services\" TYPE=\"CHECKBOX\" VALUE=\"!##SIDLABEL##\" ##CHECKED##> !##SIDLABEL##</TD></TR>"
     369#define TPLSAVETEMPLATES "##TPLHEADER##\
     370##TPLMENU##\n\
     371<br><b>Saved ##CNT## templates to ##PATH##</b><br>\n\
     372##TPLFOOTER##"
     373#define TPLREADERCONFIGSIDOKBIT "\
     374          <TR>\n\
     375            <TD><INPUT NAME=\"services\" TYPE=\"CHECKBOX\" VALUE=\"##SIDLABEL##\" ##CHECKED##> ##SIDLABEL##</TD>\n"
     376
     377#define TPLREADERCONFIGSIDNOBIT "\
     378            <TD><INPUT NAME=\"services\" TYPE=\"CHECKBOX\" VALUE=\"!##SIDLABEL##\" ##CHECKED##> !##SIDLABEL##</TD>\n\
     379          </TR>\n"
    182380
    183381enum refreshtypes {REFR_ACCOUNTS, REFR_READERS, REFR_SERVER, REFR_ANTICASC};
     382
     383char *tpl[]={
     384    "HEADER",
     385    "FOOTER",
     386    "MENU",
     387    "REFRESH",
     388    "STATUS",
     389    "CLIENTSTATUSBIT",
     390    "USERCONFIGLIST",
     391    "USERCONFIGLISTBIT",
     392    "SIDTAB",
     393    "SIDTABBIT",
     394    "READERS",
     395    "READERSBIT",
     396    "ENTITLEMENTS",
     397    "READERCONFIG",
     398    "READERCONFIGSIDOKBIT",
     399    "READERCONFIGSIDNOBIT",
     400    "USEREDIT",
     401    "USEREDITRDRSELECTED",
     402    "USEREDITSIDOKBIT",
     403    "USEREDITSIDNOBIT",
     404    "SAVETEMPLATES"
     405#ifdef CS_ANTICASC
     406    ,"USEREDITANTICASC"
     407#endif
     408};
     409
     410char *tplmap[]={
     411    TPLHEADER,
     412    TPLFOOTER,
     413    TPLMENU,
     414    TPLREFRESH,
     415    TPLSTATUS,
     416    TPLCLIENTSTATUSBIT,
     417    TPLUSERCONFIGLIST,
     418    TPLUSERCONFIGLISTBIT,
     419    TPLSIDTAB,
     420    TPLSIDTABBIT,
     421    TPLREADERS,
     422    TPLREADERSBIT,
     423    TPLENTITLEMENTS,
     424    TPLREADERCONFIG,
     425    TPLREADERCONFIGSIDOKBIT,
     426    TPLREADERCONFIGSIDNOBIT,
     427    TPLUSEREDIT,
     428    TPLUSEREDITRDRSELECTED,
     429    TPLUSEREDITSIDOKBIT,
     430    TPLUSEREDITSIDNOBIT,
     431    TPLSAVETEMPLATES
     432#ifdef CS_ANTICASC
     433    ,TPLUSEREDITANTICASC
     434#endif
     435};
    184436
    185437struct templatevars {
     
    220472void send_oscam_menu(FILE *f);
    221473char *getParam(struct uriparams *params, char *name);
     474int tpl_saveIncludedTpls(const char *path);
  • branches/monitor-improvement/oscam-simples.c

    r1019 r1024  
    467467    return 0;
    468468}
    469 
Note: See TracChangeset for help on using the changeset viewer.