The files which make up FaqMan, and the purpose of their functions are described here
addfaq.cgi handles the addition of new faqs. It initially presents an empty form, determinied by the prescence of CGI variables. After the form is filled ans submitted, the information is checked for errors and piped through a spellcheck function inside faqman.pm. The entered data is shown to the user, where they are asked to double check it.
All form data is stored in hidden variables as well. Comments to is-routers and
those to be posted with the faq on the web are taken. When the user submits the
form, all data is passed to check_submit.cgi
Top
admin.cgi handles all of the administrative displays and actions. It uses a category flag to do this, with no category being admin home. Each time the script runs it checks a long set of if statements to determine which action to take or interface to display. Possible actions are:
Possible interfaces are:
void formatFAQlist ( @faqFilenames )
Prints to stdout a table containing information on and administrative controls for the passed faqs.
void printAdminLog ( {int numberOfDays} )
Prints to stdout a table containing the administrative actions which have occured in the last x number of days.
If numberOfDays is ommitted, the last 5 actions are returned
check_submit.cgi is the file which allows for both modfaq.cgi and addfaq.cgi to actually submit faqs. It recieves a type variable and all FAQ data, along with optional comments, via post from one of these two CGIs.
check_submit then sends/posts to the web any comments which are present and
either adds the faq or creates a pending faq. Finally, it displays to the user
a copy of the FAQ exactly as they have entered it for one last look over.
Top
This cgi takes a filename from cgi and returns the pending or new version of that faq for viewing/commenting.
comment.cgi also takes input from it's own comment form and posts any
provided comments.
Top
The index or home page for FaqMan. This page initially shows a search location and three faq lists: new, pending, and owned.
The new and pending lists have links which allow the user to view and comment upon changes to the FAQs.
The owned list displays all faqs the user owns and gives them links to perform actions on them.
Two of these actions: "Request Approval" and "Request Boneyard" are handled by faqhome.cgi itself. They send an email to the administrator with the appropriate request.
Modify Faq links direct the user to modfaq.cgi
void formatOWNlist ( array FAQFilenames );
Prints to stdout the html table containing the owner functions
void formatFAQlist ( array FAQFilenames );
Prints to stdout the html table containing comment/review links for new/pending FAQs.
This perl module is included in all web scripts which make up FaqMan, and provides all access to the database in a long series of specialized functions.
array termList( string filename, string terms );
Gathers a list of up to five lines out of the given faq which match the given terms. Useful for providing context to search results. The matches are highlighted in html bold tags
string spellCheck( string toBeChecked );
Returnes the passed string with all spelling errors surrounded in span tags of the class "error"
string getMenu( void );
Retuns the HTML for the FaqMan standard menu. Includes "Admin tools" option if current user is an administrator
string getCurrentUser( void );
Checks the environment to get the user's uwnetid and returns it.
void routerComment( string from, string filename, string comments);
Sends an email to is-routers, passing on to them any comments that the owner of said faq has posted
void remind( void );
Checks all faqs for old age and sends an email to any consultant owning out of date faqs asking them to review each one.
void adminNote( string faqTitle, string owner, string noteType);
Passes a not to the FaqMan administrators, letting them know that the given owner wants a faq either boneyarded or approved, based on noteType
void ownerNote( string faqTitle, string owner, string newOwner );
Sends an email to the two given owners and the admins, letting them know that faq ownership has changed.
void routerNote( string faqTitle );
Sends an email to is-routers letting them know that the given faq has been modified or created and needs reviewing.
void sendMail( string to, string subject, string body);
Used by the "note" functions to send the actual emails, opens a pipe to sendmail and sends the passed info to the passed address
void connect( void );
Makes DBI database connections to cs_general and cs_faqs if they don't exist.
void disconnect( void );
Closes both database connections if they are present.
array getAdmin( void );
Returns an array of all uwnetids considered to be administrators
array getComments( string filename );
Returns an array of all the comments currently attached to the given FAQ.
array getComments( string filename );
Returns an array of all the comments currently attached to the given FAQ.
bool isOld( string filename );
Returns true if the FAQ is older than the "old age" specified in a variable at the top of faqman.pm
void makeCurrent( string filename);
Sets the last modified date for the given FAQ to "now"
string getName( string uwnetid );
Returns the full name for the user with given uwnetid
void comment( string comment, string filename );
Appends the users uwnetid and name and the current date to the provided comment and attaches it to the given FAQ in the database
void modFaq( string filename, string newFilename, string newTitle,
string newQuestion, string newAnswer, string newOwner);
Makes the faq pending, and places the new version in storage for comparision with the old and eventual approval into use.
void discard( string filename );
Actually deletes the faq and relationship data out of the database. There is NO web control which calls this function.
void approve( string filename );
Approves a new or pending FAQ version, shifting the pending data into the main data slots in the database, and putting it into current searches and common dir updating
array getAdminLog( int numberOfDays);
Returns an array of format Date, Username, Action, Date Username, Action etc going back for as many days as specified or, if no days are specified, the last five actions
void adminLog( string action);
Logs the given action along with the time and user into the admin Log database.
void log( string action);
Logs the action in a file somewhere for debug purposes.
int getState( string filename);
Returns the state of the given FAQ. 0=current, 1=new, 2=pending, 3=boneyard
hash rrefQ( string fields, array fids);
Takes a string of space-separated fields that the user desires, and an array of FAQ ids for which this information should be returned.
Returns a hash of the given fids containing a hash of the given fields.
if the special value -1 is passed as the fid array, rrefQ returns the desired information for all current fids
void printFaqs( void );
Prints a local copy of all the faqs into text files inside a "common" directory. The function then makes a system call to the set-user-id script "updatecommon" which uses rsync to mirror the local common with the actual common on Red.
void setState( string filename, int state );
Sets the state of the given faq to the given state code.
array stateList( int stateWanted );
Returns an array of filenames for the FAQS contained in this state. When the desired state is "current," this function does return filenames for faqs with pending changes.
string getTitle( string filename );
Returns the textual title for the faq requested.
array listFaq( void );
returns an array of filenames, one for each faq in the database, in any state. Useful for debugging.
array ownedList( string uwnetid );
Returns an array of filenames for each faq owned by the given netid.
hash getFaq( string filename );
Returns a hash of all information about the requested Faq.
The returned hash contains the following fields:
bool filenameExists( string filename );
Does a quick check to see if this filename is already taken, and returnes true if it does, false otherwise.
array searchFaq( string typeOfSearch(and/or), string searchTerms, {string
search type flag});
Searches for faqs. the type of search flag affects "all keywords" or "any keywords behavior". An array of filenames is returned.
The search type flag can be ommitted or one of two special values:
void addFaq(
string owner,
string filename,
string title,
string question,
string answer );
Adds a new faq into the database and places it into the new state.
bool validNetid( string uwnetid );
checks if the string is a valid netid in shape, length, and composition.
Does NO actual existence or authority checking.
Top
This cgi processes the variables created by the search form, which is avaialbe both on this page itself and on the Faq Home page (faqhome.cgi). It calls the actual search functions in faqman.pm and displays a list of the results.
fsearch.cgi requires the following CGI variables to work:
This CGI's primary function is to get a whole Faq from the database and display it for viewing. If the Faq is out of date and the viewer happens to be the owner, it also lets them assert that the faq is still up to date, resetting their age.
This CGI takes only one variable - "filename", the filename of the faq
desired.
Top
For displaying lists of all Faqs in various states. Takes one variable:
"state" the desired state to be listed.
Top
This CGI allows the owner of a Faq or the administrators to modify a faq which is present in the database. The initial call takes only one variable: "filename" of the faq to be modified.
Modfaq calls itself one more time to provide a confirmation of changes
screen. If the user confirms the changes is passes the garnered Faq information
to check_submit.cgi, where the changes are acted upon and placed into the
database.
Top
This is a quick Perl script which runs the twice monthly out-of-date
reminders. It is only called from a cron job.
Top
This file is the Cascading Style Sheet for Faqman. It contains all the CSS
information for the faqman pages except for "cellspacing=0" which was included
in the actual html for compatibility with some older browsers.
Top
This small script exists to isolate the only set-user-id function of the
Faqman tool. This script needs to be set to suid for a user with no-password
entry to red.cac, and write priviledge to the common directory. It calls rsync,
using the user's ssh keys to make the connection and sync the local and red
copies of the common directory. This script should only be called by the
faqman.pm function "printFaqs" to ensure that the local common directory is
up-to-date.
Top
This is a quick Perl script which runs the nightly common directory update. It is only called from a cron job.
Top
A list of newline seperated, sorted words which the Faqman internal spellchecking uses in addition to the local unix dictionary for checking words.