소스 검색

submit some demo

lusa 6 년 전
부모
커밋
795e949ce9
39개의 변경된 파일131개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      app/Makefile
  2. BIN
      app/goahead-5.1.0/build/linux-arm-static/.install-certs-modified
  3. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test
  4. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test.gdb
  5. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/goahead.gdb
  6. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/gopass
  7. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/gopass.gdb
  8. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/libgo.a
  9. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/libgoahead-mbedtls.a
  10. BIN
      app/goahead-5.1.0/build/linux-arm-static/bin/libmbedtls.a
  11. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/action.o
  12. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/alloc.o
  13. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/auth.o
  14. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/cgi.o
  15. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/crypt.o
  16. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/file.o
  17. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/fs.o
  18. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/goahead-mbedtls.o
  19. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/goahead.o
  20. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/gopass.o
  21. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/http.o
  22. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/js.o
  23. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/jst.o
  24. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/mbedtls.o
  25. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/options.o
  26. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/osdep.o
  27. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/rom.o
  28. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/route.o
  29. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/runtime.o
  30. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/socket.o
  31. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/test.o
  32. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/time.o
  33. BIN
      app/goahead-5.1.0/build/linux-arm-static/obj/upload.o
  34. 2 0
      app/goahead-5.1.0/src/action.c
  35. 91 0
      app/goahead-5.1.0/src/goahead.c
  36. 36 1
      app/goahead-5.1.0/src/web/index.html
  37. 0 0
      app/goahead-5.1.0/src/web/static/js/app.js
  38. 0 0
      app/goahead-5.1.0/src/web/static/js/chunk-vendors.js
  39. 1 1
      local/rc

+ 1 - 1
app/Makefile

@@ -1,5 +1,5 @@
 all	: 
 all	: 
-	make -C ./web
+	make -C ./goahead-5.1.0
 #	apps modules test_apps
 #	apps modules test_apps
 clean	: clean_apps clean_modules clean_test_apps
 clean	: clean_apps clean_modules clean_test_apps
 
 

BIN
app/goahead-5.1.0/build/linux-arm-static/.install-certs-modified


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead-test.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/goahead.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/gopass


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/gopass.gdb


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libgo.a


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libgoahead-mbedtls.a


BIN
app/goahead-5.1.0/build/linux-arm-static/bin/libmbedtls.a


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/action.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/alloc.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/auth.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/cgi.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/crypt.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/file.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/fs.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/goahead-mbedtls.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/goahead.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/gopass.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/http.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/js.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/jst.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/mbedtls.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/options.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/osdep.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/rom.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/route.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/runtime.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/socket.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/test.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/time.o


BIN
app/goahead-5.1.0/build/linux-arm-static/obj/upload.o


+ 2 - 0
app/goahead-5.1.0/src/action.c

@@ -119,6 +119,8 @@ PUBLIC void websFooter(Webs *wp)
 }
 }
 #endif
 #endif
 
 
+
+
 /*
 /*
     Copyright (c) Embedthis Software. All Rights Reserved.
     Copyright (c) Embedthis Software. All Rights Reserved.
     This software is distributed under commercial and open source licenses.
     This software is distributed under commercial and open source licenses.

+ 91 - 0
app/goahead-5.1.0/src/goahead.c

@@ -38,10 +38,94 @@ static LRESULT CALLBACK websWindProc(HWND hwnd, UINT msg, UINT wp, LPARAM lp);
 static void sigHandler(int signo);
 static void sigHandler(int signo);
 #endif
 #endif
 
 
+static void buy(Webs *wp);
+static void actionTest(Webs *wp);
+static void personInfoAction(Webs *wp);
+
+
+typedef struct PERSON
+{
+  char *name;
+  int age;
+  char *gender;
+}Person;
+
+
+
+static void personInfoAction(Webs *wp)
+{
+    logmsg(2, "-----------------------111----------------------");
+    int i; 
+    Person person[2];
+    person[0].name = "kangkang";
+    person[0].age = 12;
+    person[0].gender = "male";
+    person[1].name = "Jane";
+    person[1].age = 14;
+    person[1].gender = "female";
+
+   websSetStatus(wp, 200);
+   websWriteHeaders(wp, -1, 0);
+   websWriteEndHeaders(wp);
+
+    websWrite(wp, "[");
+     for (i = 0;i < 2; i++)
+     {
+      
+      websWrite(wp, "       {\"name\":\"%s\",\"age\":\"%d\",\"gender\":\"%s\"}",
+       person[i].name, person[i].age, person[i].gender);
+      if (i != 1)
+      {
+       websWrite(wp, ",");
+      }
+      
+     }
+     websWrite(wp, "]");
+     websDone(wp);
+}
+
+
+static void buy(Webs *wp)
+{
+    char    *name, *age;
+    name = websGetVar(wp, "name", NULL);
+    age = websGetVar(wp, "age", NULL);
+     logmsg(2, "---------------------------------------------");
+    logmsg(2, "name value is : %s", name );
+     logmsg(2, "age value is : %s", age );
+    websSetStatus(wp, 200);
+    websWriteHeaders(wp, 0, 0);
+    websWriteEndHeaders(wp);
+    websWrite(wp, "Name %s", name); 
+    websWrite(wp,  "Age %s", age);
+    websFlush(wp, 0);
+    websDone(wp);
+}
+
+
+
+/*
+    Implement /action/actionTest. Parse the form variables: name, address and echo back.
+ */
+static void actionTest(Webs *wp)
+{
+    cchar   *name, *address;
+
+    name = websGetVar(wp, "name", NULL);
+    address = websGetVar(wp, "address", NULL);
+    websSetStatus(wp, 200);
+    websWriteHeaders(wp, -1, 0);
+    websWriteEndHeaders(wp);
+    websWrite(wp, "<html><body><h2>name: %s, address: %s</h2></body></html>\n", name, address);
+    websFlush(wp, 0);
+    websDone(wp);
+}
+
 /*********************************** Code *************************************/
 /*********************************** Code *************************************/
 
 
 MAIN(goahead, int argc, char **argv, char **envp)
 MAIN(goahead, int argc, char **argv, char **envp)
 {
 {
+   
     char    *argp, *home, *documents, *endpoints, *endpoint, *route, *auth, *tok, *lspec;
     char    *argp, *home, *documents, *endpoints, *endpoint, *route, *auth, *tok, *lspec;
     int     argind;
     int     argind;
 	logmsg(2, "---> log1\n");
 	logmsg(2, "---> log1\n");
@@ -151,6 +235,13 @@ MAIN(goahead, int argc, char **argv, char **envp)
      */
      */
     websAddRoute("/", "file", 0);
     websAddRoute("/", "file", 0);
 #endif
 #endif
+
+//add by lusa start 
+        websDefineAction("buy", buy);
+        websDefineAction("test", actionTest);
+        websDefineAction("person", personInfoAction);
+        
+// add by lusa end 
 #ifdef GOAHEAD_INIT
 #ifdef GOAHEAD_INIT
     /*
     /*
         Define your init function in main.me goahead.init, or
         Define your init function in main.me goahead.init, or

+ 36 - 1
app/goahead-5.1.0/src/web/index.html

@@ -1 +1,36 @@
-<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>bmc-ui</title><link href=/static/css/app.css rel=preload as=style><link href=/static/js/app.js rel=preload as=script><link href=/static/js/chunk-vendors.js rel=preload as=script><link href=/static/css/app.css rel=stylesheet></head><body><noscript><strong>We're sorry but bmc-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.js></script><script src=/static/js/app.js></script></body></html>
+ <p>Please log in</p>
+    <form action=/action/test method="post">
+        <table>
+        <tr><td>账号:</td><td><input type="text" name="name"></td></tr>
+        <tr><td>密码:</td><td><input type="password" name="address"></td></tr>
+        <tr><td><input type="submit" name="submit" value="submit"></td>
+            <td><input type="reset" value="reset"></td></tr>
+        </table>
+    </form>
+    
+    <script type="text/javascript">
+    function loadXMLDoc()
+    {
+        var xmlhttp;
+        if (window.XMLHttpRequest)
+          {// code for IE7+, Firefox, Chrome, Opera, Safari
+              xmlhttp=new XMLHttpRequest();
+          }
+        else
+          {// code for IE6, IE5
+              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
+          }
+        xmlhttp.onreadystatechange=function()
+          {
+              if (xmlhttp.readyState==4 && xmlhttp.status==200)
+            {
+                document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
+                }
+          }
+        xmlhttp.open("GET","action/test",true);
+        xmlhttp.send();
+    }
+    </script>
+    
+    <div id="myDiv"><h2>需要刷新的局部内容</h2></div>
+    <button type="button" onclick="loadXMLDoc()">通过 AJAX 实现局部刷新</button>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
app/goahead-5.1.0/src/web/static/js/app.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
app/goahead-5.1.0/src/web/static/js/chunk-vendors.js


+ 1 - 1
local/rc

@@ -9,4 +9,4 @@ ifconfig lo 127.0.0.1
 
 
 #run bmc function 
 #run bmc function 
 #./usr/bin/bmc.sh 
 #./usr/bin/bmc.sh 
-
+/usr/bin/goahead -v --home /etc/goahead /var/www/goahead &

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.