This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
sample_code:visitor_log [2014/10/18 21:49] stevegarman created |
sample_code:visitor_log [2014/11/11 21:56] stevegarman [Notes] larger databàses |
||
---|---|---|---|
Line 2: | Line 2: | ||
This is the first working draft of a visitor sign-in log for my workplace. | This is the first working draft of a visitor sign-in log for my workplace. | ||
- | The final copy includes more error-checking for signing out, extra code to deal with the possibility that the app is left running over midnight and a fair bit of prettying up. | + | The live version |
===== The code ===== | ===== The code ===== | ||
<code javascript visitors.js> | <code javascript visitors.js> | ||
Line 15: | Line 15: | ||
//Called when application is started. | //Called when application is started. | ||
function OnStart(){ | function OnStart(){ | ||
+ | if( ! app.IsTablet()) app.SetOrientation(" | ||
//file variables | //file variables | ||
var d = new Date(); | var d = new Date(); | ||
jsonPath = fileFolder + " | jsonPath = fileFolder + " | ||
- | | + | |
+ " | + " | ||
app.MakeFolder(fileFolder) | app.MakeFolder(fileFolder) | ||
Line 146: | Line 147: | ||
</ | </ | ||
+ | ===== Notes ===== | ||
+ | This app was designed for a tablet. It is a replacement for an old paper form and is designed to be similar. | ||
+ | |||
+ | The final version is in use on a 7-inch tablet, which is mainly kept in landscape mode, though sometimes they rotate the tablet to make it easier to log-out a visitor who is way back the list. | ||
+ | |||
+ | At the suggestion of Jorge Ramirez, I have set the orientation to Landscape if it is being used on a phone. | ||
+ | |||
+ | The final version includes code to save previous files to a network server and the internal code to deal with date/time is significantly more robust, so that visitors who have not been logged out can be copied across to the live list as part of the backup process. | ||
+ | |||
+ | Please note. If this code is used with large numbers of records, the slow bit is displaying them all. For sizeable databases, the method of creating hundreds of layouts will need to be avoided. |