aboutsummaryrefslogtreecommitdiff
path: root/views/default/admin
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-18 23:18:43 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-18 23:18:43 +0000
commit0b5a24d7943c6f8bc275d1160f4060b337a3cf7a (patch)
tree105769cfd0c1d29c75fe368b989c5380536aa40a /views/default/admin
parent09d08af9814a4edfb2050cdb47ad8ae20a944472 (diff)
downloadelgg-0b5a24d7943c6f8bc275d1160f4060b337a3cf7a.tar.gz
elgg-0b5a24d7943c6f8bc275d1160f4060b337a3cf7a.tar.bz2
continuing to slash and burn the profile plugin - moving the admin profile fields into core - last major change
git-svn-id: http://code.elgg.org/elgg/trunk@7673 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/admin')
-rw-r--r--views/default/admin/appearance/profile_fields.php21
-rw-r--r--views/default/admin/appearance/profile_fields/list.php88
2 files changed, 109 insertions, 0 deletions
diff --git a/views/default/admin/appearance/profile_fields.php b/views/default/admin/appearance/profile_fields.php
new file mode 100644
index 000000000..f20bbaeb6
--- /dev/null
+++ b/views/default/admin/appearance/profile_fields.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Admin area: edit default profile fields
+ */
+
+$title = elgg_view_title(elgg_echo('admin:profile:fields'));
+
+$add = elgg_view_form('profile/fields/add', array(), array());
+$list = elgg_view('admin/appearance/profile_fields/list');
+$reset = elgg_view_form('profile/fields/reset', array(), array());
+
+$body = <<<__HTML
+$title
+$add
+$list
+<div class="default_profile_reset">
+ $reset
+</div>
+__HTML;
+
+echo $body;
diff --git a/views/default/admin/appearance/profile_fields/list.php b/views/default/admin/appearance/profile_fields/list.php
new file mode 100644
index 000000000..bbd6dccd2
--- /dev/null
+++ b/views/default/admin/appearance/profile_fields/list.php
@@ -0,0 +1,88 @@
+<?php
+
+
+// List form elements
+$n = 0;
+$loaded_defaults = array();
+$items = array();
+if ($fieldlist = get_plugin_setting('user_defined_fields', 'profile')) {
+ $fieldlistarray = explode(',', $fieldlist);
+ foreach($fieldlistarray as $listitem) {
+ if ($translation = get_plugin_setting("admin_defined_profile_{$listitem}", 'profile')) {
+ $item = new stdClass;
+ $item->translation = $translation;
+ $item->shortname = $listitem;
+ $item->name = "admin_defined_profile_{$listitem}";
+ $item->type = get_plugin_setting("admin_defined_profile_type_{$listitem}", 'profile');
+ $items[] = $item;
+ }
+ }
+}
+?>
+
+<script language="javascript" type="text/javascript" src="<?php echo elgg_get_site_url()?>vendors/jquery/jquery.jeditable.mini.js"></script>
+<script language="javascript" type="text/javascript">
+var reorderURL = '<?php echo elgg_add_action_tokens_to_url(elgg_get_site_url() . 'action/profile/fields/reorder', FALSE); ?>';
+function sortCallback(event, ui) {
+ var orderArr = $('#sortable_profile_fields').sortable('toArray');
+ var orderStr = orderArr.join(',');
+ jQuery.post(reorderURL, {'fieldorder': orderStr});
+}
+
+$(document).ready(function() {
+ $('#sortable_profile_fields').sortable({
+ items: 'li',
+ handle: '.handle',
+ stop: sortCallback
+ });
+});
+
+</script>
+
+<div id="list">
+ <ul id="sortable_profile_fields">
+<?php
+
+ $save = elgg_echo('save');
+ $cancel = elgg_echo('cancel');
+ $edit_url = elgg_add_action_tokens_to_url(elgg_get_site_url()."action/profile/editdefault/editfield", FALSE);
+
+ foreach($items as $item) {
+ echo <<< END
+
+<script language="javascript" type="text/javascript">
+
+ $(function() {
+ $(".{$item->shortname}_editable").editable("$edit_url ", {
+ type : 'text',
+ submitdata: { _method: "post", 'field': '{$item->shortname}' },
+ onblur: 'submit',
+ width:'300px',
+ height:'none',
+ style:'display:inline;',
+ tooltip:'Click to edit label'
+ });
+ });
+
+</script>
+
+END;
+
+ echo elgg_view("profile/", array('value' => $item->translation));
+
+ //$even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even';
+ $url = elgg_add_action_tokens_to_url(elgg_get_site_url()."action/profile/fields/delete?id={$item->shortname}");
+ echo "<li id=\"{$item->shortname}\"><div class='delete-button'><a href=\"$url\">" . elgg_echo('delete') . "</a></div>";
+ echo "<img width='16' height='16' class='handle' alt='move' title='Drag here to reorder this item' src='".elgg_get_site_url()."mod/profile/graphics/drag-handle.png'/>";
+ echo "<b class=\"profile_field_editable\"><span class=\"{$item->shortname}_editable\">$item->translation</span></b>: [".elgg_echo($item->type)."]";
+ echo "</li>";
+
+ }
+
+?>
+ </ul>
+</div>
+<div id="tempList"></div>
+
+<input name="sortableListOrder" type="hidden" id="sortableListOrder" value="<?php echo $fieldlist; ?>" />
+