"Fossies" - the Fresh Open Source Software Archive

Member "metadot/metadot/upgrade" (12 Jul 2006, 297820 Bytes) of package /linux/www/old/Metadot6.4.5.4.tar.gz:


The requested HTML page contains a <FORM> tag that is unusable on "Fossies" in "automatic" (rendered) mode so that page is shown as HTML source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 ###########################################################################
    3 # <LICENSEINFO>
    4 # Metadot Portal Server
    5 # Copyright (C) 2001 Metadot Corporation
    6 #
    7 # For more information go to
    8 # http://www.metadot.com
    9 # or contact us at info@metadot.com
   10 #
   11 #</LICENSEINFO>
   12 ############################################################################
   13  
   14 # upgrades from 4.0 or later to current release
   15 # use this version of the upgrade script to add the closed-source
   16 # modifications.
   17 
   18 require 'startup.pl';
   19 use strict;
   20 
   21 use DBI;
   22 use POSIX;
   23 use Storable qw(nfreeze thaw);
   24 use Lingua::EN::NameParse;
   25 use Data::Dumper;
   26 
   27 use Metadot qw( $USER $SESSION $CGI);
   28 use MetadotConfig;
   29 use ParamsHash;
   30 use Metadot::UserFactory;
   31 use Metadot::User::Default;
   32 use MetadotConfig;
   33 use File::Copy;
   34 use File::Path;
   35 use vars qw(%GA);
   36 
   37 use Portal;
   38 use Gizmo;
   39 use Metadot::Utils::ModuleMgmt;
   40 use Metadot::Gizmo3000::ClassRegistry;
   41 use Metadot::PortalFactory;
   42 
   43 
   44 $GA{DEBUG_LEVEL} = 2;
   45 
   46 my $admin_group_number;
   47 $|=1;  # do not buffer output so we can see the progress in realtime.
   48 
   49 my %defaults = ();  ## used to store config variable, etc.
   50 ## NAMEPARSE SECTION
   51 my %np_args = ( allow_reversed => 1, auto_clean => 1);
   52 my $name_parser = new Lingua::EN::NameParse(%np_args);
   53 ## END NAMEPARSE SECTION
   54 my $dbh;
   55 my $registry = {
   56                 logdirectory               => '/tmp',
   57                 absolutepathfileuploaddir  => '/home/metadot/metadot/html/files',
   58                 categorytitlebgcolor       => '336699',
   59                 #      max_total_upload_size      => '100000000',
   60                 max_total_upload_size      => '10',
   61                 # this 'insecure' file access var should no longer be used anywhere at all.
   62                 #      fileuploaddir              => '/files',
   63                 formbgcolor                => 'EEEEEE',
   64                 globallook                 => 'new',
   65                 hourlylasttime             => '0',
   66                 dailylasttime              => '0',
   67                 uri_scheme                 => 'http',
   68                 httpbasename               => 'localhost/metadot',
   69                 httpportnumber             => '',
   70 
   71                 home_page                  => 'index.pl',
   72                 post_login                 => 'index.pl',
   73                 require_login              => '',
   74 
   75                 is_event_log_enabled       => undef,
   76                 event_log_clean_after       => 10,
   77 
   78                 imageslocation             => '/images',
   79                 lasttimenotification       => '',
   80                 mailsenderaddress          => 'root@localhost',
   81                 mailserveraddress          => 'localhost',
   82                 subscriptionsender         => 'abc',
   83                 subscriptionhost           => 'xyz.com',
   84                 subscriptionpwd            => 'xxx',
   85                 mainfooter                 => &_get_mainfooter,
   86                 mainheader                 => &_get_mainheader,
   87                 maintemplate               => &_get_maintemplate,
   88                 utilitytemplate            => &_get_utilitytemplate,
   89                 #      utility_template2          => &_get_utility_template2,
   90                 subtemplate                => &_get_subtemplate,
   91                 loginsplash_text           => &_get_loginsplash_text,
   92                 maxlinks                   => '10',
   93                 mypageelementboxcolor      => '336699',
   94                 mypageelementcolor         => '',
   95                 mypageheader               => '',
   96                 use_mypagehdr_default      => '0',
   97                 mypagetitleboxcolor        => '336699',
   98                 grp_change_stamp           => '0',
   99                 newscolbgcolor             => 'EEEEEE',
  100                 newscoltitlebgcolor        => '336699',
  101                 newsversion                => '57',
  102                 nextcid                    => &_get_nextcid,    #'1000',
  103                 nextciid                   => &_get_nextciid,   #'1000',
  104                 nextiid                    => &_get_nextiid,    #'1000',
  105                 nextuid                    => &_get_nextuid,    #'1000',
  106                 nextgrpid                                  => &_get_nextgrpid,  #'1000',
  107                 nextmpid                   => &_get_nextmpid,   #'2000',
  108                 password_checker           => '',
  109                 proxyhost                  => '',
  110                 proxyport                  => '',
  111                 regapproval                => '0',
  112                 rootdomain                 => 'localhost',
  113                 sessionduration            => '28000',
  114                 simpleheader               => &_get_simpleheader,
  115                 #      formbanner                 => &_get_formbanner,
  116                 stylesheet                 => &_get_stylesheet,
  117                 subfooter                  => &_get_subfooter,
  118                 subheader                  => &_get_subheader,
  119                 ldap_base_dn               => '',
  120                 encryption_done            => 'yes',
  121                 timecounters               => 'h=984776400-d=984830400-w=984999600',
  122                 toolbgcolor                => 'EEEEEE',
  123                 ldap_server                => '',
  124                 if_ldap                    => '0',
  125                 basename                   => 'localhost/metadot',
  126                 ldap_uid                   => 'name',
  127                 ldap_uid_label             => '',
  128                 max_total_number_upload    => '10000',
  129                 debuglog                   => '',
  130                 defregmessage              => &_get_defregmessage,
  131                 aprregmessage              => &_get_aprregmessage,
  132                 rejregmessage              => &_get_rejregmessage,
  133                 subsmessage                => &_get_subsmessage,
  134                 maxnewsitems           => 20,
  135                 IIS_max_cached_db_handles  => '50',
  136                 items_are_rateable         => 0,
  137                 sessions_are_deleted_on_logout => 1,
  138                 new_user_notification_enabled  => 1,
  139                 new_user_notification_message  => &_get_new_user_notification_message,
  140                 registration_closed        => 0,
  141                 is_jsform_enabled          => 1,
  142                 trusted_site               => 0,
  143                 loginsplash                => &_get_login_splash,
  144                 my_website_creation        => 1,
  145                 template_mgmt              => 0,
  146                 template_theme             => 'null',
  147                 recursive_perms            => 1,
  148                 uri_scheme                  => 'http',
  149                 show_who_online             =>1,
  150                 expand_nav_on_style_1       =>0,
  151                 expand_nav_on_themes        =>1,
  152                 max_number_of_users         =>25000,
  153                 global_uploads_quota        =>1000,
  154                 docs_url                    =>'http://www.metadot.net',
  155                 email_friend                => 0,
  156                 hide_my_page                => 0,
  157                 disable_allowed_image_urls_check => 0,
  158                };
  159 
  160 
  161 
  162 #if test==success then next test
  163 
  164 my %todos = ();
  165 
  166 $todos{mysql} = [
  167 
  168             {
  169                 info              => "Testing presence of params table",
  170                 sqlcommand        => "select count(*) from params",
  171                 perlcommand       => "",
  172 #               expectedtruevalue => "RESULT >= 0",
  173                 onsuccess_info    => "table params already exists",
  174                 onsuccess         => "",
  175                 onfailure_info    => "existence check failed -> creating table params",
  176                 onfailure         => "CREATE TABLE params (
  177                                   params_id int(11) NOT NULL AUTO_INCREMENT,
  178                                   name varchar(64) NOT NULL,
  179                                   value text,
  180                                   parent_id int(11) NOT NULL,
  181                                   PRIMARY KEY(params_id),
  182                                   UNIQUE(name, parent_id));",
  183                 },
  184              {
  185              info              => "Testing existence of users table",
  186              sqlcommand        => "select count(*) from users",
  187              perlcommand       => "",
  188              onsuccess_info    => "table users already exists",
  189              onsuccess         => "",
  190              onfailure_info    => "existence check failed -> altering table user to become table users",
  191              onfailure         => "ALTER TABLE user RENAME AS users;",
  192             },
  193 
  194 
  195         # template mgmt -- closed source
  196             {
  197                 info              => "Testing existence of template table",
  198                 sqlcommand        => "select count(*) from template",
  199                 perlcommand       => "",
  200                 onsuccess_info    => "table template already exists",
  201                 onsuccess         => "",
  202                 onfailure_info    => "existence check failed -> creating table template",
  203                 onfailure         => "create table template (
  204     isa varchar(60) not null,
  205     op varchar(60) not null,
  206     iid varchar(12) not null,
  207     template text,
  208      PRIMARY KEY (isa,op,iid)
  209     );",
  210                 },
  211 # themes info - don't know yet if this is open- or closed-source...
  212             {
  213                 info              => "Testing existence of template table",
  214                 sqlcommand        => "select count(*) from theme",
  215                 perlcommand       => "",
  216                 onsuccess_info    => "table theme already exists",
  217                 onsuccess         => "",
  218                 onfailure_info    => "existence check failed -> creating table theme",
  219                 onfailure         => "create table theme(
  220   theme varchar(30) not null,
  221    pname varchar(60) not null,
  222    pvalue text,
  223    primary key (theme,pname));",
  224                 },
  225 
  226 # for rateable items-- closed source
  227             {
  228                 info              => "Testing existence of rates table",
  229                 sqlcommand        => "select count(*) from rates",
  230                 perlcommand       => "",
  231                 onsuccess_info    => "table rates already exists",
  232                 onsuccess         => "",
  233                 onfailure_info    => "existence check failed -> creating table rates",
  234                 onfailure         => "CREATE TABLE rates (
  235       rater_uid int(11) DEFAULT '0' NOT NULL,
  236       rated_class varchar(128) DEFAULT '' NOT NULL,
  237       rated_id int(11) DEFAULT '0' NOT NULL,
  238       rate int(11) DEFAULT '0' NOT NULL,
  239       comments text,
  240       PRIMARY KEY (rater_uid,rated_class,rated_id));",
  241                 },
  242 # for groupshash -- open source
  243             {
  244                 info              => "Testing existence of timestamps table",
  245                 sqlcommand        => "select count(*) from timestamps",
  246                 perlcommand       => "",
  247                 onsuccess_info    => "table timestamps already exists",
  248                 onsuccess         => "",
  249                 onfailure_info    => "existence check failed -> creating table timestamps",
  250                 onfailure         => "CREATE TABLE timestamps (
  251       timestamp_id int(11) DEFAULT '0' NOT NULL AUTO_INCREMENT,
  252       name varchar(255),
  253       value varchar(255),
  254       PRIMARY KEY (timestamp_id));",
  255                 },
  256 # the following three tables are for the survey gizmo -- closed source
  257             {
  258                 info              => "Testing existence of questions table",
  259                 sqlcommand        => "select count(*) from questions",
  260                 perlcommand       => "",
  261                 onsuccess_info    => "table questions already exists",
  262                 onsuccess         => "",
  263                 onfailure_info    => "existence check failed -> creating table questions",
  264                 onfailure         => "CREATE TABLE questions (
  265   qid int(11) DEFAULT '0' NOT NULL auto_increment,
  266   iid int(11),
  267   name varchar(255),
  268   description text,
  269   creationdate date,
  270   questiontype varchar(5),
  271   instanceorder int(11),
  272   updatedate date,
  273   PRIMARY KEY (qid));",
  274                 },
  275             {
  276                 info              => "Testing existence of answer table",
  277                 sqlcommand        => "select count(*) from answer",
  278                 perlcommand       => "",
  279                 onsuccess_info    => "table answer already exists",
  280                 onsuccess         => "",
  281                 onfailure_info    => "existence check failed -> creating table answer",
  282                 onfailure         => "CREATE TABLE answer (
  283   aid int(11) DEFAULT '0' NOT NULL auto_increment,
  284   uid int(11),
  285   qid int(11),
  286   iid int(11),
  287   answer text,
  288   PRIMARY KEY (aid));",
  289                 },
  290             {
  291                 info              => "Testing existence of participants table",
  292                 sqlcommand        => "select count(*) from participants",
  293                 perlcommand       => "",
  294                 onsuccess_info    => "table participants already exists",
  295                 onsuccess         => "",
  296                 onfailure_info    => "existence check failed -> creating table participants",
  297                 onfailure         => "CREATE TABLE participants (
  298   iid int(11),
  299   qid int(11),
  300   uid int(11));",
  301                 },
  302 # The following two commands catch the case where the survey table already existed but was using
  303 # an earlier data format
  304             {
  305                 info              => "Modifying survey instances if necessary",
  306                 sqlcommand        => "update instance set c2 = 'after_end_date' where isa = 'Survey' and c2 = 'after'",
  307                 onsuccess_info    => "Modification successful",
  308                 onsuccess         => "",
  309                 onfailure_info    => "Modification failed",
  310                 onfailure         => "",
  311                 },
  312             {
  313                 info              => "Modifying survey instances if necessary",
  314                 sqlcommand        => "update instance set c2 = 'upon_completing' where isa = 'Survey' and c2 = 'during'",
  315                 onsuccess_info    => "Modification successful",
  316                 onsuccess         => "",
  317                 onfailure_info    => "Modification failed",
  318                 onfailure         => "",
  319                 },
  320 
  321 # the table used by the event logger: closed source
  322             {
  323                 info              => "Testing existence of event_log table",
  324                 sqlcommand        => "select count(*) from event_log",
  325                 perlcommand       => "",
  326                 onsuccess_info    => "table event_log already exists",
  327                 onsuccess         => "",
  328                 onfailure_info    => "existence check failed -> creating table event_log",
  329                 onfailure         => "CREATE TABLE event_log (
  330   unique_id int(11) NOT NULL auto_increment,
  331   userid int(11) default NULL,
  332   user_name varchar(255) default NULL,
  333   sub_application_name varchar(255) default NULL,
  334   class_name varchar(255) default NULL,
  335   operation_name varchar(255) default NULL,
  336   instance_id varchar(255) default NULL,
  337   date_and_time varchar(255) default NULL,
  338   unix_time varchar(255) default NULL,
  339   slot_1 varchar(255) default NULL,
  340   slot_2 varchar(255) default NULL,
  341   slot_3 varchar(255) default NULL,
  342   slot_4 varchar(255) default NULL,
  343   slot_5 varchar(255) default NULL,
  344   slot_6 varchar(255) default NULL,
  345   slot_7 varchar(255) default NULL,
  346   slot_8 varchar(255) default NULL,
  347   slot_9 varchar(255) default NULL,
  348   slot_10 varchar(255) default NULL,
  349   slot_11 varchar(255) default NULL,
  350   slot_12 varchar(255) default NULL,
  351   slot_13 varchar(255) default NULL,
  352   slot_14 varchar(255) default NULL,
  353   slot_15 varchar(255) default NULL,
  354   slot_16 varchar(255) default NULL,
  355   slot_17 varchar(255) default NULL,
  356   slot_18 varchar(255) default NULL,
  357   slot_19 varchar(255) default NULL,
  358   slot_20 varchar(255) default NULL,
  359   PRIMARY KEY  (unique_id)
  360 );",
  361                 },
  362 
  363             {
  364                 info              => "Testing new name for stranger account",
  365                 sqlcommand        => "select count(*) from users where fullname='Visitor'",
  366                 result_condition =>  "<<result>> > 0",
  367                 onsuccess_info    => "changing Visitor name to default_look",
  368         onsuccess         => "update users set fullname='default_look' where fullname = 'Visitor'",
  369                 onfailure_info    => "the name is already updated",
  370                 onfailure         => "",
  371             },
  372             {
  373                 info              => "Testing existence of file1_size field in table instance",
  374                 sqlcommand        => "select file1_size from instance",
  375                 onsuccess_info    => "the field already exists",
  376                 onsuccess         => "",
  377                 onfailure_info    => "test failed, adding the column",
  378                 onfailure         => "alter table instance add column file1_size int(11)",
  379             },
  380             {
  381                 info              => "Testing existence of field 'mid' in table channelitem",
  382                 sqlcommand        => "select mid from channelitem",
  383                 onsuccess_info    => "the 'mid' field already exists in channelitem",
  384                 onsuccess         => "",
  385                 onfailure_info    => "test failed -> adding field 'mid' to the table 'channelitem'",
  386                 onfailure         => "alter table channelitem add mid int(11)",
  387             },
  388 
  389             {
  390                 info              => "Testing existence of field 'max_total_upload_size' in table users",
  391                 sqlcommand        => "select max_total_upload_size from users",
  392                 onsuccess_info    => "the 'max_total_upload_size' field already exists in users",
  393                 onsuccess         => "",
  394                 onfailure_info    => "test failed -> adding field 'max_total_upload_size' to the table 'users'",
  395                 onfailure         => "alter table users add max_total_upload_size int(11) default '-1'",
  396             },
  397 
  398             {
  399                 info              => "Testing existence of field 'max_total_numberof_upload' in table users",
  400                 sqlcommand        => "select max_total_numberof_upload from users",
  401                 onsuccess_info    => "the 'max_total_numberof_upload' field already exists in users",
  402                 onsuccess         => "",
  403                 onfailure_info    => "test failed -> adding field 'max_total_numberof_upload' to the table 'users'",
  404                 #default NULL?
  405                 onfailure         => "alter table users add max_total_numberof_upload int(11) default '-1'",
  406             },
  407 
  408 
  409             {
  410                 info              => "Changing column updatedby's type in message table",
  411                 sqlcommand        => "alter table message modify updatedby varchar(60)",
  412                 onsuccess_info    => "Type changed",
  413                 onsuccess         => "",
  414                 onfailure_info    => "column doesn't exist - adding",
  415                 onfailure         => "alter table message add updatedby varchar(60)"
  416 
  417             },
  418 
  419             {
  420                 info              => "Adding column iid to channelitem table",
  421                 sqlcommand        => "select iid from channelitem",
  422                 onsuccess_info    => "Field exists already",
  423                 onsuccess         => "",
  424                 onfailure_info    => "column doesn't exist - adding",
  425                 onfailure         => "alter table channelitem add iid int(11)"
  426 
  427             },
  428             {
  429                 info              => "Increasing the size of file1 in the instance table",
  430                 sqlcommand        => "alter table instance modify file1 varchar(255)",
  431                 onsuccess_info    => "Size changed",
  432                 onsuccess         => "",
  433                 onfailure_info    => "column doesn't exist - adding",
  434                 onfailure         => "alter table instance add file1 varchar(255)"
  435 
  436             },
  437 
  438             {
  439                 info              => "Adding column iid to grp table",
  440                 sqlcommand        => "select iid from grp",
  441                 onsuccess_info    => "Field exists already",
  442                 onsuccess         => "",
  443                 onfailure_info    => "column doesn't exist - adding",
  444                 onfailure         => "alter table grp add iid int(11)"
  445 
  446             },
  447 
  448             {
  449                 info              => "Moving GizmoShortcut t1 to c1 in instance",
  450                 sqlcommand        => "update instance set c1=t1, t1='' where isa='GizmoShortcut' and c1=''",
  451                 onsuccess_info    => "Update successful",
  452                 onsuccess         => "",
  453                 onfailure_info    => "Update unsuccessful - no alternative",
  454                 onfailure         => ""
  455 
  456             },
  457 
  458             {
  459                 info              => "Adding column iid to grp table",
  460                 sqlcommand        => "select iid from grp",
  461                 onsuccess_info    => "Field exists already",
  462                 onsuccess         => "",
  463                 onfailure_info    => "column doesn't exist - adding",
  464                 onfailure         => "alter table grp add iid int(11)"
  465 
  466             },
  467 
  468             {
  469              info              => "Testing existence of extended_user table",
  470              sqlcommand        => "select count(*) from extended_user",
  471              perlcommand       => "",
  472              onsuccess_info    => "table extended_user already exists",
  473              onsuccess         => "",
  474              onfailure_info    => "existence check failed -> creating table extended_user",
  475              onfailure         => "
  476 CREATE TABLE extended_user (
  477   uid varchar(20) NOT NULL,
  478   f1 varchar(255),
  479   f2 varchar(255),
  480   f3 varchar(255),
  481   f4 varchar(255),
  482   f5 varchar(255),
  483   f6 varchar(255),
  484   f7 varchar(255),
  485   f8 varchar(255),
  486   f9 varchar(255),
  487   f10 varchar(255),
  488   f11 varchar(255),
  489   f12 varchar(255),
  490   f13 varchar(255),
  491   f14 varchar(255),
  492   f15 varchar(255),
  493   f16 varchar(255),
  494   f17 varchar(255),
  495   f18 varchar(255),
  496   f19 varchar(255),
  497   f20 varchar(255),
  498   t1 text,
  499   t2 text,
  500   t3 text,
  501   t4 text,
  502   t5 text,
  503   t6 text,
  504   t7 text,
  505   t8 text,
  506   t9 text,
  507   t10 text,
  508   PRIMARY KEY (uid)
  509 );",
  510             },
  511 
  512             {
  513              info              => "Testing existence of uploads table",
  514              sqlcommand        => "select count(*) from uploads",
  515              perlcommand       => "",
  516              onsuccess_info    => "table uploads already exists",
  517              onsuccess         => "",
  518              onfailure_info    => "existence check failed -> creating table uploads",
  519              onfailure         => "
  520 CREATE TABLE uploads (
  521   uid varchar(20) NOT NULL,
  522   isa varchar(64) NOT NULL,
  523   id varchar(64) NOT NULL,
  524   field_name varchar(64) NOT NULL,
  525   type varchar(64) NOT NULL,
  526   stored_at varchar(64) NOT NULL,
  527   file_name varchar(128) NOT NULL,
  528   file_size int(11) NOT NULL,
  529   PRIMARY KEY  (id,isa,field_name)
  530 );",
  531             },
  532 
  533             {
  534              info              => "Testing existence of system messages table",
  535              sqlcommand        => "select count(*) from system_messages",
  536              perlcommand       => "",
  537              onsuccess_info    => "table system_messages exists.",
  538              onsuccess         => "",
  539              onfailure_info    => "existence check failed -> creating table system_messages",
  540              onfailure         => "
  541 CREATE TABLE system_messages (
  542   timestamp     timestamp,
  543   sender        varchar(255) NOT NULL,
  544   recipient     varchar(255),
  545   content       varchar(255),
  546   index  (timestamp),
  547   index  (sender),
  548   index  (recipient)
  549 );",
  550             },
  551 
  552          {
  553             info              => "Testing existence of userid column in users",
  554             sqlcommand        => "select userid from users",
  555             onsuccess_info    => "Field exists already",
  556             onsuccess         => "",
  557             onfailure_info    => "column doesn't exist - adding",
  558             onfailure         => "alter table users change uid userid int(11) not null"
  559 
  560             },
  561         {
  562              info              => "Testing existence of userid column in answer",
  563              sqlcommand        => "select userid from answer",
  564              perlcommand       => "",
  565              onsuccess_info    => "Field already exists",
  566              onsuccess         => "",
  567              onfailure_info    => "column doesn't exist - adding",
  568              onfailure         => "alter table answer change uid userid int(11);",
  569             },
  570         {
  571              info              => "Testing existence of userid column in extended_user",
  572              sqlcommand        => "select userid from extended_user",
  573              perlcommand       => "",
  574              onsuccess_info    => "Field already exists",
  575              onsuccess         => "",
  576              onfailure_info    => "column doesn't exist - adding",
  577              onfailure         => "alter table extended_user change uid userid int(11) not null;",
  578             },
  579             {
  580              info              => "Testing existence of userid column in grp",
  581              sqlcommand        => "select userid from grp",
  582              perlcommand       => "",
  583              onsuccess_info    => "Field already exists",
  584              onsuccess         => "",
  585              onfailure_info    => "column doesn't exist - adding",
  586              onfailure         => "alter table grp change uid userid int(11);",
  587             },
  588      {
  589              info              => "Testing existence of userid column in grpmembers",
  590              sqlcommand        => "select userid from grpmembers",
  591              perlcommand       => "",
  592              onsuccess_info    => "Field already exists",
  593              onsuccess         => "",
  594              onfailure_info    => "column doesn't exist - adding",
  595              onfailure         => "alter table grpmembers change uid userid int(11) not null;",
  596             },
  597              {
  598              info              => "Testing existence of userid column in instance",
  599              sqlcommand        => "select userid from instance",
  600              perlcommand       => "",
  601              onsuccess_info    => "Field already exists",
  602              onsuccess         => "",
  603              onfailure_info    => "column doesn't exist - adding",
  604              onfailure         => "alter table instance change uid userid int(11) not null;",
  605             },
  606              {
  607              info              => "Testing existence of userid column in message",
  608              sqlcommand        => "select userid from message",
  609              perlcommand       => "",
  610              onsuccess_info    => "Field already exists",
  611              onsuccess         => "",
  612              onfailure_info    => "column doesn't exist - adding",
  613              onfailure         => "alter table message change uid userid int(11) not null;",
  614             },
  615              {
  616              info              => "Testing existence of userid column in mypage",
  617              sqlcommand        => "select userid from mypage",
  618              perlcommand       => "",
  619              onsuccess_info    => "Field already exists",
  620              onsuccess         => "",
  621              onfailure_info    => "column doesn't exist - adding",
  622              onfailure         => "alter table mypage change uid userid int(11) not null;",
  623             },
  624              {
  625              info              => "Testing existence of userid column in participants",
  626              sqlcommand        => "select userid from participants",
  627              perlcommand       => "",
  628              onsuccess_info    => "Field already exists",
  629              onsuccess         => "",
  630              onfailure_info    => "column doesn't exist - adding",
  631              onfailure         => "alter table participants change uid userid int(11);",
  632             },
  633              {
  634              info              => "Testing existence of userid column in poll_vote",
  635              sqlcommand        => "select userid from poll_vote",
  636              perlcommand       => "",
  637              onsuccess_info    => "Field already exists",
  638              onsuccess         => "",
  639              onfailure_info    => "column doesn't exist - adding",
  640              onfailure         => "alter table poll_vote change uid userid int(11);",
  641             },
  642 
  643 
  644         {
  645              info              => "Testing existence of sessions table",
  646              sqlcommand        => "select count(*) from sessions",
  647              perlcommand       => "",
  648              onsuccess_info    => "table sessions already exists",
  649              onsuccess         => "",
  650              onfailure_info    => "existence check failed -> altering table session to become table sessions",
  651              onfailure         => "ALTER TABLE session RENAME AS sessions;",
  652             },
  653 
  654 
  655              {
  656              info              => "Testing existence of userid column in sessions",
  657              sqlcommand        => "select userid from sessions",
  658              perlcommand       => "",
  659              onsuccess_info    => "Field already exists",
  660              onsuccess         => "",
  661              onfailure_info    => "column doesn't exist - adding",
  662              onfailure         => "alter table sessions change uid userid int(11) not null;",
  663             },
  664              {
  665              info              => "Testing existence of userid column in subscription",
  666              sqlcommand        => "select userid from subscription",
  667              perlcommand       => "",
  668              onsuccess_info    => "Field already exists",
  669              onsuccess         => "",
  670              onfailure_info    => "column doesn't exist - adding",
  671              onfailure         => "alter table subscription change uid userid int(11) not null;",
  672             },
  673              {
  674              info              => "Testing existence of userid column in uploads",
  675              sqlcommand        => "select userid from uploads",
  676              perlcommand       => "",
  677              onsuccess_info    => "Field already exists",
  678              onsuccess         => "",
  679              onfailure_info    => "column doesn't exist - adding",
  680              onfailure         => "alter table uploads change uid userid int(11);",
  681             },
  682              {
  683              info              => "Testing existence of userid column",
  684              sqlcommand        => "select userid from instance",
  685              perlcommand       => "",
  686              onsuccess_info    => "Field already exists",
  687              onsuccess         => "",
  688              onfailure_info    => "column doesn't exist - adding",
  689              onfailure         => "alter table instance change uid userid int(11);",
  690             },
  691              {
  692              info              => "Changing column d1 of instance to datetime",
  693              sqlcommand        => "alter table instance modify d1 datetime default NULL",
  694              perlcommand       => "",
  695              onsuccess_info    => "Field altered",
  696              onsuccess         => "",
  697              onfailure_info    => "",
  698              onfailure         => "",
  699             },
  700              {
  701              info              => "Changing column d2 of instance to datetime",
  702              sqlcommand        => "alter table instance modify d2 datetime default NULL",
  703              perlcommand       => "",
  704              onsuccess_info    => "Field altered",
  705              onsuccess         => "",
  706              onfailure_info    => "",
  707              onfailure         => "",
  708             },
  709              {
  710              info              => "Changing column d3 of instance to datetime",
  711              sqlcommand        => "alter table instance modify d3 datetime default NULL",
  712              perlcommand       => "",
  713              onsuccess_info    => "Field altered",
  714              onsuccess         => "",
  715              onfailure_info    => "",
  716              onfailure         => "",
  717             },
  718              {
  719              info              => "Changing column d4 of instance to datetime",
  720              sqlcommand        => "alter table instance modify d4 datetime default NULL",
  721              perlcommand       => "",
  722              onsuccess_info    => "Field altered",
  723              onsuccess         => "",
  724              onfailure_info    => "",
  725              onfailure         => "",
  726             },
  727              {
  728              info              => "Changing column d5 of instance to datetime",
  729              sqlcommand        => "alter table instance modify d5 datetime default NULL",
  730              perlcommand       => "",
  731              onsuccess_info    => "Field altered",
  732              onsuccess         => "",
  733              onfailure_info    => "",
  734              onfailure         => "",
  735             },
  736              {
  737              info              => "Changing column creationdate of questions to datetime",
  738              sqlcommand        => "alter table questions modify creationdate datetime default NULL",
  739              perlcommand       => "",
  740              onsuccess_info    => "Field altered",
  741              onsuccess         => "",
  742              onfailure_info    => "",
  743              onfailure         => "",
  744             },
  745              {
  746              info              => "Changing column updatedate of questions to datetime",
  747              sqlcommand        => "alter table questions modify updatedate datetime default NULL",
  748              perlcommand       => "",
  749              onsuccess_info    => "Field altered",
  750              onsuccess         => "",
  751              onfailure_info    => "",
  752              onfailure         => "",
  753             },
  754              {
  755              info              => "Changing column creation_date of poll_vote to datetime",
  756              sqlcommand        => "alter table poll_vote modify creation_date datetime default NULL",
  757              perlcommand       => "",
  758              onsuccess_info    => "Field altered",
  759              onsuccess         => "",
  760              onfailure_info    => "",
  761              onfailure         => "",
  762             },
  763 
  764 #   {
  765 #                 info              => "Adding SUPER_XXX group",
  766 #                 sqlcommand        => "select grp_id from grp where group_name='SUPER_XXX'",
  767 #                 onsuccess_info    => "SUPER_XXX exists already",
  768 #                 onsuccess         => "",
  769 #                 onfailure_info    => "SUPER_XXX doesn't exist - adding",
  770 #                 onfailure         => "insert into grp (group_name, group_description, userid) VALUES ('SUPER_XXX', 'Super admins', '8')"
  771 
  772 #             },
  773 
  774   {
  775                 info              => "Changing column user_id of event_log to userid and int(11)",
  776                 sqlcommand        => "select count(userid) from event_log",
  777                 onsuccess_info    => "column userid exists already",
  778                 onsuccess         => "",
  779                 onfailure_info    => "userid doesn't exis - changing",
  780                 onfailure         => "alter table event_log change user_id userid int(11)"
  781 
  782             },
  783   {
  784                 info              => "Changing column comment of rates to comments",
  785                 sqlcommand        => "select comments from rates",
  786                 onsuccess_info    => "column comments exists already",
  787                 onsuccess         => "",
  788                 onfailure_info    => "comments doesn't exist - changing",
  789                 onfailure         => "alter table rates change comment comments text"
  790 
  791             },
  792 
  793             {
  794              info              => "Checking if uploads table allows index numbers",
  795              sqlcommand        => "select field_index from uploads",
  796              perlcommand       => "",
  797              onsuccess_info    => "Uploads table allows index numbers",
  798              onsuccess         => "",
  799              onfailure_info    => "Uploads table check failed -> modifying table uploads",
  800              onfailure         => [
  801 'ALTER TABLE uploads DROP PRIMARY KEY;',
  802 'ALTER TABLE uploads ADD field_index INT(11) NOT NULL DEFAULT 0;',
  803 'ALTER TABLE uploads ADD PRIMARY KEY (id,isa,field_name,field_index);',
  804 ],
  805             },
  806             {
  807              info              => "Checking if grpmembers table includes subgrp_id",
  808              sqlcommand        => "select subgrp_id from grpmembers",
  809              perlcommand       => "",
  810              onsuccess_info    => "grpmembers.subgrp_id exists",
  811              onsuccess         => "",
  812              onfailure_info    => "grpmembers table check failed -> modifying table grpmembers",
  813              onfailure         => [
  814 'ALTER TABLE grpmembers DROP PRIMARY KEY;',
  815 'ALTER TABLE grpmembers ADD subgrp_id INT(11) NOT NULL DEFAULT 0;',
  816 'ALTER TABLE grpmembers ADD PRIMARY KEY (grp_id, userid, subgrp_id);',
  817 ],
  818             },
  819 
  820             {
  821              info              => "Checking if grpmembers table includes is_manager",
  822              sqlcommand        => "select is_manager from grpmembers",
  823              perlcommand       => "",
  824              onsuccess_info    => "grpmembers.is_manager exists",
  825              onsuccess         => "",
  826              onfailure_info    => "grpmembers table check failed -> modifying table grpmembers",
  827              onfailure         => "ALTER TABLE grpmembers ADD is_manager TINYINT(1) NOT NULL DEFAULT 0"
  828             },
  829 
  830             {
  831              info              => "Checking if nextciid has been converted to a sequence",
  832              sqlcommand        => "select name from params where name='nextciid'",
  833              perlcommand       => "",
  834              onsuccess_info    => "nextciid has been converted already",
  835              onsuccess         => "",
  836              onfailure_info    => "converting nextciid to a sequence",
  837              onfailure         => ""
  838             },
  839 
  840         # vserv_modules table
  841             {
  842                 info              => "Testing existence of vserv_modules table",
  843                 sqlcommand        => "select count(*) from vserv_modules",
  844                 perlcommand       => "",
  845                 onsuccess_info    => "table vserv_modules already exists",
  846                 onsuccess         => [
  847 "update vserv_modules set modules = CONCAT('Category,', modules) where modules not like '%Category,%';",
  848 "update vserv_modules set modules = CONCAT(modules, ',Separator') where modules not like '%,Separator%';",
  849 ],
  850                 onfailure_info    => "existence check failed -> creating table vserv_modules",
  851                 onfailure         => "create table vserv_modules (
  852     section_name varchar(100) default NULL,
  853     modules text
  854     );",
  855                 },
  856             {
  857              info              => "Converting instance.name to a nullable field",
  858              sqlcommand        => "ALTER TABLE instance MODIFY name VARCHAR(255) NULL",
  859              perlcommand       => "",
  860              onsuccess_info    => "Conversion was successful",
  861              onsuccess         => "",
  862              onfailure_info    => "Conversion failed!",
  863              onfailure         => ""
  864             },
  865             {
  866              info              => "Fixing null i3 values for Tasks",
  867              sqlcommand        => "UPDATE instance SET i3=0 WHERE i3 IS NULL and isa='Task'",
  868              perlcommand       => "",
  869              onsuccess_info    => "Update was successful",
  870              onsuccess         => "",
  871              onfailure_info    => "Update failed!",
  872              onfailure         => ""
  873             },
  874             {
  875              info              => "Checking if grp table includes is_organization",
  876              sqlcommand        => "select is_organization from grp",
  877              perlcommand       => "",
  878              onsuccess_info    => "grp.is_organization exists",
  879              onsuccess         => "",
  880              onfailure_info    => "grp table check failed -> modifying table grp",
  881              onfailure         => "ALTER TABLE grp ADD is_organization TINYINT(1) NOT NULL DEFAULT 0"
  882             },
  883             {
  884              info              => "Checking if grp table includes organization_homepage",
  885              sqlcommand        => "select organization_homepage from grp",
  886              perlcommand       => "",
  887              onsuccess_info    => "grp.organization_homepage exists",
  888              onsuccess         => "",
  889              onfailure_info    => "grp table check failed -> modifying table grp",
  890              onfailure         => "ALTER TABLE grp ADD organization_homepage varchar(255) DEFAULT NULL"
  891             },
  892             {
  893              info              => "Checking if grp table includes organization_post_registration",
  894              sqlcommand        => "select organization_post_registration from grp",
  895              perlcommand       => "",
  896              onsuccess_info    => "grp.organization_post_registration exists",
  897              onsuccess         => "",
  898              onfailure_info    => "grp table check failed -> modifying table grp",
  899              onfailure         => "ALTER TABLE grp ADD organization_post_registration varchar(255) DEFAULT NULL"
  900             },
  901         {
  902          info              => "Changing column isa's type in permissions table",
  903          sqlcommand        => "alter table permissions modify isa varchar(60) NOT NULL default ''",
  904          onsuccess_info    => "Type changed",
  905          onsuccess         => "",
  906          onfailure_info    => "column doesn't exist",
  907          onfailure         => ""
  908 
  909         },
  910 
  911         {
  912          info              => "Testing existence of event_log_report_builder table",
  913          sqlcommand        => "select count(*) from event_log_report_builder",
  914          perlcommand       => "",
  915          onsuccess_info    => "table event_log_report_builder already exists",
  916          onsuccess         => "",
  917          onfailure_info    => "existence check failed -> creating table event_log_report_builder",
  918          onfailure         => "
  919 CREATE TABLE event_log_report_builder (
  920   unique_id varchar(32) NOT NULL default '',
  921   date_and_time datetime default NULL,
  922   year_month_date mediumint(6) default NULL,
  923   userid int(11) default NULL,
  924   user_name varchar(255) default NULL,
  925   class_name varchar(255) default NULL,
  926   operation_name varchar(255) default NULL,
  927   total int(11) default NULL,
  928   instance_id varchar(255) default NULL,
  929   login_timestamp text,
  930   PRIMARY KEY  (unique_id),
  931   KEY event_log_report_builder (year_month_date,userid,class_name(50),operation_name(20),instance_id(15))
  932 );",
  933         },
  934         {
  935          info              => "Testing existence of event_log_monthly_user_stats table",
  936          sqlcommand        => "select count(*) from event_log_monthly_user_stats",
  937          perlcommand       => "",
  938          onsuccess_info    => "table event_log_monthly_user_stats already exists",
  939          onsuccess         => "",
  940          onfailure_info    => "existence check failed -> creating table event_log_monthly_user_stats",
  941          onfailure         => "
  942 CREATE TABLE event_log_monthly_user_stats (
  943   unique_id varchar(32) NOT NULL default '',
  944   year_month_date mediumint(6) default NULL,
  945   userid int(11) default NULL,
  946   user_name varchar(255) default NULL,
  947   class_name varchar(255) default NULL,
  948   operation_name varchar(255) default NULL,
  949   monthly_total int(11) default NULL,
  950   instance_id varchar(255) default NULL,
  951   instance_name varchar(255) default NULL,
  952   slot_1 varchar(255) default NULL,
  953   slot_2 varchar(255) default NULL,
  954   slot_3 varchar(255) default NULL,
  955   slot_4 varchar(255) default NULL,
  956   slot_5 varchar(255) default NULL,
  957   PRIMARY KEY  (unique_id),
  958   KEY event_log_monthly_user (year_month_date,userid,class_name(50),operation_name(20),instance_id(15)),
  959   KEY event_log_monthly_user2 (slot_1(30),slot_2(30),slot_3(30),slot_4(30),slot_5(30))
  960 );",
  961         },
  962         {
  963          info              => "Testing existence of event_log_monthly_object_stats table",
  964          sqlcommand        => "select count(*) from event_log_monthly_object_stats",
  965          perlcommand       => "",
  966          onsuccess_info    => "table event_log_monthly_object_stats already exists",
  967          onsuccess         => "",
  968          onfailure_info    => "existence check failed -> creating table event_log_monthly_object_stats",
  969          onfailure         => "
  970 CREATE TABLE event_log_monthly_object_stats (
  971   unique_id varchar(32) NOT NULL default '',
  972   year_month_date mediumint(6) default NULL,
  973   class_name varchar(255) default NULL,
  974   operation_name varchar(255) default NULL,
  975   monthly_total int(11) default NULL,
  976   instance_id varchar(255) default NULL,
  977   instance_name varchar(255) default NULL,
  978   PRIMARY KEY  (unique_id),
  979   KEY event_log_monthly_object (year_month_date,class_name(50),operation_name(20),instance_id(15))
  980 );",
  981         },
  982         {
  983          info              => "Testing existence of event_log_monthly_group_stats table",
  984          sqlcommand        => "select count(*) from event_log_monthly_group_stats",
  985          perlcommand       => "",
  986          onsuccess_info    => "table event_log_monthly_group_stats already exists",
  987          onsuccess         => "",
  988          onfailure_info    => "existence check failed -> creating table event_log_monthly_group_stats",
  989          onfailure         => "
  990 CREATE TABLE event_log_monthly_group_stats (
  991   unique_id varchar(32) NOT NULL default '',
  992   year_month_date mediumint(6) default NULL,
  993   class_name varchar(255) default NULL,
  994   operation_name varchar(255) default NULL,
  995   monthly_total int(11) default NULL,
  996   grp_id int(11) NOT NULL default '0',
  997   group_name varchar(30) default NULL,
  998   instance_id varchar(255) default NULL,
  999   instance_name varchar(255) default NULL,
 1000   PRIMARY KEY  (unique_id),
 1001   KEY event_log_monthly_group (year_month_date,grp_id,class_name(50),operation_name(20),instance_id(15))
 1002 )
 1003   ;",
 1004         },
 1005         {
 1006          info              => "Testing existence of event_log_monthly_grpmembers table",
 1007          sqlcommand        => "select count(*) from event_log_monthly_grpmembers",
 1008          perlcommand       => "",
 1009          onsuccess_info    => "table event_log_monthly_grpmembers already exists",
 1010          onsuccess         => "",
 1011          onfailure_info    => "existence check failed -> creating table event_log_monthly_grpmembers",
 1012          onfailure         => "
 1013 CREATE TABLE event_log_monthly_grpmembers (
 1014   year_month_date mediumint(6) NOT NULL default '0',
 1015   grp_id int(11) NOT NULL default '0',
 1016   userid int(11) NOT NULL default '0',
 1017   PRIMARY KEY  (year_month_date,grp_id,userid),
 1018   KEY grp_id (grp_id),
 1019   KEY userid (userid)
 1020 );",
 1021         },
 1022         {
 1023          info              => "Correcting bad values for showfrom",
 1024          sqlcommand        => "update instance set showfrom=null where showfrom = '0000-00-00 00:00:00'",
 1025          perlcommand       => "",
 1026          onsuccess_info    => "Values were corrected.",
 1027          onsuccess         => "",
 1028          onfailure_info    => "Attemp failed. Check showfrom values in instance",
 1029          onfailure         => ""
 1030         },
 1031         {
 1032          info              => "Adding column showend in instance",
 1033          sqlcommand        => "select count(showend) from instance",
 1034          perlcommand       => "",
 1035          onsuccess_info    => "showend field already exists",
 1036          onsuccess         => "",
 1037          onfailure_info    => "field showend does not exist - creating",
 1038          onfailure         => "alter table instance add showend datetime default NULL",
 1039         },
 1040         {
 1041          info              => "Altering column date_and_time in event_log_report_builder",
 1042          sqlcommand        => "select count(date) from event_log_report_builder",
 1043          perlcommand       => "",
 1044          onsuccess_info    => "Will alter old field date to date_and_time",
 1045          onsuccess         => "alter table event_log_report_builder change date date_and_time datetime default NULL",
 1046          onfailure_info    => "Field already updated",
 1047          onfailure         => "",
 1048         },
 1049         {
 1050          info              => "Setting default skin to Metadot6 if the value was previously 'default'",
 1051          sqlcommand        => "update params set value='Metadot6' where name='skin_selection' AND (value = 'default')",
 1052          perlcommand       => "",
 1053          onsuccess_info    => "Update successful",
 1054          onsuccess         => "",
 1055          onfailure_info    => "Update failed. Possibly the default has not been selected.",
 1056          onfailure         => "",
 1057         },
 1058         {
 1059          info              => "Indexing instance.IsA",
 1060          sqlcommand        => "alter table instance add index isa (IsA)",
 1061          perlcommand       => "",
 1062          onsuccess_info    => "Update successful",
 1063          onsuccess         => "",
 1064          onfailure_info    => "Update failed. No action taken.",
 1065          onfailure         => "",
 1066         },
 1067         {
 1068          info              => "Adding recipient_uid & isa field to message table",
 1069          sqlcommand        => "select recipient_uid from message",
 1070          perlcommand       => "",
 1071          onsuccess_info    => "Field exists already",
 1072          onsuccess         => "",
 1073          onfailure_info    => "Field does not exist - adding",
 1074          onfailure         => [
 1075 "alter table message add (recipient_uid int(11) null, isa varchar(60) null);",
 1076 "alter table message add index recipient_uid (recipient_uid);",
 1077 "alter table message add index isa (isa);",
 1078 "alter table message add index status (status);",
 1079 ]
 1080         },
 1081         {
 1082          info              => "Updating null values for isa field in message table",
 1083          sqlcommand        => "update message set isa ='Message' where isa is null",
 1084          perlcommand       => "",
 1085          onsuccess_info    => "Updated!",
 1086          onsuccess         => "",
 1087          onfailure_info    => "",
 1088          onfailure         => "",
 1089         },
 1090         {
 1091          info              => "Altering event_log tables - changing char's to varchar's",
 1092          sqlcommand        => "select count(*) from event_log_report_builder",
 1093          perlcommand       => "",
 1094          onsuccess_info    => "Altering tables",
 1095          onsuccess         => [
 1096 'ALTER TABLE event_log
 1097   MODIFY user_name VARCHAR(255),
 1098   MODIFY sub_application_name VARCHAR(255),
 1099   MODIFY class_name VARCHAR(255),
 1100   MODIFY operation_name VARCHAR(255),
 1101   MODIFY instance_id VARCHAR(255),
 1102   MODIFY date_and_time VARCHAR(255),
 1103   MODIFY unix_time VARCHAR(255),
 1104   MODIFY slot_1 VARCHAR(255),
 1105   MODIFY slot_2 VARCHAR(255),
 1106   MODIFY slot_3 VARCHAR(255),
 1107   MODIFY slot_4 VARCHAR(255),
 1108   MODIFY slot_5 VARCHAR(255),
 1109   MODIFY slot_6 VARCHAR(255),
 1110   MODIFY slot_7 VARCHAR(255),
 1111   MODIFY slot_8 VARCHAR(255),
 1112   MODIFY slot_9 VARCHAR(255),
 1113   MODIFY slot_10 VARCHAR(255),
 1114   MODIFY slot_11 VARCHAR(255),
 1115   MODIFY slot_12 VARCHAR(255),
 1116   MODIFY slot_13 VARCHAR(255),
 1117   MODIFY slot_14 VARCHAR(255),
 1118   MODIFY slot_15 VARCHAR(255),
 1119   MODIFY slot_16 VARCHAR(255),
 1120   MODIFY slot_17 VARCHAR(255),
 1121   MODIFY slot_18 VARCHAR(255),
 1122   MODIFY slot_19 VARCHAR(255),
 1123   MODIFY slot_20 VARCHAR(255);',
 1124 'ALTER TABLE event_log_report_builder
 1125   MODIFY user_name VARCHAR(255),
 1126   MODIFY class_name VARCHAR(255),
 1127   MODIFY operation_name VARCHAR(255),
 1128   MODIFY instance_id VARCHAR(255);',
 1129 'ALTER TABLE event_log_monthly_user_stats
 1130   MODIFY user_name VARCHAR(255),
 1131   MODIFY class_name VARCHAR(255),
 1132   MODIFY operation_name VARCHAR(255),
 1133   MODIFY instance_id VARCHAR(255),
 1134   MODIFY instance_name VARCHAR(255),
 1135   MODIFY slot_1 VARCHAR(255),
 1136   MODIFY slot_2 VARCHAR(255),
 1137   MODIFY slot_3 VARCHAR(255),
 1138   MODIFY slot_4 VARCHAR(255),
 1139   MODIFY slot_5 VARCHAR(255);',
 1140 'ALTER TABLE event_log_monthly_object_stats
 1141   MODIFY class_name VARCHAR(255),
 1142   MODIFY operation_name VARCHAR(255),
 1143   MODIFY instance_id VARCHAR(255),
 1144   MODIFY instance_name VARCHAR(255);',
 1145 'ALTER TABLE event_log_monthly_group_stats
 1146   MODIFY class_name VARCHAR(255),
 1147   MODIFY operation_name VARCHAR(255),
 1148   MODIFY instance_id VARCHAR(255),
 1149   MODIFY instance_name VARCHAR(255);'
 1150 ],
 1151          onfailure_info    => "",
 1152          onfailure         => "",
 1153         },
 1154 
 1155         {
 1156      ### NZ
 1157          info              => "Checking if event_log_report_builder table includes login timestamp field",
 1158          sqlcommand        => "select login_timestamp from event_log_report_builder",
 1159          perlcommand       => "",
 1160          onsuccess_info    => "login timestamp already exists",
 1161          onsuccess         => "",
 1162          onfailure_info    => "login_timestamp check failed -> modifying table event_log_report_builder",
 1163          onfailure         => "ALTER TABLE  event_log_report_builder ADD login_timestamp text"
 1164         },
 1165 
 1166         {
 1167          info              => "Altering the IsA field to fit longer class names",
 1168          sqlcommand        => "ALTER TABLE instance MODIFY IsA VARCHAR(255) NOT NULL",
 1169          perlcommand       => "",
 1170          onsuccess_info    => "IsA field was successfully altered",
 1171          onsuccess         => "",
 1172          onfailure_info    => "IsA field could NOT be altered",
 1173          onfailure         => ""
 1174         },
 1175 
 1176         ## check existance of password_changed_time field
 1177         {
 1178            info            => "Checking if password_changed_time field exists in the users table",
 1179            sqlcommand      => "select password_changed_time from users where userid = 8",
 1180            perlcommand     => "",
 1181            onsuccess_info  => "password_changed_time field already exists",
 1182            onsuccess       => "",
 1183            onfailure_info  => "password_changed_time check failed -> modifying users table",
 1184            onfailure       => "ALTER TABLE users add password_changed_time int(11)"
 1185         },
 1186 
 1187         ## check existance of password_expiration_notification_sent_time field (RENAME TO SHORTER NAME)
 1188         {
 1189            info            => "Checking if password_expiration_notification_sent_time field exists in the users table",
 1190            sqlcommand      => "select password_expiration_notification_sent_time from users where userid = 8",
 1191            perlcommand     => "",
 1192            onsuccess_info  => "password_expiration_notification_sent_time field already exists, must rename",
 1193            onsuccess       => "ALTER TABLE users CHANGE password_expiration_notification_sent_time pw_expire_notification_time int(11)",
 1194            onfailure_info  => "password_expiration_notification_sent_time does not exist, no action necessary",
 1195            onfailure       => "",
 1196         },
 1197 
 1198         ## check existance of pw_expire_notification_time field
 1199         {
 1200            info            => "Checking if pw_expire_notification_time field exists in the users table",
 1201            sqlcommand      => "select pw_expire_notification_time from users where userid = 8",
 1202            perlcommand     => "",
 1203            onsuccess_info  => "pw_expire_notification_time field already exists",
 1204            onsuccess       => "",
 1205            onfailure_info  => "pw_expire_notification_time check failed -> modifying users table",
 1206            onfailure       => "ALTER TABLE users ADD pw_expire_notification_time int(11)"
 1207         },
 1208 
 1209 
 1210         ## check existence of short_name field in instance
 1211         {
 1212                 info              => "Testing existence of short_name field in table instance",
 1213                 sqlcommand        => "select distinct(short_name) from instance",
 1214                 onsuccess_info    => "the field already exists",
 1215                 onsuccess         => "",
 1216                 onfailure_info    => "test failed, adding the column",
 1217                 onfailure         => "ALTER TABLE instance ADD COLUMN short_name VARCHAR(255) DEFAULT NULL, ADD INDEX idx_short_name(short_name)",
 1218         },
 1219 
 1220         ## check existence of grp_id field in subscription
 1221         {
 1222                 info              => "Testing existence of grp_id field in table subscription",
 1223                 sqlcommand        => "select distinct(grp_id) from subscription",
 1224                 onsuccess_info    => "the field already exists",
 1225                 onsuccess         => "",
 1226                 onfailure_info    => "test failed, adding the column",
 1227                 onfailure         => "ALTER TABLE subscription ADD COLUMN grp_id VARCHAR(255) DEFAULT NULL, MODIFY COLUMN userid INT(11), ADD COLUMN optional TINYINT, ADD COLUMN opt_out TINYINT, ADD INDEX idx_subscription_grp_id(grp_id), ADD INDEX idx_subscription_opt_out(opt_out)",
 1228         },
 1229 
 1230         ## create dynaProperties table
 1231             {
 1232              info              => "Testing existence of dynaProperties table",
 1233              sqlcommand        => "select count(*) from dynaProperties",
 1234              perlcommand       => "",
 1235              onsuccess_info    => "table dynaProperties already exists",
 1236              onsuccess         => "",
 1237              onfailure_info    => "existence check failed -> creating table dynaProperties",
 1238              onfailure         => "
 1239 CREATE TABLE dynaProperties (
 1240   propertyId    INT(11) NOT NULL,
 1241   className     VARCHAR(255) NOT NULL,
 1242   instanceId    INT(11) DEFAULT NULL,
 1243   categoryId    VARCHAR(255) DEFAULT NULL,
 1244   name          VARCHAR(255) DEFAULT NULL,
 1245   type          INT(1) DEFAULT NULL,
 1246   sortOrder     INT(5) DEFAULT NULL,
 1247   valueSTRING   TEXT DEFAULT NULL,
 1248 
 1249   PRIMARY KEY (propertyId),
 1250   INDEX idx_dp_class_instance(className, instanceId),
 1251   INDEX idx_dp_name(name),
 1252   INDEX idx_dp_type(type)
 1253 );",
 1254             },
 1255 
 1256 
 1257             ## check existence of valueSTRING field in dynaProperties
 1258             {
 1259                     info              => "Testing existence of valueSTRING field in table dynaProperties",
 1260                     sqlcommand        => "select count(valueSTRING) from dynaProperties",
 1261                     onsuccess_info    => "the field already exists",
 1262                     onsuccess         => "",
 1263                     onfailure_info    => "test failed, adding the column",
 1264                     onfailure         => "ALTER TABLE dynaProperties ADD COLUMN valueString text",
 1265             },
 1266 
 1267 
 1268             ## check existence of sender_class field in system_messages
 1269             {
 1270                     info              => "Testing existence of sender_class field in table system_messages",
 1271                     sqlcommand        => "select distinct(sender_class) from system_messages",
 1272                     onsuccess_info    => "the field already exists",
 1273                     onsuccess         => "",
 1274                     onfailure_info    => "test failed, adding the column",
 1275                     onfailure         => "ALTER TABLE system_messages ADD COLUMN sender_class VARCHAR(255) DEFAULT NULL, ADD recipient_class VARCHAR(255) DEFAULT NULL, ADD INDEX idx_sender_class(sender_class), ADD INDEX idx_recipient_class(recipient_class)",
 1276             },
 1277 
 1278 
 1279             ## index subscription.frequency
 1280             {
 1281                     info              => "Indexing subscription.frequency",
 1282                     sqlcommand        => "CREATE INDEX idx_subscription_freq ON subscription(frequency)",
 1283                     onsuccess_info    => "Index created.",
 1284                     onsuccess         => "",
 1285                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1286                     onfailure         => undef,
 1287             },
 1288 
 1289             ## index subscription.cid
 1290             {
 1291                     info              => "Indexing subscription.cid",
 1292                     sqlcommand        => "CREATE INDEX idx_subscription_cid ON subscription(cid)",
 1293                     onsuccess_info    => "Index created.",
 1294                     onsuccess         => "",
 1295                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1296                     onfailure         => undef,
 1297             },
 1298 
 1299 
 1300             ## check existence of last_ciid field in subscription
 1301             {
 1302                     info              => "Testing existence of last_ciid field in table subscription",
 1303                     sqlcommand        => "select distinct(last_ciid) from subscription",
 1304                     onsuccess_info    => "the field already exists",
 1305                     onsuccess         => "",
 1306                     onfailure_info    => "test failed, adding the column",
 1307                     onfailure         => "ALTER TABLE subscription ADD COLUMN last_ciid INT(11) DEFAULT NULL",
 1308             },
 1309 
 1310             ## allow nulls in processdate
 1311             {
 1312                     info              => "Allowing null for subscription.processdate",
 1313                     sqlcommand        => "ALTER TABLE subscription MODIFY processdate DATETIME NULL",
 1314                     onsuccess_info    => "Change was successful.",
 1315                     onsuccess         => "",
 1316                     onfailure_info    => "Update failed.",
 1317             },
 1318 
 1319             ## fix incorrect user image uploads
 1320             {
 1321                 info              => "Fixing incorrect user image uploads",
 1322                 sqlcommand        => "UPDATE uploads SET type='user_upload' WHERE type='Metadot::User::User3000::PictureField'",
 1323                 onsuccess_info    => "Change was successful.",
 1324                 onsuccess         => "",
 1325                 onfailure_info    => "Update failed.",
 1326             },
 1327 
 1328             ## check for welcome_letter_heading in grp table
 1329             {
 1330              info              => "Adding column welcome_letter_heading in grp",
 1331              sqlcommand        => "SELECT COUNT(welcome_letter_heading) FROM grp",
 1332              perlcommand       => "",
 1333              onsuccess_info    => "welcome_letter_heading field already exists",
 1334              onsuccess         => "",
 1335              onfailure_info    => "field welcome_letter_heading does not exist - creating",
 1336              onfailure         => "ALTER TABLE grp ADD welcome_letter_heading TEXT DEFAULT NULL",
 1337             },
 1338 
 1339             ## check for welcome_letter_body in grp table
 1340             {
 1341              info              => "Adding column welcome_letter_body in grp",
 1342              sqlcommand        => "SELECT COUNT(welcome_letter_body) FROM grp",
 1343              perlcommand       => "",
 1344              onsuccess_info    => "welcome_letter_body field already exists",
 1345              onsuccess         => "",
 1346              onfailure_info    => "field welcome_letter_body does not exist - creating",
 1347              onfailure         => "ALTER TABLE grp ADD welcome_letter_body TEXT DEFAULT NULL",
 1348             },
 1349 
 1350             ## Adding indexes to event_log tables
 1351             {
 1352                     info              => "Indexing event_log.userid",
 1353                     sqlcommand        => "ALTER TABLE event_log ADD INDEX userid_index(userid)",
 1354                     onsuccess_info    => "Index created.",
 1355                     onsuccess         => "",
 1356                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1357                     onfailure         => undef,
 1358             },
 1359 
 1360             {
 1361                     info              => "Indexing event_log.user_name",
 1362                     sqlcommand        => "ALTER TABLE event_log ADD INDEX username_index(user_name)",
 1363                     onsuccess_info    => "Index created.",
 1364                     onsuccess         => "",
 1365                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1366                     onfailure         => undef,
 1367             },
 1368 
 1369             {
 1370                     info              => "Indexing event_log.sub_application_name",
 1371                     sqlcommand        => "ALTER TABLE event_log ADD INDEX application_name_index(sub_application_name)",
 1372                     onsuccess_info    => "Index created.",
 1373                     onsuccess         => "",
 1374                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1375                     onfailure         => undef,
 1376             },
 1377 
 1378             {
 1379                     info              => "Indexing event_log.class_name",
 1380                     sqlcommand        => "ALTER TABLE event_log ADD INDEX class_index(class_name)",
 1381                     onsuccess_info    => "Index created.",
 1382                     onsuccess         => "",
 1383                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1384                     onfailure         => undef,
 1385             },
 1386 
 1387             {
 1388                     info              => "Indexing event_log.instance_id",
 1389                     sqlcommand        => "ALTER TABLE event_log ADD INDEX instance_index(instance_id)",
 1390                     onsuccess_info    => "Index created.",
 1391                     onsuccess         => "",
 1392                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1393                     onfailure         => undef,
 1394             },
 1395 
 1396             {
 1397                     info              => "Indexing event_log.operation_name",
 1398                     sqlcommand        => "ALTER TABLE event_log ADD INDEX op_name_index(operation_name)",
 1399                     onsuccess_info    => "Index created.",
 1400                     onsuccess         => "",
 1401                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1402                     onfailure         => undef,
 1403             },
 1404 
 1405             {
 1406                     info              => "Indexing event_log.date_and_time",
 1407                     sqlcommand        => "ALTER TABLE event_log ADD INDEX date_and_time_index(date_and_time)",
 1408                     onsuccess_info    => "Index created.",
 1409                     onsuccess         => "",
 1410                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1411                     onfailure         => undef,
 1412             },
 1413 
 1414             {
 1415                     info              => "Indexing event_log.unix_time",
 1416                     sqlcommand        => "ALTER TABLE event_log ADD INDEX  unix_time_index(unix_time)",
 1417                     onsuccess_info    => "Index created.",
 1418                     onsuccess         => "",
 1419                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1420                     onfailure         => undef,
 1421             },
 1422 
 1423             {
 1424                     info              => "Indexing event_log_monthly_group_stats.class_name",
 1425                     sqlcommand        => "ALTER TABLE event_log_monthly_group_stats ADD INDEX class_name_index(class_name)",
 1426                     onsuccess_info    => "Index created.",
 1427                     onsuccess         => "",
 1428                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1429                     onfailure         => undef,
 1430             },
 1431 
 1432             {
 1433                     info              => "Indexing event_log_monthly_group_stats.operation_name",
 1434                     sqlcommand        => "ALTER TABLE event_log_monthly_group_stats ADD INDEX op_name_index(operation_name)",
 1435                     onsuccess_info    => "Index created.",
 1436                     onsuccess         => "",
 1437                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1438                     onfailure         => undef,
 1439             },
 1440 
 1441             {
 1442                     info              => "Indexing event_log_monthly_group_stats.grp_id",
 1443                     sqlcommand        => "ALTER TABLE event_log_monthly_group_stats ADD INDEX grp_id_index(grp_id)",
 1444                     onsuccess_info    => "Index created.",
 1445                     onsuccess         => "",
 1446                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1447                     onfailure         => undef,
 1448             },
 1449 
 1450             {
 1451                     info              => "Indexing event_log_monthly_group_stats.group_name",
 1452                     sqlcommand        => "ALTER TABLE event_log_monthly_group_stats ADD INDEX group_name_index(group_name)",
 1453                     onsuccess_info    => "Index created.",
 1454                     onsuccess         => "",
 1455                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1456                     onfailure         => undef,
 1457             },
 1458 
 1459             {
 1460                     info              => "Indexing event_log_monthly_group_stats.instance_id",
 1461                     sqlcommand        => "ALTER TABLE event_log_monthly_group_stats ADD INDEX instance_id_index(instance_id)",
 1462                     onsuccess_info    => "Index created.",
 1463                     onsuccess         => "",
 1464                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1465                     onfailure         => undef,
 1466             },
 1467 
 1468             {
 1469                     info              => "Indexing event_log_monthly_group_stats.instance_name",
 1470                     sqlcommand        => "ALTER TABLE event_log_monthly_group_stats ADD INDEX instance_name_index(instance_name)",
 1471                     onsuccess_info    => "Index created.",
 1472                     onsuccess         => "",
 1473                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1474                     onfailure         => undef,
 1475             },
 1476 
 1477             {
 1478                     info              => "Indexing event_log_monthly_object_stats.class_name",
 1479                     sqlcommand        => "ALTER TABLE event_log_monthly_object_stats ADD INDEX class_name_index(class_name)",
 1480                     onsuccess_info    => "Index created.",
 1481                     onsuccess         => "",
 1482                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1483                     onfailure         => undef,
 1484             },
 1485 
 1486             {
 1487                     info              => "Indexing event_log_monthly_object_stats.operation_name",
 1488                     sqlcommand        => "ALTER TABLE event_log_monthly_object_stats ADD INDEX operation_name_index(operation_name)",
 1489                     onsuccess_info    => "Index created.",
 1490                     onsuccess         => "",
 1491                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1492                     onfailure         => undef,
 1493             },
 1494 
 1495             {
 1496                     info              => "Indexing event_log_monthly_object_stats.instance_id",
 1497                     sqlcommand        => "ALTER TABLE event_log_monthly_object_stats ADD INDEX instance_id_index(instance_id)",
 1498                     onsuccess_info    => "Index created.",
 1499                     onsuccess         => "",
 1500                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1501                     onfailure         => undef,
 1502             },
 1503 
 1504             {
 1505                     info              => "Indexing event_log_monthly_object_stats.instance_name",
 1506                     sqlcommand        => "ALTER TABLE event_log_monthly_object_stats ADD INDEX instance_name_index(instance_name)",
 1507                     onsuccess_info    => "Index created.",
 1508                     onsuccess         => "",
 1509                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1510                     onfailure         => undef,
 1511             },
 1512 
 1513             {
 1514                     info              => "Indexing event_log_monthly_user_stats.userid",
 1515                     sqlcommand        => "ALTER TABLE event_log_monthly_user_stats ADD INDEX userid_index(userid)",
 1516                     onsuccess_info    => "Index created.",
 1517                     onsuccess         => "",
 1518                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1519                     onfailure         => undef,
 1520             },
 1521 
 1522             {
 1523                     info              => "Indexing event_log_monthly_user_stats.user_name",
 1524                     sqlcommand        => "ALTER TABLE event_log_monthly_user_stats ADD INDEX user_name_index(user_name)",
 1525                     onsuccess_info    => "Index created.",
 1526                     onsuccess         => "",
 1527                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1528                     onfailure         => undef,
 1529             },
 1530 
 1531             {
 1532                     info              => "Indexing event_log_monthly_user_stats.class_name",
 1533                     sqlcommand        => "ALTER TABLE event_log_monthly_user_stats ADD INDEX class_name_index(class_name)",
 1534                     onsuccess_info    => "Index created.",
 1535                     onsuccess         => "",
 1536                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1537                     onfailure         => undef,
 1538             },
 1539 
 1540             {
 1541                     info              => "Indexing event_log_monthly_user_stats.operation_name",
 1542                     sqlcommand        => "ALTER TABLE event_log_monthly_user_stats ADD INDEX operation_name_index(operation_name)",
 1543                     onsuccess_info    => "Index created.",
 1544                     onsuccess         => "",
 1545                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1546                     onfailure         => undef,
 1547             },
 1548 
 1549             {
 1550                     info              => "Indexing event_log_monthly_user_stats.instance_id",
 1551                     sqlcommand        => "ALTER TABLE event_log_monthly_user_stats ADD INDEX instance_id(instance_id)",
 1552                     onsuccess_info    => "Index created.",
 1553                     onsuccess         => "",
 1554                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1555                     onfailure         => undef,
 1556             },
 1557 
 1558             {
 1559                     info              => "Indexing event_log_monthly_user_stats.instance_name",
 1560                     sqlcommand        => "ALTER TABLE event_log_monthly_user_stats ADD INDEX instance_name_index(instance_name)",
 1561                     onsuccess_info    => "Index created.",
 1562                     onsuccess         => "",
 1563                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1564                     onfailure         => undef,
 1565             },
 1566 
 1567             {
 1568                     info              => "Indexing event_log_report_builder.date_and_time",
 1569                     sqlcommand        => "ALTER TABLE event_log_report_builder ADD INDEX date_and_time_index(date_and_time)",
 1570                     onsuccess_info    => "Index created.",
 1571                     onsuccess         => "",
 1572                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1573                     onfailure         => undef,
 1574             },
 1575 
 1576             {
 1577                     info              => "Indexing event_log_report_builder.userid",
 1578                     sqlcommand        => "ALTER TABLE event_log_report_builder ADD INDEX userid_index(userid)",
 1579                     onsuccess_info    => "Index created.",
 1580                     onsuccess         => "",
 1581                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1582                     onfailure         => undef,
 1583             },
 1584 
 1585             {
 1586                     info              => "Indexing event_log_report_builder.user_name",
 1587                     sqlcommand        => "ALTER TABLE event_log_report_builder ADD INDEX user_name_index(user_name)",
 1588                     onsuccess_info    => "Index created.",
 1589                     onsuccess         => "",
 1590                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1591                     onfailure         => undef,
 1592             },
 1593 
 1594             {
 1595                     info              => "Indexing event_log_report_builder.class_name",
 1596                     sqlcommand        => "ALTER TABLE event_log_report_builder ADD INDEX class_name_index(class_name)",
 1597                     onsuccess_info    => "Index created.",
 1598                     onsuccess         => "",
 1599                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1600                     onfailure         => undef,
 1601             },
 1602 
 1603             {
 1604                     info              => "Indexing event_log_report_builder.operation_name",
 1605                     sqlcommand        => "ALTER TABLE event_log_report_builder ADD INDEX operation_name_index(operation_name)",
 1606                     onsuccess_info    => "Index created.",
 1607                     onsuccess         => "",
 1608                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1609                     onfailure         => undef,
 1610             },
 1611 
 1612             {
 1613                     info              => "Indexing event_log_report_builder.instance_id",
 1614                     sqlcommand        => "ALTER TABLE event_log_report_builder ADD INDEX instance_id_index(instance_id)",
 1615                     onsuccess_info    => "Index created.",
 1616                     onsuccess         => "",
 1617                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 1618                     onfailure         => undef,
 1619             },
 1620 
 1621             {
 1622                     info              => "Renaming default_mail_encoding to default_mail_content_type",
 1623                     sqlcommand        => "SELECT count(*) FROM params WHERE name='default_mail_encoding'",
 1624                     result_condition  =>  "<<result>> > 0",
 1625                     onsuccess_info    => "We need to rename the param",
 1626                     onsuccess         => "UPDATE params SET name='default_mail_content_type' WHERE name='default_mail_encoding'",
 1627                     onfailure_info    => "No need to rename the param, it does not exist",
 1628                     onfailure         => undef,
 1629             },
 1630 # Mel Stuff
 1631         
 1632             {
 1633                     info              => "Updating support links...",
 1634                     sqlcommand        => "SELECT value from gizmoitemparam WHERE ciid=510501 AND value = 'http://support.metadot.com'",
 1635                     onsuccess_info    => "Pointing to current address",
 1636                     onsuccess         => "UPDATE gizmoitemparam SET value='http://www.metadot.com/' WHERE ciid=510501",
 1637                     onfailure_info    => "Default one undefined - Good!",
 1638                     onfailure         => undef,
 1639             },
 1640             {
 1641                     info              => "Updating support links...",
 1642                     sqlcommand        => "SELECT * from params where params_id=93 AND value = 'http://support.metadot.com'",
 1643                     onsuccess_info    => "Pointing to current address",
 1644                     onsuccess         => "UPDATE gizmoitemparam SET value='http://www.metadot.com/' WHERE ciid=510501",
 1645                     onfailure_info    => "Default one undefined - Good!",
 1646                     onfailure         => undef,
 1647             },
 1648             {
 1649                     info              => "Updating support links...in Skin Header",
 1650                     sqlcommand        => "SELECT * from params where params_id=127",
 1651                     onsuccess_info    => "Pointing to current address",
 1652                     onsuccess         => "UPDATE params SET value='<div id=\"footer\">\r\n   <h1>My Custom Footer</h1>\r\n  <span class=\"date\">&copy; 1999-2005 Metadot Corporation. All Rights Reserved.</span>\r\n\r\n  <span class=\"other\">\r\n    <a href=\"http://www.metadot.com/\"><img class=\"icon\" src=\"/images/help.gif\" border=\"0\" alt=\"\"/></a>\r\n        \r\n    <a href=\"http://www.metadot.com\"><img class=\"icon\" src=\"http://www.metadot.com/public/footer_logo.gif\" border=\"0\" alt=\"\" /></a>\r\n  </span>\r\n</div>' WHERE params_id=127",
 1653                     onfailure_info    => "Undefined - Good!",
 1654                     onfailure         => undef,
 1655             },          
 1656             {
 1657                     info              => "Updating support link on maintemplate",
 1658                     sqlcommand        => "SELECT * from theme WHERE theme='theme1' AND pname='theme_maintemplate'",
 1659                     onsuccess_info    => "Got it..good",
 1660                     onsuccess         => "UPDATE theme SET pvalue='<html>\n<head>\n<title><gizmotag no_comments=\"1\" name=\"md_title\"></gizmotag></title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n<gizmotag name=\"md_theme1_style\"></gizmotag>\n</head>\n\n<body bgcolor=\"#FFFFFF\" text=\"#000000\" marginheight=0 marginwidth=0>\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n  <tr> \n    <td width=\"100%\"><gizmotag name=\"md_theme1_header\">top header table</gizmotag></td>\n  </tr>\n  <tr> \n    <td align=\"left\"> \n      <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n        <tr> \n<!--           <td width=\"150\" valign=\"top\"> -->\n   <gizmotag name=\"md_theme1_lefttable\">left col</gizmotag>\n<!--    </td> -->\n          <td valign=\"top\" width=\"100%\"> \n            <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n              <tr> \n                <td><gizmotag name=\"md_h_topnavl1\">categ listing</gizmotag></td>\n              </tr>\n              <tr> \n                <td>   \n         <table width=\"100%\"><tr>\n         <td align=left><gizmotag name=\"md_editpanel\"></gizmotag></td>\n         <td align=right><gizmotag name=\"md_links_panel\"></gizmotag></td>\n         </tr></table>\n        </td>\n              </tr>\n              <tr> \n              <td align=right valign=top><gizmotag name=\"md_adminbar\"></gizmotag></td>\n              </tr>\n              <tr> \n                <td> \n      <table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"100%\">\n        <tr> \n          <td width=\"15\">&nbsp;</td>\n          <td width=\"450\">&nbsp;</td>\n          <td width=\"15\">&nbsp;</td>\n          <td width=\"1\" ><img src=\"[% imageslocation %]/spacer.gif\" width=1></td>\n          <td width=\"15\">&nbsp;</td>\n          <td width=\"150\">&nbsp;</td>\n        </tr>\n        <tr valign=\"top\"> \n          <td width=\"15\">&nbsp;</td>\n          <td width=\"450\"> \n<!--           middle panel -->\n            <h2><gizmotag name=\"md_title\"></gizmotag></h2>\n            <gizmotag name=\"md_catdesc\"></gizmotag>\n            <gizmotag name=\"md_gizmolist\">this is where the middle\n      panel stuff goes..</gizmotag>\n          </td>\n          <td width=\"15\">&nbsp;</td>\n          <td width=\"1\" bgcolor=\"#000000\"><img src=\"[% imageslocation %]/spacer.gif\" width=1></td>\n          <td width=\"15\">&nbsp;</td>\n          <td width=\"150\">\n<!--            right-hand col -->\n           <gizmotag name=\"md_calendar_month\"></gizmotag>\n           <gizmotag name=\"md_newscol\"></gizmotag>\n           <gizmotag name=\"md_poll\"></gizmotag>\n          </td>\n        </tr>\n        <tr> \n          <td height=\"1\"><img height=\"1\" width=\"15\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td><img height=\"1\" width=\"450\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td><img height=\"1\" width=\"15\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td><img height=\"1\" width=\"1\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td><img height=\"1\" width=\"15\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td><img height=\"1\" width=\"150\" src=\"[% imageslocation %]/spacer.gif\"></td>\n        </tr>\n      </table>\n\n                </td>\n              </tr>\n            </table>\n          </td>\n        </tr>\n        <tr> \n          <td height=\"1\"><img height=\"1\" width=\"175\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td></td>\n        </tr>\n      </table>\n    </td>\n  </tr>\n</table>\n<center><gizmotag name=\"md_clipboard\"></gizmotag></center>\n\n[% IF site_in_trial_mode == \"true\" %]<div align=center><a href=\"http://www.metadot.com/metadot/index.pl?iid=2497\"><img src=\"/images/subscribe.gif\" border=0></a>&nbsp;</div>[% END %]\n<div align=right>\n\n<a href=\"[% docs_url %]\" target=\"_blank\"><img src=\"[% imageslocation %]/help.gif\" border=0></a>&nbsp;\n<a href=\"http://www.metadot.com\"><img src=\"[% imageslocation %]/md-managed.gif\" border=0></a></div></body>\n</html>\n' WHERE theme='theme1' AND pname='theme_maintemplate'",
 1661                     onfailure_info    => "Not there...you sure?",
 1662                     onfailure         => undef,
 1663             },
 1664             {
 1665                     info => "Updating support link on subtemplate",
 1666                     sqlcommand => "SELECT * from theme where theme='theme1' and pname='theme_subtemplate'",
 1667                     onsuccess_info => "Got it..good",
 1668                     onsuccess => "UPDATE theme SET pvalue='<html>\n<head>\n<title><gizmotag no_comments=\"1\" name=\"md_title\"></gizmotag></title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n<gizmotag name=\"md_theme1_style\"></gizmotag>\n</head>\n\n<body bgcolor=\"#FFFFFF\" text=\"#000000\" marginheight=0 marginwidth=0>\n<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n  <tr> \n    <td width=\"100%\"><gizmotag name=\"md_theme1_header\">top header table</gizmotag></td>\n  </tr>\n  <tr> \n    <td align=\"left\"> \n      <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n        <tr> \n<!--           <td width=\"150\" valign=\"top\"> -->\n   <gizmotag name=\"md_theme1_lefttable\">left col</gizmotag>\n<!--    </td> -->\n          <td valign=\"top\" width=\"100%\"> \n            <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n              <tr> \n                <td><gizmotag name=\"md_h_topnavl1\">categ listing</gizmotag></td>\n              </tr>\n              <tr> \n                <td>   \n         <table width=\"100%\"><tr>\n         <td align=left><gizmotag name=\"md_catpath\"></gizmotag></td>\n         <td align=right><gizmotag name=\"md_links_panel\"></gizmotag></td>\n         </tr></table>\n        </td>\n              </tr>\n              <tr> \n              <td align=right valign=top><gizmotag name=\"md_adminbar\"></gizmotag></td>\n              </tr>\n              <tr> \n                <td> \n      <table  border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"100%\">\n        <tr> \n          <td width=\"15\">&nbsp;</td>\n          <td width=\"450\">&nbsp;</td>\n          <td width=\"15\">&nbsp;</td>\n          <td width=\"1\" ><img src=\"[% imageslocation %]/spacer.gif\" width=1></td>\n          <td width=\"15\">&nbsp;</td>\n          <td width=\"150\">&nbsp;</td>\n        </tr>\n        <tr valign=\"top\"> \n          <td width=\"15\">&nbsp;</td>\n          <td width=\"450\"> \n<!--           middle panel -->\n            <h2><gizmotag name=\"md_title\"></gizmotag></h2>\n            <gizmotag name=\"md_catdesc\"></gizmotag>\n            <gizmotag name=\"md_gizmolist\">this is where the middle\n        panel stuff goes..</gizmotag>\n          </td>\n          <td width=\"15\">&nbsp;</td>\n          <td width=\"1\" bgcolor=\"#000000\"><img src=\"[% imageslocation %]/spacer.gif\" width=1></td>\n          <td width=\"15\">&nbsp;</td>\n          <td width=\"150\">\n<!--            right-hand col -->\n           <gizmotag name=\"md_calendar_month\"></gizmotag>\n           <gizmotag name=\"md_newscol\"></gizmotag>\n           <gizmotag name=\"md_poll\"></gizmotag>\n          </td>\n        </tr>\n        <tr> \n          <td height=\"1\"><img height=\"1\" width=\"15\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td><img height=\"1\" width=\"450\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td><img height=\"1\" width=\"15\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td><img height=\"1\" width=\"1\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td><img height=\"1\" width=\"15\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td><img height=\"1\" width=\"150\" src=\"[% imageslocation %]/spacer.gif\"></td>\n        </tr>\n      </table>\n\n                </td>\n              </tr>\n            </table>\n          </td>\n        </tr>\n        <tr> \n          <td height=\"1\"><img height=\"1\" width=\"175\" src=\"[% imageslocation %]/spacer.gif\"></td>\n          <td></td>\n        </tr>\n      </table>\n    </td>\n  </tr>\n</table>\n<center><gizmotag name=\"md_clipboard\"></gizmotag></center>\n\n[% IF site_in_trial_mode == \"true\" %]<div align=center><a href=\"http://www.metadot.com/metadot/index.pl?iid=2497\"><img src=\"/images/subscribe.gif\" border=0></a>&nbsp;</div>[% END %]\n<div align=right>\n\n<a href=\"[% docs_url %]\" target=\"_blank\"><img src=\"[% imageslocation %]/help.gif\" border=0></a>&nbsp;\n\n<a href=\"http://www.metadot.com\"><img src=\"[% imageslocation %]/md-managed.gif\" border=0></a></div></body>\n</html>\n' WHERE theme = 'theme1' and pname='subtemplate'",
 1669                     onfailure_info    => "Not there...you sure?",
 1670                     onfailure         => undef,
 1671             },
 1672             
 1673             #end to do MYSQL
 1674            ];
 1675 
 1676 #####################################################################################
 1677 #####################################################################################
 1678 #####################################################################################
 1679 #####################################################################################
 1680 #####################################################################################
 1681 #####################################################################################
 1682 #####################################################################################
 1683 #####################################################################################
 1684 #####################################################################################
 1685 #####################################################################################
 1686 #####################################################################################
 1687 #####################################################################################
 1688 #####################################################################################
 1689 #####################################################################################
 1690 #####################################################################################
 1691 #####################################################################################
 1692 #####################################################################################
 1693 #####################################################################################
 1694 #####################################################################################
 1695 #####################################################################################
 1696 #####################################################################################
 1697 #####################################################################################
 1698 
 1699 $todos{oracle} = [
 1700     {
 1701      info              => "Testing existence of system messages table",
 1702      sqlcommand        => "select count(*) from system_messages",
 1703      perlcommand       => "",
 1704      onsuccess_info    => "table system_messages already exists",
 1705      onsuccess         => "",
 1706      onfailure_info    => "existence check failed -> creating table system_messages",
 1707      onfailure         => [
 1708 "CREATE TABLE system_messages (
 1709     timestamp date DEFAULT sysdate NOT NULL,
 1710     sender varchar2(255) NOT NULL,
 1711     recipient varchar2(255),
 1712     content varchar2(255))",
 1713 "CREATE INDEX idx_system_messages ON system_messages (timestamp, sender, recipient)",
 1714         ]
 1715     },
 1716 
 1717     {
 1718     info               => "Correcting 'userid_name' field in event_log",
 1719     sqlcommand         => "SELECT COUNT(userid) FROM event_log",
 1720     onsuccess_info     => "No correction is needed..",
 1721     onfailure_info     => "Will correct the column.",
 1722     onfailure          => [
 1723 "ALTER TABLE event_log ADD (userid NUMBER(11))",
 1724 "UPDATE event_log SET userid=userid_name",
 1725 "COMMIT",
 1726 "ALTER TABLE event_log DROP(userid_name)",
 1727     ],
 1728     },
 1729 
 1730     {
 1731      info              => "Converting instance.name to accept null values",
 1732      sqlcommand        => "ALTER TABLE instance MODIFY name VARCHAR2(255) DEFAULT ''",
 1733      perlcommand       => "",
 1734      onsuccess_info    => "Conversion was successful",
 1735      onsuccess         => "",
 1736      onfailure_info    => "Conversion failed!",
 1737      onfailure         => ""
 1738     },
 1739     {
 1740      info              => "Fixing null i3 values for Tasks",
 1741      sqlcommand        => "UPDATE instance SET i3=0 WHERE i3 IS NULL and isa='Task'",
 1742      perlcommand       => "",
 1743      onsuccess_info    => "Update was successful",
 1744      onsuccess         => "",
 1745      onfailure_info    => "Update failed!",
 1746      onfailure         => ""
 1747     },
 1748     {
 1749      info              => "Checking if grp table includes is_organization",
 1750      sqlcommand        => "select is_organization from grp",
 1751      perlcommand       => "",
 1752      onsuccess_info    => "grp.is_organization exists",
 1753      onsuccess         => "",
 1754      onfailure_info    => "grp table check failed -> modifying table grp",
 1755      onfailure         => "ALTER TABLE grp ADD is_organization TINYINT(1) NOT NULL DEFAULT 0"
 1756     },
 1757     {
 1758      info              => "Checking if grp table includes organization_homepage",
 1759      sqlcommand        => "select organization_homepage from grp",
 1760      perlcommand       => "",
 1761      onsuccess_info    => "grp.organization_homepage exists",
 1762      onsuccess         => "",
 1763      onfailure_info    => "grp table check failed -> modifying table grp",
 1764      onfailure         => "ALTER TABLE grp ADD organization_homepage varchar(255) DEFAULT NULL"
 1765     },
 1766     {
 1767      info              => "Checking if grp table includes organization_post_registration",
 1768      sqlcommand        => "select organization_post_registration from grp",
 1769      perlcommand       => "",
 1770      onsuccess_info    => "grp.organization_post_registration exists",
 1771      onsuccess         => "",
 1772      onfailure_info    => "grp table check failed -> modifying table grp",
 1773      onfailure         => "ALTER TABLE grp ADD organization_post_registration varchar(255) DEFAULT NULL"
 1774     },
 1775     {
 1776      info              => "Changing column isa's type in permissions table",
 1777      sqlcommand        => "ALTER TABLE permissions MODIFY isa VARCHAR2(255) DEFAULT ''",
 1778      onsuccess_info    => "Type changed",
 1779      onsuccess         => "",
 1780      onfailure_info    => "column doesn't exist",
 1781      onfailure         => ""
 1782 
 1783     },
 1784 
 1785     {
 1786      info              => "Testing existence of event_log_report_builder table",
 1787      sqlcommand        => "select count(*) from event_log_report_builder",
 1788      perlcommand       => "",
 1789      onsuccess_info    => "table event_log_report_builder already exists",
 1790      onsuccess         => "",
 1791      onfailure_info    => "existence check failed -> creating table event_log_report_builder",
 1792      onfailure         => [
 1793 "CREATE TABLE event_log_report_builder (
 1794     unique_id       char(32) PRIMARY KEY,
 1795     date_and_time   date default NULL,
 1796     year_month_date number(6) default NULL,
 1797     userid          number(11) default NULL,
 1798     user_name       char(255) default NULL,
 1799     class_name      char(255) default NULL,
 1800     operation_name  char(255) default NULL,
 1801     total           number(11) default NULL,
 1802     instance_id     char(255) default NULL
 1803     )",
 1804 "CREATE INDEX idx_elog_report_builder ON event_log_report_builder(
 1805   year_month_date, userid, class_name, operation_name, instance_id)"],
 1806 
 1807 #KEY event_log_report_builder(year_month_date, userid, class_name(50), operation_name(20), instance_id(15))
 1808     },
 1809     {
 1810      info              => "Testing existence of event_log_monthly_user_stats table",
 1811      sqlcommand        => "select count(*) from event_log_monthly_user_stats",
 1812      perlcommand       => "",
 1813      onsuccess_info    => "table event_log_monthly_user_stats already exists",
 1814      onsuccess         => "",
 1815      onfailure_info    => "existence check failed -> creating table event_log_monthly_user_stats",
 1816      onfailure         => [
 1817 "CREATE TABLE event_log_monthly_user_stats (
 1818     unique_id       char(32) PRIMARY KEY,
 1819     year_month_date number(6) default NULL,
 1820     userid          number(11) default NULL,
 1821     user_name       char(255) default NULL,
 1822     class_name      char(255) default NULL,
 1823     operation_name  char(255) default NULL,
 1824     monthly_total   number(11) default NULL,
 1825     instance_id     char(255) default NULL,
 1826     instance_name   char(255) default NULL,
 1827     slot_1 char(255),
 1828     slot_2 char(255),
 1829     slot_3 char(255),
 1830     slot_4 char(255),
 1831     slot_5 char(255)
 1832     )",
 1833 "CREATE INDEX idx_elog_monthly_user_stats ON event_log_monthly_user_stats(
 1834   year_month_date, userid, class_name, operation_name, instance_id)",
 1835 "CREATE INDEX idx_elog_monthly_user_stats2 ON event_log_monthly_user_stats(
 1836   slot_1, slot_2, slot_3, slot_4, slot_5)"],
 1837 #KEY event_log_monthly_user(year_month_date, userid, class_name(50), operation_name(20), instance_id(15)),
 1838 #KEY event_log_monthly_user2(slot_1(30), slot_2(30), slot_3(30), slot_4(30), slot_5(30))
 1839     },
 1840     {
 1841      info              => "Testing existence of event_log_monthly_object_stats table",
 1842      sqlcommand        => "select count(*) from event_log_monthly_object_stats",
 1843      perlcommand       => "",
 1844      onsuccess_info    => "table event_log_monthly_object_stats already exists",
 1845      onsuccess         => "",
 1846      onfailure_info    => "existence check failed -> creating table event_log_monthly_object_stats",
 1847      onfailure         => [
 1848 "CREATE TABLE event_log_monthly_object_stats (
 1849     unique_id       char(32) PRIMARY KEY,
 1850     year_month_date number(6) default NULL,
 1851     class_name      char(255) default NULL,
 1852     operation_name  char(255) default NULL,
 1853     monthly_total   number(11) default NULL,
 1854     instance_id     char(255) default NULL,
 1855     instance_name   char(255) default NULL
 1856     )",
 1857 "CREATE INDEX idx_elog_monthly_object_stats ON event_log_monthly_object_stats(
 1858   year_month_date, class_name, operation_name, instance_id)"],
 1859 #KEY event_log_monthly_object(year_month_date, class_name(50), operation_name(20), instance_id(15))
 1860     },
 1861     {
 1862      info              => "Testing existence of event_log_monthly_group_stats table",
 1863      sqlcommand        => "select count(*) from event_log_monthly_group_stats",
 1864      perlcommand       => "",
 1865      onsuccess_info    => "table event_log_monthly_group_stats already exists",
 1866      onsuccess         => "",
 1867      onfailure_info    => "existence check failed -> creating table event_log_monthly_group_stats",
 1868      onfailure         => [
 1869 "CREATE TABLE event_log_monthly_group_stats (
 1870     unique_id       char(32) PRIMARY KEY,
 1871     year_month_date number(6) default NULL,
 1872     class_name      char(255) default NULL,
 1873     operation_name  char(255) default NULL,
 1874     monthly_total   number(11) default NULL,
 1875     grp_id          number(11) NOT NULL,
 1876     group_name      varchar2(30) default NULL,
 1877     instance_id     char(255) default NULL,
 1878     instance_name   char(255) default NULL
 1879     )",
 1880 "CREATE INDEX idx_elog_monthly_group_stats ON event_log_monthly_group_stats(
 1881   year_month_date, grp_id, class_name, operation_name, instance_id)"],
 1882     },
 1883 
 1884     {
 1885      info              => "Testing existence of event_log_monthly_grpmembers table",
 1886      sqlcommand        => "select count(*) from event_log_monthly_grpmembers",
 1887      perlcommand       => "",
 1888      onsuccess_info    => "table event_log_monthly_grpmembers already exists",
 1889      onsuccess         => "",
 1890      onfailure_info    => "existence check failed -> creating table event_log_monthly_grpmembers",
 1891      onfailure         => [
 1892      "CREATE TABLE event_log_monthly_grpmembers (
 1893         year_month_date number(6) DEFAULT 0 NOT NULL,
 1894         grp_id number(11) DEFAULT 0 NOT NULL,
 1895         userid number(11) DEFAULT 0 NOT NULL,
 1896         CONSTRAINT pk_event_log_monthy_grpmembers PRIMARY KEY(
 1897           year_month_date, grp_id, userid)
 1898         )",
 1899 
 1900      "CREATE INDEX idx_monthly_grpmember_grp_id ON event_log_monthly_grpmembers(
 1901         grp_id)",
 1902 
 1903      "CREATE INDEX idx_monthly_grpmember_userid ON event_log_monthly_grpmembers(
 1904         userid)",
 1905         ],
 1906     },
 1907 
 1908 
 1909     {
 1910      info              => "Adding column showend in instance",
 1911      sqlcommand        => "select count(showend) from instance",
 1912      perlcommand       => "",
 1913      onsuccess_info    => "showend field already exists",
 1914      onsuccess         => "",
 1915      onfailure_info    => "field showend does not exist - creating",
 1916      onfailure         => "ALTER TABLE instance ADD showend DATE DEFAULT NULL",
 1917     },
 1918     {
 1919      info              => "Setting default skin to Metadot6 if the value was previously 'default'",
 1920      sqlcommand        => "update params set value='Metadot6' where name='skin_selection' AND (TO_CHAR(value) = 'default')",
 1921      perlcommand       => "",
 1922      onsuccess_info    => "Update successful",
 1923      onsuccess         => "",
 1924      onfailure_info    => "Update failed. Possibly the default has not been selected.",
 1925      onfailure         => "",
 1926     },
 1927     {
 1928      info              => "Indexing instance.IsA",
 1929      sqlcommand        => "CREATE INDEX idx_instance_isa ON instance(isa)",
 1930      perlcommand       => "",
 1931      onsuccess_info    => "Update successful",
 1932      onsuccess         => "",
 1933      onfailure_info    => "Update failed. No action taken. If this index already exists, you may ignore this error.",
 1934      onfailure         => "",
 1935     },
 1936     {
 1937      info              => "Checking if event_log_report_builder table includes login timestamp field",
 1938      sqlcommand        => "select login_timestamp from event_log_report_builder",
 1939      perlcommand       => "",
 1940      onsuccess_info    => "login_timestamp field already exists",
 1941      onsuccess         => "",
 1942      onfailure_info    => "login_timestamp check failed -> modifying table event_log_report_builder",
 1943      onfailure         => "ALTER TABLE event_log_report_builder ADD (login_timestamp VARCHAR2(4000) DEFAULT 0)"
 1944     },
 1945     {
 1946      info              => "Adding recipient_uid field to message table",
 1947      sqlcommand        => "select recipient_uid from message",
 1948      perlcommand       => "",
 1949      onsuccess_info    => "Field exists already",
 1950      onsuccess         => "",
 1951      onfailure_info    => "Field does not exist - adding",
 1952      onfailure         => [
 1953 "ALTER TABLE message ADD (recipient_uid NUMBER(11) DEFAULT NULL, isa varchar(60) DEFAULT NULL)",
 1954 "CREATE INDEX message_recipient_uid on message (recipient_uid)",
 1955 "CREATE INDEX message_isa on message (isa)",
 1956 "CREATE INDEX message_status on message (status)",
 1957 ]
 1958     },
 1959         {
 1960          info              => "Updating null values for isa field in message table",
 1961          sqlcommand        => "update message set isa ='Message' where isa is null",
 1962          perlcommand       => "",
 1963          onsuccess_info    => "Updated!",
 1964          onsuccess         => "",
 1965          onfailure_info    => "",
 1966          onfailure         => "",
 1967         },
 1968 
 1969         {
 1970          info              => "Checking if event_log_report_builder table includes login timestamp field",
 1971          sqlcommand        => "select login_timestamp from event_log_report_builder",
 1972          perlcommand       => "",
 1973          onsuccess_info    => "login_timestamp field already exists",
 1974          onsuccess         => "",
 1975          onfailure_info    => "login_timestamp check failed -> modifying table event_log_report_builder",
 1976          onfailure         => "ALTER TABLE event_log_report_builder ADD (login_timestamp VARCHAR2(4000) DEFAULT 0)"
 1977         },
 1978 
 1979         ## check existance of password_changed_time field
 1980         {
 1981            info            => "Checking if password_changed_time field exists in the users table",
 1982            sqlcommand      => "select password_changed_time from users",
 1983            perlcommand     => "",
 1984            onsuccess_info  => "password_changed_time field already exists",
 1985            onsuccess       => "",
 1986            onfailure_info  => "password_changed_time check failed -> modifying users table",
 1987            onfailure       => "ALTER TABLE users ADD (password_changed_time NUMBER(11))"
 1988         },
 1989 
 1990         ## check existance of password_expiration_notification_sent_time field
 1991         {
 1992            info            => "Checking if password_expiration_notification_sent_time field exists in the users table",
 1993            sqlcommand      => "select pw_expire_notification_time from users",
 1994            perlcommand     => "",
 1995            onsuccess_info  => "pw_expire_notification_time field already exists",
 1996            onsuccess       => "",
 1997            onfailure_info  => "pw_expire_notification_time check failed -> modifying users table",
 1998            onfailure       => "ALTER TABLE users ADD (pw_expire_notification_time NUMBER(11))"
 1999            # NICO TODO: fix this
 2000         },
 2001 
 2002 
 2003         ## check existence of short_name field in instance
 2004         {
 2005                 info              => "Testing existence of short_name field in table instance",
 2006                 sqlcommand        => "select short_name from instance",
 2007                 onsuccess_info    => "the field already exists",
 2008                 onsuccess         => "",
 2009                 onfailure_info    => "test failed, adding the column",
 2010                 onfailure         => [
 2011                   "ALTER TABLE instance ADD ( short_name VARCHAR2(255) DEFAULT NULL)",
 2012           "CREATE INDEX idx_short_name ON instance (short_name)",
 2013                   ]
 2014         },
 2015 
 2016         ## check existence of grp_id field in subscription
 2017         {
 2018                 info              => "Testing existence of grp_id field in table subscription",
 2019                 sqlcommand        => "SELECT DISTINCT(grp_id) FROM SUBSCRIPTION",
 2020                 onsuccess_info    => "the field already exists",
 2021                 onsuccess         => "",
 2022                 onfailure_info    => "test failed, adding the column",
 2023                 onfailure         => ["ALTER TABLE subscription ADD (grp_id VARCHAR(255) DEFAULT NULL,
 2024                                                             optional NUMBER(1) DEFAULT NULL,
 2025                                                             opt_out NUMBER(1) DEFAULT NULL)",
 2026                              "ALTER TABLE subscription MODIFY (userid NUMBER(11) DEFAULT NULL)",
 2027                              "CREATE INDEX idx_subscription_opt_out ON subscription (opt_out)",],
 2028         },
 2029 
 2030         ## create dynaProperties table
 2031             {
 2032              info              => "Testing existence of dynaProperties table",
 2033              sqlcommand        => "select count(*) from dynaProperties",
 2034              perlcommand       => "",
 2035              onsuccess_info    => "table dynaProperties already exists",
 2036              onsuccess         => "",
 2037              onfailure_info    => "existence check failed -> creating table dynaProperties",
 2038              onfailure         => [
 2039 "CREATE TABLE dynaProperties (
 2040   propertyId    NUMBER(11) PRIMARY KEY,
 2041   className     VARCHAR2(255) NOT NULL,
 2042   instanceId    NUMBER(11) DEFAULT NULL,
 2043   categoryId    VARCHAR2(255) DEFAULT NULL,
 2044   name          VARCHAR2(255) DEFAULT NULL,
 2045   type          NUMBER(1) DEFAULT NULL,
 2046   sortOrder     NUMBER(5) DEFAULT NULL,
 2047   valueSTRING   VARCHAR(4000) DEFAULT NULL
 2048 )",
 2049 "CREATE INDEX idx_dp_class_instance ON dynaProperties(
 2050    className, instanceId)",
 2051 "CREATE INDEX idx_dp_name ON dynaProperties(
 2052    name)",
 2053 "CREATE INDEX idx_dp_type ON dynaProperties(
 2054    type)",
 2055   ],
 2056 
 2057             },
 2058 
 2059 
 2060             ## check existence of valueSTRING field in dynaProperties
 2061             {
 2062                     info              => "Testing existence of valueSTRING field in table dynaProperties",
 2063                     sqlcommand        => "select count(valueSTRING) from dynaProperties",
 2064                     onsuccess_info    => "the field already exists",
 2065                     onsuccess         => "",
 2066                     onfailure_info    => "test failed, adding the column",
 2067                     onfailure         => "ALTER TABLE dynaProperties ADD (valueString VARCHAR2(4000) DEFAULT NULL)",
 2068             },
 2069 
 2070 
 2071             ## check existence of sender_class field in system_messages
 2072             {
 2073                     info              => "Testing existence of sender_class field in table system_messages",
 2074                     sqlcommand        => "select distinct(sender_class) from system_messages",
 2075                     onsuccess_info    => "the field already exists",
 2076                     onsuccess         => "",
 2077                     onfailure_info    => "test failed, adding the column",
 2078                     onfailure         => "ALTER TABLE system_messages ADD COLUMN sender_class VARCHAR(255) DEFAULT NULL, ADD recipient_class VARCHAR(255) DEFAULT NULL, ADD INDEX idx_sender_class(sender_class), ADD INDEX idx_recipient_class(recipient_class)",
 2079                     onfailure         => [
 2080                         "ALTER TABLE system_messages ADD (
 2081                             sender_class VARCHAR(255) DEFAULT NULL,
 2082                             recipient_class VARCHAR(255) DEFAULT NULL)",
 2083                         "CREATE INDEX idx_sys_msg_sender_class_out ON system_messages (sender_class)",
 2084                         "CREATE INDEX idx_sys_msg_recip_class_out ON system_messages (recipient_class)",
 2085                         ],
 2086 
 2087 
 2088             },
 2089 
 2090 
 2091             ## index subscription.frequency
 2092             {
 2093                     info              => "Indexing subscription.frequency",
 2094                     sqlcommand        => "CREATE INDEX idx_subscription_freq ON subscription(frequency)",
 2095                     onsuccess_info    => "Index created.",
 2096                     onsuccess         => "",
 2097                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2098                     onfailure         => undef,
 2099             },
 2100 
 2101 
 2102             ## index subscription.cid
 2103             {
 2104                     info              => "Indexing subscription.cid",
 2105                     sqlcommand        => "CREATE INDEX idx_subscription_cid ON subscription(cid)",
 2106                     onsuccess_info    => "Index created.",
 2107                     onsuccess         => "",
 2108                     onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2109                     onfailure         => undef,
 2110             },
 2111 
 2112 
 2113             ## check existence of last_ciid field in subscription
 2114             {
 2115                     info              => "Testing existence of last_ciid field in table subscription",
 2116                     sqlcommand        => "select last_ciid from subscription",
 2117                     onsuccess_info    => "the field already exists",
 2118                     onsuccess         => "",
 2119                     onfailure_info    => "test failed, adding the column",
 2120                     onfailure         => "ALTER TABLE subscription ADD ( last_ciid NUMBER(11) DEFAULT NULL)",
 2121             },
 2122 
 2123             ## allow nulls in processdate
 2124             {
 2125                     info              => "Allowing null for subscription.processdate",
 2126                     sqlcommand        => "ALTER TABLE subscription MODIFY processdate DATE NULL",
 2127                     onsuccess_info    => "Change was successful.",
 2128                     onsuccess         => "",
 2129                     onfailure_info    => "Update failed.",
 2130             },
 2131 
 2132             ## fix incorrect user image uploads
 2133             {
 2134                 info              => "Fixing incorrect user image uploads",
 2135                 sqlcommand        => "UPDATE uploads SET type='user_upload' WHERE type='Metadot::User::User3000::PictureField'",
 2136                 onsuccess_info    => "Change was successful.",
 2137                 onsuccess         => "",
 2138                 onfailure_info    => "Update failed.",
 2139             },
 2140 
 2141             ## check for welcome_letter_heading in grp table
 2142             {
 2143              info              => "Adding column welcome_letter_heading in grp",
 2144              sqlcommand        => "SELECT COUNT(welcome_letter_heading) FROM grp",
 2145              perlcommand       => "",
 2146              onsuccess_info    => "welcome_letter_heading field already exists",
 2147              onsuccess         => "",
 2148              onfailure_info    => "field welcome_letter_heading does not exist - creating",
 2149              onfailure         => "ALTER TABLE grp ADD (welcome_letter_heading VARCHAR2(400) DEFAULT NULL)",
 2150             },
 2151 
 2152             ## check for welcome_letter_body in grp table
 2153             {
 2154              info              => "Adding column welcome_letter_body in grp",
 2155              sqlcommand        => "SELECT COUNT(welcome_letter_body) FROM grp",
 2156              perlcommand       => "",
 2157              onsuccess_info    => "welcome_letter_body field already exists",
 2158              onsuccess         => "",
 2159              onfailure_info    => "field welcome_letter_body does not exist - creating",
 2160              onfailure         => "ALTER TABLE grp ADD (welcome_letter_body VARCHAR2(4000) DEFAULT NULL)",
 2161             },
 2162 
 2163             ## Adding indexes to event_log tables
 2164             {
 2165              info              => "Indexing event_log.userid",
 2166              sqlcommand        => "CREATE INDEX userid_index ON event_log(userid)",
 2167              onsuccess_info    => "Index created.",
 2168              onsuccess         => "",
 2169              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2170              onfailure         => undef,
 2171             },
 2172 
 2173             {
 2174              info              => "Indexing event_log.user_name",
 2175              sqlcommand        => "CREATE INDEX username_index ON event_log(user_name)",
 2176              onsuccess_info    => "Index created.",
 2177              onsuccess         => "",
 2178              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2179              onfailure         => undef,
 2180             },
 2181 
 2182             {
 2183              info              => "Indexing event_log.sub_application_name",
 2184              sqlcommand        => "CREATE INDEX application_name_index ON event_log(sub_application_name)",
 2185              onsuccess_info    => "Index created.",
 2186              onsuccess         => "",
 2187              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2188              onfailure         => undef,
 2189             },
 2190 
 2191             {
 2192              info              => "Indexing event_log.class_name",
 2193              sqlcommand        => "CREATE INDEX class_inces ON event_log(class_name)",
 2194              onsuccess_info    => "Index created.",
 2195              onsuccess         => "",
 2196              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2197              onfailure         => undef,
 2198             },
 2199 
 2200             {
 2201              info              => "Indexing event_log.instance_id",
 2202              sqlcommand        => "CREATE INDEX instance_index ON event_log(instance_id)",
 2203              onsuccess_info    => "Index created.",
 2204              onsuccess         => "",
 2205              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2206              onfailure         => undef,
 2207             },
 2208 
 2209             {
 2210              info              => "Indexing event_log.operation_name",
 2211              sqlcommand        => "CREATE INDEX op_name_index ON event_log(operation_name)",
 2212              onsuccess_info    => "Index created.",
 2213              onsuccess         => "",
 2214              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2215              onfailure         => undef,
 2216             },
 2217 
 2218             {
 2219              info              => "Indexing event_log.date_and_time",
 2220              sqlcommand        => "CREATE INDEX date_and_time_index ON event_log(date_and_time)",
 2221              onsuccess_info    => "Index created.",
 2222              onsuccess         => "",
 2223              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2224              onfailure         => undef,
 2225             },
 2226 
 2227             {
 2228              info              => "Indexing event_log.unix_time",
 2229              sqlcommand        => "CREATE INDEX unix_time_index ON event_log(unix_time)",
 2230              onsuccess_info    => "Index created.",
 2231              onsuccess         => "",
 2232              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2233              onfailure         => undef,
 2234             },
 2235 
 2236             {
 2237              info              => "Indexing event_log_monthly_group_stats.class_name",
 2238              sqlcommand        => "CREATE INDEX class_name_index ON event_log_monthly_group_stats(class_name)",
 2239              onsuccess_info    => "Index created.",
 2240              onsuccess         => "",
 2241              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2242              onfailure         => undef,
 2243             },
 2244 
 2245             {
 2246              info              => "Indexing event_log_monthly_group_stats.operation_name",
 2247              sqlcommand        => "CREATE INDEX op_name_index ON event_log_monthly_group_stats(operation_name)",
 2248              onsuccess_info    => "Index created.",
 2249              onsuccess         => "",
 2250              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2251              onfailure         => undef,
 2252             },
 2253 
 2254             {
 2255              info              => "Indexing event_log_monthly_group_stats.grp_id",
 2256              sqlcommand        => "CREATE INDEX grp_id_index ON event_log_monthly_group_stats(grp_id)",
 2257              onsuccess_info    => "Index created.",
 2258              onsuccess         => "",
 2259              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2260              onfailure         => undef,
 2261             },
 2262 
 2263             {
 2264              info              => "Indexing event_log_monthly_group_stats.group_name",
 2265              sqlcommand        => "CREATE INDEX group_name_index ON event_log_monthly_group_stats(group_name)",
 2266              onsuccess_info    => "Index created.",
 2267              onsuccess         => "",
 2268              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2269              onfailure         => undef,
 2270             },
 2271 
 2272             {
 2273              info              => "Indexing event_log_monthly_group_stats.instance_id",
 2274              sqlcommand        => "CREATE INDEX instance_id_index ON event_log_monthly_group_stats(instance_id)",
 2275              onsuccess_info    => "Index created.",
 2276              onsuccess         => "",
 2277              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2278              onfailure         => undef,
 2279             },
 2280 
 2281             {
 2282              info              => "Indexing event_log_monthly_group_stats.instance_name",
 2283              sqlcommand        => "CREATE INDEX instance_name_index ON event_log_monthly_group_stats(instance_name)",
 2284              onsuccess_info    => "Index created.",
 2285              onsuccess         => "",
 2286              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2287              onfailure         => undef,
 2288             },
 2289 
 2290             {
 2291              info              => "Indexing event_log_monthly_object_stats.class_name",
 2292              sqlcommand        => "CREATE INDEX class_name_index ON event_log_monthly_object_stats(class_name)",
 2293              onsuccess_info    => "Index created.",
 2294              onsuccess         => "",
 2295              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2296              onfailure         => undef,
 2297             },
 2298 
 2299             {
 2300              info              => "Indexing event_log_monthly_object_stats.operation_name",
 2301              sqlcommand        => "CREATE INDEX operation_name_index ON event_log_monthly_object_stats(operation_name)",
 2302              onsuccess_info    => "Index created.",
 2303              onsuccess         => "",
 2304              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2305              onfailure         => undef,
 2306             },
 2307 
 2308             {
 2309              info              => "Indexing event_log_monthly_object_stats.instance_id",
 2310              sqlcommand        => "CREATE INDEX instance_id_index ON event_log_monthly_object_stats(instance_id)",
 2311              onsuccess_info    => "Index created.",
 2312              onsuccess         => "",
 2313              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2314              onfailure         => undef,
 2315             },
 2316 
 2317             {
 2318              info              => "Indexing event_log_monthly_object_stats.instance_name",
 2319              sqlcommand        => "CREATE INDEX instance_name_index ON event_log_monthly_object_stats(instance_name)",
 2320              onsuccess_info    => "Index created.",
 2321              onsuccess         => "",
 2322              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2323              onfailure         => undef,
 2324             },
 2325 
 2326             {
 2327              info              => "Indexing event_log_monthly_user_stats.userid",
 2328              sqlcommand        => "CREATE INDEX userid_index ON event_log_monthly_user_stats(userid)",
 2329              onsuccess_info    => "Index created.",
 2330              onsuccess         => "",
 2331              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2332              onfailure         => undef,
 2333             },
 2334 
 2335             {
 2336              info              => "Indexing event_log_monthly_user_stats.user_name",
 2337              sqlcommand        => "CREATE INDEX user_name_index ON event_log_monthly_user_stats(user_name)",
 2338              onsuccess_info    => "Index created.",
 2339              onsuccess         => "",
 2340              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2341              onfailure         => undef,
 2342             },
 2343 
 2344             {
 2345              info              => "Indexing event_log_monthly_user_stats.class_name",
 2346              sqlcommand        => "CREATE INDEX class_name_index ON event_log_monthly_user_stats(class_name)",
 2347              onsuccess_info    => "Index created.",
 2348              onsuccess         => "",
 2349              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2350              onfailure         => undef,
 2351             },
 2352 
 2353             {
 2354              info              => "Indexing event_log_monthly_user_stats.operation_name",
 2355              sqlcommand        => "CREATE INDEX operation_name_index ON event_log_monthly_user_stats(operation_name)",
 2356              onsuccess_info    => "Index created.",
 2357              onsuccess         => "",
 2358              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2359              onfailure         => undef,
 2360             },
 2361 
 2362             {
 2363              info              => "Indexing event_log_monthly_user_stats.instance_id",
 2364              sqlcommand        => "CREATE INDEX instance_id ON event_log_monthly_user_stats(instance_id)",
 2365              onsuccess_info    => "Index created.",
 2366              onsuccess         => "",
 2367              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2368              onfailure         => undef,
 2369             },
 2370 
 2371             {
 2372              info              => "Indexing event_log_monthly_user_stats.instance_name",
 2373              sqlcommand        => "CREATE INDEX instance_name_index ON event_log_monthly_user_stats(instance_name)",
 2374              onsuccess_info    => "Index created.",
 2375              onsuccess         => "",
 2376              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2377              onfailure         => undef,
 2378             },
 2379 
 2380             {
 2381              info              => "Indexing event_log_report_builder.date_and_time",
 2382              sqlcommand        => "CREATE INDEX date_and_time_index ON event_log_report_builder(date_and_time)",
 2383              onsuccess_info    => "Index created.",
 2384              onsuccess         => "",
 2385              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2386              onfailure         => undef,
 2387             },
 2388 
 2389             {
 2390              info              => "Indexing event_log_report_builder.userid",
 2391              sqlcommand        => "CREATE INDEX userid_index ON event_log_report_builder(userid)",
 2392              onsuccess_info    => "Index created.",
 2393              onsuccess         => "",
 2394              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2395              onfailure         => undef,
 2396             },
 2397 
 2398             {
 2399              info              => "Indexing event_log_report_builder.user_name",
 2400              sqlcommand        => "CREATE INDEX user_name_index ON event_log_report_builder(user_name)",
 2401              onsuccess_info    => "Index created.",
 2402              onsuccess         => "",
 2403              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2404              onfailure         => undef,
 2405             },
 2406 
 2407             {
 2408              info              => "Indexing event_log_report_builder.class_name",
 2409              sqlcommand        => "CREATE INDEX class_name_index ON event_log_report_builder(class_name)",
 2410              onsuccess_info    => "Index created.",
 2411              onsuccess         => "",
 2412              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2413              onfailure         => undef,
 2414             },
 2415 
 2416             {
 2417              info              => "Indexing event_log_report_builder.operation_name",
 2418              sqlcommand        => "CREATE INDEX operation_name_index ON event_log_report_builder(operation_name)",
 2419              onsuccess_info    => "Index created.",
 2420              onsuccess         => "",
 2421              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2422              onfailure         => undef,
 2423             },
 2424 
 2425             {
 2426              info              => "Indexing event_log_report_builder.instance_id",
 2427              sqlcommand        => "CREATE INDEX instance_id_index ON event_log_report_builder(instance_id)",
 2428              onsuccess_info    => "Index created.",
 2429              onsuccess         => "",
 2430              onfailure_info    => "Create failed. If this index already exists, you may ignore this error.",
 2431              onfailure         => undef,
 2432             },
 2433 
 2434             {
 2435                     info              => "Renaming default_mail_encoding to default_mail_content_type",
 2436                     sqlcommand        => "SELECT count(*) FROM params WHERE name='default_mail_encoding'",
 2437                     result_condition  =>  "<<result>> > 0",
 2438                     onsuccess_info    => "We need to rename the param",
 2439                     onsuccess         => "UPDATE params SET name='default_mail_content_type' WHERE name='default_mail_encoding'",
 2440                     onfailure_info    => "No need to rename the param, it does not exist",
 2441                     onfailure         => undef,
 2442             },
 2443 
 2444 
 2445         ]; # end todo ORACLE
 2446 
 2447     #####################################################################################
 2448     #####################################################################################
 2449     #####################################################################################
 2450     #####################################################################################
 2451     #####################################################################################
 2452     #####################################################################################
 2453     #####################################################################################
 2454     #####################################################################################
 2455     #####################################################################################
 2456     #####################################################################################
 2457     #####################################################################################
 2458     #####################################################################################
 2459     #####################################################################################
 2460     #####################################################################################
 2461     #####################################################################################
 2462     #####################################################################################
 2463     #####################################################################################
 2464     #####################################################################################
 2465 
 2466 
 2467 
 2468 
 2469 ###############################################################
 2470 sub doCommand{
 2471   my ($i)=shift;
 2472   my $cmd ="";
 2473 
 2474   my $db_type = lc(DBAccess->get_db_type());
 2475 
 2476   if ( $todos{$db_type}->[$i]{sqlcommand} ne ""){ #we have an sql cmd do run
 2477     $cmd = "DBAccess->sqlSimple(\"" . $todos{$db_type}->[$i]{sqlcommand} . "\")";
 2478   }else{
 2479     # we have a perl cmd to run
 2480     $cmd = "$todos{$db_type}->[$i]{sqlcommand}";
 2481   }
 2482 
 2483   debug_msg (2, "==>doCommand $i:");
 2484   debug_msg (2, "============================================");
 2485   debug_msg (2, "==>doCommand: $todos{$db_type}->[$i]{info}");
 2486   debug_msg (2, "==>doCommand: $todos{$db_type}->[$i]{sqlcommand}");
 2487 
 2488   ### TRY
 2489   my $retcode=undef; my $result=undef;
 2490   #  my ($retcode, $result)=&run($cmd);
 2491   eval {
 2492       ($retcode, $result) = DBAccess->xsqlSimple($todos{$db_type}->[$i]{sqlcommand});
 2493   };
 2494   ### CATCH
 2495   if($@){
 2496     debug_msg (2, "Error in eval ==> $@ ### going to use onfailure. retcode='".($retcode||'')."', result='".($result||'')."'\n");
 2497   }
 2498 
 2499   if (!defined $retcode || $retcode != 0){
 2500     # TEST FAILURE
 2501     debug_msg (2, "   couldn't complete command: $cmd");
 2502 
 2503         my $handler = $todos{$db_type}->[$i]{onfailure};
 2504         my @statements;
 2505         if (ref($handler) eq 'ARRAY') {
 2506                 @statements = @{$handler};
 2507         } else {
 2508                 @statements = ($handler);
 2509         }
 2510         foreach my $statement (@statements) {
 2511                 debug_msg (2, "Handling error by: " . ($todos{$db_type}->[$i]{onfailure_info} || $statement) . "\n");
 2512                 ($retcode, $result) = DBAccess->xsqlSimple($statement);
 2513                 if($retcode !=0){
 2514                 die "FATAL ERROR: there is a problem: retcode=$retcode, error=$result";
 2515                 }
 2516         }
 2517    # TEST SUCCESS
 2518   } else {
 2519 
 2520     if ($todos{$db_type}->[$i]{result_condition}) { # if a result condition is specified
 2521         my $rc = $todos{$db_type}->[$i]{result_condition};
 2522         # replace '<<result>>' in condition template with actual result
 2523         $rc =~ s/<<result>>/$result/gi;
 2524         debug_msg(3, "evaluating result condition: ($rc)");
 2525         # if test passes
 2526         if (eval($rc)) {
 2527             debug_msg (2, "   ...test success: $todos{$db_type}->[$i]{onsuccess_info} \n");
 2528             # check if an onsuccess handler is defined
 2529             if($todos{$db_type}->[$i]{onsuccess}) {
 2530                         my $handler = $todos{$db_type}->[$i]{onsuccess};
 2531                         my @statements;
 2532                         if (ref($handler) eq 'ARRAY') {
 2533                                 @statements = @{$handler};
 2534                         } else {
 2535                                 @statements = ($handler);
 2536                         }
 2537                         foreach my $statement (@statements) {
 2538                                 my ($retcode, $result) = DBAccess->xsqlSimple($statement);
 2539                                 if($retcode !=0){
 2540                                         die "FATAL ERROR: there is a problem: retcode=$retcode, error=$result";
 2541                                 }
 2542                         }
 2543             }
 2544         }
 2545         else {                  # result test condition did not pass; test failed
 2546             debug_msg(2, "result condition ($rc) failed");
 2547                 debug_msg (2, "Handling error by: " . $todos{$db_type}->[$i]{onfailure_info} . "\n");
 2548 
 2549                 my $handler = $todos{$db_type}->[$i]{onfailure};
 2550                 my @statements;
 2551                 if (ref($handler) eq 'ARRAY') {
 2552                         @statements = @{$handler};
 2553                 } else {
 2554                         @statements = ($handler);
 2555                 }
 2556                 foreach my $statement (@statements) {
 2557                         my ($retcode, $result) = DBAccess->xsqlSimple($statement);
 2558                         if($retcode !=0){
 2559                         die "FATAL ERROR: there is a problem: retcode=$retcode, error=$result";
 2560                         }
 2561                 }
 2562         }
 2563     }
 2564     else {                      #  no result condition specified-- so success
 2565                 debug_msg (2, "   ...test success: $todos{$db_type}->[$i]{onsuccess_info} \n");
 2566                 # check if an onsuccess handler is defined
 2567             if($todos{$db_type}->[$i]{onsuccess}) {
 2568                         my $handler = $todos{$db_type}->[$i]{onsuccess};
 2569                         my @statements;
 2570                         if (ref($handler) eq 'ARRAY') {
 2571                                 @statements = @{$handler};
 2572                         } else {
 2573                                 @statements = ($handler);
 2574                         }
 2575                         foreach my $statement (@statements) {
 2576                                 my ($retcode, $result) = DBAccess->xsqlSimple($statement);
 2577                                 if($retcode !=0){
 2578                                         die "FATAL ERROR: there is a problem: retcode=$retcode, error=$result";
 2579                                 }
 2580                         }
 2581             }
 2582     }
 2583 
 2584   }                             # end TEST SUCCESS
 2585 }
 2586 
 2587 ###################################################
 2588 sub usage {
 2589   my ($mess) = @_;
 2590 
 2591   print "$0: $mess\n\n";
 2592   print <<"_EOF_";
 2593 
 2594  usage: $0 [-options ...]
 2595 
 2596  where options include:
 2597  -add_mod <module>      add module(s) to vserv_modules (space separated list)
 2598  -all                   run script on ALL virtual servers
 2599  -debug <debuglevel>    <1 to 5> (1=small amount, 5=ou la la!)
 2600  -h                     help
 2601  -p <password>          update admin password with <password>
 2602  -remove_mod <module>   remove module(s) from vserv_modules (space separated list)
 2603  -s <servername>        use database information for server, <servername>
 2604  -v                     verbose (same as -debug 3)
 2605 
 2606 
 2607 _EOF_
 2608 
 2609 
 2610   exit -1;
 2611 }
 2612 
 2613 ###################################################
 2614 sub getOption {
 2615   &usage("missing argument for $_[0]") if ($#ARGV==-1) ;
 2616   my $result = $ARGV[0];
 2617   shift @ARGV;
 2618   return $result;
 2619 }
 2620 
 2621 #################################################
 2622 ### UPDATE FUNCTIONS
 2623 #################################################
 2624 
 2625 
 2626 ######################################################
 2627 
 2628 
 2629 
 2630 ##################
 2631 #### CLEVAND #####
 2632 sub update_children_order {
 2633 
 2634         print "Checking if all children in a given category can be reordered regardless their ISA property\n";
 2635         if ((DBAccess->sqlSelect('value','params', 'name=\'global_order\''))[0]) {
 2636                 #SUCCESS
 2637                 print "All children in a given category can already be reordered regardless their ISA property\n";
 2638         }
 2639         else {
 2640                 #FAILURE -> MODIFYING TABLES;
 2641                 print "Children in a given category can not be reordered globally yet -> modifying instanceorder field in instance table\n";
 2642 
 2643                 my $sth = DBAccess->sqlSelectMany('IID, userid, Name','instance', 'isa=\'category\' and iid >= 0');
 2644                 unless ($sth) {
 2645                         print "No category found in DB. Aborting.\n";
 2646                         return undef;
 2647                 }
 2648 
 2649                 # CREATES ARRAY OF ALL CATEGORIES IDS
 2650                 my ($catID, $catUID, $catName); my (%catUID_hash, %catName_hash, @catID_array);
 2651                 while (($catID, $catUID, $catName) = $sth->fetchrow()) {
 2652                         $catUID_hash{$catID} = $catUID;
 2653                         $catName_hash{$catID} = $catName;
 2654                         push @catID_array, $catID;
 2655                 }
 2656 
 2657                 # EXAMINING EACH CATEGORY AND BUILDINFG %children_order_by_category HASHTABLE
 2658                 my $counter; #used to arrange childs in a global order in a given category
 2659                 my %children_order_by_category; #a hash of hash #first keys are categories id. #second keys are children id #values are children global instance order in the given category.
 2660 
 2661                 foreach $catID (@catID_array) {
 2662                         $counter = 0;
 2663                         print "Updating instanceorder for children in category $catID\n";
 2664                         $sth = DBAccess->sqlSelectMany('iid,isa','instance', "isa<>\'category\' AND parentiid = $catID ORDER BY instanceorder");
 2665 
 2666                         #GET SOME LISTS OF ALL CHILDREN OF THIS CATEGORY, ARRANGING THE CHILDREN BY ISA IN ASCENDING ORDER IN A HASH
 2667                         my %childHash; #$childHash is a hash of arrays. Each keys is an ISA parameter.
 2668                         while (my ($childID, $childISA) = $sth->fetchrow()) {
 2669                                 push @{$childHash{$childISA}}, $childID;
 2670                         }
 2671                         $sth->finish();
 2672 
 2673 
 2674                         foreach my $gizmoType (Gizmo->get_gizmo_list()) { # reads the list of gizmo types in good order.
 2675 
 2676                                 if ((%childHash) && (exists ($childHash{$gizmoType})) && (&itemBelongsToList($gizmoType,Category->get_non_excluded_gizmo_list()))) {
 2677 
 2678                                 #Inserts a separator if: the category contains at least one child AND the the class of this child is not excluded from the navigation page
 2679 
 2680                                         my $child = Separator->new();
 2681 
 2682                                         $catName = $catName_hash{$catID};
 2683                                         $child->{parent_id} = $catID;
 2684                                         $child->{uid} = $catUID_hash{$catID};
 2685                                         $child->{c2} = 'on';
 2686                                         $child->{cool} = '';
 2687                                         if ($gizmoType->can('gizmo_list_header') && $gizmoType->gizmo_list_header()) {
 2688                                                 $child->{t1} = $gizmoType->gizmo_list_header();
 2689                                         } else {
 2690                                                 $child->{t1} = $gizmoType->legacy_list_header();
 2691                                         }
 2692                                         $child->{t1} =~ s/\<\/?h3\>//gi;
 2693                                         $child->add();
 2694 
 2695                                         $children_order_by_category{$catID}{$child->get_id()} = $counter++;
 2696                                 }
 2697                                 foreach my $childID (@{$childHash{$gizmoType}}){ # reads the list of children in childHash in ascending order.
 2698                                         $children_order_by_category{$catID}{$childID} = $counter++;
 2699                                 }
 2700                         }
 2701                 }
 2702 
 2703 
 2704 =display iid in ascending order given the iid of the category
 2705                 my %cobc = %{$children_order_by_category{0}};
 2706                 foreach my $key (sort {$cobc{$a} <=> $cobc{$b}} keys %cobc) {
 2707                         print "iid: $key\n";
 2708                 }
 2709 =cut
 2710                 #EXPORTING EVERY MODIFICATION TO DataBase
 2711                 my @array_of_hashes = values %children_order_by_category;
 2712                 my $dbh = DBAccess->get_db_object()->get_dbh();
 2713                 my $sql = 'UPDATE instance SET instanceorder = ? WHERE iid=?';
 2714                 my $sth_input = $dbh->prepare($sql);
 2715                 foreach my $hash_ref (@array_of_hashes) {
 2716                         while(my ($iid, $order) = each %{$hash_ref}) {
 2717                                 $sth_input->execute(($order, $iid)) or die $dbh->errstr;
 2718                         }
 2719                 }
 2720                 $sth_input->finish();
 2721 
 2722 
 2723 
 2724                 #CALLING REORDER_CHILDREN METHOD FOR EACH CONTAINER (CATEGORY)
 2725                 foreach my $catID (keys %children_order_by_category) {
 2726                         #Gizmo->validate_or_refresh_cache();
 2727                         Category->new($catID)->reorder_children();
 2728                 }
 2729 
 2730 
 2731 
 2732                 # UPDATING params table (for upgrade detection)
 2733                 DBAccess->sqlInsertUpdate('params',     'name=\'global_order\'',        (       name    =>      'global_order',
 2734                                                                                                                                                         value   =>      '1',
 2735                                                                                                                                                 ));
 2736 
 2737         } # end else
 2738 } #end sub
 2739 
 2740 ##########
 2741 ##CLEVAND
 2742 sub itemBelongsToList {
 2743 
 2744 #Usage: itemBelongsToList($item, @array)";
 2745 
 2746 my $item = shift;
 2747 my @list = @_;
 2748 
 2749 foreach (@list) {
 2750         if ($item eq $_) {return 1;}
 2751 }
 2752 return 0;
 2753 
 2754 }
 2755 
 2756 
 2757 
 2758 
 2759 
 2760 
 2761 
 2762 sub debug_msg {
 2763     my ($level, $msg) = @_;
 2764 
 2765     return if (!defined $level);
 2766     return if (!defined $msg);
 2767     my $eol="\n";
 2768 
 2769     if ($level <= $GA{'DEBUG_LEVEL'}){
 2770         print " debug: $msg$eol" ;
 2771     }
 2772 }
 2773 
 2774 
 2775 sub populate_params_table {
 2776     # note, the new table is called "params"
 2777     my ($count) = DBAccess->sqlSelect ("count(*)", "params");
 2778 
 2779     if ($count == 0) {
 2780 
 2781 
 2782         #---- insert standard params values
 2783 
 2784         my ($sth) = DBAccess->sqlSelectMany("*", "param", "name is NULL");
 2785 
 2786         my $row = $sth->fetchrow_hashref;
 2787 
 2788         foreach my $key (sort keys %$row) {
 2789             unless (($key eq 'name') ||
 2790                     ($key eq 'value') ||
 2791                     ($key eq 'sysvars')) {
 2792                 eval {
 2793                     DBAccess->sqlInsert("params", ('name' => "$key", 'value' => "$row->{$key}"));
 2794                 };
 2795                 if($@) {
 2796                     print STDERR "Couldn't insert $key\n";
 2797                 }
 2798             }
 2799         }
 2800 
 2801         #---- insert existing name value pairs
 2802 
 2803         $sth = DBAccess->sqlSelectMany("name, value", "param", "name is not null");
 2804 
 2805         while ($row = $sth->fetchrow_hashref) {
 2806             eval {
 2807                     DBAccess->sqlInsert("params", ('name' => "$row->{'name'}", 'value' => "$row->{'value'}"));
 2808             };
 2809             if($@) {
 2810                 print STDERR "Couldn't insert $row->{name}\n";
 2811             }
 2812         }
 2813 
 2814         #---- insert sysvars variables
 2815 
 2816         my ($sysvars) = DBAccess->sqlSelect("sysvars", "param", "name is null");
 2817 
 2818         my $thawed_sysvars = thaw($sysvars);
 2819 
 2820         foreach my $key (sort keys %$thawed_sysvars) {
 2821             eval {
 2822                 # turn to lower case, because the sysvars were upper case
 2823                 my $insert_key = lc $key;
 2824         DBAccess->sqlInsert("params", ('name' => "$insert_key", 'value' => "$thawed_sysvars->{$key}"));
 2825             };
 2826             if($@) {
 2827                 print STDERR "Couldn't insert $key\n";
 2828             }
 2829         }
 2830 
 2831         #---- drop param table
 2832 
 2833     #now make sure that all keys in the registry have a value in the params table
 2834 
 2835 
 2836 
 2837         DBAccess->sqlSimple("drop table param");
 2838 
 2839 
 2840     }
 2841 
 2842     foreach my $key (keys %{$registry}) {
 2843         my ($name) = DBAccess->sqlSelect("name", "params", "name = '$key'");
 2844         if (defined $name) {
 2845             print STDERR "$key is already in the database\n";
 2846         } else {
 2847             print STDERR "inserting $key into the database\n";
 2848             my $reg_value = $registry->{$key};
 2849             DBAccess->sqlInsert("params", ('name' => "$key", 'value' => "$reg_value"));
 2850         }
 2851     }
 2852 
 2853 }
 2854 
 2855 sub populate_ldapdn_field_in_user_table {
 2856     debug_msg (2, "==>Populate ldapdn field in the user table");
 2857     # note, if upgrading from ver < 4.0 should be run AFTER the populate_params_table function
 2858 
 2859     # don't bother with this if we are not using LDAP authentication
 2860     my $authenticator = Metadot::PortalFactory->get_authenticator();
 2861     return unless($authenticator->isa('Metadot::Authenticator::LDAPAuthenticator'));
 2862 
 2863 
 2864 
 2865     my ($ldap_server) = DBAccess->sqlSelect("value", "params", "name = 'ldap_server'");
 2866     my ($ldap_base_dn) = DBAccess->sqlSelect("value", "params", "name = 'ldap_base_dn'");
 2867     my ($ldap_uid) = DBAccess->sqlSelect("value", "params", "name = 'ldap_uid'");
 2868 
 2869     my $params;
 2870 
 2871     $params->{ldap_server} = $ldap_server;
 2872     $params->{ldap_base_dn} = $ldap_base_dn;
 2873     $params->{ldap_uid} = $ldap_uid;
 2874 
 2875     #---- create LDAPSubsystem object
 2876     debug_msg (2, "==>Initializing LDAPSubsystem with the parameters {ldap_server}, {ldap_base_dn}, {ldap_uid}");
 2877     my $ldap;
 2878     eval {
 2879         use Metadot::LDAPSubsystemFactory;
 2880         $ldap = Metadot::LDAPSubsystemFactory->get_ldap_subsystem();
 2881     };
 2882 
 2883     #---- if parameters are not set, return
 2884     unless ($ldap && $ldap->initialize($params)) {
 2885         debug_msg (2, "==>LDAP parameters are not set, skipping LDAP section\n");
 2886         print STDERR "populate_ldapdn_field_in_user_table : LDAP parameters are not set, skipping LDAP section\n" ;
 2887         return ;
 2888     }
 2889 
 2890     #---- get the current ldapdn values
 2891     my $sth = DBAccess->sqlSelectMany("userid, ldapdn", "users") ;
 2892 
 2893         while (my ($key, $value) = $sth->fetchrow()) {
 2894         debug_msg (2, "====>User: $key, ldapdn : $value") ;
 2895         # getting the cn field from dn to search for the ldap record
 2896         if ($value =~ /cn=(.*?),/i) {
 2897             my $t = $1 ;
 2898             # replace more the one space with the one space to split values
 2899             $t =~ s/\s+/ /g;
 2900             my @search = () ;
 2901             @search = split(" ", $t) ;
 2902             next unless (@search > 0) ;
 2903             my $ldap_alias = undef ;
 2904             my @entries = $ldap->_search_ldap(@search) ;
 2905             if ($entries[0]) {
 2906                 foreach my $entry (@entries) {
 2907                     my $ldap_in_dn = $entry->dn() ;
 2908                     $ldap_in_dn =~ s/\s//g ;
 2909                     $value =~ s/\s//g ;
 2910                     if (lc($ldap_in_dn) eq lc($value)) {
 2911                         debug_msg (2, "====>   ...found in LDAP") ;
 2912                         $ldap_alias = $entry->get_value($params->{ldap_uid}) ;
 2913                         next ;
 2914                     }
 2915                 }
 2916             }
 2917             next unless (defined($ldap_alias) && $ldap_alias !~ /^\s+$/) ;
 2918             #---- update the ldyapdn field for the user with the new value
 2919             DBAccess->sqlUpdate("users", "userid=$key", (ldapdn => $ldap_alias)) ;
 2920             debug_msg (2, "====>   ...ldapdn field in db is updated with the ".$params->{ldap_uid}." from LDAP") ;
 2921         }
 2922         }
 2923     debug_msg (2, "==>Done: Populate ldapdn field in the user table\n") ;
 2924 }
 2925 
 2926 
 2927 sub update_user_quota_units {
 2928 
 2929     # for each user, if their max_total_upload_size is not -1, then if units are not already
 2930     # set to M, adjust the units from bytes to M.
 2931 
 2932     my $need_update = 0;
 2933     # check to see if the conversion has already occured.
 2934     my ($upload_units) = DBAccess->sqlSelect("value", "params", "name = 'upload_units'");
 2935     if ($upload_units) {
 2936        if ((lc $upload_units) eq 'm') {
 2937            # don't need to update
 2938            print STDERR "units update has already occured\n";
 2939        }
 2940        else {                   # upload_units set to some other value than 'm'
 2941            $need_update = 1;
 2942        }
 2943     }
 2944     else {                      #upload_units not yet defined
 2945         $need_update = 1;
 2946     }
 2947     if ($need_update) {
 2948         print STDERR "updating params hash and user quota info\n";
 2949         my $bytes_p_M = 1048576;
 2950         # first update info in params hash
 2951         my ($current_gupload_size) = DBAccess->sqlSelect("value", "params", "name = 'max_total_upload_size'");
 2952         print STDERR "current default upload size in params hash: $current_gupload_size\n";
 2953         my $converted_gupload_size = ceil($current_gupload_size / $bytes_p_M);
 2954         print STDERR "converted default upload size: $converted_gupload_size\n";
 2955         DBAccess->sqlInsert("params", ('name' => 'upload_units', 'value' => 'm'));
 2956         DBAccess->sqlUpdate("params", "name = 'max_total_upload_size'", (value => $converted_gupload_size));
 2957         # now update user info
 2958         my $sth = DBAccess->sqlSelectMany("userid, max_total_upload_size", "users", '');
 2959         while (my ($uid, $upload_size) = $sth->fetchrow()) {
 2960             if ($upload_size && ($upload_size > -1)) {
 2961                 my $conv_size = ceil($upload_size / $bytes_p_M);
 2962                 print STDERR "got converted size $conv_size for $upload_size, uid $uid\n";
 2963                 #modify record
 2964                 DBAccess->sqlUpdate("users", "userid = $uid", (max_total_upload_size => $conv_size));
 2965             }
 2966         }                       # end while
 2967     }
 2968 }
 2969 
 2970 
 2971 sub upgrade_CMS_document {
 2972 
 2973     # we need to call this to initialize global vars
 2974     # such as $USER,
 2975     my $mdot = Portal->new(1);
 2976 
 2977     my ($upload_directory) = DBAccess->sqlSelect("value", "params", "name = 'absolutepathfileuploaddir'");
 2978     my $sth = DBAccess->sqlSelectMany("iid, userid", "instance", "isa = 'CMSDocument'");
 2979     while (my ($cms_iid, $uid) = $sth->fetchrow()) {
 2980         print "my cms_iid is $cms_iid\n";
 2981         my $filedir = $upload_directory . "/$cms_iid";
 2982         if (-d $filedir) {
 2983             print "my filedir is $filedir\n";
 2984             opendir(FILES, $filedir);
 2985             while (my $name = readdir(FILES)) {
 2986                 if (($name ne "..") && ($name ne ".") && ($name ne "comment")) {
 2987                     print "my name is $name\n";
 2988                    my ($filename, $version_number) = split(/rev_/,$name);
 2989                    #open the appropriate comment file and read teh line
 2990                    my $read_file = $filedir . "/comment/comment.rev_" . $version_number;
 2991                    #print STDERR "revision file was $read_file\n";
 2992 
 2993                     unless (open OUT, "<$read_file") {
 2994                              next;
 2995                     }
 2996                     my $comment;
 2997                     read(OUT,$comment,16384);
 2998                     close(OUT);
 2999                     #print STDERR "read $comment\n";
 3000                     $read_file = $filedir . "/comment/timestamp.rev_" . $version_number;
 3001                     #print STDERR "timestamp file was $read_file\n";
 3002                      print "my comment is $comment\n";
 3003 
 3004                     unless (open OUT, "<$read_file") {
 3005                            next;
 3006                      }
 3007 
 3008                      my $timestamp;
 3009                      read(OUT,$timestamp,16384);
 3010                      close(OUT);
 3011                      #print STDERR "read $timestamp\n";
 3012 
 3013                      $timestamp =~ m/(\w{3})\s+(\w{3})\s+(\d+)\s+(\d+)\:(\d{2})\:(\d{2})\s+(\d{4})/;
 3014                      my %month = (Jan => 1, Feb => 2, Mar => 3, Apr => 4, May => 5, Jun => 6, Jul => 7, Aug => 8, Sep => 9, Oct => 10, Nov => 11, Dec => 12);
 3015                      $timestamp = $7 . "-" . $month{$2} . "-" . $3 . " $4:$5:$6";
 3016 
 3017 
 3018                      $read_file = $filedir . "/comment/owner.rev_" . $version_number;
 3019                      #print STDERR "owner file was $read_file\n";
 3020 
 3021                      unless (open OUT, "<$read_file") {
 3022                              next
 3023                      }
 3024                      my $owner;
 3025                      read(OUT,$owner,16384);
 3026                      close(OUT);
 3027                      my ($uid_of_modifier)  = DBAccess->sqlSelect("userid", "users", "fullname = '$owner'");
 3028                      #can't use the version module to add all the information to a new version gizmo,
 3029                      #because this is the upgrade script, and we can't be dependent on any code in
 3030                      #the product, because that code may change from release to release
 3031 
 3032                      my ($version_iid) = DBAccess->sqlSelect("value", "params", "name = 'nextiid'");
 3033                      my $next_version_iid = $version_iid + 1;
 3034                      DBAccess->sqlUpdate("params", "name = 'nextiid'", value => $next_version_iid);
 3035                     my $version_iid = DBAccess->sqlInsert("instance", (
 3036                                                                        'userid' => $uid,
 3037                                                                        't1' => "$comment",
 3038                                                                        't2' => "$version_number",
 3039                                                                        'i1' => $uid_of_modifier,
 3040                                                                        'file1' => "$filename",
 3041                                                                        'ParentIID' => $cms_iid,
 3042                                                                        'IsA' => 'Version',
 3043                                                                        'CreationDate' => $timestamp
 3044                                                                       )
 3045                      );
 3046                     mkpath ("$upload_directory/$version_iid");
 3047 
 3048                     unless( -d "$upload_directory/$version_iid" ) {
 3049 
 3050                         # remove version and die
 3051                         DBAccess->sqlDelete( "instance", "iid=$version_iid" );
 3052                         die "Could not create Version gixmo directory $upload_directory/$version_iid.\n Please check file permissions of the uploads directory";
 3053                     }
 3054 
 3055                     move ("$filedir/$name", "$upload_directory/$version_iid/$filename");
 3056 
 3057                     unless( -e "$upload_directory/$version_iid/$filename" ) {
 3058 
 3059                         # remove version and die
 3060                         DBAccess->sqlDelete( "instance", "iid=$version_iid" );
 3061 
 3062                         die "Could not move Version gizmo file $upload_directory/$version_iid/$filename.\n Please check file permissions of the uploads directory";
 3063                     }
 3064 
 3065                 }
 3066             }
 3067             closedir FILES;
 3068             rmtree($filedir);
 3069         }
 3070         my ($max_creation_date) = DBAccess->sqlSelect("max(CreationDate)", "instance", "parentiid = $cms_iid");
 3071         my ($max_iid) = DBAccess->sqlSelect("iid", "instance", "CreationDate = '$max_creation_date' and parentiid = $cms_iid");
 3072         DBAccess->sqlUpdate("instance", "iid = $cms_iid", (i1 => $max_iid));
 3073 
 3074 
 3075         # upgrade permissions bundles
 3076 
 3077         my $cms_doc = Gizmo->restore( $cms_iid );
 3078 
 3079         # fix base permisssions
 3080         my $bundle_level = $cms_doc->get_bundle_level( 'CHECKINOUT' );
 3081 
 3082         unless( ( defined $bundle_level ) && ( $bundle_level == 2 or $bundle_level == 9 ) ) {
 3083 
 3084             $cms_doc->set_bundle_level( 'CHECKINOUT', 8 );
 3085         }
 3086 
 3087         my $perms = $cms_doc->_get_permissions();
 3088 
 3089         # fix groups ACL
 3090 
 3091         foreach my $grp_id (@{$perms->get_acl_groups()}) {
 3092 
 3093             if( $perms->is_group_acl_pair_there( $grp_id, 'MOD' ) ) {
 3094 
 3095                 #           print STDERR "ADDING CHECKINOUT ACL PAIR TO $cms_iid GROUP $grp_id\n";
 3096                 $perms->add_group_acl_pair( $grp_id, 'CHECKINOUT' );
 3097             }
 3098         }
 3099 
 3100         # fix users ACL
 3101 
 3102         foreach my $uid ( @{$perms->get_acl_users()} ) {
 3103 
 3104             if( $perms->is_user_acl_pair_there( $uid, 'MOD' ) ) {
 3105 
 3106                 #           print STDERR "ADDING CHECKINOUT ACL PAIR TO $cms_iid USER $uid\n";
 3107                 $perms->add_user_acl_pair( $uid, 'CHECKINOUT' );
 3108             }
 3109         }
 3110 
 3111         $cms_doc->_set_permissions( $perms );
 3112 
 3113         $cms_doc->save_permissions();
 3114     }
 3115 
 3116 }
 3117 
 3118 
 3119 sub populate_extended_user_table {
 3120 
 3121     ### mike: THIS IS A HACK - DO NOT REMOVE
 3122     ### default user should not run this method
 3123     my $testuser = Metadot::UserFactory->get_user();
 3124     return unless ($testuser->can('set_value'));
 3125 
 3126     # do not perform this upgrade if we are not using FlexUser
 3127     return unless $testuser->isa('Metadot::User::FlexUser');
 3128 
 3129 
 3130     # CKIM: this syntax is less desirable but may be needed by users with
 3131     #       Oracle prior to 9i
 3132     # my $users = DBAccess->sqlSelectMany( 'userid, fullname', 'users' );
 3133 
 3134 
 3135     # CKIM: this is a better query to use, as long as nobody is running Oracle
 3136     #       versions prior to 9i
 3137     #
 3138     my $users = DBAccess->sqlSelectMany(
 3139       'u.userid, u.fullname',
 3140       'users u LEFT OUTER JOIN extended_user e ON u.userid=e.userid',
 3141       'e.userid IS NULL'
 3142     );
 3143 
 3144     while (my ($uid, $fullname) = $users->fetchrow() ) {
 3145 
 3146         # CKIM: this check will be no longer necessary when the above query is
 3147         #       used.
 3148 
 3149         # my ($already_there) =
 3150         #  DBAccess->sqlSelect("count(*)",
 3151         #                      "extended_user",
 3152         #                      "userid = '$uid'");
 3153 
 3154         # unless( $already_there ) {
 3155 
 3156             # aju -- do a more sophisticated job parsing the fullname info
 3157             my $parse_error = $name_parser->parse($fullname);
 3158             my %name_comps = $parse_error ? () : $name_parser->components;
 3159 #           print STDERR "got parse error $parse_error and components for $fullname: ",
 3160 #             Dumper(\%name_comps), "\n";
 3161 
 3162             if ($parse_error) {
 3163                 my $temp_fn = $fullname;
 3164                 $temp_fn =~ s/, Jr/ Jr/g;
 3165                 $temp_fn =~ s/,Jr/ Jr/g;
 3166                 $temp_fn =~ s/, Jnr/ Jnr/g;
 3167                 $temp_fn =~ s/,Jnr/ Jnr/g;
 3168                 $parse_error = $name_parser->parse($temp_fn);
 3169                 %name_comps = $parse_error ? () : $name_parser->components;
 3170 #               print STDERR "--reparse: got parse error $parse_error and components for $temp_fn: ",
 3171 #               Dumper(\%name_comps), "\n";
 3172             }
 3173             my ($first_name, $last_name, $initial);
 3174             if ($parse_error) { # then revert to prev. approach
 3175                 my ($first_word, $second_word, $third_word, $remainder ) = ('', '', '', '');
 3176                 ($first_word, $second_word, $remainder ) = split( /\s+/, $fullname, 3 );
 3177                 ($first_word) || print STDERR "user $uid has no defined name";
 3178                 $first_name = $first_word || '';
 3179                 ($last_name, $initial) = ('', '');
 3180                 if( $second_word && $remainder && ( length $second_word == 1 ) ) {
 3181                     $initial = $second_word || '';
 3182                     $last_name = $remainder || '';
 3183                 } else {
 3184                     $initial = '';
 3185                     $last_name =
 3186                         ( $second_word ) ? ( ( $remainder ) ? "$second_word $remainder" : $second_word ) : '';
 3187                 }
 3188             }
 3189             else {              # parse was okay
 3190                 if ($name_comps{given_name_1}) {
 3191                     $first_name = $name_comps{given_name_1};            }
 3192                 else {
 3193                     if ($name_comps{initials_1}) {
 3194                         $first_name = $name_comps{initials_1};
 3195                     }
 3196                 }
 3197                 if ($name_comps{initials_1} && !($name_comps{middle_name})) {
 3198                     $initial = $name_comps{initials_1};
 3199                 }
 3200                 else {
 3201                     if ($name_comps{middle_name}) {
 3202                         $initial = substr($name_comps{middle_name}, 0,1);
 3203                     }
 3204                 }
 3205                 $last_name = $name_comps{surname_1} . " " . $name_comps{suffix};
 3206             }
 3207 
 3208             print STDERR "name parsing result for $fullname: fn $first_name mi $initial ln $last_name\n";
 3209             # we have to do these so that following calls
 3210             # run properly
 3211             $USER = Metadot::UserFactory->get_user();
 3212             $SESSION = Session->new();
 3213 
 3214             my $usr = Metadot::UserFactory->get_user( $uid );
 3215 #           print STDERR "instantiated user is: ", Dumper($usr), "\n";
 3216 
 3217             $usr->set_value( 'first_name', $first_name );
 3218             $usr->set_value( 'last_name', $last_name );
 3219             $usr->set_value( 'initial', $initial );
 3220 
 3221             $usr->save();
 3222 
 3223 
 3224 #        }
 3225 #       unless( $already_there ) {
 3226 
 3227 #           my ($first_word, $second_word, $third_word, $remainder ) = ('', '', '', '');
 3228 
 3229 #           ($first_word, $second_word, $remainder ) = split( /\s+/, $fullname, 3 );
 3230 
 3231 #           ($first_word) || print STDERR "user $uid has no defined name";
 3232 
 3233 #           my $first_name = $first_word || '';
 3234 #           my ($last_name, $initial) = ('', '');
 3235 
 3236 #           if( $second_word && $remainder && ( length $second_word == 1 ) ) {
 3237 
 3238 #               $initial = $second_word || '';
 3239 #               $last_name = $remainder || '';
 3240 
 3241 #           } else {
 3242 
 3243 #               $initial = '';
 3244 #               $last_name =
 3245 #                 ( $second_word ) ? ( ( $remainder ) ? "$second_word $remainder" : $second_word ) : '';
 3246 
 3247 #           }
 3248 
 3249 #           # we have to do these so that following calls
 3250 #           # run properly
 3251 #           $USER = Metadot::UserFactory->get_user();
 3252 #           $SESSION = Session->new();
 3253 
 3254 #           my $usr = Metadot::UserFactory->get_user( $uid );
 3255 
 3256 #           $usr->set_value( 'first_name', $first_name );
 3257 #           $usr->set_value( 'last_name', $last_name );
 3258 #           $usr->set_value( 'initial', $initial );
 3259 
 3260 #           $usr->save();
 3261 #       }
 3262     }
 3263 }
 3264 
 3265 sub     convert_channelitem_ciid_to_sequence {
 3266     my $db_type = lc(DBAccess->get_db_type());
 3267 
 3268     # this is not necessary for Oracle, or any later database implementations
 3269     if ($db_type eq 'mysql') {
 3270         my ($max_ciid) = DBAccess->sqlSelect("max(ciid)","channelitem");
 3271         my ($next_ciid) = DBAccess->sqlSelect("value","params","name='nextciid'");
 3272         if ($max_ciid >= $next_ciid) {
 3273             #this has not yet been converted
 3274             $next_ciid = $max_ciid+1;
 3275             DBAccess->sqlSimple("UPDATE params SET value='$next_ciid' WHERE name='nextciid'");
 3276             DBAccess->sqlSimple("ALTER TABLE channelitem MODIFY ciid INT(11) NOT NULL");
 3277         }
 3278     }
 3279 }
 3280 
 3281 
 3282 sub convert_gizmo_uploads {
 3283 
 3284     my ($upload_directory) = DBAccess->sqlSelect( "value", "params", "name = 'absolutepathfileuploaddir'" );
 3285 
 3286     unless( $upload_directory ) {
 3287 
 3288         die "Cannot convert category images, absolutepathfileuploaddir not defined";
 3289     }
 3290 
 3291 
 3292     my $sth = DBAccess->sqlSelectMany("iid, isa, userid, file1, file1_size", "instance" );
 3293 
 3294 
 3295     while ( my ( $id, $isa, $uid, $file1, $file1_size ) = $sth->fetchrow() ) {
 3296 
 3297         if( lc $isa eq 'item' || lc $isa eq 'imageitem' || lc $isa eq 'imagerow' || lc $isa eq 'marketingrow') {
 3298 
 3299             if( $file1 ) {
 3300 
 3301                 # calculate file size from the actual file
 3302                 my $source_file = "$upload_directory/$id/$file1";
 3303 
 3304                 if ( -e $source_file ) {
 3305 
 3306                     my $size = ( stat $source_file )[7];
 3307 
 3308                     # insert into bookkeeping table if not already there
 3309                     my ($cnt) = DBAccess->sqlSelect("count(*)", "uploads",
 3310                                                     "isa='$isa' and id='$id' and field_name='item_attachment_file'" );
 3311 
 3312                     unless( $cnt ) {
 3313                         DBAccess->sqlInsert( "uploads",
 3314                                              id => $id,
 3315                                              userid => $uid,
 3316                                              isa => $isa,
 3317                                              field_name => 'item_attachment_file',
 3318                                              type => Metadot::UploadsManager::UPLOAD_TYPE_USER_SELECTED(),
 3319                                              stored_at => Metadot::UploadsManager::STORAGE_TYPE_ACCESS_CONTROLLED(),
 3320                                              file_name => $file1,
 3321                                              file_size => $size );
 3322             DBAccess->sqlUpdate( "instance", "iid=$id", ( file1_size => 0 ) );
 3323                     }
 3324                 }
 3325             }
 3326         }
 3327     }
 3328 }
 3329 
 3330 
 3331 
 3332 sub convert_category_and_discussion_image_uploads {
 3333 
 3334     my ($upload_directory) = DBAccess->sqlSelect( "value", "params", "name = 'absolutepathfileuploaddir'" );
 3335 
 3336     my $public_dir = MetadotConfig->get_public_uploads_dir();
 3337 
 3338     unless( $upload_directory && $public_dir ) {
 3339 
 3340         die "Cannot convert category images, absolutepathfileuploaddir or public_uploads_dir not defined";
 3341     }
 3342 
 3343     my $move_image = sub {
 3344         my $id = shift;
 3345         my $uid = shift;
 3346         my $image_name = shift;
 3347         my $field_name = shift;
 3348         my $legacy_field_name = shift;
 3349         my $isa = shift;
 3350 
 3351         my $source_dir = "$upload_directory/$id";
 3352         my $source_file = "$source_dir/$image_name";
 3353 
 3354         # first check if this had been already converted (though this shouldn't happen)
 3355         my ($cnt) = DBAccess->sqlSelect( "count(*)", "uploads",
 3356                                          "isa='$isa' and id='$id' and field_name='$field_name'" );
 3357 
 3358         if( $cnt ) { return }
 3359 
 3360         # add the image id as prefix to avoid name clashes
 3361         my $dest_file = "$public_dir\/$id\_$image_name";
 3362 
 3363         # move
 3364         if (-e $source_file) {  #  do the following only if the source file really exists
 3365             copy ( $source_file, $dest_file )
 3366                 or die "Cannot convert category images, copy from $source_file to $dest_file failed";
 3367 
 3368             unlink( $source_file );
 3369 
 3370             my $file_size = (stat $dest_file)[7];
 3371 
 3372             # create new record in the uploads table
 3373             DBAccess->sqlInsert( "uploads",
 3374                                  id => $id,
 3375                                  userid => $uid,
 3376                                  isa => "$isa",
 3377                                  field_name => $field_name,
 3378                                  type => Metadot::UploadsManager::UPLOAD_TYPE_PUBLIC(),
 3379                                  stored_at => Metadot::UploadsManager::STORAGE_TYPE_PUBLIC(),
 3380                                  file_name => "$id\_$image_name",
 3381                                  file_size => $file_size );
 3382 
 3383             # clear the corresponding field in the instance table
 3384             DBAccess->sqlUpdate( "instance", "iid=$id", ( $legacy_field_name => '' ) );
 3385         }
 3386     };
 3387 
 3388     my $sth = DBAccess->sqlSelectMany("iid, isa, userid, t1, t2, t3, file1", "instance" );
 3389 
 3390     while ( my ( $id, $isa, $uid, $display_image, $highlight_image, $active_image, $discussion_image ) = $sth->fetchrow() ) {
 3391         if( lc $isa eq 'category' ) {
 3392 
 3393             $display_image && &$move_image( $id, $uid, $display_image, 'display_image', 't1', $isa );
 3394             $highlight_image && &$move_image( $id, $uid, $highlight_image, 'highlight_image', 't2', $isa );
 3395             $active_image && &$move_image( $id, $uid, $active_image, 'active_image', 't3', $isa );
 3396         } elsif( lc $isa eq 'discussion' ) {
 3397 
 3398             $discussion_image && &$move_image( $id, $uid, $discussion_image, 'discussion_attachment_file', 'file1', $isa );
 3399         }
 3400     }
 3401 }
 3402 
 3403 
 3404 
 3405 sub make_clipboards_private {
 3406     #
 3407     #
 3408     use Gizmo;
 3409     use Gizmo::Category;
 3410 
 3411     my $parent_clip = MetadotConfig->get_reserved_iid('PARENT_CLIPBOARD');
 3412     my $sth = DBAccess->sqlSelectMany( "iid, isa", "instance", "parentiid=$parent_clip" );
 3413 
 3414     while ( my ( $id, $isa ) = $sth->fetchrow() ) {
 3415 
 3416         if( lc $isa eq 'category' ) {
 3417 
 3418             my $cat = Category->restore( $id );
 3419 
 3420             # make sure the new clipboard is not public accsessible
 3421             $cat->set_bundle_level( 'DISP', 8 );
 3422             $cat->set_bundle_level( 'MOD', 8 );
 3423             $cat->save();
 3424 
 3425         }
 3426     }
 3427 }
 3428 
 3429 
 3430 # this now needs to handle three possible stages of the database
 3431 sub create_super_admin_group {
 3432 
 3433     print STDERR "**in create_super_admin_group\n";
 3434     my ($supera_exists) = DBAccess->sqlSelect("grp_id", "grp", "group_name='SUPER_ADMIN'");;
 3435     my ($site_mgr_exists) = DBAccess->sqlSelect("grp_id", "grp", "group_name='SITE_MGR'");;
 3436     my ($orig_admin_grpid) = DBAccess->sqlSelect("grp_id", "grp", "group_name='ADMIN'");;
 3437 
 3438     if (!$orig_admin_grpid) {
 3439         print STDERR "error: can't get id of ADMIN group: exiting\n";
 3440         return;
 3441     }
 3442     if (!$supera_exists && !$site_mgr_exists) {
 3443         print STDERR "neither super_admin nor site_mgr group exists yet\n";
 3444         # stage 1 - neither exists yet.
 3445         # rename admin group to site_mgr, then create new admin group for super-admin
 3446         DBAccess->sqlUpdate("grp", "grp_id = $orig_admin_grpid", (group_name => 'SITE_MGR'));
 3447         DBAccess->sqlInsert("grp", (group_name => 'ADMIN', group_description => 'Super admins', userid => 8));
 3448     }
 3449     elsif ($supera_exists && !$site_mgr_exists) {
 3450         print STDERR "superadmin group already exists\n";
 3451         # stage 2 - super admin group exists.
 3452         # rename admin group to site mgr, then rename super_admin group to admin
 3453         print STDERR "updating admin to site mgr\n";
 3454         DBAccess->sqlUpdate("grp", "grp_id = $orig_admin_grpid", (group_name => 'SITE_MGR'));
 3455         print STDERR "updating super admin  to admin\n";
 3456         DBAccess->sqlUpdate("grp", "grp_id = $supera_exists", (group_name => 'ADMIN'));
 3457     }
 3458     elsif (!$supera_exists && $site_mgr_exists) {
 3459         # do nothing - up to date
 3460     }
 3461     else {
 3462         print STDERR "in create_super_admin_group: error - should not have reached this case.\n";
 3463     }
 3464 # print "\n\nSUPER ADMIN GROUP IS $grp_id\n\n";
 3465 
 3466 #     unless ($grp_id) {
 3467 #         DBAccess->sqlInsert("grp", group_name => 'SUPER_XXX', group_description => 'Super admins', userid => 8);
 3468 #     }
 3469 }
 3470 
 3471 
 3472 # create a registration manager group
 3473 sub create_registration_manager_group {
 3474     # check if the group exists
 3475     my $reg_mgr_group_name = Metadot::User::Default::REGISTRATION_MGR_GROUP_NAME();
 3476     my $reg_mgr_grp_id     = Metadot::User::Default::REGISTRATION_MGR_GRP_ID();
 3477 
 3478     print "Checking for registration manager group $reg_mgr_grp_id\n";
 3479 
 3480     my ($exists) = DBAccess->sqlSelect('count(*)', 'grp', 'grp_id='.$reg_mgr_grp_id);
 3481 
 3482     if ($exists) {
 3483         print "$reg_mgr_group_name already exists ($exists) \n";
 3484     } else {
 3485         my $admin_userid = MetadotConfig->get_reserved_uid('ADMIN');
 3486         DBAccess->sqlSimple(qq~
 3487 INSERT INTO grp (grp_id, group_name, group_description, userid)
 3488   VALUES ( $reg_mgr_grp_id,
 3489            '$reg_mgr_group_name',
 3490            'Registration managers',
 3491            $admin_userid)~);
 3492         print "Created new $reg_mgr_group_name\n";
 3493     }
 3494 
 3495 }
 3496 
 3497 
 3498 # corrects the permissions for the site library. the default required login
 3499 # to view, but we need it to be public. The current permission model is that
 3500 # if a user can't see the page, he can't see any of its contents -- including
 3501 # publicly uploaded images
 3502 sub correct_site_library_permissions {
 3503     print "Checking site library permissions\n";
 3504     use Gizmo::SiteLibrary;
 3505 
 3506     my $bundle_name   = 'DISP';
 3507     my $desired_level = 0;
 3508 
 3509     my $library = SiteLibrary->get_instance();
 3510     my $perms   = $library->_get_permissions();
 3511     my $level   = $perms->get_bundle_level($bundle_name);
 3512 
 3513     print "Permission for $bundle_name is $level\n";
 3514     if ($level != $desired_level) {
 3515         print "Setting level to $desired_level\n";
 3516         $perms->set_bundle_level($bundle_name, $desired_level);
 3517         $library->save();
 3518     }
 3519 }
 3520 
 3521 
 3522 
 3523 sub convert_permissions_to_xml
 3524 {
 3525     print "Converting permissions to XML\n";
 3526     require "../bin/migrate_storables.pl";
 3527 }
 3528 
 3529 
 3530 #################################################################################
 3531 #######################      Script Starts Here         #########################
 3532 #################################################################################
 3533 
 3534 ######################################
 3535 ## check for command line args and do
 3536 ## something with them
 3537 ##
 3538 my $server_name = "localhost";
 3539 my $all_flag = 0;
 3540 my $new_admin_password = '';
 3541 ## list of modules to add to the 'vserv_modules' table
 3542 my @modules_to_add    = ();
 3543 ## list of modules to remove from the 'vserv_modules' table
 3544 my @modules_to_remove = ();
 3545 
 3546 while ( $_ = $ARGV[0]) {
 3547   shift(@ARGV);
 3548   last if /^--$/;
 3549 
 3550   if (/^-h|^-help/) {
 3551     &usage("HELP");
 3552   } elsif (/^-s/) {
 3553     $server_name = $ARGV[0];
 3554     shift(@ARGV);
 3555   } elsif (/^-all/) {
 3556         $all_flag = 1;
 3557   } elsif (/^-d|^-debug/) {
 3558     #turn debug mode on
 3559     my $debug_level = $ARGV[0];
 3560     $GA{DEBUG_LEVEL} = $debug_level;
 3561     shift(@ARGV);
 3562   } elsif (/^-p|^-password/) {
 3563       $new_admin_password = shift @ARGV;
 3564   } elsif (/^-add_mod/) {
 3565       while ($ARGV[0] =~ /^\w/) {
 3566           push @modules_to_add, shift @ARGV;
 3567       }
 3568   } elsif (/^-remove_mod/) {
 3569       while ($ARGV[0] =~ /^\w/) {
 3570           push @modules_to_remove, shift @ARGV;
 3571       }
 3572   } else {
 3573     &usage("unknown argument: $_");
 3574   }
 3575 }
 3576 ##
 3577 ######################################
 3578 
 3579 my @servers;
 3580 $servers[0] = $server_name;
 3581 if ($all_flag) {@servers = MetadotConfig->get_all_server_names();}
 3582 
 3583 print "I am going to perform my operations on the following servers: @servers\n";
 3584 
 3585 
 3586 
 3587 foreach my $server_name (@servers) {
 3588 
 3589         print "Performing operations on server $server_name:\n";
 3590 
 3591     if ($server_name) {
 3592         MetadotConfig->set_server_name($server_name);
 3593     }
 3594 
 3595     my $section_name = MetadotConfig->get_section_name($server_name);
 3596     print STDERR "\n\nsection_name:$section_name\n\n";
 3597     if (!$section_name){
 3598         die "\nThere is no server configuration for the server name : $server_name\n\n";
 3599     }
 3600 
 3601     my($errormsg, $nberror);
 3602 
 3603     my $cmd;
 3604     my $db_type = lc(DBAccess->get_db_type());
 3605     my $nb=scalar(@{$todos{$db_type}});
 3606     my $i=0;
 3607     $nb++;
 3608     print STDERR "$0: starting for db_type = '$db_type'\n";
 3609     print STDERR "I have about $nb operations to do\n";
 3610     while ($i < $nb){
 3611         &doCommand($i);
 3612         $i++;
 3613     }
 3614     print STDERR "Completed the \"todo\" operations\n";
 3615 
 3616     &convert_permissions_to_xml();
 3617 
 3618     &populate_params_table() ;
 3619 
 3620     &populate_ldapdn_field_in_user_table() ;
 3621 
 3622     &upgrade_CMS_document();
 3623 
 3624     &populate_extended_user_table();
 3625 
 3626     &update_user_quota_units();
 3627 
 3628     &add_default_theme_templates();
 3629 
 3630     &convert_gizmo_uploads();
 3631 
 3632     &convert_category_and_discussion_image_uploads();
 3633 
 3634     &make_clipboards_private();
 3635 
 3636     &convert_channelitem_ciid_to_sequence();
 3637 
 3638     &update_children_order();
 3639 
 3640     &create_super_admin_group();
 3641 
 3642     &create_registration_manager_group();
 3643 
 3644     &correct_site_library_permissions();
 3645 
 3646     &update_vserv_modules($section_name);
 3647 
 3648     &update_street_maps_basic_tool();
 3649 
 3650     &update_admin_password();
 3651 
 3652     &update_toolbox_page();
 3653 
 3654     &update_profile_properties();
 3655 
 3656     &migrate_profile_properties();
 3657 
 3658     # temporarily disabled this because it doesn't work in Oracle
 3659     # NICO TODO: FIX THIS SUB TO WORK IN ORACLE
 3660     #&enable_mystuff_links();
 3661 
 3662     # disabled the removal of Business Edition modules
 3663     #&cleanup_be_modules();
 3664 
 3665     &clean_up_orphaned_faq_questions();
 3666     &migrate_extensions_directory();
 3667     &change_webmonitor_pointer();
 3668 
 3669     &deploy_gizmo3000_resources();
 3670 
 3671     # we do this to free memory during execution
 3672     MetadotConfig->clear_config_cache();
 3673 
 3674     DBAccess->close_db_object();
 3675 
 3676 } # end of foreach
 3677 
 3678 print STDERR "
 3679 
 3680 ####################### IMPORTANT #############################
 3681 ##### MAKE SURE AND READ THE UPGRADE INSTRUCTIONS LOCATED #####
 3682 ##### IN THE ../doc DIRECTORY                             #####
 3683 ####################### IMPORTANT #############################
 3684 
 3685 
 3686 ";
 3687 debug_msg(1, "$0: I'm finished....");
 3688 
 3689 
 3690 
 3691 
 3692 
 3693 
 3694 sub _get_maintemplate {
 3695     my $maintemplate = "<HTML>\r\n\r\n
 3696     <HEAD>\r\n\r\n
 3697     <STYLE TYPE=\"text/css\">\r\n
 3698     BODY, DIV, P, B, A, TD, TR, TH, TABLE, UL, LI, OPTION,INPUT, SELECT\r\n
 3699     {font-family: Verdana, Helvetica,Arial,sans-serif; font-size: 12pt; color: 333333;}\r\n
 3700     H1, H2, H3, H4, H5, H6 {font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 14pt;}\r\n
 3701     .AdminText, .AdminText:visited  {font-family: Helvetica, Verdana,Arial,sans-serif; text-decoration: none; font-size: 8pt; color: green;}\r\n\r\n
 3702     A {color: 003366;}\r\n
 3703     A:visited {color: 003366;}\r\n
 3704     A:active {color: 336633;}\r\n
 3705     A:hover {color: ff6600;}\r\n\r\n
 3706     .AdminText:hover {color: red; text-decoration: underline}\r\n\r\n
 3707     .welcomesub {font-style: italic; font-size: 8pt}\r\n\r\n
 3708     .catheader { font-family: Helvetica, Verdana,Arial,sans-serif; font-size: 12pt; color:  white;}\r\n
 3709     a.catheader {text-decoration: none;}\r\n
 3710     a.catheader:visited {color:  white; text-decoration: none;}\r\n
 3711     a.catheader:hover {color:ff6600; text-decoration: underline;}\r\n
 3712     a.catheader:active {color:ff6600; text-decoration: underline;}\r\n\r\n
 3713     .catlistmain { font-family: Helvetica, Arial,sans-serif; font-size: 12pt; font-weight: bold;}\r\n
 3714     .catlistsub { font-family: Helvetica, Arial, sans-serif; font-size: 12pt;}\r\n\r\n
 3715     .newscattitle{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; font-weight: bold; color: ffffff; }\r\n\r\n
 3716     .newsitemtitle{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; font-weight: bold}\r\n\r\n
 3717     .newsitem{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; }\r\n\r\n
 3718     .prevnextbar, .prevnextbar:visited { font-family: Helvetica,Arial,Helvetica,sans-serif;\r\n
 3719     font-size: 12pt; font-weight: bold; color: cc6633;}\r\n\r\n
 3720     .toollink, .toollink:visited  {font-family: Helvetica,Verdana,Arial,Helvetica,sans-serif; text-decoration: none; font-size: 8pt; font-weight: bold; color: 444444;}\r\n\r\n
 3721     .toollink:active{color: ff6600; text-decoration: underline;}\r\n\r\n
 3722     .toollink:hover {color:ff6600; text-decoration: underline;}\r\n\r\n
 3723     .mypage, .mypage:visited  {font-family: times; text-decoration: none; font-size: 12pt; font-weight: bold; color: ff6600;}\r\n\r\n
 3724     .mypage:active{color: ff6600; text-decoration: underline;}\r\n\r\n
 3725     .mypage:hover {color:ff6600; text-decoration: underline;}\r\n
 3726     </style>\r\n\r\n
 3727     <META NAME=\"Generator\" CONTENT=\"MetaDot Portal Server;www.metadot.com\">\r\n
 3728     <META HTTP-EQUIV=\"Window-target\" CONTENT=\"_top\">\r\n
 3729     <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n\r\n
 3730     <TITLE>MetaDot Developers\' Site</TITLE>\r\n
 3731     <script language=\"JavaScript\">\r\n
 3732     <!--\r\n\r\n
 3733     var session_cookie = document.cookie;\r\n
 3734     var cookie_string = \"sessionid=; uid=\";\r\n
 3735     var ie_cookie_string = \"sessionid; uid\";\r\n
 3736     var empty_string = \"\";\r\n
 3737     function newImage(arg) {\r\n
 3738     if (document.images) {\r\n
 3739     rslt = new Image();\r\n
 3740     rslt.src = arg;\r\n
 3741     return rslt;\r\n
 3742     }\r\n
 3743     }\r\n\r\n
 3744     function changeImages() {\r\n
 3745     if (document.images && (preloadFlag == true)) {\r\n
 3746     for (var i=0; i<changeImages.arguments.length; i+=2) {\r\n
 3747     document[changeImages.arguments[i]].src = changeImages.arguments[i+1];\r\n
 3748     }\r\n
 3749     }\r\n
 3750     }\r\n\r\n
 3751     var preloadFlag = false;\r\n
 3752     function preloadImages() {\r\n
 3753     if (document.images) {\r\n
 3754     register_over = newImage(\"../images/navbar/register_over_new.gif\");\r\n
 3755     register = newImage(\"../images/navbar/register_new.gif\");\r\n
 3756     login = newImage(\"../images/navbar/login_new.gif\");\r\n
 3757     login_over = newImage(\"../images/navbar/login_over_new.gif\");\r\n
 3758     logout = newImage(\"../images/navbar/logout_new.gif\");\r\n
 3759     logout_over = newImage(\"../images/navbar/logout_over_new.gif\");\r\n
 3760     profile = newImage(\"../images/navbar/profile_new.gif\");\r\n
 3761     profile_over = newImage(\"../images/navbar/profile_over_new.gif\");\r\n
 3762     preloadFlag = true;\r\n
 3763     }\r\n
 3764     }\r\n\r\n
 3765     // -->\r\n
 3766     </script>\r\n
 3767     </HEAD>\r\n\r\n\r\n\r\n\r\n\r\n
 3768     <BODY bgcolor=#FFFFFF>\r\n
 3769     <SCRIPT>\r\n
 3770     preloadImages();\r\n
 3771     </SCRIPT>\r\n
 3772     <TABLE WIDTH=\"100%\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">\r\n
 3773     <TR VALIGN=\"bottom\">\r\n
 3774     <TD ALIGN=\"LEFT\" VALIGN=\"bottom\">\r\n
 3775     <A href = \"index.pl\"><IMG src = \"../images/metadot_3.25_standard.jpg\" border = \"0\"></A>\r\n
 3776     </TD>\r\n
 3777     <TD ALIGN=\"right\" VALIGN=\"bottom\" nowrap>\r\n
 3778     <TABLE border=0 cellpadding=0 cellspacing=0>\r\n
 3779     <TR VALIGN=\"bottom\">\r\n
 3780     <TD valign=\"bottom\">\r\n
 3781     <a href=\"index.pl?isa=User&op=register_form\" onmouseover=\"changeImages(\'register\',\'../images/navbar/register_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'register\', \'../images/navbar/register_new.gif\'); return true;\"><img name=\"register\" src=\"../images/navbar/register_new.gif\" width=70 height=14 border=0></a>\r\n
 3782     <a href=\"index.pl?isa=Session&op=login\" onmouseover=\"changeImages(\'login\',\'../images/navbar/login_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'login\', \'../images/navbar/login_new.gif\'); return true;\"><img name=\"login\" src=\"../images/navbar/login_new.gif\" width=70 height=14 border=0></a>\r\n
 3783     <a href=\"index.pl?isa=Session&op=logout\" onmouseover=\"changeImages(\'logout\',\'../images/navbar/logout_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'logout\', \'../images/navbar/logout_new.gif\'); return true;\"><img name=\"logout\" src=\"../images/navbar/logout_new.gif\" width=70 height=14 border=0></a>\r\n
 3784     <a href=\"index.pl?isa=User&op=modify_self\" onmouseover=\"changeImages(\'profile\',\'../images/navbar/profile_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'profile\', \'../images/navbar/profile_new.gif\'); return true;\"><img name=\"profile\" src=\"../images/navbar/profile_new.gif\" width=70 height=14 border=0></a>\r\n
 3785     <a href=\"index.pl?isa=Portal&op=myportal\" onmouseover=\"changeImages(\'my_projects\', \'../images/navbar/my_projects_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'my_projects\', \'../images/navbar/my_projects_new.gif\'); return true;\"><IMG name=\"my_projects\" src=\"../images/navbar/my_projects_new.gif\" width=70 height=14 border=0></A>\r\n
 3786     <a href=\"userchannel.pl\" onmouseover=\"changeImages(\'my_page\', \'../images/navbar/my_page_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'my_page\', \'../images/navbar/my_page_new.gif\'); return true;\"><IMG name=\"my_page\" src=\"../images/navbar/my_page_new.gif\" width=70 height=14 border=0></A>\r\n
 3787     </TD>\r\n
 3788     </TR>\r\n
 3789     </TABLE>\r\n
 3790     </TD>\r\n
 3791     </TR>\r\n
 3792     </TABLE>\r\n\r\n\r\n
 3793     <table border=0 width=100%>\r\n
 3794     <tr>\r\n
 3795     <td>\r\n
 3796     <table border=0 width=100%>\r\n
 3797     <tr>\r\n
 3798     <td nowrap>\r\n\r\n
 3799     <!-- GIZMOTAG : md_welcome : Begin -->\r\n
 3800     <GIZMOTAG NAME=\"md_welcome\">\r\n
 3801     <DIV><SPAN CLASS=tagWelcomeClass></SPAN><font class=welcome>Hello <b>Admin</b>.<BR></font>\r\n
 3802     <font class=welcomesub>(Not Admin? Click <a class=welcomesub href=\'\'>here</a>)</font>\r\n
 3803     </DIV>\r\n
 3804     </GIZMOTAG>\r\n
 3805     <!-- GIZMOTAG : md_welcome : End -->\r\n\r\n
 3806     </td>\r\n
 3807     <td width=100% align=center>\r\n\r\n
 3808     <!-- GIZMOTAG : md_date : Begin -->\r\n
 3809     <GIZMOTAG NAME=\"md_date\">\r\n
 3810     <DIV><SPAN CLASS=tagDateClass></SPAN>Sat Oct  6 20:09:37 2001</DIV>\r\n
 3811     </GIZMOTAG>\r\n
 3812     <!-- GIZMOTAG : md_date : End -->\r\n\r\n
 3813     <!-- GIZMOTAG : md_catname : Begin -->\r\n
 3814     <GIZMOTAG NAME=\"md_catname\">\r\n
 3815     <DIV><SPAN CLASS=tagCatNameClass></SPAN>Metadot Example Portal</DIV>\r\n
 3816     </GIZMOTAG>\r\n
 3817     <!-- GIZMOTAG : md_catname : End -->\r\n\r\n
 3818     </td>\r\n
 3819     <td nowrap>\r\n\r\n
 3820     <!-- GIZMOTAG : md_search : Begin -->\r\n
 3821     <GIZMOTAG NAME=\"md_search\">\r\n
 3822     <DIV><SPAN CLASS=tagSearchClass></SPAN>\r\n
 3823     <table cellpadding=0 cellspacing=0 border=0>\r\n
 3824     <tr><td nowrap align=right>\r\n
 3825     <form name=\'searchform\' action=\'\' method=\'post\'>\r\n
 3826     <input type=text onfocus=\"searchform.filter.value=\'\'\" size=\'10\' name=\'filter\' value=\'Search\'>\r\n
 3827     <input type=submit value=\'Go\'>\r\n
 3828     <input type=hidden name=op value=search>\r\n
 3829     <input type=hidden name=isa value=Portal>\r\n
 3830     </form></td></tr></table>\r\n
 3831     </DIV>\r\n
 3832     </GIZMOTAG>\r\n
 3833     <!-- GIZMOTAG : md_search : End -->\r\n\r\n
 3834     </td>\r\n
 3835     </tr>\r\n
 3836     </table>\r\n
 3837     </td>\r\n
 3838     </tr>\r\n
 3839     <tr>\r\n
 3840     <td>\r\n
 3841     <table border=0 width=100%>\r\n
 3842     <tr>\r\n
 3843     <td>\r\n\r\n
 3844     <!-- GIZMOTAG : md_catpath : Begin -->\r\n
 3845     <GIZMOTAG NAME=\"md_catpath\">\r\n
 3846     <DIV><SPAN CLASS=tagCatPathClass></SPAN><B>Home</B> <a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n
 3847     <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n
 3848     <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n
 3849     <a href=\'\'><img src=\'../images/obj/del.gif\' width=11 height=11 border=0 alt=\'Delete Me!\'></a>\r\n
 3850     </DIV>\r\n
 3851     </GIZMOTAG><!-- GIZMOTAG : md_catpath : End --></td>\r\n
 3852     <td align=right bgcolor=\"FFFFFF\"><gizmotag name=\"md_adminbar\">admin bar here</gizmotag></td>\r\n
 3853     </tr>\r\n
 3854     <tr>\r\n
 3855     <td colspan=2>\r\n\r\n
 3856     <!-- GIZMOTAG : md_h_topnav : Begin -->\r\n
 3857     <GIZMOTAG NAME=\"md_h_topnav\">\r\n
 3858     <DIV><SPAN CLASS=tagTopNavClass></SPAN>\r\n
 3859     <table border=0  bgcolor=\'#FF0000\' width=\'100%\' cellpadding=0 cellspacing=0><tr><td align=center>\r\n
 3860     <table border=0 cellpadding=4 cellspacing=0><tr><td>\r\n
 3861     <a class=catheader href=\'\'>Products</a>\r\n
 3862     <a class=catheader href=\'\'>IT Center</a>\r\n
 3863     <a class=catheader href=\'\'>Clients</a>\r\n
 3864     <a class=catheader href=\'\'>People</a>\r\n
 3865     <a class=catheader href=\'\'>Discussions</a>\r\n
 3866     <a class=catheader href=\'\'>Contact</a>\r\n
 3867     </td></tr></table>\r\n
 3868     </td></tr></table>\r\n
 3869     </DIV>\r\n
 3870     </GIZMOTAG>\r\n
 3871     <!-- GIZMOTAG : md_h_topnav : End -->\r\n\r\n
 3872     </td>\r\n
 3873     </tr>\r\n
 3874     </table>\r\n
 3875     </td>\r\n
 3876     </tr>\r\n
 3877     <tr>\r\n
 3878     <td>\r\n
 3879     <table border=0 width=100%>\r\n
 3880     <tr>\r\n
 3881     <td valign=top>\r\n\r\n
 3882     <!-- GIZMOTAG : md_v_subnav : Begin -->\r\n
 3883     <GIZMOTAG NAME=\"md_v_subnav\">\r\n
 3884     <DIV><SPAN CLASS=tagSubNavClass></SPAN><table border = 0 cellpadding = 0 cellspacing = 0><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n
 3885     <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n
 3886     </nobr></td><td><a class=catlistsub href=\'\'>Products</a></td></tr></table></td></tr><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n
 3887     <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n
 3888     </nobr></td><td><a class=catlistsub href=\'\'>IT Center</a></td></tr></table></td></tr><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n
 3889     <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n
 3890     </nobr></td><td><a class=catlistsub href=\'\'>Clients</a></td></tr></table></td></tr><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n
 3891     <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n
 3892     </nobr></td><td><a class=catlistsub href=\'\'>People</a></td></tr></table></td></tr><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n
 3893     <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n
 3894     </nobr></td><td><a class=catlistsub href=\'\'>Discussions</a></td></tr></table></td></tr><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n
 3895     <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n
 3896     </nobr></td><td><a class=catlistsub href=\'\'>Contact</a></td></tr></table></td></tr></table></DIV>\r\n
 3897     </GIZMOTAG>\r\n
 3898     <!-- GIZMOTAG : md_v_subnav : End -->\r\n\r\n
 3899     </td>\r\n
 3900     <td valign=top>\r\n
 3901     <table border=0 width=100%>\r\n
 3902     <tr>\r\n
 3903     <td>\r\n\r\n
 3904     <!-- GIZMOTAG : md_catdesc : Begin -->\r\n
 3905     <GIZMOTAG NAME=\"md_catdesc\">\r\n
 3906     <DIV><SPAN CLASS=tagCatDescClass></SPAN><table border=\"0\" cellpadding=\"5\">\r\n
 3907     <tr>\r\n
 3908     <td valign=\"top\">\r\n
 3909     <h2><img src=\"../images/portal_6.jpg\" width=\"200\" height=\"141\"></h2>\r\n
 3910     </td>\r\n
 3911     <td valign=\"top\">\r\n
 3912     <table border=\"0\" cellpadding=\"5\">\r\n
 3913     <tr>\r\n
 3914     <td>\r\n
 3915     <h2><font color=\"#000066\">Welcome to the example Metadot<br>\r\n
 3916     Site</font></h2>\r\n
 3917     </td>\r\n
 3918     </tr>\r\n
 3919     <tr>\r\n
 3920     <td>\r\n
 3921     <p> </p>\r\n
 3922     <p>See the <a href=\"\">developers\' site</a> for resources for the <a href=\"\">Metadot</a>\r\n
 3923     MetaCenter\'s  developers. </p>\r\n
 3924     </td>\r\n
 3925     </tr>\r\n
 3926     </table>\r\n
 3927     </td>\r\n
 3928     </tr>\r\n
 3929     <tr>\r\n
 3930     <td colspan=\"2\">\r\n
 3931     <p>General information about your company can go in this central area.\r\n
 3932     </td>\r\n
 3933     </tr>\r\n
 3934     </table>\r\n
 3935     </DIV>\r\n
 3936     </GIZMOTAG>\r\n
 3937     <!-- GIZMOTAG : md_catdesc : End -->\r\n\r\n
 3938     </td>\r\n
 3939     </tr>\r\n
 3940     <tr>\r\n
 3941     <td>\r\n\r\n
 3942     <!-- GIZMOTAG : md_gizmolist : Begin -->\r\n
 3943     <GIZMOTAG NAME=\"md_gizmolist\">\r\n
 3944     <DIV><SPAN CLASS=tagGizmoListClass></SPAN><!-- ImageItem List -->\r\n
 3945     <p><br>\r\n
 3946     <div  class=catlistsub> <h3>Metadot Example Portal Image Items</h3></div>\r\n
 3947     <LI> <a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n
 3948     <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n
 3949     <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n
 3950     <a href=\'\'><img src=\'../images/obj/del.gif\' width=11 height=11 border=0 alt=\'Delete Me!\'></a>\r\n
 3951     <a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n
 3952     <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n
 3953     <a href=\'\'>test image 1:</a>\r\n
 3954     <a href=\'\'><img src=\"../images/index.gif\" border=0 align=top vspace=5  alt=\"\" ></a>\r\n
 3955     <br><br></li>\r\n
 3956     <p><br>\r\n
 3957     <div  class=catlistsub> <h3>Metadot Example Portal Items</h3></div>\r\n
 3958     <TABLE BORDER=0 CELLSPACING=0><TR VALIGN=BOTTOM><TD ALIGN=LEFT><img ALIGN=MIDDLE src=\'../images/square.gif\'></TD><TD NOWRAP><a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n
 3959     <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n
 3960     <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n
 3961     <a href=\'\'><img src=\'../images/obj/del.gif\' width=11 height=11 border=0 alt=\'Delete Me!\'></a>\r\n
 3962     <a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n
 3963     <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n
 3964     </TD><TD NOWRAP><B>test item 1</B></TD><TD ALIGN=LEFT VALIGN=BOTTOM><img SRC=\'../images/star.gif\' width=\'15\' height=\'16\' border=\'0\'>\r\n
 3965     </TD><TD WIDTH=100%> </TD></TR>\r\n
 3966     <TR VALIGN=TOP><TD> </TD><TD COLSPAN=4 CLASS=centerNewsItem>bla bla bla</TD></TR>\r\n
 3967     </TABLE><TABLE BORDER=0 CELLSPACING=0><TR VALIGN=BOTTOM><TD ALIGN=LEFT><img ALIGN=MIDDLE src=\'../images/square.gif\'></TD><TD NOWRAP><a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n
 3968     <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n
 3969     <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n
 3970     <a href=\'\'><img src=\'../images/obj/del.gif\' width=11 height=11 border=0 alt=\'Delete Me!\'></a>\r\n
 3971     <a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n
 3972     <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n
 3973     </TD><TD NOWRAP><a href=\"\" CLASS=centerNewsTitle>test item2</a></TD><TD ALIGN=LEFT VALIGN=BOTTOM><img SRC=\'../images/star.gif\' width=\'15\' height=\'16\' border=\'0\'>\r\n
 3974     </TD><TD NOWRAP ALIGN=LEFT VALIGN=BOTTOM> <a href=\'\'><img align=bottom src=\"../images/text.jpg\" border=0 align=center alt=\'Download Me!\' width=\"16\" height=\"16\"></a> <a href=\'\'><span class=centerNewsLink>download</span></a> </TD><TD CLASS=centerNewsLink NOWRAP>- http://www.yahoo.fr</TD><TD WIDTH=100%> </TD></TR>\r\n
 3975     <TR VALIGN=TOP><TD> </TD><TD COLSPAN=6 CLASS=centerNewsItem>mon yahoo en francais</TD></TR>\r\n
 3976     </TABLE>\r\n
 3977     </DIV>\r\n
 3978     </GIZMOTAG>\r\n
 3979     <!-- GIZMOTAG : md_gizmolist : End -->\r\n\r\n
 3980     </td>\r\n
 3981     </tr>\r\n
 3982     </table>\r\n
 3983     </td>\r\n
 3984     <td valign=top>\r\n\r\n
 3985     <!-- GIZMOTAG : md_newscol : Begin -->\r\n
 3986     <GIZMOTAG NAME=\"md_newscol\">\r\n
 3987     <DIV><SPAN CLASS=tagNewsColClass></SPAN>\r\n
 3988     <table width=155 border=0 bgcolor=\'#FF0000\' cellpadding=3 cellspacing=0>\r\n
 3989     <tr><td valign=top align=center>\r\n
 3990     <table border=\'0\' cellspacing=0 cellpadding=5 width=150>\r\n
 3991     <tr>\r\n
 3992     <td bgcolor=\'#6699cc\' class=\'newscattitle\' align=center>\r\n
 3993     Metadot Example Portal News</td></tr></table>\r\n
 3994     </td></tr>\r\n
 3995     <tr><td valign=top>\r\n
 3996     <a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n
 3997     <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n
 3998     <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n
 3999     <a href=\'\'><img src=\'../images/obj/del.gif\' width=11 height=11 border=0 alt=\'Delete Me!\'></a>\r\n
 4000     <table cellpadding=0 cellspacing=0><tr><td class=newsitemtitle>- <a class=newsitemtitle href=\'\'>2-For-1 Split Announced</a>\r\n
 4001     </td></tr>\r\n
 4002     <tr><td class=newsitem>Laser Computer announces a 2-1 stock split.<br> </td></tr></table>\r\n
 4003     </td></tr>\r\n
 4004     <tr><td valign=top align=center>\r\n
 4005     <A HREF=\'\'>\r\n
 4006     <IMG SRC=\'../images/addchannel.gif\' BORDER=\'0\' ALT=\'Add to MyPage\'></A>\r\n
 4007     </td></tr>\r\n
 4008     </table>\r\n
 4009     </DIV>\r\n
 4010     </GIZMOTAG>\r\n
 4011     <br>\r\n
 4012     <gizmotag name=\"md_poll\">\r\n
 4013     Here is where the poll is placed.\r\n
 4014     </gizmotag>\r\n
 4015     <!-- GIZMOTAG : md_newscol : End -->\r\n\r\n
 4016     </td>\r\n
 4017     </tr>\r\n
 4018     </table>\r\n
 4019     </td>\r\n
 4020     </tr>\r\n
 4021     </table>\r\n
 4022     <table width=100% border=0>\r\n
 4023     <tr>\r\n
 4024     <td width=30%>\r\n\r\n
 4025     </td>\r\n
 4026     <td width=40% align=center>\r\n
 4027     <font face=\"Arial, Helvetica, sans-serif\" size=-1>\r\n
 4028     <A HREF=#top>Top</a>\r\n
 4029     </td>\r\n
 4030     <td width=30% align=right>\r\n
 4031     <a href=\"http://www.metadot.com\"><img src=\"/images/powered.gif\" border=0></a>\r\n
 4032     </td>\r\n
 4033     </tr>\r\n
 4034     </table>\r\n\r\n\r\n
 4035     </BODY>\r\n\r\n
 4036     </HTML>\r\n";
 4037 
 4038 #    my $maintemplate = '<GIZMOTAG NAME=\"md_top\">some dummy data</GIZMOTAG><GIZMOTAG NAME=\"md_header\">some dummy data</GIZMOTAG><GIZMOTAG NAME=\"md_portal\">some dummy data</GIZMOTAG><table border=0 width=100%><tr><td><table border=0 width=100%><tr><td nowrap><GIZMOTAG NAME=\"md_welcome\">some dummy data</GIZMOTAG></td><td width=100% align=center><GIZMOTAG NAME=\"md_date\">some dummy data</GIZMOTAG><GIZMOTAG NAME=\"md_catname\">some dummy data</GIZMOTAG></td><td nowrap><GIZMOTAG NAME=\"md_search\">some dummy data</GIZMOTAG></td></tr></table></td></tr><tr><td><table border=0 width=100%><tr><td><GIZMOTAG NAME=\"md_catpath\">some dummy data</GIZMOTAG></td></tr><tr><td><GIZMOTAG NAME=\"md_topnav\">some dummy data</GIZMOTAG></td></tr></table></td></tr><tr><td><table border=0 width=100%><tr><td valign=top><GIZMOTAG NAME=\"md_subnav\">some dummy data</GIZMOTAG></td><td valign=top><GIZMOTAG NAME=\"md_catdesc\">some dummy data</GIZMOTAG></td><td valign=top><GIZMOTAG NAME=\"md_newscol\">some dummy data</GIZMOTAG></td></tr></table></td></tr></table><GIZMOTAG NAME=\"md_bottom\">some dummy data</GIZMOTAG>' ;
 4039     return $maintemplate;
 4040 }
 4041 
 4042 ## _get_utilitytemplate: used for displaying serch results, discussions, etc...
 4043 sub _get_utilitytemplate {
 4044 
 4045     my $utilitytemplate = "<HTML>\r\n\r\n <HEAD>\r\n\r\n        <STYLE TYPE=\"text/css\">\r\n        BODY, DIV, P, B, A, TD, TR, TH, TABLE, UL, LI, OPTION,INPUT, SELECT\r\n        {font-family: Verdana, Helvetica,Arial,sans-serif; font-size: 12pt; color: 333333;}\r\n        H1, H2, H3, H4, H5, H6 {font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 14pt;}\r\n        .AdminText, .AdminText:visited  {font-family: Helvetica, Verdana,Arial,sans-serif; text-decoration: none; font-size: 8pt; color: green;}\r\n\r\n        A {color: 003366;}\r\n        A:visited {color: 003366;}\r\n        A:active {color: 336633;}\r\n        A:hover {color: ff6600;}\r\n\r\n        .AdminText:hover {color: red; text-decoration: underline}\r\n\r\n        .welcomesub {font-style: italic; font-size: 8pt}\r\n\r\n        .catheader { font-family: Helvetica, Verdana,Arial,sans-serif; font-size: 12pt; color:  white;}\r\n        a.catheader {text-decoration: none;}\r\n        a.catheader:visited {color:  white; text-decoration: none;}\r\n        a.catheader:hover {color:ff6600; text-decoration: underline;}\r\n        a.catheader:active {color:ff6600; text-decoration: underline;}\r\n\r\n        .catlistmain { font-family: Helvetica, Arial,sans-serif; font-size: 12pt; font-weight: bold;}\r\n        .catlistsub { font-family: Helvetica, Arial, sans-serif; font-size: 12pt;}\r\n\r\n        .newscattitle{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; font-weight: bold; color: ffffff; }\r\n\r\n        .newsitemtitle{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; font-weight: bold}\r\n\r\n        .newsitem{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; }\r\n\r\n        .prevnextbar, .prevnextbar:visited { font-family: Helvetica,Arial,Helvetica,sans-serif;\r\n        font-size: 12pt; font-weight: bold; color: cc6633;}\r\n\r\n        .toollink, .toollink:visited  {font-family: Helvetica,Verdana,Arial,Helvetica,sans-serif; text-decoration: none; font-size: 8pt; font-weight: bold; color: 444444;}\r\n\r\n        .toollink:active{color: ff6600; text-decoration: underline;}\r\n\r\n        .toollink:hover {color:ff6600; text-decoration: underline;}\r\n\r\n        .mypage, .mypage:visited  {font-family: times; text-decoration: none; font-size: 12pt; font-weight: bold; color: ff6600;}\r\n\r\n        .mypage:active{color: ff6600; text-decoration: underline;}\r\n\r\n        .mypage:hover {color:ff6600; text-decoration: underline;}\r\n        </style>\r\n\r\n  <META NAME=\"Generator\" CONTENT=\"MetaDot Portal Server;www.metadot.com\">\r\n  <META HTTP-EQUIV=\"Window-target\" CONTENT=\"_top\">\r\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n\r\n  <TITLE>MetaDot Developers\' Site</TITLE>\r\n  <script language=\"JavaScript\">\r\n  <!--\r\n\r\n   var session_cookie = document.cookie;\r\n   var cookie_string = \"sessionid=; uid=\";\r\n   var ie_cookie_string = \"sessionid; uid\";\r\n   var empty_string = \"\";\r\n   var logged_in = true;\r\n\r\n   if ( session_cookie == cookie_string || session_cookie == empty_string || session_cookie == ie_cookie_string) {\r\n    logged_in = false;\r\n   }\r\n\r\n   function newImage(arg) {\r\n    if (document.images) {\r\n     rslt = new Image();\r\n     rslt.src = arg;\r\n     return rslt;\r\n    }\r\n   }\r\n\r\n   function changeImages() {\r\n    if (document.images && (preloadFlag == true)) {\r\n     for (var i=0; i<changeImages.arguments.length; i+=2) {\r\n      document[changeImages.arguments[i]].src = changeImages.arguments[i+1];\r\n     }\r\n    }\r\n   }\r\n\r\n   var preloadFlag = false;\r\n   function preloadImages() {\r\n    if (document.images) {\r\n     register_over = newImage(\"../images/navbar/register_over.gif\");\r\n     register = newImage(\"../images/navbar/register.gif\");\r\n     login = newImage(\"../images/navbar/login.gif\");\r\n     login_over = newImage(\"../images/navbar/login_over.gif\");\r\n     logout = newImage(\"../images/navbar/logout.gif\");\r\n     logout_over = newImage(\"../images/navbar/logout_over.gif\");\r\n     profile = newImage(\"../images/navbar/profile.gif\");\r\n     profile_over = newImage(\"../images/navbar/profile_over.gif\");\r\n     preloadFlag = true;\r\n    }\r\n   }\r\n\r\n  // -->\r\n  </script>\r\n </HEAD>\r\n\r\n\r\n\r\n\r\n\r\n <BODY bgcolor=#FFFFFF>\r\n  <SCRIPT>\r\n   preloadImages();\r\n  </SCRIPT>\r\n  <TABLE WIDTH=\"100%\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">\r\n   <TR VALIGN=\"bottom\">\r\n    <TD ALIGN=\"LEFT\" VALIGN=\"bottom\">\r\n     <A href = \"index.pl\"><IMG src = \"../images/metadot_3.25_standard.jpg\" border = \"0\"></A>\r\n    </TD>\r\n    <TD ALIGN=\"right\" VALIGN=\"bottom\" nowrap>\r\n     <TABLE border=0 cellpadding=0 cellspacing=0>\r\n      <TR VALIGN=\"bottom\">\r\n       <TD valign=\"bottom\">\r\n        <SCRIPT language=\"JavaScript\">\r\n         if (!logged_in) {\r\n          doclink1 = \"<a href=\\\"index.pl?isa=User&op=register_form\\\" onmouseover=\\\"changeImages(\\\'register\\\',\\\'../images/navbar/register_over.gif\\\'); return true;\\\" onmouseout=\\\"changeImages(\\\'register\\\', \\\'../images/navbar/register.gif\\\'); return true;\\\"><img name=\\\"register\\\" src=\\\"../images/navbar/register.gif\\\" width=70 height=14 border=0></a>\";\r\n          doclink2 = \"<a href=\\\"index.pl?isa=Session&op=login\\\" onmouseover=\\\"changeImages(\\\'login\\\',\\\'../images/navbar/login_over.gif\\\'); return true;\\\" onmouseout=\\\"changeImages(\\\'login\\\', \\\'../images/navbar/login.gif\\\'); return true;\\\"><img name=\\\"login\\\" src=\\\"../images/navbar/login.gif\\\" width=60 height=14 border=0></a>\";\r\n         }else{\r\n          doclink1=\"<a href=\\\"index.pl?isa=Session&op=logout\\\" onmouseover=\\\"changeImages(\\\'logout\\\',\\\'../images/navbar/logout_over.gif\\\'); return true;\\\" onmouseout=\\\"changeImages(\\\'logout\\\', \\\'../images/navbar/logout.gif\\\'); return true;\\\"><img name=\\\"logout\\\" src=\\\"../images/navbar/logout.gif\\\" width=70 height=14 border=0></a>\";\r\n          doclink2 = \"<a href=\\\"index.pl?isa=User&op=modify_self\\\" onmouseover=\\\"changeImages(\\\'profile\\\',\\\'../images/navbar/profile_over.gif\\\'); return true;\\\" onmouseout=\\\"changeImages(\\\'profile\\\', \\\'../images/navbar/profile.gif\\\'); return true;\\\"><img name=\\\"profile\\\" src=\\\"../images/navbar/profile.gif\\\" width=65 height=14 border=0></a>\";\r\n         }\r\n         document.write(doclink1);\r\n         document.write(doclink2);\r\n        </SCRIPT>\r\n       </TD>\r\n       <TD valign=\"bottom\">\r\n        <A href=\"index.pl?isa=Portal&op=myportal\" onmouseover=\"changeImages(\'my_projects\', \'../images/navbar/my_projects_over.gif\'); return true;\" onmouseout=\"changeImages(\'my_projects\', \'../images/navbar/my_projects.gif\'); return true;\">\r\n         <IMG name=\"my_projects\" src=\"../images/navbar/my_projects.gif\" width=70 height=14 border=0></A>\r\n       </TD>\r\n       <TD valign=\"bottom\">\r\n        <A href=\"userchannel.pl\" onmouseover=\"changeImages(\'my_page\', \'../images/navbar/my_page_over.gif\'); return true;\" onmouseout=\"changeImages(\'my_page\', \'../images/navbar/my_page.gif\'); return true;\">\r\n         <IMG name=\"my_page\" src=\"../images/navbar/my_page.gif\" width=70 height=14 border=0></A>\r\n       </TD>\r\n      </TR>\r\n     </TABLE>\r\n    </TD>\r\n   </TR>\r\n  </TABLE>\r\n\r\n\r\n  <table border=0 width=100%>\r\n   <tr>\r\n    <td>\r\n     <table border=0 width=100%>\r\n      <tr>\r\n       <td nowrap>\r\n\r\n        <!-- GIZMOTAG : md_welcome : Begin -->\r\n        <GIZMOTAG NAME=\"md_welcome\">\r\n             <DIV><SPAN CLASS=tagWelcomeClass></SPAN><font class=welcome>Hello <b>Admin</b>.<BR></font>\r\n             <font class=welcomesub>(Not Admin? Click <a class=welcomesub href=\'\'>here</a>)</font>\r\n             </DIV>\r\n        </GIZMOTAG>\r\n        <!-- GIZMOTAG : md_welcome : End -->\r\n\r\n       </td>\r\n       <td width=100% align=center>\r\n\r\n        <!-- GIZMOTAG : md_date : Begin -->\r\n        <GIZMOTAG NAME=\"md_date\">\r\n             <DIV><SPAN CLASS=tagDateClass></SPAN>Sat Oct  6 20:09:37 2001</DIV>\r\n        </GIZMOTAG>\r\n        <!-- GIZMOTAG : md_date : End -->\r\n\r\n        <!-- GIZMOTAG : md_catname : Begin -->\r\n        <GIZMOTAG NAME=\"md_catname\">\r\n             <DIV><SPAN CLASS=tagCatNameClass></SPAN>Metadot Example Portal</DIV>\r\n        </GIZMOTAG>\r\n        <!-- GIZMOTAG : md_catname : End -->\r\n\r\n       </td>\r\n       <td nowrap>\r\n\r\n        <!-- GIZMOTAG : md_search : Begin -->\r\n        <GIZMOTAG NAME=\"md_search\">\r\n                <DIV><SPAN CLASS=tagSearchClass></SPAN>\r\n                <table cellpadding=0 cellspacing=0 border=0>\r\n                <tr><td nowrap align=right>\r\n                <form name=\'searchform\' action=\'\' method=\'post\'>\r\n                <input type=text onfocus=\"searchform.filter.value=\'\'\" size=\'10\' name=\'filter\' value=\'Search\'>\r\n                <input type=submit value=\'Go\'>\r\n                <input type=hidden name=op value=search>\r\n                <input type=hidden name=isa value=Portal>\r\n                </form></td></tr></table>\r\n                </DIV>\r\n        </GIZMOTAG>\r\n        <!-- GIZMOTAG : md_search : End -->\r\n\r\n       </td>\r\n      </tr>\r\n     </table>\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td>\r\n     <table border=0 width=100%>\r\n      <tr>\r\n       <td>\r\n\r\n        <!-- GIZMOTAG : md_catpath : Begin -->\r\n        <GIZMOTAG NAME=\"md_catpath\">\r\n                <DIV><SPAN CLASS=tagCatPathClass></SPAN><B>Home</B> <a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/del.gif\' width=11 height=11 border=0 alt=\'Delete Me!\'></a>\r\n                </DIV>\r\n        </GIZMOTAG><!-- GIZMOTAG : md_catpath : End --></td>\r\n       <td align=right bgcolor=\"FFFFFF\"><gizmotag name=\"md_adminbar\">admin bar here</gizmotag></td>\r\n      </tr>\r\n      <tr>\r\n       <td colspan=2>\r\n\r\n        <!-- GIZMOTAG : md_h_topnav : Begin -->\r\n        <GIZMOTAG NAME=\"md_h_topnav\">\r\n                <DIV><SPAN CLASS=tagTopNavClass></SPAN>\r\n                <table border=0  bgcolor=\'#FF0000\' width=\'100%\' cellpadding=0 cellspacing=0><tr><td align=center>\r\n                <table border=0 cellpadding=4 cellspacing=0><tr><td>\r\n                <a class=catheader href=\'\'>Products</a>\r\n                <a class=catheader href=\'\'>IT Center</a>\r\n                <a class=catheader href=\'\'>Clients</a>\r\n                <a class=catheader href=\'\'>People</a>\r\n                <a class=catheader href=\'\'>Discussions</a>\r\n                <a class=catheader href=\'\'>Contact</a>\r\n                </td></tr></table>\r\n                </td></tr></table>\r\n                </DIV>\r\n        </GIZMOTAG>\r\n        <!-- GIZMOTAG : md_h_topnav : End -->\r\n\r\n       </td>\r\n      </tr>\r\n     </table>\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td>\r\n     <table border=0 width=100%>\r\n      <tr>\r\n       <td valign=top>\r\n\r\n        <!-- GIZMOTAG : md_v_subnav : Begin -->\r\n        <GIZMOTAG NAME=\"md_v_subnav\">\r\n                <DIV><SPAN CLASS=tagSubNavClass></SPAN><table border = 0 cellpadding = 0 cellspacing = 0><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n                </nobr></td><td><a class=catlistsub href=\'\'>Products</a></td></tr></table></td></tr><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n                </nobr></td><td><a class=catlistsub href=\'\'>IT Center</a></td></tr></table></td></tr><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n                </nobr></td><td><a class=catlistsub href=\'\'>Clients</a></td></tr></table></td></tr><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n                </nobr></td><td><a class=catlistsub href=\'\'>People</a></td></tr></table></td></tr><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'
 4046 ../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n                </nobr></td><td><a class=catlistsub href=\'\'>Discussions</a></td></tr></table></td></tr><tr><td nowrap valign = top> </td><td><table cellpadding = 0 cellspacing = 2 border = 0><tr><td valign = top><nobr><a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n
 4047     <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n                </nobr></td><td><a class=catlistsub href=\'\'>Contact</a></td></tr></table></td></tr></table></DIV>\r\n        </GIZMOTAG>\r\n        <!-- GIZMOTAG : md_v_subnav : End -->\r\n\r\n       </td>\r\n       <td valign=top>\r\n        <table border=0 width=100%>\r\n         <tr>\r\n          <td>\r\n\r\n           <!-- GIZMOTAG : md_catdesc : Begin -->\r\n           <GIZMOTAG NAME=\"md_catdesc\">\
 4048 r\n                <DIV><SPAN CLASS=tagCatDescClass></SPAN><table border=\"0\" cellpadding=\"5\">\r\n                <tr>\r\n                <td valign=\"top\">\r\n                <h2><img src=\"../images/portal_6.jpg\" width=\"200\" height=\"141\"></h2>\r\n                </td>\r\n                <td valign=\"top\">\r\n                <table border=\"0\" cellpadding=\"5\">\r\n                <tr>\r\n                <td>\r\n                <h2><font color=\"#000066\">Welcome to the example Metadot<br>\r\n                Site</font></h2>\r\n                </td>\r\n                </tr>\r\n                <tr>\r\n                <td>\r\n                <p> </p>\r\n                <p>See the <a href=\"\">developers\' site</a> for resources for the <a href=\"\">Metadot</a>\r\n                MetaCenter\'s  developers. </p>\r\n                </td>\r\n                </tr>\r\n                </table>\r\n
 4049  </td>\r\n                </tr>\r\n                <tr>\r\n                <td colspan=\"2\">\r\n                <p>General information about your company can go in this central area.\r\n                </td>\r\n                </tr>\r\n                </table>\r\n                </DIV>\r\n           </GIZMOTAG>\r\n           <!-- GIZMOTAG : md_catdesc : End -->\r\n\r\n          </td>\r\n         </tr>\r\n         <tr>\r\n          <td>\r\n\r\n           <!-- GIZMOTAG : md_gizmolist : Begin -->\r\n           <GIZMOTAG NAME=\"md_gizmolist\">\r\n                <DIV><SPAN CLASS=tagGizmoListClass></SPAN><!-- ImageItem List -->\r\n                <p><br>\r\n                <div  class=catlistsub> <h3>Metadot Example Portal Image Items</h3></div>\r\n                <LI> <a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/del.gif\' width=11 height=11 border=0 alt=\'Delete Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n                <a href=\'\'>test image 1:</a>\r\n                <a href=\'\'><img src=\"../images/index.gif\" border=0 align=top vspace=5  alt=\"\" ></a>\r\n                <br><br></li>\r\n                <p><br>\r\n                <div  class=catlistsub> <h3>Metadot Example Portal Items</h3></div>\r\n                <TABLE BORDER=0 CELLSPACING=0><TR VALIGN=BOTTOM><TD ALIGN=LEFT><img ALIGN=MIDDLE src=\'../images/square.gif\'></TD><TD NOWRAP><a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/del.gif\' width=11 height=11 border=0 alt=\'Delete Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n                </TD><TD NOWRAP><B>test item 1</B></TD><TD ALIGN=LEFT VALIGN=BOTTOM><img SRC=\'../images/star.gif\' width=\'15\' height=\'16\' border=\'0\'>\r\n                </TD><TD WIDTH=100%> </TD></TR>\r\n                <TR VALIGN=TOP><TD> </TD><TD COLSPAN=4 CLASS=centerNewsItem>bla bla bla</TD></TR>\r\n                </TABLE><TABLE BORDER=0 CELLSPACING=0><TR VALIGN=BOTTOM><TD ALIGN=LEFT><img ALIGN=MIDDLE src=\'../images/square.gif\'></TD><TD NOWRAP><a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/del.gif\' width=11 height=11 border=0 alt=\'Delete Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/uparrow.gif\' width=11 height=11 border=0 alt=\'Up\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/downarrow.gif\' width=11 height=11 border=0 alt=\'Down\'></a>\r\n                </TD><TD NOWRAP><a href=\"\" CLASS=centerNewsTitle>test item2</a></TD><TD ALIGN=LEFT VALIGN=BOTTOM><img SRC=\'../images/star.gif\' width=\'15\' height=\'16\' border=\'0\'>\r\n                </TD><TD NOWRAP ALIGN=LEFT VALIGN=BOTTOM> <a href=\'\'><img align=bottom src=\"../images/text.jpg\" border=0 align=center alt=\'Download Me!\' width=\"16\" height=\"16\"></a> <a href=\'\'><span class=centerNewsLink>download</span></a> </TD><TD CLASS=centerNewsLink NOWRAP>- http://www.yahoo.fr</TD><TD WIDTH=100%> </TD></TR>\r\n                <TR VALIGN=TOP><TD> </TD><TD COLSPAN=6 CLASS=centerNewsItem>mon yahoo en francais</TD></TR>\r\n                </TABLE>\r\n                </DIV>\r\n           </GIZMOTAG>\r\n           <!-- GIZMOTAG : md_gizmolist : End -->\r\n\r\n          </td>\r\n         </tr>\r\n        </table>\r\n       </td>\r\n       <td valign=top>\r\n\r\n        <!-- GIZMOTAG : md_newscol : Begin -->\r\n        <GIZMOTAG NAME=\"md_newscol\">\r\n                <DIV><SPAN CLASS=tagNewsColClass></SPAN>\r\n                <table width=155 border=0 bgcolor=\'#FF0000\' cellpadding=3 cellspacing=0>\r\n                <tr><td valign=top align=center>\r\n                <table border=\'0\' cellspacing=0 cellpadding=5 width=150>\r\n                <tr>\r\n                <td bgcolor=\'#6699cc\' class=\'newscattitle\' align=center>\r\n                Metadot Example Portal News</td></tr></table>\r\n                </td></tr>\r\n                <tr><td valign=top>\r\n                <a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n                <a href=\'\'><img src=\'../images/obj/del.gif\' width=11 height=11 border=0 alt=\'Delete Me!\'></a>\r\n                <table cellpadding=0 cellspacing=0><tr><td class=newsitemtitle>- <a class=newsitemtitle href=\'\'>2-For-1 Split Announced</a>\r\n                </td></tr>\r\n                <tr><td class=newsitem>Laser Computer announces a 2-1 stock split.<br> </td></tr></table>\r\n                </td></tr>\r\n                <tr><td valign=top align=center>\r\n                <A HREF=\'\'>\r\n                <IMG SRC=\'../images/addchannel.gif\' BORDER=\'0\' ALT=\'Add to MyPage\'></A>\r\n                </td></tr>\r\n                </table>\r\n                </DIV>\r\n        </GIZMOTAG>\r\n     <br>\r\n        <gizmotag name=\"md_poll\">\r\n Here is where the poll is placed.\r\n   </gizmotag>\r\n        <!-- GIZMOTAG : md_newscol : End -->\r\n\r\n       </td>\r\n      </tr>\r\n     </table>\r\n    </td>\r\n   </tr>\r\n  </table>\r\n  <table width=100% border=0>\r\n   <tr>\r\n    <td width=30%>\r\n\r\n    </td>\r\n    <td width=40% align=center>\r\n     <font face=\"Arial, Helvetica, sans-serif\" size=-1>\r\n      <A HREF=#top>Top</a>\r\n     </td>\r\n     <td width=30% align=right>\r\n      <a href=\"http://www.metadot.com\"><img src=\"/images/powered2.gif\" border=0></a>\r\n     </td>\r\n    </tr>\r\n   </table>\r\n\r\n\r\n </BODY>\r\n\r\n</HTML>\r\n";
 4050     return $utilitytemplate;
 4051 }
 4052 
 4053 #  sub _get_utility_template2 {
 4054 
 4055 #      my $template = "<HTML>\r\n\r\n <HEAD>\r\n\r\n        <STYLE TYPE=\"text/css\">\r\n        BODY, DIV, P, B, A, TD, TR, TH, TABLE, UL, LI, OPTION,INPUT, SELECT\r\n        {font-family: Verdana, Helvetica,Arial,sans-serif; font-size: 12pt; color: 333333;}\r\n        H1, H2, H3, H4, H5, H6 {font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 14pt;}\r\n        .AdminText, .AdminText:visited  {font-family: Helvetica, Verdana,Arial,sans-serif; text-decoration: none; font-size: 8pt; color: green;}\r\n\r\n\r\n        A {color: 003366;}\r\n        A:visited {color: 003366;}\r\n        A:active {color: 336633;}\r\n        A:hover {color: ff6600;}\r\n\r\n        .AdminText:hover {color: red; text-decoration: underline}\r\n\r\n        .welcomesub {font-style: italic; font-size: 8pt}\r\n\r\n        .catheader { font-family: Helvetica, Verdana,Arial,sans-serif; font-size: 12pt; color:  white;}\r\n        a.catheader {text-decoration: none;}\r\n        a.catheader:visited {color:  white; text-decoration: none;}\r\n        a.catheader:hover {color:ff6600; text-decoration: underline;}\r\n        a.catheader:active {color:ff6600; text-decoration: underline;}\r\n\r\n        .catlistmain { font-family: Helvetica, Arial,sans-serif; font-size: 12pt; font-weight: bold;}\r\n        .catlistsub { font-family: Helvetica, Arial, sans-serif; font-size: 12pt;}\r\n        .newscattitle{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; font-weight: bold; color: ffffff; }\r\n        .newsitemtitle{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; font-weight: bold}\r\n        .newsitem{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; }\r\n        .prevnextbar, .prevnextbar:visited { font-family: Helvetica,Arial,Helvetica,sans-serif;\r\n        font-size: 12pt; font-weight: bold; color: cc6633;}\r\n        .toollink, .toollink:visited  {font-family: Helvetica,Verdana,Arial,Helvetica,sans-serif; text-decoration: none; font-size: 8pt; font-weight: bold; color: 444444;}\r\n        .toollink:active{color: ff6600; text-decoration: underline;}\r\n        .toollink:hover {color:ff6600; text-decoration: underline;}\r\n        .mypage, .mypage:visited  {font-family: times; text-decoration: none; font-size: 12pt; font-weight: bold; color: ff6600;}\r\n        .mypage:active{color: ff6600; text-decoration: underline;}\r\n        .mypage:hover {color:ff6600; text-decoration: underline;}\r\n        .calendar { font-family: Helvetica, Verdana,Arial,sans-serif; font-size: 10pt; color: black;}\r\n        .calendarselected { font-family: Helvetica, Verdana,Arial,sans-serif; font-size: 10pt; color: blue;}\r\n         a.calendar:visited {color: black; text-decoration: underline;}\r\n\r\n        </style>\r\n\r\n\r\n  <META NAME=\"Generator\" CONTENT=\"MetaDot Portal Server;www.metadot.com\">\r\n  <META HTTP-EQUIV=\"Window-target\" CONTENT=\"_top\">\r\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n\r\n  <TITLE>MetaDot Developers\' Site</title>\r\n\r\n </head>\r\n\r\n <BODY bgcolor=#FFFFFF>\r\n  <TABLE WIDTH=\"100%\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">\r\n   <TR VALIGN=\"bottom\">\r\n    <TD ALIGN=\"LEFT\" VALIGN=\"bottom\">\r\n     <A href = \"index.pl\"><IMG src = \"../images/metadot_3.25_standard.jpg\" border = \"0\"></a>\r\n    </td>\r\n    <TD ALIGN=\"right\" VALIGN=\"bottom\" nowrap>\r\n\r\n\r\n<GIZMOTAG NAME=\"md_links_panel\">\r\n</GIZMOTAG>\r\n\r\n    </td>\r\n   </tr>\r\n  </table>\r\n\r\n  <table border=0 width=100%>\r\n   <tr>\r\n    <td>\r\n     <table border=0 width=100%>\r\n      <tr>\r\n       <td nowrap>\r\n\r\n        <!-- GIZMOTAG : md_welcome : Begin -->\r\n        <GIZMOTAG NAME=\"md_welcome\">\r\n             <DIV><SPAN CLASS=tagWelcomeClass></span><font class=welcome>Hello <b>Admin</b>.<BR></font>\r\n             <font class=welcomesub>(Not Admin? Click <a class=welcomesub href=\'\'>here</a>)</font>\r\n             </div>\r\n        </GIZMOTAG>\r\n        <!-- GIZMOTAG : md_welcome : End -->\r\n       </td>\r\n\r\n       <td width=100% align=center>\r\n        <!-- GIZMOTAG : md_date : Begin -->\r\n        <GIZMOTAG NAME=\"md_date\">\r\n             <DIV><SPAN CLASS=tagDateClass></span>Sat Oct  6 20:09:37 2001</div>\r\n        </GIZMOTAG>\r\n        <!-- GIZMOTAG : md_date : End -->\r\n\r\n        <!-- GIZMOTAG : md_catname : Begin -->\r\n        <GIZMOTAG NAME=\"md_catname\">\r\n             <DIV><SPAN CLASS=tagCatNameClass></span>Metadot Example Portal</div>\r\n        </GIZMOTAG>\r\n        <!-- GIZMOTAG : md_catname : End -->\r\n       </td>\r\n       <td nowrap>\r\n\r\n        <!-- GIZMOTAG : md_search : Begin -->\r\n        <GIZMOTAG NAME=\"md_search\">\r\n        search box goes here..\r\n        </GIZMOTAG>\r\n        <!-- GIZMOTAG : md_search : End -->\r\n       </td>\r\n      </tr>\r\n     </table>\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td>\r\n     <table border=0 width=100%>\r\n      <tr>\r\n       <td>\r\n\r\n        <!-- GIZMOTAG : md_catpath : Begin -->\r\n        <GIZMOTAG NAME=\"md_catpath\">\r\n               category path content..\r\n             </GIZMOTAG><!-- GIZMOTAG : md_catpath : End --></td>\r\n\r\n       <td align=right bgcolor=\"FFFFFF\"><gizmotag name=\"md_adminbar\">\r\n       admin bar here\r\n       </gizmotag></td>\r\n      </tr>\r\n      <tr>\r\n       <td colspan=2>\r\n\r\n       </td>\r\n      </tr>\r\n     </table>\r\n\r\n    </td>\r\n   </tr>\r\n   <tr>\r\n    <td>\r\n     <table border=0 width=100%>\r\n      <tr>\r\n       <td valign=top>\r\n\r\n\r\n       </td>\r\n       <td valign=top>\r\n        <table border=0 width=100%>\r\n         <tr>\r\n          <td>\r\n\r\n           <!-- GIZMOTAG : md_catdesc : Begin -->\r\n           <GIZMOTAG NAME=\"md_catdesc\">\r\n           <p> This is the category description content</p>\r\n           </GIZMOTAG>\r\n           <!-- GIZMOTAG : md_catdesc : End -->\r\n\r\n          </td>\r\n         </tr>\r\n         <tr>\r\n\r\n          <td>\r\n\r\n\r\n          </td>\r\n         </tr>\r\n        </table>\r\n       </td>\r\n       <td valign=top>\r\n\r\n\r\n\r\n       </td>\r\n      </tr>\r\n     </table>\r\n    </td>\r\n   </tr>\r\n  </table>\r\n\r\n  <table width=100% border=0>\r\n   <tr>\r\n    <td width=30%>\r\n    </td>\r\n    <td width=40% align=center>\r\n     <font face=\"Arial, Helvetica, sans-serif\" size=-1>\r\n      <A HREF=#top>Top</a>\r\n     </td>\r\n     <td width=30% align=right>\r\n      <a href=\"http://www.metadot.com\"><img src=\"/images/powered2.gif\" border=0></a>\r\n     </td>\r\n    </tr>\r\n   </table>\r\n\r\n\r\n   <!-- Clipboard -->\r\n   <center>\r\n   <gizmotag name=\"md_clipboard\">\r\n       Here is where the clipboard is placed.\r\n   </gizmotag>\r\n   </center>\r\n\r\n </body>\r\n</html>\r\n";
 4056 
 4057 #      return $template;
 4058 #  }
 4059 
 4060 sub _get_subtemplate {
 4061     my $subtemplate = "<HTML>\r\n\r\n
 4062     <HEAD>\r\n\r\n
 4063     <STYLE TYPE=\"text/css\">\r\n
 4064     BODY, DIV, P, B, A, TD, TR, TH, TABLE, UL, LI, OPTION,INPUT, SELECT\r\n
 4065     {font-family: Verdana, Helvetica,Arial,sans-serif; font-size: 12pt; color: 333333;}\r\n
 4066     H1, H2, H3, H4, H5, H6 {font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 14pt;}\r\n
 4067     .AdminText, .AdminText:visited  {font-family: Helvetica, Verdana,Arial,sans-serif; text-decoration: none; font-size: 8pt; color: green;}\r\n\r\n
 4068     A {color: 003366;}\r\n
 4069     A:visited {color: 003366;}\r\n
 4070     A:active {color: 336633;}\r\n
 4071     A:hover {color: ff6600;}\r\n\r\n
 4072     .AdminText:hover {color: red; text-decoration: underline}\r\n\r\n
 4073     .welcomesub {font-style: italic; font-size: 8pt}\r\n\r\n
 4074     .catheader { font-family: Helvetica, Verdana,Arial,sans-serif; font-size: 12pt; color:  white;}\r\n
 4075     a.catheader {text-decoration: none;}\r\n
 4076     a.catheader:visited {color:  white; text-decoration: none;}\r\n
 4077     a.catheader:hover {color:ff6600; text-decoration: underline;}\r\n
 4078     a.catheader:active {color:ff6600; text-decoration: underline;}\r\n\r\n
 4079     .catlistmain { font-family: Helvetica, Arial,sans-serif; font-size: 12pt; font-weight: bold;}\r\n
 4080     .catlistsub { font-family: Helvetica, Arial, sans-serif; font-size: 12pt;}\r\n\r\n
 4081     .newscattitle{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; font-weight: bold; color: ffffff; }\r\n\r\n
 4082     .newsitemtitle{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; font-weight: bold}\r\n\r\n
 4083     .newsitem{ font-family: Helvetica, Arial,Helvetica,sans-serif; font-size: 10pt; }\r\n\r\n
 4084     .prevnextbar, .prevnextbar:visited { font-family: Helvetica,Arial,Helvetica,sans-serif;\r\n
 4085     font-size: 12pt; font-weight: bold; color: cc6633;}\r\n\r\n
 4086     .toollink, .toollink:visited  {font-family: Helvetica,Verdana,Arial,Helvetica,sans-serif; text-decoration: none; font-size: 8pt; font-weight: bold; color: 444444;}\r\n\r\n
 4087     .toollink:active{color: ff6600; text-decoration: underline;}\r\n\r\n
 4088     .toollink:hover {color:ff6600; text-decoration: underline;}\r\n\r\n
 4089     .mypage, .mypage:visited  {font-family: times; text-decoration: none; font-size: 12pt; font-weight: bold; color: ff6600;}\r\n\r\n
 4090     .mypage:active{color: ff6600; text-decoration: underline;}\r\n\r\n
 4091     .mypage:hover {color:ff6600; text-decoration: underline;}\r\n
 4092     </style>\r\n\r\n
 4093     <META NAME=\"Generator\" CONTENT=\"MetaDot Portal Server;www.metadot.com\">\r\n
 4094     <META HTTP-EQUIV=\"Window-target\" CONTENT=\"_top\">\r\n
 4095     <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\r\n\r\n
 4096     <TITLE>MetaDot Developers\' Site</TITLE>\r\n
 4097     <script language=\"JavaScript\">\r\n
 4098     <!--\r\n\r\n
 4099     var session_cookie = document.cookie;\r\n
 4100     var cookie_string = \"sessionid=; uid=\";\r\n
 4101     var ie_cookie_string = \"sessionid; uid\";\r\n
 4102     var empty_string = \"\";\r\n
 4103     function newImage(arg) {\r\n
 4104     if (document.images) {\r\n
 4105     rslt = new Image();\r\n
 4106     rslt.src = arg;\r\n
 4107     return rslt;\r\n
 4108     }\r\n
 4109     }\r\n\r\n
 4110     function changeImages() {\r\n
 4111     if (document.images && (preloadFlag == true)) {\r\n
 4112     for (var i=0; i<changeImages.arguments.length; i+=2) {\r\n
 4113     document[changeImages.arguments[i]].src = changeImages.arguments[i+1];\r\n
 4114     }\r\n
 4115     }\r\n
 4116     }\r\n\r\n
 4117     var preloadFlag = false;\r\n
 4118     function preloadImages() {\r\n
 4119     if (document.images) {\r\n
 4120     register_over = newImage(\"../images/navbar/register_over_new.gif\");\r\n
 4121     register = newImage(\"../images/navbar/register_new.gif\");\r\n
 4122     login = newImage(\"../images/navbar/login_new.gif\");\r\n
 4123     login_over = newImage(\"../images/navbar/login_over_new.gif\");\r\n
 4124     logout = newImage(\"../images/navbar/logout_new.gif\");\r\n
 4125     logout_over = newImage(\"../images/navbar/logout_over_new.gif\");\r\n
 4126     profile = newImage(\"../images/navbar/profile_new.gif\");\r\n
 4127     profile_over = newImage(\"../images/navbar/profile_over_new.gif\");\r\n
 4128     preloadFlag = true;\r\n
 4129     }\r\n
 4130     }\r\n\r\n
 4131     // -->\r\n
 4132     </script>\r\n
 4133     </HEAD>\r\n\r\n\r\n\r\n\r\n\r\n
 4134     <BODY bgcolor=#FFFFFF>\r\n
 4135     <SCRIPT>\r\n
 4136     preloadImages();\r\n
 4137     </SCRIPT>\r\n
 4138     <TABLE WIDTH=\"100%\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">\r\n
 4139     <TR VALIGN=\"bottom\">\r\n
 4140     <TD ALIGN=\"LEFT\" VALIGN=\"bottom\">\r\n
 4141     <A href = \"index.pl\"><IMG src = \"../images/metadot_3.25_standard.jpg\" border = \"0\"></A>\r\n
 4142     </TD>\r\n
 4143     <TD ALIGN=\"right\" VALIGN=\"bottom\" nowrap>\r\n
 4144     <TABLE border=0 cellpadding=0 cellspacing=0>\r\n
 4145     <TR VALIGN=\"bottom\">\r\n
 4146     <TD valign=\"bottom\">\r\n
 4147     <a href=\"index.pl?isa=User&op=register_form\" onmouseover=\"changeImages(\'register\',\'../images/navbar/register_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'register\', \'../images/navbar/register_new.gif\'); return true;\"><img name=\"register\" src=\"../images/navbar/register_new.gif\" width=70 height=14 border=0></a>\r\n
 4148     <a href=\"index.pl?isa=Session&op=login\" onmouseover=\"changeImages(\'login\',\'../images/navbar/login_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'login\', \'../images/navbar/login_new.gif\'); return true;\"><img name=\"login\" src=\"../images/navbar/login_new.gif\" width=70 height=14 border=0></a>\r\n
 4149     <a href=\"index.pl?isa=Session&op=logout\" onmouseover=\"changeImages(\'logout\',\'../images/navbar/logout_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'logout\', \'../images/navbar/logout_new.gif\'); return true;\"><img name=\"logout\" src=\"../images/navbar/logout_new.gif\" width=70 height=14 border=0></a>\r\n
 4150     <a href=\"index.pl?isa=User&op=modify_self\" onmouseover=\"changeImages(\'profile\',\'../images/navbar/profile_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'profile\', \'../images/navbar/profile_new.gif\'); return true;\"><img name=\"profile\" src=\"../images/navbar/profile_new.gif\" width=70 height=14 border=0></a>\r\n
 4151     <A href=\"index.pl?isa=Portal&op=myportal\" onmouseover=\"changeImages(\'my_projects\', \'../images/navbar/my_projects_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'my_projects\', \'../images/navbar/my_projects_new.gif\'); return true;\"><IMG name=\"my_projects\" src=\"../images/navbar/my_projects_new.gif\" width=70 height=14 border=0></A>\r\n
 4152     <A href=\"userchannel.pl\" onmouseover=\"changeImages(\'my_page\', \'../images/navbar/my_page_over_new.gif\'); return true;\" onmouseout=\"changeImages(\'my_page\', \'../images/navbar/my_page_new.gif\'); return true;\"><IMG name=\"my_page\" src=\"../images/navbar/my_page_new.gif\" width=70 height=14 border=0></A>\r\n
 4153     </TD>\r\n
 4154     </TR>\r\n
 4155     </TABLE>\r\n
 4156     </TD>\r\n
 4157     </TR>\r\n
 4158     </TABLE>\r\n\r\n\r\n
 4159     <table border=0 width=100%>\r\n
 4160     <tr>\r\n
 4161     <td>\r\n
 4162     <table border=0 width=100%>\r\n
 4163     <tr>\r\n
 4164     <td nowrap>\r\n\r\n
 4165     <!-- GIZMOTAG : md_welcome : Begin -->\r\n
 4166     <GIZMOTAG NAME=\"md_welcome\">\r\n
 4167     <DIV><SPAN CLASS=tagWelcomeClass></SPAN><font class=welcome>Hello <b>Admin</b>.<BR></font>\r\n
 4168     <font class=welcomesub>(Not Admin? Click <a class=welcomesub href=\'\'>here</a>)</font>\r\n
 4169     </DIV>\r\n
 4170     </GIZMOTAG>\r\n
 4171     <!-- GIZMOTAG : md_welcome : End -->\r\n\r\n
 4172     </td>\r\n
 4173     <td width=100% align=center>\r\n\r\n
 4174     <!-- GIZMOTAG : md_date : Begin -->\r\n
 4175     <GIZMOTAG NAME=\"md_date\">\r\n
 4176     <DIV><SPAN CLASS=tagDateClass></SPAN>Sat Oct  6 20:09:37 2001</DIV>\r\n
 4177     </GIZMOTAG>\r\n
 4178     <!-- GIZMOTAG : md_date : End -->\r\n\r\n
 4179     <!-- GIZMOTAG : md_catname : Begin -->\r\n
 4180     <GIZMOTAG NAME=\"md_catname\">\r\n
 4181     <DIV><SPAN CLASS=tagCatNameClass></SPAN>Metadot Example Portal</DIV>\r\n
 4182     </GIZMOTAG>\r\n
 4183     <!-- GIZMOTAG : md_catname : End -->\r\n\r\n
 4184     </td>\r\n
 4185     <td nowrap>\r\n\r\n
 4186     <!-- GIZMOTAG : md_search : Begin -->\r\n
 4187     <GIZMOTAG NAME=\"md_search\">\r\n
 4188     <DIV><SPAN CLASS=tagSearchClass></SPAN>\r\n
 4189     <table cellpadding=0 cellspacing=0 border=0>\r\n
 4190     <tr><td nowrap align=right>\r\n
 4191     <form name=\'searchform\' action=\'\' method=\'post\'>\r\n
 4192     <input type=text onfocus=\"searchform.filter.value=\'\'\" size=\'10\' name=\'filter\' value=\'Search\'>\r\n
 4193     <input type=submit value=\'Go\'>\r\n
 4194     <input type=hidden name=op value=search>\r\n
 4195     <input type=hidden name=isa value=Portal>\r\n
 4196     </form></td></tr></table>\r\n
 4197     </DIV>\r\n
 4198     </GIZMOTAG>\r\n
 4199     <!-- GIZMOTAG : md_search : End -->\r\n\r\n
 4200     </td>\r\n
 4201     </tr>\r\n
 4202     </table>\r\n
 4203     </td>\r\n
 4204     </tr>\r\n
 4205     <tr>\r\n
 4206     <td>\r\n
 4207     <table border=0 width=100%>\r\n
 4208     <tr>\r\n
 4209     <td>\r\n\r\n
 4210     <!-- GIZMOTAG : md_catpath : Begin -->\r\n
 4211     <GIZMOTAG NAME=\"md_catpath\">\r\n
 4212     <DIV><SPAN CLASS=tagCatPathClass></SPAN><B>Home</B> <a href=\'\'><img src=\'../images/obj/edit.gif\' width=25 height=11 border=0 alt=\'Edit Me!\'></a>\r\n
 4213     <a href=\'\'><img src=\'../images/obj/ac.gif\' width=24 height=11 border=0 alt=\'Change Access Rights!\'></a>\r\n
 4214     <a href=\'\'><img src=\'../images/obj/cut.gif\' width=22 height=11 border=0 alt=\'Cut Me!\'></a>\r\n
 4215     <a href=\'\'><img src=\'../images/obj