diff --git a/tutorial/Skylark01/Skylark01.upp b/tutorial/Skylark01/Skylark01.upp deleted file mode 100644 index 9e80e3ffb..000000000 --- a/tutorial/Skylark01/Skylark01.upp +++ /dev/null @@ -1,13 +0,0 @@ -description "SKYLARK handlers and path patterns\377"; - -uses - Core, - Skylark; - -file - favicon.png, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark01/favicon.png b/tutorial/Skylark01/favicon.png deleted file mode 100644 index 137c9b578..000000000 Binary files a/tutorial/Skylark01/favicon.png and /dev/null differ diff --git a/tutorial/Skylark01/main.cpp b/tutorial/Skylark01/main.cpp deleted file mode 100644 index df4a5a6c7..000000000 --- a/tutorial/Skylark01/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include - -using namespace Upp; - -SKYLARK(HomePage, "") -{ - http << "Hello world!"; -} - -SKYLARK(Param, "*/param") -{ - http << "Parameter: " << http[0] << ""; -} - -SKYLARK(Params, "params/**") -{ - http << "Parameters: "; - for(int i = 0; i < http.GetParamCount(); i++) - http << http[i] << " "; - http << ""; -} - -SKYLARK(CatchAll, "**") -{ - http.Redirect(HomePage); -} - -SKYLARK(Favicon, "/favicon.ico") -{ - http.ContentType("image/png") << LoadFile(GetDataFile("favicon.png")); -} - -struct MyApp : SkylarkApp { - MyApp() { - root = "myapp"; - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - - MyApp().Run(); -} diff --git a/tutorial/Skylark02/Skylark02.upp b/tutorial/Skylark02/Skylark02.upp deleted file mode 100644 index 7a802d514..000000000 --- a/tutorial/Skylark02/Skylark02.upp +++ /dev/null @@ -1,13 +0,0 @@ -description "Witz templates\377"; - -uses - Core, - Skylark; - -file - index.witz, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark02/index.witz b/tutorial/Skylark02/index.witz deleted file mode 100644 index 529aabf0b..000000000 --- a/tutorial/Skylark02/index.witz +++ /dev/null @@ -1,16 +0,0 @@ - - - -MyValue: $MyValue
-MyRawValue: $MyRawValue
-MyRawValue2: $raw(MyRawValue2)
-
MyArray:
-$for(i in MyArray) - $i._index. $i
-$endfor -
MyMap:
-$for(i in MyMap) - $i._index. $i._key: $i
-$endfor - - diff --git a/tutorial/Skylark02/main.cpp b/tutorial/Skylark02/main.cpp deleted file mode 100644 index ef43db83c..000000000 --- a/tutorial/Skylark02/main.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include - -using namespace Upp; - -SKYLARK(HomePage, "") -{ - ValueArray va; - va.Add(1); - va.Add("Hello"); - ValueMap m; - m.Add("key1", "first value"); - m.Add("key2", "second value"); - - http("MyValue", "some value") - ("MyRawValue", Raw("raw html")) - ("MyRawValue2", "another raw html") - ("MyArray", va) - ("MyMap", m) - .RenderResult("Skylark02/index"); -} - -struct MyApp : SkylarkApp { - MyApp() { - root = "myapp"; - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - - MyApp().Run(); -} diff --git a/tutorial/Skylark03/Skylark03.upp b/tutorial/Skylark03/Skylark03.upp deleted file mode 100644 index a69c6c73f..000000000 --- a/tutorial/Skylark03/Skylark03.upp +++ /dev/null @@ -1,15 +0,0 @@ -description "Witz links to handlers\377"; - -uses - Core, - Skylark; - -file - index.witz, - page2.witz, - param.witz, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark03/index.witz b/tutorial/Skylark03/index.witz deleted file mode 100644 index 5b06d0372..000000000 --- a/tutorial/Skylark03/index.witz +++ /dev/null @@ -1,9 +0,0 @@ - - - -Link to page2
-$for(i in ["param_test", 123, "param_test3"]) - Param test: $i
-$endfor - - diff --git a/tutorial/Skylark03/main.cpp b/tutorial/Skylark03/main.cpp deleted file mode 100644 index 72ef58a47..000000000 --- a/tutorial/Skylark03/main.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include - -using namespace Upp; - -SKYLARK(HomePage, "") -{ - http.RenderResult("Skylark03/index"); -} - -SKYLARK(Page2, "page2") -{ - http.RenderResult("Skylark03/page2"); -} - -SKYLARK(Param, "paramtest/*") -{ - http("PARAM", http[0]).RenderResult("Skylark03/param"); -} - -struct MyApp : SkylarkApp { - MyApp() { - root = "myapp"; - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - - MyApp().Run(); -} diff --git a/tutorial/Skylark03/page2.witz b/tutorial/Skylark03/page2.witz deleted file mode 100644 index f2af18488..000000000 --- a/tutorial/Skylark03/page2.witz +++ /dev/null @@ -1,6 +0,0 @@ - - - -Back to index
- - diff --git a/tutorial/Skylark03/param.witz b/tutorial/Skylark03/param.witz deleted file mode 100644 index e386c40c4..000000000 --- a/tutorial/Skylark03/param.witz +++ /dev/null @@ -1,7 +0,0 @@ - - - -Param: $PARAM
-Back to index
- - diff --git a/tutorial/Skylark04/Skylark04.upp b/tutorial/Skylark04/Skylark04.upp deleted file mode 100644 index cd500f9a5..000000000 --- a/tutorial/Skylark04/Skylark04.upp +++ /dev/null @@ -1,16 +0,0 @@ -description "Combining Witz templates using #define and #include\377"; - -uses - Core, - Skylark, - plugin/jpg, - plugin/png; - -file - base.witz, - index.witz, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark04/base.witz b/tutorial/Skylark04/base.witz deleted file mode 100644 index 8be15cc1c..000000000 --- a/tutorial/Skylark04/base.witz +++ /dev/null @@ -1,9 +0,0 @@ - - -#TITLE - -#BODY - - - -#define TITLE Generic title \ No newline at end of file diff --git a/tutorial/Skylark04/index.witz b/tutorial/Skylark04/index.witz deleted file mode 100644 index b20dbba1a..000000000 --- a/tutorial/Skylark04/index.witz +++ /dev/null @@ -1,6 +0,0 @@ -#include Skylark04/base - -#define TITLE MyApp title - -#define BODY -This is MyApp body html! diff --git a/tutorial/Skylark04/main.cpp b/tutorial/Skylark04/main.cpp deleted file mode 100644 index 2f127b018..000000000 --- a/tutorial/Skylark04/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -using namespace Upp; - -SKYLARK(HomePage, "") -{ - http.RenderResult("Skylark04/index"); -} - -struct MyApp : SkylarkApp { - MyApp() { - root = "myapp"; - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - - MyApp().Run(); -} diff --git a/tutorial/Skylark05/Skylark05.upp b/tutorial/Skylark05/Skylark05.upp deleted file mode 100644 index b9de41b89..000000000 --- a/tutorial/Skylark05/Skylark05.upp +++ /dev/null @@ -1,14 +0,0 @@ -description "FORM GET\377"; - -uses - Core, - Skylark; - -file - index.witz, - submit.witz, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark05/index.witz b/tutorial/Skylark05/index.witz deleted file mode 100644 index 832afb28d..000000000 --- a/tutorial/Skylark05/index.witz +++ /dev/null @@ -1,11 +0,0 @@ - - - -
-

- - -

-
- - diff --git a/tutorial/Skylark05/main.cpp b/tutorial/Skylark05/main.cpp deleted file mode 100644 index 00588cc03..000000000 --- a/tutorial/Skylark05/main.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include - -using namespace Upp; - -SKYLARK(HomePage, "") -{ - http.RenderResult("Skylark05/index"); -} - -SKYLARK(Submit, "submit") -{ - http("RESULT", ToUpper((String)http["id"])) - .RenderResult("Skylark05/submit"); -} - -struct MyApp : SkylarkApp { - MyApp() { - root = "myapp"; - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - - MyApp().Run(); -} diff --git a/tutorial/Skylark05/submit.witz b/tutorial/Skylark05/submit.witz deleted file mode 100644 index a87811f19..000000000 --- a/tutorial/Skylark05/submit.witz +++ /dev/null @@ -1,7 +0,0 @@ - - - -Result: $RESULT
-Back to homepage - - diff --git a/tutorial/Skylark06/Skylark06.upp b/tutorial/Skylark06/Skylark06.upp deleted file mode 100644 index a0c238fc4..000000000 --- a/tutorial/Skylark06/Skylark06.upp +++ /dev/null @@ -1,14 +0,0 @@ -description "FORM POST\377"; - -uses - Core, - Skylark; - -file - index.witz, - submit.witz, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark06/index.witz b/tutorial/Skylark06/index.witz deleted file mode 100644 index 9be72b635..000000000 --- a/tutorial/Skylark06/index.witz +++ /dev/null @@ -1,12 +0,0 @@ - - - -
-

- $post_identity() - - -

-
- - diff --git a/tutorial/Skylark06/main.cpp b/tutorial/Skylark06/main.cpp deleted file mode 100644 index 440edefd2..000000000 --- a/tutorial/Skylark06/main.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include - -using namespace Upp; - -SKYLARK(HomePage, "") -{ - http.RenderResult("Skylark06/index"); -} - -SKYLARK(Submit, "submit:POST") -{ - http("RESULT", ToUpper((String)http["id"])) - .RenderResult("Skylark06/submit"); -} - -struct MyApp : SkylarkApp { - MyApp() { - root = "myapp"; - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - - MyApp().Run(); -} diff --git a/tutorial/Skylark06/submit.witz b/tutorial/Skylark06/submit.witz deleted file mode 100644 index a87811f19..000000000 --- a/tutorial/Skylark06/submit.witz +++ /dev/null @@ -1,7 +0,0 @@ - - - -Result: $RESULT
-Back to homepage - - diff --git a/tutorial/Skylark07/Skylark07.upp b/tutorial/Skylark07/Skylark07.upp deleted file mode 100644 index 72bc2d6d1..000000000 --- a/tutorial/Skylark07/Skylark07.upp +++ /dev/null @@ -1,13 +0,0 @@ -description "Session\377"; - -uses - Core, - Skylark; - -file - index.witz, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark07/index.witz b/tutorial/Skylark07/index.witz deleted file mode 100644 index 7d54f6e36..000000000 --- a/tutorial/Skylark07/index.witz +++ /dev/null @@ -1,16 +0,0 @@ - - - -
-

- $post_identity() - - -

-
-List ($count(.LIST)):
-$for(i in .LIST) - "$i" -$endfor - - diff --git a/tutorial/Skylark07/main.cpp b/tutorial/Skylark07/main.cpp deleted file mode 100644 index 163348d0a..000000000 --- a/tutorial/Skylark07/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include - -using namespace Upp; - -SKYLARK(HomePage, "") -{ - http.RenderResult("Skylark07/index"); -} - -SKYLARK(Submit, "submit:POST") -{ - Value h = http[".LIST"]; - ValueArray va; - if(IsValueArray(h)) - va = h; - va.Add(http["id"]); - http.SessionSet(".LIST", va); - http.Redirect(HomePage); -} - -struct MyApp : SkylarkApp { - MyApp() { - root = "myapp"; - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - - MyApp().Run(); -} diff --git a/tutorial/Skylark08/Skylark08.upp b/tutorial/Skylark08/Skylark08.upp deleted file mode 100644 index 9b7faeffb..000000000 --- a/tutorial/Skylark08/Skylark08.upp +++ /dev/null @@ -1,13 +0,0 @@ -description "Ajax\377"; - -uses - Core, - Skylark; - -file - index.witz, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark08/index.witz b/tutorial/Skylark08/index.witz deleted file mode 100644 index b1fe4401c..000000000 --- a/tutorial/Skylark08/index.witz +++ /dev/null @@ -1,13 +0,0 @@ - - - - -$js_identity() -
- - -
-
-
- - diff --git a/tutorial/Skylark08/main.cpp b/tutorial/Skylark08/main.cpp deleted file mode 100644 index 25a334ea9..000000000 --- a/tutorial/Skylark08/main.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -using namespace Upp; - -SKYLARK(HomePage, "") -{ - http.RenderResult("Skylark08/index"); -} - -SKYLARK(Add, "add:POST") -{ - String r = AsString(Nvl(http.Int("number1")) + Nvl(http.Int("number2"))); - http.Ux("result", "The result is: " + r) - .UxSet("number1", r); -} - -struct MyApp : SkylarkApp { - MyApp() { - root = "myapp"; - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - - MyApp().Run(); -} diff --git a/tutorial/Skylark09/Skylark09.upp b/tutorial/Skylark09/Skylark09.upp deleted file mode 100644 index a3daa28f4..000000000 --- a/tutorial/Skylark09/Skylark09.upp +++ /dev/null @@ -1,15 +0,0 @@ -description "Connecting SQL\377"; - -uses - Core, - Skylark, - plugin/sqlite3; - -file - index.witz, - myapp.sch, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark09/index.witz b/tutorial/Skylark09/index.witz deleted file mode 100644 index 8e3ffc439..000000000 --- a/tutorial/Skylark09/index.witz +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - -$for(i in PERSON) - - - - - -$/ -
No.First NameLast Name
$i._index.$i.NAME$i.LASTNAME
- - diff --git a/tutorial/Skylark09/main.cpp b/tutorial/Skylark09/main.cpp deleted file mode 100644 index e3209952d..000000000 --- a/tutorial/Skylark09/main.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include -#include - -using namespace Upp; - -#define MODEL -#define SCHEMADIALECT -#include -#include -#include - -SKYLARK(HomePage, "") -{ - Sql sql; - sql * Select(ID, NAME, LASTNAME) - .From(PERSON) - .OrderBy(LASTNAME, NAME); - ValueArray person; - ValueMap vm; - while(sql.Fetch(vm)) - person.Add(vm); - http("PERSON", person) - .RenderResult("Skylark09/index"); -} - -struct MyApp : SkylarkApp { - virtual void WorkThread(); - - MyApp() { - root = "myapp"; - threads = 1; // Sqlite3 does not like threads... - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -void InitModel() -{ -#ifdef _DEBUG - SqlSchema sch(SQLITE3); - All_Tables(sch); - SqlPerformScript(sch.Upgrade()); - SqlPerformScript(sch.Attributes()); - sch.SaveNormal(); -#endif -} - -void OpenSQL(Sqlite3Session& sqlite3) -{ - if(!sqlite3.Open(ConfigFile("db"))) { - LOG("Can't create or open database file\n"); - Exit(1); - } -#ifdef _DEBUG - sqlite3.LogErrors(); - sqlite3.SetTrace(); -#endif - SQL = sqlite3; -} - -void MyApp::WorkThread() -{ - Sqlite3Session sqlite3; - OpenSQL(sqlite3); - RunThread(); -} - -void InitDB() -{ - Sqlite3Session sqlsession; - OpenSQL(sqlsession); - SqlSchema sch(SQLITE3); - All_Tables(sch); - SqlPerformScript(sch.Upgrade()); - SqlPerformScript(sch.Attributes()); - - SQL * Insert(PERSON)(NAME,"Joe")(LASTNAME,"Smith"); - SQL * Insert(PERSON)(NAME,"Mike")(LASTNAME,"Carpenter"); - SQL * Insert(PERSON)(NAME,"Jon")(LASTNAME,"Goober"); -} - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - - DeleteFile(ConfigFile("db")); // for this example, always create a new DB - InitDB(); - - MyApp().Run(); -} diff --git a/tutorial/Skylark09/myapp.sch b/tutorial/Skylark09/myapp.sch deleted file mode 100644 index dccae6188..000000000 --- a/tutorial/Skylark09/myapp.sch +++ /dev/null @@ -1,5 +0,0 @@ -TABLE_(PERSON) - INT_ (ID) PRIMARY_KEY AUTO_INCREMENT - STRING_ (NAME, 200) - STRING_ (LASTNAME, 200) -END_TABLE diff --git a/tutorial/Skylark10/Skylark10.upp b/tutorial/Skylark10/Skylark10.upp deleted file mode 100644 index 2be1e0553..000000000 --- a/tutorial/Skylark10/Skylark10.upp +++ /dev/null @@ -1,16 +0,0 @@ -description "Advanced SQL\377"; - -uses - Core, - Skylark, - plugin/sqlite3; - -file - index.witz, - dialog.witz, - myapp.sch, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark10/dialog.witz b/tutorial/Skylark10/dialog.witz deleted file mode 100644 index c93c3bf23..000000000 --- a/tutorial/Skylark10/dialog.witz +++ /dev/null @@ -1,14 +0,0 @@ - - - -
-$post_identity() -

- First name:
- Last name:
-
-

-
- - - diff --git a/tutorial/Skylark10/index.witz b/tutorial/Skylark10/index.witz deleted file mode 100644 index 44ccaa3ff..000000000 --- a/tutorial/Skylark10/index.witz +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - -$for(i in PERSON) - - - - - - -$/ -
No.First NameLast Name
$(i._index + 1).$i.NAME$i.LASTNAMEEdit
-Create new - - diff --git a/tutorial/Skylark10/main.cpp b/tutorial/Skylark10/main.cpp deleted file mode 100644 index 4e190a143..000000000 --- a/tutorial/Skylark10/main.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include -#include - -using namespace Upp; - -#define MODEL -#define SCHEMADIALECT -#include -#include -#include - -SKYLARK(HomePage, "") -{ - http("PERSON", Select(SqlAll()).From(PERSON).OrderBy(LASTNAME, NAME)) - .RenderResult("Skylark10/index"); -} - -SKYLARK(SubmitNew, "create/submit:POST") -{ - SQL * http.Insert(PERSON); - http.Redirect(HomePage); -} - -SKYLARK(New, "create") -{ - http("ACTION", SubmitNew) - .RenderResult("Skylark10/Dialog"); -} - -SKYLARK(SubmitEdit, "edit/submit/*:POST") -{ - SQL * http.Update(PERSON).Where(ID == http.Int(0)); - http.Redirect(HomePage); -} - -SKYLARK(Edit, "edit/*") -{ - int id = http.Int(0); - http - (Select(SqlAll()).From(PERSON).Where(ID == id)) - ("ID", id) - ("ACTION", SubmitEdit, id) - .RenderResult("Skylark10/Dialog"); -} - -struct MyApp : SkylarkApp { - virtual void WorkThread(); - - MyApp() { - root = "myapp"; - threads = 1; // Sqlite3 does not like threads... - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -void InitModel() -{ -#ifdef _DEBUG - SqlSchema sch(SQLITE3); - All_Tables(sch); - SqlPerformScript(sch.Upgrade()); - SqlPerformScript(sch.Attributes()); - sch.SaveNormal(); -#endif -} - -void OpenSQL(Sqlite3Session& sqlite3) -{ - if(!sqlite3.Open(ConfigFile("db"))) { - LOG("Can't create or open database file\n"); - Exit(1); - } -#ifdef _DEBUG - sqlite3.LogErrors(); - sqlite3.SetTrace(); -#endif - SQL = sqlite3; -} - -void MyApp::WorkThread() -{ - Sqlite3Session sqlite3; - OpenSQL(sqlite3); - RunThread(); -} - -void InitDB() -{ - Sqlite3Session sqlsession; - OpenSQL(sqlsession); - SqlSchema sch(SQLITE3); - All_Tables(sch); - SqlPerformScript(sch.Upgrade()); - SqlPerformScript(sch.Attributes()); -} - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - - InitDB(); - - MyApp().Run(); -} diff --git a/tutorial/Skylark10/myapp.sch b/tutorial/Skylark10/myapp.sch deleted file mode 100644 index dccae6188..000000000 --- a/tutorial/Skylark10/myapp.sch +++ /dev/null @@ -1,5 +0,0 @@ -TABLE_(PERSON) - INT_ (ID) PRIMARY_KEY AUTO_INCREMENT - STRING_ (NAME, 200) - STRING_ (LASTNAME, 200) -END_TABLE diff --git a/tutorial/Skylark11/Skylark11.upp b/tutorial/Skylark11/Skylark11.upp deleted file mode 100644 index f53e95046..000000000 --- a/tutorial/Skylark11/Skylark11.upp +++ /dev/null @@ -1,16 +0,0 @@ -description "Language support\377"; - -uses - Core, - Skylark, - plugin/sqlite3; - -file - lang.witz, - index.witz, - index.cs-cz.witz, - main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark11/index.cs-cz.witz b/tutorial/Skylark11/index.cs-cz.witz deleted file mode 100644 index 3dba61896..000000000 --- a/tutorial/Skylark11/index.cs-cz.witz +++ /dev/null @@ -1,8 +0,0 @@ - - - -#include lang -Česká verze
-Hodnota proměnné: $VAR - - diff --git a/tutorial/Skylark11/index.witz b/tutorial/Skylark11/index.witz deleted file mode 100644 index de23f1343..000000000 --- a/tutorial/Skylark11/index.witz +++ /dev/null @@ -1,8 +0,0 @@ - - - -#include lang -English version
-Variable value: $VAR - - diff --git a/tutorial/Skylark11/lang.witz b/tutorial/Skylark11/lang.witz deleted file mode 100644 index 85c68401c..000000000 --- a/tutorial/Skylark11/lang.witz +++ /dev/null @@ -1,4 +0,0 @@ -EN -CZ -
-Current language: $.language
\ No newline at end of file diff --git a/tutorial/Skylark11/main.cpp b/tutorial/Skylark11/main.cpp deleted file mode 100644 index 6da95cdb3..000000000 --- a/tutorial/Skylark11/main.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include - -using namespace Upp; - -SKYLARK(HomePage, "") -{ - http("VAR", t_("Aborted by user.")) - .RenderResult("Skylark11/index"); -} - -SKYLARK(SetLanguage, "setlanguage/*") -{ - int lang = LNGFromText(http[0]); - if(lang) - http.SetLanguage(lang); - http.Redirect(HomePage); -} - -struct MyApp : SkylarkApp { - MyApp() { - root = "myapp"; - threads = 1; // Sqlite3 does not like threads... - #ifdef _DEBUG - prefork = 0; - use_caching = false; - #endif - } -}; - -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - MyApp().Run(); -} diff --git a/tutorial/Skylark12/Ced.cpp b/tutorial/Skylark12/Ced.cpp deleted file mode 100644 index ab0a01cc1..000000000 --- a/tutorial/Skylark12/Ced.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "Skylark12.h" - -void CreateEditDelete::Create(Http& http) -{ - http("ACTION", THISLINK(SubmitCreate)) - .RenderResult(dialog); -} - -void CreateEditDelete::SubmitCreate(Http& http) -{ - SQL * http.Insert(table); - http.Redirect(back); -} - -void CreateEditDelete::Edit(Http& http) -{ - int id = http.Int(0); - http - (Select(columns).From(table).Where(key == id)) - ("ID", id) - ("ACTION", THISLINK(SubmitEdit), id) - .RenderResult(dialog); -} - -void CreateEditDelete::SubmitEdit(Http& http) -{ - SQL * http.Update(table).Where(key == http.Int(0)); - http.Redirect(back); -} - -void CreateEditDelete::Delete(Http& http) -{ - SQL * SqlDelete(table).Where(key == atoi(http[0])); - http.Redirect(back); -} - -void CreateEditDelete::Use() -{ - SKYLARK_METHOD(Create, "create"); - SKYLARK_METHOD(SubmitCreate, "create_submit:POST"); - SKYLARK_METHOD(Edit, "edit/*"); - SKYLARK_METHOD(SubmitEdit, "submit_edit/*:POST"); - SKYLARK_METHOD(Delete, "delete/*"); -} diff --git a/tutorial/Skylark12/Handlers.icpp b/tutorial/Skylark12/Handlers.icpp deleted file mode 100644 index 51ffcd13e..000000000 --- a/tutorial/Skylark12/Handlers.icpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "Skylark12.h" - -void HomePage(Http&); - -SKYLARK_USE(CreateEditDelete, Person, "person") -{ - Person.back = HomePage; - Person.table = PERSON; - Person.dialog = "Skylark12/dialog"; -} - -SKYLARK(HomePage, "") -{ - http("PERSON", Select(ID, FIRSTNAME, LASTNAME, EMAIL).From(PERSON) - .OrderBy(LASTNAME, FIRSTNAME)) - ("CREATE", LINK(Person, Create)) - .RenderResult("Skylark12/index"); -} - -SKYLARK(CatchAll, "**") -{ - http.Redirect(HomePage); -} diff --git a/tutorial/Skylark12/Main.cpp b/tutorial/Skylark12/Main.cpp deleted file mode 100644 index 4ed0279a8..000000000 --- a/tutorial/Skylark12/Main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "Skylark12.h" - -#include -#include - -Skylark12::Skylark12() -{ -#ifdef _DEBUG - prefork = 0; - use_caching = false; -#endif - threads = 1; // Sqlite3 does not work well with multiple threads - port = 8001; -} - -void OpenSQL(Sqlite3Session& session) -{ - if(!session.Open(ConfigFile("db.sqlite3"))) { - SKYLARKLOG("Can't create or open database file"); - Exit(1); - } -#ifdef _DEBUG - session.LogErrors(); - session.SetTrace(); -#endif - SQL = session; -} - -void InitModel() -{ -#ifdef _DEBUG - Sqlite3Session session; - OpenSQL(session); - SqlSchema sch(SQLITE3); - All_Tables(sch); - SqlPerformScript(sch.Upgrade()); - SqlPerformScript(sch.Attributes()); - sch.SaveNormal(); -#endif -} - -void Skylark12::WorkThread() -{ - Sqlite3Session session; - OpenSQL(session); - RunThread(); -} - -// Local server URL: 127.0.0.1:8001 -CONSOLE_APP_MAIN -{ -#ifdef _DEBUG - StdLogSetup(LOG_FILE|LOG_COUT); - Ini::skylark_log = true; -#endif - InitModel(); - Skylark12().Run(); -} - diff --git a/tutorial/Skylark12/Model.sch b/tutorial/Skylark12/Model.sch deleted file mode 100644 index 852e9d896..000000000 --- a/tutorial/Skylark12/Model.sch +++ /dev/null @@ -1,6 +0,0 @@ -TABLE_(PERSON) - INT_ (ID) PRIMARY_KEY AUTO_INCREMENT - STRING_ (FIRSTNAME, 200) - STRING_ (LASTNAME, 200) - STRING_ (EMAIL, 200) -END_TABLE diff --git a/tutorial/Skylark12/Skylark12.h b/tutorial/Skylark12/Skylark12.h deleted file mode 100644 index 1735d8f2d..000000000 --- a/tutorial/Skylark12/Skylark12.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _Skylark12_Skylark12_h -#define _Skylark12_Skylark12_h - -#include -#include - -using namespace Upp; - -#define MODEL -#define SCHEMADIALECT -#include - -struct CreateEditDelete : SkylarkPack { - HandlerId back; - SqlId table; - SqlId key; - SqlSet columns; - String dialog; - - void Create(Http& http); - void SubmitCreate(Http& http); - void Edit(Http& http); - void SubmitEdit(Http& http); - void Delete(Http& http); - - typedef CreateEditDelete CLASSNAME; - - void Use(); - - CreateEditDelete() { key = SqlId("ID"); columns = SqlSet(SqlAll()); } -}; - -class Skylark12 : public SkylarkApp { -public: - virtual void WorkThread(); - - typedef Skylark12 CLASSNAME; - Skylark12(); -}; - -#endif diff --git a/tutorial/Skylark12/Skylark12.upp b/tutorial/Skylark12/Skylark12.upp deleted file mode 100644 index 8b4ccb276..000000000 --- a/tutorial/Skylark12/Skylark12.upp +++ /dev/null @@ -1,18 +0,0 @@ -description "Skylark packs\377"; - -uses - Skylark, - plugin/sqlite3; - -file - Skylark12.h, - Model.sch, - Ced.cpp, - Handlers.icpp, - index.witz, - dialog.witz, - Main.cpp; - -mainconfig - "" = "MT"; - diff --git a/tutorial/Skylark12/dialog.witz b/tutorial/Skylark12/dialog.witz deleted file mode 100644 index a73963976..000000000 --- a/tutorial/Skylark12/dialog.witz +++ /dev/null @@ -1,12 +0,0 @@ -#include Skylark/Base - -#define BODY -
- $post_identity() -

- First name:
- Last name:
- Email:
-
-

-
diff --git a/tutorial/Skylark12/index.witz b/tutorial/Skylark12/index.witz deleted file mode 100644 index 8dae56ee4..000000000 --- a/tutorial/Skylark12/index.witz +++ /dev/null @@ -1,26 +0,0 @@ -#include Skylark/Base - -#define BODY - - - - - - - -$for(i in PERSON) - - - - - - -$/ -
First NameLast NameEmail
$i.FIRSTNAME$i.LASTNAME$i.EMAIL - Edit - Delete -
- -

-Insert new person -Insert new person using LINK