This repository has been archived by the owner on Apr 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
88 lines (76 loc) · 2.51 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Accessibility / Usability issues addressed:
(Github #22, #23, #68, #34, #71, #76, #69)
#71 fixed separately in widget manager mod.
Overrides:
functions from file js/lib/ui.widgets.js:
elgg.ui.widgets.init
elgg.ui.widgets.add
elgg.ui.widgets.remove
View:
page/layouts/widgets/add_button.php
#34:
Requires removal of line 31 in js/lib/ui.widget.js core:
$('a.elgg-widget-collapse-button').live('click', elgg.ui.widgets.collapseToggle);
Also requires patch to engine/lib/navigation.php:
function widget_check_collapsed_state($widget_guid, $state) {
static $collapsed_widgets_state;
$user_guid = elgg_get_logged_in_user_guid();
//return $widget_guid;
if (empty($user_guid)) {
return false;
}
if (!isset($collapsed_widgets_state)) {
$collapsed_widgets_state = array();
$dbprefix = elgg_get_config("dbprefix");
$query = "SELECT * FROM {$dbprefix}entity_relationships WHERE guid_one = $user_guid AND relationship IN ('widget_state_collapsed', 'widget_state_open')";
$result = get_data($query);
$i=0;
if ($result) {
foreach ($result as $row) {
if (!isset($collapsed_widgets_state[$row->guid_two])) {
$collapsed_widgets_state[$row->guid_two] = array();
}
$collapsed_widgets_state[$row->guid_two][] = $row->relationship;
$ids[$i++] = $row->guid_two;
}
}
}
if (!array_key_exists($widget_guid, $collapsed_widgets_state)) {
return -1;
}
if (in_array($state, $collapsed_widgets_state[$widget_guid])) {
return true;
}
return false;
}
/**
* Widget menu is a set of widget controls
* @access private
*/
function elgg_widget_menu_setup($hook, $type, $return, $params) {
-
+// For Widget Manager collapse state storage function from elgg1.9 version of Widget Manager
+$widget_is_collapsed = false;
+$widget_is_open = true;
+
$widget = $params['entity'];
+
+if (elgg_is_logged_in()) {
+ $widget_is_collapsed = widget_check_collapsed_state($widget->guid, "widget_state_collapsed");
+ $widget_is_open = widget_check_collapsed_state($widget->guid, "widget_state_open");
+}
+if ( $widget_is_collapsed && !$widget_is_open ) $collapse_class = "elgg-widget-collapse-button elgg-state-active elgg-widget-collapsed";
+else $collapse_class = "elgg-widget-collapse-button";
+
+
/* @var ElggWidget $widget */
$show_edit = elgg_extract('show_edit', $params, true);
@@ -449,7 +497,7 @@ function elgg_widget_menu_setup($hook, $type, $return, $params) {
'name' => 'collapse',
'text' => ' ',
'href' => "#elgg-widget-content-$widget->guid",
- 'class' => 'elgg-widget-collapse-button',
+ 'class' => $collapse_class,
'rel' => 'toggle',
'priority' => 1
);