Changeset 30029


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

add gettestpage and update html doku

Location:
titan
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • titan/doc/htmlapi.txt

    r29564 r30029  
    334334param:          no
    335335example:        queryraw?getdrawcount
     336
     337query:  gethelpchoices
     338raw:            ??
     339descr:          returns help text list
     340param:          no
     341example:        queryraw?gethelpchoices
     342
     343query:  gethelp
     344raw:            ??
     345descr:          returns help text
     346param:          yes
     347example:        queryraw?gethelp&adjust
     348
     349query:  getcommand
     350raw:            ??
     351descr:          returns command output
     352param:          yes
     353example:        queryraw?getcommand&free
     354example:        queryraw?getcommand&df%02-h
     355
     356query:  webgethelp
     357raw:            ??
     358descr:          displayed your local test page
     359param:          yes
     360example:        queryraw?gettestpage&/tmp/test.html
    336361
    337362query:  videoplay
  • titan/titan/httpd.h

    r30028 r30029  
    286286                m_unlock(&status.waitrcmutex, 24);
    287287        }
     288        else if(ostrcmp(query, "gettestpage") == 0 && param != NULL)
     289        {
     290                m_lock(&status.waitrcmutex, 24);
     291                buf = webgettestpage(fmt);
     292                m_unlock(&status.waitrcmutex, 24);
     293        }
    288294        else if(ostrcmp(query, "gethelp") == 0 && param != NULL)
    289295        {
  • titan/titan/httpdfunc.h

    r30028 r30029  
    47424742        free(tmpstr1), tmpstr1 = NULL; 
    47434743
    4744         buf = ostrcat(buf, "</body></html>", 1, 0);
     4744        if(fmt == 0)
     4745                buf = ostrcat(buf, "</body></html>", 1, 0);
    47454746
    47464747        return buf;
     
    47514752        char* buf = NULL, *tmpstr = NULL, *helppath = NULL, *lang = NULL, *cmd = NULL;
    47524753       
    4753 //      if(fmt == 0)
    4754 //      {
     4754        if(fmt == 0)
     4755        {
    47554756                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
    47564757                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
    47574758                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 //      }
     4759        }
    47614760
    47624761        helppath = getconfig("helppath", NULL);
     
    47824781        max = count - 1;
    47834782       
    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 
    47904783        buf = ostrcat(buf, "<center><table cellpadding=5 cellspacing=5><tr><td nowrap>", 1, 0);
    47914784 
    4792         int icount = 0;
    4793  
    47944785        if(ret1 != NULL)
    47954786        {
    47964787                for(i = 0; i <= max; i++)
    47974788                {
    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 */
    48064789                        buf = ostrcat(buf, "<a class=linelink2 href=queryraw?gethelp&", 1, 0);
    48074790                        buf = ostrcat(buf, stringreplacecharonce(ret1[i].part, '.', '\0'), 1, 0);
     
    48104793                        buf = ostrcat(buf, "</a>", 1, 0);
    48114794                        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                 }
    48204795        }               
    48214796
     4797        free(tmpstr), tmpstr = NULL;
     4798        if(fmt == 0)
     4799                buf = ostrcat(buf, "</td></tr></table></center></body></html>", 1, 0);
     4800
     4801        return buf;
     4802}
     4803
     4804char* webgettestpage(char* param, int fmt)
     4805{
     4806        char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *helppath = NULL, *lang = NULL;
     4807        if(param == NULL) return NULL;
     4808
     4809        if(fmt == 0)
     4810        {
     4811                buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", 1, 0);
     4812                buf = ostrcat(buf, "<link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script>", 1, 0);
     4813                buf = ostrcat(buf, "</head><body class=body id=\"help\">", 1, 0);
     4814        }
     4815
     4816        tmpstr = ostrcat(tmpstr, param, 1, 0);
     4817       
     4818        debug(10, "file: %s", tmpstr);
     4819        tmpstr1 = readsys(tmpstr, 1);
     4820
     4821        buf = ostrcat(buf, tmpstr1, 1, 0);
    48224822        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);
     4823        free(tmpstr1), tmpstr1 = NULL; 
     4824
     4825        if(fmt == 0)
     4826                buf = ostrcat(buf, "</body></html>", 1, 0);
    48254827
    48264828        return buf;
Note: See TracChangeset for help on using the changeset viewer.