Elgg  Version 1.9
admin.php
Go to the documentation of this file.
1 <?php
8 ?>
9 //<script>
10 elgg.provide('elgg.admin');
11 
12 elgg.admin.init = function () {
13 
14  // system messages do not fade in admin area, instead slide up when clicked
15  $('.elgg-system-messages li').stop(true);
16  $('.elgg-system-messages li').die('click');
17  $('.elgg-system-messages li').live('click', function() {
18  $(this).stop().slideUp('medium');
19  });
20 
21  // draggable plugin reordering
22  $('#elgg-plugin-list > ul').sortable({
23  items: 'li:has(> .elgg-state-draggable)',
24  handle: '.elgg-head',
25  forcePlaceholderSize: true,
26  placeholder: 'elgg-widget-placeholder',
27  opacity: 0.8,
28  revert: 500,
29  stop: elgg.admin.movePlugin
30  });
31 
32  // in-line editing for custom profile fields.
33  // @note this requires jquery.jeditable plugin
34  $(".elgg-state-editable").editable(elgg.admin.editProfileField, {
35  type: 'text',
36  onblur: 'submit',
37  width: '300px',
38  height: 'none',
39  style: 'display:inline;'
40  });
41 
42  // draggable profile field reordering.
43  $('#elgg-profile-fields').sortable({
44  items: 'li',
45  handle: 'span.elgg-state-draggable',
46  stop: elgg.admin.moveProfileField
47  });
48 
49  // admin notices delete ajax
50  $('a.elgg-admin-notice').click(elgg.admin.deleteNotice);
51 
52  // disable checkboxes (readonly does not work for them)
53  $('input:checkbox.elgg-state-disabled').live('click', function() {return false;});
54 
55  // disable simple cache compress settings if simple cache is off
56  $('[name=simplecache_enabled]').click(elgg.admin.simplecacheToggle);
57 };
58 
66 elgg.admin.movePlugin = function(e, ui) {
67  // get guid from id like elgg-object-<guid>
68  var pluginGuid = ui.item.attr('id');
69  pluginGuid = pluginGuid.replace('elgg-object-', '');
70 
71  elgg.action('admin/plugins/set_priority', {
72  data: {
73  plugin_guid: pluginGuid,
74  // we start at priority 1
75  priority: ui.item.index() + 1
76  },
77  success: function() {
78  // update plugins with priority dependences
79  var priorityDep = new RegExp(elgg.echo('ElggPlugin:Dependencies:Priority'));
80  ui.item.siblings().andSelf().each(function() {
81  if (priorityDep.test($(this).find('.elgg-dependency-requires').text())) {
82  elgg.admin.updatePluginView($(this));
83  }
84  });
85  }
86  });
87 };
88 
95 elgg.admin.updatePluginView = function(pluginView) {
96  // get guid from id like elgg-object-<guid>
97  var pluginGuid = pluginView.attr('id');
98  pluginGuid = pluginGuid.replace('elgg-object-', '');
99 
100  elgg.get({
101  url: elgg.config.wwwroot + "ajax/view/object/plugin/full",
102  dataType: "html",
103  cache: false,
104  data: {
105  guid: pluginGuid,
106  display_reordering: true
107  },
108  success: function(htmlData) {
109  if (htmlData.length > 0) {
110  pluginView.html(htmlData);
111  }
112  }
113  });
114 }
115 
123 elgg.admin.editProfileField = function(value, settings) {
124  var id = $(this).attr('id');
125  id = id.replace('elgg-profile-field-', '');
126 
127  var data = {
128  id: id,
129  label: value
130  };
131 
132  elgg.action('profile/fields/edit', data);
133  return value;
134 };
135 
143 elgg.admin.moveProfileField = function(e, ui) {
144  var orderArr = $('#elgg-profile-fields').sortable('toArray');
145  var orderStr = orderArr.join(',');
146 
147  elgg.action('profile/fields/reorder', {
148  fieldorder: orderStr
149  });
150 };
151 
157 elgg.admin.deleteNotice = function(e) {
158  e.preventDefault();
159  var $container = $(this).closest('p');
160 
161  elgg.action($(this).attr('href'), {
162  success: function(json) {
163  $container.slideUp('medium');
164  }
165  });
166 };
167 
173 elgg.admin.simplecacheToggle = function() {
174  // when the checkbox is disabled, do not toggle the compression checkboxes
175  if (!$(this).hasClass('elgg-state-disabled')) {
176  var names = ['simplecache_minify_js', 'simplecache_minify_css'];
177  for (var i = 0; i < names.length; i++) {
178  var $input = $('input[type!=hidden][name="' + names[i] + '"]');
179  if ($input.length) {
180  $input.parent().toggleClass('elgg-state-disabled');
181  }
182  }
183  }
184 };
185 
186 elgg.register_hook_handler('init', 'system', elgg.admin.init, 1000);
elgg message elgg state success
Definition: admin.php:243
elgg
Definition: install.js:23
i
Definition: admin.php:47
elgg module widget elgg state draggable elgg widget handle
Definition: admin.php:1183
if(!$owner||!($owner instanceof ElggUser)||!$owner->canEdit()) $input
Definition: edit.php:19
elgg form settings
Definition: admin.php:562
min width
Definition: admin.php:166
$pages items
Definition: pagination.php:62
elgg widget placeholder
Definition: admin.php:1222
function elgg combo checkbox click(function(){if($(this).is(':checked')){$(this).prev().attr('disabled', true);$(this).prev().val('');}else{$(this).prev().attr('disabled', false);}})
elgg input elgg input elgg input url
Definition: admin.php:478
list style
Definition: admin.php:1148
label
Definition: admin.php:452
list style type
Definition: admin.php:724
$container
Definition: access.php:30
line height
Definition: admin.php:82