diff options
Diffstat (limited to 'views/default')
249 files changed, 8998 insertions, 67 deletions
diff --git a/views/default/admin/appearance/default_widgets.php b/views/default/admin/appearance/default_widgets.php new file mode 100644 index 000000000..1bf5791ac --- /dev/null +++ b/views/default/admin/appearance/default_widgets.php @@ -0,0 +1,82 @@ +<?php +/** + * Default widgets landing page. + * + * @package Elgg.Core + * @subpackage Administration.DefaultWidgets + */ + +$object = elgg_get_entities(array( + 'type' => 'object', + 'subtype' => 'moddefaultwidgets', + 'limit' => 1, +)); + +if ($object) { + echo elgg_view('output/url', array( + 'text' => elgg_echo('upgrade'), + 'href' => 'action/widgets/upgrade', + 'is_action' => true, + 'is_trusted' => true, + 'class' => 'elgg_button elgg-button-submit', + 'title' => 'Upgrade your default widgets to work on Elgg 1.8', + )); +} + +elgg_push_context('default_widgets'); +$widget_context = get_input('widget_context'); +$list = elgg_trigger_plugin_hook('get_list', 'default_widgets', null, array()); + +// default to something if we can +if (!$widget_context && $list) { + $widget_context = $list[0]['widget_context']; +} + +$current_info = null; +$tabs = array(); +foreach ($list as $info) { + $url = "admin/appearance/default_widgets?widget_context={$info['widget_context']}"; + $selected = false; + if ($widget_context == $info['widget_context']) { + $selected = true; + $current_info = $info; + } + + $tabs[] = array( + 'title' => $info['name'], + 'url' => $url, + 'selected' => $selected + ); +} + +$tabs_vars = array( + 'tabs' => $tabs +); + +echo elgg_view('navigation/tabs', $tabs_vars); + +echo elgg_view('output/longtext', array('value' => elgg_echo('admin:default_widgets:instructions'))); + +if (!$current_info) { + $content = elgg_echo('admin:default_widgets:unknown_type'); +} else { + // default widgets are owned and saved to the site. + elgg_set_page_owner_guid(elgg_get_config('site_guid')); + elgg_push_context($current_info['widget_context']); + + $default_widgets_input = elgg_view('input/hidden', array( + 'name' => 'default_widgets', + 'value' => 1 + )); + + $params = array( + 'content' => $default_widgets_input, + 'num_columns' => $current_info['widget_columns'], + ); + + $content = elgg_view_layout('widgets', $params); + elgg_pop_context(); +} +elgg_pop_context(); + +echo $content; diff --git a/views/default/admin/appearance/menu_items.php b/views/default/admin/appearance/menu_items.php new file mode 100644 index 000000000..1d5c95cf9 --- /dev/null +++ b/views/default/admin/appearance/menu_items.php @@ -0,0 +1,10 @@ +<?php +/** + * Elgg administration menu items + * + * @package Elgg + * @subpackage Core + */ + + +echo elgg_view_form('admin/menu/save', array('class' => 'elgg-form-settings')); diff --git a/views/default/admin/appearance/profile_fields.php b/views/default/admin/appearance/profile_fields.php new file mode 100644 index 000000000..f1d78c19f --- /dev/null +++ b/views/default/admin/appearance/profile_fields.php @@ -0,0 +1,24 @@ +<?php +/** + * Admin area: edit default profile fields + */ + +$add = elgg_view_form('profile/fields/add', array('class' => 'elgg-form-settings'), array()); +$list = elgg_view('admin/appearance/profile_fields/list'); + +$reset = elgg_view('output/confirmlink', array( + 'text' => elgg_echo('reset'), + 'href' => 'action/profile/fields/reset', + 'title' => elgg_echo('profile:resetdefault'), + 'confirm' => elgg_echo('profile:resetdefault:confirm'), + 'class' => 'elgg-button elgg-button-cancel', + 'is_trusted' => 'true', +)); + +$body = <<<__HTML +$add +$list +<div class="mtl">$reset</div> +__HTML; + +echo $body; diff --git a/views/default/admin/appearance/profile_fields/list.php b/views/default/admin/appearance/profile_fields/list.php new file mode 100644 index 000000000..b9440a95d --- /dev/null +++ b/views/default/admin/appearance/profile_fields/list.php @@ -0,0 +1,55 @@ +<?php +/** + * Profile fields. + * + * @todo Needs some review + */ + +// List form elements +$n = 0; +$loaded_defaults = array(); +$items = array(); +$fieldlist = elgg_get_config('profile_custom_fields'); +if ($fieldlist) { + $fieldlistarray = explode(',', $fieldlist); + foreach ($fieldlistarray as $listitem) { + $translation = elgg_get_config("admin_defined_profile_$listitem"); + $type = elgg_get_config("admin_defined_profile_type_$listitem"); + if ($translation && $type) { + $item = new stdClass; + $item->translation = $translation; + $item->shortname = $listitem; + $item->name = "admin_defined_profile_$listitem"; + $item->type = elgg_echo("profile:field:$type"); + $items[] = $item; + } + } +} +?> +<ul id="elgg-profile-fields" class="mvm"> +<?php + +$save = elgg_echo('save'); +$cancel = elgg_echo('cancel'); + +foreach ($items as $item) { + echo elgg_view("profile/", array('value' => $item->translation)); + + //$even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; + $url = elgg_view('output/url', array( + 'href' => "action/profile/fields/delete?id={$item->shortname}", + 'text' => elgg_view_icon('delete-alt'), + 'is_action' => true, + 'is_trusted' => true, + )); + $type = elgg_echo($item->type); + echo <<<HTML +<li id="$item->shortname" class="clearfix"> + <span class="elgg-icon elgg-icon-drag-arrow elgg-state-draggable"></span> + <b><span id="elgg-profile-field-{$item->shortname}" class="elgg-state-editable">$item->translation</span></b> [$type] $url +</li> +HTML; +} + +?> +</ul>
\ No newline at end of file diff --git a/views/default/admin/dashboard.php b/views/default/admin/dashboard.php new file mode 100644 index 000000000..d3976ca38 --- /dev/null +++ b/views/default/admin/dashboard.php @@ -0,0 +1,12 @@ +<?php + +elgg_set_page_owner_guid(elgg_get_logged_in_user_guid()); + +$params = array( + 'num_columns' => 2, + 'exact_match' => true, + 'show_access' => false, +); +$widgets = elgg_view_layout('widgets', $params); + +echo $widgets;
\ No newline at end of file diff --git a/views/default/admin/footer.php b/views/default/admin/footer.php new file mode 100644 index 000000000..ce420e99a --- /dev/null +++ b/views/default/admin/footer.php @@ -0,0 +1,9 @@ +<?php +/** + * Elgg admin footer. Extend this view to add content to the admin footer + */ + +$options = array( + 'class' => 'elgg-menu-hz' +); +echo elgg_view_menu('admin_footer', $options);
\ No newline at end of file diff --git a/views/default/admin/header.php b/views/default/admin/header.php new file mode 100644 index 000000000..331190a88 --- /dev/null +++ b/views/default/admin/header.php @@ -0,0 +1,27 @@ +<?php +/** + * Elgg admin header + */ +$admin_title = elgg_get_site_entity()->name . ' ' . elgg_echo('admin'); + +$view_site = elgg_view('output/url', array( + 'href' => elgg_get_site_url(), + 'text' => elgg_echo('admin:view_site'), + 'is_trusted' => true, +)); +$logout = elgg_view('output/url', array( + 'href' => 'action/logout', + 'text' => elgg_echo('logout'), + 'is_trusted' => true, +)); +?> +<h1 class="elgg-heading-site"> + <a href="<?php echo elgg_get_site_url(); ?>admin"> + <?php echo $admin_title; ?> + </a> +</h1> +<ul class="elgg-menu-user"> + <li><?php echo elgg_echo('admin:loggedin', array(elgg_get_logged_in_user_entity()->name)); ?></li> + <li><?php echo $view_site; ?></li> + <li><?php echo $logout; ?></li> +</ul>
\ No newline at end of file diff --git a/views/default/admin/plugin_settings.php b/views/default/admin/plugin_settings.php new file mode 100644 index 000000000..1c6e9e206 --- /dev/null +++ b/views/default/admin/plugin_settings.php @@ -0,0 +1,26 @@ +<?php +/** + * Elgg plugin settings + * + * @uses ElggPlugin $vars['plugin'] The plugin object to display settings for. + * + * @package Elgg.Core + * @subpackage Plugins.Settings + */ + +$plugin = $vars['plugin']; +$plugin_id = $plugin->getID(); + +// required for plugin settings backward compatibility +$vars['entity'] = $plugin; + +$settings = false; + +if (elgg_view_exists("settings/$plugin_id/edit") || elgg_view_exists("plugins/$plugin_id/settings")) { + $title = $plugin->getManifest()->getName(); + + $params = array('id' => "$plugin_id-settings", 'class' => 'elgg-form-settings'); + $body = elgg_view_form("plugins/settings/save", $params, $vars); + + echo elgg_view_module('info', $title, $body); +}
\ No newline at end of file diff --git a/views/default/admin/plugins.php b/views/default/admin/plugins.php new file mode 100644 index 000000000..42f153d0f --- /dev/null +++ b/views/default/admin/plugins.php @@ -0,0 +1,197 @@ +<?php +/** + * Elgg administration plugin screen + * + * Shows a list of plugins that can be sorted and filtered. + * + * @package Elgg.Core + * @subpackage Admin.Plugins + */ + +elgg_load_js('lightbox'); +elgg_load_css('lightbox'); + +elgg_generate_plugin_entities(); +$installed_plugins = elgg_get_plugins('any'); +$show_category = get_input('category', 'all'); +$sort = get_input('sort', 'priority'); + +// Get a list of the all categories +// and trim down the plugin list if we're not viewing all categories. +// @todo this could be cached somewhere after have the manifest loaded +$categories = array(); + +foreach ($installed_plugins as $id => $plugin) { + if (!$plugin->isValid()) { + if ($plugin->isActive()) { + // force disable and warn + elgg_add_admin_notice('invalid_and_deactivated_' . $plugin->getID(), + elgg_echo('ElggPlugin:InvalidAndDeactivated', array($plugin->getId()))); + $plugin->deactivate(); + } + continue; + } + + $plugin_categories = $plugin->getManifest()->getCategories(); + + // handle plugins that don't declare categories + // unset them here because this is the list we foreach + switch ($show_category) { + case 'all': + break; + case 'active': + if (!$plugin->isActive()) { + unset($installed_plugins[$id]); + } + break; + case 'inactive': + if ($plugin->isActive()) { + unset($installed_plugins[$id]); + } + break; + case 'nonbundled': + if (in_array('bundled', $plugin_categories)) { + unset($installed_plugins[$id]); + } + break; + default: + if (!in_array($show_category, $plugin_categories)) { + unset($installed_plugins[$id]); + } + break; + } + + if (isset($plugin_categories)) { + foreach ($plugin_categories as $category) { + if (!array_key_exists($category, $categories)) { + $categories[$category] = ElggPluginManifest::getFriendlyCategory($category); + } + } + } +} + +$guids = array(); +foreach ($installed_plugins as $plugin) { + $guids[] = $plugin->getGUID(); +} + +// sort plugins +switch ($sort) { + case 'date': + $plugin_list = array(); + foreach ($installed_plugins as $plugin) { + $create_date = $plugin->getTimeCreated(); + while (isset($plugin_list[$create_date])) { + $create_date++; + } + $plugin_list[$create_date] = $plugin; + } + krsort($plugin_list); + break; + case 'alpha': + $plugin_list = array(); + foreach ($installed_plugins as $plugin) { + $plugin_list[$plugin->getFriendlyName()] = $plugin; + } + ksort($plugin_list); + break; + case 'priority': + default: + $plugin_list = $installed_plugins; + break; +} + + + +asort($categories); + +// we want bundled/nonbundled pulled to be at the top of the list +unset($categories['bundled']); +unset($categories['nonbundled']); + +$common_categories = array( + 'all' => elgg_echo('admin:plugins:category:all'), + 'active' => elgg_echo('admin:plugins:category:active'), + 'inactive' => elgg_echo('admin:plugins:category:inactive'), + 'bundled' => elgg_echo('admin:plugins:category:bundled'), + 'nonbundled' => elgg_echo('admin:plugins:category:nonbundled'), +); + +$categories = array_merge($common_categories, $categories); +// security - only want a defined option +if (!array_key_exists($show_category, $categories)) { + $show_category = reset($categories); +} + +$category_form = elgg_view_form('admin/plugins/filter', array( + 'action' => 'admin/plugins', + 'method' => 'get', + 'disable_security' => true, +), array( + 'category' => $show_category, + 'category_options' => $categories, + 'sort' => $sort, +)); + + +$sort_options = array( + 'priority' => elgg_echo('admin:plugins:sort:priority'), + 'alpha' => elgg_echo('admin:plugins:sort:alpha'), + 'date' => elgg_echo('admin:plugins:sort:date'), +); +// security - only want a defined option +if (!array_key_exists($sort, $sort_options)) { + $sort = reset($sort_options); +} + +$sort_form = elgg_view_form('admin/plugins/sort', array( + 'action' => 'admin/plugins', + 'method' => 'get', + 'disable_security' => true, +), array( + 'sort' => $sort, + 'sort_options' => $sort_options, + 'category' => $show_category, +)); + +$buttons = "<div class=\"clearfix mbm\">"; +$buttons .= elgg_view_form('admin/plugins/change_state', array( + 'action' => 'action/admin/plugins/activate_all', + 'class' => 'float', +), array( + 'guids' => $guids, + 'action' => 'activate', +)); +$buttons .= elgg_view_form('admin/plugins/change_state', array( + 'action' => 'action/admin/plugins/deactivate_all', + 'class' => 'float', +), array( + 'guids' => $guids, + 'action' => 'deactivate', +)); +$buttons .= "</div>"; + +$buttons .= $category_form . $sort_form; + +// construct page header +?> +<div id="content_header" class="mbm clearfix"> + <div class="content-header-options"><?php echo $buttons ?></div> +</div> + +<div id="elgg-plugin-list"> +<?php + +$options = array( + 'limit' => 0, + 'full_view' => true, + 'list_type_toggle' => false, + 'pagination' => false, +); +if ($show_category == 'all' && $sort == 'priority') { + $options['display_reordering'] = true; +} +echo elgg_view_entity_list($plugin_list, $options); + +?> +</div>
\ No newline at end of file diff --git a/views/default/admin/settings/advanced.php b/views/default/admin/settings/advanced.php new file mode 100644 index 000000000..a262740f2 --- /dev/null +++ b/views/default/admin/settings/advanced.php @@ -0,0 +1,9 @@ +<?php +/** + * Elgg administration site advanced settings + * + * @package Elgg + * @subpackage Core + */ + +echo elgg_view_form('admin/site/update_advanced', array('class' => 'elgg-form-settings')); diff --git a/views/default/admin/settings/advanced/site_secret.php b/views/default/admin/settings/advanced/site_secret.php new file mode 100644 index 000000000..e70ac7ab6 --- /dev/null +++ b/views/default/admin/settings/advanced/site_secret.php @@ -0,0 +1,11 @@ +<?php +/** + * Elgg administration site secret settings + * + * @package Elgg + * @subpackage Core + */ + +echo elgg_view_form('admin/site/regenerate_secret', array(), array( + 'strength' => _elgg_get_site_secret_strength(), +)); diff --git a/views/default/admin/settings/basic.php b/views/default/admin/settings/basic.php new file mode 100644 index 000000000..9334ba81b --- /dev/null +++ b/views/default/admin/settings/basic.php @@ -0,0 +1,9 @@ +<?php +/** + * Elgg administration site basic settings + * + * @package Elgg + * @subpackage Core + */ + +echo elgg_view_form('admin/site/update_basic', array('class' => 'elgg-form-settings')); diff --git a/views/default/admin/sidebar.php b/views/default/admin/sidebar.php new file mode 100644 index 000000000..100ce2af8 --- /dev/null +++ b/views/default/admin/sidebar.php @@ -0,0 +1,8 @@ +<?php +/** + * Admin sidebar -- just outputs the page menus + */ + +$content = elgg_view_menu('page', array('sort_by' => 'priority', 'show_section_headers' => true)); + +echo elgg_view_module('main', '', $content, array('class' => 'elgg-admin-sidebar-menu'));
\ No newline at end of file diff --git a/views/default/admin/statistics/overview.php b/views/default/admin/statistics/overview.php new file mode 100644 index 000000000..ac5aaac36 --- /dev/null +++ b/views/default/admin/statistics/overview.php @@ -0,0 +1,13 @@ +<?php +/** + * Elgg statistics screen + * + * @package Elgg + * @subpackage Core + */ + +echo elgg_view('admin/statistics/extend'); + +echo elgg_view_module('inline', elgg_echo('admin:statistics:label:basic'), elgg_view('admin/statistics/overview/basic')); + +echo elgg_view_module('inline', elgg_echo('admin:statistics:label:numentities'), elgg_view('admin/statistics/overview/numentities')); diff --git a/views/default/admin/statistics/overview/basic.php b/views/default/admin/statistics/overview/basic.php new file mode 100644 index 000000000..2c9b3b88e --- /dev/null +++ b/views/default/admin/statistics/overview/basic.php @@ -0,0 +1,19 @@ +<?php +// Work out number of users +$users_stats = get_number_users(); +$total_users = get_number_users(true); + +// Get version information +$version = get_version(); +$release = get_version(true); +?> +<table class="elgg-table-alt"> + <tr class="odd"> + <td><b><?php echo elgg_echo('admin:statistics:label:version'); ?> :</b></td> + <td><?php echo elgg_echo('admin:statistics:label:version:release'); ?> - <?php echo $release; ?>, <?php echo elgg_echo('admin:statistics:label:version:version'); ?> - <?php echo $version; ?></td> + </tr> + <tr class="even"> + <td><b><?php echo elgg_echo('admin:statistics:label:numusers'); ?> :</b></td> + <td><?php echo $users_stats; ?> <?php echo elgg_echo('active'); ?> / <?php echo $total_users; ?> <?php echo elgg_echo('total') ?></td> + </tr> +</table>
\ No newline at end of file diff --git a/views/default/admin/statistics/overview/numentities.php b/views/default/admin/statistics/overview/numentities.php new file mode 100644 index 000000000..af4ae2773 --- /dev/null +++ b/views/default/admin/statistics/overview/numentities.php @@ -0,0 +1,40 @@ +<?php +// Get entity statistics +$entity_stats = get_entity_statistics(); +$even_odd = ""; +?> +<table class="elgg-table-alt"> +<?php +foreach ($entity_stats as $k => $entry) { + arsort($entry); + foreach ($entry as $a => $b) { + + //This function controls the alternating class + $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; + + if ($a == "__base__") { + $a = elgg_echo("item:{$k}"); + if (empty($a)) + $a = $k; + } else { + if (empty($a)) { + $a = elgg_echo("item:{$k}"); + } else { + $a = elgg_echo("item:{$k}:{$a}"); + } + + if (empty($a)) { + $a = "$k $a"; + } + } + + echo <<< END + <tr class="{$even_odd}"> + <td>{$a}:</td> + <td>{$b}</td> + </tr> +END; + } + } +?> +</table> diff --git a/views/default/admin/statistics/server.php b/views/default/admin/statistics/server.php new file mode 100644 index 000000000..9d21addc1 --- /dev/null +++ b/views/default/admin/statistics/server.php @@ -0,0 +1,8 @@ +<?php +/** + * Server information + */ + +echo elgg_view_module('inline', elgg_echo('admin:server:label:web_server'), elgg_view('admin/statistics/server/web_server')); + +echo elgg_view_module('inline', elgg_echo('admin:server:label:php'), elgg_view('admin/statistics/server/php')); diff --git a/views/default/admin/statistics/server/php.php b/views/default/admin/statistics/server/php.php new file mode 100644 index 000000000..7c6a51383 --- /dev/null +++ b/views/default/admin/statistics/server/php.php @@ -0,0 +1,50 @@ +<?php +/** + * Server PHP info + */ + +$php_log = ini_get('error_log'); +if (!$php_log) { + $php_log = elgg_echo('admin:server:error_log'); +} + +$post_max_size = elgg_get_ini_setting_in_bytes('post_max_size'); +$upload_max_filesize = elgg_get_ini_setting_in_bytes('upload_max_filesize'); + +$post_max_size_warning = ''; +if ($upload_max_filesize > $post_max_size) { + // @todo show a link to something like http://nigel.mcnie.name/blog/uploadmaxfilesizepostmaxsize-experimentation ? + $post_max_size_warning = elgg_echo('admin:server:warning:post_max_too_small'); +} + +?> +<table class="elgg-table-alt"> + <tr class="odd"> + <td><b><?php echo elgg_echo('admin:server:label:php_version'); ?> :</b></td> + <td><?php echo phpversion(); ?></td> + </tr> + <tr class="even"> + <td><b><?php echo elgg_echo('admin:server:label:php_ini'); ?> :</b></td> + <td><?php echo php_ini_loaded_file(); ?></td> + </tr> + <tr class="odd"> + <td><b><?php echo elgg_echo('admin:server:label:php_log'); ?> :</b></td> + <td><?php echo $php_log; ?></td> + </tr> + <tr class="even"> + <td><b><?php echo elgg_echo('admin:server:label:mem_avail'); ?> :</b></td> + <td><?php echo number_format(elgg_get_ini_setting_in_bytes('memory_limit')); ?></td> + </tr> + <tr class="odd"> + <td><b><?php echo elgg_echo('admin:server:label:mem_used'); ?> :</b></td> + <td><?php echo number_format(memory_get_peak_usage()); ?></td> + </tr> + <tr class="even"> + <td><b><?php echo elgg_echo('admin:server:label:post_max_size'); ?> :</b></td> + <td><?php echo number_format($post_max_size); ?></td> + </tr> + <tr class="odd"> + <td><b><?php echo elgg_echo('admin:server:label:upload_max_filesize'); ?> :</b></td> + <td><?php echo number_format($upload_max_filesize) . ' ' . $post_max_size_warning; ?></td> + </tr> +</table> diff --git a/views/default/admin/statistics/server/web_server.php b/views/default/admin/statistics/server/web_server.php new file mode 100644 index 000000000..904a54f4b --- /dev/null +++ b/views/default/admin/statistics/server/web_server.php @@ -0,0 +1,16 @@ +<?php +/** + * Web server info + */ + +?> +<table class="elgg-table-alt"> + <tr class="odd"> + <td><b><?php echo elgg_echo('admin:server:label:server'); ?> :</b></td> + <td><?php echo $_SERVER['SERVER_SOFTWARE']; ?></td> + </tr> + <tr class="even"> + <td><b><?php echo elgg_echo('admin:server:label:log_location'); ?> :</b></td> + <td><?php echo getenv('APACHE_LOG_DIR'); ?></td> + </tr> +</table> diff --git a/views/default/admin/users/add.php b/views/default/admin/users/add.php new file mode 100644 index 000000000..6d22b9c29 --- /dev/null +++ b/views/default/admin/users/add.php @@ -0,0 +1,9 @@ +<?php +/** + * Display an add user form. + */ + +$title = elgg_echo('adduser'); +$body = elgg_view_form('useradd', array(), array('show_admin' => true)); + +echo elgg_view_module('inline', $title, $body);
\ No newline at end of file diff --git a/views/default/admin/users/admins.php b/views/default/admin/users/admins.php new file mode 100644 index 000000000..9b175d437 --- /dev/null +++ b/views/default/admin/users/admins.php @@ -0,0 +1,12 @@ +<?php +$admins = elgg_list_entities(array(), 'elgg_get_admins'); + +?> +<div class="elgg-module elgg-module-inline"> + <div class="elgg-head"> + <h3><?php echo elgg_echo('admin:statistics:label:admins'); ?></h3> + </div> + <div class="elgg-body"> + <?php echo $admins; ?> + </div> +</div> diff --git a/views/default/admin/users/newest.php b/views/default/admin/users/newest.php new file mode 100644 index 000000000..91a6fa338 --- /dev/null +++ b/views/default/admin/users/newest.php @@ -0,0 +1,18 @@ +<?php +// newest users +$users = elgg_list_entities(array( + 'type' => 'user', + 'subtype'=> null, + 'full_view' => FALSE +)); + +?> + +<div class="elgg-module elgg-module-inline"> + <div class="elgg-head"> + <h3><?php echo elgg_echo('admin:users:newest'); ?></h3> + </div> + <div class="elgg-body"> + <?php echo $users; ?> + </div> +</div> diff --git a/views/default/admin/users/online.php b/views/default/admin/users/online.php new file mode 100644 index 000000000..dbda06066 --- /dev/null +++ b/views/default/admin/users/online.php @@ -0,0 +1,13 @@ +<?php + +$users_online = get_online_users(); + +?> +<div class="elgg-module elgg-module-inline"> + <div class="elgg-head"> + <h3><?php echo elgg_echo('admin:statistics:label:onlineusers'); ?></h3> + </div> + <div class="elgg-body"> + <?php echo $users_online; ?> + </div> +</div> diff --git a/views/default/annotation/default.php b/views/default/annotation/default.php new file mode 100644 index 000000000..5d29a53e2 --- /dev/null +++ b/views/default/annotation/default.php @@ -0,0 +1,40 @@ +<?php +/** + * Elgg default annotation view + * + * @note To add or remove from the annotation menu, register handlers for the menu:annotation hook. + * + * @uses $vars['annotation'] + */ + +$annotation = $vars['annotation']; + +$owner = get_entity($annotation->owner_guid); +if (!$owner) { + return true; +} +$icon = elgg_view_entity_icon($owner, 'tiny'); +$owner_link = "<a href=\"{$owner->getURL()}\">$owner->name</a>"; + +$menu = elgg_view_menu('annotation', array( + 'annotation' => $annotation, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz float-alt', +)); + +$text = elgg_view("output/longtext", array("value" => $annotation->value)); + +$friendlytime = elgg_view_friendly_time($annotation->time_created); + +$body = <<<HTML +<div class="mbn"> + $menu + $owner_link + <span class="elgg-subtext"> + $friendlytime + </span> + $text +</div> +HTML; + +echo elgg_view_image_block($icon, $body); diff --git a/views/default/annotation/generic_comment.php b/views/default/annotation/generic_comment.php new file mode 100644 index 000000000..22a8d9211 --- /dev/null +++ b/views/default/annotation/generic_comment.php @@ -0,0 +1,69 @@ +<?php +/** + * Elgg generic comment view + * + * @uses $vars['annotation'] ElggAnnotation object + * @uses $vars['full_view'] Display fill view or brief view + */ + +if (!isset($vars['annotation'])) { + return true; +} + +$full_view = elgg_extract('full_view', $vars, true); + +$comment = $vars['annotation']; + +$entity = get_entity($comment->entity_guid); +$commenter = get_user($comment->owner_guid); +if (!$entity || !$commenter) { + return true; +} + +$friendlytime = elgg_view_friendly_time($comment->time_created); + +$commenter_icon = elgg_view_entity_icon($commenter, 'tiny'); +$commenter_link = "<a href=\"{$commenter->getURL()}\">$commenter->name</a>"; + +$entity_title = $entity->title ? $entity->title : elgg_echo('untitled'); +$entity_link = "<a href=\"{$entity->getURL()}\">$entity_title</a>"; + +if ($full_view) { + $menu = elgg_view_menu('annotation', array( + 'annotation' => $comment, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz float-alt', + )); + + $comment_text = elgg_view("output/longtext", array("value" => $comment->value)); + + $body = <<<HTML +<div class="mbn"> + $menu + $commenter_link + <span class="elgg-subtext"> + $friendlytime + </span> + $comment_text +</div> +HTML; + + echo elgg_view_image_block($commenter_icon, $body); + +} else { + // brief view + + //@todo need link to actual comment! + + $commented_on = elgg_echo('generic_comment:on', array($commenter_link, $entity_link)); + + $excerpt = elgg_get_excerpt($comment->value, 80); + + $body = <<<HTML +<span class="elgg-subtext"> + $commented_on ($friendlytime): $excerpt +</span> +HTML; + + echo elgg_view_image_block($commenter_icon, $body); +} diff --git a/views/default/api/output.php b/views/default/api/output.php new file mode 100644 index 000000000..a7041c0f4 --- /dev/null +++ b/views/default/api/output.php @@ -0,0 +1,42 @@ +<?php +/** + * Elgg API default output + * This outputs the api in a human readable way. + * + * @package Elgg + * @subpackage Core + * + */ + +$result = $vars['result']; +$export = $result->export(); + +?> +<div id="api_result"> + <table width="100%"> + <tr><td width="100" valign="top"><b>Status:</b></td> <td> + <?php + if ($result instanceof SuccessResult) + echo "OK"; + else + echo "**** ERROR ({$export->status}) ****"; + ?> + </td></tr> + + <?php if ($export->message!="") { ?> + <tr><td width="100" valign="top"><b>Message:</b></td> <td><?php echo $export->message; ?></td></tr> + <?php } ?> + <?php if ($export->result) { ?> + <tr><td width="100" valign="top"><b>Result:</b></td> <td><pre><?php print_r($export->result); ?></pre></td></tr> + <?php } ?> + + + <?php if ($export->pam) { ?> + <tr><td width="100" valign="top"><b>PAM:</b></td> <td><pre><?php print_r($export->pam); ?></pre></td></tr> + <?php } ?> + + <?php if ($export->runtime_errors) { ?> + <tr><td width="100" valign="top"><b>Runtime:</b></td> <td><pre><?php print_r($export->runtime_errors); ?></pre></td></tr> + <?php } ?> + </table> +</div>
\ No newline at end of file diff --git a/views/default/core/account/login_box.php b/views/default/core/account/login_box.php new file mode 100644 index 000000000..f39113653 --- /dev/null +++ b/views/default/core/account/login_box.php @@ -0,0 +1,21 @@ +<?php +/** + * Elgg login box + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['module'] The module name. Default: aside + */ + +$module = elgg_extract('module', $vars, 'aside'); + +$login_url = elgg_get_site_url(); +if (elgg_get_config('https_login')) { + $login_url = str_replace("http:", "https:", $login_url); +} + +$title = elgg_echo('login'); +$body = elgg_view_form('login', array('action' => "{$login_url}action/login")); + +echo elgg_view_module($module, $title, $body); diff --git a/views/default/core/account/login_dropdown.php b/views/default/core/account/login_dropdown.php new file mode 100644 index 000000000..e90cbf106 --- /dev/null +++ b/views/default/core/account/login_dropdown.php @@ -0,0 +1,27 @@ +<?php +/** + * Elgg drop-down login form + */ + +if (elgg_is_logged_in()) { + return true; +} + +$login_url = elgg_get_site_url(); +if (elgg_get_config('https_login')) { + $login_url = str_replace("http:", "https:", elgg_get_site_url()); +} + +$body = elgg_view_form('login', array('action' => "{$login_url}action/login"), array('returntoreferer' => TRUE)); +?> +<div id="login-dropdown"> + <?php + echo elgg_view('output/url', array( + 'href' => 'login#login-dropdown-box', + 'rel' => 'popup', + 'class' => 'elgg-button elgg-button-dropdown', + 'text' => elgg_echo('login'), + )); + echo elgg_view_module('dropdown', '', $body, array('id' => 'login-dropdown-box')); + ?> +</div> diff --git a/views/default/core/avatar/crop.php b/views/default/core/avatar/crop.php new file mode 100644 index 000000000..1c59842c8 --- /dev/null +++ b/views/default/core/avatar/crop.php @@ -0,0 +1,16 @@ +<?php +/** + * Avatar cropping view + * + * @uses vars['entity'] + */ + +?> +<div id="avatar-croppingtool" class="mtl ptm"> + <label><?php echo elgg_echo('avatar:crop:title'); ?></label> + <br /> + <p> + <?php echo elgg_echo("avatar:create:instructions"); ?> + </p> + <?php echo elgg_view_form('avatar/crop', array(), $vars); ?> +</div> diff --git a/views/default/core/avatar/upload.php b/views/default/core/avatar/upload.php new file mode 100644 index 000000000..6f9124192 --- /dev/null +++ b/views/default/core/avatar/upload.php @@ -0,0 +1,51 @@ +<?php +/** + * Avatar upload view + * + * @uses $vars['entity'] + */ + +$user_avatar = elgg_view('output/img', array( + 'src' => $vars['entity']->getIconUrl('medium'), + 'alt' => elgg_echo('avatar'), +)); + +$current_label = elgg_echo('avatar:current'); + +$remove_button = ''; +if ($vars['entity']->icontime) { + $remove_button = elgg_view('output/url', array( + 'text' => elgg_echo('remove'), + 'title' => elgg_echo('avatar:remove'), + 'href' => 'action/avatar/remove?guid=' . elgg_get_page_owner_guid(), + 'is_action' => true, + 'class' => 'elgg-button elgg-button-cancel mll', + )); +} + +$form_params = array('enctype' => 'multipart/form-data'); +$upload_form = elgg_view_form('avatar/upload', $form_params, $vars); + +?> + +<p class="mtm"> + <?php echo elgg_echo('avatar:upload:instructions'); ?> +</p> + +<?php + +$image = <<<HTML +<div id="current-user-avatar" class="mrl prl"> + <label>$current_label</label><br /> + $user_avatar +</div> +$remove_button +HTML; + +$body = <<<HTML +<div id="avatar-upload"> + $upload_form +</div> +HTML; + +echo elgg_view_image_block($image, $upload_form); diff --git a/views/default/core/friends/collection.php b/views/default/core/friends/collection.php new file mode 100644 index 000000000..1a330af01 --- /dev/null +++ b/views/default/core/friends/collection.php @@ -0,0 +1,64 @@ +<?php +/** + * View a friends collection + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['collection'] The individual friends collection + */ + +$coll = $vars['collection']; + +if (is_array($vars['collection']->members)) { + $count = sizeof($vars['collection']->members); +} else { + $count = 0; +} + +echo "<li><h2>"; + +//as collections are private, check that the logged in user is the owner +if ($coll->owner_guid == elgg_get_logged_in_user_guid()) { + echo "<div class=\"friends_collections_controls\">"; + echo elgg_view('output/confirmlink', array( + 'href' => 'action/friends/collections/delete?collection=' . $coll->id, + 'class' => 'delete_collection', + 'text' => elgg_view_icon('delete'), + 'encode_text' => false, + )); + echo "</div>"; +} +echo $coll->name; +echo " (<span id=\"friends_membership_count{$vars['friendspicker']}\">{$count}</span>) </h2>"; + +// individual collection panels +$friends = $vars['collection']->entities; +if ($friends) { + $content = elgg_view('core/friends/collectiontabs', array( + 'owner' => elgg_get_logged_in_user_entity(), + 'collection' => $vars['collection'], + 'friendspicker' => $vars['friendspicker'], + )); + + echo elgg_view('input/friendspicker', array( + 'entities' => $friends, + 'value' => $vars['collection']->members, + 'content' => $content, + 'replacement' => '', + 'friendspicker' => $vars['friendspicker'], + )); +?> +<?php //@todo JS 1.8: no ?> + <script type="text/javascript"> + $(function () { + + $('#friends-picker_placeholder<?php echo $vars['friendspicker']; ?>').load(elgg.config.wwwroot + 'pages/friends/collections/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=list&collection=<?php echo $vars['collection']->id; ?>'); + + }); + </script> + <?php +} + +// close friends-picker div and the accordian list item +echo "</li>"; diff --git a/views/default/core/friends/collections.php b/views/default/core/friends/collections.php new file mode 100644 index 000000000..c6ee082c8 --- /dev/null +++ b/views/default/core/friends/collections.php @@ -0,0 +1,39 @@ +<?php +/** + * Elgg friends collections + * Lists a user's friends collections + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['collections'] The array of friends collections + */ + +if (is_array($vars['collections']) && sizeof($vars['collections'])) { + echo "<ul id=\"friends_collections_accordian\">"; + + $friendspicker = 0; + foreach ($vars['collections'] as $collection) { + $friendspicker++; + echo elgg_view('core/friends/collection', array( + 'collection' => $collection, + 'friendspicker' => $friendspicker, + )); + } + + echo "</ul>"; + +} else { + echo elgg_echo("friends:nocollections"); +} + +?> +<?php //@todo JS 1.8: no ?> +<script> +$(function(){ + $('#friends_collections_accordian h2').click(function () { + $(this.parentNode).children("[class=friends-picker-main-wrapper]").slideToggle("fast"); + //return false; + }); +}); +</script> diff --git a/views/default/core/friends/collectiontabs.php b/views/default/core/friends/collectiontabs.php new file mode 100644 index 000000000..bf12e0edb --- /dev/null +++ b/views/default/core/friends/collectiontabs.php @@ -0,0 +1,62 @@ +<?php +/** + * Elgg friends collections + * Lists a user's friends collections + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['collections'] The array of friends collections + */ + +$friendspicker = $vars['friendspicker']; + +$collectionid = $vars['collection']->id; +$ownerid = $vars['owner']->getGUID(); + +?> + +<ul class="elgg-tabs"> + <li class="elgg-state-selected"> + <a href="#" class="collectionmembers<?php echo $friendspicker; ?>"> + <?php echo elgg_echo('friends:collections:members'); ?> + </a> + </li> + <li> + <a href="#" class="editmembers<?php echo $friendspicker; ?>"> + <?php echo elgg_echo('friends:collections:edit'); ?> + </a> + </li> +</ul> + +<?php //@todo JS 1.8: no ?> +<script type="text/javascript"> +$(function () { + + $('a.collectionmembers<?php echo $friendspicker; ?>').click(function () { + // load collection members pane + $('#friends-picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo elgg_get_site_url(); ?>pages/friends/collections/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=list&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>'); + + // remove selected state from previous tab + $(this).parent().parent().find("li.elgg-state-selected").removeClass("elgg-state-selected"); + // add selected class to current tab + $(this).parent().addClass("elgg-state-selected"); + + return false; + }); + + $('a.editmembers<?php echo $friendspicker; ?>').click(function () { + // load friends picker pane + $('#friends-picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo elgg_get_site_url(); ?>pages/friends/collections/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=picker&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>'); + + // remove selected state from previous tab + $(this).parent().parent().find("li.elgg-state-selected").removeClass("elgg-state-selected"); + // add selected class to current tab + $(this).parent().addClass("elgg-state-selected"); + + return false; + }); + + +}); +</script> diff --git a/views/default/core/friends/tablelist.php b/views/default/core/friends/tablelist.php new file mode 100644 index 000000000..339b9ab1b --- /dev/null +++ b/views/default/core/friends/tablelist.php @@ -0,0 +1,50 @@ +<?php +/** + * Elgg friends picker + * Lists the friends picker + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['entities'] The array of ElggUser objects + */ + +if (is_array($vars['entities'])) { + +?> + +<table cellspacing="0" id="friendspicker-members-table"> + <tr> + <?php + $column = 0; + foreach($vars['entities'] as $entity) { + if (!($entity instanceof ElggEntity)) { + $entity = get_entity($entity); + } + + if ($entity instanceof ElggEntity) { + ?> + <td style="width:25px;"> + <div style="width: 25px;" class="mbl"> + <?php echo elgg_view_entity_icon($entity, 'tiny'); ?> + </div> + </td> + <td style="width: 200px;" class="pas"> + <?php echo $entity->name; ?> + </td> + <?php + $column++; + if ($column == 3) { + echo "</tr><tr>"; + $column = 0; + } + } + } + +if ($column < 3 && $column != 0) echo "</tr>"; + echo "</table>"; +} + +if (isset($vars['content'])) { + echo $vars['content']; +}
\ No newline at end of file diff --git a/views/default/core/friends/tablelistcountupdate.php b/views/default/core/friends/tablelistcountupdate.php new file mode 100644 index 000000000..7a0da1caa --- /dev/null +++ b/views/default/core/friends/tablelistcountupdate.php @@ -0,0 +1,17 @@ +<?php +/** + * Elgg friends picker count updater + * Updates the friends count on a collection + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['count'] The count + * @uses $vars['friendspicker'] The friendspicker counter number + */ + +?> +<?php //@todo JS 1.8: no ?> +<script language="text/javascript"> + $("#friends_membership_count<?php echo $vars['friendspicker']; ?>").html("<?php echo $vars['count']; ?>"); +</script>
\ No newline at end of file diff --git a/views/default/core/river/filter.php b/views/default/core/river/filter.php new file mode 100644 index 000000000..9b7fadaa8 --- /dev/null +++ b/views/default/core/river/filter.php @@ -0,0 +1,38 @@ +<?php +/** + * Content filter for river + * + * @uses $vars[] + */ + +// create selection array +$options = array(); +$options['type=all'] = elgg_echo('river:select', array(elgg_echo('all'))); +$registered_entities = elgg_get_config('registered_entities'); + +if (!empty($registered_entities)) { + foreach ($registered_entities as $type => $subtypes) { + // subtype will always be an array. + if (!count($subtypes)) { + $label = elgg_echo('river:select', array(elgg_echo("item:$type"))); + $options["type=$type"] = $label; + } else { + foreach ($subtypes as $subtype) { + $label = elgg_echo('river:select', array(elgg_echo("item:$type:$subtype"))); + $options["type=$type&subtype=$subtype"] = $label; + } + } + } +} + +$params = array( + 'id' => 'elgg-river-selector', + 'options_values' => $options, +); +$selector = $vars['selector']; +if ($selector) { + $params['value'] = $selector; +} +echo elgg_view('input/dropdown', $params); + +elgg_load_js('elgg.ui.river'); diff --git a/views/default/core/settings/account.php b/views/default/core/settings/account.php new file mode 100644 index 000000000..0c3792ece --- /dev/null +++ b/views/default/core/settings/account.php @@ -0,0 +1,9 @@ +<?php +/** + * Account settings form wrapper + * + * @package Elgg + * @subpackage Core + */ + +echo elgg_view_form('usersettings/save', array('class' => 'elgg-form-alt'));
\ No newline at end of file diff --git a/views/default/core/settings/account/default_access.php b/views/default/core/settings/account/default_access.php new file mode 100644 index 000000000..690f2714a --- /dev/null +++ b/views/default/core/settings/account/default_access.php @@ -0,0 +1,25 @@ +<?php +/** + * Provide a way of setting your default access + * + * @package Elgg + * @subpackage Core + */ +if (elgg_get_config('allow_user_default_access')) { + $user = elgg_get_page_owner_entity(); + + if ($user) { + if (false === ($default_access = $user->getPrivateSetting('elgg_default_access'))) { + $default_access = elgg_get_config('default_access'); + } + + $title = elgg_echo('default_access:settings'); + $content = elgg_echo('default_access:label') . ': '; + $content .= elgg_view('input/access', array( + 'name' => 'default_access', + 'value' => $default_access, + )); + + echo elgg_view_module('info', $title, $content); + } +} diff --git a/views/default/core/settings/account/email.php b/views/default/core/settings/account/email.php new file mode 100644 index 000000000..4bcdbb100 --- /dev/null +++ b/views/default/core/settings/account/email.php @@ -0,0 +1,19 @@ +<?php +/** + * Provide a way of setting your email + * + * @package Elgg + * @subpackage Core + */ + +$user = elgg_get_page_owner_entity(); + +if ($user) { + $title = elgg_echo('email:settings'); + $content = elgg_echo('email:address:label') . ': '; + $content .= elgg_view('input/email', array( + 'name' => 'email', + 'value' => $user->email, + )); + echo elgg_view_module('info', $title, $content); +} diff --git a/views/default/core/settings/account/language.php b/views/default/core/settings/account/language.php new file mode 100644 index 000000000..b36057422 --- /dev/null +++ b/views/default/core/settings/account/language.php @@ -0,0 +1,20 @@ +<?php +/** + * Provide a way of setting your language prefs + * + * @package Elgg + * @subpackage Core + */ + +$user = elgg_get_page_owner_entity(); + +if ($user) { + $title = elgg_echo('user:set:language'); + $content = elgg_echo('user:language:label') . ': '; + $content .= elgg_view("input/dropdown", array( + 'name' => 'language', + 'value' => $user->language, + 'options_values' => get_installed_translations() + )); + echo elgg_view_module('info', $title, $content); +} diff --git a/views/default/core/settings/account/name.php b/views/default/core/settings/account/name.php new file mode 100644 index 000000000..e356146a3 --- /dev/null +++ b/views/default/core/settings/account/name.php @@ -0,0 +1,21 @@ +<?php +/** + * Provide a way of setting your full name. + * + * @package Elgg + * @subpackage Core + */ + +$user = elgg_get_page_owner_entity(); +if ($user) { + $title = elgg_echo('user:name:label'); + $content = elgg_echo('name') . ': '; + $content .= elgg_view('input/text', array( + 'name' => 'name', + 'value' => $user->name, + )); + echo elgg_view_module('info', $title, $content); + + // need the user's guid to make sure the correct user gets updated + echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $user->guid)); +} diff --git a/views/default/core/settings/account/notifications.php b/views/default/core/settings/account/notifications.php new file mode 100644 index 000000000..c212b3886 --- /dev/null +++ b/views/default/core/settings/account/notifications.php @@ -0,0 +1,44 @@ +<?php +/** + * User settings for notifications. + * + * @package Elgg + * @subpackage Core + */ + +global $NOTIFICATION_HANDLERS; +$notification_settings = get_user_notification_settings(elgg_get_page_owner_guid()); + +$title = elgg_echo('notifications:usersettings'); + +$rows = ''; + +// Loop through options +foreach ($NOTIFICATION_HANDLERS as $k => $v) { + + if ($notification_settings->$k) { + $val = "yes"; + } else { + $val = "no"; + } + + $radio = elgg_view('input/radio', array( + 'name' => "method[$k]", + 'value' => $val, + 'options' => array( + elgg_echo('option:yes') => 'yes', + elgg_echo('option:no') => 'no' + ), + )); + + $cells = '<td class="prm pbl">' . elgg_echo("notification:method:$k") . ': </td>'; + $cells .= "<td>$radio</td>"; + + $rows .= "<tr>$cells</tr>"; +} + + +$content = elgg_echo('notifications:methods'); +$content .= "<table>$rows</table>"; + +echo elgg_view_module('info', $title, $content); diff --git a/views/default/core/settings/account/password.php b/views/default/core/settings/account/password.php new file mode 100644 index 000000000..4857034b2 --- /dev/null +++ b/views/default/core/settings/account/password.php @@ -0,0 +1,33 @@ +<?php + +/** + * Provide a way of setting your password + * + * @package Elgg + * @subpackage Core + */ +$user = elgg_get_page_owner_entity(); + +if ($user) { + $title = elgg_echo('user:set:password'); + + // only make the admin user enter current password for changing his own password. + $admin = ''; + if (!elgg_is_admin_logged_in() || elgg_is_admin_logged_in() && $user->guid == elgg_get_logged_in_user_guid()) { + $admin .= elgg_echo('user:current_password:label') . ': '; + $admin .= elgg_view('input/password', array('name' => 'current_password')); + $admin = "<p>$admin</p>"; + } + + $password = elgg_echo('user:password:label') . ': '; + $password .= elgg_view('input/password', array('name' => 'password')); + $password = "<p>$password</p>"; + + $password2 = elgg_echo('user:password2:label') . ': '; + $password2 .= elgg_view('input/password', array('name' => 'password2')); + $password2 = "<p>$password2</p>"; + + $content = $admin . $password . $password2; + + echo elgg_view_module('info', $title, $content); +} diff --git a/views/default/core/settings/statistics.php b/views/default/core/settings/statistics.php new file mode 100644 index 000000000..1d7a5b052 --- /dev/null +++ b/views/default/core/settings/statistics.php @@ -0,0 +1,6 @@ +<?php +/** + * User statitsics + * + * Blank view that can be extended + */ diff --git a/views/default/core/settings/statistics/numentities.php b/views/default/core/settings/statistics/numentities.php new file mode 100644 index 000000000..3782fd8bc --- /dev/null +++ b/views/default/core/settings/statistics/numentities.php @@ -0,0 +1,44 @@ +<?php +/** + * Elgg statistics screen + * + * @package Elgg + * @subpackage Core + */ + +// Get entity statistics +$entity_stats = get_entity_statistics(elgg_get_page_owner_guid()); + +if ($entity_stats) { + $rows = ''; + foreach ($entity_stats as $k => $entry) { + foreach ($entry as $a => $b) { + + // This function controls the alternating class + $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; + + if ($a == "__base__") { + $a = elgg_echo("item:{$k}"); + if (empty($a)) { + $a = $k; + } + } else { + $a = elgg_echo("item:{$k}:{$a}"); + if (empty($a)) { + $a = "$k $a"; + } + } + $rows .= <<< END + <tr class="{$even_odd}"> + <td class="column-one"><b>{$a}:</b></td> + <td>{$b}</td> + </tr> +END; + } + } + + $title = elgg_echo('usersettings:statistics:label:numentities'); + $content = "<table class=\"elgg-table-alt\">$rows</table>"; + + echo elgg_view_module('info', $title, $content); +} diff --git a/views/default/core/settings/statistics/online.php b/views/default/core/settings/statistics/online.php new file mode 100644 index 000000000..1385ff60f --- /dev/null +++ b/views/default/core/settings/statistics/online.php @@ -0,0 +1,42 @@ +<?php +/** + * Statistics about this user. + * + * @package Elgg + * @subpackage Core + */ + +$user = elgg_get_page_owner_entity(); + +$label_name = elgg_echo('usersettings:statistics:label:name'); +$label_email = elgg_echo('usersettings:statistics:label:email'); +$label_member_since = elgg_echo('usersettings:statistics:label:membersince'); +$label_last_login = elgg_echo('usersettings:statistics:label:lastlogin'); + +$time_created = date("r", $user->time_created); +$last_login = date("r", $user->last_login); + +$title = elgg_echo('usersettings:statistics:yourdetails'); + +$content = <<<__HTML +<table class="elgg-table-alt"> + <tr class="odd"> + <td class="column-one">$label_name</td> + <td>$user->name</td> + </tr> + <tr class="even"> + <td class="column-one">$label_email</td> + <td>$user->email</td> + </tr> + <tr class="odd"> + <td class="column-one">$label_member_since</td> + <td>$time_created</td> + </tr> + <tr class="even"> + <td class="column-one">$label_last_login</td> + <td>$last_login</td> + </tr> +</table> +__HTML; + +echo elgg_view_module('info', $title, $content); diff --git a/views/default/core/settings/tools.php b/views/default/core/settings/tools.php new file mode 100644 index 000000000..195db1d61 --- /dev/null +++ b/views/default/core/settings/tools.php @@ -0,0 +1,34 @@ +<?php +/** + * Elgg plugin specific user settings. + * + * @uses array $vars['installed_plugins'] An array of plugins as returned by elgg_get_plugins() + * + * @package Elgg.Core + * @subpackage Plugins.Settings + */ + +// Description of what's going on +echo elgg_view('output/longtext', array( + 'value' => elgg_echo("usersettings:plugins:description"), + 'class' => 'user-settings mtn mbm', +)); + +// Get the installed plugins +$installed_plugins = $vars['installed_plugins']; +$count = count($installed_plugins); + + +// Display all plugins' usersettings forms +foreach ($installed_plugins as $plugin) { + $plugin_id = $plugin->getID(); + if ($plugin->isActive()) { + if (elgg_view_exists("usersettings/$plugin_id/edit") + || elgg_view_exists("plugins/$plugin_id/usersettings")) { + + $title = $plugin->getManifest()->getName(); + $body = elgg_view_form('plugins/usersettings/save', array(), array('entity' => $plugin)); + echo elgg_view_module('info', $title, $body); + } + } +}
\ No newline at end of file diff --git a/views/default/core/walled_garden/login.php b/views/default/core/walled_garden/login.php new file mode 100644 index 000000000..42b79607d --- /dev/null +++ b/views/default/core/walled_garden/login.php @@ -0,0 +1,31 @@ +<?php +/** + * Walled garden login + */ + +$title = elgg_get_site_entity()->name; +$welcome = elgg_echo('walled_garden:welcome'); +$welcome .= ': <br/>' . $title; + +$menu = elgg_view_menu('walled_garden', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-general elgg-menu-hz', +)); + +$login_box = elgg_view('core/account/login_box', array('module' => 'walledgarden-login')); + +echo <<<HTML +<div class="elgg-col elgg-col-1of2"> + <div class="elgg-inner"> + <h1 class="elgg-heading-walledgarden"> + $welcome + </h1> + $menu + </div> +</div> +<div class="elgg-col elgg-col-1of2"> + <div class="elgg-inner"> + $login_box + </div> +</div> +HTML; diff --git a/views/default/core/walled_garden/lost_password.php b/views/default/core/walled_garden/lost_password.php new file mode 100644 index 000000000..82f8caf50 --- /dev/null +++ b/views/default/core/walled_garden/lost_password.php @@ -0,0 +1,13 @@ +<?php +/** + * Walled garden lost password + */ + +$title = elgg_echo('user:password:lost'); +$body = elgg_view_form('user/requestnewpassword'); +echo <<<HTML +<div class="elgg-inner"> + <h3>$title</h3> + $body +</div> +HTML; diff --git a/views/default/core/walled_garden/register.php b/views/default/core/walled_garden/register.php new file mode 100644 index 000000000..1ce2f8716 --- /dev/null +++ b/views/default/core/walled_garden/register.php @@ -0,0 +1,17 @@ +<?php +/** + * Walled garden registration + */ + +$title = elgg_echo('register'); +$body = elgg_view_form('register', array(), array( + 'friend_guid' => (int) get_input('friend_guid', 0), + 'invitecode' => get_input('invitecode'), +)); + +echo <<<__HTML +<div class="elgg-inner"> + <h2>$title</h2> + $body +</div> +__HTML; diff --git a/views/default/css.php b/views/default/css.php new file mode 100644 index 000000000..e67c79c36 --- /dev/null +++ b/views/default/css.php @@ -0,0 +1,7 @@ +<?php +/** + * + * This is a deprecated CSS view used in Elgg 1.0-1.7. + * Please use the view 'css/elgg' now. + * + */ diff --git a/views/default/css/admin.php b/views/default/css/admin.php index e3205ca4e..c435621b2 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -25,7 +25,6 @@ table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; - outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; @@ -41,9 +40,6 @@ img { border-width: 0; border-color: transparent; } -:focus { - outline: 0 none; -} ol, ul { list-style: none; } @@ -127,14 +123,23 @@ p { } /* Clearfix! */ +.clearfix:after, .elgg-grid:after, -.clearfix:after { +.elgg-layout:after, +.elgg-inner:after, +.elgg-page-header:after, +.elgg-page-footer:after, +.elgg-head:after, +.elgg-foot:after, +.elgg-col:after, +.elgg-image-block:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } + .elgg-body { width: auto; word-wrap: break-word; @@ -287,14 +292,6 @@ p { .elgg-main h2 { color: #333333; } -<?php // elgg-layout gets clearfix ?> -.elgg-layout:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} /* *************************************** FOOTER @@ -358,6 +355,8 @@ p { .elgg-table td, .elgg-table th { background: white; border: 1px solid #ccc; + padding: 4px 8px; + vertical-align: middle; } .elgg-table th { background-color: #ddd; @@ -365,10 +364,10 @@ p { .elgg-table .alt td { background: #eee; } -.elgg-table td { - padding: 4px 8px; - border-bottom: 1px solid #ccc; +.elgg-table input[type=checkbox] { + margin-top: 3px; } + .elgg-table-alt { width: 100%; border-top: 1px solid #ccc; @@ -440,12 +439,15 @@ input { -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; + margin: 0; } + /* default elgg core input field classes */ .elgg-input-text, .elgg-input-tags, .elgg-input-url, -.elgg-input-plaintext { +.elgg-input-plaintext, +.elgg-input-longtext { width: 98%; } textarea { @@ -470,7 +472,6 @@ textarea { width: auto; padding: 2px 4px; cursor: pointer; - outline: none; } a.elgg-button { padding: 3px 6px; @@ -537,20 +538,20 @@ a.elgg-button { -webkit-border-radius: 5px; } .ui-datepicker-prev, .ui-datepicker-next { - position: absolute; - top: 9px; + position: absolute; + top: 9px; cursor: pointer; } .ui-datepicker-prev { - left: 6px; + left: 6px; } .ui-datepicker-next { - right: 6px; + right: 6px; } .ui-datepicker-title { - line-height: 1.8em; - margin: 0 30px; - text-align: center; + line-height: 1.8em; + margin: 0 30px; + text-align: center; font-weight: bold; } .ui-datepicker-calendar { @@ -558,39 +559,241 @@ a.elgg-button { } .ui-datepicker th { border: none; - font-weight: bold; - padding: 5px 6px; - text-align: center; + font-weight: bold; + padding: 5px 6px; + text-align: center; } .ui-datepicker td { padding: 1px; } .ui-datepicker td span, .ui-datepicker td a { - display: block; - padding: 2px; + display: block; + padding: 2px; line-height: 1.2em; - text-align: right; - text-decoration: none; + text-align: right; + text-decoration: none; } .ui-datepicker-calendar .ui-state-default { border: 1px solid #ccc; - color: #555; + color: #555; background: #fafafa; } .ui-datepicker-calendar .ui-state-hover { border: 1px solid #aaa; - color: #333; + color: #333; background: #ccc; } .ui-datepicker-calendar .ui-state-active, .ui-datepicker-calendar .ui-state-active.ui-state-hover { font-weight: bold; - border: 1px solid #999; - color: #333; + border: 1px solid #999; + color: #333; background: #ddd; } /* *************************************** + AUTOCOMPLETE +*************************************** */ +<?php //autocomplete will expand to fullscreen without max-width ?> +.ui-autocomplete { + position: absolute; + cursor: default; +} +.elgg-autocomplete-item .elgg-body { + max-width: 600px; +} +.ui-autocomplete { + background-color: white; + border: 1px solid #ccc; + overflow: hidden; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} +.ui-autocomplete .ui-menu-item { + padding: 0px 4px; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} +.ui-autocomplete .ui-menu-item:hover { + background-color: #eee; +} +.ui-autocomplete a:hover { + text-decoration: none; + color: #4690D6; +} +.ui-autocomplete a.ui-state-hover { + background-color: #eee; + display: block; +} + +/* *************************************** + USER PICKER +*************************************** */ +.elgg-user-picker-list li:first-child { + border-top: 1px dotted #ccc; + margin-top: 5px; +} +.elgg-user-picker-list > li { + border-bottom: 1px dotted #ccc; +} + +/* *************************************** + FRIENDS PICKER +*************************************** */ +.friends-picker-main-wrapper { + margin-bottom: 15px; +} +.friends-picker-container h3 { + font-size:4em !important; + text-align: left; + margin:10px 0 20px !important; + color:#999 !important; + background: none !important; + padding:0 !important; +} +.friends-picker .friends-picker-container .panel ul { + text-align: left; + margin: 0; + padding:0; +} +.friends-picker-wrapper { + margin: 0; + padding:0; + position: relative; + width: 730px; +} +.friends-picker { + position: relative; + overflow: hidden; + margin: 0; + padding:0; + width: 730px; + height: auto; + background-color: #dedede; + + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; +} +.friendspicker-savebuttons { + background: white; + + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + + margin:0 10px 10px; +} +.friends-picker .friends-picker-container { /* long container used to house end-to-end panels. Width is calculated in JS */ + position: relative; + left: 0; + top: 0; + width: 100%; + list-style-type: none; +} +.friends-picker .friends-picker-container .panel { + float:left; + height: 100%; + position: relative; + width: 730px; + margin: 0; + padding:0; +} +.friends-picker .friends-picker-container .panel .wrapper { + margin: 0; + padding:4px 10px 10px 10px; + min-height: 230px; +} +.friends-picker-navigation { + margin: 0 0 10px; + padding:0 0 10px; + border-bottom:1px solid #ccc; +} +.friends-picker-navigation ul { + list-style: none; + padding-left: 0; +} +.friends-picker-navigation ul li { + float: left; + margin:0; + background:white; +} +.friends-picker-navigation a { + font-weight: bold; + text-align: center; + background: white; + color: #999; + text-decoration: none; + display: block; + padding: 0; + width:20px; + + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.tabHasContent { + background: white; + color:#333 !important; +} +.friends-picker-navigation li a:hover { + background: #333; + color:white !important; +} +.friends-picker-navigation li a.current { + background: #4690D6; + color:white !important; +} +.friends-picker-navigation-l, .friends-picker-navigation-r { + position: absolute; + top: 46px; + text-indent: -9000em; +} +.friends-picker-navigation-l a, .friends-picker-navigation-r a { + display: block; + height: 40px; + width: 40px; +} +.friends-picker-navigation-l { + right: 48px; + z-index:1; +} +.friends-picker-navigation-r { + right: 0; + z-index:1; +} +.friends-picker-navigation-l { + background: url("<?php echo elgg_get_site_url(); ?>_graphics/friendspicker.png") no-repeat left top; +} +.friends-picker-navigation-r { + background: url("<?php echo elgg_get_site_url(); ?>_graphics/friendspicker.png") no-repeat -60px top; +} +.friends-picker-navigation-l:hover { + background: url("<?php echo elgg_get_site_url(); ?>_graphics/friendspicker.png") no-repeat left -44px; +} +.friends-picker-navigation-r:hover { + background: url("<?php echo elgg_get_site_url(); ?>_graphics/friendspicker.png") no-repeat -60px -44px; +} +.friendspicker-savebuttons .elgg-button-submit, +.friendspicker-savebuttons .elgg-button-cancel { + margin:5px 20px 5px 5px; +} +.friendspicker-members-table { + background: #dedede; + + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + + margin:10px 0 0; + padding:10px 10px 0; +} + +/* *************************************** PAGINATION *************************************** */ .elgg-pagination { @@ -801,7 +1004,7 @@ a.elgg-button { ENTITY MENU *************************************** */ <?php // height depends on line height/font size ?> -.elgg-menu-entity, elgg-menu-annotation { +.elgg-menu-entity, .elgg-menu-annotation { float: right; margin-left: 15px; font-size: 90%; @@ -1040,6 +1243,10 @@ a.elgg-widget-collapsed:before { height: 16px; display: inline-block; margin: 0 2px; + vertical-align: text-bottom; +} +.elgg-module .elgg-head .elgg-icon { + vertical-align: baseline; } .elgg-icon-delete:hover, .elgg-icon-delete-alt:hover { @@ -1262,12 +1469,13 @@ a.elgg-widget-collapsed:before { padding: 5px 10px; margin: 4px 0; } -ul.elgg-plugin-categories, ul.elgg-plugin-categories > li { +ul.elgg-plugin-categories, ul.elgg-plugin-categories > li, +ul.elgg-plugin-resources, ul.elgg-plugin-resources > li { display: inline; } .elgg-plugin-category-bundled { border-width: 2px; - border-color: #DAA520; + border-color: #0054A7; } /**************************************** @@ -1312,6 +1520,12 @@ ul.elgg-plugin-categories, ul.elgg-plugin-categories > li { margin-bottom: 5px; } +.elgg-text-help { + display: block; + font-size: 85%; + font-style: italic; +} + .elgg-longtext-control { margin-left: 14px; font-size: 80%; @@ -1330,6 +1544,26 @@ table.mceLayout { } /* *************************************** + SITE SECRET +*************************************** */ +.elgg-form-admin-site-regenerate-secret table { + width: 60%; + margin: 1em auto; +} +td.elgg-strength-strong, +td.elgg-strength-strong h4 { + background: #DFF0D8; color: #468847; +} +td.elgg-strength-moderate, +td.elgg-strength-moderate h4 { + background: #FCF8E3; color: #C09853; +} +td.elgg-strength-weak, +td.elgg-strength-weak h4 { + background: #F2DEDE; color: #B94A48; +} + +/* *************************************** HELPERS *************************************** */ .hidden { diff --git a/views/default/css/elements/forms.php b/views/default/css/elements/forms.php index 81db81747..068cc8fd6 100644 --- a/views/default/css/elements/forms.php +++ b/views/default/css/elements/forms.php @@ -69,6 +69,7 @@ input[type="radio"] { margin:0 3px 0 0; padding:0; border:none; + border-radius:0; width:auto; } .elgg-input-checkboxes.elgg-horizontal li, @@ -104,7 +105,7 @@ input[type="radio"] { margin: 0; padding:0; position: relative; - width: 100%; + width: 730px; } .friends-picker { position: relative; @@ -267,6 +268,10 @@ input[type="radio"] { text-decoration: none; color: #4690D6; } +.ui-autocomplete a.ui-state-hover { + background-color: #eee; + display: block; +} /* *************************************** USER PICKER @@ -315,20 +320,20 @@ input[type="radio"] { color: white; } .ui-datepicker-prev, .ui-datepicker-next { - position: absolute; - top: 5px; + position: absolute; + top: 5px; cursor: pointer; } .ui-datepicker-prev { - left: 6px; + left: 6px; } .ui-datepicker-next { - right: 6px; + right: 6px; } .ui-datepicker-title { - line-height: 1.8em; - margin: 0 30px; - text-align: center; + line-height: 1.8em; + margin: 0 30px; + text-align: center; font-weight: bold; } .ui-datepicker-calendar { @@ -337,34 +342,34 @@ input[type="radio"] { .ui-datepicker th { color: #0054A7; border: none; - font-weight: bold; - padding: 5px 6px; - text-align: center; + font-weight: bold; + padding: 5px 6px; + text-align: center; } .ui-datepicker td { padding: 1px; } .ui-datepicker td span, .ui-datepicker td a { - display: block; - padding: 2px; + display: block; + padding: 2px; line-height: 1.2em; - text-align: right; - text-decoration: none; + text-align: right; + text-decoration: none; } .ui-datepicker-calendar .ui-state-default { border: 1px solid #ccc; - color: #4690D6;; + color: #4690D6;; background: #fafafa; } .ui-datepicker-calendar .ui-state-hover { border: 1px solid #aaa; - color: #0054A7; + color: #0054A7; background: #eee; } .ui-datepicker-calendar .ui-state-active, .ui-datepicker-calendar .ui-state-active.ui-state-hover { font-weight: bold; - border: 1px solid #0054A7; - color: #0054A7; + border: 1px solid #0054A7; + color: #0054A7; background: #E4ECF5; } diff --git a/views/default/css/elements/icons.php b/views/default/css/elements/icons.php index f7c789e33..9b12e0a57 100644 --- a/views/default/css/elements/icons.php +++ b/views/default/css/elements/icons.php @@ -288,8 +288,8 @@ .elgg-ajax-loader { background: white url(<?php echo elgg_get_site_url(); ?>_graphics/ajax_loader_bw.gif) no-repeat center center; - min-height: 33px; - min-width: 33px; + min-height: 31px; + min-width: 31px; } /* *************************************** diff --git a/views/default/css/elements/layout.php b/views/default/css/elements/layout.php index 25a2bffb7..9d92752b4 100644 --- a/views/default/css/elements/layout.php +++ b/views/default/css/elements/layout.php @@ -118,4 +118,4 @@ } .elgg-page-footer a:hover { color: #666; -}
\ No newline at end of file +} diff --git a/views/default/css/elements/modules.php b/views/default/css/elements/modules.php index 74092c774..a37ae094b 100644 --- a/views/default/css/elements/modules.php +++ b/views/default/css/elements/modules.php @@ -191,4 +191,4 @@ a.elgg-widget-collapsed:before { .elgg-widget-placeholder { border: 2px dashed #dedede; margin-bottom: 15px; -}
\ No newline at end of file +} diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php index 62f370069..6b29e4c19 100644 --- a/views/default/css/elements/navigation.php +++ b/views/default/css/elements/navigation.php @@ -16,7 +16,7 @@ text-align: center; } .elgg-pagination li { - display: inline; + display: inline-block; margin: 0 6px 0 0; text-align: center; } @@ -24,7 +24,8 @@ -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; - + + display: block; padding: 2px 6px; color: #4690d6; border: 1px solid #4690d6; @@ -449,7 +450,7 @@ ENTITY AND ANNOTATION *************************************** */ <?php // height depends on line height/font size ?> -.elgg-menu-entity, elgg-menu-annotation { +.elgg-menu-entity, .elgg-menu-annotation { float: right; margin-left: 15px; font-size: 90%; diff --git a/views/default/css/elements/typography.php b/views/default/css/elements/typography.php index d93b28d2c..c044cb1cc 100644 --- a/views/default/css/elements/typography.php +++ b/views/default/css/elements/typography.php @@ -158,4 +158,5 @@ h6 { font-size: 0.8em; } } .elgg-output img { max-width: 100%; -}
\ No newline at end of file + height: auto; +} diff --git a/views/default/css/ie.php b/views/default/css/ie.php index 4bddd4d55..34ececa89 100644 --- a/views/default/css/ie.php +++ b/views/default/css/ie.php @@ -6,3 +6,11 @@ .elgg-avatar { display: block; } + +/* ie8 adds space to the top of .elgg-gallery which causes jumpiness if this is display: block; */ +.elgg-gallery .elgg-avatar > a > img { + display: inline-block; +} +.elgg-gallery .elgg-avatar > .elgg-icon-hover-menu { + bottom: 4px; +} diff --git a/views/default/css/ie7.php b/views/default/css/ie7.php index db0125b4b..90274797d 100644 --- a/views/default/css/ie7.php +++ b/views/default/css/ie7.php @@ -24,6 +24,7 @@ .elgg-menu-footer > li > a, .elgg-menu-footer li, .elgg-menu-general > li > a, +.elgg-pagination li, .elgg-menu-general li { display: inline; } @@ -62,4 +63,13 @@ .elgg-module-walledgarden > .elgg-head, .elgg-module-walledgarden > .elgg-foot { width: 530px; -}
\ No newline at end of file +} + +input, textarea { + width: 98%; +} + +.elgg-tag a { + /* IE7 had a weird wrapping issue for tags */ + word-wrap: normal; +} 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 @@ +<?php +/** + * Page not found error + */ + +$message = elgg_echo('error:404'); + +echo "<h2>$message</h2>"; 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 @@ +<?php +/** + * General error + */ + +$message = elgg_echo('error:default'); + +echo "<h2>$message</h2>"; diff --git a/views/default/export/entity.php b/views/default/export/entity.php new file mode 100644 index 000000000..3064f1288 --- /dev/null +++ b/views/default/export/entity.php @@ -0,0 +1,79 @@ +<?php +/** + * Elgg Entity export. + * Displays an entity using the current view. + * + * @package Elgg + * @subpackage Core + */ + +$entity = $vars['entity']; +if (!$entity) { + throw new InvalidParameterException(elgg_echo('InvalidParameterException:NoEntityFound')); +} +$options = array( + 'guid' => $entity->guid, + 'limit' => 0 +); +$metadata = elgg_get_metadata($options); +$annotations = elgg_get_annotations($options); +$relationships = get_entity_relationships($entity->guid); + +$exportable_values = $entity->getExportableValues(); +?> +<div> +<h2><?php echo elgg_echo('Entity'); ?></h2> + <?php + foreach ($entity as $k => $v) { + if ((in_array($k, $exportable_values)) || (elgg_is_admin_logged_in())) { +?> + <p class="margin-none"><b><?php echo $k; ?>: </b><?php echo strip_tags($v); ?></p> +<?php + } + } + ?> +</div> + +<?php if ($metadata) { ?> +<div id="metadata" class="mtm"> +<h2><?php echo elgg_echo('metadata'); ?></h2> + <?php + foreach ($metadata as $m) { +?> + <p class="margin-none"><b><?php echo $m->name; ?>: </b><?php echo $m->value; ?></p> +<?php + } + ?> + +</div> +<?php } ?> + +<?php if ($annotations) { ?> +<div id="annotations" class="mtm"> +<h2><?php echo elgg_echo('annotations'); ?></h2> + <?php + foreach ($annotations as $a) { +?> + <table> + <p class="margin-none"><b><?php echo $a->name; ?>: </b><?php echo $a->value; ?></p> + </table> +<?php + } + ?> +</div> +<?php } ?> + +<?php if ($relationships) { ?> +<div id="relationship" class="mtm"> +<h2><?php echo elgg_echo('relationships'); ?></h2> + <?php + foreach ($relationships as $r) { +?> + <table> + <p class="margin-none"><b><?php echo $r->relationship; ?>: </b><?php echo $r->guid_two; ?></p> + </table> +<?php + } + ?> +</div> +<?php } ?> diff --git a/views/default/export/metadata.php b/views/default/export/metadata.php new file mode 100644 index 000000000..1dd7f2054 --- /dev/null +++ b/views/default/export/metadata.php @@ -0,0 +1,14 @@ +<?php +/** + * Elgg metadata export. + * Displays a metadata item using the current view. + * + * @package Elgg + * @subpackage Core + */ + +$m = $vars['metadata']; +$e = get_entity($m->entity_guid); +?> +<p class="margin-none"><?php if ($e) echo "<a href=\"" . $e->getURL() . "\">GUID:{$m->entity_guid}</a>"; else echo "GUID:".$m->entity_guid; +?>: <b><?php echo $m->name; ?></b> <?php echo $m->value; ?></p>
\ No newline at end of file diff --git a/views/default/export/relationship.php b/views/default/export/relationship.php new file mode 100644 index 000000000..d8cb3e4f4 --- /dev/null +++ b/views/default/export/relationship.php @@ -0,0 +1,21 @@ +<?php +/** + * Elgg relationship export. + * Displays a relationship using the current view. + * + * @package Elgg + * @subpackage Core + */ + +$r = $vars['relationship']; + +$e1 = get_entity($r->guid_one); +$e2 = get_entity($r->guid_two); +?> +<p class="margin-none"><?php + if ($e1) echo "<a href=\"" . $e1->getURL() . "\">GUID:" . $r->guid_one . "</a>"; else echo "GUID:".$r->guid_one; +?> +<b><?php echo $r->relationship; ?></b> +<?php + if ($e2) echo "<a href=\"" . $e2->getURL() . "\">GUID:" . $r->guid_two . "</a>"; else echo "GUID:".$r->guid_two; +?></p> diff --git a/views/default/forms/account/settings.php b/views/default/forms/account/settings.php new file mode 100644 index 000000000..3967207ce --- /dev/null +++ b/views/default/forms/account/settings.php @@ -0,0 +1,10 @@ +<?php +/** + * Account settings form used for user settings + * + * This form is extended by Elgg with the views in core/settings/account. + * Plugins can additionally extend it and then register for the + * 'usersettings:save', 'user' plugin hook. + * + * This view is included by "forms/usersettings/save" + */ diff --git a/views/default/forms/admin/menu/save.php b/views/default/forms/admin/menu/save.php new file mode 100644 index 000000000..1a67ffcc4 --- /dev/null +++ b/views/default/forms/admin/menu/save.php @@ -0,0 +1,102 @@ +<?php +/** + * Form body for setting up site menu + */ + +// @todo Could probably make this number configurable +$num_featured_items = 6; + +// get site menu items +$menu = elgg_get_config('menus'); +$menu = $menu['site']; +$builder = new ElggMenuBuilder($menu); +$menu = $builder->getMenu('name'); +$menu_items = $menu['default']; + +$featured_menu_names = elgg_get_config('site_featured_menu_names'); + +$dropdown_values = array(); +foreach ($menu_items as $item) { + $dropdown_values[$item->getName()] = $item->getText(); +} +$dropdown_values[' '] = elgg_echo('none'); + +?> +<div class="elgg-module elgg-module-inline"> + <div class="elgg-head"> + <h3><?php echo elgg_echo('admin:menu_items:configure'); ?></h3> + </div> + <div class="elgg-body"> +<?php +echo elgg_view('output/longtext', array( + 'value' => elgg_echo("admin:menu_items:description") +)); + +for ($i=0; $i<$num_featured_items; $i++) { + if ($featured_menu_names && array_key_exists($i, $featured_menu_names)) { + $current_value = $featured_menu_names[$i]; + } else { + $current_value = ' '; + } + + echo elgg_view('input/dropdown', array( + 'options_values' => $dropdown_values, + 'name' => 'featured_menu_names[]', + 'value' => $current_value + )); +} +?> + </div> +</div> + +<div class="elgg-module elgg-module-inline"> + <div class="elgg-head"> + <h3><?php echo elgg_echo('admin:add_menu_item'); ?></h3> + </div> + <div class="elgg-body"> +<?php +echo elgg_view('output/longtext', array( + 'value' => elgg_echo("admin:add_menu_item:description") +)); + +$custom_items = elgg_get_config('site_custom_menu_items'); + +$name_str = elgg_echo('name'); +$url_str = elgg_echo('admin:plugins:label:website'); + +echo '<ul class="elgg-list elgg-list-simple">'; + +if (is_array($custom_items)) { + foreach ($custom_items as $title => $url) { + $name_input = elgg_view('input/text', array( + 'name' => 'custom_menu_titles[]', + 'value' => $title + )); + + $url_input = elgg_view('input/text', array( + 'name' => 'custom_menu_urls[]', + 'value' => $url + )); + + echo "<li>$name_str: $name_input $url_str: $url_input $delete</li>"; + } +} + +$new = elgg_echo('new'); +$name_input = elgg_view('input/text', array( + 'name' => 'custom_menu_titles[]', +)); + +$url_input = elgg_view('input/text', array( + 'name' => 'custom_menu_urls[]', +)); + +echo "<li class='custom_menuitem'>$name_str: $name_input $url_str: $url_input</li> +</ul>"; + +?> + </div> +</div> +<?php + +echo elgg_view('input/submit', array('value' => elgg_echo('save'))); diff --git a/views/default/forms/admin/plugins/change_state.php b/views/default/forms/admin/plugins/change_state.php new file mode 100644 index 000000000..730c8ff32 --- /dev/null +++ b/views/default/forms/admin/plugins/change_state.php @@ -0,0 +1,22 @@ +<?php +/** + * Activate/deactive all plugins specified by guids array + * + * @uses $vars['guids'] Array of GUIDs + * @uses $vars['action'] 'activate' or 'deactivate' + */ + +$guids = elgg_extract('guids', $vars, array()); +$guids = implode(',', $guids); + +echo '<div>'; +echo elgg_view('input/hidden', array( + 'name' => 'guids', + 'value' => $guids, +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo("admin:plugins:{$vars['action']}_all"), + 'class' => 'elgg-button elgg-button-action mrm' +)); +echo '</div>'; diff --git a/views/default/forms/admin/plugins/filter.php b/views/default/forms/admin/plugins/filter.php new file mode 100644 index 000000000..fd1b618bc --- /dev/null +++ b/views/default/forms/admin/plugins/filter.php @@ -0,0 +1,26 @@ +<?php +/** + * Category filter for plugins + * + * @uses $vars['category'] + * @uses $vars['category_options'] + * @uses $vvars['sort'] + */ + +echo '<div>'; +echo elgg_view('input/dropdown', array( + 'name' => 'category', + 'options_values' => $vars['category_options'], + 'value' => $vars['category'], +)); + +echo elgg_view('input/hidden', array( + 'name' => 'sort', + 'value' => $vars['sort'], +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo('filter'), + 'class' => 'elgg-button elgg-button-action', +)); +echo '</div>'; diff --git a/views/default/forms/admin/plugins/sort.php b/views/default/forms/admin/plugins/sort.php new file mode 100644 index 000000000..7f2246bad --- /dev/null +++ b/views/default/forms/admin/plugins/sort.php @@ -0,0 +1,26 @@ +<?php +/** + * Sort plugins form body + * + * @uses $vars['sort'] + * @uses $vars['sort_options'] + * @uses $vars['category'] + */ + +echo '<div class="mtm">'; +echo elgg_view('input/dropdown', array( + 'name' => 'sort', + 'options_values' => $vars['sort_options'], + 'value' => $vars['sort'], +)); + +echo elgg_view('input/hidden', array( + 'name' => 'category', + 'value' => $vars['category'], +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo('sort'), + 'class' => 'elgg-button elgg-button-action' +)); +echo '</div>'; diff --git a/views/default/forms/admin/site/regenerate_secret.php b/views/default/forms/admin/site/regenerate_secret.php new file mode 100644 index 000000000..af269b801 --- /dev/null +++ b/views/default/forms/admin/site/regenerate_secret.php @@ -0,0 +1,24 @@ +<?php + +$strength = $vars['strength']; + +?> +<p><?php echo elgg_echo('admin:site:secret:intro'); ?></p> + +<table class="elgg-table"> + <tr> + <th><?php echo elgg_echo('site_secret:current_strength'); ?></th> + <td class="elgg-strength-<?php echo $strength; ?>"> + <h4><?php echo elgg_echo("site_secret:strength:$strength"); ?></h4> + <div><?php echo elgg_echo("site_secret:strength_msg:$strength"); ?></div> + </td> + </tr> +</table> + +<div class="elgg-foot"> + <?php echo elgg_view('input/submit', array( + 'value' => elgg_echo('admin:site:secret:regenerate'), + 'class' => 'elgg-requires-confirmation elgg-button elgg-button-submit', + )); ?> + <p class="elgg-text-help mts"><?php echo elgg_echo('admin:site:secret:regenerate:help'); ?></p> +</div> diff --git a/views/default/forms/admin/site/update_advanced.php b/views/default/forms/admin/site/update_advanced.php new file mode 100644 index 000000000..14b74e4f9 --- /dev/null +++ b/views/default/forms/admin/site/update_advanced.php @@ -0,0 +1,101 @@ +<?php +/** + * @todo cleanup + */ +$form_body = ""; + +foreach (array('wwwroot', 'path', 'dataroot') as $field) { + $form_body .= "<div>"; + $form_body .= elgg_echo('installation:' . $field) . "<br />"; + $warning = elgg_echo('installation:warning:' . $field); + if ($warning != 'installation:warning:' . $field) { + echo "<b>" . $warning . "</b><br />"; + } + $value = elgg_get_config($field); + $form_body .= elgg_view("input/text",array('name' => $field, 'value' => $value)); + $form_body .= "</div>"; +} + +$form_body .= "<div>" . elgg_echo('admin:site:access:warning') . "<br />"; +$form_body .= "<label>" . elgg_echo('installation:sitepermissions') . "</label>"; +$form_body .= elgg_view('input/access', array( + 'options_values' => array( + ACCESS_PRIVATE => elgg_echo("PRIVATE"), + ACCESS_FRIENDS => elgg_echo("access:friends:label"), + ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"), + ACCESS_PUBLIC => elgg_echo("PUBLIC") + ), + 'name' => 'default_access', + 'value' => elgg_get_config('default_access'), +)) . "</div>"; +$form_body .= "<div>" . elgg_echo('installation:allow_user_default_access:description') . "<br />"; +$form_body .= elgg_view("input/checkboxes", array( + 'options' => array(elgg_echo('installation:allow_user_default_access:label') => 1), + 'name' => 'allow_user_default_access', + 'value' => (elgg_get_config('allow_user_default_access') ? 1 : 0), +)) . "</div>"; +$form_body .= "<div>" . elgg_echo('installation:simplecache:description') . "<br />"; +$form_body .= elgg_view("input/checkboxes", array( + 'options' => array(elgg_echo('installation:simplecache:label') => 1), + 'name' => 'simplecache_enabled', + 'value' => (elgg_get_config('simplecache_enabled') ? 1 : 0), +)) . "</div>"; +$form_body .= "<div>" . elgg_echo('installation:systemcache:description') . "<br />"; +$form_body .= elgg_view("input/checkboxes", array( + 'options' => array(elgg_echo('installation:systemcache:label') => 1), + 'name' => 'system_cache_enabled', + 'value' => (elgg_get_config('system_cache_enabled') ? 1 : 0), +)) . "</div>"; + +$debug_options = array('0' => elgg_echo('installation:debug:none'), 'ERROR' => elgg_echo('installation:debug:error'), 'WARNING' => elgg_echo('installation:debug:warning'), 'NOTICE' => elgg_echo('installation:debug:notice')); +$form_body .= "<div>" . elgg_echo('installation:debug'); +$form_body .= elgg_view('input/dropdown', array( + 'options_values' => $debug_options, + 'name' => 'debug', + 'value' => elgg_get_config('debug'), +)); +$form_body .= '</div>'; + +// control new user registration +$options = array( + 'options' => array(elgg_echo('installation:registration:label') => 1), + 'name' => 'allow_registration', + 'value' => elgg_get_config('allow_registration') ? 1 : 0, +); +$form_body .= '<div>' . elgg_echo('installation:registration:description'); +$form_body .= '<br />' .elgg_view('input/checkboxes', $options) . '</div>'; + +// control walled garden +$walled_garden = elgg_get_config(walled_garden); +$options = array( + 'options' => array(elgg_echo('installation:walled_garden:label') => 1), + 'name' => 'walled_garden', + 'value' => $walled_garden ? 1 : 0, +); +$form_body .= '<div>' . elgg_echo('installation:walled_garden:description'); +$form_body .= '<br />' . elgg_view('input/checkboxes', $options) . '</div>'; + +$form_body .= "<div>" . elgg_echo('installation:httpslogin') . "<br />"; +$form_body .= elgg_view("input/checkboxes", array( + 'options' => array(elgg_echo('installation:httpslogin:label') => 1), + 'name' => 'https_login', + 'value' => (elgg_get_config('https_login') ? 1 : 0) +)) . "</div>"; + +$form_body .= "<div>" . elgg_echo('installation:disableapi') . "<br />"; +$disable_api = elgg_get_config('disable_api'); +$on = $disable_api ? 0 : 1; +$form_body .= elgg_view("input/checkboxes", array( + 'options' => array(elgg_echo('installation:disableapi:label') => 1), + 'name' => 'api', + 'value' => $on, +)); +$form_body .= "</div>"; + +$form_body .= elgg_view('input/hidden', array('name' => 'settings', 'value' => 'go')); + +$form_body .= '<div class="elgg-foot">'; +$form_body .= elgg_view('input/submit', array('value' => elgg_echo("save"))); +$form_body .= '</div>'; + +echo $form_body; diff --git a/views/default/forms/admin/site/update_basic.php b/views/default/forms/admin/site/update_basic.php new file mode 100644 index 000000000..88870bc60 --- /dev/null +++ b/views/default/forms/admin/site/update_basic.php @@ -0,0 +1,31 @@ +<?php +/** + * @todo cleanup + */ +$form_body = ""; + +foreach (array('sitename','sitedescription', 'siteemail') as $field) { + $form_body .= "<div>"; + $form_body .= elgg_echo('installation:' . $field) . "<br />"; + $warning = elgg_echo('installation:warning:' . $field); + if ($warning != 'installation:warning:' . $field) { + echo "<b>" . $warning . "</b><br />"; + } + $value = elgg_get_config($field); + $form_body .= elgg_view("input/text",array('name' => $field, 'value' => $value)); + $form_body .= "</div>"; +} + +$languages = get_installed_translations(); +$form_body .= "<div>" . elgg_echo('installation:language'); +$form_body .= elgg_view("input/dropdown", array( + 'name' => 'language', + 'value' => elgg_get_config('language'), + 'options_values' => $languages, +)) . "</div>"; + +$form_body .= '<div class="elgg-foot">'; +$form_body .= elgg_view('input/submit', array('value' => elgg_echo("save"))); +$form_body .= '</div>'; + +echo $form_body;
\ No newline at end of file diff --git a/views/default/forms/avatar/crop.php b/views/default/forms/avatar/crop.php new file mode 100644 index 000000000..3e798cb27 --- /dev/null +++ b/views/default/forms/avatar/crop.php @@ -0,0 +1,42 @@ +<?php +/** + * Avatar crop form + * + * @uses $vars['entity'] + */ + +elgg_load_js('jquery.imgareaselect'); +elgg_load_js('elgg.avatar_cropper'); +elgg_load_css('jquery.imgareaselect'); + +$master_img = elgg_view('output/img', array( + 'src' => $vars['entity']->getIconUrl('master'), + 'alt' => elgg_echo('avatar'), + 'class' => 'mrl', + 'id' => 'user-avatar-cropper', +)); + +$preview_img = elgg_view('output/img', array( + 'src' => $vars['entity']->getIconUrl('master'), + 'alt' => elgg_echo('avatar'), +)); + +?> +<div class="clearfix"> + <?php echo $master_img; ?> + <div id="user-avatar-preview-title"><label><?php echo elgg_echo('avatar:preview'); ?></label></div> + <div id="user-avatar-preview"><?php echo $preview_img; ?></div> +</div> +<div class="elgg-foot"> +<?php +$coords = array('x1', 'x2', 'y1', 'y2'); +foreach ($coords as $coord) { + echo elgg_view('input/hidden', array('name' => $coord, 'value' => $vars['entity']->$coord)); +} + +echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid)); + +echo elgg_view('input/submit', array('value' => elgg_echo('avatar:create'))); + +?> +</div> diff --git a/views/default/forms/avatar/upload.php b/views/default/forms/avatar/upload.php new file mode 100644 index 000000000..d91e8575e --- /dev/null +++ b/views/default/forms/avatar/upload.php @@ -0,0 +1,16 @@ +<?php +/** + * Avatar upload form + * + * @uses $vars['entity'] + */ + +?> +<div> + <label><?php echo elgg_echo("avatar:upload"); ?></label><br /> + <?php echo elgg_view("input/file",array('name' => 'avatar')); ?> +</div> +<div class="elgg-foot"> + <?php echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid)); ?> + <?php echo elgg_view('input/submit', array('value' => elgg_echo('upload'))); ?> +</div> diff --git a/views/default/forms/comments/add.php b/views/default/forms/comments/add.php new file mode 100644 index 000000000..9acabf3ea --- /dev/null +++ b/views/default/forms/comments/add.php @@ -0,0 +1,37 @@ +<?php +/** + * Elgg comments add form + * + * @package Elgg + * + * @uses ElggEntity $vars['entity'] The entity to comment on + * @uses bool $vars['inline'] Show a single line version of the form? + */ + + +if (isset($vars['entity']) && elgg_is_logged_in()) { + + $inline = elgg_extract('inline', $vars, false); + + if ($inline) { + echo elgg_view('input/text', array('name' => 'generic_comment')); + echo elgg_view('input/submit', array('value' => elgg_echo('comment'))); + } else { +?> + <div> + <label><?php echo elgg_echo("generic_comments:add"); ?></label> + <?php echo elgg_view('input/longtext', array('name' => 'generic_comment')); ?> + </div> + <div class="elgg-foot"> +<?php + echo elgg_view('input/submit', array('value' => elgg_echo("generic_comments:post"))); +?> + </div> +<?php + } + + echo elgg_view('input/hidden', array( + 'name' => 'entity_guid', + 'value' => $vars['entity']->getGUID() + )); +} diff --git a/views/default/forms/friends/collections/add.php b/views/default/forms/friends/collections/add.php new file mode 100644 index 000000000..04c87346b --- /dev/null +++ b/views/default/forms/friends/collections/add.php @@ -0,0 +1,53 @@ +<?php +/** + * Form body for editing or adding a friend collection + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['collection'] Optionally, the collection to edit + */ + +// Set title, form destination +if (isset($vars['collection'])) { + $title = $vars['collection']->name; + $highlight = 'default'; +} else { + $title = ""; + $highlight = 'all'; +} + +echo "<div class=\"mtm\"><label>" . elgg_echo("friends:collectionname") . "<br/>"; +echo elgg_view("input/text", array( + "name" => "collection_name", + "value" => $title, + )); +echo "</label></div>"; + +echo "<div>"; +if ($vars['collection_members']) { + echo elgg_echo("friends:collectionfriends") . "<br />"; + foreach ($vars['collection_members'] as $mem) { + echo elgg_view_entity_icon($mem, 'tiny'); + echo $mem->name; + } +} +echo "</div>"; + +echo "<div><label>" . elgg_echo("friends:addfriends") . "</label>"; +echo elgg_view('input/friendspicker', array( + 'entities' => $vars['friends'], + 'name' => 'friends_collection', + 'highlight' => $highlight, +)); +echo "</div>"; + +echo '<div class="elgg-foot">'; +if (isset($vars['collection'])) { + echo elgg_view('input/hidden', array( + 'name' => 'collection_id', + 'value' => $vars['collection']->id, + )); +} +echo elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('save'))); +echo '</div>'; diff --git a/views/default/forms/login.php b/views/default/forms/login.php new file mode 100644 index 000000000..d2c6e6221 --- /dev/null +++ b/views/default/forms/login.php @@ -0,0 +1,49 @@ +<?php +/** + * Elgg login form + * + * @package Elgg + * @subpackage Core + */ +?> + +<div> + <label><?php echo elgg_echo('loginusername'); ?></label> + <?php echo elgg_view('input/text', array( + 'name' => 'username', + 'class' => 'elgg-autofocus', + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('password'); ?></label> + <?php echo elgg_view('input/password', array('name' => 'password')); ?> +</div> + +<?php echo elgg_view('login/extend', $vars); ?> + +<div class="elgg-foot"> + <label class="mtm float-alt"> + <input type="checkbox" name="persistent" value="true" /> + <?php echo elgg_echo('user:persistent'); ?> + </label> + + <?php echo elgg_view('input/submit', array('value' => elgg_echo('login'))); ?> + + <?php + if (isset($vars['returntoreferer'])) { + echo elgg_view('input/hidden', array('name' => 'returntoreferer', 'value' => 'true')); + } + ?> + + <ul class="elgg-menu elgg-menu-general mtm"> + <?php + if (elgg_get_config('allow_registration')) { + echo '<li><a class="registration_link" href="' . elgg_get_site_url() . 'register">' . elgg_echo('register') . '</a></li>'; + } + ?> + <li><a class="forgot_link" href="<?php echo elgg_get_site_url(); ?>forgotpassword"> + <?php echo elgg_echo('user:password:lost'); ?> + </a></li> + </ul> +</div> diff --git a/views/default/forms/members/name_search.php b/views/default/forms/members/name_search.php new file mode 100644 index 000000000..5f6b9a4b6 --- /dev/null +++ b/views/default/forms/members/name_search.php @@ -0,0 +1,9 @@ +<?php + +$params = array( + 'name' => 'name', + 'class' => 'mbm', +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/submit', array('value' => elgg_echo('search'))); diff --git a/views/default/forms/members/tag_search.php b/views/default/forms/members/tag_search.php new file mode 100644 index 000000000..4fe9bb32a --- /dev/null +++ b/views/default/forms/members/tag_search.php @@ -0,0 +1,12 @@ +<?php +/** + * Simple members search by tag form + */ + +$params = array( + 'name' => 'tag', + 'class' => 'mbm', +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/submit', array('value' => elgg_echo('search'))); diff --git a/views/default/forms/plugins/settings/save.php b/views/default/forms/plugins/settings/save.php new file mode 100644 index 000000000..116529905 --- /dev/null +++ b/views/default/forms/plugins/settings/save.php @@ -0,0 +1,31 @@ +<?php +/** + * Used to show plugin settings for both users and admins. + * + * @package Elgg.Core + * @subpackage Plugins + */ + +$plugin = $vars['entity']; +$plugin_id = $plugin->getID(); +$user_guid = elgg_extract('user_guid', $vars, elgg_get_logged_in_user_guid()); + +// Do we want to show admin settings or user settings +$type = elgg_extract('type', $vars, ''); + +if ($type != 'user') { + $type = ''; +} + +if (elgg_view_exists("plugins/$plugin_id/{$type}settings")) { + echo elgg_view("plugins/$plugin_id/{$type}settings", $vars); +} elseif (elgg_view_exists("{$type}settings/$plugin_id/edit")) { + elgg_deprecated_notice("{$type}settings/$plugin_id/edit was deprecated in favor of plugins/$plugin_id/{$type}settings", 1.8); + echo elgg_view("{$type}settings/$plugin_id/edit", $vars); +} + +echo '<div class="elgg-foot">'; +echo elgg_view('input/hidden', array('name' => 'plugin_id', 'value' => $plugin_id)); +echo elgg_view('input/hidden', array('name' => 'user_guid', 'value' => $user_guid)); +echo elgg_view('input/submit', array('value' => elgg_echo('save'))); +echo '</div>'; diff --git a/views/default/forms/plugins/usersettings/save.php b/views/default/forms/plugins/usersettings/save.php new file mode 100644 index 000000000..ced88f818 --- /dev/null +++ b/views/default/forms/plugins/usersettings/save.php @@ -0,0 +1,14 @@ +<?php +/** + * Plugin user settings + * + * Calls the plugin admin settings form body with type set to 'user' + * + * @package Elgg.Core + * @subpackage Plugins + */ + +$vars['type'] = 'user'; + +// Can't use elgg_view_form() because it overrides the $vars['action'] parameter +echo elgg_view('forms/plugins/settings/save', $vars);
\ No newline at end of file diff --git a/views/default/forms/profile/edit.php b/views/default/forms/profile/edit.php new file mode 100644 index 000000000..cb0a37ca4 --- /dev/null +++ b/views/default/forms/profile/edit.php @@ -0,0 +1,81 @@ +<?php +/** + * Edit profile form + * + * @uses vars['entity'] + */ + +?> + +<div> + <label><?php echo elgg_echo('user:name:label'); ?></label> + <?php echo elgg_view('input/text', array('name' => 'name', 'value' => $vars['entity']->name)); ?> +</div> +<?php + +$sticky_values = elgg_get_sticky_values('profile:edit'); + +$profile_fields = elgg_get_config('profile_fields'); +if (is_array($profile_fields) && count($profile_fields) > 0) { + foreach ($profile_fields as $shortname => $valtype) { + $metadata = elgg_get_metadata(array( + 'guid' => $vars['entity']->guid, + 'metadata_name' => $shortname, + 'limit' => false + )); + if ($metadata) { + if (is_array($metadata)) { + $value = ''; + foreach ($metadata as $md) { + if (!empty($value)) { + $value .= ', '; + } + $value .= $md->value; + $access_id = $md->access_id; + } + } else { + $value = $metadata->value; + $access_id = $metadata->access_id; + } + } else { + $value = ''; + $access_id = ACCESS_DEFAULT; + } + + // sticky form values take precedence over saved ones + if (isset($sticky_values[$shortname])) { + $value = $sticky_values[$shortname]; + } + if (isset($sticky_values['accesslevel'][$shortname])) { + $access_id = $sticky_values['accesslevel'][$shortname]; + } + +?> +<div> + <label><?php echo elgg_echo("profile:{$shortname}") ?></label> + <?php + $params = array( + 'name' => $shortname, + 'value' => $value, + ); + echo elgg_view("input/{$valtype}", $params); + $params = array( + 'name' => "accesslevel[$shortname]", + 'value' => $access_id, + ); + echo elgg_view('input/access', $params); + ?> +</div> +<?php + } +} + +elgg_clear_sticky_form('profile:edit'); + +?> +<div class="elgg-foot"> +<?php + echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid)); + echo elgg_view('input/submit', array('value' => elgg_echo('save'))); +?> +</div> diff --git a/views/default/forms/profile/fields/add.php b/views/default/forms/profile/fields/add.php new file mode 100644 index 000000000..2087ec299 --- /dev/null +++ b/views/default/forms/profile/fields/add.php @@ -0,0 +1,29 @@ +<?php +/** + * Add a new field to the set of custom profile fields + */ + +$label_text = elgg_echo('profile:label'); +$type_text = elgg_echo('profile:type'); + +$label_control = elgg_view('input/text', array('name' => 'label')); +$type_control = elgg_view('input/dropdown', array('name' => 'type', 'options_values' => array( + 'text' => elgg_echo('profile:field:text'), + 'longtext' => elgg_echo('profile:field:longtext'), + 'tags' => elgg_echo('profile:field:tags'), + 'url' => elgg_echo('profile:field:url'), + 'email' => elgg_echo('profile:field:email'), + 'location' => elgg_echo('profile:field:location'), + 'date' => elgg_echo('profile:field:date'), +))); + +$submit_control = elgg_view('input/submit', array('name' => elgg_echo('add'), 'value' => elgg_echo('add'))); + +$formbody = <<< END + <div>$label_text: $label_control</div> + <div class="elgg-foot">$type_text: $type_control + $submit_control</div> +END; + +echo elgg_autop(elgg_echo('profile:explainchangefields')); +echo $formbody; diff --git a/views/default/forms/profile/fields/reset.php b/views/default/forms/profile/fields/reset.php new file mode 100644 index 000000000..c0bb1b7f4 --- /dev/null +++ b/views/default/forms/profile/fields/reset.php @@ -0,0 +1,12 @@ +<?php +/** + * Reset profile fields form + */ + +echo '<div class="elgg-foot">'; +$params = array( + 'value' => elgg_echo('profile:resetdefault'), + 'class' => 'elgg-button-cancel', +); +echo elgg_view('input/submit', $params); +echo '</div>'; diff --git a/views/default/forms/register.php b/views/default/forms/register.php new file mode 100644 index 000000000..c0ee66f76 --- /dev/null +++ b/views/default/forms/register.php @@ -0,0 +1,80 @@ +<?php +/** + * Elgg register form + * + * @package Elgg + * @subpackage Core + */ + +elgg_load_js('elgg.register'); + +$password = $password2 = ''; +$username = get_input('u'); +$email = get_input('e'); +$name = get_input('n'); + +if (elgg_is_sticky_form('register')) { + extract(elgg_get_sticky_values('register')); + elgg_clear_sticky_form('register'); +} + +?> +<div class="mtm"> + <label><?php echo elgg_echo('name'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'name', + 'value' => $name, + 'class' => 'elgg-autofocus', + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('email'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'email', + 'value' => $email, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('username'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'username', + 'value' => $username, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('password'); ?></label><br /> + <?php + echo elgg_view('input/password', array( + 'name' => 'password', + 'value' => $password, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('passwordagain'); ?></label><br /> + <?php + echo elgg_view('input/password', array( + 'name' => 'password2', + 'value' => $password2, + )); + ?> +</div> + +<?php +// view to extend to add more fields to the registration form +echo elgg_view('register/extend', $vars); + +// Add captcha hook +echo elgg_view('input/captcha', $vars); + +echo '<div class="elgg-foot">'; +echo elgg_view('input/hidden', array('name' => 'friend_guid', 'value' => $vars['friend_guid'])); +echo elgg_view('input/hidden', array('name' => 'invitecode', 'value' => $vars['invitecode'])); +echo elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('register'))); +echo '</div>'; diff --git a/views/default/forms/user/passwordreset.php b/views/default/forms/user/passwordreset.php new file mode 100644 index 000000000..5946fa7c0 --- /dev/null +++ b/views/default/forms/user/passwordreset.php @@ -0,0 +1,20 @@ +<?php +/** + * Reset user password form + */ + +echo elgg_autop(elgg_echo('user:resetpassword:reset_password_confirm')); + +echo elgg_view('input/hidden', array( + 'name' => 'u', + 'value' => $vars['guid'], +)); + +echo elgg_view('input/hidden', array( + 'name' => 'c', + 'value' => $vars['code'], +)); + +echo elgg_view('input/submit', array( + 'value' => elgg_echo('resetpassword') +)); diff --git a/views/default/forms/user/requestnewpassword.php b/views/default/forms/user/requestnewpassword.php new file mode 100644 index 000000000..c90971eaf --- /dev/null +++ b/views/default/forms/user/requestnewpassword.php @@ -0,0 +1,24 @@ +<?php +/** + * Elgg forgotten password. + * + * @package Elgg + * @subpackage Core + */ +?> + +<div class="mtm"> + <?php echo elgg_echo('user:password:text'); ?> +</div> +<div> + <label><?php echo elgg_echo('loginusername'); ?></label><br /> + <?php echo elgg_view('input/text', array( + 'name' => 'username', + 'class' => 'elgg-autofocus', + )); + ?> +</div> +<?php echo elgg_view('input/captcha'); ?> +<div class="elgg-foot"> + <?php echo elgg_view('input/submit', array('value' => elgg_echo('request'))); ?> +</div> diff --git a/views/default/forms/useradd.php b/views/default/forms/useradd.php new file mode 100644 index 000000000..4f337e4e4 --- /dev/null +++ b/views/default/forms/useradd.php @@ -0,0 +1,78 @@ +<?php +/** + * Elgg add user form. + * + * @package Elgg + * @subpackage Core + * + */ + +$name = $username = $email = $password = $password2 = $admin = ''; + +if (elgg_is_sticky_form('useradd')) { + extract(elgg_get_sticky_values('useradd')); + elgg_clear_sticky_form('useradd'); + if (is_array($admin)) { + $admin = $admin[0]; + } +} + +?> +<div> + <label><?php echo elgg_echo('name');?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'name', + 'value' => $name, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('username'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'username', + 'value' => $username, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('email'); ?></label><br /> + <?php + echo elgg_view('input/text', array( + 'name' => 'email', + 'value' => $email, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('password'); ?></label><br /> + <?php + echo elgg_view('input/password', array( + 'name' => 'password', + 'value' => $password, + )); + ?> +</div> +<div> + <label><?php echo elgg_echo('passwordagain'); ?></label><br /> + <?php + echo elgg_view('input/password', array( + 'name' => 'password2', + 'value' => $password2, + )); + ?> +</div> +<div> +<?php + echo elgg_view('input/checkboxes', array( + 'name' => "admin", + 'options' => array(elgg_echo('admin_option') => 1), + 'value' => $admin, + )); +?> +</div> + +<div class="elgg-foot"> + <?php echo elgg_view('input/submit', array('value' => elgg_echo('register'))); ?> +</div>
\ No newline at end of file diff --git a/views/default/forms/usersettings/save.php b/views/default/forms/usersettings/save.php new file mode 100644 index 000000000..71323083f --- /dev/null +++ b/views/default/forms/usersettings/save.php @@ -0,0 +1,14 @@ +<?php +/** + * User account settings. + * + * Plugins should extend "forms/account/settings" to add to the settings. + */ + +$form_body = elgg_view("forms/account/settings", $vars); + +$form_body .= '<div class="elgg-foot">'; +$form_body .= elgg_view('input/submit', array('value' => elgg_echo('save'))); +$form_body .= '</div>'; + +echo $form_body;
\ No newline at end of file diff --git a/views/default/forms/widgets/save.php b/views/default/forms/widgets/save.php new file mode 100644 index 000000000..6959b2a82 --- /dev/null +++ b/views/default/forms/widgets/save.php @@ -0,0 +1,41 @@ +<?php +/** + * Elgg widget edit settings + * + * @uses $vars['widget'] + * @uses $vars['show_access'] + */ + +$widget = $vars['widget']; +$show_access = elgg_extract('show_access', $vars, true); + +$edit_view = "widgets/$widget->handler/edit"; +$custom_form_section = elgg_view($edit_view, array('entity' => $widget)); + +$access = ''; +if ($show_access) { + $access = elgg_echo('access') . ': ' . elgg_view('input/access', array( + 'name' => 'params[access_id]', + 'value' => $widget->access_id, + )); +} + +if (!$custom_form_section && !$access) { + return true; +} + +$hidden = elgg_view('input/hidden', array('name' => 'guid', 'value' => $widget->guid)); +$submit = elgg_view('input/submit', array('value' => elgg_echo('save'))); + +$body = <<<___END + $custom_form_section + <div> + $access + </div> + <div class="elgg-foot"> + $hidden + $submit + </div> +___END; + +echo $body; diff --git a/views/default/graphics/ajax_loader.php b/views/default/graphics/ajax_loader.php new file mode 100644 index 000000000..d5ce87ea9 --- /dev/null +++ b/views/default/graphics/ajax_loader.php @@ -0,0 +1,32 @@ +<?php +/** + * Elgg AJAX loader + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['id'] CSS id + * @uses $vars['class'] Optional additional CSS class + * @uses $vars['hidden'] Begin hidden? (true) + */ + +if (isset($vars['id'])) { + $id = "id=\"{$vars['id']}\""; +} + +$class = 'elgg-ajax-loader'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +if (elgg_extract('hidden', $vars, true)) { + $class = "$class hidden"; +} + +$loader = <<< END + +<div class="$class" $id></div> + +END; + +echo $loader;
\ No newline at end of file diff --git a/views/default/group/default.php b/views/default/group/default.php new file mode 100644 index 000000000..383a25c49 --- /dev/null +++ b/views/default/group/default.php @@ -0,0 +1,9 @@ +<?php +/** + * ElggGroup default view. + * + * @package Elgg + * @subpackage Core + */ + +echo elgg_view('object/default', $vars); diff --git a/views/default/group/elements/summary.php b/views/default/group/elements/summary.php new file mode 100644 index 000000000..395ed5292 --- /dev/null +++ b/views/default/group/elements/summary.php @@ -0,0 +1,13 @@ +<?php +/** + * Group summary + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['title'] Title link (optional) false = no title, '' = default + * @uses $vars['metadata'] HTML for entity metadata and actions (optional) + * @uses $vars['subtitle'] HTML for the subtitle (optional) + * @uses $vars['tags'] HTML for the tags (optional) + * @uses $vars['content'] HTML for the entity content (optional) + */ + +echo elgg_view('object/elements/summary', $vars); diff --git a/views/default/group/search/finishblurb.php b/views/default/group/search/finishblurb.php new file mode 100644 index 000000000..ceaeb0ff0 --- /dev/null +++ b/views/default/group/search/finishblurb.php @@ -0,0 +1,18 @@ +<?php +/** + * @package Elgg + * @subpackage Core + * @deprecated 1.7 + */ +elgg_deprecated_notice('view groups/search/finishblurb was deprecated.', 1.7); + +if ($vars['count'] > $vars['threshold']) { + +?> +<div class="contentWrapper"><a href="<?php echo elgg_get_site_url(); ?>search/groups?tag=<?php echo urlencode($vars['tag']); ?>"> + <?php + echo elgg_echo("group:search:finishblurb"); + ?></a> +</div> +<?php +} diff --git a/views/default/group/search/startblurb.php b/views/default/group/search/startblurb.php new file mode 100644 index 000000000..92256d1db --- /dev/null +++ b/views/default/group/search/startblurb.php @@ -0,0 +1,14 @@ +<?php +/** + * @package Elgg + * @subpackage Core + * @deprecated 1.7 + */ +elgg_deprecated_notice('view groups/search/startblurb was deprecated.', 1.7); +?> + +<div class="contentWrapper"> + <?php + echo elgg_echo("group:search:startblurb", array($vars['tag'])); + ?> +</div> diff --git a/views/default/icon/default.php b/views/default/icon/default.php new file mode 100644 index 000000000..7f13a1189 --- /dev/null +++ b/views/default/icon/default.php @@ -0,0 +1,80 @@ +<?php +/** + * Generic icon view. + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method + * @uses $vars['size'] topbar, tiny, small, medium (default), large, master + * @uses $vars['href'] Optional override for link + * @uses $vars['img_class'] Optional CSS class added to img + * @uses $vars['link_class'] Optional CSS class for the link + */ + +$entity = $vars['entity']; + +$sizes = array('small', 'medium', 'large', 'tiny', 'master', 'topbar'); +// Get size +if (!in_array($vars['size'], $sizes)) { + $vars['size'] = "medium"; +} + +$class = elgg_extract('img_class', $vars, ''); + +if (isset($entity->name)) { + $title = $entity->name; +} else { + $title = $entity->title; +} +$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8', false); + +$url = $entity->getURL(); +if (isset($vars['href'])) { + $url = $vars['href']; +} + +$icon_sizes = elgg_get_config('icon_sizes'); +$size = $vars['size']; + +if (!isset($vars['width'])) { + $vars['width'] = $size != 'master' ? $icon_sizes[$size]['w'] : null; +} +if (!isset($vars['height'])) { + $vars['height'] = $size != 'master' ? $icon_sizes[$size]['h'] : null; +} + +$img_params = array( + 'src' => $entity->getIconURL($vars['size']), + 'alt' => $title, +); + +if (!empty($class)) { + $img_params['class'] = $class; +} + +if (!empty($vars['width'])) { + $img_params['width'] = $vars['width']; +} + +if (!empty($vars['height'])) { + $img_params['height'] = $vars['height']; +} + +$img = elgg_view('output/img', $img_params); + +if ($url) { + $params = array( + 'href' => $url, + 'text' => $img, + 'is_trusted' => true, + ); + $class = elgg_extract('link_class', $vars, ''); + if ($class) { + $params['class'] = $class; + } + + echo elgg_view('output/url', $params); +} else { + echo $img; +} diff --git a/views/default/icon/user/default.php b/views/default/icon/user/default.php new file mode 100644 index 000000000..c0b0e7483 --- /dev/null +++ b/views/default/icon/user/default.php @@ -0,0 +1,103 @@ +<?php +/** + * Elgg user icon + * + * Rounded avatar corners - CSS3 method + * uses avatar as background image so we can clip it with border-radius in supported browsers + * + * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. + * @uses $vars['size'] The size - tiny, small, medium or large. (medium) + * @uses $vars['use_hover'] Display the hover menu? (true) + * @uses $vars['use_link'] Wrap a link around image? (true) + * @uses $vars['class'] Optional class added to the .elgg-avatar div + * @uses $vars['img_class'] Optional CSS class added to img + * @uses $vars['link_class'] Optional CSS class for the link + * @uses $vars['href'] Optional override of the link href + */ + +$user = elgg_extract('entity', $vars, elgg_get_logged_in_user_entity()); +$size = elgg_extract('size', $vars, 'medium'); +if (!in_array($size, array('topbar', 'tiny', 'small', 'medium', 'large', 'master'))) { + $size = 'medium'; +} + +$class = "elgg-avatar elgg-avatar-$size"; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +$use_link = elgg_extract('use_link', $vars, true); + +if (!($user instanceof ElggUser)) { + return true; +} + +$name = htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8', false); +$username = $user->username; + +$icontime = $user->icontime; +if (!$icontime) { + $icontime = "default"; +} + +$js = elgg_extract('js', $vars, ''); +if ($js) { + elgg_deprecated_notice("Passing 'js' to icon views is deprecated.", 1.8, 5); +} + +$img_class = ''; +if (isset($vars['img_class'])) { + $img_class = $vars['img_class']; +} + +$use_hover = elgg_extract('use_hover', $vars, true); +if (isset($vars['override'])) { + elgg_deprecated_notice("Use 'use_hover' rather than 'override' with user avatars", 1.8, 5); + $use_hover = false; +} +if (isset($vars['hover'])) { + // only 1.8.0 was released with 'hover' as the key + $use_hover = $vars['hover']; +} + +$spacer_url = elgg_get_site_url() . '_graphics/spacer.gif'; + +$icon_url = elgg_format_url($user->getIconURL($size)); +$icon = elgg_view('output/img', array( + 'src' => $spacer_url, + 'alt' => $name, + 'title' => $name, + 'class' => $img_class, + 'style' => "background: url($icon_url) no-repeat;", +)); + +$show_menu = $use_hover && (elgg_is_admin_logged_in() || !$user->isBanned()); + +?> +<div class="<?php echo $class; ?>"> +<?php + +if ($show_menu) { + $params = array( + 'entity' => $user, + 'username' => $username, + 'name' => $name, + ); + echo elgg_view_icon('hover-menu'); + echo elgg_view_menu('user_hover', $params); +} + +if ($use_link) { + $class = elgg_extract('link_class', $vars, ''); + $url = elgg_extract('href', $vars, $user->getURL()); + echo elgg_view('output/url', array( + 'href' => $url, + 'text' => $icon, + 'is_trusted' => true, + 'class' => $class, + )); +} else { + echo "<a>$icon</a>"; +} +?> +</div> diff --git a/views/default/input/access.php b/views/default/input/access.php new file mode 100644 index 000000000..137eea288 --- /dev/null +++ b/views/default/input/access.php @@ -0,0 +1,38 @@ +<?php +/** + * Elgg access level input + * Displays a dropdown input field + * + * @uses $vars['value'] The current value, if any + * @uses $vars['options_values'] Array of value => label pairs (overrides default) + * @uses $vars['name'] The name of the input field + * @uses $vars['entity'] Optional. The entity for this access control (uses access_id) + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-access {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-access"; +} + +$defaults = array( + 'disabled' => false, + 'value' => get_default_access(), + 'options_values' => get_write_access_array(), +); + +if (isset($vars['entity'])) { + $defaults['value'] = $vars['entity']->access_id; + unset($vars['entity']); +} + +$vars = array_merge($defaults, $vars); + +if ($vars['value'] == ACCESS_DEFAULT) { + $vars['value'] = get_default_access(); +} + +if (is_array($vars['options_values']) && sizeof($vars['options_values']) > 0) { + echo elgg_view('input/dropdown', $vars); +} diff --git a/views/default/input/autocomplete.php b/views/default/input/autocomplete.php new file mode 100644 index 000000000..e58eb1ae8 --- /dev/null +++ b/views/default/input/autocomplete.php @@ -0,0 +1,49 @@ +<?php +/** + * Displays an autocomplete text input. + * + * @package Elgg + * @subpackage Core + * + * @todo This currently only works for ONE AUTOCOMPLETE TEXT FIELD on a page. + * + * @uses $vars['value'] Current value for the text input + * @uses $vars['match_on'] Array | str What to match on. all|array(groups|users|friends) + * @uses $vars['match_owner'] Bool. Match only entities that are owned by logged in user. + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-autocomplete {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-autocomplete"; +} + +$defaults = array( + 'value' => '', + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +$params = array(); +if (isset($vars['match_on'])) { + $params['match_on'] = $vars['match_on']; + unset($vars['match_on']); +} +if (isset($vars['match_owner'])) { + $params['match_owner'] = $vars['match_owner']; + unset($vars['match_owner']); +} +$ac_url_params = http_build_query($params); + +elgg_load_js('elgg.autocomplete'); +elgg_load_js('jquery.ui.autocomplete.html'); + +?> + +<script type="text/javascript"> +elgg.provide('elgg.autocomplete'); +elgg.autocomplete.url = "<?php echo elgg_get_site_url() . 'livesearch?' . $ac_url_params; ?>"; +</script> +<input type="text" <?php echo elgg_format_attributes($vars); ?> /> diff --git a/views/default/input/button.php b/views/default/input/button.php new file mode 100644 index 000000000..9957fdc54 --- /dev/null +++ b/views/default/input/button.php @@ -0,0 +1,40 @@ +<?php +/** + * Create a input button + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['src'] Src of an image + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-button {$vars['class']}"; +} else { + $vars['class'] = "elgg-button"; +} + +$defaults = array( + 'type' => 'button', +); + +$vars = array_merge($defaults, $vars); + +switch ($vars['type']) { + case 'button': + case 'reset': + case 'submit': + case 'image': + break; + default: + $vars['type'] = 'button'; + break; +} + +// blank src if trying to access an offsite image. @todo why? +if (isset($vars['src']) && strpos($vars['src'], elgg_get_site_url()) === false) { + $vars['src'] = ""; +} +?> +<input <?php echo elgg_format_attributes($vars); ?> /> diff --git a/views/default/input/calendar.php b/views/default/input/calendar.php new file mode 100644 index 000000000..52c84ff82 --- /dev/null +++ b/views/default/input/calendar.php @@ -0,0 +1,6 @@ +<?php +// @deprecated Use input/date instead. + +elgg_deprecated_notice('view: input/calendar is deprecated by input/date', 1.8); + +echo elgg_view('input/datepicker', $vars);
\ No newline at end of file diff --git a/views/default/input/captcha.php b/views/default/input/captcha.php new file mode 100644 index 000000000..1c2e22aaa --- /dev/null +++ b/views/default/input/captcha.php @@ -0,0 +1,8 @@ +<?php +/** + * This view provides a hook for third parties to provide a CAPTCHA. + * + * @package Elgg + * @subpackage Core + */ +?>
\ No newline at end of file diff --git a/views/default/input/checkbox.php b/views/default/input/checkbox.php new file mode 100644 index 000000000..3dc75c6c3 --- /dev/null +++ b/views/default/input/checkbox.php @@ -0,0 +1,39 @@ +<?php +/** + * Elgg checkbox input + * Displays a checkbox input tag + * + * @package Elgg + * @subpackage Core + * + * + * Pass input tag attributes as key value pairs. For a list of allowable + * attributes, see http://www.w3schools.com/tags/tag_input.asp + * + * @uses $vars['default'] The default value to submit if not checked. + * Optional, defaults to 0. Set to false for no default. + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-checkbox {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-checkbox"; +} + +$defaults = array( + 'default' => 0, + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +$default = $vars['default']; +unset($vars['default']); + +if (isset($vars['name']) && $default !== false) { + echo "<input type=\"hidden\" name=\"{$vars['name']}\" value=\"$default\"/>"; +} + +?> +<input type="checkbox" <?php echo elgg_format_attributes($vars); ?> /> diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php new file mode 100644 index 000000000..db4b06949 --- /dev/null +++ b/views/default/input/checkboxes.php @@ -0,0 +1,90 @@ +<?php +/** + * Elgg checkbox input + * Displays a checkbox input field + * + * @note This also includes a hidden input with the same name as the checkboxes + * to make sure something is sent to the server. The default value is 0. + * If using JS, be specific to avoid selecting the hidden default value: + * $('input[type=checkbox][name=name]') + * + * @warning Passing integers as labels does not currently work due to a + * deprecated hack that will be removed in Elgg 1.9. To use integer labels, + * the labels must be character codes: 1 would be 1 + * + * @package Elgg + * @subpackage Core + * + * @uses string $vars['name'] The name of the input fields + * (Forced to an array by appending []) + * @uses array $vars['options'] An array of strings representing the + * label => option for the each checkbox field + * @uses string $vars['default'] The default value to send if nothing is checked. + * Optional, defaults to 0. Set to FALSE for no default. + * @uses bool $vars['disabled'] Make all input elements disabled. Optional. + * @uses string $vars['value'] The current value. Single value or array. Optional. + * @uses string $vars['class'] Additional class of the list. Optional. + * @uses string $vars['align'] 'horizontal' or 'vertical' Default: 'vertical' + * + */ + +$defaults = array( + 'align' => 'vertical', + 'value' => array(), + 'default' => 0, + 'disabled' => false, + 'options' => array(), + 'name' => '', +); + +$vars = array_merge($defaults, $vars); + +$class = "elgg-input-checkboxes elgg-{$vars['align']}"; +if (isset($vars['class'])) { + $class .= " {$vars['class']}"; + unset($vars['class']); +} + +$id = ''; +if (isset($vars['id'])) { + $id = "id=\"{$vars['id']}\""; + unset($vars['id']); +} + +if (is_array($vars['value'])) { + $values = array_map('elgg_strtolower', $vars['value']); +} else { + $values = array(elgg_strtolower($vars['value'])); +} + +$input_vars = $vars; +$input_vars['default'] = false; +if ($vars['name']) { + $input_vars['name'] = "{$vars['name']}[]"; +} +unset($input_vars['align']); +unset($input_vars['options']); + +if (count($vars['options']) > 0) { + // include a default value so if nothing is checked 0 will be passed. + if ($vars['name'] && $vars['default'] !== false) { + echo "<input type=\"hidden\" name=\"{$vars['name']}\" value=\"{$vars['default']}\" />"; + } + + echo "<ul class=\"$class\" $id>"; + foreach ($vars['options'] as $label => $value) { + // @deprecated 1.8 Remove in 1.9 + if (is_integer($label)) { + elgg_deprecated_notice('$vars[\'options\'] must be an associative array in input/checkboxes', 1.8); + $label = $value; + } + + $input_vars['checked'] = in_array(elgg_strtolower($value), $values); + $input_vars['value'] = $value; + + $input = elgg_view('input/checkbox', $input_vars); + + echo "<li><label>$input$label</label></li>"; + } + echo '</ul>'; +} diff --git a/views/default/input/date.php b/views/default/input/date.php new file mode 100644 index 000000000..828ce5520 --- /dev/null +++ b/views/default/input/date.php @@ -0,0 +1,56 @@ +<?php +/** + * Elgg date input + * Displays a text field with a popup date picker. + * + * The elgg.ui JavaScript library initializes the jQueryUI datepicker based + * on the CSS class .elgg-input-date. It uses the ISO 8601 standard for date + * representation: yyyy-mm-dd. + * + * Unix timestamps are supported by setting the 'timestamp' parameter to true. + * The date is still displayed to the user in a text format but is submitted as + * a unix timestamp in seconds. + * + * @uses $vars['value'] The current value, if any (as a unix timestamp) + * @uses $vars['class'] Additional CSS class + * @uses $vars['timestamp'] Store as a Unix timestamp in seconds. Default = false + * Note: you cannot use an id with the timestamp option. + */ + +//@todo popup_calendar deprecated in 1.8. Remove in 2.0 +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-date popup_calendar {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-date popup_calendar"; +} + +$defaults = array( + 'value' => '', + 'disabled' => false, + 'timestamp' => false, +); + +$vars = array_merge($defaults, $vars); + +$timestamp = $vars['timestamp']; +unset($vars['timestamp']); + +if ($timestamp) { + echo elgg_view('input/hidden', array( + 'name' => $vars['name'], + 'value' => $vars['value'], + )); + + $vars['class'] = "{$vars['class']} elgg-input-timestamp"; + $vars['id'] = $vars['name']; + unset($vars['name']); + unset($vars['internalname']); +} + +// convert timestamps to text for display +if (is_numeric($vars['value'])) { + $vars['value'] = gmdate('Y-m-d', $vars['value']); +} + +$attributes = elgg_format_attributes($vars); +echo "<input type=\"text\" $attributes />"; diff --git a/views/default/input/datepicker.php b/views/default/input/datepicker.php new file mode 100644 index 000000000..8955e6e53 --- /dev/null +++ b/views/default/input/datepicker.php @@ -0,0 +1,6 @@ +<?php +/** + * @deprecated use input/date instead + */ +elgg_deprecated_notice('input/datepicker was deprecated in favor of input/date', 1.8); +echo elgg_view('input/date', $vars);
\ No newline at end of file diff --git a/views/default/input/dropdown.php b/views/default/input/dropdown.php new file mode 100644 index 000000000..9f07874f1 --- /dev/null +++ b/views/default/input/dropdown.php @@ -0,0 +1,71 @@ +<?php +/** + * Elgg dropdown input + * Displays a dropdown (select) input field + * + * @warning Default values of FALSE or NULL will match '' (empty string) but not 0. + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The current value, if any + * @uses $vars['options'] An array of strings representing the options for the dropdown field + * @uses $vars['options_values'] An associative array of "value" => "option" + * where "value" is the name and "option" is + * the value displayed on the button. Replaces + * $vars['options'] when defined. + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-dropdown {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-dropdown"; +} + +$defaults = array( + 'disabled' => false, + 'value' => '', + 'options_values' => array(), + 'options' => array(), +); + +$vars = array_merge($defaults, $vars); + +$options_values = $vars['options_values']; +unset($vars['options_values']); + +$options = $vars['options']; +unset($vars['options']); + +$value = $vars['value']; +unset($vars['value']); + +?> +<select <?php echo elgg_format_attributes($vars); ?>> +<?php + +if ($options_values) { + foreach ($options_values as $opt_value => $option) { + + $option_attrs = elgg_format_attributes(array( + 'value' => $opt_value, + 'selected' => (string)$opt_value == (string)$value, + )); + + echo "<option $option_attrs>$option</option>"; + } +} else { + if (is_array($options)) { + foreach ($options as $option) { + + $option_attrs = elgg_format_attributes(array( + 'selected' => (string)$option == (string)$value + )); + + echo "<option $option_attrs>$option</option>"; + } + } +} +?> +</select> diff --git a/views/default/input/email.php b/views/default/input/email.php new file mode 100644 index 000000000..190fb88c6 --- /dev/null +++ b/views/default/input/email.php @@ -0,0 +1,26 @@ +<?php +/** + * Elgg email input + * Displays an email input field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-email {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-email"; +} + +$defaults = array( + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +?> + +<input type="text" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/file.php b/views/default/input/file.php new file mode 100644 index 000000000..452fe72b9 --- /dev/null +++ b/views/default/input/file.php @@ -0,0 +1,31 @@ +<?php +/** + * Elgg file input + * Displays a file input field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The current value if any + * @uses $vars['class'] Additional CSS class + */ + +if (!empty($vars['value'])) { + echo elgg_echo('fileexists') . "<br />"; +} + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-file {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-file"; +} + +$defaults = array( + 'disabled' => false, + 'size' => 30, +); + +$attrs = array_merge($defaults, $vars); + +?> +<input type="file" <?php echo elgg_format_attributes($attrs); ?> /> diff --git a/views/default/input/form.php b/views/default/input/form.php new file mode 100644 index 000000000..df30133b3 --- /dev/null +++ b/views/default/input/form.php @@ -0,0 +1,44 @@ +<?php +/** + * Create a form for data submission. + * Use this view for forms as it provides protection against CSRF attacks. + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['body'] The body of the form (made up of other input/xxx views and html + * @uses $vars['action'] The action URL of the form + * @uses $vars['method'] The submit method: post (default) or get + * @uses $vars['enctype'] Set to 'multipart/form-data' if uploading a file + * @uses $vars['disable_security'] turn off CSRF security by setting to true + * @uses $vars['class'] Additional class for the form + */ + +$defaults = array( + 'method' => "post", + 'disable_security' => FALSE, +); + +$vars = array_merge($defaults, $vars); + +if (isset($vars['class'])) { + $vars['class'] = "elgg-form {$vars['class']}"; +} else { + $vars['class'] = 'elgg-form'; +} + +$vars['action'] = elgg_normalize_url($vars['action']); +$vars['method'] = strtolower($vars['method']); + +$body = $vars['body']; +unset($vars['body']); + +// Generate a security header +if (!$vars['disable_security']) { + $body = elgg_view('input/securitytoken') . $body; +} +unset($vars['disable_security']); + +$attributes = elgg_format_attributes($vars); + +echo "<form $attributes><fieldset>$body</fieldset></form>"; diff --git a/views/default/input/friendspicker.php b/views/default/input/friendspicker.php new file mode 100644 index 000000000..40708c890 --- /dev/null +++ b/views/default/input/friendspicker.php @@ -0,0 +1,319 @@ +<?php +/** + * Elgg friends picker + * Lists the friends picker + * + * @warning Below is the ugliest code in Elgg. It needs to be rewritten or removed + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['entities'] The array of ElggUser objects + * @uses $vars['name'] + * @uses $vars['value'] + * @uses $vars['highlight'] + * @uses $vars['callback'] + */ + +elgg_load_js('elgg.friendspicker'); +elgg_load_js('jquery.easing'); + + +$chararray = elgg_echo('friendspicker:chararray'); + +// Initialise name +if (!isset($vars['name'])) { + $name = "friend"; +} else { + $name = $vars['name']; +} + +// Are we highlighting default or all? +if (empty($vars['highlight'])) { + $vars['highlight'] = 'default'; +} +if ($vars['highlight'] != 'all') { + $vars['highlight'] = 'default'; +} + +// Initialise values +if (!isset($vars['value'])) { + $vars['value'] = array(); +} else { + if (!is_array($vars['value'])) { + $vars['value'] = (int) $vars['value']; + $vars['value'] = array($vars['value']); + } +} + +// Initialise whether we're calling back or not +if (isset($vars['callback'])) { + $callback = $vars['callback']; +} else { + $callback = false; +} + +// We need to count the number of friends pickers on the page. +if (!isset($vars['friendspicker'])) { + global $friendspicker; + if (!isset($friendspicker)) { + $friendspicker = 0; + } + $friendspicker++; +} else { + $friendspicker = $vars['friendspicker']; +} + +$users = array(); +$activeletters = array(); + +// Are we displaying form tags and submit buttons? +// (If we've been given a target, then yes! Otherwise, no.) +if (isset($vars['formtarget'])) { + $formtarget = $vars['formtarget']; +} else { + $formtarget = false; +} + +// Sort users by letter +if (is_array($vars['entities']) && sizeof($vars['entities'])) { + foreach($vars['entities'] as $user) { + $letter = elgg_strtoupper(elgg_substr($user->name, 0, 1)); + + if (!elgg_substr_count($chararray, $letter)) { + $letter = "*"; + } + if (!isset($users[$letter])) { + $users[$letter] = array(); + } + $users[$letter][$user->guid] = $user; + } +} + +// sort users in letters alphabetically +foreach ($users as $letter => $letter_users) { + usort($letter_users, create_function('$a, $b', ' + return strcasecmp($a->name, $b->name); + ')); + $users[$letter] = $letter_users; +} + +if (!$callback) { + ?> + + <div class="friends-picker-main-wrapper"> + + <?php + + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + + <div id="friends-picker_placeholder<?php echo $friendspicker; ?>"> + + <?php +} + +if (!isset($vars['replacement'])) { + if ($formtarget) { +?> +<?php //@todo JS 1.8: no ?> +<script language="text/javascript"> + $(function() { // onload...do + $('#collectionMembersForm<?php echo $friendspicker; ?>').submit(function() { + var inputs = []; + $(':input', this).each(function() { + if (this.type != 'checkbox' || (this.type == 'checkbox' && this.checked != false)) { + inputs.push(this.name + '=' + escape(this.value)); + } + }); + jQuery.ajax({ + type: "POST", + data: inputs.join('&'), + url: this.action, + success: function(){ + $('a.collectionmembers<?php echo $friendspicker; ?>').click(); + } + + }); + return false; + }) + }) + + </script> + +<!-- Collection members form --> +<form id="collectionMembersForm<?php echo $friendspicker; ?>" action="<?php echo $formtarget; ?>" method="post"> <!-- action="" method=""> --> + +<?php + echo elgg_view('input/securitytoken'); + echo elgg_view('input/hidden', array( + 'name' => 'collection_id', + 'value' => $vars['collection_id'], + )); + } +?> + +<div class="friends-picker-wrapper"> +<div id="friends-picker<?php echo $friendspicker; ?>"> + <div class="friends-picker-container"> +<?php + +// Initialise letters + $chararray .= "*"; + $letter = elgg_substr($chararray, 0, 1); + $letpos = 0; + while (1 == 1) { + ?> + <div class="panel" title="<?php echo $letter; ?>"> + <div class="wrapper"> + <h3><?php echo $letter; ?></h3> + <?php + + if (isset($users[$letter])) { + ksort($users[$letter]); + + echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; + $col = 0; + + foreach($users[$letter] as $friend) { + if ($col == 0) { + echo "<tr>"; + } + + //echo "<p>" . $user->name . "</p>"; + $label = elgg_view_entity_icon($friend, 'tiny', array('use_hover' => false)); + $options[$label] = $friend->getGUID(); + + if ($vars['highlight'] == 'all' && !in_array($letter,$activeletters)) { + $activeletters[] = $letter; + } + + + if (in_array($friend->getGUID(),$vars['value'])) { + $checked = "checked = \"checked\""; + if (!in_array($letter,$activeletters) && $vars['highlight'] == 'default') { + $activeletters[] = $letter; + } + } else { + $checked = ""; + } + ?> + + <td> + + <input type="checkbox" <?php echo $checked; ?> name="<?php echo $name; ?>[]" value="<?php echo $options[$label]; ?>" /> + + </td> + + <td> + + <div style="width: 25px; margin-bottom: 15px;"> + <?php + echo $label; + ?> + </div> + </td> + <td style="width: 200px; padding: 5px;"> + <?php echo $friend->name; ?> + </td> + <?php + $col++; + if ($col == 3){ + echo "</tr>"; + $col = 0; + } + } + if ($col < 3) { + echo "</tr>"; + } + + echo "</table>"; + } + +?> + + </div> + </div> +<?php + + $substr = elgg_substr($chararray, elgg_strlen($chararray) - 1, 1); + if ($letter == $substr) { + break; + } + //$letter++; + $letpos++; + $letter = elgg_substr($chararray, $letpos, 1); + } + +?> + </div> + +<?php + +if ($formtarget) { + + if (isset($vars['formcontents'])) + echo $vars['formcontents']; + +?> + <div class="clearfix"></div> + <div class="friendspicker-savebuttons"> + <input type="submit" class="elgg-button elgg-button-submit" value="<?php echo elgg_echo('save'); ?>" /> + <input type="button" class="elgg-button elgg-button-cancel" value="<?php echo elgg_echo('cancel'); ?>" onclick="$('a.collectionmembers<?php echo $friendspicker; ?>').click();" /> + <br /></div> + </form> + +<?php + +} + +?> + +</div> +</div> + +<?php +} else { + echo $vars['replacement']; +} +if (!$callback) { + +?> + +</div> +</div> + + +<?php + +} + +if (!isset($vars['replacement'])) { +?> +<?php //@todo JS 1.8: no ?> +<script type="text/javascript"> + // initialise picker + $("div#friends-picker<?php echo $friendspicker; ?>").friendsPicker(<?php echo $friendspicker; ?>); +</script> +<script type="text/javascript"> +$(document).ready(function () { +// manually add class to corresponding tab for panels that have content +<?php +if (sizeof($activeletters) > 0) + //$chararray = elgg_echo('friendspicker:chararray'); + foreach($activeletters as $letter) { + $tab = elgg_strpos($chararray, $letter) + 1; +?> +$("div#friends-picker-navigation<?php echo $friendspicker; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent"); +<?php + } + +?> +}); +</script> + +<?php + +}
\ No newline at end of file diff --git a/views/default/input/hidden.php b/views/default/input/hidden.php new file mode 100644 index 000000000..9c2fc6c08 --- /dev/null +++ b/views/default/input/hidden.php @@ -0,0 +1,12 @@ +<?php +/** + * Create a hidden data field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The current value, if any + */ + +?> +<input type="hidden" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/location.php b/views/default/input/location.php new file mode 100644 index 000000000..4cf05c72a --- /dev/null +++ b/views/default/input/location.php @@ -0,0 +1,27 @@ +<?php +/** + * Location input field + * + * @uses $vars['entity'] The ElggEntity that has a location + * @uses $vars['value'] The default value for the location + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-location {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-location"; +} + +$defaults = array( + 'disabled' => false, +); + +if (isset($vars['entity'])) { + $defaults['value'] = $vars['entity']->location; + unset($vars['entity']); +} + +$vars = array_merge($defaults, $vars); + +echo elgg_view('input/tag', $vars); diff --git a/views/default/input/longtext.php b/views/default/input/longtext.php new file mode 100644 index 000000000..61dc7ca19 --- /dev/null +++ b/views/default/input/longtext.php @@ -0,0 +1,42 @@ +<?php +/** + * Elgg long text input + * Displays a long text input field that can use WYSIWYG editor + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The current value, if any - will be html encoded + * @uses $vars['disabled'] Is the input field disabled? + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-longtext {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-longtext"; +} + +$defaults = array( + 'value' => '', + 'rows' => '10', + 'cols' => '50', + 'id' => 'elgg-input-' . rand(), //@todo make this more robust +); + +$vars = array_merge($defaults, $vars); + +$value = $vars['value']; +unset($vars['value']); + +echo elgg_view_menu('longtext', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + 'id' => $vars['id'], +)); + +?> + +<textarea <?php echo elgg_format_attributes($vars); ?>> +<?php echo htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false); ?> +</textarea> diff --git a/views/default/input/password.php b/views/default/input/password.php new file mode 100644 index 000000000..45f2b20a6 --- /dev/null +++ b/views/default/input/password.php @@ -0,0 +1,28 @@ +<?php +/** + * Elgg password input + * Displays a password input field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The current value, if any + * @uses $vars['name'] The name of the input field + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-password {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-password"; +} + +$defaults = array( + 'disabled' => false, + 'value' => '', +); + +$attrs = array_merge($defaults, $vars); +?> + +<input type="password" <?php echo elgg_format_attributes($attrs); ?> /> diff --git a/views/default/input/plaintext.php b/views/default/input/plaintext.php new file mode 100644 index 000000000..e92c61ced --- /dev/null +++ b/views/default/input/plaintext.php @@ -0,0 +1,37 @@ +<?php +/** + * Elgg long text input (plaintext) + * Displays a long text input field that should not be overridden by wysiwyg editors. + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The current value, if any + * @uses $vars['name'] The name of the input field + * @uses $vars['class'] Additional CSS class + * @uses $vars['disabled'] + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-plaintext {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-plaintext"; +} + +$defaults = array( + 'value' => '', + 'rows' => '10', + 'cols' => '50', + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +$value = $vars['value']; +unset($vars['value']); + +?> + +<textarea <?php echo elgg_format_attributes($vars); ?>> +<?php echo htmlspecialchars($value, ENT_QUOTES, 'UTF-8', false); ?> +</textarea> diff --git a/views/default/input/pulldown.php b/views/default/input/pulldown.php new file mode 100644 index 000000000..fc0595300 --- /dev/null +++ b/views/default/input/pulldown.php @@ -0,0 +1,9 @@ +<?php +/** + * Deprecated pulldown input view - use 'input/dropdown' instead. + * + * @deprecated 1.8 + */ + +elgg_deprecated_notice("input/pulldown was deprecated by input/dropdown", 1.8, 2); +echo elgg_view('input/dropdown', $vars); diff --git a/views/default/input/radio.php b/views/default/input/radio.php new file mode 100644 index 000000000..ef860a773 --- /dev/null +++ b/views/default/input/radio.php @@ -0,0 +1,76 @@ +<?php +/** + * Elgg radio input + * Displays a radio input field + * + * @warning Passing integers as labels does not currently work due to a + * deprecated hack that will be removed in Elgg 1.9. To use integer labels, + * the labels must be character codes: 1 would be 1 + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The current value, if any + * @uses $vars['name'] The name of the input field + * @uses $vars['options'] An array of strings representing the options for the + * radio field as "label" => option + * @uses $vars['class'] Additional class of the list. Optional. + * @uses $vars['align'] 'horizontal' or 'vertical' Default: 'vertical' + */ + +$defaults = array( + 'align' => 'vertical', + 'value' => array(), + 'disabled' => false, + 'options' => array(), + 'name' => '', +); + +$vars = array_merge($defaults, $vars); + +$id = ''; +if (isset($vars['id'])) { + $id = "id=\"{$vars['id']}\""; + unset($vars['id']); +} + +$class = "elgg-input-radios elgg-{$vars['align']}"; +if (isset($vars['class'])) { + $class .= " {$vars['class']}"; + unset($vars['class']); +} +unset($vars['align']); +$vars['class'] = 'elgg-input-radio'; + +if (is_array($vars['value'])) { + $vars['value'] = array_map('elgg_strtolower', $vars['value']); +} else { + $vars['value'] = array(elgg_strtolower($vars['value'])); +} + +$options = $vars['options']; +unset($vars['options']); + +$value = $vars['value']; +unset($vars['value']); + +if ($options && count($options) > 0) { + echo "<ul class=\"$class\" $id>"; + foreach ($options as $label => $option) { + + $vars['checked'] = in_array(elgg_strtolower($option), $value); + $vars['value'] = $option; + + $attributes = elgg_format_attributes($vars); + + // handle indexed array where label is not specified + // @deprecated 1.8 Remove in 1.9 + if (is_integer($label)) { + elgg_deprecated_notice('$vars[\'options\'] must be an associative array in input/radio', 1.8); + $label = $option; + } + + echo "<li><label><input type=\"radio\" $attributes />$label</label></li>"; + } + echo '</ul>'; +} diff --git a/views/default/input/reset.php b/views/default/input/reset.php new file mode 100644 index 000000000..082da8669 --- /dev/null +++ b/views/default/input/reset.php @@ -0,0 +1,14 @@ +<?php +/** + * Create a reset input button + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['class'] CSS class that replaces elgg-button-cancel + */ + +$vars['type'] = 'reset'; +$vars['class'] = elgg_extract('class', $vars, 'elgg-button-cancel'); + +echo elgg_view('input/button', $vars);
\ No newline at end of file diff --git a/views/default/input/securitytoken.php b/views/default/input/securitytoken.php new file mode 100644 index 000000000..75410848a --- /dev/null +++ b/views/default/input/securitytoken.php @@ -0,0 +1,15 @@ +<?php +/** + * CSRF security token view for use with secure forms. + * + * It is still recommended that you use input/form. + * + * @package Elgg + * @subpackage Core + */ + +$ts = time(); +$token = generate_action_token($ts); + +echo elgg_view('input/hidden', array('name' => '__elgg_token', 'value' => $token)); +echo elgg_view('input/hidden', array('name' => '__elgg_ts', 'value' => $ts)); diff --git a/views/default/input/submit.php b/views/default/input/submit.php new file mode 100644 index 000000000..df369b3b4 --- /dev/null +++ b/views/default/input/submit.php @@ -0,0 +1,14 @@ +<?php +/** + * Create a submit input button + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['class'] CSS class that replaces elgg-button-submit + */ + +$vars['type'] = 'submit'; +$vars['class'] = elgg_extract('class', $vars, 'elgg-button-submit'); + +echo elgg_view('input/button', $vars);
\ No newline at end of file diff --git a/views/default/input/tag.php b/views/default/input/tag.php new file mode 100644 index 000000000..8893a18ff --- /dev/null +++ b/views/default/input/tag.php @@ -0,0 +1,25 @@ +<?php +/** + * Elgg tag input + * + * Accepts a single tag value + * + * @uses $vars['value'] The default value for the tag + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-tag {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-tag"; +} + +$defaults = array( + 'value' => '', + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); +?> + +<input type="text" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/tags.php b/views/default/input/tags.php new file mode 100644 index 000000000..261cf9f97 --- /dev/null +++ b/views/default/input/tags.php @@ -0,0 +1,45 @@ +<?php +/** + * Elgg tag input + * Displays a tag input field + * + * @uses $vars['disabled'] + * @uses $vars['class'] Additional CSS class + * @uses $vars['value'] Array of tags or a string + * @uses $vars['entity'] Optional. Entity whose tags are being displayed (metadata ->tags) + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-tags {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-tags"; +} + +$defaults = array( + 'value' => '', + 'disabled' => false, +); + +if (isset($vars['entity'])) { + $defaults['value'] = $vars['entity']->tags; + unset($vars['entity']); +} + +$vars = array_merge($defaults, $vars); + +if (is_array($vars['value'])) { + $tags = array(); + + foreach ($vars['value'] as $tag) { + if (is_string($tag)) { + $tags[] = $tag; + } else { + $tags[] = $tag->value; + } + } + + $vars['value'] = implode(", ", $tags); +} + +?> +<input type="text" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/text.php b/views/default/input/text.php new file mode 100644 index 000000000..07ce5c710 --- /dev/null +++ b/views/default/input/text.php @@ -0,0 +1,26 @@ +<?php +/** + * Elgg text input + * Displays a text input field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-text {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-text"; +} + +$defaults = array( + 'value' => '', + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +?> +<input type="text" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/views/default/input/url.php b/views/default/input/url.php new file mode 100644 index 000000000..e97a316d8 --- /dev/null +++ b/views/default/input/url.php @@ -0,0 +1,27 @@ +<?php +/** + * Elgg URL input + * Displays a URL input field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['class'] Additional CSS class + */ + +if (isset($vars['class'])) { + $vars['class'] = "elgg-input-url {$vars['class']}"; +} else { + $vars['class'] = "elgg-input-url"; +} + +$defaults = array( + 'value' => '', + 'disabled' => false, +); + +$vars = array_merge($defaults, $vars); + +?> + +<input type="text" <?php echo elgg_format_attributes($vars); ?> /> diff --git a/views/default/input/urlshortener.php b/views/default/input/urlshortener.php new file mode 100644 index 000000000..ecfb02efa --- /dev/null +++ b/views/default/input/urlshortener.php @@ -0,0 +1,8 @@ +<?php +/** + * This view provides a hook for third parties to provide a URL shortener. + * + * @package Elgg + * @subpackage Core + */ +?>
\ No newline at end of file diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php new file mode 100644 index 000000000..8b64d7df5 --- /dev/null +++ b/views/default/input/userpicker.php @@ -0,0 +1,75 @@ +<?php +/** + * User Picker. Sends an array of user guids. + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] Array of user guids for already selected users or null + * + * The name of the hidden fields is members[] + * + * @warning Only a single input/userpicker is supported per web page. + * + * Defaults to lazy load user lists in alphabetical order. User needs + * to type two characters before seeing the user popup list. + * + * As users are selected they move down to a "users" box. + * When this happens, a hidden input is created with the + * name of members[] and a value of the GUID. + */ + +elgg_load_js('elgg.userpicker'); +elgg_load_js('jquery.ui.autocomplete.html'); + +function user_picker_add_user($user_id) { + $user = get_entity($user_id); + if (!$user || !($user instanceof ElggUser)) { + return false; + } + + $icon = elgg_view_entity_icon($user, 'tiny', array('use_hover' => false)); + + // this html must be synced with the userpicker.js library + $code = '<li><div class="elgg-image-block">'; + $code .= "<div class='elgg-image'>$icon</div>"; + $code .= "<div class='elgg-image-alt'><a href='#' class='elgg-userpicker-remove'>X</a></div>"; + $code .= "<div class='elgg-body'>" . $user->name . "</div>"; + $code .= "</div>"; + $code .= "<input type=\"hidden\" name=\"members[]\" value=\"$user_id\">"; + $code .= '</li>'; + + return $code; +} + +// loop over all values and prepare them so that "in" will work in javascript +$values = array(); +if (!is_array($vars['value'])) { + $vars['value'] = array($vars['value']); +} +foreach ($vars['value'] as $value) { + $values[$value] = TRUE; +} + +// convert the values to a json-encoded list +$json_values = json_encode($values); + +// create an HTML list of users +$user_list = ''; +foreach ($vars['value'] as $user_id) { + $user_list .= user_picker_add_user($user_id); +} + +?> +<div class="elgg-user-picker"> + <input type="text" class="elgg-input-user-picker" size="30"/> + <label> + <input type="checkbox" name="match_on" value="true" /> + <?php echo elgg_echo('userpicker:only_friends'); ?> + </label> + <ul class="elgg-user-picker-list"><?php echo $user_list; ?></ul> +</div> +<script type="text/javascript"> + // @todo grab the values in the init function rather than using inline JS + elgg.userpicker.userList = <?php echo $json_values ?>; +</script> diff --git a/views/default/js/admin.php b/views/default/js/admin.php new file mode 100644 index 000000000..e8aa0d2ed --- /dev/null +++ b/views/default/js/admin.php @@ -0,0 +1,126 @@ +<?php +/** + * Admin-area specific javascript functions. + * + * @since 1.8 + */ + +if (0) { ?><script><?php } +?> +elgg.provide('elgg.admin'); + +elgg.admin.init = function () { + + // system messages do not fade in admin area, instead slide up when clicked + $('.elgg-system-messages li').stop(true); + $('.elgg-system-messages li').die('click'); + $('.elgg-system-messages li').live('click', function() { + $(this).stop().slideUp('medium'); + }); + + // draggable plugin reordering + $('#elgg-plugin-list > ul').sortable({ + items: 'li:has(> .elgg-state-draggable)', + handle: '.elgg-head', + forcePlaceholderSize: true, + placeholder: 'elgg-widget-placeholder', + opacity: 0.8, + revert: 500, + stop: elgg.admin.movePlugin + }); + + // in-line editing for custom profile fields. + // @note this requires jquery.jeditable plugin + $(".elgg-state-editable").editable(elgg.admin.editProfileField, { + type: 'text', + onblur: 'submit', + width: '300px', + height: 'none', + style: 'display:inline;' + }); + + // draggable profile field reordering. + $('#elgg-profile-fields').sortable({ + items: 'li', + handle: 'span.elgg-state-draggable', + stop: elgg.admin.moveProfileField + }); + + // admin notices delete ajax + $('a.elgg-admin-notice').click(elgg.admin.deleteNotice); +}; + +/** + * Save the plugin order after a move event. + * + * @param {Object} e Event object. + * @param {Object} ui jQueryUI object + * @return void + */ +elgg.admin.movePlugin = function(e, ui) { + // get guid from id like elgg-object-<guid> + var pluginGuid = ui.item.attr('id'); + pluginGuid = pluginGuid.replace('elgg-object-', ''); + + elgg.action('admin/plugins/set_priority', { + data: { + plugin_guid: pluginGuid, + // we start at priority 1 + priority: ui.item.index() + 1 + } + }); +}; + +/** + * In-line editing for custom profile fields + * + * @param string value The new value + * @param {Object} settings The settings used for editable + * @return void + */ +elgg.admin.editProfileField = function(value, settings) { + var id = $(this).attr('id'); + id = id.replace('elgg-profile-field-', ''); + + var data = { + id: id, + label: value + }; + + elgg.action('profile/fields/edit', data); + return value; +}; + +/** + * Save the plugin profile order after a move event. + * + * @param {Object} e Event object. + * @param {Object} ui jQueryUI object + * @return void + */ +elgg.admin.moveProfileField = function(e, ui) { + var orderArr = $('#elgg-profile-fields').sortable('toArray'); + var orderStr = orderArr.join(','); + + elgg.action('profile/fields/reorder', { + fieldorder: orderStr + }); +}; + +/** + * Fires the ajax action to delete the admin notice then hides the notice. + * + * @return void + */ +elgg.admin.deleteNotice = function(e) { + e.preventDefault(); + var $container = $(this).closest('p'); + + elgg.action($(this).attr('href'), { + success: function(json) { + $container.slideUp('medium'); + } + }); +}; + +elgg.register_hook_handler('init', 'system', elgg.admin.init, 1000);
\ No newline at end of file diff --git a/views/default/js/elgg.php b/views/default/js/elgg.php new file mode 100644 index 000000000..c3b56e398 --- /dev/null +++ b/views/default/js/elgg.php @@ -0,0 +1,77 @@ +<?php +/** + * Core Elgg javascript loader + */ +global $CONFIG; + +$prereq_files = array( + "vendors/sprintf.js", + "js/lib/elgglib.js", +); + +foreach ($prereq_files as $file) { + include("{$CONFIG->path}$file"); +} + +//No such thing as autoloading classes in javascript +$model_files = array( + 'ElggEntity', + 'ElggUser', + 'ElggPriorityList', +); + +foreach ($model_files as $file) { + include("{$CONFIG->path}js/classes/$file.js"); +} + +//Include library files +$libs = array( + //libraries + 'prototypes', + 'hooks', + 'security', + 'languages', + 'ajax', + 'session', + 'pageowner', + 'configuration', + + //ui + 'ui', + 'ui.widgets', +); + +foreach ($libs as $file) { + include("{$CONFIG->path}js/lib/$file.js"); + // putting a new line between the files to address https://github.com/elgg/elgg/issues/3081 + echo "\n"; +} + +/** + * Set some values that are cacheable + */ +if (0) { ?><script><?php } +?> + +elgg.version = '<?php echo get_version(); ?>'; +elgg.release = '<?php echo get_version(true); ?>'; +elgg.config.wwwroot = '<?php echo elgg_get_site_url(); ?>'; +<?php //@todo make this configurable ?> +elgg.security.interval = 5 * 60 * 1000; +elgg.config.domReady = false; +elgg.config.language = '<?php echo isset($CONFIG->language) ? $CONFIG->language : 'en'; ?>'; +elgg.config.languageReady = false; + +//After the DOM is ready +$(function() { + elgg.config.domReady = true; + elgg.initWhenReady(); +}); + +<?php + +$previous_content = elgg_view('js/initialise_elgg'); +if ($previous_content) { + elgg_deprecated_notice("The view 'js/initialise_elgg' has been deprecated for js/elgg", 1.8); + echo $previous_content; +} diff --git a/views/default/js/initialise_elgg.php b/views/default/js/initialise_elgg.php new file mode 100644 index 000000000..3d617953a --- /dev/null +++ b/views/default/js/initialise_elgg.php @@ -0,0 +1,4 @@ +<?php +/** + * This has been deprecated in 1.8 - see elgg.php in this directory. + */
\ No newline at end of file diff --git a/views/default/js/initialize_elgg.php b/views/default/js/initialize_elgg.php new file mode 100644 index 000000000..b45c33463 --- /dev/null +++ b/views/default/js/initialize_elgg.php @@ -0,0 +1,52 @@ +<?php +/** + * Initialize Elgg's js lib with the uncacheable data + */ + +if (0) { ?><script><?php } +?> +/** + * Don't want to cache these -- they could change for every request + */ +elgg.config.lastcache = <?php echo (int)elgg_get_config('lastcache'); ?>; +elgg.config.viewtype = '<?php echo elgg_get_viewtype(); ?>'; +elgg.config.simplecache_enabled = <?php echo (int)elgg_is_simplecache_enabled(); ?>; + +elgg.security.token.__elgg_ts = <?php echo $ts = time(); ?>; +elgg.security.token.__elgg_token = '<?php echo generate_action_token($ts); ?>'; + +<?php +// @todo json export should be smoother than this... +// @todo Might also be nice to make url exportable. $entity->url? yes please! +$page_owner = elgg_get_page_owner_entity(); + +if ($page_owner instanceof ElggEntity) { + $page_owner_json = array(); + foreach ($page_owner->getExportableValues() as $v) { + $page_owner_json[$v] = $page_owner->$v; + } + + $page_owner_json['subtype'] = $page_owner->getSubtype(); + $page_owner_json['url'] = $page_owner->getURL(); + + echo 'elgg.page_owner = ' . json_encode($page_owner_json) . ';'; +} + +$user = elgg_get_logged_in_user_entity(); + +if ($user instanceof ElggUser) { + $user_json = array(); + foreach ($user->getExportableValues() as $v) { + $user_json[$v] = $user->$v; + } + + $user_json['subtype'] = $user->getSubtype(); + $user_json['url'] = $user->getURL(); + $user_json['admin'] = $user->isAdmin(); + + echo 'elgg.session.user = new elgg.ElggUser(' . json_encode($user_json) . ');'; +} +?> + +//Before the DOM is ready, but elgg's js framework is fully initalized +elgg.trigger_hook('boot', 'system');
\ No newline at end of file diff --git a/views/default/js/languages.php b/views/default/js/languages.php new file mode 100644 index 000000000..fcf903d4b --- /dev/null +++ b/views/default/js/languages.php @@ -0,0 +1,33 @@ +<?php +/** + * @uses $vars['language'] + * @uses $vars['lc'] if present, client will be sent long expires headers + */ + +$language = $vars['language']; +$lastcache = elgg_extract('lc', $vars, 0); + +// @todo add server-side caching +if ($lastcache) { + // we're relying on lastcache changes to predict language changes + $etag = '"' . md5("$language|$lastcache") . '"'; + + header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+6 months")), true); + header("Pragma: public", true); + header("Cache-Control: public", true); + header("ETag: $etag"); + + if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) === $etag) { + header("HTTP/1.1 304 Not Modified"); + exit; + } +} + +$all_translations = elgg_get_config('translations'); +$translations = $all_translations['en']; + +if ($language != 'en') { + $translations = array_merge($translations, $all_translations[$language]); +} + +echo json_encode($translations);
\ No newline at end of file diff --git a/views/default/js/languages/en.php b/views/default/js/languages/en.php new file mode 100644 index 000000000..8a604cc12 --- /dev/null +++ b/views/default/js/languages/en.php @@ -0,0 +1,2 @@ +<?php +echo elgg_view('js/languages', array('language' => 'en'));
\ No newline at end of file diff --git a/views/default/js/lightbox.php b/views/default/js/lightbox.php new file mode 100644 index 000000000..a1f018eea --- /dev/null +++ b/views/default/js/lightbox.php @@ -0,0 +1,36 @@ +<?php +/** + * Elgg lightbox + * + * Usage + * Call elgg_load_js('lightbox') and elgg_load_css('lightbox') then + * apply the class elgg-lightbox to links. + * + * Advanced Usage + * Elgg is distributed with the Fancybox jQuery library. Please go to + * http://fancybox.net for more information on the options of this lightbox. + * + * Overriding + * In a plugin, override this view and override the registration for the + * lightbox JavaScript and CSS (@see elgg_views_boot()). + * + * @todo add support for passing options: $('#myplugin-lightbox').elgg.ui.lightbox(options); + */ + +if (0) { ?><script><?php } +?> + +/** + * Lightbox initialization + */ +elgg.ui.lightbox_init = function() { + $(".elgg-lightbox").fancybox(); +} + +elgg.register_hook_handler('init', 'system', elgg.ui.lightbox_init); + +<?php + +$js_path = elgg_get_config('path'); +$js_path = "{$js_path}vendors/jquery/fancybox/jquery.fancybox-1.3.4.pack.js"; +include $js_path; diff --git a/views/default/js/walled_garden.php b/views/default/js/walled_garden.php new file mode 100644 index 000000000..e228df507 --- /dev/null +++ b/views/default/js/walled_garden.php @@ -0,0 +1,67 @@ +<?php +/** + * Walled garden JavaScript + * + * @since 1.8 + */ + +$cancel_button = elgg_view('input/button', array( + 'value' => elgg_echo('cancel'), + 'class' => 'elgg-button-cancel mlm', +)); +$cancel_button = json_encode($cancel_button); + +if (0) { ?><script><?php } +?> + +elgg.provide('elgg.walled_garden'); + +elgg.walled_garden.init = function () { + + $('.forgot_link').click(elgg.walled_garden.load('lost_password')); + $('.registration_link').click(elgg.walled_garden.load('register')); + + $('input.elgg-button-cancel').live('click', function(event) { + var $wgs = $('.elgg-walledgarden-single'); + if ($wgs.is(':visible')) { + $('.elgg-walledgarden-double').fadeToggle(); + $wgs.fadeToggle(); + $wgs.remove(); + } + event.preventDefault(); + }); +}; + +/** + * Creates a closure for loading walled garden content through ajax + * + * @param {String} view Name of the walled garden view + * @return {Object} + */ +elgg.walled_garden.load = function(view) { + return function(event) { + var id = '#elgg-walledgarden-' + view; + id = id.replace('_', '-'); + //@todo display some visual element that indicates that loading of content is running + elgg.get('walled_garden/' + view, { + 'success' : function(data) { + var $wg = $('.elgg-body-walledgarden'); + $wg.append(data); + $(id).find('input.elgg-button-submit').after(<?php echo $cancel_button; ?>); + + if (view == 'register' && $wg.hasClass('hidden')) { + // this was a failed register, display the register form ASAP + $('#elgg-walledgarden-login').toggle(false); + $(id).toggle(); + $wg.removeClass('hidden'); + } else { + $('#elgg-walledgarden-login').fadeToggle(); + $(id).fadeToggle(); + } + } + }); + event.preventDefault(); + }; +}; + +elgg.register_hook_handler('init', 'system', elgg.walled_garden.init);
\ No newline at end of file diff --git a/views/default/navigation/breadcrumbs.php b/views/default/navigation/breadcrumbs.php new file mode 100644 index 000000000..88577a8ff --- /dev/null +++ b/views/default/navigation/breadcrumbs.php @@ -0,0 +1,41 @@ +<?php +/** + * Displays breadcrumbs. + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['breadcrumbs'] (Optional) Array of arrays with keys 'title' and 'link' + * @uses $vars['class'] + * + * @see elgg_push_breadcrumb + */ + +if (isset($vars['breadcrumbs'])) { + $breadcrumbs = $vars['breadcrumbs']; +} else { + $breadcrumbs = elgg_get_breadcrumbs(); +} + +$class = 'elgg-menu elgg-breadcrumbs'; +$additional_class = elgg_extract('class', $vars, ''); +if ($additional_class) { + $class = "$class $additional_class"; +} + +if (is_array($breadcrumbs) && count($breadcrumbs) > 0) { + echo "<ul class=\"$class\">"; + foreach ($breadcrumbs as $breadcrumb) { + if (!empty($breadcrumb['link'])) { + $crumb = elgg_view('output/url', array( + 'href' => $breadcrumb['link'], + 'text' => $breadcrumb['title'], + 'is_trusted' => true, + )); + } else { + $crumb = $breadcrumb['title']; + } + echo "<li>$crumb</li>"; + } + echo '</ul>'; +} diff --git a/views/default/navigation/menu/default.php b/views/default/navigation/menu/default.php new file mode 100644 index 000000000..006deb3ea --- /dev/null +++ b/views/default/navigation/menu/default.php @@ -0,0 +1,31 @@ +<?php +/** + * Default menu + * + * @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'])) { + $class .= " {$vars['class']}"; +} + +foreach ($vars['menu'] as $section => $menu_items) { + echo elgg_view('navigation/menu/elements/section', array( + 'items' => $menu_items, + 'class' => "$class elgg-menu-{$vars['name']}-$section", + 'section' => $section, + 'name' => $vars['name'], + '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 new file mode 100644 index 000000000..fd9738826 --- /dev/null +++ b/views/default/navigation/menu/elements/item.php @@ -0,0 +1,43 @@ +<?php +/** + * A single element of a menu. + * + * @package Elgg.Core + * @subpackage Navigation + * + * @uses $vars['item'] ElggMenuItem + * @uses $vars['item_class'] Additional CSS class for the menu item + */ + +$item = $vars['item']; + +$link_class = 'elgg-menu-closed'; +if ($item->getSelected()) { + // @todo switch to addItemClass when that is implemented + //$item->setItemClass('elgg-state-selected'); + $link_class = 'elgg-menu-opened'; +} + +$children = $item->getChildren(); +if ($children) { + $item->addLinkClass($link_class); + $item->addLinkClass('elgg-menu-parent'); +} + +$item_class = $item->getItemClass(); +if ($item->getSelected()) { + $item_class = "$item_class elgg-state-selected"; +} +if (isset($vars['item_class']) && $vars['item_class']) { + $item_class .= ' ' . $vars['item_class']; +} + +echo "<li class=\"$item_class\">"; +echo $item->getContent(); +if ($children) { + echo elgg_view('navigation/menu/elements/section', array( + 'items' => $children, + 'class' => 'elgg-menu elgg-child-menu', + )); +} +echo '</li>'; diff --git a/views/default/navigation/menu/elements/section.php b/views/default/navigation/menu/elements/section.php new file mode 100644 index 000000000..c0e9ba750 --- /dev/null +++ b/views/default/navigation/menu/elements/section.php @@ -0,0 +1,30 @@ +<?php +/** + * Menu group + * + * @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); + $section = elgg_extract('section', $vars); + echo '<h2>' . elgg_echo("menu:$name:header:$section") . '</h2>'; +} + +echo "<ul class=\"$class\">"; +foreach ($vars['items'] as $menu_item) { + echo elgg_view('navigation/menu/elements/item', array( + 'item' => $menu_item, + 'item_class' => $item_class, + )); +} +echo '</ul>'; diff --git a/views/default/navigation/menu/page.php b/views/default/navigation/menu/page.php new file mode 100644 index 000000000..56a288234 --- /dev/null +++ b/views/default/navigation/menu/page.php @@ -0,0 +1,36 @@ +<?php +/** + * Page menu + * + * @uses $vars['menu'] + * @uses $vars['selected_item'] + * @uses $vars['class'] + * @uses $vars['name'] + * @uses $vars['show_section_headers'] + */ + +$headers = elgg_extract('show_section_headers', $vars, false); + +$class = 'elgg-menu elgg-menu-page'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +if (isset($vars['selected_item'])) { + $parent = $vars['selected_item']->getParent(); + + while ($parent) { + $parent->setSelected(); + $parent = $parent->getParent(); + } +} + +foreach ($vars['menu'] as $section => $menu_items) { + echo elgg_view('navigation/menu/elements/section', array( + 'items' => $menu_items, + 'class' => "$class elgg-menu-page-$section", + 'section' => $section, + 'name' => $vars['name'], + 'show_section_headers' => $headers + )); +} diff --git a/views/default/navigation/menu/site.php b/views/default/navigation/menu/site.php new file mode 100644 index 000000000..24c21dd57 --- /dev/null +++ b/views/default/navigation/menu/site.php @@ -0,0 +1,30 @@ +<?php +/** + * Site navigation menu + * + * @uses $vars['menu']['default'] + * @uses $vars['menu']['more'] + */ + +$default_items = elgg_extract('default', $vars['menu'], array()); +$more_items = elgg_extract('more', $vars['menu'], array()); + +echo '<ul class="elgg-menu elgg-menu-site elgg-menu-site-default clearfix">'; +foreach ($default_items as $menu_item) { + echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item)); +} + +if ($more_items) { + echo '<li class="elgg-more">'; + + $more = elgg_echo('more'); + echo "<a href=\"#\">$more</a>"; + + echo elgg_view('navigation/menu/elements/section', array( + 'class' => 'elgg-menu elgg-menu-site elgg-menu-site-more', + 'items' => $more_items, + )); + + echo '</li>'; +} +echo '</ul>'; diff --git a/views/default/navigation/menu/user_hover.php b/views/default/navigation/menu/user_hover.php new file mode 100644 index 000000000..5c89e585c --- /dev/null +++ b/views/default/navigation/menu/user_hover.php @@ -0,0 +1,60 @@ +<?php +/** + * User hover menu + * + * Register for the 'register', 'menu:user_hover' plugin hook to add to the user + * hover menu. There are three sections: action, default, and admin. + * + * @uses $vars['menu'] Menu array provided by elgg_view_menu() + */ + +$user = $vars['entity']; +$actions = elgg_extract('action', $vars['menu'], null); +$main = elgg_extract('default', $vars['menu'], null); +$admin = elgg_extract('admin', $vars['menu'], null); + +echo '<ul class="elgg-menu elgg-menu-hover">'; + +// name and username +$name_link = elgg_view('output/url', array( + 'href' => $user->getURL(), + 'text' => "<span class=\"elgg-heading-basic\">$user->name</span>@$user->username", + 'is_trusted' => true, +)); +echo "<li>$name_link</li>"; + +// actions +if (elgg_is_logged_in() && $actions) { + echo '<li>'; + echo elgg_view('navigation/menu/elements/section', array( + 'class' => "elgg-menu elgg-menu-hover-actions", + 'items' => $actions, + )); + echo '</li>'; +} + +// main +if ($main) { + echo '<li>'; + + echo elgg_view('navigation/menu/elements/section', array( + 'class' => 'elgg-menu elgg-menu-hover-default', + 'items' => $main, + )); + + echo '</li>'; +} + +// admin +if (elgg_is_admin_logged_in() && $admin) { + echo '<li>'; + + echo elgg_view('navigation/menu/elements/section', array( + 'class' => 'elgg-menu elgg-menu-hover-admin', + 'items' => $admin, + )); + + echo '</li>'; +} + +echo '</ul>'; diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php new file mode 100644 index 000000000..04044c51c --- /dev/null +++ b/views/default/navigation/pagination.php @@ -0,0 +1,132 @@ +<?php +/** + * Elgg pagination + * + * @package Elgg + * @subpackage Core + * + * @uses int $vars['offset'] The offset in the list + * @uses int $vars['limit'] Number of items per page + * @uses int $vars['count'] Number of items in list + * @uses string $vars['base_url'] Base URL to use in links + * @uses string $vars['offset_key'] The string to use for offet in the URL + */ + +if (elgg_in_context('widget')) { + // widgets do not show pagination + return true; +} + +$offset = abs((int) elgg_extract('offset', $vars, 0)); +// because you can say $vars['limit'] = 0 +if (!$limit = (int) elgg_extract('limit', $vars, 10)) { + $limit = 10; +} + +$count = (int) elgg_extract('count', $vars, 0); +$offset_key = elgg_extract('offset_key', $vars, 'offset'); +// some views pass an empty string for base_url +if (isset($vars['base_url']) && $vars['base_url']) { + $base_url = $vars['base_url']; +} else if (isset($vars['baseurl']) && $vars['baseurl']) { + elgg_deprecated_notice("Use 'base_url' instead of 'baseurl' for the navigation/pagination view", 1.8); + $base_url = $vars['baseurl']; +} else { + $base_url = current_page_url(); +} + +$num_pages = elgg_extract('num_pages', $vars, 10); +$delta = ceil($num_pages / 2); + +if ($count <= $limit && $offset == 0) { + // no need for pagination + return true; +} + +$total_pages = ceil($count / $limit); +$current_page = ceil($offset / $limit) + 1; + +$pages = new stdClass(); +$pages->prev = array( + 'text' => '« ' . elgg_echo('previous'), + 'href' => '', + 'is_trusted' => true, +); +$pages->next = array( + 'text' => elgg_echo('next') . ' »', + 'href' => '', + 'is_trusted' => true, +); +$pages->items = array(); + +// Add pages before the current page +if ($current_page > 1) { + $prev_offset = $offset - $limit; + if ($prev_offset < 0) { + $prev_offset = 0; + } + + $pages->prev['href'] = elgg_http_add_url_query_elements($base_url, array($offset_key => $prev_offset)); + + $first_page = $current_page - $delta; + if ($first_page < 1) { + $first_page = 1; + } + + $pages->items = range($first_page, $current_page - 1); +} + + +$pages->items[] = $current_page; + + +// add pages after the current one +if ($current_page < $total_pages) { + $next_offset = $offset + $limit; + if ($next_offset >= $count) { + $next_offset--; + } + + $pages->next['href'] = elgg_http_add_url_query_elements($base_url, array($offset_key => $next_offset)); + + $last_page = $current_page + $delta; + if ($last_page > $total_pages) { + $last_page = $total_pages; + } + + $pages->items = array_merge($pages->items, range($current_page + 1, $last_page)); +} + + +echo '<ul class="elgg-pagination">'; + +if ($pages->prev['href']) { + $link = elgg_view('output/url', $pages->prev); + echo "<li>$link</li>"; +} else { + echo "<li class=\"elgg-state-disabled\"><span>{$pages->prev['text']}</span></li>"; +} + +foreach ($pages->items as $page) { + if ($page == $current_page) { + echo "<li class=\"elgg-state-selected\"><span>$page</span></li>"; + } else { + $page_offset = (($page - 1) * $limit); + $url = elgg_http_add_url_query_elements($base_url, array($offset_key => $page_offset)); + $link = elgg_view('output/url', array( + 'href' => $url, + 'text' => $page, + 'is_trusted' => true, + )); + echo "<li>$link</li>"; + } +} + +if ($pages->next['href']) { + $link = elgg_view('output/url', $pages->next); + echo "<li>$link</li>"; +} else { + echo "<li class=\"elgg-state-disabled\"><span>{$pages->next['text']}</span></li>"; +} + +echo '</ul>'; diff --git a/views/default/navigation/tabs.php b/views/default/navigation/tabs.php new file mode 100644 index 000000000..95e3f2669 --- /dev/null +++ b/views/default/navigation/tabs.php @@ -0,0 +1,81 @@ +<?php +/** + * Tab navigation + * + * @uses string $vars['type'] horizontal || vertical - Defaults to horizontal + * @uses string $vars['class'] Additional class to add to ul + * @uses array $vars['tabs'] A multi-dimensional array of tab entries in the format array( + * 'text' => string, // The string between the <a></a> tags + * 'href' => string, // URL for the link + * 'class' => string // Class of the li element + * 'id' => string, // ID of the li element + * 'selected' => bool // if this tab is currently selected (applied to li element) + * 'link_class' => string, // Class to pass to the link + * 'link_id' => string, // ID to pass to the link + * ) + */ +$options = elgg_clean_vars($vars); + +$type = elgg_extract('type', $vars, 'horizontal'); + +if ($type == 'horizontal') { + $options['class'] = "elgg-tabs elgg-htabs"; +} else { + $options['class'] = "elgg-tabs elgg-vtabs"; +} +if (isset($vars['class'])) { + $options['class'] = "{$options['class']} {$vars['class']}"; +} + +unset($options['tabs']); +unset($options['type']); + +$attributes = elgg_format_attributes($options); + +if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) { + ?> + <ul <?php echo $attributes; ?>> + <?php + foreach ($vars['tabs'] as $info) { + $class = elgg_extract('class', $info, ''); + $id = elgg_extract('id', $info, ''); + + $selected = elgg_extract('selected', $info, FALSE); + if ($selected) { + $class .= ' elgg-state-selected'; + } + + $class_str = ($class) ? "class=\"$class\"" : ''; + $id_str = ($id) ? "id=\"$id\"" : ''; + + $options = $info; + unset($options['class']); + unset($options['id']); + unset($options['selected']); + + if (!isset($info['href']) && isset($info['url'])) { + $options['href'] = $info['url']; + unset($options['url']); + } + if (!isset($info['text']) && isset($info['title'])) { + $options['text'] = $options['title']; + unset($options['title']); + } + if (isset($info['link_class'])) { + $options['class'] = $options['link_class']; + unset($options['link_class']); + } + + if (isset($info['link_id'])) { + $options['id'] = $options['link_id']; + unset($options['link_id']); + } + + $link = elgg_view('output/url', $options); + + echo "<li $id_str $class_str>$link</li>"; + } + ?> + </ul> + <?php +} diff --git a/views/default/navigation/topbar_tools.php b/views/default/navigation/topbar_tools.php new file mode 100644 index 000000000..307f03fc6 --- /dev/null +++ b/views/default/navigation/topbar_tools.php @@ -0,0 +1,9 @@ +<?php +/** + * Empty view for backward compatibility. + * + * @package Elgg + * @subpackage Core + * + * @deprecated 1.8 Extend the topbar menus or the page/elements/topbar view directly + */ diff --git a/views/default/navigation/viewtype.php b/views/default/navigation/viewtype.php new file mode 100644 index 000000000..6dfa4ebc7 --- /dev/null +++ b/views/default/navigation/viewtype.php @@ -0,0 +1,11 @@ +<?php +/** + * Elgg list view switcher + * + * @package Elgg + * @subpackage Core + * + * @deprecated 1.8 See how file plugin adds a toggle in function file_register_toggle() + */ + +elgg_deprecated_notice('navigation/viewtype was deprecated', 1.8); diff --git a/views/default/object/admin_notice.php b/views/default/object/admin_notice.php new file mode 100644 index 000000000..11524567e --- /dev/null +++ b/views/default/object/admin_notice.php @@ -0,0 +1,20 @@ +<?php +/** + * A persistent admin notice to be displayed on all admin pages until cleared. + */ + +if (isset($vars['entity']) && elgg_instanceof($vars['entity'], 'object', 'admin_notice')) { + $notice = $vars['entity']; + $message = $notice->description; + + $delete = elgg_view('output/url', array( + 'href' => "action/admin/delete_admin_notice?guid=$notice->guid", + 'text' => '<span class="elgg-icon elgg-icon-delete"></span>', + 'is_action' => true, + 'class' => 'elgg-admin-notice', + 'is_trusted' => true, + )); + + echo "<p>$delete$message</p>"; +} + diff --git a/views/default/object/default.php b/views/default/object/default.php new file mode 100644 index 000000000..70e098742 --- /dev/null +++ b/views/default/object/default.php @@ -0,0 +1,48 @@ +<?php +/** + * ElggObject default view. + * + * @warning This view may be used for other ElggEntity objects + * + * @package Elgg + * @subpackage Core + */ + +$icon = elgg_view_entity_icon($vars['entity'], 'small'); + +$title = $vars['entity']->title; +if (!$title) { + $title = $vars['entity']->name; +} +if (!$title) { + $title = get_class($vars['entity']); +} + +if (elgg_instanceof($vars['entity'], 'object')) { + $metadata = elgg_view('navigation/menu/metadata', $vars); +} + +$owner_link = ''; +$owner = $vars['entity']->getOwnerEntity(); +if ($owner) { + $owner_link = elgg_view('output/url', array( + 'href' => $owner->getURL(), + 'text' => $owner->name, + 'is_trusted' => true, + )); +} + +$date = elgg_view_friendly_time($vars['entity']->time_created); + +$subtitle = "$owner_link $date"; + +$params = array( + 'entity' => $vars['entity'], + 'title' => $title, + 'metadata' => $metadata, + 'subtitle' => $subtitle, +); +$params = $params + $vars; +$body = elgg_view('object/elements/summary', $params); + +echo elgg_view_image_block($icon, $body, $vars); diff --git a/views/default/object/elements/full.php b/views/default/object/elements/full.php new file mode 100644 index 000000000..b4634fe7e --- /dev/null +++ b/views/default/object/elements/full.php @@ -0,0 +1,37 @@ +<?php +/** + * Object full rendering + * + * Sample output: + * <div class="elgg-content"> + * <div class="elgg-image-block"> + * </div> + * <div class="elgg-output"> + * </div> + * </div> + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['icon'] HTML for the content icon + * @uses $vars['summary'] HTML for the content summary + * @uses $vars['body'] HTML for the content body + * @uses $vars['class'] Optional additional class for the content wrapper + */ + +$icon = elgg_extract('icon', $vars); +$summary = elgg_extract('summary', $vars); +$body = elgg_extract('body', $vars); +$class = elgg_extract('class', $vars); +if ($class) { + $class = "elgg-content clearfix $class"; +} else { + $class = "elgg-content clearfix"; +} + +$header = elgg_view_image_block($icon, $summary); + +echo <<<HTML +<div class="$class"> +$header +$body +</div> +HTML; diff --git a/views/default/object/elements/summary.php b/views/default/object/elements/summary.php new file mode 100644 index 000000000..63ab8f816 --- /dev/null +++ b/views/default/object/elements/summary.php @@ -0,0 +1,59 @@ +<?php +/** + * Object summary + * + * Sample output + * <ul class="elgg-menu elgg-menu-entity"><li>Public</li><li>Like this</li></ul> + * <h3><a href="">Title</a></h3> + * <p class="elgg-subtext">Posted 3 hours ago by George</p> + * <p class="elgg-tags"><a href="">one</a>, <a href="">two</a></p> + * <div class="elgg-content">Excerpt text</div> + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['title'] Title link (optional) false = no title, '' = default + * @uses $vars['metadata'] HTML for entity menu and metadata (optional) + * @uses $vars['subtitle'] HTML for the subtitle (optional) + * @uses $vars['tags'] HTML for the tags (default is tags on entity, pass false for no tags) + * @uses $vars['content'] HTML for the entity content (optional) + */ + +$entity = $vars['entity']; + +$title_link = elgg_extract('title', $vars, ''); +if ($title_link === '') { + if (isset($entity->title)) { + $text = $entity->title; + } else { + $text = $entity->name; + } + $params = array( + 'text' => elgg_get_excerpt($text, 100), + 'href' => $entity->getURL(), + 'is_trusted' => true, + ); + $title_link = elgg_view('output/url', $params); +} + +$metadata = elgg_extract('metadata', $vars, ''); +$subtitle = elgg_extract('subtitle', $vars, ''); +$content = elgg_extract('content', $vars, ''); + +$tags = elgg_extract('tags', $vars, ''); +if ($tags === '') { + $tags = elgg_view('output/tags', array('tags' => $entity->tags)); +} + +if ($metadata) { + echo $metadata; +} +if ($title_link) { + echo "<h3>$title_link</h3>"; +} +echo "<div class=\"elgg-subtext\">$subtitle</div>"; +echo $tags; + +echo elgg_view('object/summary/extend', $vars); + +if ($content) { + echo "<div class=\"elgg-content\">$content</div>"; +} diff --git a/views/default/object/plugin.php b/views/default/object/plugin.php new file mode 100644 index 000000000..5c7138e96 --- /dev/null +++ b/views/default/object/plugin.php @@ -0,0 +1,20 @@ +<?php +/** + * Used to show plugin user settings. + * + * @package Elgg.Core + * @subpackage Plugins + * + */ + +if (!elgg_in_context('admin')) { + forward('/', 403); +} + +$plugin = $vars['entity']; + +if (!$plugin->isValid()) { + echo elgg_view('object/plugin/invalid', $vars); +} else { + echo elgg_view('object/plugin/full', $vars); +} diff --git a/views/default/object/plugin/elements/dependencies.php b/views/default/object/plugin/elements/dependencies.php new file mode 100644 index 000000000..d8daedd33 --- /dev/null +++ b/views/default/object/plugin/elements/dependencies.php @@ -0,0 +1,49 @@ +<?php +/** + * Shows a table of plugin dependecies for ElggPlugin in $vars['plugin']. + * + * This uses a table because it's a table of data. + * + * @package Elgg.Core + * @subpackage Admin.Plugins + */ + +$plugin = elgg_extract('plugin', $vars, false); +$deps = $plugin->getPackage()->checkDependencies(true); + +$columns = array('type', 'name', 'expected_value', 'local_value', 'comment'); + +echo '<table class="elgg-plugin-dependencies styled"><tr>'; + +foreach ($columns as $column) { + $column = elgg_echo("admin:plugins:dependencies:$column"); + echo "<th class=\"pas\">$column</th>"; +} + +echo '</tr>'; + +$row = 'odd'; +foreach ($deps as $dep) { + $fields = elgg_get_plugin_dependency_strings($dep); + $type = $dep['type']; + + if ($dep['status']) { + $class = "elgg-state-success elgg-dependency elgg-dependency-$type"; + } elseif ($dep['type'] == 'suggests') { + $class = "elgg-state-warning elgg-dependency elgg-dependency-$type"; + } else { + $class = "elgg-state-error elgg-dependency elgg-dependency-$type"; + } + + echo "<tr class=\"$row\">"; + + foreach ($columns as $column) { + echo "<td class=\"pas $class\">{$fields[$column]}</td>"; + } + + echo '</tr>'; + + $row = ($row == 'odd') ? 'even' : 'odd'; +} + +echo '</table>';
\ No newline at end of file diff --git a/views/default/object/plugin/full.php b/views/default/object/plugin/full.php new file mode 100644 index 000000000..2de65b555 --- /dev/null +++ b/views/default/object/plugin/full.php @@ -0,0 +1,308 @@ +<?php +/** + * Displays a plugin on the admin screen. + * + * This file renders a plugin for the admin screen, including active/deactive, + * manifest details & display plugin settings. + * + * @uses $vars['entity'] + * @uses $vars['display_reordering'] Do we display the priority reordering links? + * + * @package Elgg.Core + * @subpackage Plugins + */ + +$plugin = $vars['entity']; +$reordering = elgg_extract('display_reordering', $vars, false); +$priority = $plugin->getPriority(); +$active = $plugin->isActive(); + +$can_activate = $plugin->canActivate(); +$max_priority = elgg_get_max_plugin_priority(); +$actions_base = '/action/admin/plugins/'; +$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID()); + +// build reordering links +$links = ''; +$classes = array('elgg-plugin'); + +if ($reordering) { + $classes[] = 'elgg-state-draggable'; + + // top and up link only if not at top + if ($priority > 1) { + $top_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => 'first', + 'is_action' => true + )); + + $links .= "<li>" . elgg_view('output/url', array( + 'href' => $top_url, + 'text' => elgg_echo('top'), + 'is_action' => true, + 'is_trusted' => true, + )) . "</li>"; + + $up_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => '-1', + 'is_action' => true + )); + + $links .= "<li>" . elgg_view('output/url', array( + 'href' => $up_url, + 'text' => elgg_echo('up'), + 'is_action' => true, + 'is_trusted' => true, + )) . "</li>"; + } + + // down and bottom links only if not at bottom + if ($priority < $max_priority) { + $down_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => '+1', + 'is_action' => true + )); + + $links .= "<li>" . elgg_view('output/url', array( + 'href' => $down_url, + 'text' => elgg_echo('down'), + 'is_action' => true, + 'is_trusted' => true, + )) . "</li>"; + + $bottom_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array( + 'plugin_guid' => $plugin->guid, + 'priority' => 'last', + 'is_action' => true + )); + + $links .= "<li>" . elgg_view('output/url', array( + 'href' => $bottom_url, + 'text' => elgg_echo('bottom'), + 'is_action' => true, + 'is_trusted' => true, + )) . "</li>"; + } +} else { + $classes[] = 'elgg-state-undraggable'; +} + + +// activate / deactivate links + +// always let them deactivate +$options = array( + 'is_action' => true, + 'is_trusted' => true, +); +if ($active) { + $classes[] = 'elgg-state-active'; + $action = 'deactivate'; + $options['text'] = elgg_echo('admin:plugins:deactivate'); + $options['class'] = "elgg-button elgg-button-cancel"; + + if (!$can_activate) { + $classes[] = 'elgg-state-active'; + $options['class'] = 'elgg-button elgg-state-warning'; + } +} else if ($can_activate) { + $classes[] = 'elgg-state-inactive'; + $action = 'activate'; + $options['text'] = elgg_echo('admin:plugins:activate'); + $options['class'] = "elgg-button elgg-button-submit"; +} else { + $classes[] = 'elgg-state-inactive'; + $action = ''; + $options['text'] = elgg_echo('admin:plugins:cannot_activate'); + $options['class'] = "elgg-button elgg-button-disabled"; + $options['disabled'] = 'disabled'; +} + +if ($action) { + $url = elgg_http_add_url_query_elements($actions_base . $action, array( + 'plugin_guids[]' => $plugin->guid + )); + + $options['href'] = $url; +} +$action_button = elgg_view('output/url', $options); + +// Display categories and make category classes +$categories = $plugin->getManifest()->getCategories(); +$categories_html = ''; +if ($categories) { + $base_url = elgg_get_site_url() . "admin/plugins?category="; + + foreach ($categories as $category) { + $css_class = preg_replace('/[^a-z0-9-]/i', '-', $category); + $classes[] = "elgg-plugin-category-$css_class"; + + $url = $base_url . urlencode($category); + $friendly_category = htmlspecialchars(ElggPluginManifest::getFriendlyCategory($category)); + $categories_html .= "<li class=\"elgg-plugin-category prm\"><a href=\"$url\">$friendly_category</a></li>"; + } +} + +$screenshots_html = ''; +$screenshots = $plugin->getManifest()->getScreenshots(); +if ($screenshots) { + $base_url = elgg_get_plugins_path() . $plugin->getID() . '/'; + foreach ($screenshots as $screenshot) { + $desc = elgg_echo($screenshot['description']); + $alt = htmlentities($desc, ENT_QUOTES, 'UTF-8'); + $screenshot_full = "{$vars['url']}admin_plugin_screenshot/{$plugin->getID()}/full/{$screenshot['path']}"; + $screenshot_src = "{$vars['url']}admin_plugin_screenshot/{$plugin->getID()}/thumbnail/{$screenshot['path']}"; + + $screenshots_html .= "<li class=\"elgg-plugin-screenshot prm ptm\"><a class=\"elgg-lightbox\" href=\"$screenshot_full\">" + . "<img src=\"$screenshot_src\" alt=\"$alt\"></a></li>"; + } +} + +// metadata +$description = elgg_view('output/longtext', array('value' => $plugin->getManifest()->getDescription())); +$author = '<span>' . elgg_echo('admin:plugins:label:author') . '</span>: ' + . elgg_view('output/text', array('value' => $plugin->getManifest()->getAuthor())); +$version = htmlspecialchars($plugin->getManifest()->getVersion()); +$website = elgg_view('output/url', array( + 'href' => $plugin->getManifest()->getWebsite(), + 'text' => $plugin->getManifest()->getWebsite(), + 'is_trusted' => true, +)); + +$resources = array( + 'repository' => $plugin->getManifest()->getRepositoryURL(), + 'bugtracker' => $plugin->getManifest()->getBugTrackerURL(), + 'donate' => $plugin->getManifest()->getDonationsPageURL(), +); + +$resources_html = "<ul class=\"elgg-plugin-resources\">"; +foreach ($resources as $id => $href) { + if ($href) { + $resources_html .= "<li class=\"prm\">"; + $resources_html .= elgg_view('output/url', array( + 'href' => $href, + 'text' => elgg_echo("admin:plugins:label:$id"), + 'is_trusted' => true, + )); + $resources_html .= "</li>"; + } +} +$resources_html .= "</ul>"; + +$copyright = elgg_view('output/text', array('value' => $plugin->getManifest()->getCopyright())); +$license = elgg_view('output/text', array('value' => $plugin->getManifest()->getLicense())); + +// show links to text files +$files = $plugin->getAvailableTextFiles(); + +$docs = ''; +if ($files) { + $docs = '<ul>'; + foreach ($files as $file => $path) { + $url = 'admin_plugin_text_file/' . $plugin->getID() . "/$file"; + $link = elgg_view('output/url', array( + 'text' => $file, + 'href' => $url, + 'is_trusted' => true, + )); + $docs .= "<li>$link</li>"; + + } + $docs .= '</ul>'; +} + +?> + +<div class="<?php echo implode(' ', $classes); ?>" id="<?php echo $css_id; ?>"> + <div class="elgg-image-block"> + <div class="elgg-image-alt"> + <?php if ($links) : ?> + <ul class="elgg-menu elgg-menu-metadata"> + <?php echo $links; ?> + </ul> + <?php endif; ?> + <div class="clearfloat float-alt mtm"> + <?php echo $action_button; ?> + </div> + </div> + <div class="elgg-body"> +<?php +$settings_view_old = 'settings/' . $plugin->getID() . '/edit'; +$settings_view_new = 'plugins/' . $plugin->getID() . '/settings'; +if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)) { + $link = elgg_get_site_url() . "admin/plugin_settings/" . $plugin->getID(); + $settings_link = "<a class='elgg-plugin-settings' href='$link'>[" . elgg_echo('settings') . "]</a>"; +} +?> + <div class="elgg-head"> + <h3><?php echo $plugin->getManifest()->getName() . " $version $settings_link"; ?></h3> + </div> + <?php + if ($plugin->getManifest()->getApiVersion() < 1.8) { + $reqs = $plugin->getManifest()->getRequires(); + if (!$reqs) { + $message = elgg_echo('admin:plugins:warning:elgg_version_unknown'); + echo "<p class=\"elgg-state-error\">$message</p>"; + } + } + + if (!$can_activate) { + if ($active) { + $message = elgg_echo('admin:plugins:warning:unmet_dependencies_active'); + echo "<p class=\"elgg-state-warning\">$message</p>"; + } else { + $message = elgg_echo('admin:plugins:warning:unmet_dependencies'); + echo "<p class=\"elgg-state-error\">$message</p>"; + } + } + ?> + + <div><?php echo $description; ?></div> + <p><?php echo $author . ' - ' . $website; ?></p> + + <?php + echo $resources_html; + echo $docs; + ?> + + <div class="pts"> + <?php + echo elgg_view('output/url', array( + 'href' => "#elgg-plugin-manifest-$css_id", + 'text' => elgg_echo("admin:plugins:label:moreinfo"), + 'rel' => 'toggle', + )); + ?> + </div> + </div> + </div> + <div class="elgg-plugin-more hidden" id="elgg-plugin-manifest-<?php echo $css_id; ?>"> + + <?php + if ($screenshots_html) { + ?> + <div><ul><?php echo $screenshots_html; ?></ul></div> + <?php + } + + if ($categories_html) { + ?> + <div><?php echo elgg_echo('admin:plugins:label:categories') . ": <ul class=\"elgg-plugin-categories\">$categories_html</ul>"; ?></div> + <?php + } + + ?> + <div><?php echo elgg_echo('admin:plugins:label:copyright') . ": " . $copyright; ?></div> + <div><?php echo elgg_echo('admin:plugins:label:licence') . ": " . $license; ?></div> + <div><?php echo elgg_echo('admin:plugins:label:location') . ": " . htmlspecialchars($plugin->getPath()) ?></div> + + <div><?php echo elgg_echo('admin:plugins:label:dependencies'); ?>: + <?php + echo elgg_view('object/plugin/elements/dependencies', array('plugin' => $plugin)); + ?> + </div> + </div> +</div> diff --git a/views/default/object/plugin/invalid.php b/views/default/object/plugin/invalid.php new file mode 100644 index 000000000..828bceaba --- /dev/null +++ b/views/default/object/plugin/invalid.php @@ -0,0 +1,42 @@ +<?php +/** + * Displays an invalid plugin on the admin screen. + * + * An invalid plugin is a plugin whose isValid() method returns false. + * This usually means there are required files missing, unreadable or in the + * wrong format. + * + * @package Elgg.Core + * @subpackage Plugins + */ + +$plugin = $vars['entity']; + +$id = $plugin->getID(); +$path = htmlspecialchars($plugin->getPath()); +$message = elgg_echo('admin:plugins:warning:invalid', array($plugin->getError())); +$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID()); + +?> + +<div class="elgg-state-draggable elgg-plugin elgg-state-inactive elgg-state-error" id="elgg-plugin-<?php echo $plugin->guid; ?>"> + <div class="elgg-head"><h3><?php echo $id; ?></h3></div> + <div class="elgg-body"> + <p class="elgg-state-error"><?php echo $message; ?></p> + <p><?php echo elgg_echo('admin:plugins:warning:invalid:check_docs'); ?></p> + + <div class="pts"> + <?php + echo elgg_view('output/url', array( + 'href' => "#elgg-plugin-manifest-$css_id", + 'text' => elgg_echo("admin:plugins:label:moreinfo"), + 'rel' => 'toggle', + )); + ?> + </div> + + <div class="hidden elgg-plugin-more" id="elgg-plugin-manifest-<?php echo $css_id; ?>"> + <p><?php echo elgg_echo('admin:plugins:label:location') . ": " . $path; ?></p> + </div> + </div> +</div>
\ No newline at end of file diff --git a/views/default/object/widget.php b/views/default/object/widget.php new file mode 100644 index 000000000..0c7994f2b --- /dev/null +++ b/views/default/object/widget.php @@ -0,0 +1,75 @@ +<?php +/** + * Widget object + * + * @uses $vars['entity'] ElggWidget + * @uses $vars['show_access'] Show the access control in edit area? (true) + */ + +$widget = $vars['entity']; +if (!elgg_instanceof($widget, 'object', 'widget')) { + return true; +} + +$show_access = elgg_extract('show_access', $vars, true); + +// @todo catch for disabled plugins +$widget_types = elgg_get_widget_types('all'); + +$handler = $widget->handler; + +$title = $widget->getTitle(); + +$edit_area = ''; +$can_edit = $widget->canEdit(); +if ($can_edit) { + $edit_area = elgg_view('object/widget/elements/settings', array( + 'widget' => $widget, + 'show_access' => $show_access, + )); +} +$controls = elgg_view('object/widget/elements/controls', array( + 'widget' => $widget, + 'show_edit' => $edit_area != '', +)); + +// don't show content for default widgets +if (elgg_in_context('default_widgets')) { + $content = ''; +} else { + if (elgg_view_exists("widgets/$handler/content")) { + $content = elgg_view("widgets/$handler/content", $vars); + } else { + elgg_deprecated_notice("widgets use content as the display view", 1.8); + $content = elgg_view("widgets/$handler/view", $vars); + } +} + +$widget_id = "elgg-widget-$widget->guid"; +$widget_instance = "elgg-widget-instance-$handler"; +$widget_class = "elgg-module elgg-module-widget"; +if ($can_edit) { + $widget_class .= " elgg-state-draggable $widget_instance"; +} else { + $widget_class .= " elgg-state-fixed $widget_instance"; +} + +$widget_header = <<<HEADER + <div class="elgg-widget-handle clearfix"><h3>$title</h3> + $controls + </div> +HEADER; + +$widget_body = <<<BODY + $edit_area + <div class="elgg-widget-content" id="elgg-widget-content-$widget->guid"> + $content + </div> +BODY; + +echo elgg_view('page/components/module', array( + 'class' => $widget_class, + 'id' => $widget_id, + 'body' => $widget_body, + 'header' => $widget_header, +)); diff --git a/views/default/object/widget/elements/controls.php b/views/default/object/widget/elements/controls.php new file mode 100644 index 000000000..57a935f62 --- /dev/null +++ b/views/default/object/widget/elements/controls.php @@ -0,0 +1,14 @@ +<?php +/** + * Elgg widget controls + * + * @uses $vars['widget'] + * @uses $vars['show_edit'] Whether to show the edit button (true) + */ + +echo elgg_view_menu('widget', array( + 'entity' => elgg_extract('widget', $vars), + 'show_edit' => elgg_extract('show_edit', $vars, true), + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); diff --git a/views/default/object/widget/elements/settings.php b/views/default/object/widget/elements/settings.php new file mode 100644 index 000000000..25cda58c9 --- /dev/null +++ b/views/default/object/widget/elements/settings.php @@ -0,0 +1,25 @@ +<?php +/** + * Elgg widget edit settings + * + * @uses $vars['widget'] + */ + +$widget = elgg_extract('widget', $vars); + +// not using elgg_view_form() so that we can detect if the form is empty +$form_body = elgg_view('forms/widgets/save', $vars); +if (!$form_body) { + return true; +} + +$form = elgg_view('input/form', array( + 'action' => 'action/widgets/save', + 'body' => $form_body, + 'class' => 'elgg-form-widgets-save', +)); +?> + +<div class="elgg-widget-edit" id="widget-edit-<?php echo $widget->guid; ?>"> + <?php echo $form; ?> +</div> diff --git a/views/default/output/access.php b/views/default/output/access.php new file mode 100644 index 000000000..5c8d62c4d --- /dev/null +++ b/views/default/output/access.php @@ -0,0 +1,42 @@ +<?php +/** + * Displays HTML for entity access levels. + * Requires an entity because some special logic for containers is used. + * + * @uses int $vars['entity'] - The entity whose access ID to display. + */ + +//sort out the access level for display +if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) { + $access_id = $vars['entity']->access_id; + $access_class = 'elgg-access'; + $access_id_string = get_readable_access_level($access_id); + $access_id_string = htmlspecialchars($access_id_string, ENT_QUOTES, 'UTF-8', false); + + // if within a group or shared access collection display group name and open/closed membership status + // @todo have a better way to do this instead of checking against subtype / class. + $container = $vars['entity']->getContainerEntity(); + + if ($container && $container instanceof ElggGroup) { + // we decided to show that the item is in a group, rather than its actual access level + // not required. Group ACLs are prepended with "Group: " when written. + //$access_id_string = elgg_echo('groups:group') . $container->name; + $membership = $container->membership; + + if ($membership == ACCESS_PUBLIC) { + $access_class .= ' elgg-access-group-open'; + } else { + $access_class .= ' elgg-access-group-closed'; + } + + // @todo this is plugin specific code in core. Should be removed. + } elseif ($container && $container->getSubtype() == 'shared_access') { + $access_class .= ' shared_collection'; + } elseif ($access_id == ACCESS_PRIVATE) { + $access_class .= ' elgg-access-private'; + } + + $help_text = elgg_echo('access:help'); + + echo "<span title=\"$help_text\" class=\"$access_class\">$access_id_string</span>"; +} diff --git a/views/default/output/calendar.php b/views/default/output/calendar.php new file mode 100644 index 000000000..fa0bd0c04 --- /dev/null +++ b/views/default/output/calendar.php @@ -0,0 +1,13 @@ +<?php +/** + * Elgg calendar output + * Displays a calendar output field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The current value, if any + * + */ +elgg_deprecated_notice('output/calendar was deprecated in favor of output/date', 1.8); +echo elgg_view('output/date', $vars);
\ No newline at end of file diff --git a/views/default/output/checkboxes.php b/views/default/output/checkboxes.php new file mode 100644 index 000000000..56d2588ac --- /dev/null +++ b/views/default/output/checkboxes.php @@ -0,0 +1,13 @@ +<?php +/** + * Elgg text output + * Displays some text that was input using a standard text field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['text'] The text to display + * + */ + +echo elgg_view('output/tags',$vars);
\ No newline at end of file diff --git a/views/default/output/confirmlink.php b/views/default/output/confirmlink.php new file mode 100644 index 000000000..532790a38 --- /dev/null +++ b/views/default/output/confirmlink.php @@ -0,0 +1,47 @@ +<?php +/** + * Elgg confirmation link + * A link that displays a confirmation dialog before it executes + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['text'] The text of the link + * @uses $vars['href'] The address + * @uses $vars['title'] The title text (defaults to confirm text) + * @uses $vars['confirm'] The dialog text + * @uses $vars['encode_text'] Run $vars['text'] through htmlspecialchars() (false) + */ + +$vars['rel'] = elgg_extract('confirm', $vars, elgg_echo('question:areyousure')); +$vars['rel'] = addslashes($vars['rel']); +$encode = elgg_extract('encode_text', $vars, false); + +// always generate missing action tokens +$vars['href'] = elgg_add_action_tokens_to_url(elgg_normalize_url($vars['href']), true); + +$text = elgg_extract('text', $vars, ''); +if ($encode) { + $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8', false); +} + +if (!isset($vars['title']) && isset($vars['confirm'])) { + $vars['title'] = $vars['rel']; +} + +if (isset($vars['class'])) { + if (!is_array($vars['class'])) { + $vars['class'] = array($vars['class']); + } + $vars['class'][] = 'elgg-requires-confirmation'; +} else { + $vars['class'] = 'elgg-requires-confirmation'; +} + +unset($vars['encode_text']); +unset($vars['text']); +unset($vars['confirm']); +unset($vars['is_trusted']); + +$attributes = elgg_format_attributes($vars); +echo "<a $attributes>$text</a>"; diff --git a/views/default/output/date.php b/views/default/output/date.php new file mode 100644 index 000000000..1644a3480 --- /dev/null +++ b/views/default/output/date.php @@ -0,0 +1,17 @@ +<?php +/** + * Date + * Displays a properly formatted date + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] Date as text or a Unix timestamp in seconds + */ + +// convert timestamps to text for display +if (is_numeric($vars['value'])) { + $vars['value'] = gmdate('Y-m-d', $vars['value']); +} + +echo $vars['value']; diff --git a/views/default/output/dropdown.php b/views/default/output/dropdown.php new file mode 100644 index 000000000..8d68508ca --- /dev/null +++ b/views/default/output/dropdown.php @@ -0,0 +1,13 @@ +<?php +/** + * Elgg dropdown display + * Displays a value that was entered into the system via a dropdown + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['text'] The text to display + * + */ + +echo htmlspecialchars($vars['value'], ENT_QUOTES, 'UTF-8', false); diff --git a/views/default/output/email.php b/views/default/output/email.php new file mode 100644 index 000000000..f5a8bc4b8 --- /dev/null +++ b/views/default/output/email.php @@ -0,0 +1,17 @@ +<?php +/** + * Elgg email output + * Displays an email address that was entered using an email input field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The email address to display + * + */ + +$encoded_value = htmlspecialchars($vars['value'], ENT_QUOTES, 'UTF-8'); + +if (!empty($vars['value'])) { + echo "<a href=\"mailto:$encoded_value\">$encoded_value</a>"; +}
\ No newline at end of file diff --git a/views/default/output/friendlytime.php b/views/default/output/friendlytime.php new file mode 100644 index 000000000..22f60d517 --- /dev/null +++ b/views/default/output/friendlytime.php @@ -0,0 +1,12 @@ +<?php +/** + * Friendly time + * Translates an epoch time into a human-readable time. + * + * @uses string $vars['time'] Unix-style epoch timestamp + */ + +$friendly_time = elgg_get_friendly_time($vars['time']); +$timestamp = htmlspecialchars(date(elgg_echo('friendlytime:date_format'), $vars['time'])); + +echo "<acronym title=\"$timestamp\">$friendly_time</acronym>"; diff --git a/views/default/output/friendlytitle.php b/views/default/output/friendlytitle.php new file mode 100644 index 000000000..fbc4f39de --- /dev/null +++ b/views/default/output/friendlytitle.php @@ -0,0 +1,19 @@ +<?php +/** + * Friendly title + * Makes a URL-friendly title. + * + * @uses string $vars['title'] Title to create from. + */ + + +$title = $vars['title']; + +//$title = iconv('UTF-8', 'ASCII//TRANSLIT', $title); +$title = preg_replace("/[^\w ]/","",$title); +$title = str_replace(" ","-",$title); +$title = str_replace("--","-",$title); +$title = trim($title); +$title = strtolower($title); + +echo $title; diff --git a/views/default/output/iframe.php b/views/default/output/iframe.php new file mode 100644 index 000000000..7df9332f1 --- /dev/null +++ b/views/default/output/iframe.php @@ -0,0 +1,13 @@ +<?php +/** + * Display a page in an embedded window + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] Source of the page + * + */ +?> +<iframe src="<?php echo $vars['value']; ?>"> +</iframe>
\ No newline at end of file diff --git a/views/default/output/img.php b/views/default/output/img.php new file mode 100644 index 000000000..d3f596801 --- /dev/null +++ b/views/default/output/img.php @@ -0,0 +1,12 @@ +<?php +/** + * Elgg image view + * + * @uses string $vars['src'] The image src url. + */ + +$vars['src'] = elgg_normalize_url($vars['src']); +$vars['src'] = elgg_format_url($vars['src']); + +$attributes = elgg_format_attributes($vars); +echo "<img $attributes/>"; diff --git a/views/default/output/location.php b/views/default/output/location.php new file mode 100644 index 000000000..e1009f17d --- /dev/null +++ b/views/default/output/location.php @@ -0,0 +1,19 @@ +<?php +/** + * Display a location + * + * @uses $vars['entity'] The ElggEntity that has a location + * @uses $vars['value'] The location string if the entity is not passed + */ + +if (isset($vars['entity'])) { + $vars['value'] = $vars['entity']->location; + unset($vars['entity']); +} + +// Fixes #4566 we used to allow arrays of strings for location +if (is_array($vars['value'])) { + $vars['value'] = implode(', ', $vars['value']); +} + +echo elgg_view('output/tag', $vars); diff --git a/views/default/output/longtext.php b/views/default/output/longtext.php new file mode 100644 index 000000000..589100c4f --- /dev/null +++ b/views/default/output/longtext.php @@ -0,0 +1,38 @@ +<?php +/** + * Elgg display long text + * Displays a large amount of text, with new lines converted to line breaks + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The text to display + * @uses $vars['parse_urls'] Whether to turn urls into links. Default is true. + * @uses $vars['class'] + */ + +$class = 'elgg-output'; +$additional_class = elgg_extract('class', $vars, ''); +if ($additional_class) { + $vars['class'] = "$class $additional_class"; +} else { + $vars['class'] = $class; +} + +$parse_urls = elgg_extract('parse_urls', $vars, true); +unset($vars['parse_urls']); + +$text = $vars['value']; +unset($vars['value']); + +if ($parse_urls) { + $text = parse_urls($text); +} + +$text = filter_tags($text); + +$text = elgg_autop($text); + +$attributes = elgg_format_attributes($vars); + +echo "<div $attributes>$text</div>"; diff --git a/views/default/output/pulldown.php b/views/default/output/pulldown.php new file mode 100644 index 000000000..7097a9a8d --- /dev/null +++ b/views/default/output/pulldown.php @@ -0,0 +1,14 @@ +<?php +/** + * Elgg pulldown display + * Displays a value that was entered into the system via a pulldown + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['text'] The text to display + * + * @deprecated 1.8 Use output/dropdown + */ + +echo elgg_view('output/dropdown', $vars);
\ No newline at end of file diff --git a/views/default/output/radio.php b/views/default/output/radio.php new file mode 100644 index 000000000..0fae9977b --- /dev/null +++ b/views/default/output/radio.php @@ -0,0 +1,13 @@ +<?php +/** + * Elgg text output + * Displays some text that was input using a standard text field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['text'] The text to display + * + */ + +echo elgg_view('output/text', $vars);
\ No newline at end of file diff --git a/views/default/output/tag.php b/views/default/output/tag.php new file mode 100644 index 000000000..6bd9a72a7 --- /dev/null +++ b/views/default/output/tag.php @@ -0,0 +1,35 @@ +<?php +/** + * Elgg single tag output + * + * @uses $vars['value'] String + * @uses $vars['type'] The entity type, optional + * @uses $vars['subtype'] The entity subtype, optional + * + */ + +if (!empty($vars['type'])) { + $type = "&type=" . rawurlencode($vars['type']); +} else { + $type = ""; +} +if (!empty($vars['subtype'])) { + $subtype = "&subtype=" . rawurlencode($vars['subtype']); +} else { + $subtype = ""; +} +if (!empty($vars['object'])) { + $object = "&object=" . rawurlencode($vars['object']); +} else { + $object = ""; +} + +if (isset($vars['value'])) { + $url = elgg_get_site_url() . 'search?q=' . rawurlencode($vars['value']) . "&search_type=tags{$type}{$subtype}{$object}"; + $vars['value'] = htmlspecialchars($vars['value'], ENT_QUOTES, 'UTF-8', false); + echo elgg_view('output/url', array( + 'href' => $url, + 'text' => $vars['value'], + 'rel' => 'tag', + )); +} diff --git a/views/default/output/tagcloud.php b/views/default/output/tagcloud.php new file mode 100644 index 000000000..2fbf1cd0a --- /dev/null +++ b/views/default/output/tagcloud.php @@ -0,0 +1,66 @@ +<?php +/** + * Elgg tagcloud + * Displays a tagcloud + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['tagcloud'] An array of stdClass objects with two elements: 'tag' (the text of the tag) and 'total' (the number of elements with this tag) + * @uses $vars['value'] Sames as tagcloud + * @uses $vars['type'] Entity type + * @uses $vars['subtype'] Entity subtype + */ + +if (!empty($vars['subtype'])) { + $subtype = "&entity_subtype=" . urlencode($vars['subtype']); +} else { + $subtype = ""; +} +if (!empty($vars['type'])) { + $type = "&entity_type=" . urlencode($vars['type']); +} else { + $type = ""; +} + +if (empty($vars['tagcloud']) && !empty($vars['value'])) { + $vars['tagcloud'] = $vars['value']; +} + +if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) { + $counter = 0; + $max = 0; + + foreach ($vars['tagcloud'] as $tag) { + if ($tag->total > $max) { + $max = $tag->total; + } + } + + $cloud = ''; + foreach ($vars['tagcloud'] as $tag) { + $tag->tag = htmlspecialchars($tag->tag, ENT_QUOTES, 'UTF-8', false); + + if ($cloud != '') { + $cloud .= ', '; + } + // protecting against division by zero warnings + $size = round((log($tag->total) / log($max + .0001)) * 100) + 30; + if ($size < 100) { + $size = 100; + } + $url = "search?q=". urlencode($tag->tag) . "&search_type=tags$type$subtype"; + + $cloud .= elgg_view('output/url', array( + 'text' => $tag->tag, + 'href' => $url, + 'style' => "font-size: $size%;", + 'title' => "$tag->tag ($tag->total)", + 'rel' => 'tag' + )); + } + + $cloud .= elgg_view('tagcloud/extend'); + + echo "<div class=\"elgg-tagcloud\">$cloud</div>"; +} diff --git a/views/default/output/tags.php b/views/default/output/tags.php new file mode 100644 index 000000000..db096a3be --- /dev/null +++ b/views/default/output/tags.php @@ -0,0 +1,82 @@ +<?php +/** + * Elgg tags + * Tags can be a single string (for one tag) or an array of strings + * + * @uses $vars['value'] Array of tags or a string + * @uses $vars['type'] The entity type, optional + * @uses $vars['subtype'] The entity subtype, optional + * @uses $vars['entity'] Optional. Entity whose tags are being displayed (metadata ->tags) + * @uses $vars['list_class'] Optional. Additional classes to be passed to <ul> element + * @uses $vars['item_class'] Optional. Additional classes to be passed to <li> elements + * @uses $vars['icon_class'] Optional. Additional classes to be passed to tags icon image + */ + +if (isset($vars['entity'])) { + $vars['tags'] = $vars['entity']->tags; + unset($vars['entity']); +} + +if (!empty($vars['type'])) { + $type = "&type=" . rawurlencode($vars['type']); +} else { + $type = ""; +} +if (!empty($vars['subtype'])) { + $subtype = "&subtype=" . rawurlencode($vars['subtype']); +} else { + $subtype = ""; +} +if (!empty($vars['object'])) { + $object = "&object=" . rawurlencode($vars['object']); +} else { + $object = ""; +} + +if (empty($vars['tags']) && !empty($vars['value'])) { + $vars['tags'] = $vars['value']; +} + +if (empty($vars['tags']) && isset($vars['entity'])) { + $vars['tags'] = $vars['entity']->tags; +} + +if (!empty($vars['tags'])) { + if (!is_array($vars['tags'])) { + $vars['tags'] = array($vars['tags']); + } + + $list_class = "elgg-tags"; + if (isset($vars['list_class'])) { + $list_class = "$list_class {$vars['list_class']}"; + } + + $item_class = "elgg-tag"; + if (isset($vars['item_class'])) { + $item_class = "$item_class {$vars['item_class']}"; + } + + $icon_class = elgg_extract('icon_class', $vars); + $list_items = '<li>' . elgg_view_icon('tag', $icon_class) . '</li>'; + + foreach($vars['tags'] as $tag) { + $url = elgg_get_site_url() . 'search?q=' . rawurlencode($tag) . "&search_type=tags{$type}{$subtype}{$object}"; + if (is_string($tag)) { + $tag = htmlspecialchars($tag, ENT_QUOTES, 'UTF-8', false); + $list_items .= "<li class=\"$item_class\">"; + $list_items .= elgg_view('output/url', array('href' => $url, 'text' => $tag, 'rel' => 'tag')); + $list_items .= '</li>'; + } + } + + $list = <<<___HTML + <div class="clearfix"> + <ul class="$list_class"> + $list_items + </ul> + </div> +___HTML; + + echo $list; +} + diff --git a/views/default/output/text.php b/views/default/output/text.php new file mode 100644 index 000000000..5cbfc35b0 --- /dev/null +++ b/views/default/output/text.php @@ -0,0 +1,12 @@ +<?php +/** + * Elgg text output + * Displays some text that was input using a standard text field + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['value'] The text to display + */ + +echo htmlspecialchars($vars['value'], ENT_QUOTES, 'UTF-8', false);
\ No newline at end of file diff --git a/views/default/output/url.php b/views/default/output/url.php new file mode 100644 index 000000000..81b02087d --- /dev/null +++ b/views/default/output/url.php @@ -0,0 +1,56 @@ +<?php +/** + * Elgg URL display + * Displays a URL as a link + * + * @package Elgg + * @subpackage Core + * + * @uses string $vars['text'] The string between the <a></a> tags. + * @uses string $vars['href'] The unencoded url string + * @uses bool $vars['encode_text'] Run $vars['text'] through htmlspecialchars() (false) + * @uses bool $vars['is_action'] Is this a link to an action (false) + * @uses bool $vars['is_trusted'] Is this link trusted (false) + */ + +$url = elgg_extract('href', $vars, null); +if (!$url and isset($vars['value'])) { + $url = trim($vars['value']); + unset($vars['value']); +} + +if (isset($vars['text'])) { + if (elgg_extract('encode_text', $vars, false)) { + $text = htmlspecialchars($vars['text'], ENT_QUOTES, 'UTF-8', false); + } else { + $text = $vars['text']; + } + unset($vars['text']); +} else { + $text = htmlspecialchars($url, ENT_QUOTES, 'UTF-8', false); +} + +unset($vars['encode_text']); + +if ($url) { + $url = elgg_normalize_url($url); + + if (elgg_extract('is_action', $vars, false)) { + $url = elgg_add_action_tokens_to_url($url, false); + } + + if (!elgg_extract('is_trusted', $vars, false)) { + if (!isset($vars['rel'])) { + $vars['rel'] = 'nofollow'; + $url = strip_tags($url); + } + } + + $vars['href'] = $url; +} + +unset($vars['is_action']); +unset($vars['is_trusted']); + +$attributes = elgg_format_attributes($vars); +echo "<a $attributes>$text</a>"; diff --git a/views/default/page/admin.php b/views/default/page/admin.php new file mode 100644 index 000000000..7045edd91 --- /dev/null +++ b/views/default/page/admin.php @@ -0,0 +1,66 @@ +<?php +/** + * Elgg pageshell for the admin area + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['title'] The page title + * @uses $vars['body'] The main content of the page + * @uses $vars['sysmessages'] A 2d array of various message registers, passed from system_messages() + */ + +$notices_html = ''; +$notices = elgg_get_admin_notices(); +if ($notices) { + foreach ($notices as $notice) { + $notices_html .= elgg_view_entity($notice); + } + + $notices_html = "<div class=\"elgg-admin-notices\">$notices_html</div>"; +} + +// render content before head so that JavaScript and CSS can be loaded. See #4032 +$messages = elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); +$header = elgg_view('admin/header', $vars); +$body = $vars['body']; +$footer = elgg_view('admin/footer', $vars); + + +// Set the content type +header("Content-type: text/html; charset=UTF-8"); + +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<?php echo elgg_view('page/elements/head', $vars); ?> +</head> +<body> + <div class="elgg-page elgg-page-admin"> + <div class="elgg-inner"> + <div class="elgg-page-header"> + <div class="elgg-inner clearfix"> + <?php echo $header; ?> + </div> + </div> + <div class="elgg-page-messages"> + <?php echo $messages; ?> + <?php echo $notices_html; ?> + </div> + <div class="elgg-page-body"> + <div class="elgg-inner"> + <?php echo $body; ?> + </div> + </div> + <div class="elgg-page-footer"> + <div class="elgg-inner"> + <?php echo $footer; ?> + </div> + </div> + </div> + </div> + <?php echo elgg_view('page/elements/foot'); ?> +</body> + +</html>
\ No newline at end of file diff --git a/views/default/page/components/gallery.php b/views/default/page/components/gallery.php new file mode 100644 index 000000000..e8b3f477e --- /dev/null +++ b/views/default/page/components/gallery.php @@ -0,0 +1,77 @@ +<?php +/** + * Gallery view + * + * Implemented as an unorder list + * + * @uses $vars['items'] Array of ElggEntity or ElggAnnotation objects + * @uses $vars['offset'] Index of the first list item in complete list + * @uses $vars['limit'] Number of items per page + * @uses $vars['count'] Number of items in the complete list + * @uses $vars['pagination'] Show pagination? (default: true) + * @uses $vars['position'] Position of the pagination: before, after, or both + * @uses $vars['full_view'] Show the full view of the items (default: false) + * @uses $vars['gallery_class'] Additional CSS class for the <ul> element + * @uses $vars['item_class'] Additional CSS class for the <li> elements + */ + +$items = $vars['items']; +if (!is_array($items) || sizeof($items) == 0) { + return true; +} + +elgg_push_context('gallery'); + +$offset = $vars['offset']; +$limit = $vars['limit']; +$count = $vars['count']; +$pagination = elgg_extract('pagination', $vars, true); +$offset_key = elgg_extract('offset_key', $vars, 'offset'); +$position = elgg_extract('position', $vars, 'after'); + +$gallery_class = 'elgg-gallery'; +if (isset($vars['gallery_class'])) { + $gallery_class = "$gallery_class {$vars['gallery_class']}"; +} + +$item_class = 'elgg-item'; +if (isset($vars['item_class'])) { + $item_class = "$item_class {$vars['item_class']}"; +} + +$nav = ''; +if ($pagination && $count) { + $nav .= elgg_view('navigation/pagination', array( + 'offset' => $offset, + 'count' => $count, + 'limit' => $limit, + 'offset_key' => $offset_key, + )); +} + +if ($position == 'before' || $position == 'both') { + echo $nav; +} + +?> +<ul class="<?php echo $gallery_class; ?>"> + <?php + foreach ($items as $item) { + if (elgg_instanceof($item)) { + $id = "elgg-{$item->getType()}-{$item->getGUID()}"; + } else { + $id = "item-{$item->getType()}-{$item->id}"; + } + echo "<li id=\"$id\" class=\"$item_class\">"; + echo elgg_view_list_item($item, $vars); + echo "</li>"; + } + ?> +</ul> + +<?php +if ($position == 'after' || $position == 'both') { + echo $nav; +} + +elgg_pop_context(); diff --git a/views/default/page/components/image_block.php b/views/default/page/components/image_block.php new file mode 100644 index 000000000..a7f480aef --- /dev/null +++ b/views/default/page/components/image_block.php @@ -0,0 +1,52 @@ +<?php +/** + * Elgg image block pattern + * + * Common pattern where there is an image, icon, media object to the left + * and a descriptive block of text to the right. + * + * --------------------------------------------------------------- + * | | | alt | + * | image | body | image | + * | block | block | block | + * | | | (optional)| + * --------------------------------------------------------------- + * + * @uses $vars['body'] HTML content of the body block + * @uses $vars['image'] HTML content of the image block + * @uses $vars['image_alt'] HTML content of the alternate image block + * @uses $vars['class'] Optional additional class for media element + * @uses $vars['id'] Optional id for the media element + */ + +$body = elgg_extract('body', $vars, ''); +$image = elgg_extract('image', $vars, ''); +$alt_image = elgg_extract('image_alt', $vars, ''); + +$class = 'elgg-image-block'; +$additional_class = elgg_extract('class', $vars, ''); +if ($additional_class) { + $class = "$class $additional_class"; +} + +$id = ''; +if (isset($vars['id'])) { + $id = "id=\"{$vars['id']}\""; +} + + +$body = "<div class=\"elgg-body\">$body</div>"; + +if ($image) { + $image = "<div class=\"elgg-image\">$image</div>"; +} + +if ($alt_image) { + $alt_image = "<div class=\"elgg-image-alt\">$alt_image</div>"; +} + +echo <<<HTML +<div class="$class clearfix" $id> + $image$alt_image$body +</div> +HTML; diff --git a/views/default/page/components/list.php b/views/default/page/components/list.php new file mode 100644 index 000000000..28ed58ddf --- /dev/null +++ b/views/default/page/components/list.php @@ -0,0 +1,75 @@ +<?php +/** + * View a list of items + * + * @package Elgg + * + * @uses $vars['items'] Array of ElggEntity or ElggAnnotation objects + * @uses $vars['offset'] Index of the first list item in complete list + * @uses $vars['limit'] Number of items per page. Only used as input to pagination. + * @uses $vars['count'] Number of items in the complete list + * @uses $vars['base_url'] Base URL of list (optional) + * @uses $vars['pagination'] Show pagination? (default: true) + * @uses $vars['position'] Position of the pagination: before, after, or both + * @uses $vars['full_view'] Show the full view of the items (default: false) + * @uses $vars['list_class'] Additional CSS class for the <ul> element + * @uses $vars['item_class'] Additional CSS class for the <li> elements + */ + +$items = $vars['items']; +$offset = elgg_extract('offset', $vars); +$limit = elgg_extract('limit', $vars); +$count = elgg_extract('count', $vars); +$base_url = elgg_extract('base_url', $vars, ''); +$pagination = elgg_extract('pagination', $vars, true); +$offset_key = elgg_extract('offset_key', $vars, 'offset'); +$position = elgg_extract('position', $vars, 'after'); + +$list_class = 'elgg-list'; +if (isset($vars['list_class'])) { + $list_class = "$list_class {$vars['list_class']}"; +} + +$item_class = 'elgg-item'; +if (isset($vars['item_class'])) { + $item_class = "$item_class {$vars['item_class']}"; +} + +$html = ""; +$nav = ""; + +if ($pagination && $count) { + $nav .= elgg_view('navigation/pagination', array( + 'base_url' => $base_url, + 'offset' => $offset, + 'count' => $count, + 'limit' => $limit, + 'offset_key' => $offset_key, + )); +} + +if (is_array($items) && count($items) > 0) { + $html .= "<ul class=\"$list_class\">"; + foreach ($items as $item) { + $li = elgg_view_list_item($item, $vars); + if ($li) { + if (elgg_instanceof($item)) { + $id = "elgg-{$item->getType()}-{$item->getGUID()}"; + } else { + $id = "item-{$item->getType()}-{$item->id}"; + } + $html .= "<li id=\"$id\" class=\"$item_class\">$li</li>"; + } + } + $html .= '</ul>'; +} + +if ($position == 'before' || $position == 'both') { + $html = $nav . $html; +} + +if ($position == 'after' || $position == 'both') { + $html .= $nav; +} + +echo $html; diff --git a/views/default/page/components/module.php b/views/default/page/components/module.php new file mode 100644 index 000000000..7e1eaff20 --- /dev/null +++ b/views/default/page/components/module.php @@ -0,0 +1,48 @@ +<?php +/** + * Elgg module element + * + * @uses $vars['title'] Optional title text (do not pass header with this option) + * @uses $vars['header'] Optional HTML content of the header + * @uses $vars['body'] HTML content of the body + * @uses $vars['footer'] Optional HTML content of the footer + * @uses $vars['class'] Optional additional class for module + * @uses $vars['id'] Optional id for module + * @uses $vars['show_inner'] Optional flag to leave out inner div (default: false) + */ + +$title = elgg_extract('title', $vars, ''); +$header = elgg_extract('header', $vars, ''); +$body = elgg_extract('body', $vars, ''); +$footer = elgg_extract('footer', $vars, ''); +$show_inner = elgg_extract('show_inner', $vars, false); + +$class = 'elgg-module'; +$additional_class = elgg_extract('class', $vars, ''); +if ($additional_class) { + $class = "$class $additional_class"; +} + +$id = ''; +if (isset($vars['id'])) { + $id = "id=\"{$vars['id']}\""; +} + +if (isset($vars['header'])) { + $header = "<div class=\"elgg-head\">$header</div>"; +} elseif ($title) { + $header = "<div class=\"elgg-head\"><h3>$title</h3></div>"; +} + +$body = "<div class=\"elgg-body\">$body</div>"; + +if ($footer) { + $footer = "<div class=\"elgg-foot\">$footer</div>"; +} + +$contents = $header . $body . $footer; +if ($show_inner) { + $contents = "<div class=\"elgg-inner\">$contents</div>"; +} + +echo "<div class=\"$class\" $id>$contents</div>"; diff --git a/views/default/page/components/summary.php b/views/default/page/components/summary.php new file mode 100644 index 000000000..ea61a6e4b --- /dev/null +++ b/views/default/page/components/summary.php @@ -0,0 +1,4 @@ +<?php + +// Deprecated in favor of type/elements/summary +echo elgg_view('object/elements/summary', $vars); diff --git a/views/default/page/default.php b/views/default/page/default.php new file mode 100644 index 000000000..567494d0c --- /dev/null +++ b/views/default/page/default.php @@ -0,0 +1,76 @@ +<?php +/** + * Elgg pageshell + * The standard HTML page shell that everything else fits into + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['title'] The page title + * @uses $vars['body'] The main content of the page + * @uses $vars['sysmessages'] A 2d array of various message registers, passed from system_messages() + */ + +// backward compatability support for plugins that are not using the new approach +// of routing through admin. See reportedcontent plugin for a simple example. +if (elgg_get_context() == 'admin') { + if (get_input('handler') != 'admin') { + elgg_deprecated_notice("admin plugins should route through 'admin'.", 1.8); + } + elgg_admin_add_plugin_settings_menu(); + elgg_unregister_css('elgg'); + echo elgg_view('page/admin', $vars); + return true; +} + +// render content before head so that JavaScript and CSS can be loaded. See #4032 +$topbar = elgg_view('page/elements/topbar', $vars); +$messages = elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); +$header = elgg_view('page/elements/header', $vars); +$body = elgg_view('page/elements/body', $vars); +$footer = elgg_view('page/elements/footer', $vars); + +// Set the content type +header("Content-type: text/html; charset=UTF-8"); + +$lang = get_current_language(); + +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang; ?>" lang="<?php echo $lang; ?>"> +<head> +<?php echo elgg_view('page/elements/head', $vars); ?> +</head> +<body> +<div class="elgg-page elgg-page-default"> + <div class="elgg-page-messages"> + <?php echo $messages; ?> + </div> + + <?php if (elgg_is_logged_in()){ ?> + <div class="elgg-page-topbar"> + <div class="elgg-inner"> + <?php echo $topbar; ?> + </div> + </div> + <?php } ?> + + <div class="elgg-page-header"> + <div class="elgg-inner"> + <?php echo $header; ?> + </div> + </div> + <div class="elgg-page-body"> + <div class="elgg-inner"> + <?php echo $body; ?> + </div> + </div> + <div class="elgg-page-footer"> + <div class="elgg-inner"> + <?php echo $footer; ?> + </div> + </div> +</div> +<?php echo elgg_view('page/elements/foot'); ?> +</body> +</html>
\ No newline at end of file diff --git a/views/default/page/elements/body.php b/views/default/page/elements/body.php new file mode 100644 index 000000000..14c3978d3 --- /dev/null +++ b/views/default/page/elements/body.php @@ -0,0 +1,8 @@ +<?php +/** + * Elgg page body wrapper + * + * @uses $vars['body'] The HTML of the page body + */ + +echo elgg_extract('body', $vars, '');
\ No newline at end of file diff --git a/views/default/page/elements/comments.php b/views/default/page/elements/comments.php new file mode 100644 index 000000000..97cb9574e --- /dev/null +++ b/views/default/page/elements/comments.php @@ -0,0 +1,42 @@ +<?php +/** + * List comments with optional add form + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['show_add_form'] Display add form or not + * @uses $vars['id'] Optional id for the div + * @uses $vars['class'] Optional additional class for the div + */ + +$show_add_form = elgg_extract('show_add_form', $vars, true); + +$id = ''; +if (isset($vars['id'])) { + $id = "id=\"{$vars['id']}\""; +} + +$class = 'elgg-comments'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +// work around for deprecation code in elgg_view() +unset($vars['internalid']); + +echo "<div $id class=\"$class\">"; + +$options = array( + 'guid' => $vars['entity']->getGUID(), + 'annotation_name' => 'generic_comment' +); +$html = elgg_list_annotations($options); +if ($html) { + echo '<h3>' . elgg_echo('comments') . '</h3>'; + echo $html; +} + +if ($show_add_form) { + echo elgg_view_form('comments/add', array(), $vars); +} + +echo '</div>'; diff --git a/views/default/page/elements/comments_block.php b/views/default/page/elements/comments_block.php new file mode 100644 index 000000000..d0f8ab809 --- /dev/null +++ b/views/default/page/elements/comments_block.php @@ -0,0 +1,45 @@ +<?php +/** + * Display the latest related comments + * + * Generally used in a sidebar. Does not work with groups currently. + * + * @uses $vars['subtypes'] Object subtype string or array of subtypes + * @uses $vars['owner_guid'] The owner of the content being commented on + * @uses $vars['limit'] The number of comments to display + */ + +$owner_guid = elgg_extract('owner_guid', $vars, ELGG_ENTITIES_ANY_VALUE); +if (!$owner_guid) { + $owner_guid = ELGG_ENTITIES_ANY_VALUE; +} + +$owner_entity = get_entity($owner_guid); +if ($owner_entity && elgg_instanceof($owner_entity, 'group')) { + // not supporting groups so return + return true; +} + +$options = array( + 'annotation_name' => 'generic_comment', + 'owner_guid' => $owner_guid, + 'reverse_order_by' => true, + 'limit' => elgg_extract('limit', $vars, 4), + 'type' => 'object', + 'subtypes' => elgg_extract('subtypes', $vars, ELGG_ENTITIES_ANY_VALUE), +); + +$title = elgg_echo('generic_comments:latest'); +$comments = elgg_get_annotations($options); +if ($comments) { + $body = elgg_view('page/components/list', array( + 'items' => $comments, + 'pagination' => false, + 'list_class' => 'elgg-latest-comments', + 'full_view' => false, + )); +} else { + $body = '<p>' . elgg_echo('generic_comment:none') . '</p>'; +} + +echo elgg_view_module('aside', $title, $body); diff --git a/views/default/page/elements/foot.php b/views/default/page/elements/foot.php new file mode 100644 index 000000000..a56b373b4 --- /dev/null +++ b/views/default/page/elements/foot.php @@ -0,0 +1,11 @@ +<?php + +echo elgg_view('footer/analytics'); + +$js = elgg_get_loaded_js('footer'); +foreach ($js as $script) { ?> + <script type="text/javascript" src="<?php echo $script; ?>"></script> +<?php +} + +?>
\ No newline at end of file diff --git a/views/default/page/elements/footer.php b/views/default/page/elements/footer.php new file mode 100644 index 000000000..ded2cea9a --- /dev/null +++ b/views/default/page/elements/footer.php @@ -0,0 +1,22 @@ +<?php +/** + * Elgg footer + * The standard HTML footer that displays across the site + * + * @package Elgg + * @subpackage Core + * + */ + +echo elgg_view_menu('footer', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz')); + +$powered_url = elgg_get_site_url() . "_graphics/powered_by_elgg_badge_drk_bckgnd.gif"; + +echo '<div class="mts clearfloat float-alt">'; +echo elgg_view('output/url', array( + 'href' => 'http://elgg.org', + 'text' => "<img src=\"$powered_url\" alt=\"Powered by Elgg\" width=\"106\" height=\"15\" />", + 'class' => '', + 'is_trusted' => true, +)); +echo '</div>'; diff --git a/views/default/page/elements/head.php b/views/default/page/elements/head.php new file mode 100644 index 000000000..d4a95b4d0 --- /dev/null +++ b/views/default/page/elements/head.php @@ -0,0 +1,81 @@ +<?php +/** + * The standard HTML head + * + * @uses $vars['title'] The page title + */ + +// Set title +if (empty($vars['title'])) { + $title = elgg_get_config('sitename'); +} else { + $title = elgg_get_config('sitename') . ": " . $vars['title']; +} + +global $autofeed; +if (isset($autofeed) && $autofeed == true) { + $url = current_page_url(); + if (substr_count($url,'?')) { + $url .= "&view=rss"; + } else { + $url .= "?view=rss"; + } + $url = elgg_format_url($url); + $feedref = <<<END + + <link rel="alternate" type="application/rss+xml" title="RSS" href="{$url}" /> + +END; +} else { + $feedref = ""; +} + +$js = elgg_get_loaded_js('head'); +$css = elgg_get_loaded_css(); + +$version = get_version(); +$release = get_version(true); +?> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta name="ElggRelease" content="<?php echo $release; ?>" /> + <meta name="ElggVersion" content="<?php echo $version; ?>" /> + <title><?php echo $title; ?></title> + <?php echo elgg_view('page/elements/shortcut_icon', $vars); ?> + +<?php foreach ($css as $link) { ?> + <link rel="stylesheet" href="<?php echo $link; ?>" type="text/css" /> +<?php } ?> + +<?php + $ie_url = elgg_get_simplecache_url('css', 'ie'); + $ie7_url = elgg_get_simplecache_url('css', 'ie7'); + $ie6_url = elgg_get_simplecache_url('css', 'ie6'); +?> + <!--[if gt IE 7]> + <link rel="stylesheet" type="text/css" href="<?php echo $ie_url; ?>" /> + <![endif]--> + <!--[if IE 7]> + <link rel="stylesheet" type="text/css" href="<?php echo $ie7_url; ?>" /> + <![endif]--> + <!--[if IE 6]> + <link rel="stylesheet" type="text/css" href="<?php echo $ie6_url; ?>" /> + <![endif]--> + +<?php foreach ($js as $script) { ?> + <script type="text/javascript" src="<?php echo $script; ?>"></script> +<?php } ?> + +<script type="text/javascript"> +// <![CDATA[ + <?php echo elgg_view('js/initialize_elgg'); ?> +// ]]> +</script> + +<?php +echo $feedref; + +$metatags = elgg_view('metatags', $vars); +if ($metatags) { + elgg_deprecated_notice("The metatags view has been deprecated. Extend page/elements/head instead", 1.8); + echo $metatags; +} diff --git a/views/default/page/elements/header.php b/views/default/page/elements/header.php new file mode 100644 index 000000000..1a1f5d211 --- /dev/null +++ b/views/default/page/elements/header.php @@ -0,0 +1,14 @@ +<?php +/** + * Elgg page header + * In the default theme, the header lives between the topbar and main content area. + */ + +// link back to main site. +echo elgg_view('page/elements/header_logo', $vars); + +// drop-down login +echo elgg_view('core/account/login_dropdown'); + +// insert site-wide navigation +echo elgg_view_menu('site');
\ No newline at end of file diff --git a/views/default/page/elements/header_logo.php b/views/default/page/elements/header_logo.php new file mode 100644 index 000000000..7fe721c40 --- /dev/null +++ b/views/default/page/elements/header_logo.php @@ -0,0 +1,15 @@ +<?php +/** + * Elgg header logo + */ + +$site = elgg_get_site_entity(); +$site_name = $site->name; +$site_url = elgg_get_site_url(); +?> + +<h1> + <a class="elgg-heading-site" href="<?php echo $site_url; ?>"> + <?php echo $site_name; ?> + </a> +</h1> diff --git a/views/default/page/elements/messages.php b/views/default/page/elements/messages.php new file mode 100644 index 000000000..edd40d71e --- /dev/null +++ b/views/default/page/elements/messages.php @@ -0,0 +1,27 @@ +<?php +/** + * Elgg global system message list + * Lists all system messages + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['object'] The array of message registers + */ + +echo '<ul class="elgg-system-messages">'; + +// hidden li so we validate +echo '<li class="hidden"></li>'; + +if (isset($vars['object']) && is_array($vars['object']) && sizeof($vars['object']) > 0) { + foreach ($vars['object'] as $type => $list ) { + foreach ($list as $message) { + echo "<li class=\"elgg-message elgg-state-$type\">"; + echo elgg_autop($message); + echo '</li>'; + } + } +} + +echo '</ul>'; diff --git a/views/default/page/elements/owner_block.php b/views/default/page/elements/owner_block.php new file mode 100644 index 000000000..fc7f0f6d2 --- /dev/null +++ b/views/default/page/elements/owner_block.php @@ -0,0 +1,31 @@ +<?php +/** + * Elgg owner block + * Displays page ownership information + * + * @package Elgg + * @subpackage Core + * + */ + +elgg_push_context('owner_block'); + +// groups and other users get owner block +$owner = elgg_get_page_owner_entity(); +if ($owner instanceof ElggGroup || + ($owner instanceof ElggUser && $owner->getGUID() != elgg_get_logged_in_user_guid())) { + + $header = elgg_view_entity($owner, array('full_view' => false)); + + $body = elgg_view_menu('owner_block', array('entity' => $owner)); + + $body .= elgg_view('page/elements/owner_block/extend', $vars); + + echo elgg_view('page/components/module', array( + 'header' => $header, + 'body' => $body, + 'class' => 'elgg-owner-block', + )); +} + +elgg_pop_context();
\ No newline at end of file diff --git a/views/default/page/elements/shortcut_icon.php b/views/default/page/elements/shortcut_icon.php new file mode 100644 index 000000000..12fe9c1f8 --- /dev/null +++ b/views/default/page/elements/shortcut_icon.php @@ -0,0 +1,6 @@ +<?php +/** + * Displays the default shortcut icon + */ +?> +<link rel="SHORTCUT ICON" href="<?php echo elgg_get_site_url(); ?>_graphics/favicon.ico" />
\ No newline at end of file diff --git a/views/default/page/elements/sidebar.php b/views/default/page/elements/sidebar.php new file mode 100644 index 000000000..fe6bb450e --- /dev/null +++ b/views/default/page/elements/sidebar.php @@ -0,0 +1,32 @@ +<?php +/** + * Elgg sidebar contents + * + * @uses $vars['sidebar'] Optional content that is displayed at the bottom of sidebar + */ + +echo elgg_view_menu('extras', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); + +echo elgg_view('page/elements/owner_block', $vars); + +echo elgg_view_menu('page', array('sort_by' => 'name')); + +// optional 'sidebar' parameter +if (isset($vars['sidebar'])) { + echo $vars['sidebar']; +} + +// @todo deprecated so remove in Elgg 2.0 +// optional second parameter of elgg_view_layout +if (isset($vars['area2'])) { + echo $vars['area2']; +} + +// @todo deprecated so remove in Elgg 2.0 +// optional third parameter of elgg_view_layout +if (isset($vars['area3'])) { + echo $vars['area3']; +}
\ No newline at end of file diff --git a/views/default/page/elements/sidebar_alt.php b/views/default/page/elements/sidebar_alt.php new file mode 100644 index 000000000..6d91ca58b --- /dev/null +++ b/views/default/page/elements/sidebar_alt.php @@ -0,0 +1,12 @@ +<?php +/** + * Elgg secondary sidebar contents + * + * You can override, extend, or pass content to it + * + * @uses $vars['sidebar_alt] HTML content for the alternate sidebar + */ + +$sidebar = elgg_extract('sidebar_alt', $vars, ''); + +echo $sidebar; diff --git a/views/default/page/elements/tagcloud_block.php b/views/default/page/elements/tagcloud_block.php new file mode 100644 index 000000000..258951c41 --- /dev/null +++ b/views/default/page/elements/tagcloud_block.php @@ -0,0 +1,58 @@ +<?php +/** + * Display content-based tags + * + * Generally used in a sidebar. Does not work with groups currently. + * + * @uses $vars['subtypes'] Object subtype string or array of subtypes + * @uses $vars['owner_guid'] The owner of the content being tagged + * @uses $vars['limit'] The maxinum number of tags to display + */ + +$owner_guid = elgg_extract('owner_guid', $vars, ELGG_ENTITIES_ANY_VALUE); +if (!$owner_guid) { + $owner_guid = ELGG_ENTITIES_ANY_VALUE; +} + +$owner_entity = get_entity($owner_guid); +if ($owner_entity && elgg_instanceof($owner_entity, 'group')) { + // not supporting groups so return + return true; +} + +$options = array( + 'type' => 'object', + 'subtype' => elgg_extract('subtypes', $vars, ELGG_ENTITIES_ANY_VALUE), + 'owner_guid' => $owner_guid, + 'threshold' => 0, + 'limit' => elgg_extract('limit', $vars, 50), + 'tag_name' => 'tags', +); + +$title = elgg_echo('tagcloud'); +if (is_array($options['subtype']) && count($options['subtype']) > 1) { + // we cannot provide links to tagged objects with multiple types + $tag_data = elgg_get_tags($options); + $cloud = elgg_view("output/tagcloud", array( + 'value' => $tag_data, + 'type' => $type, + )); +} else { + $cloud = elgg_view_tagcloud($options); +} +if (!$cloud) { + return true; +} + +// add a link to all site tags +$cloud .= '<p class="small">'; +$cloud .= elgg_view_icon('tag'); +$cloud .= elgg_view('output/url', array( + 'href' => 'tags', + 'text' => elgg_echo('tagcloud:allsitetags'), + 'is_trusted' => true, +)); +$cloud .= '</p>'; + + +echo elgg_view_module('aside', $title, $cloud); diff --git a/views/default/page/elements/title.php b/views/default/page/elements/title.php new file mode 100644 index 000000000..19f47f4e6 --- /dev/null +++ b/views/default/page/elements/title.php @@ -0,0 +1,14 @@ +<?php +/** + * Elgg title element + * + * @uses $vars['title'] The page title + * @uses $vars['class'] Optional class for heading + */ + +$class= ''; +if (isset($vars['class'])) { + $class = " class=\"{$vars['class']}\""; +} + +echo "<h2{$class}>{$vars['title']}</h2>"; diff --git a/views/default/page/elements/topbar.php b/views/default/page/elements/topbar.php new file mode 100644 index 000000000..e4c6c86bb --- /dev/null +++ b/views/default/page/elements/topbar.php @@ -0,0 +1,16 @@ +<?php +/** + * Elgg topbar + * The standard elgg top toolbar + */ + +// Elgg logo +echo elgg_view_menu('topbar', array('sort_by' => 'priority', array('elgg-menu-hz'))); + +// elgg tools menu +// need to echo this empty view for backward compatibility. +$content = elgg_view("navigation/topbar_tools"); +if ($content) { + elgg_deprecated_notice('navigation/topbar_tools was deprecated. Extend the topbar menus or the page/elements/topbar view directly', 1.8); + echo $content; +} diff --git a/views/default/page/elements/wrapper.php b/views/default/page/elements/wrapper.php new file mode 100644 index 000000000..61828832d --- /dev/null +++ b/views/default/page/elements/wrapper.php @@ -0,0 +1,22 @@ +<?php +/** + * Deprecated content wrapper view from Elgg 1.5 through 1.7 + * + * @uses $vars['body'] The content to display inside content wrapper + * @uses $vars['subclass'] Additional css class + */ + +elgg_deprecated_notice("The 'page_elements/contentwrapper' has been deprecated", 1.8); +?> + +<div class="contentWrapper<?php + + if (isset($vars['subclass'])) { + echo ' ' . $vars['subclass']; + } + +?>"> +<?php + echo $vars['body']; +?> +</div> 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 @@ +<?php +/** + * Page shell for errors + * + * This is for errors that are not unhandled exceptions. Those are handled + * through the failsafe viewtype to guarantee that no further exceptions occur. + * An example error would be 404 (page not found). + * + * @uses $vars['title'] The page title + * @uses $vars['body'] The main content of the page + * @uses $vars['sysmessages'] A 2d array of various message registers, passed from system_messages() + */ + +echo elgg_view('page/default', $vars); 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/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/widgets.php b/views/default/page/layouts/widgets.php new file mode 100644 index 000000000..c6b162516 --- /dev/null +++ b/views/default/page/layouts/widgets.php @@ -0,0 +1,62 @@ +<?php +/** + * Elgg widgets layout + * + * @uses $vars['content'] Optional display box at the top of layout + * @uses $vars['num_columns'] Number of widget columns for this layout (3) + * @uses $vars['show_add_widgets'] Display the add widgets button and panel (true) + * @uses $vars['exact_match'] Widgets must match the current context (false) + * @uses $vars['show_access'] Show the access control (true) + */ + +$num_columns = elgg_extract('num_columns', $vars, 3); +$show_add_widgets = elgg_extract('show_add_widgets', $vars, true); +$exact_match = elgg_extract('exact_match', $vars, false); +$show_access = elgg_extract('show_access', $vars, true); + +$owner = elgg_get_page_owner_entity(); + +$widget_types = elgg_get_widget_types(); + +$context = elgg_get_context(); +elgg_push_context('widgets'); + +$widgets = elgg_get_widgets($owner->guid, $context); + +if (elgg_can_edit_widget_layout($context)) { + if ($show_add_widgets) { + echo elgg_view('page/layouts/widgets/add_button'); + } + $params = array( + 'widgets' => $widgets, + 'context' => $context, + 'exact_match' => $exact_match, + 'show_access' => $show_access, + ); + echo elgg_view('page/layouts/widgets/add_panel', $params); +} + +echo $vars['content']; + +$widget_class = "elgg-col-1of{$num_columns}"; +for ($column_index = 1; $column_index <= $num_columns; $column_index++) { + if (isset($widgets[$column_index])) { + $column_widgets = $widgets[$column_index]; + } else { + $column_widgets = array(); + } + + echo "<div class=\"$widget_class elgg-widgets\" id=\"elgg-widget-col-$column_index\">"; + if (sizeof($column_widgets) > 0) { + foreach ($column_widgets as $widget) { + if (array_key_exists($widget->handler, $widget_types)) { + echo elgg_view_entity($widget, array('show_access' => $show_access)); + } + } + } + echo '</div>'; +} + +elgg_pop_context(); + +echo elgg_view('graphics/ajax_loader', array('id' => 'elgg-widget-loader')); 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> diff --git a/views/default/page/upgrade.php b/views/default/page/upgrade.php new file mode 100644 index 000000000..1a92042be --- /dev/null +++ b/views/default/page/upgrade.php @@ -0,0 +1,18 @@ +<?php +/** + * Page shell for upgrade script + * + * Displays an ajax loader until upgrade is complete + */ +?> +<html> + <head> + <?php echo elgg_view('page/elements/head', $vars); ?> + <meta http-equiv="refresh" content="1;url=<?php echo elgg_get_site_url(); ?>upgrade.php?upgrade=upgrade"/> + </head> + <body> + <div style="margin-top:200px"> + <?php echo elgg_view('graphics/ajax_loader', array('hidden' => false)); ?> + </div> + </body> +</html>
\ No newline at end of file diff --git a/views/default/page/walled_garden.php b/views/default/page/walled_garden.php new file mode 100644 index 000000000..b280cf6b2 --- /dev/null +++ b/views/default/page/walled_garden.php @@ -0,0 +1,40 @@ +<?php +/** + * Walled garden page shell + * + * Used for the walled garden index page + */ + +$is_sticky_register = elgg_is_sticky_form('register'); +$wg_body_class = 'elgg-body-walledgarden'; +if ($is_sticky_register) { + $wg_body_class .= ' hidden'; +} + +// Set the content type +header("Content-type: text/html; charset=UTF-8"); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<?php echo elgg_view('page/elements/head', $vars); ?> +</head> +<body> +<div class="elgg-page elgg-page-walledgarden"> + <div class="elgg-page-messages"> + <?php echo elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); ?> + </div> + <div class="<?php echo $wg_body_class; ?>"> + <?php echo $vars['body']; ?> + </div> +</div> +<?php if ($is_sticky_register): ?> +<script type="text/javascript"> +elgg.register_hook_handler('init', 'system', function() { + $('.registration_link').trigger('click'); +}); +</script> +<?php endif; ?> +<?php echo elgg_view('page/elements/foot'); ?> +</body> +</html>
\ No newline at end of file diff --git a/views/default/profile/icon.php b/views/default/profile/icon.php new file mode 100644 index 000000000..5f06cfd54 --- /dev/null +++ b/views/default/profile/icon.php @@ -0,0 +1,17 @@ +<?php +/** + * Elgg profile icon + * + * @deprecated 1.8 use elgg_view_entity_icon() + * + * @uses $vars['entity'] The user entity. If none specified, the current user is assumed. + * @uses $vars['size'] The size - small, medium or large. If none specified, medium is assumed. + * @uses $vars['override'] + * @uses $vars['js'] + */ +elgg_deprecated_notice('The profile/icon view was deprecated. Use elgg_view_entity_icon()', 1.8); + +$override = elgg_extract('override', $vars, false); +$vars['use_hover'] = !$override; + +echo elgg_view('icon/user/default', $vars); diff --git a/views/default/river/annotation/generic_comment/create.php b/views/default/river/annotation/generic_comment/create.php new file mode 100644 index 000000000..7d586450d --- /dev/null +++ b/views/default/river/annotation/generic_comment/create.php @@ -0,0 +1,11 @@ +<?php +/** + * Post comment river view + */ +$object = $vars['item']->getObjectEntity(); +$comment = $vars['item']->getAnnotation(); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'message' => elgg_get_excerpt($comment->value), +)); diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php new file mode 100644 index 000000000..2cd7f2289 --- /dev/null +++ b/views/default/river/elements/body.php @@ -0,0 +1,67 @@ +<?php +/** + * Body of river item + * + * @uses $vars['item'] ElggRiverItem + * @uses $vars['summary'] Alternate summary (the short text summary of action) + * @uses $vars['message'] Optional message (usually excerpt of text) + * @uses $vars['attachments'] Optional attachments (displaying icons or other non-text data) + * @uses $vars['responses'] Alternate respones (comments, replies, etc.) + */ + +$item = $vars['item']; + +$menu = elgg_view_menu('river', array( + 'item' => $item, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); + +// river item header +$timestamp = elgg_view_friendly_time($item->getPostedTime()); + +$summary = elgg_extract('summary', $vars, elgg_view('river/elements/summary', array('item' => $vars['item']))); +if ($summary === false) { + $subject = $item->getSubjectEntity(); + $summary = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', + 'is_trusted' => true, + )); +} + +$message = elgg_extract('message', $vars, false); +if ($message !== false) { + $message = "<div class=\"elgg-river-message\">$message</div>"; +} + +$attachments = elgg_extract('attachments', $vars, false); +if ($attachments !== false) { + $attachments = "<div class=\"elgg-river-attachments clearfix\">$attachments</div>"; +} + +$responses = elgg_view('river/elements/responses', $vars); +if ($responses) { + $responses = "<div class=\"elgg-river-responses\">$responses</div>"; +} + +$group_string = ''; +$object = $item->getObjectEntity(); +$container = $object->getContainerEntity(); +if ($container instanceof ElggGroup && $container->guid != elgg_get_page_owner_guid()) { + $group_link = elgg_view('output/url', array( + 'href' => $container->getURL(), + 'text' => $container->name, + 'is_trusted' => true, + )); + $group_string = elgg_echo('river:ingroup', array($group_link)); +} + +echo <<<RIVER +$menu +<div class="elgg-river-summary">$summary $group_string <span class="elgg-river-timestamp">$timestamp</span></div> +$message +$attachments +$responses +RIVER; diff --git a/views/default/river/elements/image.php b/views/default/river/elements/image.php new file mode 100644 index 000000000..6f6aeae65 --- /dev/null +++ b/views/default/river/elements/image.php @@ -0,0 +1,16 @@ +<?php +/** + * Elgg river image + * + * Displayed next to the body of each river item + * + * @uses $vars['item'] + */ + +$subject = $vars['item']->getSubjectEntity(); + +if (elgg_in_context('widgets')) { + echo elgg_view_entity_icon($subject, 'tiny'); +} else { + echo elgg_view_entity_icon($subject, 'small'); +} diff --git a/views/default/river/elements/layout.php b/views/default/river/elements/layout.php new file mode 100644 index 000000000..94622e272 --- /dev/null +++ b/views/default/river/elements/layout.php @@ -0,0 +1,14 @@ +<?php +/** + * Layout of a river item + * + * @uses $vars['item'] ElggRiverItem + */ + +$item = $vars['item']; + +echo elgg_view('page/components/image_block', array( + 'image' => elgg_view('river/elements/image', $vars), + 'body' => elgg_view('river/elements/body', $vars), + 'class' => 'elgg-river-item', +)); diff --git a/views/default/river/elements/responses.php b/views/default/river/elements/responses.php new file mode 100644 index 000000000..f6c32e142 --- /dev/null +++ b/views/default/river/elements/responses.php @@ -0,0 +1,63 @@ +<?php +/** + * River item footer + * + * @uses $vars['item'] ElggRiverItem + * @uses $vars['responses'] Alternate override for this item + */ + +// allow river views to override the response content +$responses = elgg_extract('responses', $vars, false); +if ($responses) { + echo $responses; + return true; +} + +$item = $vars['item']; +$object = $item->getObjectEntity(); + +// annotations do not have comments +if ($item->annotation_id != 0 || !$object) { + return true; +} + +$comment_count = $object->countComments(); + +$options = array( + 'guid' => $object->getGUID(), + 'annotation_name' => 'generic_comment', + 'limit' => 3, + 'order_by' => 'n_table.time_created desc' +); +$comments = elgg_get_annotations($options); + +if ($comments) { + // why is this reversing it? because we're asking for the 3 latest + // comments by sorting desc and limiting by 3, but we want to display + // these comments with the latest at the bottom. + $comments = array_reverse($comments); + +?> + <span class="elgg-river-comments-tab"><?php echo elgg_echo('comments'); ?></span> + +<?php + + echo elgg_view_annotation_list($comments, array('list_class' => 'elgg-river-comments')); + + if ($comment_count > count($comments)) { + $num_more_comments = $comment_count - count($comments); + $url = $object->getURL(); + $params = array( + 'href' => $url, + 'text' => elgg_echo('river:comments:more', array($num_more_comments)), + 'is_trusted' => true, + ); + $link = elgg_view('output/url', $params); + echo "<div class=\"elgg-river-more\">$link</div>"; + } +} + +// inline comment form +$form_vars = array('id' => "comments-add-{$object->getGUID()}", 'class' => 'hidden'); +$body_vars = array('entity' => $object, 'inline' => true); +echo elgg_view_form('comments/add', $form_vars, $body_vars); diff --git a/views/default/river/elements/summary.php b/views/default/river/elements/summary.php new file mode 100644 index 000000000..d7bde51dd --- /dev/null +++ b/views/default/river/elements/summary.php @@ -0,0 +1,54 @@ +<?php +/** + * Short summary of the action that occurred + * + * @vars['item'] ElggRiverItem + */ + +$item = $vars['item']; + +$subject = $item->getSubjectEntity(); +$object = $item->getObjectEntity(); +$target = $object->getContainerEntity(); + +$subject_link = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', + 'is_trusted' => true, +)); + +$object_text = $object->title ? $object->title : $object->name; +$object_link = elgg_view('output/url', array( + 'href' => $object->getURL(), + 'text' => elgg_get_excerpt($object_text, 100), + 'class' => 'elgg-river-object', + 'is_trusted' => true, +)); + +$action = $item->action_type; +$type = $item->type; +$subtype = $item->subtype ? $item->subtype : 'default'; + +$container = $object->getContainerEntity(); +if ($container instanceof ElggGroup) { + $params = array( + 'href' => $container->getURL(), + 'text' => $container->name, + 'is_trusted' => true, + ); + $group_link = elgg_view('output/url', $params); + $group_string = elgg_echo('river:ingroup', array($group_link)); +} + +// check summary translation keys. +// will use the $type:$subtype if that's defined, otherwise just uses $type:default +$key = "river:$action:$type:$subtype"; +$summary = elgg_echo($key, array($subject_link, $object_link)); + +if ($summary == $key) { + $key = "river:$action:$type:default"; + $summary = elgg_echo($key, array($subject_link, $object_link)); +} + +echo $summary;
\ No newline at end of file diff --git a/views/default/river/item.php b/views/default/river/item.php new file mode 100644 index 000000000..75767e08d --- /dev/null +++ b/views/default/river/item.php @@ -0,0 +1,30 @@ +<?php +/** + * Primary river item view + * + * Calls the individual view saved for that river item. Most of these + * individual river views then use the views in river/elements. + * + * @uses $vars['item'] ElggRiverItem + */ + +// @todo remove this in Elgg 1.9 +global $_elgg_special_river_catch; +if (!isset($_elgg_special_river_catch)) { + $_elgg_special_river_catch = false; +} +if ($_elgg_special_river_catch) { + // we changed the views a little in 1.8.1 so this catches the plugins that + // were updated in 1.8.0 and redirects to the layout view + echo elgg_view('river/elements/layout', $vars); + return true; +} +$_elgg_special_river_catch = true; + + +$item = $vars['item']; + +echo elgg_view($item->getView(), $vars); + + +$_elgg_special_river_catch = false; diff --git a/views/default/river/relationship/friend/create.php b/views/default/river/relationship/friend/create.php new file mode 100644 index 000000000..0408d79e1 --- /dev/null +++ b/views/default/river/relationship/friend/create.php @@ -0,0 +1,14 @@ +<?php +/** + * Create friend river view + */ +$subject = $vars['item']->getSubjectEntity(); +$object = $vars['item']->getObjectEntity(); + +$subject_icon = elgg_view_entity_icon($subject, 'tiny'); +$object_icon = elgg_view_entity_icon($object, 'tiny'); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'attachments' => $subject_icon . elgg_view_icon('arrow-right') . $object_icon, +)); diff --git a/views/default/river/user/default/profileiconupdate.php b/views/default/river/user/default/profileiconupdate.php new file mode 100644 index 000000000..271064a06 --- /dev/null +++ b/views/default/river/user/default/profileiconupdate.php @@ -0,0 +1,24 @@ +<?php +/** + * Update avatar river view + */ + +$subject = $vars['item']->getSubjectEntity(); + +$subject_link = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', + 'is_trusted' => true, +)); + +$string = elgg_echo('river:update:user:avatar', array($subject_link)); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'summary' => $string, + 'attachments' => elgg_view_entity_icon($subject, 'tiny', array( + 'use_hover' => false, + 'use_link' => false, + )), +)); diff --git a/views/default/river/user/default/profileupdate.php b/views/default/river/user/default/profileupdate.php new file mode 100644 index 000000000..ce72970d6 --- /dev/null +++ b/views/default/river/user/default/profileupdate.php @@ -0,0 +1,20 @@ +<?php +/** + * Update profile river view + */ + +$subject = $vars['item']->getSubjectEntity(); + +$subject_link = elgg_view('output/url', array( + 'href' => $subject->getURL(), + 'text' => $subject->name, + 'class' => 'elgg-river-subject', + 'is_trusted' => true, +)); + +$string = elgg_echo('river:update:user:profile', array($subject_link)); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'summary' => $string, +)); diff --git a/views/default/site/default.php b/views/default/site/default.php new file mode 100644 index 000000000..5dacb4019 --- /dev/null +++ b/views/default/site/default.php @@ -0,0 +1,17 @@ +<?php +/** + * ElggSite default view. + * + * @package Elgg + * @subpackage Core + */ + +// sites information (including plugin settings) shouldn't be shown. +// this view is required for pinging home during install. +if (!defined('INSTALLING')) { + if ($site = $vars['entity']->url) { + forward($site); + } else { + forward(); + } +} diff --git a/views/default/user/default.php b/views/default/user/default.php new file mode 100644 index 000000000..6c84e84ad --- /dev/null +++ b/views/default/user/default.php @@ -0,0 +1,57 @@ +<?php +/** + * Elgg user display + * + * @uses $vars['entity'] ElggUser entity + * @uses $vars['size'] Size of the icon + */ + +$entity = $vars['entity']; +$size = elgg_extract('size', $vars, 'tiny'); + +$icon = elgg_view_entity_icon($entity, $size, $vars); + +// Simple XFN +$rel = ''; +if (elgg_get_logged_in_user_guid() == $entity->guid) { + $rel = 'rel="me"'; +} elseif (check_entity_relationship(elgg_get_logged_in_user_guid(), 'friend', $entity->guid)) { + $rel = 'rel="friend"'; +} + +$title = "<a href=\"" . $entity->getUrl() . "\" $rel>" . $entity->name . "</a>"; + +$metadata = elgg_view_menu('entity', array( + 'entity' => $entity, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); + +if (elgg_in_context('owner_block') || elgg_in_context('widgets')) { + $metadata = ''; +} + +if (elgg_get_context() == 'gallery') { + echo $icon; +} else { + if ($entity->isBanned()) { + $banned = elgg_echo('banned'); + $params = array( + 'entity' => $entity, + 'title' => $title, + 'metadata' => $metadata, + ); + } else { + $params = array( + 'entity' => $entity, + 'title' => $title, + 'metadata' => $metadata, + 'subtitle' => $entity->briefdescription, + 'content' => elgg_view('user/status', array('entity' => $entity)), + ); + } + + $list_body = elgg_view('user/elements/summary', $params); + + echo elgg_view_image_block($icon, $list_body, $vars); +} diff --git a/views/default/user/elements/summary.php b/views/default/user/elements/summary.php new file mode 100644 index 000000000..46d11c14c --- /dev/null +++ b/views/default/user/elements/summary.php @@ -0,0 +1,13 @@ +<?php +/** + * User summary + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['title'] Title link (optional) false = no title, '' = default + * @uses $vars['metadata'] HTML for entity metadata and actions (optional) + * @uses $vars['subtitle'] HTML for the subtitle (optional) + * @uses $vars['tags'] HTML for the tags (optional) + * @uses $vars['content'] HTML for the entity content (optional) + */ + +echo elgg_view('object/elements/summary', $vars); diff --git a/views/default/user/search/finishblurb.php b/views/default/user/search/finishblurb.php new file mode 100644 index 000000000..a3878a803 --- /dev/null +++ b/views/default/user/search/finishblurb.php @@ -0,0 +1,18 @@ +<?php +/** + * @package Elgg + * @subpackage Core + * @deprecated 1.7 + */ + +elgg_deprecated_notice('view user/search/finishblurb was deprecated.', 1.7); + +if ($vars['count'] > $vars['threshold']) { + +?> +<a href="<?php echo elgg_get_site_url(); ?>search/users?tag=<?php echo urlencode($vars['tag']); ?>"><?php + echo elgg_echo("user:search:finishblurb"); + ?></a> +<?php + +} diff --git a/views/default/user/search/startblurb.php b/views/default/user/search/startblurb.php new file mode 100644 index 000000000..806157609 --- /dev/null +++ b/views/default/user/search/startblurb.php @@ -0,0 +1,10 @@ +<?php +/** + * @package Elgg + * @subpackage Core + * @deprecated 1.7 + */ + +elgg_deprecated_notice('view user/search/startblurb was deprecated.', 1.7); + +echo elgg_echo("user:search:startblurb", array($vars['tag']));
\ No newline at end of file diff --git a/views/default/widgets/admin_welcome/content.php b/views/default/widgets/admin_welcome/content.php new file mode 100644 index 000000000..f4b92ea66 --- /dev/null +++ b/views/default/widgets/admin_welcome/content.php @@ -0,0 +1,19 @@ +<?php +/** + * Welcome widget for admins + */ + +// section => string replacements. +$sections = array( + 'intro' => array(), + 'admin_overview' => array(), + 'outro' => array() +); + +// don't use longtext because it filters output. +// that's annoying. +echo '<div class="elgg-output">'; +foreach ($sections as $section => $strings) { + echo '<p>' . elgg_echo("admin:widget:admin_welcome:$section", $strings) . '</p>'; +} +echo '</div>';
\ No newline at end of file diff --git a/views/default/widgets/content_stats/content.php b/views/default/widgets/content_stats/content.php new file mode 100644 index 000000000..56772047d --- /dev/null +++ b/views/default/widgets/content_stats/content.php @@ -0,0 +1,28 @@ +<?php +/** + * Content stats widget + */ + +$max = $vars['entity']->num_display; + +$entity_stats = get_entity_statistics(); +$object_stats = $entity_stats['object']; +arsort($object_stats); +$object_stats = array_slice($object_stats, 0, $max); + +echo '<table class="elgg-table-alt">'; +echo '<tr><th>' . elgg_echo('widget:content_stats:type') . '</th>'; +echo '<th>' . elgg_echo('widget:content_stats:number') . '</th></tr>'; +foreach ($object_stats as $subtype => $num) { + $name = elgg_echo("item:object:$subtype"); + echo "<tr><td>$name</td><td>$num</td></tr>"; +} +echo '</table>'; + +echo '<div class="mtm">'; +echo elgg_view('output/url', array( + 'href' => 'admin/statistics/overview', + 'text' => elgg_echo('more'), + 'is_trusted' => true, +)); +echo '</div>'; diff --git a/views/default/widgets/content_stats/edit.php b/views/default/widgets/content_stats/edit.php new file mode 100644 index 000000000..f1a050df8 --- /dev/null +++ b/views/default/widgets/content_stats/edit.php @@ -0,0 +1,23 @@ +<?php +/** + * Content statistics widget edit view + */ + + +// set default value +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 8; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(5, 8, 10, 12, 15, 20), +); +$dropdown = elgg_view('input/dropdown', $params); + +?> +<p> + <?php echo elgg_echo('widget:numbertodisplay'); ?>: + <?php echo $dropdown; ?> +</p> diff --git a/views/default/widgets/control_panel/content.php b/views/default/widgets/control_panel/content.php new file mode 100644 index 000000000..a348d612f --- /dev/null +++ b/views/default/widgets/control_panel/content.php @@ -0,0 +1,38 @@ +<?php +/** + * Admin control panel widget + */ + +elgg_register_menu_item('admin_control_panel', array( + 'name' => 'flush', + 'text' => elgg_echo('admin:cache:flush'), + 'href' => 'action/admin/site/flush_cache', + 'is_action' => true, + 'link_class' => 'elgg-button elgg-button-action', +)); + +// @todo Move in this in ElggUpgradeManager::isLocked() when #4682 fixed +$is_locked = _elgg_upgrade_is_locked(); + +if (!$is_locked) { + elgg_register_menu_item('admin_control_panel', array( + 'name' => 'upgrade', + 'text' => elgg_echo('upgrade'), + 'href' => 'upgrade.php', + 'link_class' => 'elgg-button elgg-button-action', + )); +} else { + elgg_register_menu_item('admin_control_panel', array( + 'name' => 'unlock_upgrade', + 'text' => elgg_echo('upgrade:unlock'), + 'href' => 'action/admin/site/unlock_upgrade', + 'is_action' => true, + 'link_class' => 'elgg-button elgg-button-action', + 'confirm' => elgg_echo('upgrade:unlock:confirm'), + )); +} + +echo elgg_view_menu('admin_control_panel', array( + 'class' => 'elgg-menu-hz', + 'item_class' => 'mrm', +)); diff --git a/views/default/widgets/friends/content.php b/views/default/widgets/friends/content.php new file mode 100644 index 000000000..98814c244 --- /dev/null +++ b/views/default/widgets/friends/content.php @@ -0,0 +1,25 @@ +<?php +/** + * Friend widget display view + * + */ + +// owner of the widget +$owner = $vars['entity']->getOwnerEntity(); + +// the number of friends to display +$num = (int) $vars['entity']->num_display; + +// get the correct size +$size = $vars['entity']->icon_size; + +if (elgg_instanceof($owner, 'user')) { + $html = $owner->listFriends('', $num, array( + 'size' => $size, + 'list_type' => 'gallery', + 'pagination' => false + )); + if ($html) { + echo $html; + } +} diff --git a/views/default/widgets/friends/edit.php b/views/default/widgets/friends/edit.php new file mode 100644 index 000000000..c7e6b06ff --- /dev/null +++ b/views/default/widgets/friends/edit.php @@ -0,0 +1,52 @@ +<?php +/** + * Friend widget options + * + */ + +// set default value for display number +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 12; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30, 50, 100), +); +$display_dropdown = elgg_view('input/dropdown', $params); + + +// handle upgrade to 1.7.2 from previous versions +if ($vars['entity']->icon_size == 1) { + $vars['entity']->icon_size = 'small'; +} elseif ($vars['entity']->icon_size == 2) { + $vars['entity']->icon_size = 'tiny'; +} + +// set default value for icon size +if (!isset($vars['entity']->icon_size)) { + $vars['entity']->icon_size = 'small'; +} + +$params = array( + 'name' => 'params[icon_size]', + 'value' => $vars['entity']->icon_size, + 'options_values' => array( + 'small' => elgg_echo('friends:small'), + 'tiny' => elgg_echo('friends:tiny'), + ), +); +$size_dropdown = elgg_view('input/dropdown', $params); + + +?> +<p> + <?php echo elgg_echo('friends:num_display'); ?>: + <?php echo $display_dropdown; ?> +</p> + +<p> + <?php echo elgg_echo('friends:icon_size'); ?>: + <?php echo $size_dropdown; ?> +</p> diff --git a/views/default/widgets/new_users/content.php b/views/default/widgets/new_users/content.php new file mode 100644 index 000000000..ba85e7421 --- /dev/null +++ b/views/default/widgets/new_users/content.php @@ -0,0 +1,11 @@ +<?php +/** + * New users admin widget + */ + +echo elgg_list_entities(array( + 'type' => 'user', + 'subtype'=> null, + 'full_view' => false, + 'pagination' => false, +));
\ No newline at end of file diff --git a/views/default/widgets/new_users/edit.php b/views/default/widgets/new_users/edit.php new file mode 100644 index 000000000..ed07213cb --- /dev/null +++ b/views/default/widgets/new_users/edit.php @@ -0,0 +1,23 @@ +<?php +/** + * New users widget edit view + */ + + +// set default value +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 5; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(5, 8, 10, 12, 15, 20), +); +$dropdown = elgg_view('input/dropdown', $params); + +?> +<p> + <?php echo elgg_echo('widget:numbertodisplay'); ?>: + <?php echo $dropdown; ?> +</p> diff --git a/views/default/widgets/online_users/content.php b/views/default/widgets/online_users/content.php new file mode 100644 index 000000000..6e0cc7abb --- /dev/null +++ b/views/default/widgets/online_users/content.php @@ -0,0 +1,15 @@ +<?php +/** + * Online users widget + */ + +$count = find_active_users(600, 10, 0, true); +$objects = find_active_users(600, 10); + +if ($objects) { + echo elgg_view_entity_list($objects, array( + 'count' => $count, + 'limit' => 10, + 'pagination' => false, + )); +} diff --git a/views/default/widgets/online_users/edit.php b/views/default/widgets/online_users/edit.php new file mode 100644 index 000000000..66f03a745 --- /dev/null +++ b/views/default/widgets/online_users/edit.php @@ -0,0 +1,22 @@ +<?php +/** + * Online users widget edit view + */ + +// set default value +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 8; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(5, 8, 10, 12, 15, 20), +); +$dropdown = elgg_view('input/dropdown', $params); + +?> +<p> + <?php echo elgg_echo('widget:numbertodisplay'); ?>: + <?php echo $dropdown; ?> +</p> diff --git a/views/default/widgets/river_widget/content.php b/views/default/widgets/river_widget/content.php new file mode 100644 index 000000000..867fc9db6 --- /dev/null +++ b/views/default/widgets/river_widget/content.php @@ -0,0 +1,27 @@ +<?php +/** + * Activity widget content view + */ + +$num = (int) $vars['entity']->num_display; + +$options = array( + 'limit' => $num, + 'pagination' => false, +); + +if (elgg_in_context('dashboard')) { + if ($vars['entity']->content_type == 'friends') { + $options['relationship_guid'] = elgg_get_page_owner_guid(); + $options['relationship'] = 'friend'; + } +} else { + $options['subject_guid'] = elgg_get_page_owner_guid(); +} + +$content = elgg_list_river($options); +if (!$content) { + $content = elgg_echo('river:none'); +} + +echo $content; diff --git a/views/default/widgets/river_widget/edit.php b/views/default/widgets/river_widget/edit.php new file mode 100644 index 000000000..228212e47 --- /dev/null +++ b/views/default/widgets/river_widget/edit.php @@ -0,0 +1,58 @@ +<?php +/** + * Edit settings for river widget + */ + +// dashboard widget has type parameter +if (elgg_in_context('dashboard')) { + if (!isset($vars['entity']->content_type)) { + $vars['entity']->content_type = 'friends'; + } + $params = array( + 'name' => 'params[content_type]', + 'value' => $vars['entity']->content_type, + 'options_values' => array( + 'friends' => elgg_echo('river:widgets:friends'), + 'all' => elgg_echo('river:widgets:all'), + ), + ); + $type_dropdown = elgg_view('input/dropdown', $params); + ?> + <div> + <?php echo elgg_echo('river:widget:type'); ?>: + <?php echo $type_dropdown; ?> + </div> + <?php +} + + +// set default value for number to display +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 8; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(5, 8, 10, 12, 15, 20), +); +$num_dropdown = elgg_view('input/dropdown', $params); + +?> +<div> + <?php echo elgg_echo('widget:numbertodisplay'); ?>: + <?php echo $num_dropdown; ?> +</div> + +<?php +// pass the context so we have the correct output upon save. +if (elgg_in_context('dashboard')) { + $context = 'dashboard'; +} else { + $context = 'profile'; +} + +echo elgg_view('input/hidden', array( + 'name' => 'context', + 'value' => $context +));
\ No newline at end of file |