Changeset 19 for trunk/bin


Ignore:
Timestamp:
Nov 14, 2005 6:22:44 AM (19 years ago)
Author:
scdev
Message:

Rebuilt the services/admins.php script and templates. Fixes since v2 conversion. Lots of bugs and more to come!

Location:
trunk/bin/module_maker
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/_config.inc.php

    r18 r19  
    66$common_base = realpath($_SERVER['argv'][1]);
    77
    8 
    9 if (2 == $_SERVER['argc'] && '' != $common_base && is_dir($common_base)) {
     8// Test argument.
     9if ($_SERVER['argc'] > 1 && '' != $common_base && is_dir($common_base)) {
    1010    // First arg is path to current site. Realpath removes trailing /s
    1111    define('COMMON_BASE', $common_base);
    1212} else {
    13     die("Error: Single argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n");
     13    die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n");
     14}
     15
     16// Make sure necessary files exist.
     17if (!file_exists(COMMON_BASE . '/global/db_auth.inc.php')) {
     18    die("Error: First argument directory must contain the global/db_auth.inc.php file with valid MySQL credentials.\n");
    1419}
    1520
  • trunk/bin/module_maker/form_template.cli.php

    r18 r19  
    3333}
    3434
    35 $exclude = array('added_by_admin_id', 'added_datetime', 'hit_count', 'modified_datetime', 'modified_by_admin_id');
     35$exclude = array('added_by_user_id', 'added_datetime', 'hit_count', 'modified_datetime', 'modified_by_user_id');
    3636$primary_key_field = '';
    3737$output = array();
  • trunk/bin/module_maker/list_template.cli.php

    r18 r19  
    8787        } else if (preg_match('/(amount|_rate)/i', $field)) {
    8888            $listrows[] = "<\x3fphp printf('$%01.2f', \$list[\$i]['$field']); \x3f>";
    89         } else if (preg_match('/(added_by_admin_id)/i', $field)) {
     89        } else if (preg_match('/(added_by_user_id)/i', $field)) {
    9090            $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['added_admin_username']); \x3f>";
    91         } else if (preg_match('/(modified_by_admin_id)/i', $field)) {
     91        } else if (preg_match('/(modified_by_user_id)/i', $field)) {
    9292            $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['modified_admin_username']); \x3f>";
    9393        } else if ('rank' == $field) {
     
    146146    <tr>
    147147        <td class="nowrap"><a title="<\x3fphp printf(_("Edit %s"), oTxt(\$list[\$i]['______RECORD_NAME______'])) \x3f>" href="<\x3fphp echo App::oHREF(\$_SERVER['PHP_SELF'] . '?op=edit&$primary_key=' . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
    148         <td class="nowrap"><a title="<\x3fphp printf(_("Versions of %s"), oTxt(\$list[\$i]['______RECORD_NAME______'])) \x3f>" href="<\x3fphp echo App::oHREF("/admin/record_versions.php?record_table=$db_tbl&record_key=$primary_key&boomerang=true&record_val=" . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
     148        <td class="nowrap"><a title="<\x3fphp printf(_("Versions of %s"), oTxt(\$list[\$i]['______RECORD_NAME______'])) \x3f>" href="<\x3fphp echo App::oHREF("/admin/versions.php?record_table=$db_tbl&record_key=$primary_key&boomerang=true&record_val=" . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
    149149
    150150E_O_F;
  • trunk/bin/module_maker/skel/adm_form.ihtml

    r18 r19  
    99    <tr>
    1010        <td>&nbsp;</td>
    11         <td valign="top">
    12         <?php if (!empty($frm['submit_caption'])) { ?><input type="submit" name="submit" value="<?php echo oTxt($frm['submit_caption']); ?>" /><?php } ?>
    13         <?php if (!empty($frm['repeat_caption'])) { ?><input type="submit" name="repeat" value="<?php echo oTxt($frm['repeat_caption']); ?>" /><?php } ?>
    14         <?php if (!empty($frm['reset_caption'])) { ?><input type="submit" name="reset" value="<?php echo oTxt($frm['reset_caption']); ?>" /><?php } ?>
    15         <?php if (!empty($frm['cancel_caption'])) { ?><input type="submit" name="cancel" value="<?php echo oTxt($frm['cancel_caption']); ?>" /><?php } ?>
    16         </td>
     11        <td valign="top"><?php printSubmitButtons($frm['submit_buttons']); ?></td>
    1712    </tr>
    1813%ADM_FORM_TABLE_ROWS%
    1914    <tr>
    2015        <td>&nbsp;</td>
    21         <td valign="top">
    22         <?php if (!empty($frm['submit_caption'])) { ?><input type="submit" name="submit" value="<?php echo oTxt($frm['submit_caption']); ?>" /><?php } ?>
    23         <?php if (!empty($frm['repeat_caption'])) { ?><input type="submit" name="repeat" value="<?php echo oTxt($frm['repeat_caption']); ?>" /><?php } ?>
    24         <?php if (!empty($frm['reset_caption'])) { ?><input type="submit" name="reset" value="<?php echo oTxt($frm['reset_caption']); ?>" /><?php } ?>
    25         <?php if (!empty($frm['cancel_caption'])) { ?><input type="submit" name="cancel" value="<?php echo oTxt($frm['cancel_caption']); ?>" /><?php } ?>
    26         </td>
     16        <td valign="top"><?php printSubmitButtons($frm['submit_buttons']); ?></td>
    2717    </tr>
    2818</table>
  • trunk/bin/module_maker/skel/adm_list.ihtml

    r18 r19  
    2727    <tr>
    2828        <td class="padleft nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['______RECORD_NAME______'])) ?>" href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/edit.gif" alt="Edit" width="14" height="18" border="0"></a> &nbsp;</td>
    29         <td class="padleft nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['______RECORD_NAME______'])) ?>" href="<?php echo App::oHREF('/admin/record_versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
     29        <td class="padleft nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['______RECORD_NAME______'])) ?>" href="<?php echo App::oHREF('/admin/versions.php?record_table=%DB_TBL%&record_key=%PRIMARY_KEY%&boomerang=true&record_val=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/_widgets/subcategory.gif" alt="" width="18" height="14" border="0" /></a> &nbsp;</td>
    3030%ADM_LIST_ROWS%
    3131        <td class="padleft nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['______RECORD_NAME______'])) ?>" href="<?php echo App::oHREF($_SERVER['PHP_SELF'] . "?op=del&%PRIMARY_KEY%=" . $list[$i]['%PRIMARY_KEY%']); ?>" onClick="javascript:return confirm('<?php printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt($list[$i]['______RECORD_NAME______'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0"></a> &nbsp;</td>
  • trunk/bin/module_maker/skel/admin.php

    r18 r19  
    217217
    218218    // Lock this record.
    219     $lock->set('%DB_TBL%', '%PRIMARY_KEY%', $id, $frm['address']);
     219    $lock->set('%DB_TBL%', '%PRIMARY_KEY%', $id, $frm['<##>']);
    220220   
    221221    // Set misc values for the form.
     
    277277
    278278    // Create version.
    279     $version = new RecordVersion();
     279    $version = new RecordVersion($GLOBALS['auth']);
    280280    $version->create('%DB_TBL%', '%PRIMARY_KEY%', $last_insert_id, $frm['<##>']);
    281281   
     
    300300       
    301301        // Create version.
    302         $version = new RecordVersion();
     302        $version = new RecordVersion($GLOBALS['auth']);
    303303        $version->create('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%'], $frm['<##>']);
    304304   
     
    349349            a2.username AS modified_admin_username
    350350        FROM %DB_TBL%
    351         LEFT JOIN admin_tbl a1 ON (%DB_TBL%.added_by_admin_id = a1.admin_id)
    352         LEFT JOIN admin_tbl a2 ON (%DB_TBL%.modified_by_admin_id = a2.admin_id)
     351        LEFT JOIN admin_tbl a1 ON (%DB_TBL%.added_by_user_id = a1.admin_id)
     352        LEFT JOIN admin_tbl a2 ON (%DB_TBL%.modified_by_user_id = a2.admin_id)
    353353        $where_clause
    354354        " . $so->getSortOrderSQL() . "
  • trunk/bin/module_maker/sql.cli.php

    r18 r19  
    7373            // Toggle types.
    7474            $c[$field] = "'\" . isset(\$frm['$field']) . \"'";
    75         } else if ('added_by_admin_id' == $field || 'modified_by_admin_id' == $field) {
     75        } else if ('added_by_user_id' == $field || 'modified_by_user_id' == $field) {
    7676            // Toggle types.
    7777            $c[$field] = "'\" . addslashes(\$auth->getVal('user_id')) . \"'";
     
    9494// Insert SQL.
    9595if (!isset($op) || 'insert' == $op) {
    96 $insert_skip_columns = array('modified_datetime', 'modified_by_admin_id');
     96$insert_skip_columns = array('modified_datetime', 'modified_by_user_id');
    9797$insert_c = array();
    9898foreach ($c as $k=>$v) {
     
    120120// Update SQL.
    121121if (!isset($op) || 'update' == $op) {
    122 $update_skip_columns = array('added_datetime', 'added_by_admin_id');
     122$update_skip_columns = array('added_datetime', 'added_by_user_id');
    123123$comma = '';
    124124$key_eq_val = '';
     
    181181// Search SQL
    182182if (!isset($op) || 'search' == $op) {
    183 $search_skip_columns = array('added_datetime', 'added_by_admin_id', 'modified_datetime', 'modified_by_admin_id', 'publish', 'featured');
     183$search_skip_columns = array('added_datetime', 'added_by_user_id', 'modified_datetime', 'modified_by_user_id', 'publish', 'featured');
    184184$search_columns = $db_tbl . '.' . join(" LIKE '%\" . addslashes(\$qry_words[\$i]) . \"%'\n                    OR $db_tbl.", array_diff(array_keys($c), $search_skip_columns));
    185185echo <<<E_O_F
  • trunk/bin/module_maker/validation.cli.php

    r18 r19  
    3434
    3535// Exclude these fields.
    36 $exclude = array('added_by_admin_id', 'added_datetime', 'hit_count', 'modified_datetime', 'modified_by_admin_id');
     36$exclude = array('added_by_user_id', 'added_datetime', 'hit_count', 'modified_datetime', 'modified_by_user_id');
    3737
    3838// Loop through columns
Note: See TracChangeset for help on using the changeset viewer.