diff --git a/linux/Fix_mod_harbour3.2.0_error_tweb/libharbour.so.3.2.0 b/linux/Fix_mod_harbour3.2.0_error_tweb/libharbour.so.3.2.0 new file mode 100644 index 00000000..dabe14a1 Binary files /dev/null and b/linux/Fix_mod_harbour3.2.0_error_tweb/libharbour.so.3.2.0 differ diff --git a/linux/Fix_mod_harbour3.2.0_error_tweb/mod_harbour.so b/linux/Fix_mod_harbour3.2.0_error_tweb/mod_harbour.so new file mode 100644 index 00000000..227082f8 Binary files /dev/null and b/linux/Fix_mod_harbour3.2.0_error_tweb/mod_harbour.so differ diff --git a/linux/Fix_mod_harbour3.2.0_error_tweb/readme.md b/linux/Fix_mod_harbour3.2.0_error_tweb/readme.md new file mode 100644 index 00000000..4cb5f897 --- /dev/null +++ b/linux/Fix_mod_harbour3.2.0_error_tweb/readme.md @@ -0,0 +1,103 @@ +[![](https://bitbucket.org/fivetech/screenshots/downloads/fivetech_logo.gif)](http://www.fivetechsoft.com "FiveTech Software") + +**How to install mod_harbour:** + +``` +git clone https://github.com/fivetechsoft/mod_harbour +cd /var/www/html +sudo ln -sf ~/mod_harbour/linux/libharbour.so.3.2.0 libharbour.so.3.2.0 +sudo ln -sf ~/mod_harbour/samples modharbour_samples +cd /usr/lib/apache2/modules +sudo ln -sf ~/mod_harbour/linux/mod_harbour.so mod_harbour.so +``` +In /etc/apache2/apache2.conf add these lines at the bottom of the file: +``` +LoadModule harbour_module /usr/lib/apache2/modules/mod_harbour.so + + SetHandler harbour + +``` +Restart apache doing this: + +``` +sudo apachectl restart +``` + +Go to localhost/modharbour_samples/ from your browser and click on any .prg + +
+ +**How to build mod_harbour:** + +You need to install these Linux packages: +``` +sudo apt install libcurl4-openssl-dev +sudo apt install libssl-dev +sudo cp -r /usr/include/x86_64-linux-gnu/curl /usr/include +``` + +First of all, build Harbour +``` +git clone https://github.com/harbour/core harbour +cd harbour +export HB_USER_CFLAGS="-fPIC" +export HB_BUILD_CONTRIBS +make +``` +Install apache and apache2-dev +``` +sudo apt install apache2 +sudo apt install apache2-dev +``` +then give execution permissions to go.sh and execute it: +``` +chmod +x go.sh +./go.sh +``` +Once built, do this: +``` +cd /var/www/html +sudo ln -sf ~/mod_harbour/linux/libharbour.so.3.2.0 libharbour.so.3.2.0 +sudo ln -sf ~/mod_harbour/samples modharbour_samples +cd /usr/lib/apache2/modules +sudo ln -sf ~/mod_harbour/linux/mod_harbour.so mod_harbour.so +``` +and restart apache +``` +sudo systemctl restart apache2 + +or + +sudo service apache2 restart +``` + +Then from your browser go to: +``` +localhost/modharbour_samples +``` +In case you get a wrong behavior, please check: +``` +/var/log/apache2/error.log +``` + +*** + +To use the rewrite module you have to modify /etc/apache2/apache2.conf directly and not use .htaccess (because rewrite gets not enough memory). This way it works fine and there are no segmentation faults in error.log +``` + + SetEnv APP_TITLE "Snipets v0.1" + SetEnv PATH_URL "/snipets" + SetEnv PATH_APP "/snipets" + SetEnv PATH_DATA "/snipets/data/" + DirectoryIndex index.prg main.prg + RewriteEngine on + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.prg/$1 [L] + +``` +https://httpd.apache.org/docs/2.4/en/howto/htaccess.html +*** + +[![](https://bitbucket.org/fivetech/screenshots/downloads/harbour.jpg)](https://harbour.github.io "The Harbour Project") + diff --git a/samples/rastrelliera/data/.htaccess b/samples/rastrelliera/data/.htaccess new file mode 100644 index 00000000..db5f07b9 --- /dev/null +++ b/samples/rastrelliera/data/.htaccess @@ -0,0 +1,6 @@ +Options All -Indexes + + + Order Allow,Deny + Deny from all + diff --git a/samples/rastrelliera/data/controllers.dbf b/samples/rastrelliera/data/controllers.dbf new file mode 100644 index 00000000..f48ef64a Binary files /dev/null and b/samples/rastrelliera/data/controllers.dbf differ diff --git a/samples/rastrelliera/data/controllers.dbt b/samples/rastrelliera/data/controllers.dbt new file mode 100644 index 00000000..57ea6dcd Binary files /dev/null and b/samples/rastrelliera/data/controllers.dbt differ diff --git a/samples/rastrelliera/data/database.dbf b/samples/rastrelliera/data/database.dbf new file mode 100644 index 00000000..495ea2f5 Binary files /dev/null and b/samples/rastrelliera/data/database.dbf differ diff --git a/samples/rastrelliera/data/database.dbt b/samples/rastrelliera/data/database.dbt new file mode 100644 index 00000000..22821a10 Binary files /dev/null and b/samples/rastrelliera/data/database.dbt differ diff --git a/samples/rastrelliera/data/logs.dbf b/samples/rastrelliera/data/logs.dbf new file mode 100644 index 00000000..fd2e4341 Binary files /dev/null and b/samples/rastrelliera/data/logs.dbf differ diff --git a/samples/rastrelliera/data/menus.dbf b/samples/rastrelliera/data/menus.dbf new file mode 100644 index 00000000..809d5e4b Binary files /dev/null and b/samples/rastrelliera/data/menus.dbf differ diff --git a/samples/rastrelliera/data/routes.dbf b/samples/rastrelliera/data/routes.dbf new file mode 100644 index 00000000..b549c69d Binary files /dev/null and b/samples/rastrelliera/data/routes.dbf differ diff --git a/samples/rastrelliera/data/settings.dbf b/samples/rastrelliera/data/settings.dbf new file mode 100644 index 00000000..3591270a Binary files /dev/null and b/samples/rastrelliera/data/settings.dbf differ diff --git a/samples/rastrelliera/data/settings.dbt b/samples/rastrelliera/data/settings.dbt new file mode 100644 index 00000000..c900afd5 Binary files /dev/null and b/samples/rastrelliera/data/settings.dbt differ diff --git a/samples/rastrelliera/data/test1/data/database.dbf b/samples/rastrelliera/data/test1/data/database.dbf new file mode 100644 index 00000000..f8f1af03 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/database.dbf differ diff --git a/samples/rastrelliera/data/test1/data/database.dbt b/samples/rastrelliera/data/test1/data/database.dbt new file mode 100644 index 00000000..22821a10 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/database.dbt differ diff --git a/samples/rastrelliera/data/test1/data/impegna.dbf b/samples/rastrelliera/data/test1/data/impegna.dbf new file mode 100644 index 00000000..d970b87f Binary files /dev/null and b/samples/rastrelliera/data/test1/data/impegna.dbf differ diff --git a/samples/rastrelliera/data/test1/data/logs.dbf b/samples/rastrelliera/data/test1/data/logs.dbf new file mode 100644 index 00000000..9a1a2e59 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/logs.dbf differ diff --git a/samples/rastrelliera/data/test1/data/menus.dbf b/samples/rastrelliera/data/test1/data/menus.dbf new file mode 100644 index 00000000..5db7d44f Binary files /dev/null and b/samples/rastrelliera/data/test1/data/menus.dbf differ diff --git a/samples/rastrelliera/data/test1/data/rastrelliera.dbf b/samples/rastrelliera/data/test1/data/rastrelliera.dbf new file mode 100644 index 00000000..00824001 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/rastrelliera.dbf differ diff --git a/samples/rastrelliera/data/test1/data/settings.dbf b/samples/rastrelliera/data/test1/data/settings.dbf new file mode 100644 index 00000000..0b5d5281 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/settings.dbf differ diff --git a/samples/rastrelliera/data/test1/data/settings.dbt b/samples/rastrelliera/data/test1/data/settings.dbt new file mode 100644 index 00000000..22821a10 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/settings.dbt differ diff --git a/samples/rastrelliera/data/test1/data/tasks.dbf b/samples/rastrelliera/data/test1/data/tasks.dbf new file mode 100644 index 00000000..4ee0f5d0 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/tasks.dbf differ diff --git a/samples/rastrelliera/data/test1/data/tasks.dbt b/samples/rastrelliera/data/test1/data/tasks.dbt new file mode 100644 index 00000000..22821a10 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/tasks.dbt differ diff --git a/samples/rastrelliera/data/test1/data/users.dbf b/samples/rastrelliera/data/test1/data/users.dbf new file mode 100644 index 00000000..b1a1b5e1 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/users.dbf differ diff --git a/samples/rastrelliera/data/test1/data/users.dbt b/samples/rastrelliera/data/test1/data/users.dbt new file mode 100644 index 00000000..22821a10 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/users.dbt differ diff --git a/samples/rastrelliera/data/test1/data/views.dbf b/samples/rastrelliera/data/test1/data/views.dbf new file mode 100644 index 00000000..5e271106 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/views.dbf differ diff --git a/samples/rastrelliera/data/test1/data/views.dbt b/samples/rastrelliera/data/test1/data/views.dbt new file mode 100644 index 00000000..22821a10 Binary files /dev/null and b/samples/rastrelliera/data/test1/data/views.dbt differ diff --git a/samples/rastrelliera/data/test1/views/body.view b/samples/rastrelliera/data/test1/views/body.view new file mode 100644 index 00000000..f0547cd9 --- /dev/null +++ b/samples/rastrelliera/data/test1/views/body.view @@ -0,0 +1,57 @@ + + +
+
+ + + +
+ + {{If( GetUserName() == nil, "", View("menu"))}} + +
+ + + + + + +
+
+ + + \ No newline at end of file diff --git a/samples/rastrelliera/data/test1/views/browse.view b/samples/rastrelliera/data/test1/views/browse.view new file mode 100644 index 00000000..90e9632b --- /dev/null +++ b/samples/rastrelliera/data/test1/views/browse.view @@ -0,0 +1,26 @@ +
+
+
+
+ + +
+
+
+
+ + + + +
+
+
+ {{BuildBrowse( GetContent() )}} +
\ No newline at end of file diff --git a/samples/rastrelliera/data/test1/views/code.view b/samples/rastrelliera/data/test1/views/code.view new file mode 100644 index 00000000..d434c3ba --- /dev/null +++ b/samples/rastrelliera/data/test1/views/code.view @@ -0,0 +1,15 @@ +
function Main() + + ? "Hello world" + +return nil
+ + + + diff --git a/samples/rastrelliera/data/test1/views/default.view b/samples/rastrelliera/data/test1/views/default.view new file mode 100644 index 00000000..e155d700 --- /dev/null +++ b/samples/rastrelliera/data/test1/views/default.view @@ -0,0 +1,3 @@ +{{View("head")}} + +{{View("body")}} \ No newline at end of file diff --git a/samples/rastrelliera/data/test1/views/designer.view b/samples/rastrelliera/data/test1/views/designer.view new file mode 100644 index 00000000..502215b5 --- /dev/null +++ b/samples/rastrelliera/data/test1/views/designer.view @@ -0,0 +1,235 @@ + + + +
+
+
+
+
+
+ {{View([form])}} +
+
+ + + + +
+ + +
+ + + + + +
+
+ \ No newline at end of file diff --git a/samples/rastrelliera/data/test1/views/edit.view b/samples/rastrelliera/data/test1/views/edit.view new file mode 100644 index 00000000..59980af7 --- /dev/null +++ b/samples/rastrelliera/data/test1/views/edit.view @@ -0,0 +1,31 @@ +
+
+ +

Edit record: {{AllTrim(Str(GetVal1()))}}

+
+
+
+
+
+
+
+ {{BuildEdit( GetContent())}} +
+
+
+
+
+ +
+ + +
+
+ \ No newline at end of file diff --git a/samples/rastrelliera/data/test1/views/exec.view b/samples/rastrelliera/data/test1/views/exec.view new file mode 100644 index 00000000..5ce34d9c --- /dev/null +++ b/samples/rastrelliera/data/test1/views/exec.view @@ -0,0 +1,21 @@ +
+
+
+
+
+
+
+ {{Task()}} +
+
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/samples/rastrelliera/data/test1/views/form.view b/samples/rastrelliera/data/test1/views/form.view new file mode 100644 index 00000000..59356cbc --- /dev/null +++ b/samples/rastrelliera/data/test1/views/form.view @@ -0,0 +1,33 @@ + +
+
+
+
+
+
Group1 Header
+
+
+ +
+ +
+ +
+ +
+
+
+
+ \ No newline at end of file diff --git a/samples/rastrelliera/data/test1/views/head.view b/samples/rastrelliera/data/test1/views/head.view new file mode 100644 index 00000000..d8e98f3b --- /dev/null +++ b/samples/rastrelliera/data/test1/views/head.view @@ -0,0 +1,227 @@ + + + + Genesis + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/rastrelliera/data/test1/views/home.view b/samples/rastrelliera/data/test1/views/home.view new file mode 100644 index 00000000..c7b82f7a --- /dev/null +++ b/samples/rastrelliera/data/test1/views/home.view @@ -0,0 +1,9 @@ +
+
+
+

RASTRELLIERA

+

Per iniziare premere sulla categoria dell'articolo.

+
+ + +
diff --git a/samples/rastrelliera/data/test1/views/login.view b/samples/rastrelliera/data/test1/views/login.view new file mode 100644 index 00000000..93c47628 --- /dev/null +++ b/samples/rastrelliera/data/test1/views/login.view @@ -0,0 +1,36 @@ + +
+ +
+
+
+ + +

Login

+
+
+ +
+
+ +
+
+
+ + +
+ +
+
+ +
+ +
+
+
diff --git a/samples/rastrelliera/data/test1/views/menu.view b/samples/rastrelliera/data/test1/views/menu.view new file mode 100644 index 00000000..41ed8702 --- /dev/null +++ b/samples/rastrelliera/data/test1/views/menu.view @@ -0,0 +1,35 @@ +
+
+ + + + TTTT + + + TTBB + + + + +
+
\ No newline at end of file diff --git a/samples/rastrelliera/data/test1/views/sendfile.view b/samples/rastrelliera/data/test1/views/sendfile.view new file mode 100644 index 00000000..6a70e2d5 --- /dev/null +++ b/samples/rastrelliera/data/test1/views/sendfile.view @@ -0,0 +1,38 @@ + +
+
+
+ +

+ Please select a file to send +


+

+
+
+
+
+
+

+ + +
+
+
+ \ No newline at end of file diff --git a/samples/rastrelliera/data/users.dbf b/samples/rastrelliera/data/users.dbf new file mode 100644 index 00000000..fb6067c4 Binary files /dev/null and b/samples/rastrelliera/data/users.dbf differ diff --git a/samples/rastrelliera/data/users.dbt b/samples/rastrelliera/data/users.dbt new file mode 100644 index 00000000..22821a10 Binary files /dev/null and b/samples/rastrelliera/data/users.dbt differ diff --git a/samples/rastrelliera/images/avatar/avatar.png b/samples/rastrelliera/images/avatar/avatar.png new file mode 100644 index 00000000..74ce9ff7 Binary files /dev/null and b/samples/rastrelliera/images/avatar/avatar.png differ diff --git a/samples/rastrelliera/images/avatar/cristobal.jpeg b/samples/rastrelliera/images/avatar/cristobal.jpeg new file mode 100644 index 00000000..60d15b3d Binary files /dev/null and b/samples/rastrelliera/images/avatar/cristobal.jpeg differ diff --git a/samples/rastrelliera/images/avatar/lady.png b/samples/rastrelliera/images/avatar/lady.png new file mode 100644 index 00000000..7c9a8112 Binary files /dev/null and b/samples/rastrelliera/images/avatar/lady.png differ diff --git a/samples/rastrelliera/index.prg b/samples/rastrelliera/index.prg new file mode 100644 index 00000000..8be88318 --- /dev/null +++ b/samples/rastrelliera/index.prg @@ -0,0 +1,831 @@ +static cContent, cAction, cParam1 := "", cParam2 := "", nVal1 := 0, nVal2 := 0,cdart +static cUserName, cCode,deftable +static valcateg +static imp := "impegna" +static nrow_rastr := 0 +//----------------------------------------------------------------------------// + +function Main() + + SET CENTURY ON + + CheckUser() + + + Controller( AP_Args() ) + + + +return nil + +function Getdeftable() + deftable := "rastrelliera" +return deftable + +//----------------------------------------------------------------------------// + +function GetContent() + +return cContent + +//----------------------------------------------------------------------------// + +function GetAction() + +return cAction + +//----------------------------------------------------------------------------// + +function GetParam1() + +return cParam1 + +//----------------------------------------------------------------------------// + +function GetParam2() + +return cParam2 + +//----------------------------------------------------------------------------// + +function GetVal1() + +return nVal1 + +//----------------------------------------------------------------------------// + +function GetVal2() + +return nVal2 + +//----------------------------------------------------------------------------// + +function GetUserName() + +return cUserName + +//----------------------------------------------------------------------------// + +function GetCode() + +return cCode + +//----------------------------------------------------------------------------// + + +function GetCateg() + +return valcateg + + + + +//----------------------------------------------------------------------------// + +function ItemStatus( cItem ) + +return If( cContent == cItem, "class='active'", nil) + +//----------------------------------------------------------------------------// + +function GetColor1() ; return "mediumblue" +function GetColor2() ; return "darkblue" +function GetColor3() ; return "rgb(34, 45, 50)" + + + +//----------------------------------------------------------------------------// + +function CheckUser() + + local hCookies := GetCookies() + + if hb_HHasKey( hCookies, "genesis" ) .and. ! Empty( hCookies[ "genesis" ] ) + cUserName = hCookies[ "genesis" ] + + endif + + if cUserName != nil + if ! File( hb_vfDirExists( hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName ) ) + hb_vfDirMake( hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName ) + hb_vfDirMake( hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/data" ) + hb_vfDirMake( hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/images" ) + hb_vfDirMake( hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/default.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/default.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/head.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/head.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/body.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/body.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/browse.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/browse.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/edit.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/edit.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/menu.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/menu.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/home.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/home.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/login.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/login.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/exec.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/exec.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/code.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/code.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/sendfile.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/sendfile.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/form.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/form.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/designer.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/designer.view" ) + hb_vfCopyFile( hb_GetEnv( "PRGPATH" ) + "/views/impegna.view",; + hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/views/impegna.view" ) + endif + endif + +return nil + +//----------------------------------------------------------------------------// + +function Controller( cRequest ) + + local aRequest + + + if ":" $ cRequest + aRequest = hb_aTokens( cRequest, ":" ) + cRequest = if(aRequest[ 2 ] == imp, aRequest[2],aRequest[1]) + + + cAction = If( Len( aRequest ) > 1, aRequest[ 2 ], "browse" ) + + + + cParam1 = If( Len( aRequest ) > 2, aRequest[ 3 ], aRequest[2]) + cParam2 = If( Len( aRequest ) > 3, aRequest[ 4 ], nil) + valcateg = If( Len( aRequest ) > 3, aRequest[ 4 ], nil) + nVal1 = Val( iif(cParam1 != nil,cParam1,"" )) + nVal2 = Val( iif(cParam2 != nil,cParam2,"" )) + + + + nrow_rastr := If( Len( aRequest ) > 4, aRequest[ 5 ],nil) + + if nrow_rastr != nil + MWRITE("nrowrastr",nrow_rastr) + end if + + + + + + + endif + + if "-" $ cRequest + aRequest = hb_ATokens(cRequest,"-") + cRequest = aRequest[1] + valcateg = aRequest[2] + + + + + endif + + if cRequest == "logout" + AP_HeadersOutSet( "Set-Cookie", "genesis=" ) + cRequest = "login" + cUserName = nil + else + if ! hb_HhasKey( GetCookies(), "genesis" ) + cRequest = "login" + else + if cUserName != nil + if cRequest == "login" + cRequest = "home" + endif + else + cRequest = "login" + endif + endif + endif + + hb_default( @cAction, "browse" ) + + if cAction $ "add,browse" + if nVal1 == 0 + nVal1 = 20 + endif + endif + + cContent = If( Empty( cRequest ), "home",; + If( cRequest $ "login,logout,home,rastrelliera,impegna,controllers,menus,routes,database,users,settings,tasks,views",; + cRequest, "home" ) ) + + do case + case AP_Method() == "GET" + AP_RPuts( View( "default" ) ) + + case AP_Method() == "POST" + do case + case cAction == "save" + + Save() + + case cRequest == "login" + Login() + endcase + endcase + +return nil + +//----------------------------------------------------------------------------// + +function Router() + + local cRoute := "home" + + if GetContent() != "home" + if GetContent() == "login" + cRoute = "login" + else + if GetAction() == "edit" + cRoute = "edit" + elseif GetAction() == "exec" + cRoute = "exec" + elseif GetAction() == "impegna" + cRoute = "impegna" + + else + cRoute = "browse" + endif + endif + endif + +return View( cRoute ) + +//----------------------------------------------------------------------------// + + + +function AddLog() + + if GetContent() != "logs" + OpenTable( "logs" ) + APPEND BLANK + + if RLock() + field->date := Date() + field->time := Time() + field->userip := AP_UserIP() + field->method := AP_Method() + field->content := If( ! Empty( GetContent() ), GetContent(), nil) + field->action := If( ! Empty( GetAction() ), GetAction(), nil) + field->param1 := If( ! Empty( GetVal1() ), GetVal1(), 0 ) + field->param2 := If( ! Empty( GetVal2() ), GetVal2(), 0 ) + DbUnLock() + endif + + USE + endif + +return nil + +//----------------------------------------------------------------------------// + +function Login() + + local hPairs := AP_PostPairs() + + do case + + + case hb_HHasKey( hPairs, "continue" ) + if Identify( hPairs[ "username" ], hPairs[ "password" ] ) + cContent = "home" + AP_HeadersOutSet( "Set-Cookie", "genesis=" + cUserName ) + + AP_RPuts( View( "default" ) ) + else + AP_RPuts( View( "default" ) ) + AP_RPuts( "" ) + endif + + case hb_HHasKey( hPairs, "ok" ) + AddUser( hPairs ) + AP_RPuts( View( "default" ) ) + AP_RPuts( "" ) + endcase + +return nil + +//----------------------------------------------------------------------------// + +function AddUser( hPairs ) + + OpenTable( "users" ) + APPEND BLANK + + if RLock() + field->date := Date() + field->first := hb_HGet( hPairs, "first" ) + field->last := hb_HGet( hPairs, "last" ) + field->email := hb_UrlDecode( hb_HGet( hPairs, "email" ) ) + field->phone := hb_HGet( hPairs, "phone" ) + field->passmd5 := hb_Md5( hb_HGet( hPairs, "password" ) ) + DbUnLock() + endif + USE + +return nil + +//----------------------------------------------------------------------------// + +function Identify( _cUserName, _cPassword ) + + local lFound + + OpenTable( "users" ) + + LOCATE FOR ( field->email = hb_UrlDecode( _cUserName ) .or. field->phone = _cUserName ) .and. ; + field->passmd5 = hb_Md5( _cPassword ) + + lFound = Found() + + if lFound + cUserName = AllTrim( field->first ) + else + cUserName = nil + endif + + USE + +return lFound + + + +//----------------------------------------------------------------------------// + +function View( cView ) + + local cViewName, lFound, cData + + if cUserName == nil + cViewName = hb_GetEnv( "PRGPATH" ) + "/views/" + cView + ".view" + else + + cViewName = hb_GetEnv( "PRGPATH" ) + "/data/"+ cUserName+ + "/views/" + cView + ".view" + endif + + lFound = File( cViewName ) + + if ! lFound + + LOCATE FOR AllTrim( field->name ) = AllTrim( cView ) + if lFound := Found() + cData = field->code + endif + USE + endif + + if lFound + if Empty( cData ) + cData = MemoRead( cViewName ) + endif + + while ReplaceBlocks( @cData, "{{", "}}" ) + end + else + cData = "

" + cViewName + " not found!

" + endif + +return cData + +//----------------------------------------------------------------------------// + + + +function BuildBrowse( cTableName ) + + local cHtml := "", n, nRow := 0,CODART,nrow_imp + local I_CATEG := '/var/tmp/I_CATEG' + local I_IMP := '/var/tmp/I_IMP' + + + + if cTableName == imp + + + + + /*--------------------------------------------------------RASTRELLIERA-----------------------------------------------------------*/ + OpenTable( deftable ) + + DbGoTo( Val(mread("nrowrastr")) ) + + cHtml += '

Riga selezionata:

' + cHtml += '' + CRLF + cHtml += '' + CRLF + for n = 1 to FCount() + if n != 8 + cHtml += '' + CRLF + cHtml+='' + + cHtml += '' + for n = 1 to FCount() + + if n != 8 + do case + + case FieldType( n ) == "D" + cHtml += '' + CRLF + otherwise + cHtml += '" + CRLF + + do case + case FieldName(n) == "CATEG" + valcateg = ValToChar(FieldGet(n)) + case FieldName(n) == "CODART" + cdart = ValToChar(FieldGet(n)) + + endcase + + + + + endcase + end if + next + + + cHtml += '' + cHtml+='' + + cHtml += '
' + FieldName( n ) + '' + end if + next + cHtml += '
' + DtoC( FieldGet( n ) ) + '' + AllTrim(ValToChar( FieldGet( n ) )) + "
' + CRLF + cHtml += '

Elenco barre impegnate:

' + + + + nrow_imp = nVal1 + nVal1 = 20 + + USE + /*----------------------------------------------------------------------------------------------------------------------------*/ + + + + end if + + + + OpenTable( cTableName ) + + + + + if ! Empty( GetAction() ) .and. GetAction() == "add" + APPEND BLANK + do case + case cTableName == imp + if RLock() + replace CATEG with valcateg + replace impegna->cdart with cdart + DbUnLock() + endif + case cTableName == deftable + if RLock() + replace CATEG with valcateg + + DbUnLock() + endif + endcase + + + + GO TOP + endif + + if ! Empty( GetAction() ) .and. GetAction() == "del" + USE + if cUserName != nil + USE ( hb_GetEnv( "PRGPATH" ) + "/data/" + cUserName + "/data/" + cTableName ) NEW + endif + + + if cTableName == imp + dbGoto(nrow_imp) + else + DbGoTo( GetVal1() ) + end if + + DELETE + PACK + USE + OpenTable( cTableName ) + GO TOP + + cParam1 := "" + + nVal1 := 20 + + + endif + + + //Quando la tabella diventa rastrelliera creo indice per filtrare con categoria + do case + case cTableName == deftable + + INDEX ON rastrelliera->CATEG to (I_CATEG) for rastrelliera->CATEG = valcateg + SET INDEX TO (I_CATEG) + + case cTableName == imp + + INDEX ON impegna->CATEG to (I_IMP) for impegna->CATEG = AllTrim(valcateg) .AND. impegna->cdart = cdart + SET INDEX TO (I_IMP) + + end case + + + if ! Empty( GetAction() ) .and. GetAction() == "search" + SET FILTER TO Upper( GetParam1() ) $ Upper( DBRECORDINFO( 7 ) ) + GO TOP + nVal1 = 20 + endif + + + if GetVal2() != 0 + DbSkip( GetVal2() ) + endif + + cHtml += '
' + CRLF + cHtml += '
' + cHtml += '
' + cHtml += '' + CRLF + cHtml += '' + CRLF + cHtml += '' + CRLF + + cHtml += '' + CRLF + for n = 1 to FCount() + if n != 8 + cHtml += '' + cHtml+= '' + CRLF + cHtml += '' + cHtml+='' + + while ! Eof() .and. nRow < GetVal1() + + + cHtml += '' + CRLF + cHtml += '" + CRLF + for n = 1 to FCount() + if n != 8 + cHtml += '"+ CRLF + end if + next + + + + + cHtml += "
#' + FieldName( n ) + '' + end if + next + cHtml += 'AZIONI
' + AllTrim( Str( RecNo() ) ) + "' + ValToChar( FieldGet( n ) ) + ""+ CRLF + cHtml += ' + + {{hb_CapFirst(GetContent())}} + + + + + + +
+ {{Router()}} +
+ + + + + + + + + + \ No newline at end of file diff --git a/samples/rastrelliera/views/browse.view b/samples/rastrelliera/views/browse.view new file mode 100644 index 00000000..90e9632b --- /dev/null +++ b/samples/rastrelliera/views/browse.view @@ -0,0 +1,26 @@ +
+
+
+
+ + +
+
+
+
+ + + + +
+
+
+ {{BuildBrowse( GetContent() )}} +
\ No newline at end of file diff --git a/samples/rastrelliera/views/code.view b/samples/rastrelliera/views/code.view new file mode 100644 index 00000000..d434c3ba --- /dev/null +++ b/samples/rastrelliera/views/code.view @@ -0,0 +1,15 @@ +
function Main() + + ? "Hello world" + +return nil
+ + + + diff --git a/samples/rastrelliera/views/default.view b/samples/rastrelliera/views/default.view new file mode 100644 index 00000000..e155d700 --- /dev/null +++ b/samples/rastrelliera/views/default.view @@ -0,0 +1,3 @@ +{{View("head")}} + +{{View("body")}} \ No newline at end of file diff --git a/samples/rastrelliera/views/designer.view b/samples/rastrelliera/views/designer.view new file mode 100644 index 00000000..502215b5 --- /dev/null +++ b/samples/rastrelliera/views/designer.view @@ -0,0 +1,235 @@ + + + +
+
+
+
+
+
+ {{View([form])}} +
+
+ + + + +
+ + +
+ + + + + +
+
+ \ No newline at end of file diff --git a/samples/rastrelliera/views/edit.view b/samples/rastrelliera/views/edit.view new file mode 100644 index 00000000..59980af7 --- /dev/null +++ b/samples/rastrelliera/views/edit.view @@ -0,0 +1,31 @@ +
+
+ +

Edit record: {{AllTrim(Str(GetVal1()))}}

+
+
+
+
+
+
+
+ {{BuildEdit( GetContent())}} +
+
+
+
+
+ +
+ + +
+
+ \ No newline at end of file diff --git a/samples/rastrelliera/views/exec.view b/samples/rastrelliera/views/exec.view new file mode 100644 index 00000000..5ce34d9c --- /dev/null +++ b/samples/rastrelliera/views/exec.view @@ -0,0 +1,21 @@ +
+
+
+
+
+
+
+ {{Task()}} +
+
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/samples/rastrelliera/views/form.view b/samples/rastrelliera/views/form.view new file mode 100644 index 00000000..59356cbc --- /dev/null +++ b/samples/rastrelliera/views/form.view @@ -0,0 +1,33 @@ + +
+
+
+
+
+
Group1 Header
+
+
+ +
+ +
+ +
+ +
+
+
+
+ \ No newline at end of file diff --git a/samples/rastrelliera/views/head.view b/samples/rastrelliera/views/head.view new file mode 100644 index 00000000..d8e98f3b --- /dev/null +++ b/samples/rastrelliera/views/head.view @@ -0,0 +1,227 @@ + + + + Genesis + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/rastrelliera/views/home.view b/samples/rastrelliera/views/home.view new file mode 100644 index 00000000..c7b82f7a --- /dev/null +++ b/samples/rastrelliera/views/home.view @@ -0,0 +1,9 @@ +
+
+
+

RASTRELLIERA

+

Per iniziare premere sulla categoria dell'articolo.

+
+ + +
diff --git a/samples/rastrelliera/views/login.view b/samples/rastrelliera/views/login.view new file mode 100644 index 00000000..93c47628 --- /dev/null +++ b/samples/rastrelliera/views/login.view @@ -0,0 +1,36 @@ + +
+ +
+
+
+ + +

Login

+
+
+ +
+
+ +
+
+
+ + +
+ +
+
+ +
+ +
+
+
diff --git a/samples/rastrelliera/views/menu.view b/samples/rastrelliera/views/menu.view new file mode 100644 index 00000000..41ed8702 --- /dev/null +++ b/samples/rastrelliera/views/menu.view @@ -0,0 +1,35 @@ +
+
+ + + + TTTT + + + TTBB + + + + +
+
\ No newline at end of file diff --git a/samples/rastrelliera/views/sendfile.view b/samples/rastrelliera/views/sendfile.view new file mode 100644 index 00000000..6a70e2d5 --- /dev/null +++ b/samples/rastrelliera/views/sendfile.view @@ -0,0 +1,38 @@ + +
+
+
+ +

+ Please select a file to send +


+

+
+
+
+
+
+

+ + +
+
+
+ \ No newline at end of file