aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-20 18:54:26 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-20 18:54:26 +0000
commit9732dc7b1a96bc90ac21c29a222633af220ddb3f (patch)
treefa26bfdf223829c92d24c385a78f7cb51a8a64f6 /mod
parent2447aa071c65e99f9981059637054734f3951e0b (diff)
downloadelgg-9732dc7b1a96bc90ac21c29a222633af220ddb3f.tar.gz
elgg-9732dc7b1a96bc90ac21c29a222633af220ddb3f.tar.bz2
Riverdashboard now loads tabs via jQuery AJAX.
git-svn-id: https://code.elgg.org/elgg/trunk@2873 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r--mod/riverdashboard/index.php45
-rw-r--r--mod/riverdashboard/views/default/riverdashboard/container.php5
-rw-r--r--mod/riverdashboard/views/default/riverdashboard/js.php12
-rw-r--r--mod/riverdashboard/views/default/riverdashboard/nav.php38
4 files changed, 62 insertions, 38 deletions
diff --git a/mod/riverdashboard/index.php b/mod/riverdashboard/index.php
index f269c66ba..1afdb5bf4 100644
--- a/mod/riverdashboard/index.php
+++ b/mod/riverdashboard/index.php
@@ -19,24 +19,29 @@
$type = $content[0];
$subtype = $content[1];
$orient = get_input('display');
+ $callback = get_input('callback');
if ($type == 'all') {
$type = '';
$subtype = '';
}
- //set a view for the wire to extend
- $area1 = elgg_view("activity/thewire");
+ $body = '';
+ if (empty($callback)) {
- //set a view to display newest members
- $area1 .= elgg_view("riverdashboard/newestmembers");
-
- //set a view to display a welcome message
- $body = elgg_view("riverdashboard/welcome");
-
- //set a view to display a site wide message
- $body .= elgg_view("riverdashboard/sitemessage");
+ //set a view for the wire to extend
+ $area1 = elgg_view("activity/thewire");
+
+ //set a view to display newest members
+ $area1 .= elgg_view("riverdashboard/newestmembers");
+
+ //set a view to display a welcome message
+ $body .= elgg_view("riverdashboard/welcome");
+
+ //set a view to display a site wide message
+ $body .= elgg_view("riverdashboard/sitemessage");
+ }
switch($orient) {
case 'mine':
@@ -52,13 +57,17 @@
}
$river = elgg_view_river_items($subject_guid, 0, $relationship_type, $type, $subtype, '') . "</div>";
- $body .= elgg_view('riverdashboard/nav',array(
- 'type' => $type,
- 'subtype' => $subtype,
- 'orient' => $orient
- ));
- $body .= $river;
-
- echo page_draw(elgg_echo('dashboard'),elgg_view_layout('sidebar_boxes',$area1,$body));
+
+ $nav = elgg_view('riverdashboard/nav',array(
+ 'type' => $type,
+ 'subtype' => $subtype,
+ 'orient' => $orient
+ ));
+ if (empty($callback)) {
+ $body .= elgg_view('riverdashboard/container', array('body' => $nav . $river . elgg_view('riverdashboard/js')));
+ echo page_draw(elgg_echo('dashboard'),elgg_view_layout('sidebar_boxes',$area1,$body));
+ } else {
+ echo $nav . $river . elgg_view('riverdashboard/js');
+ }
?> \ No newline at end of file
diff --git a/mod/riverdashboard/views/default/riverdashboard/container.php b/mod/riverdashboard/views/default/riverdashboard/container.php
new file mode 100644
index 000000000..13a42f46d
--- /dev/null
+++ b/mod/riverdashboard/views/default/riverdashboard/container.php
@@ -0,0 +1,5 @@
+<?php
+
+?>
+
+<div id="river_container"><?php echo $vars['body']; ?></div> \ No newline at end of file
diff --git a/mod/riverdashboard/views/default/riverdashboard/js.php b/mod/riverdashboard/views/default/riverdashboard/js.php
new file mode 100644
index 000000000..828453e99
--- /dev/null
+++ b/mod/riverdashboard/views/default/riverdashboard/js.php
@@ -0,0 +1,12 @@
+<?php
+
+?>
+<script type="text/javascript">
+ $(document).ready(function() {
+
+ var href = $("div.river_pagination a").attr('href');
+ href = href.replace("callback=true","callback=");
+ $("div.river_pagination a").attr('href',href);
+
+ });
+</script> \ No newline at end of file
diff --git a/mod/riverdashboard/views/default/riverdashboard/nav.php b/mod/riverdashboard/views/default/riverdashboard/nav.php
index bfebf8420..1bb5fecca 100644
--- a/mod/riverdashboard/views/default/riverdashboard/nav.php
+++ b/mod/riverdashboard/views/default/riverdashboard/nav.php
@@ -28,29 +28,27 @@
<div class="contentWrapper">
<div id="elgg_horizontal_tabbed_nav">
<ul>
- <li <?php echo $allselect; ?> ><a href="?type=<?php echo $vars['type']; ?>&content=<?php echo $vars['subtype']; ?>"><?php echo elgg_echo('all'); ?></a></li>
- <li <?php echo $friendsselect; ?> ><a href="?type=<?php echo $vars['type']; ?>&display=friends&content=<?php echo $vars['subtype']; ?>"><?php echo elgg_echo('friends'); ?></a></li>
- <li <?php echo $mineselect; ?> ><a href="?type=<?php echo $vars['type']; ?>&display=mine&content=<?php echo $vars['subtype']; ?>"><?php echo elgg_echo('mine'); ?></a></li>
+ <li <?php echo $allselect; ?> ><a onclick="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?type=<?php echo $vars['type']; ?>&content=<?php echo $vars['subtype']; ?>&callback=true'); return false;" href="?type=<?php echo $vars['type']; ?>&content=<?php echo $vars['subtype']; ?>"><?php echo elgg_echo('all'); ?></a></li>
+ <li <?php echo $friendsselect; ?> ><a onclick="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?type=<?php echo $vars['type']; ?>&display=friends&content=<?php echo $vars['subtype']; ?>&callback=true'); return false;" href="?type=<?php echo $vars['type']; ?>&display=friends&content=<?php echo $vars['subtype']; ?>"><?php echo elgg_echo('friends'); ?></a></li>
+ <li <?php echo $mineselect; ?> ><a onclick="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?type=<?php echo $vars['type']; ?>&display=mine&content=<?php echo $vars['subtype']; ?>&callback=true'); return false;" href="?type=<?php echo $vars['type']; ?>&display=mine&content=<?php echo $vars['subtype']; ?>"><?php echo elgg_echo('mine'); ?></a></li>
</ul>
</div>
<div class="riverdashboard_filtermenu">
- <form action="index.php">
- <select name="content">
- <?php
-
- foreach($contents as $label => $content) {
- if (("{$vars['type']},{$vars['subtype']}" == $content) ||
- (empty($vars['subtype']) && $content == 'all')) {
- $selected = 'selected="selected"';
- } else $selected = '';
- echo "<option value=\"{$content}\" {$selected}>".elgg_echo($label)."</option>";
- }
-
- ?>
- </select>
- <input type="hidden" name="display" value="<?php echo htmlentities($vars['orient']); ?>" />
- <!-- <input type="submit" value="<?php echo elgg_echo('filter'); ?>" /> -->
- </form>
+ <select name="content" id="content" onchange="javascript:$('#river_container').load('<?php echo $vars['url']; ?>mod/riverdashboard/?callback=true&display='+$('input#display').val() + '&content=' + $('select#content').val());">
+ <?php
+
+ foreach($contents as $label => $content) {
+ if (("{$vars['type']},{$vars['subtype']}" == $content) ||
+ (empty($vars['subtype']) && $content == 'all')) {
+ $selected = 'selected="selected"';
+ } else $selected = '';
+ echo "<option value=\"{$content}\" {$selected}>".elgg_echo($label)."</option>";
+ }
+
+ ?>
+ </select>
+ <input type="hidden" name="display" id="display" value="<?php echo htmlentities($vars['orient']); ?>" />
+ <!-- <input type="submit" value="<?php echo elgg_echo('filter'); ?>" /> -->
</div>
<!-- </div> --> \ No newline at end of file