Changeset 127 for branches/2.0singleton/bin/module_maker
- Timestamp:
- May 25, 2006 10:21:07 PM (18 years ago)
- Location:
- branches/2.0singleton/bin/module_maker
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0singleton/bin/module_maker/form_template.cli.php
r121 r127 24 24 // Make sure requested table is in database. 25 25 if (!in_array($db_tbl, $tables)) { 26 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)));26 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))); 27 27 } 28 28 … … 65 65 <label for="$field"<\x3fphp \$fv->err('$field') \x3f>><\x3fphp echo _("$title"); \x3f></label> 66 66 <select name="$field" id="$field" class="sc-small"><\x3fphp printSelectForm('<##>_tbl', "CONCAT(<##>_id, '—', <##>)", '$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>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> 68 68 <\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>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 70 <\x3fphp } \x3f> 71 71 E_O_F; -
branches/2.0singleton/bin/module_maker/list_template.cli.php
r121 r127 37 37 // Make sure requested table is in database. 38 38 if (!in_array($db_tbl, $tables)) { 39 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)));39 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))); 40 40 } 41 41 … … 80 80 $listrows[] = "<\x3fphp echo strlen(\$list[\$i]['$field'])<50 \x3f oTxt(\$list[\$i]['$field'], true) : oTxt(trim(substr(\$list[\$i]['$field'], 0, 50)) . '...'); \x3f>"; 81 81 } else if (preg_match('/.*(begin|start).*date.*/i', $field)) { 82 $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date( App::getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>";82 $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date(\$app->getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>"; 83 83 } else if (preg_match('/.*(end|expire).*date.*/i', $field)) { 84 $listrows[] = "<\x3fphp echo '9999-12-31' == \$list[\$i]['$field'] ? '' : date( App::getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>";84 $listrows[] = "<\x3fphp echo '9999-12-31' == \$list[\$i]['$field'] ? '' : date(\$app->getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>"; 85 85 } else if (preg_match('/datetime/i', $type)) { 86 $listrows[] = "<\x3fphp echo '0000-00-00 00:00:00' == \$list[\$i]['$field'] ? '' : date( App::getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>";86 $listrows[] = "<\x3fphp echo '0000-00-00 00:00:00' == \$list[\$i]['$field'] ? '' : date(\$app->getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>"; 87 87 } else if (preg_match('/date/i', $type)) { 88 $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date( App::getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>";88 $listrows[] = "<\x3fphp echo '0000-00-00' == \$list[\$i]['$field'] ? '' : date(\$app->getParam('date_format'), strtotime(\$list[\$i]['$field'])); \x3f>"; 89 89 } else if (preg_match('/(amount|_rate)/i', $field)) { 90 90 $listrows[] = "<\x3fphp printf('$%01.2f', \$list[\$i]['$field']); \x3f>"; … … 110 110 <div id="commandbox"> 111 111 <form action="<\x3fphp echo \$_SERVER['PHP_SELF']; \x3f>" method="get"> 112 <\x3fphp App::printHiddenSession(false); \x3f>113 <span class="sc-nowrap commandtext"><a href="<\x3fphp echo App::oHREF(\$_SERVER['PHP_SELF'] . '?op=add'); \x3f>"><\x3fphp echo _("Add <##>"); \x3f></a></span>112 <\x3fphp \$app->printHiddenSession(false); \x3f> 113 <span class="sc-nowrap commandtext"><a href="<\x3fphp echo \$app->oHREF(\$_SERVER['PHP_SELF'] . '?op=add'); \x3f>"><\x3fphp echo _("Add <##>"); \x3f></a></span> 114 114 <br /> 115 115 … … 149 149 <\x3fphp for (\$i = 0; \$i <= \$page->last_item - \$page->first_item && \$page->total_items > 0; \$i++) { \x3f> 150 150 <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>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> 153 153 154 154 E_O_F; … … 164 164 165 165 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>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> 167 167 </tr> 168 168 <\x3fphp } \x3f> -
branches/2.0singleton/bin/module_maker/module.cli.php
r119 r127 136 136 // Make sure requested table is in database. 137 137 if (!in_array($db_tbl, $tables)) { 138 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)));138 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))); 139 139 } 140 140 … … 266 266 // If file upload errors, redirect to edit operation for the inserted record. 267 267 if (\$upload->anyErrors() || false === \$new_file) { 268 App::dieURL(\$_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . \$%PRIMARY_KEY%);268 \$app->dieURL(\$_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . \$%PRIMARY_KEY%); 269 269 } 270 270 E_O_F; … … 300 300 301 301 $search['date'] = '/%DATE%/'; 302 $replace['date'] = date( App::getParam('date_format'));302 $replace['date'] = date($app->getParam('date_format')); 303 303 304 304 $search['name_plural'] = '/%NAME_PLURAL%/'; -
branches/2.0singleton/bin/module_maker/skel/admin.php
r111 r127 11 11 $auth->requireLogin(); 12 12 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%); 13 App::sslOn();13 $app->sslOn(); 14 14 15 15 require_once 'codebase/lib/PageNumbers.inc.php'; … … 41 41 42 42 // Search limiters retain their values between page requests. 43 App::carryQuery('search_query');44 App::carryQuery('filter_<##>');43 $app->carryQuery('search_query'); 44 $app->carryQuery('filter_<##>'); 45 45 %ADMIN_UPLOAD_CONFIG% 46 46 /****************************************************************************** … … 51 51 // allows us to remember which page we came from so we can go back there. 52 52 if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { 53 App::setBoomerangURL($_SERVER['HTTP_REFERER'], '%NAME_PLURAL%');53 $app->setBoomerangURL($_SERVER['HTTP_REFERER'], '%NAME_PLURAL%'); 54 54 } 55 55 … … 81 81 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_DELETE); 82 82 deleteRecord(getFormData('%PRIMARY_KEY%'));%ADMIN_UPLOAD_DEL% 83 if ( App::validBoomerangURL('%NAME_PLURAL%')) {83 if ($app->validBoomerangURL('%NAME_PLURAL%')) { 84 84 // Display boomerang page. 85 App::dieBoomerangURL('%NAME_PLURAL%');85 $app->dieBoomerangURL('%NAME_PLURAL%'); 86 86 } 87 87 // Display default page. 88 App::dieURL($_SERVER['PHP_SELF']);88 $app->dieURL($_SERVER['PHP_SELF']); 89 89 break; 90 90 … … 92 92 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_ADD); 93 93 if (getFormdata('cancel', false)) { 94 if ( App::validBoomerangURL('%NAME_PLURAL%')) {94 if ($app->validBoomerangURL('%NAME_PLURAL%')) { 95 95 // Display boomerang page. 96 App::dieBoomerangURL('%NAME_PLURAL%');96 $app->dieBoomerangURL('%NAME_PLURAL%'); 97 97 } 98 98 // Display default page. 99 App::dieURL($_SERVER['PHP_SELF']);99 $app->dieURL($_SERVER['PHP_SELF']); 100 100 } 101 101 validateInput(); … … 109 109 if (getFormdata('repeat', false)) { 110 110 // Display function again. 111 App::dieURL($_SERVER['PHP_SELF'] . '?op=add');112 } else if ( App::validBoomerangURL('%NAME_PLURAL%')) {111 $app->dieURL($_SERVER['PHP_SELF'] . '?op=add'); 112 } else if ($app->validBoomerangURL('%NAME_PLURAL%')) { 113 113 // Display boomerang page. 114 App::dieBoomerangURL('%NAME_PLURAL%');114 $app->dieBoomerangURL('%NAME_PLURAL%'); 115 115 } 116 116 // Display default page. 117 App::dieURL($_SERVER['PHP_SELF']);117 $app->dieURL($_SERVER['PHP_SELF']); 118 118 } 119 119 break; … … 122 122 // $auth->requireAccessClearance(ZONE_ADMIN_%NAME_UPPER%_FUNC_EDIT); 123 123 if (getFormdata('reset', false)) { 124 App::raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__);125 App::dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . getFormData('%PRIMARY_KEY%'));124 $app->raiseMsg(_("Saved values have been reloaded."), MSG_NOTICE, __FILE__, __LINE__); 125 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . getFormData('%PRIMARY_KEY%')); 126 126 } 127 127 if (getFormdata('cancel', false)) { … … 129 129 $lock->select('%DB_TBL%', '%PRIMARY_KEY%', getFormData('%PRIMARY_KEY%')); 130 130 $lock->remove(); 131 if ( App::validBoomerangURL('%NAME_PLURAL%')) {131 if ($app->validBoomerangURL('%NAME_PLURAL%')) { 132 132 // Display boomerang page. 133 App::dieBoomerangURL('%NAME_PLURAL%');133 $app->dieBoomerangURL('%NAME_PLURAL%'); 134 134 } 135 135 // Display default page. 136 App::dieURL($_SERVER['PHP_SELF']);136 $app->dieURL($_SERVER['PHP_SELF']); 137 137 } 138 138 validateInput(); … … 148 148 $qid = DB::query("SELECT %PRIMARY_KEY% FROM %DB_TBL% WHERE %PRIMARY_KEY% > '" . DB::escapeString(getFormData('%PRIMARY_KEY%')) . "' ORDER BY %PRIMARY_KEY% ASC LIMIT 1"); 149 149 if (list($next_id) = mysql_fetch_row($qid)) { 150 App::dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id);150 $app->dieURL($_SERVER['PHP_SELF'] . '?op=edit&%PRIMARY_KEY%=' . $next_id); 151 151 } else { 152 App::raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__);152 $app->raiseMsg(_("Cannot edit next, the end of the list was reached"), MSG_NOTICE, __FILE__, __LINE__); 153 153 } 154 } else if ( App::validBoomerangURL('%NAME_PLURAL%')) {154 } else if ($app->validBoomerangURL('%NAME_PLURAL%')) { 155 155 // Display boomerang page. 156 App::dieBoomerangURL('%NAME_PLURAL%');156 $app->dieBoomerangURL('%NAME_PLURAL%'); 157 157 } 158 158 // Display default page. 159 App::dieURL($_SERVER['PHP_SELF']);159 $app->dieURL($_SERVER['PHP_SELF']); 160 160 } 161 161 break; … … 164 164 // $auth->requireAccessClearance(ZONE_ADMIN_PROGRAMS_FUNC_REORDER); 165 165 updateRank(getFormData('rank')); 166 App::dieURL($_SERVER['PHP_SELF']);166 $app->dieURL($_SERVER['PHP_SELF']); 167 167 break; 168 168 … … 220 220 "); 221 221 if (!$frm = mysql_fetch_assoc($qid)) { 222 App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);223 App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);224 App::dieBoomerangURL();222 $app->logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__); 223 $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__); 224 $app->dieBoomerangURL(); 225 225 } 226 226 … … 262 262 "); 263 263 if (! list($name) = mysql_fetch_row($qid)) { 264 App::logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__);265 App::raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__);266 App::dieBoomerangURL();264 $app->logMsg('Could not find record with %PRIMARY_KEY%: ' . $id, LOG_WARNING, __FILE__, __LINE__); 265 $app->raiseMsg(sprintf(_("The requested record %s could not be found."), $id), MSG_ERR, __FILE__, __LINE__); 266 $app->dieBoomerangURL(); 267 267 } 268 268 … … 270 270 DB::query("DELETE FROM %DB_TBL% WHERE %PRIMARY_KEY% = '" . DB::escapeString($id) . "'"); 271 271 272 App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__);272 $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been deleted."), $name), MSG_SUCCESS, __FILE__, __LINE__); 273 273 274 274 // Unlock record. … … 290 290 $version->create('%DB_TBL%', '%PRIMARY_KEY%', $last_insert_id, $frm['<##>']); 291 291 292 App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been added."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);292 $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been added."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__); 293 293 294 294 return $last_insert_id; … … 313 313 $version->create('%DB_TBL%', '%PRIMARY_KEY%', $frm['%PRIMARY_KEY%'], $frm['<##>']); 314 314 315 App::raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been updated."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__);315 $app->raiseMsg(sprintf(_("The %ITEM_TITLE% <strong>%s</strong> has been updated."), $frm['<##>']), MSG_SUCCESS, __FILE__, __LINE__); 316 316 317 317 // Unlock record. … … 399 399 { 400 400 if (!is_array($ranks)) { 401 App::logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__);401 $app->logMsg('Saving rank failed, data posted is not an array: ' . $ranks, LOG_ERR, __FILE__, __LINE__); 402 402 return false; 403 403 } … … 423 423 } 424 424 425 App::raiseMsg(_("Records have been reordered with the new rank."), MSG_SUCCESS, __FILE__, __LINE__);425 $app->raiseMsg(_("Records have been reordered with the new rank."), MSG_SUCCESS, __FILE__, __LINE__); 426 426 if ($unspecified_counter > 0) { 427 App::raiseMsg(sprintf(_("%s items with unspecified ranks were automatically assigned a rank of 10000."), $unspecified_counter), MSG_NOTICE, __FILE__, __LINE__);427 $app->raiseMsg(sprintf(_("%s items with unspecified ranks were automatically assigned a rank of 10000."), $unspecified_counter), MSG_NOTICE, __FILE__, __LINE__); 428 428 } 429 429 } -
branches/2.0singleton/bin/module_maker/skel/public.php
r111 r127 42 42 "); 43 43 if (!$item = mysql_fetch_assoc($qid)) { 44 App::raiseMsg(_("Sorry that %ITEM_TITLE% could not be found"), MSG_WARNING, __FILE__, __LINE__);45 App::dieBoomerangURL();44 $app->raiseMsg(_("Sorry that %ITEM_TITLE% could not be found"), MSG_WARNING, __FILE__, __LINE__); 45 $app->dieBoomerangURL(); 46 46 } 47 47 -
branches/2.0singleton/bin/module_maker/sql.cli.php
r111 r127 37 37 // Make sure requested table is in database. 38 38 if (!in_array($db_tbl, $tables)) { 39 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)));39 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))); 40 40 } 41 41 -
branches/2.0singleton/bin/module_maker/validation.cli.php
r111 r127 24 24 // Make sure requested table is in database. 25 25 if (!in_array($db_tbl, $tables)) { 26 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)));26 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))); 27 27 } 28 28
Note: See TracChangeset
for help on using the changeset viewer.