Changeset 295 for trunk/bin


Ignore:
Timestamp:
Dec 16, 2007 7:21:57 AM (16 years ago)
Author:
quinn
Message:

Updated example config file. Added admin2.inc.css and minor corrections into HTML. Module maker fixes.

Location:
trunk/bin/module_maker
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/module_maker/form_template.cli.php

    r270 r295  
    6262        if (preg_match('/.*_id$/i', $field)) {
    6363            $output[$field] = <<<E_O_F
    64 
    65 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    66 <select name="$field" id="$field" class="sc-small"><\x3fphp printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', __///__)", '$field', \$frm['$field'], true, 'ORDER BY $field ASC'); \x3f></select>
    67     <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('__///__.php?op=add&boomerang=true'); \x3f>" onclick"javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo _("Add __///__") \x3f></a></span>
     64           
     65<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     66    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     67    <select name="$field" id="$field" class="sc-small"><\x3fphp printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', __///__)", '$field', \$frm['$field'], true, 'ORDER BY $field ASC'); \x3f></select>
     68    <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('__///__.php?op=add&boomerang=true'); \x3f>" onclick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>');"><\x3fphp echo _("Add __///__") \x3f></a></span>
    6869    <\x3fphp if ('' != \$frm['__///___id']) { \x3f>
    69     <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('__///__.php?op=edit&boomerang=true&__///___id=' . \$frm['__///___id']); \x3f>" onclick"javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>')"><\x3fphp echo sprintf(_("Edit __///__ <em>%s</em>"), \$frm['__///__']) \x3f></a></span>
     70        <span class="commanditem commandtext"><a href="<\x3fphp echo \$app->oHREF('__///__.php?op=edit&boomerang=true&__///___id=' . \$frm['__///___id']); \x3f>" onclick="javascript:return confirm('<\x3fphp echo _("Notice: You are about to leave this form page and any changes you may have made without saving will be lost."); \x3f>');"><\x3fphp echo sprintf(_("Edit __///__ <em>%s</em>"), \$frm['__///__']) \x3f></a></span>
    7071    <\x3fphp } \x3f>
     72</div>
    7173E_O_F;
    7274            continue;
     
    7779            $output[$field] = <<<E_O_F
    7880
    79 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    80 <input type="file" name="$field" id="$field" />
     81<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     82    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     83    <input type="file" name="$field" id="$field" />
    8184    <\x3fphp if ('' != \$upload->getFilenameGlob(getFormData('$primary_key') . '_*') && getFormData('op') == 'edit' || getFormData('op') == 'update') { \x3f>
    82     <div class="sc-help"><\x3fphp printf(_("The current file <a href=\"%s/%2\\\$s\"><strong>%2\\\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/__///__', \$upload->getFilenameGlob(getFormData('$primary_key') . '_*')) \x3f></div>
     85        <div class="sc-help"><\x3fphp printf(_("The current file <a href=\"%s/%2\\\$s\"><strong>%2\\\$s</strong></a> will be deleted if a new file is selected for upload."), '/_db_files/__///__', \$upload->getFilenameGlob(getFormData('$primary_key') . '_*')) \x3f></div>
    8386    <\x3fphp } \x3f>
    8487    <div class="sc-help"><\x3fphp printf(_("File to upload must have one of the following file-name extensions: %s."), join(', ', \$upload->getParam('valid_file_extensions'))) \x3f></div>
     88</div>
    8589E_O_F;
    8690            continue;
     
    9195            $output[$field] = <<<E_O_F
    9296
    93 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    94 <input type="password" class="sc-medium" size="50" name="$field" id="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
     97<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     98    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     99    <input type="password" name="$field" id="$field" class="sc-medium" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
     100</div>
    95101E_O_F;
    96102            continue;
     
    103109            $output[$field] = <<<E_O_F
    104110
    105 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    106 <select name="$field" id="$field"><\x3fphp printSetSelectForm('$db_tbl', '$field', \$frm['$field'], true); \x3f></select>
     111<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     112    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     113    <select name="$field" id="$field"><\x3fphp printSetSelectForm('$db_tbl', '$field', \$frm['$field'], true); \x3f></select>
     114</div>
    107115E_O_F;
    108116            break;
     
    112120            $output[$field] = <<<E_O_F
    113121
    114 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    115 <\x3fphp printSetCheckboxes('$db_tbl', '$field', \$frm['$field'], 1) \x3f>
     122<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     123    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     124    <\x3fphp printSetCheckboxes('$db_tbl', '$field', \$frm['$field'], 1) \x3f>
     125</div>
    116126E_O_F;
    117127            break;
     
    121131            $output[$field] = <<<E_O_F
    122132
    123 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    124 <input type="checkbox" name="$field" id="$field" <\x3fphp frmChecked(!empty(\$frm['$field'])) \x3f> /><label class="left"><\x3fphp echo _("Check this box to $title"); \x3f></label>
     133<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     134    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     135    <label><input type="checkbox" name="$field" id="$field" <\x3fphp frmChecked(!empty(\$frm['$field'])) \x3f> /><\x3fphp echo _("Check this box to $title"); \x3f></label>
     136</div>
    125137E_O_F;
    126138            break;
     
    132144            $output[$field] = <<<E_O_F
    133145
    134 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    135 <textarea class="sc-large sc-short" cols="75" rows="4" name="$field" id="$field"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
     146<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     147    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     148    <textarea name="$field" id="$field" rows="8" cols="40" class="sc-short sc-medium"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
     149</div>
    136150E_O_F;
    137151            break;
     
    144158            $output[$field] = <<<E_O_F
    145159
    146 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    147 <textarea class="sc-large sc-tall" cols="75" rows="4" name="$field" id="$field"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
     160<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     161    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     162    <textarea name="$field" id="$field" rows="8" cols="40" class="sc-short sc-medium"><\x3fphp echo oTxt(\$frm['$field']); \x3f></textarea>
     163</div>
    148164E_O_F;
    149165            break;
     
    170186            $output[$field] = <<<E_O_F
    171187
    172 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    173 <input type="text" class="sc-tiny" size="12" name="$field" id="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
     188<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     189    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     190    <input type="text" name="$field" id="$field" class="sc-tiny" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
     191</div>
    174192E_O_F;
    175193            break;
     
    184202            $output[$field] = <<<E_O_F
    185203
    186 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    187 <input type="text" class="sc-medium" size="25" name="$field" id="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
     204<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     205    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     206    <input type="text" name="$field" id="$field" class="sc-small" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
     207</div>
    188208E_O_F;
    189209            break;
     
    197217            $output[$field] = <<<E_O_F
    198218
    199 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label>
    200 <input type="text" class="sc-medium" size="50" name="$field" id="$field" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
     219<div class="sc-form-row<\x3fphp \$fv->err('$field'); \x3f>">
     220    <label for="$field"><\x3fphp echo _("$title"); \x3f></label>
     221    <input type="text" name="$field" id="$field" class="sc-medium" value="<\x3fphp echo oTxt(\$frm['$field']); \x3f>" />
     222</div>
    201223E_O_F;
    202224            break;
  • trunk/bin/module_maker/list_template.cli.php

    r270 r295  
    9090            $listrows[] = "<\x3fphp printf('$%01.2f', \$list[\$i]['$field']); \x3f>";
    9191        } else if (preg_match('/(added_by_user_id)/i', $field)) {
    92             $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['added_admin_username']); \x3f>";
     92            $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['added_by_username']); \x3f>";
    9393        } else if (preg_match('/(modified_by_user_id)/i', $field)) {
    94             $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['modified_admin_username']); \x3f>";
     94            $listrows[] = "<\x3fphp echo oTxt(\$list[\$i]['modified_by_username']); \x3f>";
    9595        } else if ('rank' == $field) {
    9696            $listrows[] = "<input type=\"text\" name=\"rank[<\x3fphp echo \$list[\$i]['$primary_key']; \x3f>]\" value=\"<\x3fphp echo \$list[\$i]['rank']; \x3f>\" size=\"5\" />";
     
    164164
    165165echo isset($op) ? '' : <<<E_O_F
    166         <td class="sc-nowrap" align="right"><a title="<\x3fphp printf(_("Delete %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . "?op=del&$primary_key=" . \$list[\$i]['$primary_key']); \x3f>" onclick"javascript:return confirm('<\x3fphp printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt(\$list[\$i]['__///__'])) \x3f>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
     166        <td class="sc-nowrap" align="right"><a title="<\x3fphp printf(_("Delete %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . "?op=del&$primary_key=" . \$list[\$i]['$primary_key']); \x3f>" onclick"javascript:return confirm('<\x3fphp printf(_("Are you sure you want to delete the record %s? This action is permanent and cannot be undone."), oTxt(\$list[\$i]['__///__'])) \x3f>');"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
    167167    </tr>
    168168    <\x3fphp } \x3f>
  • trunk/bin/module_maker/module.cli.php

    r259 r295  
    137137
    138138// Make sure requested table is in database.
     139if (!isset($tables)) {
     140    die(sprintf("%s Warning: %s does not exist in database %s. No DB tables found!", basename($_SERVER['argv'][0]), $db_tbl, $app->getParam('db_name')));
     141}
    139142if (!in_array($db_tbl, $tables)) {
    140143    die(sprintf("%s Warning: %s does not exist in database %s. Please select one of: \n\n%s\n\n", basename($_SERVER['argv'][0]), $db_tbl, $app->getParam('db_name'), join("\n", $tables)));
     
    207210
    208211$search['admin_form_tag_init'] = '/%ADMIN_FORM_TAG_INIT%/';
    209 $replace['admin_form_tag_init'] = '<form method="post" action="<\x3fphp echo \$_SERVER[\'PHP_SELF\']; \x3f>" class="sc-form">';
     212$replace['admin_form_tag_init'] = "<form method=\"post\" action=\"<\x3fphp echo oTxt(\$_SERVER['PHP_SELF']); \x3f>\" class=\"sc-form\">";
    210213$search['admin_upload_include'] = '/%ADMIN_UPLOAD_INCLUDE%/';
    211214$replace['admin_upload_include'] = '';
  • trunk/bin/module_maker/skel/adm_form.ihtml

    r136 r295  
    66<input type="hidden" name="%PRIMARY_KEY%" value="<?php echo $frm['%PRIMARY_KEY%']; ?>" />
    77
    8 <?php printSubmitButtons($frm['submit_buttons']); ?>
     8<div class="sc-form-row sc-submit-buttons">
     9    <?php printSubmitButtons($frm['submit_buttons']); ?>
     10</div>
    911
    1012%ADM_FORM_TABLE_ROWS%
    1113
    12 <?php printSubmitButtons($frm['submit_buttons']); ?>
     14<div class="sc-form-row sc-submit-buttons">
     15    <?php printSubmitButtons($frm['submit_buttons']); ?>
     16</div>
    1317</form>
  • trunk/bin/module_maker/skel/adm_list.ihtml

    r270 r295  
    33
    44<div id="commandbox">
    5 <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get">
    6 <?php $app->printHiddenSession(false); ?>
    75    <span class="sc-nowrap commandtext"><a href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=add'); ?>"><?php echo _("Add %ITEM_TITLE%"); ?></a></span>
    8     <br />
    9 
    10     <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: __///__ %SEARCH_FIELDS%.")); ?>" />
    11     <select name="filter___///__">
    12         <?php // printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', city, '&mdash;', title)", '__///___id', getFormData('filter___///__'), array('Any __///__'), 'ORDER BY __///__ ASC'); ?>
    13     </select>
    14     <input type="submit" value="<?php echo _("Search"); ?>" />
    15 </form>
     6    <form action="<?php echo oTxt($_SERVER['PHP_SELF']); ?>" method="get" class="sc-form">
     7        <?php $app->printHiddenSession(false); ?>
     8        <input type="text" class="sc-small" size="20" name="search_query" value="<?php echo getFormData('search_query'); ?>" title="<?php echo oTxt(_("Fields searched: __///__ %SEARCH_FIELDS%.")); ?>" />
     9        <select name="filter___///__" class="sc-small">
     10            <?php // printSelectForm('__///___tbl', "CONCAT(__///___id, '&mdash;', city, '&mdash;', title)", '__///___id', getFormData('filter___///__'), array('Any __///__'), 'ORDER BY __///__ ASC'); ?>
     11        </select>
     12        <input type="submit" value="<?php echo _("Filter"); ?>" />
     13    </form>
    1614</div>
    1715
     
    3129        <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Versions of %s"), oTxt($list[$i]['__///__'])) ?>" 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>
    3230%ADM_LIST_ROWS%
    33         <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['__///__'])) ?>" 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]['__///__'])) ?>')"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
     31        <td class="sc-padleft sc-nowrap" align="right"><a title="<?php printf(_("Delete %s"), oTxt($list[$i]['__///__'])) ?>" 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]['__///__'])) ?>');"><img src="/admin/_widgets/delete.gif" alt="Delete" width="16" height="17" border="0" /></a> &nbsp;</td>
    3432    </tr>
    3533    <?php } ?>
  • trunk/bin/module_maker/skel/admin.php

    r202 r295  
    203203        'new_op' => 'insert',
    204204        'submit_buttons' => array(
    205             'submit' => _("Add %ITEM_TITLE%"),
    206             'repeat' => _("Add &amp; repeat"),
    207             'cancel' => _("Cancel"),
     205            array('name' => 'submit', 'value' => _("Add %ITEM_TITLE%"), 'accesskey' => 's'),
     206            array('name' => 'repeat', 'value' => _("Add &amp; repeat"), 'accesskey' => 'r'),
     207            array('name' => 'cancel', 'value' => _("Cancel"), 'accesskey' => 'c'),
    208208        ),
    209209    );
     
    216216    global $lock;
    217217    $db =& DB::getInstance();
     218    $app =& App::getInstance();
    218219   
    219220    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
     
    242243        'new_op' => 'update',
    243244        'submit_buttons' => array(
    244             'submit' => _("Save changes"),
    245             'repeat' => _("Save &amp; edit next"),
    246             'reset' => _("Reset"),
    247             'cancel' => _("Cancel"),
     245            array('name' => 'submit', 'value' => _("Save changes"), 'accesskey' => 's'),
     246            array('name' => 'repeat', 'value' => _("Save & edit next"), 'accesskey' => 'e'),
     247            array('name' => 'reset', 'value' => _("Reset"), 'accesskey' => 'r'),
     248            array('name' => 'cancel', 'value' => _("Cancel"), 'accesskey' => 'c'),
    248249        ),
    249250    ), $frm);
     
    257258    global $cache;
    258259    $db =& DB::getInstance();
     260    $app =& App::getInstance();
    259261   
    260262    $lock->select('%DB_TBL%', '%PRIMARY_KEY%', $id);
     
    292294    global $cache;
    293295    $db =& DB::getInstance();
     296    $app =& App::getInstance();
    294297   
    295298    // Remove any stale cached list data.
     
    313316    global $lock;
    314317    global $cache;
     318    $db =& DB::getInstance();
    315319    $app =& App::getInstance();
    316320   
     
    342346    global $cache;
    343347    $db =& DB::getInstance();   
     348    $app =& App::getInstance();
    344349   
    345350    $where_clause = '';
     
    374379        SELECT
    375380            %DB_TBL%.*,
    376             a1.username AS added_admin_username,
    377             a2.username AS modified_admin_username
     381            a1.username AS added_by_username,
     382            a2.username AS modified_by_username
    378383        FROM %DB_TBL%
    379         LEFT JOIN admin_tbl a1 ON (%DB_TBL%.added_by_user_id = a1.admin_id)
    380         LEFT JOIN admin_tbl a2 ON (%DB_TBL%.modified_by_user_id = a2.admin_id)
     384        LEFT JOIN user_tbl a1 ON (%DB_TBL%.added_by_user_id = a1.user_id)
     385        LEFT JOIN user_tbl a2 ON (%DB_TBL%.modified_by_user_id = a2.user_id)
    381386        $where_clause
    382387        " . $so->getSortOrderSQL() . "
     
    398403    // First try to return from the cache.
    399404    if ($cache->exists('list')) {
    400         return $cache->get('list');
     405        $list = $cache->get('list');
     406        return $list;
    401407    }
    402408   
     
    419425    global $cache;
    420426    $db =& DB::getInstance();
     427    $app =& App::getInstance();
    421428   
    422429    if (!is_array($ranks)) {
Note: See TracChangeset for help on using the changeset viewer.