Skip to content

Commit ab47641

Browse files
authored
Merge pull request knop-project#133 from knop-project/v9.3
Merge v9.3 branch onto master branch
2 parents 8e68733 + 96054de commit ab47641

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1071
-870
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
.idea
2+
.DS_Store
3+
__assets
14
/.buildpath
25
/.project
3-
.DS_Store
46
*.bbproject*
57
SQLiteDBs/

knop9/INSTALL.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,20 @@ Navigation method
7373
-----------------
7474
The navigation method for the demo is initially set to 'path', which uses virtual URLs. If you can't use virtual URLs, you can change the default navigation method by configuring the variable `navmethod` and setting it to the value of 'param' in `demo/_config/cfg__global.inc`.
7575

76+
Visit demo site
77+
---------------
78+
Once you have configured the Knop demo site, you may visit it in a web browser.
79+
80+
To demonstrate simple authentication, visit the login page, for example:
81+
82+
<http://myhostname/login/>
83+
84+
For `Username` and `Password`, use any `email` and `password` in the `knopdemo` database, for example, `[email protected]` and `demo`.
85+
86+
The demo site does not follow best security practices for authentication, such as hashing of passwords, and its methods should not be used in production. This method is for demonstration of authentication only.
87+
7688
Upgrading Knop
77-
--------------
89+
==============
7890
To upgrade Knop, overwrite the Knop libraries in the appropriate location, then either restart the instance or use the Knop type reloader (see "Reload Knop types" above).
7991

8092
Install L-Debug

knop9/databases/knopdemo.sql

+86-145
Large diffs are not rendered by default.

knop9/demo/_action/act_advanced_edit.inc

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<?LassoScript
1+
<?LassoScript
22

3-
// process form
3+
// process form
44
// "the more complicated way"
55

66
// first load field data from form submission
@@ -12,18 +12,18 @@ $trace -> insert($f -> updatefields);
1212
// do nothing
1313
else( $f -> getbutton == 'save' && $f -> isvalid);
1414

15-
$d -> saverecord( -fields=($f -> updatefields),
16-
-lockvalue=($f -> lockvalue),
15+
$d -> saverecord( -fields=($f -> updatefields),
16+
-lockvalue=($f -> lockvalue),
1717
-user=$s_user);
1818

1919
else( $f -> getbutton == 'add' && $f -> isvalid);
2020

21-
$d -> addrecord( -fields=($f -> updatefields),
21+
$d -> addrecord( -fields=($f -> updatefields),
2222
-keyvalue=($f -> keyvalue));
2323

2424
else( $f -> getbutton == 'delete');
2525

26-
$d -> deleterecord( -lockvalue=($f -> lockvalue),
26+
$d -> deleterecord( -lockvalue=($f -> lockvalue),
2727
-user=$s_user);
2828

2929
/if;
@@ -38,5 +38,8 @@ $trace -> insert($f -> updatefields);
3838

3939
if( $d -> error_code);
4040
$message -> insert($d -> error_msg + ' ' + $d -> error_code);
41+
if( $d -> error_data);
42+
$message -> insert($d -> error_data);
43+
/if;
4144
/if;
4245
?>

knop9/demo/_action/act_customer_edit.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// process form
44
// "the easy way"

knop9/demo/_action/act_login.inc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<?LassoScript
1+
<?LassoScript
22

33

44
// load the field values from the form submission into the form
55
$loginform -> loadfields;
66

77

88
// authenticate the user
9-
$s_user -> login(-username=($loginform -> username),
10-
-password=($loginform -> password));
9+
$s_user -> login(-username=($loginform -> getvalue('username')),
10+
-password=($loginform -> getvalue('password')));
1111

1212
// check if authentication was successful
1313
if($s_user -> auth);

knop9/demo/_config/cfg__global.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22
// Use some kind of security to prevent l-debug running where it should not.
33
// Uncomment the next line to activate l-debug, assuming you have installed it.
44
// client_getparams >> 'debug' && server_name == 'knop9' ? debug->activate

knop9/demo/_config/cfg__lang.inc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33

44
// Configure language strings
@@ -144,6 +144,7 @@ else(string($s_lang) -> size > 0);
144144

145145
else;
146146
// no specific language has been chosen, use the visitor's preferred language acording to the browser's request header
147+
$lang_ui -> setlanguage($lang_ui -> browserlanguage);
147148
/if;
148149

149150

knop9/demo/_config/cfg_advanced_edit.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// initiate empty array to hold options for select field
44
var( 'options'=array);

knop9/demo/_config/cfg_advanced_list.inc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// create grid object for the record list
44
var( 'list'=knop_grid(
@@ -33,11 +33,11 @@ $list -> addfield(
3333
-name='enabled',
3434
-width=80,
3535
-template=map(
36-
1='<span style="color: green;">' + $lang_ui -> yes + '</span>',
37-
-default='<span style="color: red;">&bull;</span>'));
36+
'1'='<span style="color: green;">' + $lang_ui -> yes + '</span>',
37+
'-default'='<span style="color: red;">&bull;</span>'));
3838
$list -> addfield(
39-
-label='Compund',
40-
-name='enabled',
39+
-label='Modified',
40+
-name='moddate',
4141
-width=150,
4242
-template={return date( field( 'moddate')) -> format( $lang_ui -> dateformat_short)});
4343

knop9/demo/_config/cfg_customer_edit.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// create form object
44
var('f'=knop_form(

knop9/demo/_config/cfg_customer_list.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// create grid object for records list
44
var('list'=knop_grid(

knop9/demo/_config/cfg_login.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// Create login form
44

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
[/* Show the edit form */]
1+
[/* Show the edit form */]
22
[$f -> renderform]

knop9/demo/_content/cnt_advanced_list.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[/* Show record listing */]
1+
[/* Show record listing */]
22
[$list -> renderhtml]
33

44
[/* Show button to create new record */]
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
[/* Show the edit form */]
1+
[/* Show the edit form */]
22
[$f -> renderform]

knop9/demo/_content/cnt_customer_list.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[/* Show record listing */]
1+
[/* Show record listing */]
22
[$list -> renderhtml]
33

44
[/* Show button to create new record */]

knop9/demo/_content/cnt_login.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[if($s_user -> auth)]
2-
<p>[$lang_ui -> loggedinas(-replace=array($s_user -> firstname, $s_user -> lastname))]</p>
1+
[if($s_user -> auth)]
2+
<p>[$lang_ui -> loggedinas(-replace=array($s_user -> getdata('firstname'), $s_user -> getdata('lastname')))]</p>
33
<p><a href="[$nav -> url(-urlargs='-action=logout')]">[$lang_ui -> logout]</a></p>
44
[else]
55
[$loginform -> renderform]

knop9/demo/_content/cnt_sitemap.inc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-

2-
[$nav -> renderhtml(-renderpath='/', -expand)]
1+
[$nav -> renderhtml(-renderpath='/', -expand)]

knop9/demo/_library/lib__global.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// dynamically disable certain nav elements - after action
44

knop9/demo/_library/lib_advanced_edit.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// initiate form to capture keyvalue, set formmode etc.
44
if($f -> error_code == 0);
@@ -7,7 +7,7 @@ if($f -> error_code == 0);
77

88
if( $f -> error_code == 0 && $f -> formmode == 'edit');
99
// an existing record is requested, load field data from database
10-
$d->getrecord(-keyvalue = $f -> keyvalue, -lock, -user=$s_user);
10+
$d->getrecord(-keyvalue = $f -> keyvalue, -lock=true, -user=$s_user);
1111
$f -> loadfields( -database);
1212

1313
else;

knop9/demo/_library/lib_advanced_list.inc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// find out the current skiprecords value based on the -page parameter and $maxrecords
44
$skiprecords = $list -> page_skiprecords($maxrecords);
@@ -18,7 +18,7 @@
1818

1919

2020
// get list of records
21-
$d -> select($searchparams);
21+
$d -> select(-search=$searchparams);
2222

2323

2424
// check if the -page value was out of bounds
@@ -28,7 +28,7 @@
2828
$list -> 'page' = $list -> lastpage;
2929
$skiprecords = $list -> page_skiprecords($maxrecords);
3030
$searchparams -> removeall(-skiprecords) & insert( -skiprecords=$skiprecords);
31-
$d -> select($searchparams);
31+
$d -> select(-search=$searchparams);
3232
/if;
3333

3434

knop9/demo/_library/lib_customer_edit.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// initiate form to capture keyvalue, set formmode etc.
44
if($f -> error_code == 0); // there was no error in the action

knop9/demo/_library/lib_customer_list.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?LassoScript
1+
<?LassoScript
22

33
// find out the current skiprecords value based on the -page parameter and $maxrecords
44
$skiprecords = $list -> page_skiprecords($maxrecords);
@@ -17,7 +17,7 @@
1717
$searchparams -> merge($list -> quicksearch);
1818

1919
// get list of records
20-
$d -> select($searchparams);
20+
$d -> select(-search=$searchparams);
2121

2222

2323

knop9/demo/css/form.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fieldset {
1+
fieldset {
22
background-color: #f7f7f7;
33
padding: 10px;
44
/*width: 600px;*/

knop9/demo/css/general.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
body {
1+
body {
22
margin: 10px;
33
font-family: verdana, arial;
44
font-size: 12px;

knop9/demo/css/grid.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
table.grid {
1+
table.grid {
22
border-collapse: collapse;
33
border-bottom: 1px solid #ccc;
44
}

knop9/demo/css/nav.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-

1+
22
#menu {
33
font-family: verdana;
44
font-size: 12px;

knop9/demo/error.lasso

Whitespace-only changes.

knop9/demo/index.lasso

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?lassoscript
1+
<?lassoscript
22
33
// Specify the root path to this solution. The path should begin and end with "/".
44
// Specify just "/" if the solution is at the virtual host root instead of in a sub folder.
@@ -81,6 +81,11 @@ if( $message -> size);
8181
if( $messageitem -> type == 'pair');
8282
// if message item is a pair, the left side of the pair is a class name to use to format this message text
8383
$messageitem = ('<span class="' + ($messageitem -> name) + '">' + ($messageitem -> value) + '</span>');
84+
else( $messageitem -> type == 'map');
85+
iterate($messageitem, local(i)) => {^
86+
#i -> first + ': ' + #i -> second
87+
loop_count != $messageitem -> size ? '<br>'
88+
^}
8489
else;
8590
$messageitem;
8691
/if;

knop9/knoplibs/_inc/help.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ while(#myregexp -> find) => {
3333
$myresult -> join('\r')
3434
'</pre>'
3535
*/
36-
?>
36+
?>

knop9/knoplibs/_inc/reload.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ with reloaditem in #reloadarray do => {
3535
if(#message -> size > 0)
3636
#message -> join('<br>')
3737
/if
38-
?>
38+
?>

knop9/knoplibs/_init.lasso

+34-32
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
[
2-
/* =====================================================
3-
Pull in core methods
4-
This is done in-order so if you wish to load any before others then shuffle the order of the array as desired.
5-
===================================================== */
6-
local(coremethods = array(
7-
// 'debug.type',
8-
'knop_utils',
9-
'knop_base',
10-
'knop_cache',
11-
'knop_lang',
12-
'knop_database',
13-
'knop_form',
14-
'knop_grid',
15-
'knop_nav',
16-
'knop_user'
17-
)
18-
)
1+
<?lasso
2+
/*
3+
Load core methods in order.
4+
Optionally shuffle the loading order of elements as desired.
5+
*/
6+
local(coremethods) = array(
7+
// 'debug.type.lasso',
8+
'knop_utils.lasso',
9+
'knop_base.lasso',
10+
'knop_cache.lasso',
11+
'knop_lang.lasso',
12+
'knop_database.lasso',
13+
'knop_form.lasso',
14+
'knop_grid.lasso',
15+
'knop_nav.lasso',
16+
'knop_user.lasso'
17+
)
1918
20-
(not lasso_tagExists('debug')) ? #coremethods -> insertfirst('debug.type')
21-
// Courtesy of Ke Carlton, www.l-debug.org. L-Debug for Lasso 9 All rights reserved — K Carlton 2011-2013
2219
23-
with i in #coremethods do => {
24-
protect => {
25-
handle_error => {
26-
log_critical('Load failure on ' + #i + ' ' + error_msg)
27-
}
28-
log_critical('Prepping to load ' + #i)
29-
lassoapp_include(#i+'.lasso')
30-
log_critical('Done with ' + #i)
31-
}
32-
}
20+
(not lasso_tagExists('debug')) ? #coremethods -> insertfirst('debug.type.lasso')
21+
// Courtesy of Ke Carlton. L-Debug for Lasso 9, https://github.com/zeroloop/l-debug
3322
34-
error_reset
23+
with file in #coremethods do protect => {
24+
local(s) = micros
25+
handle => {
26+
stdoutnl(
27+
error_msg + ' (' + ((micros - #s) * 0.000001) -> asstring(-precision=3) + ' seconds)'
28+
)
29+
}
3530
36-
]
31+
stdout('\t' + #file + ' - ')
32+
33+
web_request
34+
? library(include_path + #file)
35+
| lassoapp_include(#file)
36+
37+
}
38+
?>

0 commit comments

Comments
 (0)