Changeset 30028


Ignore:
Timestamp:
09/21/14 16:38:24 (9 years ago)
Author:
obi
Message:

webif add help screen

Location:
titan/titan
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/help.h

    r22371 r30028  
    2323        tmpstr = ostrcat(tmpstr, "/", 1, 0);
    2424        tmpstr = ostrcat(tmpstr, node->name, 1, 0);
    25   tmpstr = ostrcat(tmpstr, ".txt", 1, 0);
     25        tmpstr = ostrcat(tmpstr, ".txt", 1, 0);
    2626
    2727        buf = readfiletomem(tmpstr, 0);
  • titan/titan/httpd.h

    r28830 r30028  
    274274                m_unlock(&status.waitrcmutex, 24);
    275275        }
     276        else if(ostrcmp(query, "getcommand") == 0 && param != NULL)
     277        {
     278                m_lock(&status.waitrcmutex, 24);
     279                buf = webgetcommand(param, fmt);
     280                m_unlock(&status.waitrcmutex, 24);
     281        }
     282        else if(ostrcmp(query, "gethelpchoices") == 0)
     283        {
     284                m_lock(&status.waitrcmutex, 24);
     285                buf = webgethelpchoices(fmt);
     286                m_unlock(&status.waitrcmutex, 24);
     287        }
     288        else if(ostrcmp(query, "gethelp") == 0 && param != NULL)
     289        {
     290                m_lock(&status.waitrcmutex, 24);
     291                buf = webgethelp(param, fmt);
     292                m_unlock(&status.waitrcmutex, 24);
     293        }
    276294        else if(ostrcmp(query, "getsatchannel") == 0 && param != NULL)
    277295        {
  • titan/titan/httpdfunc.h

    r30021 r30028  
    46874687}
    46884688
     4689char* webgetcommand(char* param, int fmt)
     4690{
     4691        char* buf = NULL, *tmpstr = NULL;
     4692        if(param == NULL) return NULL;
     4693        if(status.security == 0) return NULL;
     4694
     4695        if(fmt == 0)
     4696        {
     4697                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
     4698                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
     4699                buf = ostrcat(buf, "</head><body class=body id=\"command\">", 1, 0);
     4700        }
     4701
     4702        debug(10, "cmd: %s", param);
     4703        tmpstr = command(param);
     4704        buf = ostrcat(buf, tmpstr, 1, 0);
     4705        free(tmpstr), tmpstr = NULL;   
     4706        buf = ostrcat(buf, "</body></html>", 1, 0);
     4707
     4708        return buf;
     4709}
     4710
     4711char* webgethelp(char* param, int fmt)
     4712{
     4713        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *helppath = NULL, *lang = NULL;
     4714        if(param == NULL) return NULL;
     4715
     4716        if(fmt == 0)
     4717        {
     4718                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
     4719                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
     4720                buf = ostrcat(buf, "</head><body class=body id=\"help\">", 1, 0);
     4721        }
     4722
     4723        helppath = getconfig("helppath", NULL);
     4724        if(helppath == NULL) return NULL;
     4725
     4726        //get language
     4727        lang = ostrcat(getconfig("lang", NULL), NULL, 0, 0);
     4728        lang = string_replace("po/", "", lang, 1);
     4729
     4730        //create full filename
     4731        tmpstr = ostrcat(helppath, "/", 0, 0);
     4732        tmpstr = ostrcat(tmpstr, lang, 1, 1);
     4733        tmpstr = ostrcat(tmpstr, "/", 1, 0);
     4734        tmpstr = ostrcat(tmpstr, param, 1, 0);
     4735        tmpstr = ostrcat(tmpstr, ".txt", 1, 0);
     4736       
     4737        debug(10, "file: %s", tmpstr);
     4738        tmpstr1 = readsys(tmpstr, 1);
     4739
     4740        buf = ostrcat(buf, tmpstr1, 1, 0);
     4741        free(tmpstr), tmpstr = NULL;   
     4742        free(tmpstr1), tmpstr1 = NULL; 
     4743
     4744        buf = ostrcat(buf, "</body></html>", 1, 0);
     4745
     4746        return buf;
     4747}
     4748
     4749char* webgethelpchoices(int fmt)
     4750{
     4751        char* buf = NULL, *tmpstr = NULL, *helppath = NULL, *lang = NULL, *cmd = NULL;
     4752       
     4753//      if(fmt == 0)
     4754//      {
     4755                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
     4756                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
     4757                buf = ostrcat(buf, "</head><body class=body id=\"helpchoices\">", 1, 0);
     4758//              buf = ostrcat(buf, "<center><form action=query method=get target=nothing><br><br>", 1, 0);
     4759
     4760//      }
     4761
     4762        helppath = getconfig("helppath", NULL);
     4763        if(helppath == NULL) return NULL;
     4764
     4765        //get language
     4766        lang = ostrcat(getconfig("lang", NULL), NULL, 0, 0);
     4767        lang = string_replace("po/", "", lang, 1);
     4768
     4769        //create full filename
     4770        cmd = ostrcat("ls -1 ", helppath, 0, 0);
     4771        cmd = ostrcat(cmd, "/", 1, 0);
     4772        cmd = ostrcat(cmd, lang, 1, 1);
     4773        cmd = ostrcat(cmd, "/", 1, 0);
     4774       
     4775        debug(10, "cmd: %s", cmd);
     4776        tmpstr = command(cmd);
     4777       
     4778        int count, i, max;
     4779        count = 0;
     4780        struct splitstr* ret1 = NULL;
     4781        ret1 = strsplit(tmpstr, "\n", &count);
     4782        max = count - 1;
     4783       
     4784
     4785       
     4786//      buf = ostrcat(buf, "<a class=linelink2 href=query?getprovider target=main>Provider</a>", 1, 0);
     4787//      buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gethelp&adjust target=main>Adjust</a>", 1, 0);
     4788//      buf = ostrcat(buf, "<a class=linelink2 href=query?getprovider target=main>Provider</a>", 1, 0);
     4789
     4790        buf = ostrcat(buf, "<center><table cellpadding=5 cellspacing=5><tr><td nowrap>", 1, 0);
     4791 
     4792        int icount = 0;
     4793 
     4794        if(ret1 != NULL)
     4795        {
     4796                for(i = 0; i <= max; i++)
     4797                {
     4798                        icount++;
     4799/*
     4800                        buf = ostrcat(buf, "<input class=bigbutton type=submit name=gethelp", 1, 0);
     4801//                      buf = ostrcat(buf, _(ret1[i].part), 1, 0);
     4802                        buf = ostrcat(buf, " value=\"", 1, 0);
     4803                        buf = ostrcat(buf, _(stringreplacecharonce(ret1[i].part, '.', '\0')), 1, 0);
     4804                        buf = ostrcat(buf, "\"></input><br>", 1, 0);
     4805*/
     4806                        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gethelp&", 1, 0);
     4807                        buf = ostrcat(buf, stringreplacecharonce(ret1[i].part, '.', '\0'), 1, 0);
     4808                        buf = ostrcat(buf, " target=main>", 1, 0);
     4809                        buf = ostrcat(buf, _(stringreplacecharonce(ret1[i].part, '.', '\0')), 1, 0);
     4810                        buf = ostrcat(buf, "</a>", 1, 0);
     4811                        buf = ostrcat(buf, "</br></br>", 1, 0);
     4812
     4813                        if(icount == 4)
     4814                        {
     4815//                              buf = ostrcat(buf, "</br>", 1, 0);
     4816                                icount = 0;
     4817                        }
     4818//<a class=linelink2 href=query?getallchannel target=main>All</a>
     4819                }
     4820        }               
     4821
     4822        free(tmpstr), tmpstr = NULL;   
     4823//      buf = ostrcat(buf, "</form></center></body></html>", 1, 0);
     4824        buf = ostrcat(buf, "</td></tr></table></center></body></html>", 1, 0);
     4825
     4826        return buf;
     4827}
    46894828
    46904829#endif
Note: See TracChangeset for help on using the changeset viewer.