Programmer's Procedure for Implementing CMS Codes
CMS Codes populate drop-down controls and are used extensively throughout the Cy Think Content Management System. CMS Codes have replaced string arrays in the Perl code. (A search for "_types" in the code may turn up remnants of this earlier approach.) For basic add, change and delete instructions, see this page:
Administrator's Guide to CMS Codes
For a user-oriented description of CMS codes, and a list of CMS code types, see this page:
User's Guide to CMS Codes
The programmer needs to understand CMS codes because they are critical to the smooth functioning of the CMS. The site administrator can make minor additions the to CMS code table, but the programmer must make most changes because they are so critical. Adding a code type will be done almost exclusively by the programmer.
In a new installation the code table may be empty. If the code table is empty, the administrator may need to add a "codecode" of "codecode". After that, the administrator can add any other codes needed by the client. To add the first codecode, click Codes >> Continue then continue as usual.
Here are a few more tips for managing CMS Codes.
-
Even though codecodes may be created by the administrator, a programmer may need to write some program code to get everything to work as desired.
-
The first few letters of a codecode should refer to the relevant table or program name unless it is shared by more than one. E.g. evallocation, inboxtype.
-
Add the codecode to codecode, then add the values.
-
Programs that call code subs use Jshcode.
-
Model code can be found in evals.pl. Search for code_select_array, etc.
Procedure to Add a Code Type
-
Decide on the name of the code and add use MySQL Admin to add it to the code table.
-
Add some values for the code type.
-
Before leaving MySQL Admin. Note key and default. (Note to self - eliminate this need.)
-
Add "use Jshcode" at the top of the xxx.pl script, if not already there.
-
Use code_select_array("xxx") to get an array of codes. E.g., replace "xxx_types" with code_select_array("xxx") in the xxx.pl script.
-
Set default in xxxx.pl in the add_row sub.
-
In the delete confirmation sub and anywhere value is to be displayed, call the code_get_value sub.
-
Select the appropriate call for the edit_form sub.
New code types involve changes to the Perl code. All procedures for code maintenance apply. Here are a few additional notes: The most common of these is document describes the actual implementation of this feature in the CMS, the creation of new Codes and the code to retrieve and display the codes on the various pages in the CMS.
Because the database is designed the way it is, a special procedure is needed to migrate codes from on client to another. The key in the Code Value Table must be unique. Also, it is best if the keys are contiguous. To make this work correctly, these keys need to be adjusted by means of a manual step.
This procedure is an example. It documents the steps taken to migrate the CSS update of 2007 to the roster of clients at that time.
Procedure to Migrate a Code Type From One Client Site to Another
-
Determine the code types that need to be migrated to the target client.
-
Use phpMyAdmin on the source client's site to create a file containing the CMS codes you want to copy to the target client's site. Use Programmer's Procedure to Copy a Database Table as a guide.
-
Use phpMyAdmin on the target client's site to examine the key values in the code table. Find out what the next key should be.
-
Renumber the codes in the .sql file.
-
Using phpMyAdmin, insert the codes into the code table on the target website.
-
This procedure is abbreviated and high level. Programmers should apply their knowledge and experience to supply any missing details.
|