Changeset 1034


Ignore:
Timestamp:
01/02/10 19:08:23 (12 years ago)
Author:
alno
Message:

WebIf:

  • "serial" added in config (readonly) todo: content of device is nort showed correct
  • changings in templates (cosmetic)
Location:
branches/monitor-improvement
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/monitor-improvement/oscam-http.c

    r1033 r1034  
    282282}
    283283
     284void send_oscam_config_serial(struct templatevars *vars, FILE *f, struct uriparams *params) {
     285    int i;
     286    if (strcmp(getParam(params, "action"),"execute") == 0){
     287            for(i = 0; i < (*params).paramcount; ++i){
     288                if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
     289                    tpl_printf(vars, 1, "MESSAGE", "Parameter: %s set to Value: %s<BR>\n", (*params).params[i], (*params).values[i]);
     290                    //we use the same function as used for parsing the config tokens
     291                    chk_t_serial((*params).params[i], (*params).values[i]);
     292                }
     293            }
     294            tpl_addVar(vars, 1, "MESSAGE", "<BR><BR><B>Configuration Serial *DONE*</B><BR><BR>");
     295            refresh_oscam(REFR_SERVER);
     296    }
     297
     298    tpl_addVar(vars, 0, "SERIALDEVICE", cfg->ser_device);
     299
     300    fputs(tpl_getTpl(vars, "CONFIGSERIAL"), f);
     301}
     302
    284303#ifdef CS_ANTICASC
    285304void send_oscam_config_anticasc(struct templatevars *vars, FILE *f, struct uriparams *params) {
     
    321340#endif
    322341    else if (!strcmp(part,"monitor")) send_oscam_config_monitor(vars, f, params);
     342    else if (!strcmp(part,"serial")) send_oscam_config_serial(vars, f, params);
    323343    else send_oscam_config_global(vars, f, params);
    324344}
     
    688708void send_oscam_status(struct templatevars *vars, FILE *f) {
    689709    int i;
    690         char *usr;
    691         int lsec, isec, cnr, con, cau;
    692         time_t now = time((time_t)0);
    693         struct tm *lt;
     710    char *usr;
     711    int lsec, isec, cnr, con, cau;
     712    time_t now = time((time_t)0);
     713    struct tm *lt;
     714
    694715    for (i=0; i<CS_MAXPID; i++) {
    695716        if (client[i].pid) {
    696         if ((cfg->mon_hideclient_to <= 0) ||    (((now-client[i].lastecm)/60)<cfg->mon_hideclient_to) ||
    697         (((now-client[i].lastemm)/60)<cfg->mon_hideclient_to) || (client[i].typ!='c')){
    698             lsec=now-client[i].login;
    699             isec=now-client[i].last;
    700             usr=client[i].usr;
    701 
    702             if (((client[i].typ=='r') || (client[i].typ=='p')) && (con=cs_idx2ridx(i))>=0) usr=reader[con].label;
    703 
    704             if (client[i].dup) con=2;
    705                 else if ((client[i].tosleep) && (now-client[i].lastswitch>client[i].tosleep)) con=1;
    706                 else con=0;
    707 
    708             if (i-cdiff>0) cnr=i-cdiff;
    709             else cnr=(i>1) ? i-1 : 0;
    710 
    711             if( (cau=client[i].au+1) && (now-client[i].lastemm)/60 > cfg->mon_aulow) cau=-cau;
    712 
    713             lt=localtime(&client[i].login);
    714 
    715             tpl_printf(vars, 0, "CLIENTPID", "%d", client[i].pid);
    716             tpl_printf(vars, 0, "CLIENTTYPE", "%c", client[i].typ);
    717             tpl_printf(vars, 0, "CLIENTCNR", "%d", cnr);
    718             tpl_addVar(vars, 0, "CLIENTUSER", usr);
    719             tpl_printf(vars, 0, "CLIENTCAU", "%d", cau);
    720             tpl_printf(vars, 0, "CLIENTCRYPTED", "%d", client[i].crypted);
    721             tpl_printf(vars, 0, "CLIENTIP", "%s", cs_inet_ntoa(client[i].ip));
    722             tpl_printf(vars, 0, "CLIENTPORT", "%d", client[i].port);
    723             tpl_addVar(vars, 0, "CLIENTPROTO", monitor_get_proto(i));
    724             tpl_printf(vars, 0, "CLIENTLOGINDATE", "%02d.%02d.%02d", lt->tm_mday, lt->tm_mon+1, lt->tm_year%100);
    725             tpl_printf(vars, 0, "CLIENTLOGINTIME", "%02d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec);
    726             tpl_printf(vars, 0, "CLIENTLOGINSECS", "%d", lsec);
    727             tpl_printf(vars, 0, "CLIENTCAID", "%04X", client[i].last_caid);
    728             tpl_printf(vars, 0, "CLIENTSRVID", "%04X", client[i].last_srvid);
    729             tpl_addVar(vars, 0, "CLIENTSRVNAME", monitor_get_srvname(client[i].last_srvid));
    730             tpl_printf(vars, 0, "CLIENTIDLESECS", "%d", isec);
    731             tpl_printf(vars, 0, "CLIENTCON", "%d", con);
    732             tpl_printf(vars, 0, "CWOK", "%d", client[i].cwfound);
    733             tpl_printf(vars, 0, "CWNOK", "%d", client[i].cwnot);
    734             tpl_addVar(vars, 1, "CLIENTSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT"));
    735         }
    736     }
    737 }
     717
     718            //if((client[i].typ == 'c') && (client[i].last_srvid == 0)) continue;
     719
     720            if ((cfg->mon_hideclient_to <= 0) ||    (((now-client[i].lastecm)/60)<cfg->mon_hideclient_to) ||
     721            (((now-client[i].lastemm)/60)<cfg->mon_hideclient_to) || (client[i].typ!='c')){
     722                lsec=now-client[i].login;
     723                isec=now-client[i].last;
     724                usr=client[i].usr;
     725
     726                if (((client[i].typ=='r') || (client[i].typ=='p')) && (con=cs_idx2ridx(i))>=0) usr=reader[con].label;
     727
     728                if (client[i].dup) con=2;
     729                    else if ((client[i].tosleep) && (now-client[i].lastswitch>client[i].tosleep)) con=1;
     730                    else con=0;
     731
     732                if (i-cdiff>0) cnr=i-cdiff;
     733                else cnr=(i>1) ? i-1 : 0;
     734
     735                if( (cau=client[i].au+1) && (now-client[i].lastemm)/60 > cfg->mon_aulow) cau=-cau;
     736
     737                lt=localtime(&client[i].login);
     738
     739                tpl_printf(vars, 0, "CLIENTPID", "%d", client[i].pid);
     740                tpl_printf(vars, 0, "CLIENTTYPE", "%c", client[i].typ);
     741                tpl_printf(vars, 0, "CLIENTCNR", "%d", cnr);
     742                tpl_addVar(vars, 0, "CLIENTUSER", usr);
     743                tpl_printf(vars, 0, "CLIENTCAU", "%d", cau);
     744                tpl_printf(vars, 0, "CLIENTCRYPTED", "%d", client[i].crypted);
     745                tpl_printf(vars, 0, "CLIENTIP", "%s", cs_inet_ntoa(client[i].ip));
     746                tpl_printf(vars, 0, "CLIENTPORT", "%d", client[i].port);
     747                tpl_addVar(vars, 0, "CLIENTPROTO", monitor_get_proto(i));
     748                tpl_printf(vars, 0, "CLIENTLOGINDATE", "%02d.%02d.%02d", lt->tm_mday, lt->tm_mon+1, lt->tm_year%100);
     749                tpl_printf(vars, 0, "CLIENTLOGINTIME", "%02d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec);
     750                tpl_printf(vars, 0, "CLIENTLOGINSECS", "%d", lsec);
     751                tpl_printf(vars, 0, "CLIENTCAID", "%04X", client[i].last_caid);
     752                tpl_printf(vars, 0, "CLIENTSRVID", "%04X", client[i].last_srvid);
     753                tpl_addVar(vars, 0, "CLIENTSRVNAME", monitor_get_srvname(client[i].last_srvid));
     754                tpl_printf(vars, 0, "CLIENTIDLESECS", "%d", isec);
     755                tpl_printf(vars, 0, "CLIENTCON", "%d", con);
     756                tpl_printf(vars, 0, "CWOK", "%d", client[i].cwfound);
     757                tpl_printf(vars, 0, "CWNOK", "%d", client[i].cwnot);
     758                tpl_addVar(vars, 1, "CLIENTSTATUS", tpl_getTpl(vars, "CLIENTSTATUSBIT"));
     759            }
     760        }
     761    }
    738762
    739763#ifdef CS_LOGHISTORY
  • branches/monitor-improvement/oscam-http.h

    r1031 r1034  
    7474            ##TPLCONFIGMENUANTICASC##\
    7575            <TD CLASS=\"menu\"><A HREF=\"config.html?part=monitor\">Monitor</TD>\n\
     76            <TD CLASS=\"menu\"><A HREF=\"config.html?part=serial\">Serial</TD>\n\
    7677        </TR>\n\
    7778    </TABLE>"
     
    382383      <TD><input name=\"boxid\" type=\"text\" size=\"30\" maxlength=\"50\" value=\"##BOXID##\"></TD>\n\
    383384    </TR>\n\
     385    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
    384386  </TABLE>\n\
    385   <input type=\"submit\" value=\"OK\"></form>\n\
    386387<BR><BR>Saving not yet implemented - Nothing changes on click<BR><BR>\n\
    387388##TPLFOOTER##"
     
    415416        <TR><TD>Cardinfos:</TD><TD><input name=\"cardinfos\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##CARDINFOS##\"></TD></TR>\n\
    416417        <TR><TD>Locals:</TD><TD><input name=\"locals\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##LOCALS##\"></TD></TR>\n\
    417     </TABLE>\n\
    418 <input type=\"submit\" value=\"OK\"></form>\n\
     418    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     419    </TABLE>\n\
    419420##TPLFOOTER##"
    420421
     
    439440        <TR><TD>Fakedelay:</TD><TD><input name=\"fakedelay\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##FAKEDELAY##\"></TD></TR>\n\
    440441        <TR><TD>Denysamples:</TD><TD><input name=\"denysamples\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##DENYSAMPLES##\"></TD></TR>\n\
    441     </TABLE>\n\
    442     <input type=\"submit\" value=\"OK\">\n\
     442    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     443    </TABLE>\n\
    443444</form>\n\
    444445##TPLFOOTER##"
     
    456457    <TABLE cellspacing=\"0\">\n\
    457458        <TR><TH>&nbsp;</TH><TH>Edit Cccam Config</TH></TR>\n\
    458     </TABLE>\n\
    459     <input type=\"submit\" value=\"OK\">\n\
     459    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     460    </TABLE>\n\
    460461</form>\n\
    461462<BR><BR>Configuration Cccam not yet implemented<BR><BR>\n\
     
    494495        <TR><TD>Httprefresh:</TD><TD><input name=\"httprefresh\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##HTTPREFRESH##\"></TD></TR>\n\
    495496        <TR><TD>Httptpl:</TD><TD><input name=\"httptpl\" type=\"text\" size=\"50\" maxlength=\"100\" value=\"##HTTPTPL##\"></TD></TR>\n\
    496     </TABLE>\n\
    497     <input type=\"submit\" value=\"OK\">\n\
     497    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     498    </TABLE>\n\
    498499</form>\n\
    499500##TPLFOOTER##"
     
    514515        <TR><TD>Allowed:</TD><TD><input name=\"allowed\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##ALLOWED##\">wrong, see Ticket #265</TD></TR>\n\
    515516        <TR><TD>User:</TD><TD><input name=\"user\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##USER##\"></TD></TR>\n\
    516     </TABLE>\n\
    517     <input type=\"submit\" value=\"OK\">\n\
     517    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     518    </TABLE>\n\
    518519</form>\n\
    519520##TPLFOOTER##"
     
    533534        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
    534535        <TR><TD>Key:</TD><TD><input name=\"key\" type=\"text\" size=\"35\" maxlength=\"28\" value=\"##KEY##\"></TD></TR>\n\
    535     </TABLE>\n\
    536     <input type=\"submit\" value=\"OK\">\n\
     536    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     537    </TABLE>\n\
    537538</form>\n\
    538539##TPLFOOTER##"
     
    569570        <TR><TD>Waitforcards:</TD><TD><input name=\"waitforcards\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##WAITFORCARDS##\"></TD></TR>\n\
    570571        <TR><TD>Preferlocalcards:</TD><TD><input name=\"preferlocalcards\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##PREFERLOCALCARDS##\"></TD></TR>\n\
    571     </TABLE>\n\
    572     <input type=\"submit\" value=\"OK\">\n\
     572    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     573    </TABLE>\n\
    573574</form>\n\
    574575<BR><BR>Configuration Global not yet implemented chengings havn't any effect<BR><BR>\n\
     
    591592        <TR><TD>Passive:</TD><TD><input name=\"passive\" type=\"text\" size=\"3\" maxlength=\"1\" value=\"##PASSIVE##\"></TD></TR>\n\
    592593        <TR><TD>Nocrypt:</TD><TD><input name=\"nocrypt\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##NOCRYPT##\">wrong, see Ticket #265</TD></TR>\n\
    593     </TABLE>\n\
    594     <input type=\"submit\" value=\"OK\">\n\
     594    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     595    </TABLE>\n\
    595596</form>\n\
    596597<BR><BR>Configuration camd33 not yet implemented<BR><BR>\n\
     
    603604<BR><BR>\n\
    604605##MESSAGE##\
    605 <form action=\"/config.html\" method=\"get\">\n\
     606<form action=\"config.html\" method=\"get\">\n\
    606607    <input name=\"part\" type=\"hidden\" value=\"camd35\">\n\
    607608    <input name=\"action\" type=\"hidden\" value=\"execute\">\n\
     
    610611        <TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##PORT##\"></TD></TR>\n\
    611612        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
    612     </TABLE>\n\
    613     <input type=\"submit\" value=\"OK\">\n\
     613    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     614    </TABLE>\n\
    614615</form>\n\
    615616<BR><BR>Configuration camd35 not yet implemented<BR><BR>\n\
     617##TPLFOOTER##"
     618
     619#define TPLCONFIGSERIAL "\
     620##TPLHEADER##\
     621##TPLMENU##\n\
     622##TPLCONFIGMENU##\n\
     623<BR><BR>\n\
     624##MESSAGE##\
     625<form action=\"config.html\" method=\"get\">\n\
     626    <input name=\"part\" type=\"hidden\" value=\"serial\">\n\
     627    <input name=\"action\" type=\"hidden\" value=\"execute\">\n\
     628    <TABLE cellspacing=\"0\">\n\
     629        <TR><TH>&nbsp;</TH><TH>Edit Serial Config</TH></TR>\n\
     630        <TR><TD>Device:</TD><TD><input name=\"device\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##SERIALDEVICE##\"></TD></TR>\n\
     631    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     632    </TABLE>\n\
     633</form>\n\
     634<BR><BR>Configuration Serial not yet implemented<BR><BR>\n\
    616635##TPLFOOTER##"
    617636
     
    648667    "CONFIGGLOBAL",
    649668    "CONFIGCAMD33",
    650     "CONFIGCAMD35"
     669    "CONFIGCAMD35",
     670    "CONFIGSERIAL"
    651671#ifdef CS_ANTICASC
    652672    ,"USEREDITANTICASC"
     
    686706    TPLCONFIGGLOBAL,
    687707    TPLCONFIGCAMD33,
    688     TPLCONFIGCAMD35
     708    TPLCONFIGCAMD35,
     709    TPLCONFIGSERIAL
    689710#ifdef CS_ANTICASC
    690711    ,TPLUSEREDITANTICASC
Note: See TracChangeset for help on using the changeset viewer.