<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][7285] trunk/bp-xprofile: Update XProfile field edit UI to match field group edit UI, for 1.9.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/7285">7285</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2013-07-18 06:54:34 +0000 (Thu, 18 Jul 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update XProfile field edit UI to match field group edit UI, for 1.9. See <a href="http://buddypress.trac.wordpress.org/ticket/5094">#5094</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpxprofileadmincssadmincss">trunk/bp-xprofile/admin/css/admin.css</a></li>
<li><a href="#trunkbpxprofileadminjsadminjs">trunk/bp-xprofile/admin/js/admin.js</a></li>
<li><a href="#trunkbpxprofilebpxprofileclassesphp">trunk/bp-xprofile/bp-xprofile-classes.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpxprofileadmincssadmincss"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/admin/css/admin.css (7284 => 7285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/admin/css/admin.css    2013-07-17 16:15:05 UTC (rev 7284)
+++ trunk/bp-xprofile/admin/css/admin.css       2013-07-18 06:54:34 UTC (rev 7285)
</span><span class="lines">@@ -241,8 +241,9 @@
</span><span class="cx">  top: -2px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-textarea#description {
</del><ins>+textarea#description,
+textarea#group_description {
</ins><span class="cx">   border: 1px solid #ddd;
</span><del>-       width: 85%;
</del><ins>+        width: 100%;
</ins><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpxprofileadminjsadminjs"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/admin/js/admin.js (7284 => 7285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/admin/js/admin.js      2013-07-17 16:15:05 UTC (rev 7284)
+++ trunk/bp-xprofile/admin/js/admin.js 2013-07-18 06:54:34 UTC (rev 7285)
</span><span class="lines">@@ -3,10 +3,10 @@
</span><span class="cx">  var theId     = document.getElementById(forWhat + '_option_number').value;
</span><span class="cx">  var newDiv    = document.createElement('p');
</span><span class="cx">  var newOption = document.createElement('input');
</span><del>-       var span     = document.createElement( 'span' );
</del><ins>+        var span      = document.createElement( 'span' );
</ins><span class="cx">   var txt       = document.createTextNode( "\u00A0\u039E\u00A0" );
</span><span class="cx">  var isDefault = document.createElement( 'input' );
</span><del>-       var span1    = document.createElement( 'span' );
</del><ins>+        var span1     = document.createElement( 'span' );
</ins><span class="cx">   var txt1      = document.createTextNode( " Default Value " );
</span><span class="cx"> 
</span><span class="cx">  newDiv.setAttribute('id', forWhat + '_div' + theId);
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx"> 
</span><span class="cx"> function enableSortableFieldOptions( forWhat ) {
</span><span class="cx">  if ( jQuery( '#' + forWhat + ' p.sortable' ).length > 1 ) {
</span><del>-               jQuery( '.options-box' ).sortable( {
</del><ins>+                jQuery( '.bp-options-box' ).sortable( {
</ins><span class="cx">                   items: 'p.sortable',
</span><span class="cx">                  tolerance: 'pointer',
</span><span class="cx">                  axis: 'y',
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function destroySortableFieldOptions() {
</span><del>-       jQuery( '.options-box' ).sortable( 'destroy' );
</del><ins>+        jQuery( '.bp-options-box' ).sortable( 'destroy' );
</ins><span class="cx">   jQuery( '.sortable span' ).css( 'cursor', 'default' );
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofileclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-classes.php (7284 => 7285)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-classes.php        2013-07-17 16:15:05 UTC (rev 7284)
+++ trunk/bp-xprofile/bp-xprofile-classes.php   2013-07-18 06:54:34 UTC (rev 7285)
</span><span class="lines">@@ -748,66 +748,69 @@
</span><span class="cx"> 
</span><span class="cx">                  ?>
</span><span class="cx"> 
</span><del>-                       <div id="<?php echo esc_attr( $type ); ?>" class="options-box" style="<?php echo esc_attr( $class ); ?> margin-left: 15px;">
-                               <h4><?php _e( 'Please enter options for this Field:', 'buddypress' ); ?></h4>
-                               <p>
-                                       <label for="sort_order_<?php echo esc_attr( $type ); ?>"><?php _e( 'Sort Order:', 'buddypress' ); ?></label>
-                                       <select name="sort_order_<?php echo esc_attr( $type ); ?>" id="sort_order_<?php echo esc_attr( $type ); ?>" >
-                                               <option value="custom" <?php selected( 'custom', $this->order_by ); ?>><?php _e( 'Custom',     'buddypress' ); ?></option>
-                                               <option value="asc"    <?php selected( 'asc',    $this->order_by ); ?>><?php _e( 'Ascending',  'buddypress' ); ?></option>
-                                               <option value="desc"   <?php selected( 'desc',   $this->order_by ); ?>><?php _e( 'Descending', 'buddypress' ); ?></option>
-                                       </select>
</del><ins>+                        <div id="<?php echo esc_attr( $type ); ?>" class="postbox bp-options-box" style="<?php echo esc_attr( $class ); ?> margin-top: 15px;">
+                               <h3><?php _e( 'Please enter options for this Field:', 'buddypress' ); ?></h3>
+                               <div class="inside">
+                                       <p>
+                                               <label for="sort_order_<?php echo esc_attr( $type ); ?>"><?php _e( 'Sort Order:', 'buddypress' ); ?></label>
+                                               <select name="sort_order_<?php echo esc_attr( $type ); ?>" id="sort_order_<?php echo esc_attr( $type ); ?>" >
+                                                       <option value="custom" <?php selected( 'custom', $this->order_by ); ?>><?php _e( 'Custom',     'buddypress' ); ?></option>
+                                                       <option value="asc"    <?php selected( 'asc',    $this->order_by ); ?>><?php _e( 'Ascending',  'buddypress' ); ?></option>
+                                                       <option value="desc"   <?php selected( 'desc',   $this->order_by ); ?>><?php _e( 'Descending', 'buddypress' ); ?></option>
+                                               </select>
+                                       </p>
</ins><span class="cx"> 
</span><del>-                               <?php if ( !$options = $this->get_children( true ) ) {
</del><ins>+                                        <?php if ( !$options = $this->get_children( true ) ) {
</ins><span class="cx"> 
</span><del>-                                       $i = 1;
-                                       while ( isset( $_POST[$type . '_option'][$i] ) ) {
-                                               (array) $options[] = (object) array(
-                                                       'id'                => -1,
-                                                       'name'              => $_POST[$type . '_option'][$i],
-                                                       'is_default_option' => ( ( 'multiselectbox' != $type ) && ( 'checkbox' != $type ) && ( $_POST["isDefault_{$type}_option"] == $i ) ) ? 1 : $_POST["isDefault_{$type}_option"][$i]
-                                               );
</del><ins>+                                                $i = 1;
+                                               while ( isset( $_POST[$type . '_option'][$i] ) ) {
+                                                       (array) $options[] = (object) array(
+                                                               'id'                => -1,
+                                                               'name'              => $_POST[$type . '_option'][$i],
+                                                               'is_default_option' => ( ( 'multiselectbox' != $type ) && ( 'checkbox' != $type ) && ( $_POST["isDefault_{$type}_option"] == $i ) ) ? 1 : $_POST["isDefault_{$type}_option"][$i]
+                                                       );
</ins><span class="cx"> 
</span><del>-                                               ++$i;
</del><ins>+                                                        ++$i;
+                                               }
</ins><span class="cx">                                   }
</span><del>-                               }
</del><span class="cx"> 
</span><del>-                               if ( !empty( $options ) ) {
-                                       for ( $i = 0, $count = count( $options ); $i < $count; ++$i ) {
-                                               $j = $i + 1;
</del><ins>+                                        if ( !empty( $options ) ) {
+                                               for ( $i = 0, $count = count( $options ); $i < $count; ++$i ) {
+                                                       $j = $i + 1;
</ins><span class="cx"> 
</span><ins>+                                                       if ( 'multiselectbox' == $type || 'checkbox' == $type )
+                                                               $default_name = '[' . $j . ']'; ?>
+
+                                                       <p class="sortable">
+                                                               <span>&nbsp;&Xi;&nbsp;</span>
+                                                               <input type="text" name="<?php echo esc_attr( $type ); ?>_option[<?php echo esc_attr( $j ); ?>]" id="<?php echo esc_attr( $type ); ?>_option<?php echo esc_attr( $j ); ?>" value="<?php echo stripslashes( esc_attr( $options[$i]->name ) ); ?>" />
+                                                               <input type="<?php echo $default_input; ?>" name="isDefault_<?php echo esc_attr( $type ); ?>_option<?php echo esc_attr( $default_name ); ?>" <?php checked( (int) $options[$i]->is_default_option, true ); ?> value="<?php echo esc_attr( $j ); ?>" />
+                                                               <span><?php _e( 'Default Value', 'buddypress' ); ?></span>
+                                                               <a href="<?php echo esc_url( 'users.php?page=bp-profile-setup&amp;mode=delete_option&amp;option_id=' . $options[$i]->id ); ?>" class="ajax-option-delete" id="delete-<?php echo esc_attr( $options[$i]->id ); ?>">[x]</a>
+                                                       </p>
+
+                                               <?php } /* end for */ ?>
+
+                                               <input type="hidden" name="<?php echo esc_attr( $type ); ?>_option_number" id="<?php echo esc_attr( $type ); ?>_option_number" value="<?php echo esc_attr( (int) $j + 1 ); ?>" />
+
+                                       <?php } else {
+
</ins><span class="cx">                                           if ( 'multiselectbox' == $type || 'checkbox' == $type )
</span><del>-                                                       $default_name = '[' . $j . ']'; ?>
</del><ins>+                                                        $default_name = '[1]'; ?>
</ins><span class="cx"> 
</span><span class="cx">                                          <p class="sortable">
</span><span class="cx">                                                  <span>&nbsp;&Xi;&nbsp;</span>
</span><del>-                                                       <input type="text" name="<?php echo esc_attr( $type ); ?>_option[<?php echo esc_attr( $j ); ?>]" id="<?php echo esc_attr( $type ); ?>_option<?php echo esc_attr( $j ); ?>" value="<?php echo stripslashes( esc_attr( $options[$i]->name ) ); ?>" />
-                                                       <input type="<?php echo $default_input; ?>" name="isDefault_<?php echo esc_attr( $type ); ?>_option<?php echo esc_attr( $default_name ); ?>" <?php checked( (int) $options[$i]->is_default_option, true ); ?> value="<?php echo esc_attr( $j ); ?>" />
</del><ins>+                                                        <input type="text" name="<?php echo esc_attr( $type ); ?>_option[1]" id="<?php echo esc_attr( $type ); ?>_option1" />
+                                                       <input type="<?php echo esc_attr( $default_input ); ?>" name="isDefault_<?php echo esc_attr( $type ); ?>_option<?php echo esc_attr( $default_name ); ?>" id="isDefault_<?php echo esc_attr( $type ); ?>_option" value="1" />
</ins><span class="cx">                                                   <span><?php _e( 'Default Value', 'buddypress' ); ?></span>
</span><del>-                                                       <a href="<?php echo esc_url( 'users.php?page=bp-profile-setup&amp;mode=delete_option&amp;option_id=' . $options[$i]->id ); ?>" class="ajax-option-delete" id="delete-<?php echo esc_attr( $options[$i]->id ); ?>">[x]</a>
</del><ins>+                                                        <input type="hidden" name="<?php echo esc_attr( $type ); ?>_option_number" id="<?php echo esc_attr( $type ); ?>_option_number" value="2" />
</ins><span class="cx">                                           </p>
</span><span class="cx"> 
</span><del>-                                       <?php } /* end for */ ?>
</del><ins>+                                        <?php } /* end if */ ?>
</ins><span class="cx"> 
</span><del>-                                       <input type="hidden" name="<?php echo esc_attr( $type ); ?>_option_number" id="<?php echo esc_attr( $type ); ?>_option_number" value="<?php echo esc_attr( (int) $j + 1 ); ?>" />
-
-                               <?php } else {
-
-                                       if ( 'multiselectbox' == $type || 'checkbox' == $type )
-                                               $default_name = '[1]'; ?>
-
-                                       <p class="sortable">
-                                               <span>&nbsp;&Xi;&nbsp;</span>
-                                               <input type="text" name="<?php echo esc_attr( $type ); ?>_option[1]" id="<?php echo esc_attr( $type ); ?>_option1" />
-                                               <input type="<?php echo esc_attr( $default_input ); ?>" name="isDefault_<?php echo esc_attr( $type ); ?>_option<?php echo esc_attr( $default_name ); ?>" id="isDefault_<?php echo esc_attr( $type ); ?>_option" value="1" />
-                                               <span><?php _e( 'Default Value', 'buddypress' ); ?></span>
-                                               <input type="hidden" name="<?php echo esc_attr( $type ); ?>_option_number" id="<?php echo esc_attr( $type ); ?>_option_number" value="2" />
-                                       </p>
-
-                               <?php } /* end if */ ?>
-
-                               <div id="<?php echo esc_attr( $type ); ?>_more"></div>
-                               <p><a href="javascript:add_option('<?php echo esc_attr( $type ); ?>')"><?php _e( 'Add Another Option', 'buddypress' ); ?></a></p>
</del><ins>+                                        <div id="<?php echo esc_attr( $type ); ?>_more"></div>
+                                       <p><a href="javascript:add_option('<?php echo esc_attr( $type ); ?>')"><?php _e( 'Add Another Option', 'buddypress' ); ?></a></p>
+                               </div>
</ins><span class="cx">                   </div>
</span><span class="cx"> 
</span><span class="cx">          <?php }
</span><span class="lines">@@ -834,7 +837,6 @@
</span><span class="cx">          <div class="wrap">
</span><span class="cx">                  <div id="icon-users" class="icon32"><br /></div>
</span><span class="cx">                  <h2><?php echo esc_html( $title ); ?></h2>
</span><del>-                       <p><?php _e( 'Fields marked * are required', 'buddypress' ) ?></p>
</del><span class="cx"> 
</span><span class="cx">                  <?php if ( !empty( $message ) ) : ?>
</span><span class="cx"> 
</span><span class="lines">@@ -846,92 +848,128 @@
</span><span class="cx"> 
</span><span class="cx">                  <form id="bp-xprofile-add-field" action="<?php echo esc_url( $action ); ?>" method="post">
</span><span class="cx">                          <div id="poststuff">
</span><del>-                                       <div id="titlediv">
-                                               <h3><label for="title"><?php _e( 'Field Title', 'buddypress' ); ?> *</label></h3>
-                                               <div id="titlewrap">
-                                                       <input type="text" name="title" id="title" value="<?php echo esc_attr( $this->name ); ?>" style="width:50%" />
-                                               </div>
-                                       </div>
</del><ins>+                                        <div id="post-body" class="metabox-holder columns-<?php echo ( 1 == get_current_screen()->get_columns() ) ? '1' : '2'; ?>">
+                                               <div id="post-body-content">
+                                                       <div id="titlediv">
+                                                               <input type="text" name="title" id="title" value="<?php echo esc_attr( $this->name ); ?>" />
+                                                       </div>
+                                                       <div class="postbox">
+                                                               <h3><?php _e( 'Field Description', 'buddypress' ); ?></h3>
+                                                               <div class="inside">
+                                                                       <textarea name="description" id="description" rows="8" cols="60"><?php echo esc_attr( $this->description ); ?></textarea>
+                                                               </div>
+                                                       </div>
+                                               </div><!-- #post-body-content -->
</ins><span class="cx"> 
</span><del>-                                       <div id="titlediv">
-                                               <h3><label for="description"><?php _e("Field Description", 'buddypress'); ?></label></h3>
-                                               <div id="titlewrap">
-                                                       <textarea name="description" id="description" rows="8" cols="60"><?php echo esc_textarea( $this->description ); ?></textarea>
-                                               </div>
-                                       </div>
</del><ins>+                                                <div id="postbox-container-1" class="postbox-container">
+                                                       <div id="submitdiv" class="postbox">
+                                                               <h3><?php _e( 'Submit', 'buddypress' ); ?></h3>
+                                                               <div class="inside">
+                                                                       <div id="submitcomment" class="submitbox">
+                                                                               <div id="major-publishing-actions">
+                                                                                       <input type="hidden" name="field_order" id="field_order" value="<?php echo esc_attr( $this->field_order ); ?>" />
+                                                                                       <div id="publishing-action">
+                                                                                               <input type="submit" value="<?php _e( 'Save', 'buddypress' ); ?>" name="saveField" id="saveField" style="font-weight: bold" class="button-primary" />
+                                                                                       </div>
+                                                                                       <div id="delete-action">
+                                                                                               <a href="users.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a>
+                                                                                       </div>
+                                                                                       <?php wp_nonce_field( 'xprofile_delete_option' ); ?>
+                                                                                       <div class="clear"></div>
+                                                                               </div>
+                                                                       </div>
+                                                               </div>
+                                                       </div>
</ins><span class="cx"> 
</span><del>-                                       <?php if ( '0' != $this->can_delete ) : ?>
</del><ins>+                                                        <?php if ( 1 != $this->id ) : ?>
</ins><span class="cx"> 
</span><del>-                                               <div id="titlediv">
-                                                       <h3><label for="required"><?php _e( "Is This Field Required?", 'buddypress' ); ?> *</label></h3>
-                                                       <select name="required" id="required" style="width: 30%">
-                                                               <option value="0"<?php selected( $this->is_required, '0' ); ?>><?php _e( 'Not Required', 'buddypress' ); ?></option>
-                                                               <option value="1"<?php selected( $this->is_required, '1' ); ?>><?php _e( 'Required',     'buddypress' ); ?></option>
-                                                       </select>
-                                               </div>
</del><ins>+                                                                <div class="postbox">
+                                                                       <h3><label for="default-visibility"><?php _e( 'Default Visibility', 'buddypress' ); ?></label></h3>
+                                                                       <div class="inside">
+                                                                               <ul>
</ins><span class="cx"> 
</span><del>-                                               <div id="titlediv">
-                                                       <h3><label for="fieldtype"><?php _e( 'Field Type', 'buddypress'); ?> *</label></h3>
-                                                       <select name="fieldtype" id="fieldtype" onchange="show_options(this.value)" style="width: 30%">
-                                                               <option value="textbox"        <?php selected( $this->type, 'textbox'        ); ?>><?php _e( 'Text Box',             'buddypress' ); ?></option>
-                                                               <option value="textarea"       <?php selected( $this->type, 'textarea'       ); ?>><?php _e( 'Multi-line Text Box',  'buddypress' ); ?></option>
-                                                               <option value="datebox"        <?php selected( $this->type, 'datebox'        ); ?>><?php _e( 'Date Selector',        'buddypress' ); ?></option>
-                                                               <option value="radio"          <?php selected( $this->type, 'radio'          ); ?>><?php _e( 'Radio Buttons',        'buddypress' ); ?></option>
-                                                               <option value="selectbox"      <?php selected( $this->type, 'selectbox'      ); ?>><?php _e( 'Drop Down Select Box', 'buddypress' ); ?></option>
-                                                               <option value="multiselectbox" <?php selected( $this->type, 'multiselectbox' ); ?>><?php _e( 'Multi Select Box',     'buddypress' ); ?></option>
-                                                               <option value="checkbox"       <?php selected( $this->type, 'checkbox'       ); ?>><?php _e( 'Checkboxes',           'buddypress' ); ?></option>
-                                                       </select>
-                                               </div>
</del><ins>+                                                                                        <?php foreach( bp_xprofile_get_visibility_levels() as $level ) : ?>
</ins><span class="cx"> 
</span><del>-                                               <?php do_action_ref_array( 'xprofile_field_additional_options', array( $this ) ); ?>
</del><ins>+                                                                                                <li>
+                                                                                                       <input type="radio" id="default-visibility[<?php echo esc_attr( $level['id'] ) ?>]" name="default-visibility" value="<?php echo esc_attr( $level['id'] ) ?>" <?php checked( $this->default_visibility, $level['id'] ); ?> />
+                                                                                                       <label for="default-visibility[<?php echo esc_attr( $level['id'] ) ?>]"><?php echo esc_html( $level['label'] ) ?></label>
+                                                                                               </li>
</ins><span class="cx"> 
</span><del>-                                               <?php $this->render_admin_form_children(); ?>
</del><ins>+                                                                                        <?php endforeach ?>
</ins><span class="cx"> 
</span><del>-                                       <?php else : ?>
</del><ins>+                                                                                </ul>
+                                                                       </div>
+                                                               </div>
</ins><span class="cx"> 
</span><del>-                                               <input type="hidden" name="required"  id="required"  value="1"       />
-                                               <input type="hidden" name="fieldtype" id="fieldtype" value="textbox" />
</del><ins>+                                                                <div class="postbox">
+                                                                       <h3><label for="allow-custom-visibility"><?php _e( 'Per-Member Visibility', 'buddypress' ); ?></label></h3>
+                                                                       <div class="inside">
+                                                                               <ul>
+                                                                                       <li>
+                                                                                               <input type="radio" id="allow-custom-visibility-allowed" name="allow-custom-visibility" value="allowed" <?php checked( $this->allow_custom_visibility, 'allowed' ); ?> />
+                                                                                               <label for="allow-custom-visibility-allowed"><?php _e( "Let members change this field's visibility", 'buddypress' ); ?></label>
+                                                                                       </li>
+                                                                                       <li>
+                                                                                               <input type="radio" id="allow-custom-visibility-disabled" name="allow-custom-visibility" value="disabled" <?php checked( $this->allow_custom_visibility, 'disabled' ); ?> />
+                                                                                               <label for="allow-custom-visibility-disabled"><?php _e( 'Enforce the default visibility for all members', 'buddypress' ); ?></label>
+                                                                                       </li>
+                                                                               </ul>
+                                                                       </div>
+                                                               </div>
</ins><span class="cx"> 
</span><del>-                                       <?php endif;
</del><ins>+                                                        <?php endif ?>
+                                               </div>
</ins><span class="cx"> 
</span><del>-                                       /* The fullname field cannot be hidden */
-                                       if ( 1 != $this->id ) : ?>
</del><ins>+                                                <div id="postbox-container-2" class="postbox-container">
</ins><span class="cx"> 
</span><del>-                                               <div id="titlediv">
-                                                       <div id="titlewrap">
-                                                               <h3><label for="default-visibility"><?php _e( 'Default Visibility', 'buddypress' ); ?></label></h3>
-                                                               <ul>
</del><ins>+                                                        <?php if ( '0' != $this->can_delete ) : ?>
</ins><span class="cx"> 
</span><del>-                                                                       <?php foreach( bp_xprofile_get_visibility_levels() as $level ) : ?>
</del><ins>+                                                                <div class="postbox">
+                                                                       <h3><label for="required"><?php _e( "Field Requirement", 'buddypress' ); ?></label></h3>
+                                                                       <div class="inside">
+                                                                               <select name="required" id="required" style="width: 30%">
+                                                                                       <option value="0"<?php selected( $this->is_required, '0' ); ?>><?php _e( 'Not Required', 'buddypress' ); ?></option>
+                                                                                       <option value="1"<?php selected( $this->is_required, '1' ); ?>><?php _e( 'Required',     'buddypress' ); ?></option>
+                                                                               </select>
+                                                                       </div>
+                                                               </div>
</ins><span class="cx"> 
</span><del>-                                                                               <li><label><input type="radio" name="default-visibility" value="<?php echo esc_attr( $level['id'] ) ?>" <?php checked( $this->default_visibility, $level['id'] ); ?>> <?php echo esc_html( $level['label'] ) ?></label></li>
</del><ins>+                                                                <div class="postbox">
+                                                                       <h3><label for="fieldtype"><?php _e( 'Field Type', 'buddypress'); ?></label></h3>
+                                                                       <div class="inside">
+                                                                               <select name="fieldtype" id="fieldtype" onchange="show_options(this.value)" style="width: 30%">
+                                                                                       <optgroup label="<?php _e( 'Single Fields', 'buddypress' ); ?>">
+                                                                                               <option value="textbox"        <?php selected( $this->type, 'textbox'        ); ?>><?php _e( 'Text Box',             'buddypress' ); ?></option>
+                                                                                               <option value="textarea"       <?php selected( $this->type, 'textarea'       ); ?>><?php _e( 'Multi-line Text Area', 'buddypress' ); ?></option>
+                                                                                               <option value="datebox"        <?php selected( $this->type, 'datebox'        ); ?>><?php _e( 'Date Selector',        'buddypress' ); ?></option>
+                                                                                       </optgroup>
+                                                                                       <optgroup label="<?php _e( 'Multi Fields', 'buddypress' ); ?>">
+                                                                                               <option value="radio"          <?php selected( $this->type, 'radio'          ); ?>><?php _e( 'Radio Buttons',        'buddypress' ); ?></option>
+                                                                                               <option value="selectbox"      <?php selected( $this->type, 'selectbox'      ); ?>><?php _e( 'Drop Down Select Box', 'buddypress' ); ?></option>
+                                                                                               <option value="multiselectbox" <?php selected( $this->type, 'multiselectbox' ); ?>><?php _e( 'Multi Select Box',     'buddypress' ); ?></option>
+                                                                                               <option value="checkbox"       <?php selected( $this->type, 'checkbox'       ); ?>><?php _e( 'Checkboxes',           'buddypress' ); ?></option>
+                                                                                       </optgroup>
+                                                                               </select>
</ins><span class="cx"> 
</span><del>-                                                                       <?php endforeach ?>
</del><ins>+                                                                                <?php do_action_ref_array( 'xprofile_field_additional_options', array( $this ) ); ?>
</ins><span class="cx"> 
</span><del>-                                                               </ul>
-                                                       </div>
</del><ins>+                                                                                <?php $this->render_admin_form_children(); ?>
</ins><span class="cx"> 
</span><del>-                                                       <div id="titlewrap">
-                                                               <h3><label for="allow-custom-visibility"><?php _e( 'Per-Member Visibility', 'buddypress' ); ?></label></h3>
-                                                               <ul>
-                                                                       <li><label><input type="radio" name="allow-custom-visibility" value="allowed"  <?php checked( $this->allow_custom_visibility, 'allowed'  ); ?>> <?php _e( "Let members change this field's visibility", 'buddypress' ); ?></label></li>
-                                                                       <li><label><input type="radio" name="allow-custom-visibility" value="disabled" <?php checked( $this->allow_custom_visibility, 'disabled' ); ?>> <?php _e( 'Enforce the default visibility for all members', 'buddypress' ); ?></label></li>
-                                                               </ul>
-                                                       </div>
-                                               </div>
</del><ins>+                                                                        </div>
+                                                               </div>
</ins><span class="cx"> 
</span><del>-                                       <?php endif ?>
</del><ins>+                                                        <?php else : ?>
</ins><span class="cx"> 
</span><del>-                                       <p class="submit">
-                                               <input type="hidden" name="field_order" id="field_order" value="<?php echo esc_attr( $this->field_order ); ?>" />
-                                               <input type="submit" value="<?php _e( 'Save', 'buddypress' ); ?>" name="saveField" id="saveField" style="font-weight: bold" class="button-primary" />
-                                               <?php _e( 'or', 'buddypress' ); ?> <a href="users.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a>
-                                       </p>
</del><ins>+                                                                <input type="hidden" name="required"  id="required"  value="1"       />
+                                                               <input type="hidden" name="fieldtype" id="fieldtype" value="textbox" />
</ins><span class="cx"> 
</span><del>-                               </div>
</del><ins>+                                                        <?php endif; ?>
</ins><span class="cx"> 
</span><del>-                               <?php wp_nonce_field( 'xprofile_delete_option' ); ?>
</del><ins>+                                                </div>
+                                       </div><!-- #post-body -->
</ins><span class="cx"> 
</span><ins>+                               </div><!-- #poststuff -->
+
</ins><span class="cx">                   </form>
</span><span class="cx">          </div>
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>