Elgg  Version 1.12
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(e) {
18  if (!$(e.target).is('a')) {
19  $(this).stop().slideUp('medium');
20  }
21  });
22 
23  // draggable plugin reordering
24  $('#elgg-plugin-list > ul').sortable({
25  items: 'li:has(> .elgg-state-draggable)',
26  handle: '.elgg-head',
27  forcePlaceholderSize: true,
28  placeholder: 'elgg-widget-placeholder',
29  opacity: 0.8,
30  revert: 500,
31  stop: elgg.admin.movePlugin
32  });
33 
34  // in-line editing for custom profile fields.
35  // @note this requires jquery.jeditable plugin
36  $(".elgg-state-editable").editable(elgg.admin.editProfileField, {
37  type: 'text',
38  onblur: 'submit',
39  width: '300px',
40  height: 'none',
41  style: 'display:inline;'
42  });
43 
44  // draggable profile field reordering.
45  $('#elgg-profile-fields').sortable({
46  items: 'li',
47  handle: 'span.elgg-state-draggable',
48  stop: elgg.admin.moveProfileField
49  });
50 
51  // admin notices delete ajax
52  $('a.elgg-admin-notice').click(elgg.admin.deleteNotice);
53 
54  // disable checkboxes (readonly does not work for them)
55  $('input:checkbox.elgg-state-disabled, label.elgg-state-disabled > input:checkbox')
56  .live('click', function() {return false;});
57 
58  // disable simple cache compress settings if simple cache is off
59  $('[name=simplecache_enabled]').click(elgg.admin.simplecacheToggle);
60 };
61 
69 elgg.admin.movePlugin = function(e, ui) {
70  // get guid from id like elgg-object-<guid>
71  var pluginGuid = ui.item.attr('id');
72  pluginGuid = pluginGuid.replace('elgg-object-', '');
73 
74  elgg.action('admin/plugins/set_priority', {
75  data: {
76  plugin_guid: pluginGuid,
77  // we start at priority 1
78  priority: ui.item.index() + 1
79  },
80  success: function() {
81  // update plugins with priority dependences
82  var priorityDep = new RegExp(elgg.echo('ElggPlugin:Dependencies:Priority'));
83  ui.item.siblings().andSelf().each(function() {
84  if (priorityDep.test($(this).find('.elgg-dependency-requires').text())) {
85  elgg.admin.updatePluginView($(this));
86  }
87  });
88  }
89  });
90 };
91 
98 elgg.admin.updatePluginView = function(pluginView) {
99  // get guid from id like elgg-object-<guid>
100  var pluginGuid = pluginView.attr('id');
101  pluginGuid = pluginGuid.replace('elgg-object-', '');
102 
103  elgg.get({
104  url: elgg.config.wwwroot + "ajax/view/object/plugin/full",
105  dataType: "html",
106  cache: false,
107  data: {
108  guid: pluginGuid,
109  display_reordering: true
110  },
111  success: function(htmlData) {
112  if (htmlData.length > 0) {
113  pluginView.html(htmlData);
114  }
115  }
116  });
117 }
118 
126 elgg.admin.editProfileField = function(value, settings) {
127  var id = $(this).attr('id');
128  id = id.replace('elgg-profile-field-', '');
129 
130  var data = {
131  id: id,
132  label: value
133  };
134 
135  elgg.action('profile/fields/edit', data);
136  return value;
137 };
138 
146 elgg.admin.moveProfileField = function(e, ui) {
147  var orderArr = $('#elgg-profile-fields').sortable('toArray');
148  var orderStr = orderArr.join(',');
149 
150  elgg.action('profile/fields/reorder', {
151  fieldorder: orderStr
152  });
153 };
154 
160 elgg.admin.deleteNotice = function(e) {
161  e.preventDefault();
162  var $container = $(this).closest('p');
163 
164  elgg.action($(this).attr('href'), {
165  success: function(json) {
166  $container.slideUp('medium');
167  }
168  });
169 };
170 
176 elgg.admin.simplecacheToggle = function() {
177  // when the checkbox is disabled, do not toggle the compression checkboxes
178  if (!$(this).hasClass('elgg-state-disabled')) {
179  var names = ['simplecache_minify_js', 'simplecache_minify_css'];
180  for (var i = 0; i < names.length; i++) {
181  var $input = $('input[type!=hidden][name="' + names[i] + '"]');
182  if ($input.length) {
183  $input.parent().toggleClass('elgg-state-disabled');
184  }
185  }
186  }
187 };
188 
189 elgg.register_hook_handler('init', 'system', elgg.admin.init, 1000);
elgg message elgg state success
Definition: admin.php:252
elgg
Definition: install.js:23
i
Definition: admin.php:47
elgg module widget elgg state draggable elgg widget handle
Definition: admin.php:1214
if(!$owner||!($owner instanceof ElggUser)||!$owner->canEdit()) $input
Definition: edit.php:19
elgg form settings
Definition: admin.php:584
min width
Definition: admin.php:166
if($entity) $container
Definition: access.php:62
elgg widget placeholder
Definition: admin.php:1253
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:494
list style
Definition: admin.php:1179
label
Definition: admin.php:464
list style type
Definition: admin.php:753
line height
Definition: admin.php:82