------------------------------------------------------------
revno: 1004
committer: Jakub Jankiewicz <[email protected]>
branch nick: aikiframework
timestamp: Sat 2012-01-07 00:39:08 +0100
message:
Add Error 404 (Page Not Found) widget
modified:
configs/config.php
libs/Errors.php
libs/widgets.php
sql/InsertVariable-in.sql
--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk
Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'configs/config.php'
--- configs/config.php 2011-11-15 22:43:12 +0000
+++ configs/config.php 2012-01-06 23:39:08 +0000
@@ -164,12 +164,6 @@
* @global bool $config["register_errors"] */
$config["register_errors"] = false;
-/** Custom 404 error page
- * @global string $config["error_404"] */
-$config["error_404"] = "<h1>404 Page Not Found</h1>
-<p>This page is not found</p>
-<p>Please visit <a href=\"".AIKI_SITE_URL."\">Home page</a> so you may find what you are looking for.</p>";
-
/** Your default timezone. Before code had "America/Los_Angeles", should try
* defaults first. If one has set this, then it overrides the system.
* @global string $config["timezone"] */
=== modified file 'libs/Errors.php'
--- libs/Errors.php 2011-11-08 13:42:45 +0000
+++ libs/Errors.php 2012-01-06 23:39:08 +0000
@@ -71,9 +71,10 @@
/**
* @todo actually handle translating the page name
*/
- $aiki->Output->set_title("404 Page Not Found");
+
+ //$aiki->Output->set_title("404 Page Not Found");
// return page because it would be handle by cache..
- return $config['error_404'];
+ //return $config['error_404'];
} // end of page_not_found function
=== modified file 'libs/widgets.php'
--- libs/widgets.php 2011-12-26 20:34:56 +0000
+++ libs/widgets.php 2012-01-06 23:39:08 +0000
@@ -115,20 +115,21 @@
}
}
-
+
+ $widget_group = array();
// ..page not found..
if (!$unique_widget_exists) {
- $this->html_output .= $aiki->Errors->pageNotFound();
- return;
+ $aiki->Errors->pageNotFound();
+ $widget_group = $this->getPageNotFoundWidgets();
+ } else {
+ // now filter canditate widgets, before create content
+ foreach ($module_widgets as $widget) {
+ if ($aiki->url->match($widget->display_urls) &&
+ !$aiki->url->match($widget->kill_urls) ) {
+ $widget_group[] = $widget->id;
+ }
+ }
}
-
- // now filter canditate widgets, before create content
- $widget_group = array();
- foreach ( $module_widgets as $widget ) {
- if ( $aiki->url->match($widget->display_urls) && !$aiki->url->match($widget->kill_urls) ) {
- $widget_group[] = $widget->id;
- }
- }
$this->createWidget($widget_group);
}
@@ -1139,17 +1140,28 @@
$search = $aiki->url->url[0];
$SQL =
- "SELECT id, display_urls,kill_urls,widget_name " .
- " FROM aiki_widgets " .
+ "SELECT id, display_urls, kill_urls, widget_name FROM aiki_widgets " .
" WHERE father_widget=$father AND is_active=1 AND " .
" (widget_site='{$aiki->site}' OR widget_site ='aiki_shared') AND " . // default.
- " (display_urls LIKE '%$search%' OR display_urls = '*' OR display_urls LIKE '%#%#%') AND " .
- " (kill_urls='' OR kill_urls<> '$search') " .
+ " (display_urls LIKE '%$search%' OR display_urls = '*' OR ".
+ " display_urls LIKE '%#%#%') AND " .
+ " (kill_urls='' OR kill_urls not like '%$search%') " .
" ORDER BY display_order, id";
return $db->get_results($SQL);
}
-
+ function getPageNotFoundWidgets() {
+ global $db, $aiki;
+
+ $SQL =
+ "SELECT id FROM aiki_widgets WHERE is_active=1 AND " .
+ " (widget_site='{$aiki->site}' OR widget_site ='aiki_shared') AND " .
+ " (display_urls LIKE '%error_404%' OR display_urls = '*' OR " .
+ " display_urls LIKE '%#%#%') AND " .
+ " (kill_urls='' OR kill_urls not like '%error_404%') " .
+ " ORDER BY display_order, id";
+ return $db->get_col($SQL);
+ }
/**
* lookup a widget_id.
*
=== modified file 'sql/InsertVariable-in.sql'
--- sql/InsertVariable-in.sql 2011-11-24 20:09:50 +0000
+++ sql/InsertVariable-in.sql 2012-01-06 23:39:08 +0000
@@ -73,4 +73,5 @@
(25, 1, 'table_tools', 'default', 'body', 'div', 1, '', 0, 0, 'admin_tools/auto_generate/(.*)', '', '', '', '', '', '', '', 0, 0, '', '', 1, 'table: (!(2)!)\r\n<p style="padding: 10px"><a href="[root]/admin_tools/generate_form/(!(2)!)" rel="generate_form" rev="#table_information_container">Generate Form</a> - <a href="[root]/admin_tools/auto_generate/(!(2)!)" rel="auto_generate" rev="#table_information_container">Structure</a> - <a href="[root]/admin_tools/datagrid/(!(2)!)" rel="table_datagrid" rev="#table_information_container">Browse</a> - <a href="[root]/admin_tools/newfromtable/(!(2)!)" rel="new_record_from_tablename" rev="#table_information_container">Insert</a></p>', 'SystemGOD', 0, 0, 1, '', 1, 2, 'w'),
(26, 1, 'table_datagrid', 'default', 'body', 'div', 0, '', 0, 0, 'admin_tools/datagrid/(.*)', '', '', '', '', '', '', '', 0, 0, '', '', 1, '<php $aiki->Bot->DataGrid( (!(2)!) ); php>', 'SystemGOD', 0, 0, 1, '', 1, 2, 'w'),
(27, 1, 'new_record_from_tablename', 'default', 'body', 'div', 0, '', 0, 0, 'admin_tools/newfromtable/(.*)', '', '', 'select id from aiki_forms where form_table like ''(!(2)!)''', '', '', '', '', 0, 0, '', '', 1, '(#(form:add:((id)):ajax)#)', 'SystemGOD', 0, 0, 1, '', 1, 2, 'w'),
+(28, 0, 'error_404', 'default', 'body', 'div', 0, '', 0, 0, 'error_404', '', '', '', '', '<h1>404 Page Not Found</h1><p>Please visit <a href="[root]">Home page</a> so you may find what you are looking for.</p>', '', '', 0, 0, '', 'Aikiframework', 0, '', '', 0, 0, 0, '', 1, 2, 'w'),
(100, 1, 'fake', 'default', 'body', 'div', 0, '', 0, 0, '', '', '', '', '', '', '', '', 0, 0, '', '', 0, '', '', 0, 0, 0, '', 0, 0, 'w');
_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help : https://help.launchpad.net/ListHelp