aboutsummaryrefslogtreecommitdiff
path: root/mod/profile/views/default
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-07 16:11:29 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-07 16:11:29 +0000
commit68f2c92868ddf477568c1dcbe6c58bc2f3375d33 (patch)
tree8ffa8b835182154aa3793f479d1834064c411ab9 /mod/profile/views/default
parent002f788efcd57f43a7347c12273779a163d2920a (diff)
downloadelgg-68f2c92868ddf477568c1dcbe6c58bc2f3375d33.tar.gz
elgg-68f2c92868ddf477568c1dcbe6c58bc2f3375d33.tar.bz2
First go at merging in draggable profile fields.
Added categories to profile plugin. git-svn-id: http://code.elgg.org/elgg/trunk@5652 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/profile/views/default')
-rw-r--r--mod/profile/views/default/profile/editdefaultprofile.php6
-rw-r--r--mod/profile/views/default/profile/editdefaultprofileitems.php68
2 files changed, 71 insertions, 3 deletions
diff --git a/mod/profile/views/default/profile/editdefaultprofile.php b/mod/profile/views/default/profile/editdefaultprofile.php
index 338204d36..ae05e6da1 100644
--- a/mod/profile/views/default/profile/editdefaultprofile.php
+++ b/mod/profile/views/default/profile/editdefaultprofile.php
@@ -20,9 +20,9 @@ $type_control = elgg_view('input/pulldown', array('internalname' => 'type', 'opt
'url' => elgg_echo('url'),
'email' => elgg_echo('email')
)));
-
-$submit_control = elgg_view('input/submit', array('internalname' => elgg_echo('save'), 'value' => elgg_echo('Add')));
-
+
+$submit_control = elgg_view('input/submit', array('internalname' => elgg_echo('add'), 'value' => elgg_echo('add')));
+
$formbody = <<< END
<p>$label_text: $label_control
$type_text: $type_control
diff --git a/mod/profile/views/default/profile/editdefaultprofileitems.php b/mod/profile/views/default/profile/editdefaultprofileitems.php
new file mode 100644
index 000000000..cfd15247a
--- /dev/null
+++ b/mod/profile/views/default/profile/editdefaultprofileitems.php
@@ -0,0 +1,68 @@
+<script language="javascript" type="text/javascript" src="<?php echo $vars['url']?>mod/profile/vendor/jq.editable.min.js"></script>
+<script language="javascript" type="text/javascript">
+var reorderURL = '<?php echo elgg_add_action_tokens_to_url($vars['url'] . 'action/profile/editdefault/reorder', FALSE); ?>';
+function sortCallback(event, ui) {
+ var orderArr = $('#sortableList').sortable('toArray');
+ var orderStr = orderArr.join(',');
+ console.log(orderArr);
+ console.log(orderStr);
+ jQuery.post(reorderURL, {'fieldorder': orderStr});
+}
+
+$(document).ready(function() {
+ $('#sortableList').sortable({
+ items: 'li',
+ handle: '.handle',
+ stop: sortCallback
+ });
+});
+
+</script>
+<script language="javascript" type="text/javascript" src="<?php echo $vars['url']; ?>mod/multiadmin/vendors/js/jquery.jeditable.js" ></script>
+
+<div id="list">
+ <ul id="sortableList">
+<?php
+
+ $save = elgg_echo('save');
+ $cancel = elgg_echo('cancel');
+
+ foreach($vars['items'] as $item) {
+ $url = elgg_add_action_tokens_to_url("{$vars['url']}action/profile/editdefault/editfield");
+ echo <<< END
+
+<script language="javascript" type="text/javascript">
+
+ $(function() {
+ $(".{$item->shortname}_editable").editable("$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("{$vars['url']}action/profile/editdefault/delete?id={$item->shortname}");
+ echo "<li id=\"{$item->shortname}\"><div class=\"delete_note\" style=\"float:right\"><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='{$vars['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 $vars['fieldlist']; ?>" />