Notice Board Web App (0.0.1)


This module implements a simple notice board for company communications.  download noticeboard (RAR file)
Can be used as-is with Xitami, Apache and IIS7. Needs
latest libraries (free2.max).

The app is over-simplyfied to make easier its understanding, yet is completely usable as is, with some care such as limiting access to the maintenance page only to authorized users.

Overall structure of the module

Main pages
index.msp Frame page Contains the frames. Contains the code for tracking users that access the application. Creates automatically all necessary files. Users are monitored by IP address.
index_frm0.msp Top frame Top banner This is a 2-passages page: when first called gets from browser some informations by using a javascript, then submits the results to itself to process it.
The results are converted into MaxScript variables for later use.
index_frm1.msp Left frame Vertical left menu Main menu: shows available choices and the code to query the tracker database to offer informations on user (such last visit's date and time).
index_frm2.msp Right frame Target frame for menu choices and most operations Contains the code to generate all tables and indexes for the application, except user tracking. Shows the application logo and some quick links.
index_frm3.msp Bottom frame Links and aknowledgments. Not used by the app Available for personalizations, credits and useful links.
Actuator pages  
browse.msp Left frame List of records with links for display the content shows on left panel the list of notices available. When clicked shows the corresponding record on target frame on right.
display.msp Right frame Display the board with the current notice in graphical view Needs VAR_RECNO carrying the record number to go. Gathers some fields and display the content on the notice board picture.
edit.msp Right frame Display a web form for editing current record MaxObject: VAR_ACTION accepts APPEND, SAVE, LIST, EDIT and SHOW. Needs VAR_RECNO for record positioning.
Static pages  
maint.htm Right frame Links for add a new record or edit existing ones Contains two links with appropriate parameters for the MaxObject that implements all the necessary functions. Just remove them and place the links anywhere else to restrict the capabilities to add notices to everyone.
For example you can create a folder where to place this page or its links, then protect its access by editing Xitami default.aut authorization file
about.htm Right frame Shows info about the app Available for personalization
help.htm Right frame Show an help page Available for personalization
htmlheader.txt none used by MaxScript Common HTML header to be included in pages using the function include()

Installation instructions

Download the compressed file.
It contains a folder noticeboard: just extract it as a whole and place it under your current site into /APPS (i.e. c:\dbfree\webpages\lib or c:\dbfree\webpages\public\web1\apps depending by your DBFree version).

The module is immediately active: you can test it by calling it from your browser at the address http://localhost.winix.it/apps/noticeboard/index.msp (assuming you have DBFree 1.9)

If you have latest DBFree 2.1 version you should already see an automatically generated link listed in your application menu.
Otherwise just create manually a link.

Databases structure

Structure of table BOARD
Real name:[
BOARD.DBF

Structure of table BOARD_DET
Real name:[
BOARD_DET.DBF]

Field # Fieldname Type Size Descr
1 MSG_ID C 12 Key Field
2 D_REG D 12 Date of creation (indexed)
3 T_REG C 10 Time of creation
4 TTL_DAYS N 10 Time-to-live (days)
5 D_END D 12 To be shown until this date
6 ONLY_TO C 50 To be shown to these groups only
7 MSG_TYPE C 20 Category of the notice
8 ABSTRACT C 30 Abstract to be used in searches
9 SUBJECT C 128 Subject of the notice
10 MSG_BODY M 75 Full text of the notice
11 MSG_FILE C 80 File to read the text from (opt)
12 ATTACHMENT C 80 File to be displayied (opt)
13 POSTED_BY C 35 Username of the author
14 REPLY_TO C 35 Mail address for replies
15 PREV_MSG C 15 Conversation: previous post
16 NEXT_MSG C 15 Conversation: next post
17 REQ_CONF L 1 Require user to confirm read?
18 VISIB N 10 Numeric code for visibility level
Field # Fieldname Type Size
1 MSG_ID C 12
2 D_REG D 12
3 T_REG C 10
4 D_AKN D 12
5 USR_NAME C 22
6 IP_ADDR C 15

(not used)

How to build databases for notice board

The module builds all the necessary files when lauched.
Databases are located in your \DB folder (usually c:\dbfree\db). To reset demo data just delette all files and open noticeboard in your browser.

In case, this is the code to rebuild databases (indexes will be re-created automatically first time the module is invoked):

cDb  := cDBpath + "BOARD.DBF"
cXb  := cDBpath + "BOARD.MTX"
if not file(cDb)
  ainit( "aField","MSG_ID","D_REG","T_REG","TTL_DAYS","D_END","ONLY_TO","MSG_TYPE","ABSTRACT","SUBJECT","MSG_BODY","MSG_FILE","ATTACHMENT","POSTED_BY","REPLY_TO","PREV_MSG","NEXT_MSG","REQ_CONF","VISIB")
  ainit( "aType","C","D","C","N","D","C","C","C","C","M","C","C","C","C","C","C","L","N")
  ainit( "aSize",12,8,10,3,8,50,20,30,128,10,80,80,35,35,15,15,1,2)
  ainit( "aDec",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
  create (cDb) from aField, aType, aSize, aDec
  ? "Rebuilt table " + cDb
endif

cDb  := cDBpath + "BOARD_DET.DBF"
cXb  := cDBpath + "BOARD_DET.MTX"
if not file(cDb)
  ainit( "aField","MSG_ID","D_REG","T_REG","D_AKN","USR_NAME","IP_ADDR")
  ainit( "aType","C","D","C","D","C","C")
  ainit( "aSize",12,8,10,8,22,15)
  ainit( "aDec",0,0,0,0,0,0)
  create (cDb) from aField, aType, aSize, aDec
  ? "Rebuilt table " + cDb
endif

 

 

About the application

There are numberous improvements needed by this example app:

For a real corporate use a login system is compulsory. Anyway this can't be provided by this module: it must be implemented at application level (i.e. using the standard DBFree login module).

Edit page offers a LIST function that simply shows all records: this is good for learning purpouses, but a real usage needs a browser functionality. It can be added to this page object with relative ease, but we didn't to avoid to make the code too complicated.

As you noticed the database structure is fairly more complicated that what needed: in facts several fields are not used at all, not to menction the child table that is completely ignored by the app. This is because this example is only the sketch of a complete message board application where those fields will find their profitable utilization.
The child table, for example, is to log the notice readers and give a confirmation they actually read the messages and when.

These and other issues will be amended in future versions, that will be available soon, and will hopefully guide you into a throughful understanding of the inner workings of the programming in MaxScript by providing implementations of increasing complexity to achieve a fully functional application.