diff options
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/admin/appearance/profile_fields.php | 21 | ||||
-rw-r--r-- | views/default/admin/appearance/profile_fields/list.php | 88 | ||||
-rw-r--r-- | views/default/forms/profile/fields/add.php | 29 | ||||
-rw-r--r-- | views/default/forms/profile/fields/reset.php | 10 |
4 files changed, 148 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; ?>" /> + diff --git a/views/default/forms/profile/fields/add.php b/views/default/forms/profile/fields/add.php new file mode 100644 index 000000000..50d1600fd --- /dev/null +++ b/views/default/forms/profile/fields/add.php @@ -0,0 +1,29 @@ +<?php +/** + * Elgg profile index + * + * @package ElggProfile + */ + +$label_text = elgg_echo('profile:label'); +$type_text = elgg_echo('profile:type'); + +$label_control = elgg_view('input/text', array('internalname' => 'label')); +$type_control = elgg_view('input/pulldown', array('internalname' => 'type', 'options_values' => array( + 'text' => elgg_echo('text'), + 'longtext' => elgg_echo('longtext'), + 'tags' => elgg_echo('tags'), + 'url' => elgg_echo('url'), + 'email' => elgg_echo('email') +))); + +$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 + $submit_control</p> +END; + +echo "<p class='margin-top'>" . elgg_echo('profile:explainchangefields') . "</p>"; +echo $formbody; diff --git a/views/default/forms/profile/fields/reset.php b/views/default/forms/profile/fields/reset.php new file mode 100644 index 000000000..1661b2fa3 --- /dev/null +++ b/views/default/forms/profile/fields/reset.php @@ -0,0 +1,10 @@ +<?php +/** + * Reset profile fields form + */ + +$params = array( + 'value' => elgg_echo('profile:resetdefault'), + 'class' => 'action-button disabled', +); +echo elgg_view('input/submit', $params); |