Elgg  Version 1.11
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, label.elgg-state-disabled > input:checkbox')
54  .live('click', function() {return false;});
55 
56  // disable simple cache compress settings if simple cache is off
57  $('[name=simplecache_enabled]').click(elgg.admin.simplecacheToggle);
58 };
59 
67 elgg.admin.movePlugin = function(e, ui) {
68  // get guid from id like elgg-object-<guid>
69  var pluginGuid = ui.item.attr('id');
70  pluginGuid = pluginGuid.replace('elgg-object-', '');
71 
72  elgg.action('admin/plugins/set_priority', {
73  data: {
74  plugin_guid: pluginGuid,
75  // we start at priority 1
76  priority: ui.item.index() + 1
77  },
78  success: function() {
79  // update plugins with priority dependences
80  var priorityDep = new RegExp(elgg.echo('ElggPlugin:Dependencies:Priority'));
81  ui.item.siblings().andSelf().each(function() {
82  if (priorityDep.test($(this).find('.elgg-dependency-requires').text())) {
83  elgg.admin.updatePluginView($(this));
84  }
85  });
86  }
87  });
88 };
89 
96 elgg.admin.updatePluginView = function(pluginView) {
97  // get guid from id like elgg-object-<guid>
98  var pluginGuid = pluginView.attr('id');
99  pluginGuid = pluginGuid.replace('elgg-object-', '');
100 
101  elgg.get({
102  url: elgg.config.wwwroot + "ajax/view/object/plugin/full",
103  dataType: "html",
104  cache: false,
105  data: {
106  guid: pluginGuid,
107  display_reordering: true
108  },
109  success: function(htmlData) {
110  if (htmlData.length > 0) {
111  pluginView.html(htmlData);
112  }
113  }
114  });
115 }
116 
124 elgg.admin.editProfileField = function(value, settings) {
125  var id = $(this).attr('id');
126  id = id.replace('elgg-profile-field-', '');
127 
128  var data = {
129  id: id,
130  label: value
131  };
132 
133  elgg.action('profile/fields/edit', data);
134  return value;
135 };
136 
144 elgg.admin.moveProfileField = function(e, ui) {
145  var orderArr = $('#elgg-profile-fields').sortable('toArray');
146  var orderStr = orderArr.join(',');
147 
148  elgg.action('profile/fields/reorder', {
149  fieldorder: orderStr
150  });
151 };
152 
158 elgg.admin.deleteNotice = function(e) {
159  e.preventDefault();
160  var $container = $(this).closest('p');
161 
162  elgg.action($(this).attr('href'), {
163  success: function(json) {
164  $container.slideUp('medium');
165  }
166  });
167 };
168 
174 elgg.admin.simplecacheToggle = function() {
175  // when the checkbox is disabled, do not toggle the compression checkboxes
176  if (!$(this).hasClass('elgg-state-disabled')) {
177  var names = ['simplecache_minify_js', 'simplecache_minify_css'];
178  for (var i = 0; i < names.length; i++) {
179  var $input = $('input[type!=hidden][name="' + names[i] + '"]');
180  if ($input.length) {
181  $input.parent().toggleClass('elgg-state-disabled');
182  }
183  }
184  }
185 };
186 
187 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:1209
if(!$owner||!($owner instanceof ElggUser)||!$owner->canEdit()) $input
Definition: edit.php:19
elgg form settings
Definition: admin.php:579
min width
Definition: admin.php:166
if($entity) $container
Definition: access.php:62
elgg widget placeholder
Definition: admin.php:1248
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:490
list style
Definition: admin.php:1174
label
Definition: admin.php:460
list style type
Definition: admin.php:748
line height
Definition: admin.php:82