From c2cddede38dbb29d53167e296981a678759e0648 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 5 Dec 2011 21:54:09 -0500 Subject: first version of a 404 page --- views/default/errors/404.php | 8 ++++++++ views/default/errors/default.php | 8 ++++++++ views/default/page/error.php | 14 ++++++++++++++ views/default/page/layouts/error.php | 6 ++++++ 4 files changed, 36 insertions(+) create mode 100644 views/default/errors/404.php create mode 100644 views/default/errors/default.php create mode 100644 views/default/page/error.php create mode 100644 views/default/page/layouts/error.php (limited to 'views/default') diff --git a/views/default/errors/404.php b/views/default/errors/404.php new file mode 100644 index 000000000..8bc35acdd --- /dev/null +++ b/views/default/errors/404.php @@ -0,0 +1,8 @@ +$message"; diff --git a/views/default/errors/default.php b/views/default/errors/default.php new file mode 100644 index 000000000..a0582eba2 --- /dev/null +++ b/views/default/errors/default.php @@ -0,0 +1,8 @@ +$message"; diff --git a/views/default/page/error.php b/views/default/page/error.php new file mode 100644 index 000000000..b7ba3ae9b --- /dev/null +++ b/views/default/page/error.php @@ -0,0 +1,14 @@ + Date: Thu, 8 Dec 2011 19:28:56 -0500 Subject: added the ability to pass a class to be applied to all menu item
  • elements --- views/default/navigation/menu/default.php | 13 ++++++++----- views/default/navigation/menu/elements/item.php | 6 ++++++ views/default/navigation/menu/elements/section.php | 17 +++++++++++------ 3 files changed, 25 insertions(+), 11 deletions(-) (limited to 'views/default') diff --git a/views/default/navigation/menu/default.php b/views/default/navigation/menu/default.php index 0fa391433..006deb3ea 100644 --- a/views/default/navigation/menu/default.php +++ b/views/default/navigation/menu/default.php @@ -2,15 +2,17 @@ /** * Default menu * - * @uses $vars['name'] - * @uses $vars['menu'] - * @uses $vars['class'] - * @uses $vars['show_section_headers'] + * @uses $vars['name'] Name of the menu + * @uses $vars['menu'] Array of menu items + * @uses $vars['class'] Additional CSS class for the menu + * @uses $vars['item_class'] Additional CSS class for each menu item + * @uses $vars['show_section_headers'] Do we show headers for each section? */ // we want css classes to use dashes $vars['name'] = preg_replace('/[^a-z0-9\-]/i', '-', $vars['name']); $headers = elgg_extract('show_section_headers', $vars, false); +$item_class = elgg_extract('item_class', $vars, ''); $class = "elgg-menu elgg-menu-{$vars['name']}"; if (isset($vars['class'])) { @@ -23,6 +25,7 @@ foreach ($vars['menu'] as $section => $menu_items) { 'class' => "$class elgg-menu-{$vars['name']}-$section", 'section' => $section, 'name' => $vars['name'], - 'show_section_headers' => $headers + 'show_section_headers' => $headers, + 'item_class' => $item_class, )); } diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php index 5d6a7e367..22383ce0b 100644 --- a/views/default/navigation/menu/elements/item.php +++ b/views/default/navigation/menu/elements/item.php @@ -4,6 +4,9 @@ * * @package Elgg.Core * @subpackage Navigation + * + * @uses $vars['item'] ElggMenuItem + * @uses $vars['item_class'] Additional CSS class for the menu item */ $item = $vars['item']; @@ -21,6 +24,9 @@ if ($children) { } $item_class = $item->getItemClass(); +if (isset($vars['item_class']) && $vars['item_class']) { + $item_class .= ' ' . $vars['item_class']; +} echo "
  • "; echo $item->getContent(); diff --git a/views/default/navigation/menu/elements/section.php b/views/default/navigation/menu/elements/section.php index 92a259776..c0e9ba750 100644 --- a/views/default/navigation/menu/elements/section.php +++ b/views/default/navigation/menu/elements/section.php @@ -2,15 +2,17 @@ /** * Menu group * - * @uses $vars['items'] - * @uses $vars['class'] - * @uses $vars['name'] - * @uses $vars['section'] - * @uses $vars['show_section_headers'] + * @uses $vars['items'] Array of menu items + * @uses $vars['class'] Additional CSS class for the section + * @uses $vars['name'] Name of the menu + * @uses $vars['section'] The section name + * @uses $vars['item_class'] Additional CSS class for each menu item + * @uses $vars['show_section_headers'] Do we show headers for each section */ $headers = elgg_extract('show_section_headers', $vars, false); $class = elgg_extract('class', $vars, ''); +$item_class = elgg_extract('item_class', $vars, ''); if ($headers) { $name = elgg_extract('name', $vars); @@ -20,6 +22,9 @@ if ($headers) { echo "'; -- cgit v1.2.3 From 1ec7692c1639e8415cd9984d9ad040ec28bd9755 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 8 Dec 2011 20:09:36 -0500 Subject: Fixes #4185, #2111 adds control panel widget --- actions/admin/site/flush_cache.php | 10 ++++++++++ engine/lib/admin.php | 5 +++-- languages/en.php | 6 ++++++ views/default/widgets/control_panel/content.php | 24 ++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 actions/admin/site/flush_cache.php create mode 100644 views/default/widgets/control_panel/content.php (limited to 'views/default') diff --git a/actions/admin/site/flush_cache.php b/actions/admin/site/flush_cache.php new file mode 100644 index 000000000..b81f5fc83 --- /dev/null +++ b/actions/admin/site/flush_cache.php @@ -0,0 +1,10 @@ + array of handlers in order, top to bottom $adminWidgets = array( - 1 => array('admin_welcome'), + 1 => array('control_panel', 'admin_welcome'), 2 => array('online_users', 'new_users', 'content_stats'), ); diff --git a/languages/en.php b/languages/en.php index 036ca8883..a2e6e152e 100644 --- a/languages/en.php +++ b/languages/en.php @@ -610,6 +610,12 @@ $english = array( // argh, this is ugly 'admin:widget:admin_welcome:outro' => '
    Be sure to check out the resources available through the footer links and thank you for using Elgg!', + 'admin:widget:control_panel' => 'Control panel', + 'admin:widget:control_panel:help' => "Provides easy access to common controls", + + 'admin:cache:flush' => 'Flush the caches', + 'admin:cache:flushed' => "The site's caches have been flushed", + 'admin:footer:faq' => 'Administration FAQ', 'admin:footer:manual' => 'Administration Manual', 'admin:footer:community_forums' => 'Elgg Community Forums', diff --git a/views/default/widgets/control_panel/content.php b/views/default/widgets/control_panel/content.php new file mode 100644 index 000000000..d2db54bc6 --- /dev/null +++ b/views/default/widgets/control_panel/content.php @@ -0,0 +1,24 @@ + 'flush', + 'text' => elgg_echo('admin:cache:flush'), + 'href' => 'action/admin/site/flush_cache', + 'is_action' => true, + 'link_class' => 'elgg-button elgg-button-action', +)); + +elgg_register_menu_item('admin_control_panel', array( + 'name' => 'upgrade', + 'text' => elgg_echo('upgrade'), + 'href' => 'upgrade.php', + 'link_class' => 'elgg-button elgg-button-action', +)); + +echo elgg_view_menu('admin_control_panel', array( + 'class' => 'elgg-menu-hz', + 'item_class' => 'mrm', +)); -- cgit v1.2.3 From be930396dfd7c722d9c90d8987a49823710e6717 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 8 Dec 2011 21:15:36 -0500 Subject: Fixes #4189 correctly getting the base url in pagination view --- views/default/navigation/pagination.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'views/default') diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php index 4df5cf575..ad4689d83 100644 --- a/views/default/navigation/pagination.php +++ b/views/default/navigation/pagination.php @@ -25,7 +25,12 @@ if (!$limit = (int) elgg_extract('limit', $vars, 10)) { $count = (int) elgg_extract('count', $vars, 0); $offset_key = elgg_extract('offset_key', $vars, 'offset'); -$base_url = elgg_extract('baseurl', $vars, current_page_url()); +// some views pass an empty string for base_url +if (isset($vars['base_url']) && $vars['base_url']) { + $base_url = $vars['base_url']; +} else { + $base_url = current_page_url(); +} $num_pages = elgg_extract('num_pages', $vars, 10); $delta = ceil($num_pages / 2); -- cgit v1.2.3 From f8a2f8e5b9ae26781ec317391948266433cd7669 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Thu, 15 Dec 2011 19:31:33 -0500 Subject: Fixes #4214 added missing dependency for userpicker --- js/lib/ui.userpicker.js | 2 +- views/default/input/userpicker.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'views/default') diff --git a/js/lib/ui.userpicker.js b/js/lib/ui.userpicker.js index 8287ba91c..7298da114 100644 --- a/js/lib/ui.userpicker.js +++ b/js/lib/ui.userpicker.js @@ -93,7 +93,7 @@ elgg.userpicker.viewUser = function(info) { html += "
    " + info.icon + "
    "; html += "
    " + deleteLink + "
    "; html += "
    " + info.name + "
    "; - html += " Date: Thu, 15 Dec 2011 05:20:57 +0100 Subject: Fix #4200: Converting widgets controls into an elgg menu --- engine/lib/navigation.php | 50 +++++++++++++++++++++++ js/lib/ui.widgets.js | 2 +- views/default/css/elements/modules.php | 15 ------- views/default/css/elements/navigation.php | 24 ++++++++++- views/default/object/widget/elements/controls.php | 49 ++++------------------ 5 files changed, 82 insertions(+), 58 deletions(-) (limited to 'views/default') diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index 176790188..956ca220a 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -384,6 +384,55 @@ function elgg_entity_menu_setup($hook, $type, $return, $params) { return $return; } +/** + * Widget menu is a set of widget controls + * @access private + */ +function elgg_widget_menu_setup($hook, $type, $return, $params) { + + $widget = $params['entity']; + $show_edit = elgg_extract('show_edit', $params, true); + + $collapse = array( + 'name' => 'collapse', + 'text' => ' ', + 'href' => "#elgg-widget-content-$widget->guid", + 'class' => 'elgg-widget-collapse-button', + 'rel' => 'toggle', + 'priority' => 1 + ); + $return[] = ElggMenuItem::factory($collapse); + + if ($widget->canEdit()) { + $delete = array( + 'name' => 'delete', + 'text' => elgg_view_icon('delete-alt'), + 'title' => elgg_echo('widget:delete', array($widget->getTitle())), + 'href' => "action/widgets/delete?widget_guid=$widget->guid", + 'is_action' => true, + 'class' => 'elgg-widget-delete-button', + 'id' => "elgg-widget-delete-button-$widget->guid", + 'priority' => 900 + ); + $return[] = ElggMenuItem::factory($delete); + + if ($show_edit) { + $edit = array( + 'name' => 'settings', + 'text' => elgg_view_icon('settings-alt'), + 'title' => elgg_echo('widget:edit'), + 'href' => "#widget-edit-$widget->guid", + 'class' => "elgg-widget-edit-button", + 'rel' => 'toggle', + 'priority' => 800, + ); + $return[] = ElggMenuItem::factory($edit); + } + } + + return $return; +} + /** * Adds a delete link to "generic_comment" annotations * @access private @@ -418,6 +467,7 @@ function elgg_nav_init() { elgg_register_plugin_hook_handler('prepare', 'menu:site', 'elgg_site_menu_setup'); elgg_register_plugin_hook_handler('register', 'menu:river', 'elgg_river_menu_setup'); elgg_register_plugin_hook_handler('register', 'menu:entity', 'elgg_entity_menu_setup'); + elgg_register_plugin_hook_handler('register', 'menu:widget', 'elgg_widget_menu_setup'); elgg_register_plugin_hook_handler('register', 'menu:annotation', 'elgg_annotation_menu_setup'); } diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js index f12ae02c1..a44585843 100644 --- a/js/lib/ui.widgets.js +++ b/js/lib/ui.widgets.js @@ -107,7 +107,7 @@ elgg.ui.widgets.move = function(event, ui) { * @return void */ elgg.ui.widgets.remove = function(event) { - var $widget = $(this).parent().parent(); + var $widget = $(this).closest('.elgg-module-widget'); // if widget type is single instance type, enable the add buton var type = $widget.attr('class'); diff --git a/views/default/css/elements/modules.php b/views/default/css/elements/modules.php index ef85d4dd5..7750c208f 100644 --- a/views/default/css/elements/modules.php +++ b/views/default/css/elements/modules.php @@ -158,16 +158,7 @@ .elgg-module-widget.elgg-state-draggable > .elgg-head { cursor: move; } -.elgg-module-widget > .elgg-head a { - position: absolute; - top: 4px; - display: inline-block; - width: 18px; - height: 18px; - padding: 2px 2px 0 0; -} a.elgg-widget-collapse-button { - left: 5px; color: #c5c5c5; } a.elgg-widget-collapse-button:hover, @@ -181,12 +172,6 @@ a.elgg-widget-collapse-button:before { a.elgg-widget-collapsed:before { content: "\25BA"; } -a.elgg-widget-delete-button { - right: 5px; -} -a.elgg-widget-edit-button { - right: 25px; -} .elgg-module-widget > .elgg-body { background-color: white; width: 100%; diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php index d5b20896a..62f370069 100644 --- a/views/default/css/elements/navigation.php +++ b/views/default/css/elements/navigation.php @@ -534,4 +534,26 @@ *************************************** */ .elgg-menu-extras { margin-bottom: 15px; -} \ No newline at end of file +} + +/* *************************************** + WIDGET MENU +*************************************** */ +.elgg-menu-widget > li { + position: absolute; + top: 4px; + display: inline-block; + width: 18px; + height: 18px; + padding: 2px 2px 0 0; +} + +.elgg-menu-widget > .elgg-menu-item-collapse { + left: 5px; +} +.elgg-menu-widget > .elgg-menu-item-delete { + right: 5px; +} +.elgg-menu-widget > .elgg-menu-item-settings { + right: 25px; +} diff --git a/views/default/object/widget/elements/controls.php b/views/default/object/widget/elements/controls.php index 866dcc787..d1d630c4f 100644 --- a/views/default/object/widget/elements/controls.php +++ b/views/default/object/widget/elements/controls.php @@ -6,44 +6,11 @@ * @uses $vars['show_edit'] Whether to show the edit button (true) */ -$widget = $vars['widget']; -$show_edit = elgg_extract('show_edit', $vars, true); - -$params = array( - 'text' => ' ', - 'href' => "#elgg-widget-content-$widget->guid", - 'class' => 'elgg-widget-collapse-button', - 'rel' => 'toggle', -); -$collapse_link = elgg_view('output/url', $params); - -$delete_link = $edit_link = ''; -if ($widget->canEdit()) { - $params = array( - 'text' => elgg_view_icon('delete-alt'), - 'title' => elgg_echo('widget:delete', array($widget->getTitle())), - 'href' => "action/widgets/delete?widget_guid=$widget->guid", - 'is_action' => true, - 'is_trusted' => true, - 'class' => 'elgg-widget-delete-button', - 'id' => "elgg-widget-delete-button-$widget->guid" - ); - $delete_link = elgg_view('output/url', $params); - - if ($show_edit) { - $params = array( - 'text' => elgg_view_icon('settings-alt'), - 'title' => elgg_echo('widget:edit'), - 'href' => "#widget-edit-$widget->guid", - 'class' => "elgg-widget-edit-button", - 'rel' => 'toggle', - ); - $edit_link = elgg_view('output/url', $params); - } -} - -echo <<<___END - $collapse_link - $delete_link - $edit_link -___END; +echo elgg_view_menu('widget', array( + 'entity' => elgg_extract('widget', $vars), + 'params' => array( + 'show_edit' => elgg_extract('show_edit', $vars, true) + ), + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); -- cgit v1.2.3 From f003120fba687d14630b690c50e2316f717eca7d Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 19 Dec 2011 20:49:30 -0500 Subject: added more spacing to error layout --- engine/lib/pagehandler.php | 2 ++ views/default/css/elements/layout.php | 3 +++ views/default/page/layouts/error.php | 6 ++++++ 3 files changed, 11 insertions(+) (limited to 'views/default') diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php index 16be6e3b2..ffcfc5b6a 100644 --- a/engine/lib/pagehandler.php +++ b/engine/lib/pagehandler.php @@ -114,6 +114,8 @@ function elgg_unregister_page_handler($handler) { /** * Serve an error page * + * @todo not sending status codes yet + * * @param string $hook The name of the hook * @param string $type The type of the hook * @param bool $result The current value of the hook diff --git a/views/default/css/elements/layout.php b/views/default/css/elements/layout.php index 42d898439..25a2bffb7 100644 --- a/views/default/css/elements/layout.php +++ b/views/default/css/elements/layout.php @@ -81,6 +81,9 @@ .elgg-layout-two-sidebar { background: transparent url(_graphics/two_sidebar_background.gif) repeat-y right top; } +.elgg-layout-error { + margin-top: 20px; +} .elgg-sidebar { position: relative; padding: 20px 10px; diff --git a/views/default/page/layouts/error.php b/views/default/page/layouts/error.php index 5b3109964..cdce28a8e 100644 --- a/views/default/page/layouts/error.php +++ b/views/default/page/layouts/error.php @@ -3,4 +3,10 @@ * Error layout */ +$class = 'elgg-layout-error'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} +$vars['class'] = $class; + echo elgg_view('page/layouts/one_column', $vars); -- cgit v1.2.3