- Timestamp:
- Mar 12, 2008 1:47:19 AM (16 years ago)
- Location:
- trunk/bin/module_maker
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/module_maker/list_template.cli.php
r295 r316 54 54 // Human readable. 55 55 $field = $col[0]; 56 $type = preg_replace('/^(\w+).*$/', '\\1', $col[1]); 56 57 $title = ucfirst(str_replace('_', ' ', $field)); 57 $type = preg_replace('/^(\w+).*$/', '\\1', $col[1]); 58 59 switch ($field) { 60 case 'added_by_user_id' : 61 case 'modified_by_user_id' : 62 $title = "by"; 63 break; 64 65 case 'added_datetime' : 66 case 'modified_datetime' : 67 $title = str_replace(' datetime', '', $title); 68 break; 69 } 58 70 59 71 // Get primary key. … … 136 148 if (!isset($op) || 'headerrows' == $op) { 137 149 foreach ($headers as $field=>$title) { 150 if (preg_match('/(_date|_datetime|_time|price|value|quantity)/', $field)) { 151 $ordering = 'DESC'; 152 } else { 153 $ordering = 'ASC'; 154 } 155 138 156 if ($field == $primary_key) { 139 echo " <th><\x3fphp echo \$so->printSortHeader('$db_tbl.$field', _(\"ID\"), ' ASC'); \x3f></th>\n";157 echo " <th><\x3fphp echo \$so->printSortHeader('$db_tbl.$field', _(\"ID\"), 'DESC'); \x3f></th>\n"; 140 158 } else { 141 echo " <th><\x3fphp echo \$so->printSortHeader('$db_tbl.$field', _(\"$title\"), ' ASC'); \x3f></th>\n";159 echo " <th><\x3fphp echo \$so->printSortHeader('$db_tbl.$field', _(\"$title\"), '$ordering'); \x3f></th>\n"; 142 160 } 143 161 } … … 149 167 <\x3fphp for (\$i = 0; \$i <= \$page->last_item - \$page->first_item && \$page->total_items > 0; \$i++) { \x3f> 150 168 <tr> 151 <td class="sc-nowrap"><a title="<\x3fphp printf(_("Edit %s"), oTxt(\$list[\$i]['__///__'])) \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> </td>152 <td class="sc-nowrap"><a title="<\x3fphp printf(_("Versions of %s"), oTxt(\$list[\$i]['__///__'])) \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> </td>169 <td class="sc-nowrap"><a title="<\x3fphp printf(_("Edit %s"), oTxt(\$list[\$i]['__///__'])) \x3f>" href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . '?op=edit&$primary_key=' . \$list[\$i]['$primary_key']); \x3f>"><img src="/admin/i/pen.gif" alt="Edit" width="12" height="12" border="0" /></a> </td> 170 <td class="sc-nowrap"><a title="<\x3fphp printf(_("Versions of %s"), oTxt(\$list[\$i]['__///__'])) \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/i/multiple.png" alt="" width="12" height="12" border="0" /></a> </td> 153 171 154 172 E_O_F; … … 164 182 165 183 echo 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> </td>184 <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/i/trash.gif" alt="Delete" width="10" height="10" border="0" /></a> </td> 167 185 </tr> 168 186 <\x3fphp } \x3f> -
trunk/bin/module_maker/module.cli.php
r295 r316 118 118 // Ensure essential directories exist. 119 119 if (!is_dir("$admin_dir")) { 120 die(basename($_SERVER['argv'][0]) . " Error: $admin_dirdirectory not found.\n");120 die(basename($_SERVER['argv'][0]) . " Error: admin_dir '$admin_dir' directory not found.\n"); 121 121 } 122 122 if (!is_dir("$admin_tpl_dir")) { 123 die(basename($_SERVER['argv'][0]) . " Error: $admin_tpl_dirdirectory not found.\n");123 die(basename($_SERVER['argv'][0]) . " Error: admin_tpl_dir '$admin_tpl_dir' directory not found.\n"); 124 124 } 125 125 if (!is_dir("$public_dir")) { 126 die(basename($_SERVER['argv'][0]) . " Error: $public_dirdirectory not found.\n");126 die(basename($_SERVER['argv'][0]) . " Error: public_dir '$public_dir' directory not found.\n"); 127 127 } 128 128 if (!is_dir("$public_tpl_dir")) { 129 die(basename($_SERVER['argv'][0]) . " Error: $public_tpl_dirdirectory not found.\n");129 die(basename($_SERVER['argv'][0]) . " Error: public_tpl_dir '$public_tpl_dir' directory not found.\n"); 130 130 } 131 131 … … 174 174 $type = preg_replace('/^(\w+).*$/', '\\1', $col[1]); 175 175 $default = $col[4]; 176 177 if (mb_strpos($default, '0000') !== false || '0' == $default) { 178 $default = ''; 179 } 176 180 177 181 // Get primary key. -
trunk/bin/module_maker/skel/adm_list.ihtml
r295 r316 26 26 <?php for ($i = 0; $i <= $page->last_item - $page->first_item && $page->total_items > 0; $i++) { ?> 27 27 <tr> 28 <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['__///__'])) ?>" 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> </td>29 <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> </td>28 <td class="sc-padleft sc-nowrap"><a title="<?php printf(_("Edit %s"), oTxt($list[$i]['__///__'])) ?>" href="<?php echo $app->oHREF($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $list[$i]['%PRIMARY_KEY%']); ?>"><img src="/admin/i/pen.gif" alt="Edit" width="12" height="12" border="0" /></a> </td> 29 <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/i/multiple.png" alt="" width="12" height="12" border="0" /></a> </td> 30 30 %ADM_LIST_ROWS% 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> </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/i/trash.gif" alt="Delete" width="10" height="10" border="0" /></a> </td> 32 32 </tr> 33 33 <?php } ?>
Note: See TracChangeset
for help on using the changeset viewer.