aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-20 17:07:20 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-20 17:07:20 +0000
commit26ca356ea7bb4521d763204fb68d0cba8086684b (patch)
tree03b123ed40eb6fc0b50cd8523ea1d8ec7ee6b6e3 /views/default/widgets
parent078d930d12f450f32f1b7d1976e5d3fe0aa01808 (diff)
downloadelgg-26ca356ea7bb4521d763204fb68d0cba8086684b.tar.gz
elgg-26ca356ea7bb4521d763204fb68d0cba8086684b.tar.bz2
Fixes #472 handling interactive adding/deleting of widgets with single/multiple instance constraints
git-svn-id: http://code.elgg.org/elgg/trunk@7385 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/widgets')
-rw-r--r--views/default/widgets/add_panel.php11
-rw-r--r--views/default/widgets/wrapper.php5
2 files changed, 13 insertions, 3 deletions
diff --git a/views/default/widgets/add_panel.php b/views/default/widgets/add_panel.php
index 09511487c..a010d1e9e 100644
--- a/views/default/widgets/add_panel.php
+++ b/views/default/widgets/add_panel.php
@@ -19,7 +19,8 @@ foreach ($widgets as $column_widgets) {
</p>
<ul>
<?php
- foreach ($widget_types as $handler => $widget_type) {
+ foreach ($widget_types as $handler => $widget_type) {
+ $id = "widget_type_$handler";
// check if widget added and only one instance allowed
if ($widget_type->multiple == false && in_array($handler, $current_handlers)) {
$class = 'widget_unavailable';
@@ -29,7 +30,13 @@ foreach ($widgets as $column_widgets) {
$tooltip = $widget_type->description;
}
- echo "<li title=\"$tooltip\" id=\"$handler\" class=\"$class\">$widget_type->name</li>";
+ if ($widget_type->multiple) {
+ $class .= ' widget_multiple';
+ } else {
+ $class .= ' widget_single';
+ }
+
+ echo "<li title=\"$tooltip\" id=\"$id\" class=\"$class\">$widget_type->name</li>";
}
?>
</ul>
diff --git a/views/default/widgets/wrapper.php b/views/default/widgets/wrapper.php
index 6963989f9..a8651e666 100644
--- a/views/default/widgets/wrapper.php
+++ b/views/default/widgets/wrapper.php
@@ -23,8 +23,11 @@ if (!$title) {
$can_edit = $widget->canEdit();
+$widget_id = "widget_$widget->guid";
+$widget_instance = "widget_instance_$handler";
+
?>
-<div class="widget draggable" id="widget_<?php echo $widget->guid; ?>">
+<div class="widget draggable <?php echo $widget_instance?>" id="<?php echo $widget_id; ?>">
<div class="widget_title drag_handle">
<h3><?php echo $title; ?></h3>
<?php