Changeset 7285
- Timestamp:
- 07/18/2013 06:54:34 AM (11 years ago)
- Location:
- trunk/bp-xprofile
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/admin/css/admin.css
r6294 r7285 242 242 } 243 243 244 textarea#description { 244 textarea#description, 245 textarea#group_description { 245 246 border: 1px solid #ddd; 246 width: 85%;247 } 248 247 width: 100%; 248 } 249 -
trunk/bp-xprofile/admin/js/admin.js
r7012 r7285 4 4 var newDiv = document.createElement('p'); 5 5 var newOption = document.createElement('input'); 6 var span = document.createElement( 'span' );6 var span = document.createElement( 'span' ); 7 7 var txt = document.createTextNode( "\u00A0\u039E\u00A0" ); 8 8 var isDefault = document.createElement( 'input' ); 9 var span1 = document.createElement( 'span' );9 var span1 = document.createElement( 'span' ); 10 10 var txt1 = document.createTextNode( " Default Value " ); 11 11 … … 92 92 function enableSortableFieldOptions( forWhat ) { 93 93 if ( jQuery( '#' + forWhat + ' p.sortable' ).length > 1 ) { 94 jQuery( '. options-box' ).sortable( {94 jQuery( '.bp-options-box' ).sortable( { 95 95 items: 'p.sortable', 96 96 tolerance: 'pointer', … … 104 104 105 105 function destroySortableFieldOptions() { 106 jQuery( '. options-box' ).sortable( 'destroy' );106 jQuery( '.bp-options-box' ).sortable( 'destroy' ); 107 107 jQuery( '.sortable span' ).css( 'cursor', 'default' ); 108 108 } -
trunk/bp-xprofile/bp-xprofile-classes.php
r7271 r7285 749 749 ?> 750 750 751 <div id="<?php echo esc_attr( $type ); ?>" class="options-box" style="<?php echo esc_attr( $class ); ?> margin-left: 15px;"> 752 <h4><?php _e( 'Please enter options for this Field:', 'buddypress' ); ?></h4> 753 <p> 754 <label for="sort_order_<?php echo esc_attr( $type ); ?>"><?php _e( 'Sort Order:', 'buddypress' ); ?></label> 755 <select name="sort_order_<?php echo esc_attr( $type ); ?>" id="sort_order_<?php echo esc_attr( $type ); ?>" > 756 <option value="custom" <?php selected( 'custom', $this->order_by ); ?>><?php _e( 'Custom', 'buddypress' ); ?></option> 757 <option value="asc" <?php selected( 'asc', $this->order_by ); ?>><?php _e( 'Ascending', 'buddypress' ); ?></option> 758 <option value="desc" <?php selected( 'desc', $this->order_by ); ?>><?php _e( 'Descending', 'buddypress' ); ?></option> 759 </select> 760 761 <?php if ( !$options = $this->get_children( true ) ) { 762 763 $i = 1; 764 while ( isset( $_POST[$type . '_option'][$i] ) ) { 765 (array) $options[] = (object) array( 766 'id' => -1, 767 'name' => $_POST[$type . '_option'][$i], 768 'is_default_option' => ( ( 'multiselectbox' != $type ) && ( 'checkbox' != $type ) && ( $_POST["isDefault_{$type}_option"] == $i ) ) ? 1 : $_POST["isDefault_{$type}_option"][$i] 769 ); 770 771 ++$i; 751 <div id="<?php echo esc_attr( $type ); ?>" class="postbox bp-options-box" style="<?php echo esc_attr( $class ); ?> margin-top: 15px;"> 752 <h3><?php _e( 'Please enter options for this Field:', 'buddypress' ); ?></h3> 753 <div class="inside"> 754 <p> 755 <label for="sort_order_<?php echo esc_attr( $type ); ?>"><?php _e( 'Sort Order:', 'buddypress' ); ?></label> 756 <select name="sort_order_<?php echo esc_attr( $type ); ?>" id="sort_order_<?php echo esc_attr( $type ); ?>" > 757 <option value="custom" <?php selected( 'custom', $this->order_by ); ?>><?php _e( 'Custom', 'buddypress' ); ?></option> 758 <option value="asc" <?php selected( 'asc', $this->order_by ); ?>><?php _e( 'Ascending', 'buddypress' ); ?></option> 759 <option value="desc" <?php selected( 'desc', $this->order_by ); ?>><?php _e( 'Descending', 'buddypress' ); ?></option> 760 </select> 761 </p> 762 763 <?php if ( !$options = $this->get_children( true ) ) { 764 765 $i = 1; 766 while ( isset( $_POST[$type . '_option'][$i] ) ) { 767 (array) $options[] = (object) array( 768 'id' => -1, 769 'name' => $_POST[$type . '_option'][$i], 770 'is_default_option' => ( ( 'multiselectbox' != $type ) && ( 'checkbox' != $type ) && ( $_POST["isDefault_{$type}_option"] == $i ) ) ? 1 : $_POST["isDefault_{$type}_option"][$i] 771 ); 772 773 ++$i; 774 } 772 775 } 773 } 774 775 if ( !empty( $options ) ) { 776 for ( $i = 0, $count = count( $options ); $i < $count; ++$i ) { 777 $j = $i + 1; 776 777 if ( !empty( $options ) ) { 778 for ( $i = 0, $count = count( $options ); $i < $count; ++$i ) { 779 $j = $i + 1; 780 781 if ( 'multiselectbox' == $type || 'checkbox' == $type ) 782 $default_name = '[' . $j . ']'; ?> 783 784 <p class="sortable"> 785 <span> Ξ </span> 786 <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 ) ); ?>" /> 787 <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 ); ?>" /> 788 <span><?php _e( 'Default Value', 'buddypress' ); ?></span> 789 <a href="<?php echo esc_url( 'users.php?page=bp-profile-setup&mode=delete_option&option_id=' . $options[$i]->id ); ?>" class="ajax-option-delete" id="delete-<?php echo esc_attr( $options[$i]->id ); ?>">[x]</a> 790 </p> 791 792 <?php } /* end for */ ?> 793 794 <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 ); ?>" /> 795 796 <?php } else { 778 797 779 798 if ( 'multiselectbox' == $type || 'checkbox' == $type ) 780 $default_name = '[ ' . $j . ']'; ?>799 $default_name = '[1]'; ?> 781 800 782 801 <p class="sortable"> 783 802 <span> Ξ </span> 784 <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 ) ); ?>" />785 <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 ); ?>" />803 <input type="text" name="<?php echo esc_attr( $type ); ?>_option[1]" id="<?php echo esc_attr( $type ); ?>_option1" /> 804 <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" /> 786 805 <span><?php _e( 'Default Value', 'buddypress' ); ?></span> 787 < a href="<?php echo esc_url( 'users.php?page=bp-profile-setup&mode=delete_option&option_id=' . $options[$i]->id ); ?>" class="ajax-option-delete" id="delete-<?php echo esc_attr( $options[$i]->id ); ?>">[x]</a>806 <input type="hidden" name="<?php echo esc_attr( $type ); ?>_option_number" id="<?php echo esc_attr( $type ); ?>_option_number" value="2" /> 788 807 </p> 789 808 790 <?php } /* end for */ ?> 791 792 <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 ); ?>" /> 793 794 <?php } else { 795 796 if ( 'multiselectbox' == $type || 'checkbox' == $type ) 797 $default_name = '[1]'; ?> 798 799 <p class="sortable"> 800 <span> Ξ </span> 801 <input type="text" name="<?php echo esc_attr( $type ); ?>_option[1]" id="<?php echo esc_attr( $type ); ?>_option1" /> 802 <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" /> 803 <span><?php _e( 'Default Value', 'buddypress' ); ?></span> 804 <input type="hidden" name="<?php echo esc_attr( $type ); ?>_option_number" id="<?php echo esc_attr( $type ); ?>_option_number" value="2" /> 805 </p> 806 807 <?php } /* end if */ ?> 808 809 <div id="<?php echo esc_attr( $type ); ?>_more"></div> 810 <p><a href="javascript:add_option('<?php echo esc_attr( $type ); ?>')"><?php _e( 'Add Another Option', 'buddypress' ); ?></a></p> 809 <?php } /* end if */ ?> 810 811 <div id="<?php echo esc_attr( $type ); ?>_more"></div> 812 <p><a href="javascript:add_option('<?php echo esc_attr( $type ); ?>')"><?php _e( 'Add Another Option', 'buddypress' ); ?></a></p> 813 </div> 811 814 </div> 812 815 … … 835 838 <div id="icon-users" class="icon32"><br /></div> 836 839 <h2><?php echo esc_html( $title ); ?></h2> 837 <p><?php _e( 'Fields marked * are required', 'buddypress' ) ?></p>838 840 839 841 <?php if ( !empty( $message ) ) : ?> … … 847 849 <form id="bp-xprofile-add-field" action="<?php echo esc_url( $action ); ?>" method="post"> 848 850 <div id="poststuff"> 849 <div id="titlediv"> 850 <h3><label for="title"><?php _e( 'Field Title', 'buddypress' ); ?> *</label></h3> 851 <div id="titlewrap"> 852 <input type="text" name="title" id="title" value="<?php echo esc_attr( $this->name ); ?>" style="width:50%" /> 851 <div id="post-body" class="metabox-holder columns-<?php echo ( 1 == get_current_screen()->get_columns() ) ? '1' : '2'; ?>"> 852 <div id="post-body-content"> 853 <div id="titlediv"> 854 <input type="text" name="title" id="title" value="<?php echo esc_attr( $this->name ); ?>" /> 855 </div> 856 <div class="postbox"> 857 <h3><?php _e( 'Field Description', 'buddypress' ); ?></h3> 858 <div class="inside"> 859 <textarea name="description" id="description" rows="8" cols="60"><?php echo esc_attr( $this->description ); ?></textarea> 860 </div> 861 </div> 862 </div><!-- #post-body-content --> 863 864 <div id="postbox-container-1" class="postbox-container"> 865 <div id="submitdiv" class="postbox"> 866 <h3><?php _e( 'Submit', 'buddypress' ); ?></h3> 867 <div class="inside"> 868 <div id="submitcomment" class="submitbox"> 869 <div id="major-publishing-actions"> 870 <input type="hidden" name="field_order" id="field_order" value="<?php echo esc_attr( $this->field_order ); ?>" /> 871 <div id="publishing-action"> 872 <input type="submit" value="<?php _e( 'Save', 'buddypress' ); ?>" name="saveField" id="saveField" style="font-weight: bold" class="button-primary" /> 873 </div> 874 <div id="delete-action"> 875 <a href="users.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a> 876 </div> 877 <?php wp_nonce_field( 'xprofile_delete_option' ); ?> 878 <div class="clear"></div> 879 </div> 880 </div> 881 </div> 882 </div> 883 884 <?php if ( 1 != $this->id ) : ?> 885 886 <div class="postbox"> 887 <h3><label for="default-visibility"><?php _e( 'Default Visibility', 'buddypress' ); ?></label></h3> 888 <div class="inside"> 889 <ul> 890 891 <?php foreach( bp_xprofile_get_visibility_levels() as $level ) : ?> 892 893 <li> 894 <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'] ); ?> /> 895 <label for="default-visibility[<?php echo esc_attr( $level['id'] ) ?>]"><?php echo esc_html( $level['label'] ) ?></label> 896 </li> 897 898 <?php endforeach ?> 899 900 </ul> 901 </div> 902 </div> 903 904 <div class="postbox"> 905 <h3><label for="allow-custom-visibility"><?php _e( 'Per-Member Visibility', 'buddypress' ); ?></label></h3> 906 <div class="inside"> 907 <ul> 908 <li> 909 <input type="radio" id="allow-custom-visibility-allowed" name="allow-custom-visibility" value="allowed" <?php checked( $this->allow_custom_visibility, 'allowed' ); ?> /> 910 <label for="allow-custom-visibility-allowed"><?php _e( "Let members change this field's visibility", 'buddypress' ); ?></label> 911 </li> 912 <li> 913 <input type="radio" id="allow-custom-visibility-disabled" name="allow-custom-visibility" value="disabled" <?php checked( $this->allow_custom_visibility, 'disabled' ); ?> /> 914 <label for="allow-custom-visibility-disabled"><?php _e( 'Enforce the default visibility for all members', 'buddypress' ); ?></label> 915 </li> 916 </ul> 917 </div> 918 </div> 919 920 <?php endif ?> 853 921 </div> 854 </div> 855 856 <div id="titlediv"> 857 <h3><label for="description"><?php _e("Field Description", 'buddypress'); ?></label></h3> 858 <div id="titlewrap"> 859 <textarea name="description" id="description" rows="8" cols="60"><?php echo esc_textarea( $this->description ); ?></textarea> 922 923 <div id="postbox-container-2" class="postbox-container"> 924 925 <?php if ( '0' != $this->can_delete ) : ?> 926 927 <div class="postbox"> 928 <h3><label for="required"><?php _e( "Field Requirement", 'buddypress' ); ?></label></h3> 929 <div class="inside"> 930 <select name="required" id="required" style="width: 30%"> 931 <option value="0"<?php selected( $this->is_required, '0' ); ?>><?php _e( 'Not Required', 'buddypress' ); ?></option> 932 <option value="1"<?php selected( $this->is_required, '1' ); ?>><?php _e( 'Required', 'buddypress' ); ?></option> 933 </select> 934 </div> 935 </div> 936 937 <div class="postbox"> 938 <h3><label for="fieldtype"><?php _e( 'Field Type', 'buddypress'); ?></label></h3> 939 <div class="inside"> 940 <select name="fieldtype" id="fieldtype" onchange="show_options(this.value)" style="width: 30%"> 941 <optgroup label="<?php _e( 'Single Fields', 'buddypress' ); ?>"> 942 <option value="textbox" <?php selected( $this->type, 'textbox' ); ?>><?php _e( 'Text Box', 'buddypress' ); ?></option> 943 <option value="textarea" <?php selected( $this->type, 'textarea' ); ?>><?php _e( 'Multi-line Text Area', 'buddypress' ); ?></option> 944 <option value="datebox" <?php selected( $this->type, 'datebox' ); ?>><?php _e( 'Date Selector', 'buddypress' ); ?></option> 945 </optgroup> 946 <optgroup label="<?php _e( 'Multi Fields', 'buddypress' ); ?>"> 947 <option value="radio" <?php selected( $this->type, 'radio' ); ?>><?php _e( 'Radio Buttons', 'buddypress' ); ?></option> 948 <option value="selectbox" <?php selected( $this->type, 'selectbox' ); ?>><?php _e( 'Drop Down Select Box', 'buddypress' ); ?></option> 949 <option value="multiselectbox" <?php selected( $this->type, 'multiselectbox' ); ?>><?php _e( 'Multi Select Box', 'buddypress' ); ?></option> 950 <option value="checkbox" <?php selected( $this->type, 'checkbox' ); ?>><?php _e( 'Checkboxes', 'buddypress' ); ?></option> 951 </optgroup> 952 </select> 953 954 <?php do_action_ref_array( 'xprofile_field_additional_options', array( $this ) ); ?> 955 956 <?php $this->render_admin_form_children(); ?> 957 958 </div> 959 </div> 960 961 <?php else : ?> 962 963 <input type="hidden" name="required" id="required" value="1" /> 964 <input type="hidden" name="fieldtype" id="fieldtype" value="textbox" /> 965 966 <?php endif; ?> 967 860 968 </div> 861 </div> 862 863 <?php if ( '0' != $this->can_delete ) : ?> 864 865 <div id="titlediv"> 866 <h3><label for="required"><?php _e( "Is This Field Required?", 'buddypress' ); ?> *</label></h3> 867 <select name="required" id="required" style="width: 30%"> 868 <option value="0"<?php selected( $this->is_required, '0' ); ?>><?php _e( 'Not Required', 'buddypress' ); ?></option> 869 <option value="1"<?php selected( $this->is_required, '1' ); ?>><?php _e( 'Required', 'buddypress' ); ?></option> 870 </select> 871 </div> 872 873 <div id="titlediv"> 874 <h3><label for="fieldtype"><?php _e( 'Field Type', 'buddypress'); ?> *</label></h3> 875 <select name="fieldtype" id="fieldtype" onchange="show_options(this.value)" style="width: 30%"> 876 <option value="textbox" <?php selected( $this->type, 'textbox' ); ?>><?php _e( 'Text Box', 'buddypress' ); ?></option> 877 <option value="textarea" <?php selected( $this->type, 'textarea' ); ?>><?php _e( 'Multi-line Text Box', 'buddypress' ); ?></option> 878 <option value="datebox" <?php selected( $this->type, 'datebox' ); ?>><?php _e( 'Date Selector', 'buddypress' ); ?></option> 879 <option value="radio" <?php selected( $this->type, 'radio' ); ?>><?php _e( 'Radio Buttons', 'buddypress' ); ?></option> 880 <option value="selectbox" <?php selected( $this->type, 'selectbox' ); ?>><?php _e( 'Drop Down Select Box', 'buddypress' ); ?></option> 881 <option value="multiselectbox" <?php selected( $this->type, 'multiselectbox' ); ?>><?php _e( 'Multi Select Box', 'buddypress' ); ?></option> 882 <option value="checkbox" <?php selected( $this->type, 'checkbox' ); ?>><?php _e( 'Checkboxes', 'buddypress' ); ?></option> 883 </select> 884 </div> 885 886 <?php do_action_ref_array( 'xprofile_field_additional_options', array( $this ) ); ?> 887 888 <?php $this->render_admin_form_children(); ?> 889 890 <?php else : ?> 891 892 <input type="hidden" name="required" id="required" value="1" /> 893 <input type="hidden" name="fieldtype" id="fieldtype" value="textbox" /> 894 895 <?php endif; 896 897 /* The fullname field cannot be hidden */ 898 if ( 1 != $this->id ) : ?> 899 900 <div id="titlediv"> 901 <div id="titlewrap"> 902 <h3><label for="default-visibility"><?php _e( 'Default Visibility', 'buddypress' ); ?></label></h3> 903 <ul> 904 905 <?php foreach( bp_xprofile_get_visibility_levels() as $level ) : ?> 906 907 <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> 908 909 <?php endforeach ?> 910 911 </ul> 912 </div> 913 914 <div id="titlewrap"> 915 <h3><label for="allow-custom-visibility"><?php _e( 'Per-Member Visibility', 'buddypress' ); ?></label></h3> 916 <ul> 917 <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> 918 <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> 919 </ul> 920 </div> 921 </div> 922 923 <?php endif ?> 924 925 <p class="submit"> 926 <input type="hidden" name="field_order" id="field_order" value="<?php echo esc_attr( $this->field_order ); ?>" /> 927 <input type="submit" value="<?php _e( 'Save', 'buddypress' ); ?>" name="saveField" id="saveField" style="font-weight: bold" class="button-primary" /> 928 <?php _e( 'or', 'buddypress' ); ?> <a href="users.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a> 929 </p> 930 931 </div> 932 933 <?php wp_nonce_field( 'xprofile_delete_option' ); ?> 969 </div><!-- #post-body --> 970 971 </div><!-- #poststuff --> 934 972 935 973 </form>
Note: See TracChangeset
for help on using the changeset viewer.