Changeset 202
- Timestamp:
- Jul 13, 2006 11:24:01 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/module_maker/module.cli.php
r185 r202 285 285 \$frm =& editRecordForm(getFormData('%PRIMARY_KEY%')); 286 286 \$frm = array_merge(\$frm, getFormData()); 287 \$nav->add Page(_("Edit %ITEM_TITLE%"));287 \$nav->add(_("Edit %ITEM_TITLE%")); 288 288 \$main_template = '%ADMIN_FORM_TEMPLATE%'; 289 289 break; -
trunk/bin/module_maker/skel/admin.php
r159 r202 28 28 29 29 // Titles and navigation header. 30 $nav->add Page(_("%TITLE%"), $_SERVER['PHP_SELF']);30 $nav->add(_("%TITLE%"), null); 31 31 32 32 // The object to validate form input. … … 74 74 // Initialize variables for the form template. 75 75 $frm =& addRecordForm(); 76 $nav->add Page(_("Add %ITEM_TITLE%"));76 $nav->add(_("Add %ITEM_TITLE%")); 77 77 $main_template = '%ADMIN_FORM_TEMPLATE%'; 78 78 break; … … 82 82 // Initialize variables for the form template. 83 83 $frm =& editRecordForm(getFormData('%PRIMARY_KEY%')); 84 $nav->add Page(_("Edit %ITEM_TITLE%"));84 $nav->add(_("Edit %ITEM_TITLE%")); 85 85 $main_template = '%ADMIN_FORM_TEMPLATE%'; 86 86 break; … … 111 111 $frm =& addRecordForm(); 112 112 $frm = array_merge($frm, getFormData()); 113 $nav->add Page(_("Add %ITEM_TITLE%"));113 $nav->add(_("Add %ITEM_TITLE%")); 114 114 $main_template = '%ADMIN_FORM_TEMPLATE%'; 115 115 } else { … … 148 148 $frm =& editRecordForm(getFormData('%PRIMARY_KEY%')); 149 149 $frm = array_merge($frm, getFormData()); 150 $nav->add Page(_("Edit %ITEM_TITLE%"));150 $nav->add(_("Edit %ITEM_TITLE%")); 151 151 $main_template = '%ADMIN_FORM_TEMPLATE%'; 152 152 } else {%ADMIN_UPLOAD_UPDATE% -
trunk/bin/module_maker/skel/public.php
r154 r202 17 17 18 18 // Titles and navigation header. 19 $nav->addPage(_("%TITLE%"), $_SERVER['PHP_SELF']); 20 $nav->setFeature(array('title'=>true)); 19 $nav->add(sprintf(_("%TITLE%"), null)); 20 $nav->setParam(array( 21 'title' => true, 22 )); 21 23 22 24 // Instantiate page numbers. Total items are set and calculation is done in the getRecordList function. … … 54 56 55 57 // Set title and main template. 56 $nav->add Page($item['__///__']);58 $nav->add($item['__///__']); 57 59 $main_template = '%PUBLIC_DETAIL_TEMPLATE%'; 58 60 -
trunk/docs/example_config.inc.php
r136 r202 96 96 $css->setFile('codebase/css/admin.inc.css'); 97 97 98 // Nav class for titles, breadcrumbs, and page features. 99 require_once 'codebase/lib/Nav.inc.php'; 100 $nav = new Nav(); 101 $nav->path_delimiter = ' / '; 102 $nav->last_crumb_format = '<b>%s</b>'; 98 // Global navigation elements object. 99 require_once 'codebase/lib/Navigation.inc.php'; 100 $nav = new Navigation(array( 101 'path_delimiter' => ' / ', 102 'last_crumb_format' => '<b>%s</b>', 103 )); 103 104 104 105 ?> -
trunk/lib/App.inc.php
r201 r202 345 345 } 346 346 $this->timer->stop('_app'); 347 $this->logMsg(sprintf('Script ended gracefully. Execution time: %s. Number of db queries: %s.', $this->timer->getTime('_app'), $num_queries), LOG_ INFO, __FILE__, __LINE__);347 $this->logMsg(sprintf('Script ended gracefully. Execution time: %s. Number of db queries: %s.', $this->timer->getTime('_app'), $num_queries), LOG_DEBUG, __FILE__, __LINE__); 348 348 } 349 349 … … 824 824 $url = $this->url($url, $carry_args, $always_include_sid); 825 825 826 // Should we send a "303 See Other" header here instead of relying on the 302 sent automatically by PHP? 826 827 header(sprintf('Location: %s', $url)); 827 828 $this->logMsg(sprintf('dieURL: %s', $url), LOG_DEBUG, __FILE__, __LINE__); 828 829 829 // End thisapplication.830 // End application. 830 831 // Recommended, although I'm not sure it's necessary: http://cn2.php.net/session_write_close 831 832 $this->stop(); -
trunk/lib/Lock.inc.php
r201 r202 318 318 // Delete specific user's locks. 319 319 $db->query("DELETE FROM " . $db->escapeString($this->getParam('db_table')) . " WHERE set_by_admin_id = '" . $db->escapeString($user_id) . "'"); 320 $app->logMsg(sprintf('Record locks owned by %s %s have been deleted', $this->_auth->get('auth_name'), $this->_auth->getUsername($user_id)), LOG_DEBUG, __FILE__, __LINE__);320 $app->logMsg(sprintf('Record locks owned by user %s have been deleted', $this->_auth->getUsername($user_id)), LOG_DEBUG, __FILE__, __LINE__); 321 321 } else { 322 322 // Delete ALL locks. 323 323 $db->query("DELETE FROM " . $db->escapeString($this->getParam('db_table')) . ""); 324 $app->logMsg(sprintf('All record locks deleted by %s %s', $this->_auth->get('auth_name'), $this->_auth->get('username')), LOG_DEBUG, __FILE__, __LINE__);324 $app->logMsg(sprintf('All record locks deleted by user %s', $this->_auth->get('username')), LOG_DEBUG, __FILE__, __LINE__); 325 325 } 326 326 } -
trunk/lib/Utilities.inc.php
r201 r202 295 295 function humanTime($seconds, $max_unit=null, $format='%01.1f') 296 296 { 297 // Units 297 // Units: array of seconds in the unit, singular and plural unit names. 298 298 $units = array( 299 299 'second' => array(1, _("second"), _("seconds")), … … 307 307 ); 308 308 309 // Max unit 309 // Max unit to calculate. 310 310 $max_unit = isset($units[$max_unit]) ? $max_unit : 'decade'; 311 311 -
trunk/services/admins.php
r159 r202 25 25 26 26 // Titles and navigation header. 27 $nav->add Page(_("Administrators"), $_SERVER['PHP_SELF']);27 $nav->add(_("Administrators"), null); 28 28 29 29 // The object to validate form input. … … 86 86 // Initialize variables for the form template. 87 87 $frm =& addRecordForm(); 88 $nav->add Page(_("Add Admin"));88 $nav->add(_("Add Admin")); 89 89 $main_template = 'admin_form.ihtml'; 90 90 break; … … 93 93 // Initialize variables for the form template. 94 94 $frm =& editRecordForm(getFormData('admin_id')); 95 $nav->add Page(_("Edit Admin"));95 $nav->add(_("Edit Admin")); 96 96 $main_template = 'admin_form.ihtml'; 97 97 break; … … 120 120 $frm =& addRecordForm(); 121 121 $frm = array_merge($frm, getFormData()); 122 $nav->add Page(_("Add Admin"));122 $nav->add(_("Add Admin")); 123 123 $main_template = 'admin_form.ihtml'; 124 124 } else { … … 156 156 $frm =& editRecordForm(getFormData('admin_id')); 157 157 $frm = array_merge($frm, getFormData()); 158 $nav->add Page(_("Edit Admin"));158 $nav->add(_("Edit Admin")); 159 159 $main_template = 'admin_form.ihtml'; 160 160 } else { -
trunk/services/lock.php
r159 r202 42 42 43 43 // Titles and navigation header. 44 $nav->add Page(sprintf(_("Locked record: <em>%s</em>"), $lock->getTitle()));44 $nav->add(sprintf(_("Locked record: <em>%s</em>"), $lock->getTitle())); 45 45 46 46 // Templates. -
trunk/services/login.php
r147 r202 21 21 $app->raiseMsg(_("You are now logged in."), MSG_SUCCESS, __FILE__, __LINE__); 22 22 $app->dieBoomerangURL('login'); 23 $app->logMsg(sprintf(' %s %s successfully logged-in.', $auth->get('auth_name'), $frm['username']), LOG_INFO, __FILE__, __LINE__);23 $app->logMsg(sprintf('User %s successfully logged-in.', $frm['username']), LOG_INFO, __FILE__, __LINE__); 24 24 } else { 25 25 $app->raiseMsg(_("Login failed, please try again."), MSG_NOTICE, __FILE__, __LINE__); 26 $app->logMsg(sprintf(' %s %s failed login using (MD5ed) password: %s', ucfirst($auth->get('auth_name')), $frm['username'], md5($frm['password'])), LOG_NOTICE, __FILE__, __LINE__);26 $app->logMsg(sprintf('User %s failed login using (MD5ed) password: %s', $frm['username'], md5($frm['password'])), LOG_NOTICE, __FILE__, __LINE__); 27 27 } 28 28 } 29 29 30 30 // Titles and navigation header. 31 $nav->add Page(_("Login"));31 $nav->add(_("Login")); 32 32 33 33 // Templates. -
trunk/services/logs.php
r153 r202 46 46 47 47 // Titles and navigation header. 48 $nav->add Page(sprintf(_("Viewing log: <em>%s</em>"), $tmp_prefs->get('log_file')), '/admin/logs.php');48 $nav->add(sprintf(_("Viewing log: <em>%s</em>"), $tmp_prefs->get('log_file')), '/admin/logs.php'); 49 49 50 50 /******************************************************************** -
trunk/services/password.php
r147 r202 16 16 17 17 // Titles and navigation header. 18 $nav->add Page(_("Change password"));18 $nav->add(_("Change password")); 19 19 20 20 // The object to validate form input from the user. -
trunk/services/versions.php
r159 r202 26 26 27 27 // Titles and navigation header. 28 $nav->add Page(_("Versions"), $_SERVER['PHP_SELF']);28 $nav->add(_("Versions"), null); 29 29 30 30 /******************************************************************** … … 59 59 $data = $version->getData($version_id); 60 60 $versionrecord = $version->getVerson($version_id); 61 $nav->add Page(sprintf(_("View <em>%s</em> version %s (%s)"), $versionrecord['version_title'], $version_id, $versionrecord['version_datetime']));61 $nav->add(sprintf(_("View <em>%s</em> version %s (%s)"), $versionrecord['version_title'], $version_id, $versionrecord['version_datetime'])); 62 62 $main_template = 'versions_view.ihtml'; 63 63 break; … … 70 70 $app->raiseMsg(sprintf(_("Version <em>%s</em> is identical to the current record"), $version_id), MSG_NOTICE, __FILE__, __LINE__); 71 71 } 72 $nav->add Page(sprintf(_("Difference between version %s (%s) and current record."), $version_id, $versionrecord['version_datetime']));72 $nav->add(sprintf(_("Difference between version %s (%s) and current record."), $version_id, $versionrecord['version_datetime'])); 73 73 $main_template = 'versions_diff.ihtml'; 74 74 break; … … 98 98 $_POST['version_title'] = $versions[0]['version_title']; 99 99 if (is_array($versions) && !empty($versions)) { 100 $nav->add Page(sprintf(_("%s versions of record <em>%s</em>"), sizeof($versions), $versions[0]['version_title']));100 $nav->add(sprintf(_("%s versions of record <em>%s</em>"), sizeof($versions), $versions[0]['version_title'])); 101 101 $main_template = 'versions_list.ihtml'; 102 102 } else { -
trunk/tests/NavTest.php
r42 r202 4 4 5 5 /** 6 * PHPUnit test case for Nav 6 * PHPUnit test case for Navigation 7 7 * 8 8 * The method skeletons below need to be filled in with … … 13 13 */ 14 14 require_once 'PHPUnit.php'; 15 class Nav Test extends PHPUnit_TestCase {15 class NavigationTest extends PHPUnit_TestCase { 16 16 17 var $Nav ;17 var $Navigation; 18 18 19 function Nav Test($name)19 function NavigationTest($name) 20 20 { 21 21 $this->PHPUnit_TestCase($name); … … 25 25 { 26 26 require dirname(__FILE__) . '/_config.inc.php'; 27 require_once '../lib/Nav .inc.php';28 $this->Nav =& new Nav(PARAM);27 require_once '../lib/Navigation.inc.php'; 28 $this->Navigation =& new Navigation(PARAM); 29 29 } 30 30 31 31 function tearDown() 32 32 { 33 unset($this->Nav );33 unset($this->Navigation); 34 34 } 35 35 36 36 function test_addpage() 37 37 { 38 $result = $this->Nav ->addpage(PARAM);38 $result = $this->Navigation->addpage(PARAM); 39 39 $expected = EXPECTED_VAL; 40 40 $this->assertEquals($expected, $result); … … 43 43 function test_setfeature() 44 44 { 45 $result = $this->Nav ->setfeature(PARAM);45 $result = $this->Navigation->setfeature(PARAM); 46 46 $expected = EXPECTED_VAL; 47 47 $this->assertEquals($expected, $result); … … 50 50 function test_clearpath() 51 51 { 52 $result = $this->Nav ->clearpath(PARAM);52 $result = $this->Navigation->clearpath(PARAM); 53 53 $expected = EXPECTED_VAL; 54 54 $this->assertEquals($expected, $result); … … 57 57 function test_getfeature() 58 58 { 59 $result = $this->Nav ->getfeature(PARAM);59 $result = $this->Navigation->getfeature(PARAM); 60 60 $expected = EXPECTED_VAL; 61 61 $this->assertEquals($expected, $result); … … 64 64 function test_gettitle() 65 65 { 66 $result = $this->Nav ->gettitle(PARAM);66 $result = $this->Navigation->gettitle(PARAM); 67 67 $expected = EXPECTED_VAL; 68 68 $this->assertEquals($expected, $result); … … 71 71 function test_printtitle() 72 72 { 73 $result = $this->Nav ->printtitle(PARAM);73 $result = $this->Navigation->printtitle(PARAM); 74 74 $expected = EXPECTED_VAL; 75 75 $this->assertEquals($expected, $result); … … 78 78 function test_getpath() 79 79 { 80 $result = $this->Nav ->getpath(PARAM);80 $result = $this->Navigation->getpath(PARAM); 81 81 $expected = EXPECTED_VAL; 82 82 $this->assertEquals($expected, $result); … … 85 85 function test_printpath() 86 86 { 87 $result = $this->Nav ->printpath(PARAM);87 $result = $this->Navigation->printpath(PARAM); 88 88 $expected = EXPECTED_VAL; 89 89 $this->assertEquals($expected, $result); … … 92 92 function test_getbreadcrumbs() 93 93 { 94 $result = $this->Nav ->getbreadcrumbs(PARAM);94 $result = $this->Navigation->getbreadcrumbs(PARAM); 95 95 $expected = EXPECTED_VAL; 96 96 $this->assertEquals($expected, $result); … … 99 99 function test_printbreadcrumbs() 100 100 { 101 $result = $this->Nav ->printbreadcrumbs(PARAM);101 $result = $this->Navigation->printbreadcrumbs(PARAM); 102 102 $expected = EXPECTED_VAL; 103 103 $this->assertEquals($expected, $result); … … 106 106 function test_currentpage() 107 107 { 108 $result = $this->Nav ->currentpage(PARAM);108 $result = $this->Navigation->currentpage(PARAM); 109 109 $expected = EXPECTED_VAL; 110 110 $this->assertEquals($expected, $result); … … 113 113 } 114 114 // Running the test. 115 $suite = new PHPUnit_TestSuite('Nav Test');115 $suite = new PHPUnit_TestSuite('NavigationTest'); 116 116 $result = PHPUnit::run($suite); 117 117 echo $result->toString();
Note: See TracChangeset
for help on using the changeset viewer.