]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2703 - added support for url ids in navigation tabs
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 31 Dec 2010 14:36:26 +0000 (14:36 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 31 Dec 2010 14:36:26 +0000 (14:36 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7788 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/embed/views/default/embed/embed.php
views/default/navigation/tabs.php

index 21b296db4e5c15b22fd373cc29683d2c78c59821..7e84a9d72ba0cfb9868cdd376037aa47144157f3 100644 (file)
@@ -30,8 +30,7 @@ if (!$sections) {
                        'title' => $section_info['name'],
                        'url' => '#',
                        'url_class' => 'embed_section',
-                       // abusing the js attribute.
-                       'url_js' => "id=\"$section_id\""
+                       'url_id' => $section_id,
                );
 
                if ($section_id == $active_section) {
@@ -46,7 +45,7 @@ if (!$sections) {
                        'title' => elgg_echo('embed:upload'),
                        'url' => '#',
                        'url_class' => 'embed_section',
-                       'url_js' => 'id="upload"',
+                       'url_id' => 'upload',
                        'selected' => ($active_section == 'upload')
                );
        }
index e3398a99dc48ed6073a8fabe350e4580f93ec4ea..21fae82021364136495a5ef777dbe4afb87c77fe 100644 (file)
@@ -6,10 +6,11 @@
  * @uses array $vars['tabs'] A multi-dimensional array of tab entries in the format array(
  *     'title' => string, // Title of link
  *     'url' => string, // URL for the link
- *     'url_js' => string, // JS to pass to the link
+ *     'class' => string  // Class of the li element
+ *     'id' => string, // ID of the li element
+ *     'selected' => bool // if this li element is currently selected
  *     'url_class' => string, // Class to pass to the link
- *     'class' => string  // Class of the li element.
- *     'selected' => bool // if this link is currently selected
+ *     'url_id' => string, // ID to pass to the link
  * )
  */
 
@@ -26,6 +27,7 @@ if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) {
        <?php
        foreach ($vars['tabs'] as $info) {
                $class = elgg_get_array_value('class', $info, '');
+               $id = elgg_get_array_value('id', $info, '');
                
                $selected = elgg_get_array_value('selected', $info, FALSE);
                if ($selected) {
@@ -33,8 +35,9 @@ if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) {
                }
 
                $class_str = ($class) ? "class=\"$class\"" : '';
-               $title = htmlentities($info['title'], ENT_QUOTES, 'UTF-8');
-               $url = htmlentities($info['url'], ENT_QUOTES, 'UTF-8');
+               $id_str = ($id) ? "id=\"$id\"" : '';
+               $title = htmlspecialchars($info['title'], ENT_QUOTES, 'UTF-8');
+               $url = htmlspecialchars($info['url'], ENT_QUOTES, 'UTF-8');
 
                $options = array(
                        'href' => $url,
@@ -42,14 +45,14 @@ if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) {
                        'text' => $title
                );
 
-               if (isset($info['url_js'])) {
-                       $options['js'] = $info['url_js'];
-               }
-
                if (isset($info['url_class'])) {
                        $options['class'] = $info['url_class'];
                }
 
+               if (isset($info['url_id'])) {
+                       $options['internalid'] = $info['url_id'];
+               }
+
                $link = elgg_view('output/url', $options);
 
                echo "<li $class_str $js>$link</li>";