aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-19 22:51:23 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-19 22:51:23 +0000
commit1f68d84ee83efd73ce5fec5af7a14a1fb234977a (patch)
treec218e5282a9c536e921b35c2a8448c04cb4a8f05
parent8784c7282009b9cd14b166d57617525424ef94a5 (diff)
downloadelgg-1f68d84ee83efd73ce5fec5af7a14a1fb234977a.tar.gz
elgg-1f68d84ee83efd73ce5fec5af7a14a1fb234977a.tar.bz2
fixed a few bugs and updated the widget code
git-svn-id: http://code.elgg.org/elgg/trunk@7694 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--actions/widgets/save.php3
-rw-r--r--engine/classes/ElggDiskFilestore.php2
-rw-r--r--js/lib/ui.js2
-rw-r--r--js/lib/ui.widgets.js36
-rw-r--r--mod/pages/views/default/pages/pagelisting.php4
-rw-r--r--mod/pages/views/default/pages/pageprofile.php4
-rw-r--r--pages/dashboard.php2
-rw-r--r--views/default/css/screen.php7
-rw-r--r--views/default/graphics/ajax_loader.php8
-rw-r--r--views/default/layout/objects/widget/controls.php7
-rw-r--r--views/default/layout/objects/widget/settings.php2
-rw-r--r--views/default/layout/shells/widgets.php4
12 files changed, 43 insertions, 38 deletions
diff --git a/actions/widgets/save.php b/actions/widgets/save.php
index 8854d7810..a78f4ca75 100644
--- a/actions/widgets/save.php
+++ b/actions/widgets/save.php
@@ -11,7 +11,8 @@ $params = get_input('params');
$widget = get_entity($guid);
if ($widget && $widget->saveSettings($params)) {
- $view = "widgets/$widget->handler/view";
+ elgg_set_page_owner_guid($widget->getContainerGUID());
+ $view = "widgets/$widget->handler/content";
echo elgg_view($view, array('entity' => $widget));
} else {
register_error(elgg_echo('widgets:save:failure'));
diff --git a/engine/classes/ElggDiskFilestore.php b/engine/classes/ElggDiskFilestore.php
index c7ca9fd05..774054842 100644
--- a/engine/classes/ElggDiskFilestore.php
+++ b/engine/classes/ElggDiskFilestore.php
@@ -63,7 +63,7 @@ class ElggDiskFilestore extends ElggFilestore {
// Try and create the directory
try {
- $this->make_directory_root($path);
+ $this->makeDirectoryRoot($path);
} catch (Exception $e) {
}
diff --git a/js/lib/ui.js b/js/lib/ui.js
index 1ebc3bca6..c7eda593c 100644
--- a/js/lib/ui.js
+++ b/js/lib/ui.js
@@ -6,7 +6,7 @@ elgg.ui.init = function () {
$(this).stop().fadeOut('fast');
});
- $('.elgg-toggle').click(elgg.ui.toggle);
+ $('.elgg-toggle').live('click', elgg.ui.toggle);
$('a.collapsibleboxlink').click(elgg.ui.toggleCollapsibleBox);
diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js
index 867b53af5..87f552d50 100644
--- a/js/lib/ui.widgets.js
+++ b/js/lib/ui.widgets.js
@@ -24,10 +24,10 @@ elgg.ui.widgets.init = function() {
});
$('.elgg-widgets-add-panel li.elgg-widget-available').click(elgg.ui.widgets.add);
- $('a.elgg-widget-delete-button').click(elgg.ui.widgets.remove);
- $('a.elgg-widget-edit-button').click(elgg.ui.widgets.editToggle);
- $('.elgg-widget-edit > form ').submit(elgg.ui.widgets.saveSettings);
- $('a.elgg-widget-collapse-button').click(elgg.ui.widgets.collapseToggle);
+
+ $('a.elgg-widget-delete-button').live('click', elgg.ui.widgets.remove);
+ $('.elgg-widget-edit > form ').live('submit', elgg.ui.widgets.saveSettings);
+ $('a.elgg-widget-collapse-button').live('click', elgg.ui.widgets.collapseToggle);
elgg.ui.widgets.equalHeight(".elgg-widgets");
};
@@ -62,10 +62,6 @@ elgg.ui.widgets.add = function(event) {
success: function(json) {
$('#elgg-widget-col-1').prepend(json.output);
var $widget = $('#elgg-widget-col-1').children(":first");
- $widget.find('a.elgg-widget-delete-button').click(elgg.ui.widgets.remove);
- $widget.find('a.elgg-widget-edit-button').click(elgg.ui.widgets.editToggle);
- $widget.find('a.elgg-widget-collapse-button').click(elgg.ui.widgets.collapseToggle);
- $widget.find('.elgg-widget-edit > form ').submit(elgg.ui.widgets.saveSettings);
}
});
event.preventDefault();
@@ -141,20 +137,7 @@ elgg.ui.widgets.remove = function(event) {
}
/**
- * Toggle the edit panel of a widget
- *
- * Yes, I'm quite bad at selectors.
- *
- * @param {Object} event
- * @return void
- */
-elgg.ui.widgets.editToggle = function(event) {
- $(this).parent().parent().find('.elgg-widget-edit').slideToggle('medium');
- event.preventDefault();
-}
-
-/**
- * Toogle the collapse state of the widget
+ * Toggle the collapse state of the widget
*
* @param {Object} event
* @return void
@@ -176,8 +159,13 @@ elgg.ui.widgets.collapseToggle = function(event) {
elgg.ui.widgets.saveSettings = function(event) {
$(this).parent().slideToggle('medium');
var $widgetContent = $(this).parent().parent().children('.elgg-widget-content');
- // @todo - change to ajax loader
- $widgetContent.html('loading');
+
+ // stick the ajaxk loader in there
+ var $loader = $('#elgg-widget-loader').clone();
+ $loader.attr('id', '#elgg-widget-active-loader');
+ $loader.removeClass('hidden');
+ $widgetContent.html($loader);
+
elgg.action('widgets/save', {
data: $(this).serialize(),
success: function(json) {
diff --git a/mod/pages/views/default/pages/pagelisting.php b/mod/pages/views/default/pages/pagelisting.php
index 0c4a411fb..b5034313f 100644
--- a/mod/pages/views/default/pages/pagelisting.php
+++ b/mod/pages/views/default/pages/pagelisting.php
@@ -24,9 +24,9 @@ if ($latest) {
$info .= "<p class=\"owner_timestamp\">" . elgg_echo("pages:strapline",
- array(elgg_view_friendly_time($time_updated)),
+ array(elgg_view_friendly_time($time_updated),
"<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"
- ) . "</p>";
+ )) . "</p>";
}
echo elgg_view_listing($icon, $info);
diff --git a/mod/pages/views/default/pages/pageprofile.php b/mod/pages/views/default/pages/pageprofile.php
index 7008e668c..f8399556a 100644
--- a/mod/pages/views/default/pages/pageprofile.php
+++ b/mod/pages/views/default/pages/pageprofile.php
@@ -63,9 +63,9 @@ if ($rev) {
$owner = get_entity($owner_guid);
echo elgg_echo("pages:strapline",
- array(elgg_view_friendly_time($time_updated)),
+ array(elgg_view_friendly_time($time_updated),
"<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>"
- );
+ ));
?>
</p>
diff --git a/pages/dashboard.php b/pages/dashboard.php
index c6a24773a..6cd19e1cf 100644
--- a/pages/dashboard.php
+++ b/pages/dashboard.php
@@ -11,7 +11,7 @@ gatekeeper();
// Set context and title
elgg_set_context('dashboard');
-set_page_owner(get_loggedin_userid());
+elgg_set_page_owner_guid(get_loggedin_userid());
$title = elgg_echo('dashboard');
// wrap intro message in a div
diff --git a/views/default/css/screen.php b/views/default/css/screen.php
index a96aaaa90..129a8c637 100644
--- a/views/default/css/screen.php
+++ b/views/default/css/screen.php
@@ -150,6 +150,7 @@ echo elgg_view('css/elements/skin', $vars);
padding: 10px;
margin: 0 5px 15px;
background: #dedede;
+ border: 2px solid #cccccc;
}
.elgg-widgets-add-panel ul {
padding: 0;
@@ -162,13 +163,19 @@ echo elgg_view('css/elements/skin', $vars);
width: 200px;
padding: 4px;
background-color: #cccccc;
+ border: 2px solid #b0b0b0;
+ font-weight: bold;
}
.elgg-widgets-add-panel li a {
display: block;
}
.elgg-widget-available {
+ color: #333333;
cursor: pointer;
}
+.elgg-widget-available:hover {
+ background-color: #bcbcbc;
+}
.elgg-widget-unavailable {
color: #888888;
}
diff --git a/views/default/graphics/ajax_loader.php b/views/default/graphics/ajax_loader.php
index b1f35971a..e539188f2 100644
--- a/views/default/graphics/ajax_loader.php
+++ b/views/default/graphics/ajax_loader.php
@@ -4,11 +4,17 @@
*
* @package Elgg
* @subpackage Core
+ *
+ * @uses $vars['id']
*/
+if (isset($vars['internalid'])) {
+ $id = "id=\"{$vars['internalid']}\"";
+}
+
$loader = <<< END
-<div align="center" class="ajax-loader hidden"></div>
+<div align="center" class="ajax-loader hidden" $id></div>
END;
diff --git a/views/default/layout/objects/widget/controls.php b/views/default/layout/objects/widget/controls.php
index b07a42e22..79e434f1a 100644
--- a/views/default/layout/objects/widget/controls.php
+++ b/views/default/layout/objects/widget/controls.php
@@ -12,7 +12,8 @@ $params = array(
'text' => ' ',
'href' => "#",
'class' => 'elgg-widget-collapse-button',
- 'internalid' => "elgg-widget-collapse-button-$widget->guid"
+// 'internalid' => "elgg-toggler-widget-$widget->guid"
+// 'internalid' => "elgg-widget-collapse-button-$widget->guid"
);
$collapse_link = elgg_view('output/url', $params);
@@ -30,8 +31,8 @@ $params = array(
'text' => ' ',
'title' => elgg_echo('widget:edit'),
'href' => "#",
- 'class' => 'elgg-widget-edit-button',
- 'internalid' => "elgg-widget-edit-button-$widget->guid"
+ 'class' => 'elgg-widget-edit-button elgg-toggle',
+ 'internalid' => "elgg-toggler-widget-$widget->guid"
);
$edit_link = elgg_view('output/url', $params);
diff --git a/views/default/layout/objects/widget/settings.php b/views/default/layout/objects/widget/settings.php
index c1e00c3f1..8020983c6 100644
--- a/views/default/layout/objects/widget/settings.php
+++ b/views/default/layout/objects/widget/settings.php
@@ -33,7 +33,7 @@ $body = <<<___END
___END;
?>
-<div class="elgg-widget-edit">
+<div class="elgg-widget-edit" id="elgg-togglee-widget-<?php echo $widget->guid; ?>">
<?php
$params = array(
'body' => $body,
diff --git a/views/default/layout/shells/widgets.php b/views/default/layout/shells/widgets.php
index 0c21e7042..82489b37f 100644
--- a/views/default/layout/shells/widgets.php
+++ b/views/default/layout/shells/widgets.php
@@ -43,4 +43,6 @@ for ($column_index = 1; $column_index <= $num_columns; $column_index++) {
echo '</div>';
}
-elgg_pop_context(); \ No newline at end of file
+elgg_pop_context();
+
+echo elgg_view('graphics/ajax_loader', array('internalid' => 'elgg-widget-loader')); \ No newline at end of file