diff options
Diffstat (limited to 'views/default/page/layouts')
24 files changed, 485 insertions, 238 deletions
diff --git a/views/default/page/layouts/admin.php b/views/default/page/layouts/admin.php new file mode 100644 index 000000000..8dbdc27e6 --- /dev/null +++ b/views/default/page/layouts/admin.php @@ -0,0 +1,40 @@ +<?php +/** + * Elgg Admin Area Canvas + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content string + * @uses $vars['sidebar'] Optional sidebar content + * @uses $vars['title'] Title string + */ + +?> + +<div class="elgg-layout elgg-layout-one-sidebar"> + <div class="elgg-sidebar clearfix"> + <?php + echo elgg_view('admin/sidebar', $vars); + ?> + </div> + <div class="elgg-main elgg-body"> + <div class="elgg-head"> + <?php + echo elgg_view_menu('title', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + )); + + if (isset($vars['title'])) { + echo elgg_view_title($vars['title']); + } + ?> + </div> + <?php + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + </div> +</div>
\ No newline at end of file diff --git a/views/default/page/layouts/content.php b/views/default/page/layouts/content.php new file mode 100644 index 000000000..c406c9faf --- /dev/null +++ b/views/default/page/layouts/content.php @@ -0,0 +1,53 @@ +<?php +/** + * Main content area layout + * + * @uses $vars['content'] HTML of main content area + * @uses $vars['sidebar'] HTML of the sidebar + * @uses $vars['header'] HTML of the content area header (override) + * @uses $vars['nav'] HTML of the content area nav (override) + * @uses $vars['footer'] HTML of the content area footer + * @uses $vars['filter'] HTML of the content area filter (override) + * @uses $vars['title'] Title text (override) + * @uses $vars['context'] Page context (override) + * @uses $vars['filter_context'] Filter context: everyone, friends, mine + * @uses $vars['class'] Additional class to apply to layout + */ + +// give plugins an opportunity to add to content sidebars +$sidebar_content = elgg_extract('sidebar', $vars, ''); +$params = $vars; +$params['content'] = $sidebar_content; +$sidebar = elgg_view('page/layouts/content/sidebar', $params); + +// allow page handlers to override the default header +if (isset($vars['header'])) { + $vars['header_override'] = $vars['header']; +} +$header = elgg_view('page/layouts/content/header', $vars); + +// allow page handlers to override the default filter +if (isset($vars['filter'])) { + $vars['filter_override'] = $vars['filter']; +} +$filter = elgg_view('page/layouts/content/filter', $vars); + +// the all important content +$content = elgg_extract('content', $vars, ''); + +// optional footer for main content area +$footer_content = elgg_extract('footer', $vars, ''); +$params = $vars; +$params['content'] = $footer_content; +$footer = elgg_view('page/layouts/content/footer', $params); + +$body = $header . $filter . $content . $footer; + +$params = array( + 'content' => $body, + 'sidebar' => $sidebar, +); +if (isset($vars['class'])) { + $params['class'] = $vars['class']; +} +echo elgg_view_layout('one_sidebar', $params); diff --git a/views/default/page/layouts/content/filter.php b/views/default/page/layouts/content/filter.php new file mode 100644 index 000000000..701c6418a --- /dev/null +++ b/views/default/page/layouts/content/filter.php @@ -0,0 +1,52 @@ +<?php +/** + * Main content filter + * + * Select between user, friends, and all content + * + * @uses $vars['filter_context'] Filter context: all, friends, mine + * @uses $vars['filter_override'] HTML for overriding the default filter (override) + * @uses $vars['context'] Page context (override) + */ + +if (isset($vars['filter_override'])) { + echo $vars['filter_override']; + return true; +} + +$context = elgg_extract('context', $vars, elgg_get_context()); + +if (elgg_is_logged_in() && $context) { + $username = elgg_get_logged_in_user_entity()->username; + $filter_context = elgg_extract('filter_context', $vars, 'all'); + + // generate a list of default tabs + $tabs = array( + 'all' => array( + 'text' => elgg_echo('all'), + 'href' => (isset($vars['all_link'])) ? $vars['all_link'] : "$context/all", + 'selected' => ($filter_context == 'all'), + 'priority' => 200, + ), + 'mine' => array( + 'text' => elgg_echo('mine'), + 'href' => (isset($vars['mine_link'])) ? $vars['mine_link'] : "$context/owner/$username", + 'selected' => ($filter_context == 'mine'), + 'priority' => 300, + ), + 'friend' => array( + 'text' => elgg_echo('friends'), + 'href' => (isset($vars['friend_link'])) ? $vars['friend_link'] : "$context/friends/$username", + 'selected' => ($filter_context == 'friends'), + 'priority' => 400, + ), + ); + + foreach ($tabs as $name => $tab) { + $tab['name'] = $name; + + elgg_register_menu_item('filter', $tab); + } + + echo elgg_view_menu('filter', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz')); +} diff --git a/views/default/page/layouts/content/footer.php b/views/default/page/layouts/content/footer.php new file mode 100644 index 000000000..66f5d3ff8 --- /dev/null +++ b/views/default/page/layouts/content/footer.php @@ -0,0 +1,8 @@ +<?php +/** + * Main content footer + * + * @uses $vars['content'] The content for the footer + */ + +echo $vars['content']; diff --git a/views/default/page/layouts/content/header.php b/views/default/page/layouts/content/header.php new file mode 100644 index 000000000..1e66e52db --- /dev/null +++ b/views/default/page/layouts/content/header.php @@ -0,0 +1,43 @@ +<?php +/** + * Main content header + * + * Title and title menu + * + * @uses $vars['header_override'] HTML for overriding the default header (override) + * @uses $vars['title'] Title text (override) + * @uses $vars['context'] Page context (override) + */ + +if (isset($vars['buttons'])) { + // it was a bad idea to implement buttons with a pass through + elgg_deprecated_notice("Use elgg_register_menu_item() to register for the title menu", 1.0); +} + +if (isset($vars['header_override'])) { + echo $vars['header_override']; + return true; +} + +$context = elgg_extract('context', $vars, elgg_get_context()); + +$title = elgg_extract('title', $vars, ''); +if (!$title) { + $title = elgg_echo($context); +} +$title = elgg_view_title($title, array('class' => 'elgg-heading-main')); + +if (isset($vars['buttons']) && $vars['buttons']) { + $buttons = $vars['buttons']; +} else { + $buttons = elgg_view_menu('title', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + )); +} + +echo <<<HTML +<div class="elgg-head clearfix"> + $title$buttons +</div> +HTML; diff --git a/views/default/page/layouts/content/sidebar.php b/views/default/page/layouts/content/sidebar.php new file mode 100644 index 000000000..86ca8435f --- /dev/null +++ b/views/default/page/layouts/content/sidebar.php @@ -0,0 +1,8 @@ +<?php +/** + * Main content sidebar + * + * @uses $vars['content] The content for the sidebar + */ + +echo $vars['content']; diff --git a/views/default/page/layouts/default.php b/views/default/page/layouts/default.php new file mode 100644 index 000000000..60dc90b0d --- /dev/null +++ b/views/default/page/layouts/default.php @@ -0,0 +1,18 @@ +<?php +/** + * Elgg default layout + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content string + */ + +// @todo deprecated so remove in Elgg 2.0 +if (isset($vars['area1'])) { + echo $vars['area1']; +} + +if (isset($vars['content'])) { + echo $vars['content']; +} diff --git a/views/default/page/layouts/error.php b/views/default/page/layouts/error.php new file mode 100644 index 000000000..cdce28a8e --- /dev/null +++ b/views/default/page/layouts/error.php @@ -0,0 +1,12 @@ +<?php +/** + * 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); diff --git a/views/default/page/layouts/index.php b/views/default/page/layouts/index.php deleted file mode 100644 index a73a0d7b1..000000000 --- a/views/default/page/layouts/index.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - $area1widgets = $vars['area1']; - $area2widgets = $vars['area2']; - $area3widgets = $vars['area3']; - $layoutmode = $vars['layoutmode']; //edit, index -?> - - <table cellspacing="10" cellpadding="10" width="100%" class="<?php echo elgg_echo($layoutmode); ?>"> - <tr> - <td align="left" valign="top" class="half"> - <div id="leftcolumn_widgets" class="half_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area1widgets) ?> - </div> - </td> - <td align="left" valign="top" class="half"> - <div id="middlecolumn_widgets" class="half_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area2widgets) ?> - </div> - </td> - </tr> - <tr > - <td colspan="2" align="left" valign="top" class="big"> - <div id="rightcolumn_widgets" class="big_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area3widgets) ?> - </div> - </td> - </tr> - </table> - - diff --git a/views/default/page/layouts/index_1rsss.php b/views/default/page/layouts/index_1rsss.php deleted file mode 100644 index 0d43469e9..000000000 --- a/views/default/page/layouts/index_1rsss.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php
- $area1widgets = $vars['area1'];
- $area2widgets = $vars['area2'];
- $area3widgets = $vars['area3'];
- $layoutmode = $vars['layoutmode']; //edit, index
-?>
-
- <table cellspacing="10" cellpadding="10" width="100%" class="<?php echo elgg_echo($layoutmode); ?>">
- <tr>
- <td align="left" valign="top" class="small">
- <div id="leftcolumn_widgets" class="small_<?php echo elgg_echo($layoutmode); ?>_box">
- <?php custom_index_show_widget_area($area1widgets) ?>
- </div>
- </td>
- <td align="left" valign="top" class="small">
- <div id="middlecolumn_widgets" class="small_<?php echo elgg_echo($layoutmode); ?>_box">
- <?php custom_index_show_widget_area($area2widgets) ?>
- </div>
- </td>
- <td align="left" valign="top" class="small">
- <div id="rightcolumn_widgets" class="small_<?php echo elgg_echo($layoutmode); ?>_box">
- <?php custom_index_show_widget_area($area3widgets) ?>
- </div>
- </td>
-
- </tr>
- </table>
-
-
diff --git a/views/default/page/layouts/index_2rbhh.php b/views/default/page/layouts/index_2rbhh.php deleted file mode 100644 index 7f8c22437..000000000 --- a/views/default/page/layouts/index_2rbhh.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - $area1widgets = $vars['area1']; - $area2widgets = $vars['area2']; - $area3widgets = $vars['area3']; - $layoutmode = $vars['layoutmode']; //edit, index -?> - - <table cellspacing="10" cellpadding="10" width="100%" class="<?php echo elgg_echo($layoutmode); ?>"> - <tr> - <td colspan="2" align="left" valign="top" class="big"> - <div id="leftcolumn_widgets" class="big_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area1widgets) ?> - </div> - </td> - </tr> - <tr> - <td align="left" valign="top" class="half"> - <div id="middlecolumn_widgets" class="half_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area2widgets) ?> - </div> - </td> - <td align="left" valign="top" class="half"> - <div id="rightcolumn_widgets" class="half_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area3widgets) ?> - </div> - </td> - </tr> - </table> - - diff --git a/views/default/page/layouts/index_2rbms.php b/views/default/page/layouts/index_2rbms.php deleted file mode 100644 index fdb0cf38b..000000000 --- a/views/default/page/layouts/index_2rbms.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php
- $area1widgets = $vars['area1'];
- $area2widgets = $vars['area2'];
- $area3widgets = $vars['area3'];
- $layoutmode = $vars['layoutmode']; //edit, index
-?>
-
- <table cellspacing="10" cellpadding="10" width="100%" class="<?php echo elgg_echo($layoutmode); ?>">
- <tr>
- <td colspan="2" align="left" valign="top" class="big">
- <div id="leftcolumn_widgets" class="big_<?php echo elgg_echo($layoutmode); ?>_box">
- <?php custom_index_show_widget_area($area1widgets) ?>
- </div>
- </td>
- </tr>
- <tr>
- <td align="left" valign="top" class="medium">
- <div id="middlecolumn_widgets" class="medium_<?php echo elgg_echo($layoutmode); ?>_box">
- <?php custom_index_show_widget_area($area2widgets) ?>
- </div>
- </td>
- <td align="left" valign="top" class="small">
- <div id="rightcolumn_widgets" class="small_<?php echo elgg_echo($layoutmode); ?>_box">
- <?php custom_index_show_widget_area($area3widgets) ?>
- </div>
- </td>
- </tr>
- </table>
-
-
diff --git a/views/default/page/layouts/index_2rbsm.php b/views/default/page/layouts/index_2rbsm.php deleted file mode 100644 index d5a81f1f5..000000000 --- a/views/default/page/layouts/index_2rbsm.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - $area1widgets = $vars['area1']; - $area2widgets = $vars['area2']; - $area3widgets = $vars['area3']; - $layoutmode = $vars['layoutmode']; //edit, index -?> - - <table cellspacing="10" cellpadding="10" width="100%" class="<?php echo elgg_echo($layoutmode); ?>"> - <tr> - <td colspan="2" align="left" valign="top" class="big"> - <div id="leftcolumn_widgets" class="big_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area1widgets) ?> - </div> - </td> - </tr> - <tr> - <td align="left" valign="top" class="small"> - <div id="middlecolumn_widgets" class="small_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area2widgets) ?> - </div> - </td> - <td align="left" valign="top" class="medium"> - <div id="rightcolumn_widgets" class="medium_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area3widgets) ?> - </div> - </td> - </tr> - </table>
\ No newline at end of file diff --git a/views/default/page/layouts/index_2rhhb.php b/views/default/page/layouts/index_2rhhb.php deleted file mode 100644 index ae2995ff9..000000000 --- a/views/default/page/layouts/index_2rhhb.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - $area1widgets = $vars['area1']; - $area2widgets = $vars['area2']; - $area3widgets = $vars['area3']; - $layoutmode = $vars['layoutmode']; //edit, index -?> - - <table cellspacing="10" cellpadding="10" width="100%" class="<?php echo elgg_echo($layoutmode); ?>"> - <tr> - <td align="left" valign="top" class="half"> - <div id="leftcolumn_widgets" class="half_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area1widgets) ?> - </div> - </td> - <td align="left" valign="top" class="half"> - <div id="middlecolumn_widgets" class="half_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area2widgets) ?> - </div> - </td> - </tr> - <tr> - <td colspan="2" align="left" valign="top" class="big"> - <div id="rightcolumn_widgets" class="big_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area3widgets) ?> - </div> - </td> - </tr> - </table> - - diff --git a/views/default/page/layouts/index_2rmsb.php b/views/default/page/layouts/index_2rmsb.php deleted file mode 100644 index a774a4a42..000000000 --- a/views/default/page/layouts/index_2rmsb.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php
- $area1widgets = $vars['area1'];
- $area2widgets = $vars['area2'];
- $area3widgets = $vars['area3'];
- $layoutmode = $vars['layoutmode']; //edit, index
-?>
-
- <table cellspacing="10" cellpadding="10" width="100%" class="<?php echo elgg_echo($layoutmode); ?>">
- <tr>
- <td align="left" valign="top" class="medium">
- <div id="leftcolumn_widgets" class="medium_<?php echo elgg_echo($layoutmode); ?>_box">
- <?php custom_index_show_widget_area($area1widgets) ?>
- </div>
- </td>
- <td align="left" valign="top" class="small">
- <div id="middlecolumn_widgets" class="small_<?php echo elgg_echo($layoutmode); ?>_box">
- <?php custom_index_show_widget_area($area2widgets) ?>
- </div>
- </td>
- </tr>
- <tr>
- <td colspan="2" align="left" valign="top" class="big">
- <div id="rightcolumn_widgets" class="big_<?php echo elgg_echo($layoutmode); ?>_box">
- <?php custom_index_show_widget_area($area3widgets) ?>
- </div>
- </td>
- </tr>
- </table>
-
-
diff --git a/views/default/page/layouts/index_2rsmb.php b/views/default/page/layouts/index_2rsmb.php deleted file mode 100644 index 72bb92d3d..000000000 --- a/views/default/page/layouts/index_2rsmb.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - $area1widgets = $vars['area1']; - $area2widgets = $vars['area2']; - $area3widgets = $vars['area3']; - $layoutmode = $vars['layoutmode']; //edit, index -?> - - <table cellspacing="10" cellpadding="10" width="100%" class="<?php echo elgg_echo($layoutmode); ?>"> - <tr> - <td align="left" valign="top" class="small"> - <div id="leftcolumn_widgets" class="small_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area1widgets) ?> - </div> - </td> - <td align="left" valign="top" class="medium"> - <div id="middlecolumn_widgets" class="medium_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area2widgets) ?> - </div> - </td> - </tr> - <tr> - <td colspan="2" align="left" valign="top" class="big"> - <div id="rightcolumn_widgets" class="big_<?php echo elgg_echo($layoutmode); ?>_box"> - <?php custom_index_show_widget_area($area3widgets) ?> - </div> - </td> - </tr> - </table> - - diff --git a/views/default/page/layouts/one_column.php b/views/default/page/layouts/one_column.php new file mode 100644 index 000000000..491d5b459 --- /dev/null +++ b/views/default/page/layouts/one_column.php @@ -0,0 +1,38 @@ +<?php +/** + * Elgg one-column layout + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content string + * @uses $vars['class'] Additional class to apply to layout + */ + +$class = 'elgg-layout elgg-layout-one-column clearfix'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +// navigation defaults to breadcrumbs +$nav = elgg_extract('nav', $vars, elgg_view('navigation/breadcrumbs')); + +?> +<div class="<?php echo $class; ?>"> + <div class="elgg-body elgg-main"> + <?php + echo $nav; + + if (isset($vars['title'])) { + echo elgg_view_title($vars['title']); + } + + echo $vars['content']; + + // @deprecated 1.8 + if (isset($vars['area1'])) { + echo $vars['area1']; + } + ?> + </div> +</div>
\ No newline at end of file diff --git a/views/default/page/layouts/one_sidebar.php b/views/default/page/layouts/one_sidebar.php new file mode 100644 index 000000000..d74dad53d --- /dev/null +++ b/views/default/page/layouts/one_sidebar.php @@ -0,0 +1,48 @@ +<?php +/** + * Layout for main column with one sidebar + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content HTML for the main column + * @uses $vars['sidebar'] Optional content that is displayed in the sidebar + * @uses $vars['title'] Optional title for main content area + * @uses $vars['class'] Additional class to apply to layout + * @uses $vars['nav'] HTML of the page nav (override) (default: breadcrumbs) + */ + +$class = 'elgg-layout elgg-layout-one-sidebar clearfix'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +// navigation defaults to breadcrumbs +$nav = elgg_extract('nav', $vars, elgg_view('navigation/breadcrumbs')); + +?> + +<div class="<?php echo $class; ?>"> + <div class="elgg-sidebar"> + <?php + echo elgg_view('page/elements/sidebar', $vars); + ?> + </div> + + <div class="elgg-main elgg-body"> + <?php + echo $nav; + + if (isset($vars['title'])) { + echo elgg_view_title($vars['title']); + } + // @todo deprecated so remove in Elgg 2.0 + if (isset($vars['area1'])) { + echo $vars['area1']; + } + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + </div> +</div> diff --git a/views/default/page/layouts/two_column_left_sidebar.php b/views/default/page/layouts/two_column_left_sidebar.php new file mode 100644 index 000000000..e395a5053 --- /dev/null +++ b/views/default/page/layouts/two_column_left_sidebar.php @@ -0,0 +1,26 @@ +<?php +/** + * Deprecated layout from 1.0-1.7 + * + * Use one_sidebar instead + */ + +if (!isset($vars['content'])) { + $vars['content'] = $vars['area2']; +} +if (!isset($vars['content'])) { + $vars['sidebar'] = $vars['area1'] . $vars['area3']; +} + +unset($vars['area1']); +unset($vars['area2']); +unset($vars['area3']); + +// backward compatability support for plugins that are not using the new approach +// of routing through 'admin' +if (elgg_get_context() == 'admin') { + echo elgg_view('page/layouts/admin', $vars); + return true; +} + +echo elgg_view('page/layouts/one_sidebar', $vars); diff --git a/views/default/page/layouts/two_sidebar.php b/views/default/page/layouts/two_sidebar.php new file mode 100644 index 000000000..7521dd44f --- /dev/null +++ b/views/default/page/layouts/two_sidebar.php @@ -0,0 +1,43 @@ +<?php +/** + * Elgg 2 sidebar layout + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] The content string for the main column + * @uses $vars['sidebar'] Optional content that is displayed in the sidebar + * @uses $vars['sidebar_alt'] Optional content that is displayed in the alternate sidebar + * @uses $vars['class'] Additional class to apply to layout + */ + +$class = 'elgg-layout elgg-layout-two-sidebar clearfix'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} +?> + +<div class="<?php echo $class; ?>"> + <div class="elgg-sidebar"> + <?php + echo elgg_view('page/elements/sidebar', $vars); + ?> + </div> + <div class="elgg-sidebar-alt"> + <?php + echo elgg_view('page/elements/sidebar_alt', $vars); + ?> + </div> + + <div class="elgg-main elgg-body"> + <?php + // @todo deprecated so remove in Elgg 2.0 + if (isset($vars['area1'])) { + echo $vars['area1']; + } + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + </div> +</div> diff --git a/views/default/page/layouts/walled_garden.php b/views/default/page/layouts/walled_garden.php new file mode 100644 index 000000000..6ecd941ef --- /dev/null +++ b/views/default/page/layouts/walled_garden.php @@ -0,0 +1,16 @@ +<?php +/** + * Walled Garden layout + * + * @uses $vars['content'] Main content + * @uses $vars['class'] CSS classes + * @uses $vars['id'] CSS id + */ + +$class = elgg_extract('class', $vars, 'elgg-walledgarden-single'); +echo elgg_view_module('walledgarden', '', $vars['content'], array( + 'class' => $class, + 'id' => elgg_extract('id', $vars, ''), + 'header' => ' ', + 'footer' => ' ', +)); diff --git a/views/default/page/layouts/edit_widgets.php b/views/default/page/layouts/widgets.php index f61cea356..c6b162516 100644 --- a/views/default/page/layouts/edit_widgets.php +++ b/views/default/page/layouts/widgets.php @@ -19,7 +19,7 @@ $owner = elgg_get_page_owner_entity(); $widget_types = elgg_get_widget_types(); $context = elgg_get_context(); -//elgg_push_context('widgets'); +elgg_push_context('widgets'); $widgets = elgg_get_widgets($owner->guid, $context); @@ -31,6 +31,7 @@ if (elgg_can_edit_widget_layout($context)) { 'widgets' => $widgets, 'context' => $context, 'exact_match' => $exact_match, + 'show_access' => $show_access, ); echo elgg_view('page/layouts/widgets/add_panel', $params); } diff --git a/views/default/page/layouts/widgets/add_button.php b/views/default/page/layouts/widgets/add_button.php new file mode 100644 index 000000000..c33a45f99 --- /dev/null +++ b/views/default/page/layouts/widgets/add_button.php @@ -0,0 +1,16 @@ +<?php +/** + * Button area for showing the add widgets panel + */ +?> +<div class="elgg-widget-add-control"> +<?php + echo elgg_view('output/url', array( + 'href' => '#widgets-add-panel', + 'text' => elgg_echo('widgets:add'), + 'class' => 'elgg-button elgg-button-action', + 'rel' => 'toggle', + 'is_trusted' => true, + )); +?> +</div> diff --git a/views/default/page/layouts/widgets/add_panel.php b/views/default/page/layouts/widgets/add_panel.php new file mode 100644 index 000000000..d9b11342a --- /dev/null +++ b/views/default/page/layouts/widgets/add_panel.php @@ -0,0 +1,62 @@ +<?php +/** + * Widget add panel + * + * @uses $vars['widgets'] Array of current widgets + * @uses $vars['context'] The context for this widget layout + * @uses $vars['exact_match'] Only use widgets that match the context + */ + +$widgets = $vars['widgets']; +$context = $vars['context']; +$exact = elgg_extract('exact_match', $vars, false); + +$widget_types = elgg_get_widget_types($context, $exact); +uasort($widget_types, create_function('$a,$b', 'return strcmp($a->name,$b->name);')); + +$current_handlers = array(); +foreach ($widgets as $column_widgets) { + foreach ($column_widgets as $widget) { + $current_handlers[] = $widget->handler; + } +} + +?> +<div class="elgg-widgets-add-panel hidden clearfix" id="widgets-add-panel"> + <p> + <?php echo elgg_echo('widgets:add:description'); ?> + </p> + <ul> +<?php + foreach ($widget_types as $handler => $widget_type) { + $id = "elgg-widget-type-$handler"; + // check if widget added and only one instance allowed + if ($widget_type->multiple == false && in_array($handler, $current_handlers)) { + $class = 'elgg-state-unavailable'; + $tooltip = elgg_echo('widget:unavailable'); + } else { + $class = 'elgg-state-available'; + $tooltip = $widget_type->description; + } + + if ($widget_type->multiple) { + $class .= ' elgg-widget-multiple'; + } else { + $class .= ' elgg-widget-single'; + } + + echo "<li title=\"$tooltip\" id=\"$id\" class=\"$class\">$widget_type->name</li>"; + } +?> + </ul> +<?php + echo elgg_view('input/hidden', array( + 'name' => 'widget_context', + 'value' => $context + )); + echo elgg_view('input/hidden', array( + 'name' => 'show_access', + 'value' => (int)$vars['show_access'] + )); +?> +</div> |