Menu

2.2.1 Modification for consideration

2003-01-29
2003-04-08
  • Nobody/Anonymous

    Hi,

    I've done some heavy infrastructure and added serveral feature to V2.2.1 that I'd like to submit for being rolled into the core.  They can be downloaded from:

      http://oui.servebeer.com/clanadmin-cgm

    There's a detailed readme there but here's a copy too:

    Changes to ClanAdmin V2.2.1 by CG Monroe
    29 Jan 2003

    General

    This is a major modification to the ClanAdmin V2.2.1 code.  The primary aim was
    to simplify adding fields to the system as needed. In addition, these other 
    enhancements were done as well:

      - Member Roster calls can have multiple roles listed on a single call resulting
        in fewer CGI include calls.
      - Member Roster information is now sorted by Player Name.
      - Member information (e.g., status,role,name) and Personal Information can now
        be used in both templates.  E.g., [%NA-STATUS] works in the personal template
        and [%NA-EMAIL] works in the member list template.

    The installation and setup is still the same as V2.2.1.  See this document for
    details.  There is no provision for upgrading existing data to work with this
    version.  (Note: It is possible to carefully modify the data to match the new
    record format, but make sure you know what your doing first.)

    Modification Info

    1) Created a fileio.pl include file with primitive file io functions.  The ultimate
       intent is that the base code should NEVER open files.  All io functions should
       ultimately go thru these primatives.  This will let there eventually be "plug in"
       include modules that support other persistant storage forms (e.g. mySQL).
      
       Note, fileio.pl also supports a primative file caching (per CGI call) mechanism
       that should help speed up read only functions.
      
    2) Added a datastructures.pl include file that contains the following various global
       variables related to data structure info.  Currently these are the types in this
       file:
        - A @<recordType>_fields array with the column names of the values was added
          for each type of record in ca_index.dat, e.g. @personal_fields.  This is where
          new columns can be added.  (Note: the default columns must stay in).  This
          is used for creating generic code for reading/writing data records which
          makes it easier to add fields to records.
        - Some @<recordType>_defaults arrays where added to support defining default
          values for empty or new fields.
        - Added some @<recordType>_<ColumeName>_values/labels arrays used to produce
          various drop downs used in the admin screen.  This allows for various set
          values to be changed (also starts a little Internationalization going).

    3) All database.pl functions where modified to use fileio.pl functions. In addition,
       they were all rewritten to be generic in terms of the columns being written.
       This allows the forms handlers and template handlers to be written to use
       the datastructures variables.
      
    4) The members.pl file had all functions converted to use the datastructures.pl
       information in the following manner: 
        - all the admin forms now use the column name listed in the datastructure
          file as the HTML input field name. 
        - All the write form functions have been modified to use the column names
          from the fields array rather than use harded references (well a few column
          names have to be hard coded...)
        - The template writers have been redone to do [%NA-<ColumnName>] replaces
          based on the column names array. 
        - Both the memberlist and personalPage template handlers have been modified
          so that information from both the member and personal records can be used
          in templates.  E.g., you can put member status in the personal page and
          list the member's e-mail on the memberlist, now.
        - All functions now use the fileio primitives.
         
    5) The parse=roster function has been modified to support multiple roles on the
       show parameter.  I.e., instead of three or four separate include calls, a much
       faster single line like this can be used:
      
       <!--#include virtual="cgi-bin/cadmin/clanadmin.cgi?parse=roster&show=leader,coleader,offcaptain,defcaptian"-->
      
       In addition, the member list displayed is now sorted by player name.
      
    6) Misc performance/memory use improvements by passing arrays by reference rather
       than value in various places. (work in progress...)
      
    7) Login.pl has been modified to do a META refresh to set the cookies properly
       before displaying admin screens.  This allows there to be only one Personal
       information form to maintain/modify.
      
    8) Misc.pl has been partially modified so the links (contacts) functions follow the
       datastructures standard.
      

    ToDo:

    The members.pl file defines the new standard way to deal with data input/output.  All
    the other include files need to be converted to this standard.

    All files need to be re-done to use the fileio.pl functions.  If needed, new
    functions may need to be added to get this done.

    It may be possible to convert the admin forms to be based on templates.  This would
    make it even simpler to add columns.

    A database update tool probably could be done.
         
         
    Notes On Adding Fields (Columns) to Records

    There currently are two situations in adding columns to record types.  The first is
    that the particular area has been modified to support the new datastructure
    format.  (Check the comments at the head of the include file that supports the
    area you want to modify to see if it has been changes.)  The second is that the
    support code needs to be modified first.  This discussion will talk about the
    first case.  In particular, the personal information records.

    Adding a field (or fields) to an area that supports the datastructure standard
    require three basic changes to the code.  None of these are code intensive but
    rather are more of changes to the embedded HTML and some datastructures.

    0) First, BACKUP BACKUP BACKUP! and do this either on a copy of your production
       system or when the site is shut down (modify the index.html)

    1) Now, open the datastructures.pl and locate the lines that define the
       @<recordType>_fields array.  In the example of the personal record, this is the
       line that start with:  @personal_fields = (...  Add your new column name(s) to the
       end of this definition (before the ");"!).

       Next, see if there is a @<recordType>_defaults entry, e.g. @personal_defaults =...
       If there is, add a matching default value for each field/column you added above.  If
       you don't want a default value, just use "" as the value.

       You might look thru this file and see if there are any other changes you might want
       to make.

       Notes: 

       Changing labels is generally safer than changing values.  Most label/value pairs
       can be trimmed out of the list but be carefull, some of them are used by the code.

       Always add to the basic column definitions, never remove or rename the basic
       definitions because they are used in various places in the code.

    2) Once you've defined the new columns, you need a way to add data to them. This
       means you need to change the admin screen form to add the new values.  The admin
       screens are produced inside a function that generally has a name of the format,
       Print<RecordType>Page.  NOTE THE WORD GENERALLY... some are admin pages are based
       on older record names (e.g. links is contacts).  In our personal record example,
       this is the PrintPersonalPage in the Members.pl include file.
      
       When you have located the appropriate function (and verified that it supports the
       datastructure methods! Look at the top of file comments), you need to do two things
       to is.  First, locate the line or lines that set the "old" (or current) values and
       add variables to receive your new column(s) value(s).  (I've tried to add comments
       to the ones I've modified to point this line out).
      
       PERL Coding hint:  Add a my <varname>; statement above this line for each variable
       you are adding.  This helps keep any global conflicts to a minimum.
      
       Next, modify the HTML code that is generated here to include your input fields
       for your new column(s).  The only requirement is that the HTML Input element name
       is the same name (case matters!) as the column name(s) added in 1).  You should
       also set the value of the field to the current value variable defined above.
      
       LAYOUT DESIGN HINT:  View the page in your browser, then save the page.  This will
       give you an HTML only file that you can use in an HTML page composing tool (assuming
       one that does not add a bunch of stuff to all pages, like FrontPage!).  Use this
       to layout the form and then use this HTML to change the code.
      
    3) The hard parts are done..  The matching template files and any shtml pages related
       to displaying this information need to be edited to include the new column(s).  To
       include the new columns in templates, simply use [%NA-<columnName>] where your want
       the value to appear.
      
    Notes:

    If you get a server 500 error or file could not be included error, check your server
    error log or run the clanadmin.cgi script from the command line.  It's probably a
    syntax error like a missing ; or } or missmatched ".

     
    • Anonymous

      Anonymous - 2003-03-20

      Need to talk to you CGM, can u please email me

       
    • Nobody/Anonymous

      Anybody still have this file??? i would really like it. I myself am trying to customize this script for a clan and this mod. would be great.

       
    • Anonymous

      Anonymous - 2003-04-08

      Email me or contact me via MSN Messenger (the_coydog@hotmail.com) if you need help with ClanAdmin. I will gladly help you set it up.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.