Skip to:
Content

BuddyPress.org

Changeset 5599


Ignore:
Timestamp:
12/24/2011 06:11:28 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Tweak XProfile CSS and JS. See #3801.

Location:
trunk/bp-xprofile
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/admin/css/admin.css

    r5591 r5599  
    1 div#icon-buddypress{background:url(../../../bp-core/images/icons32.png) no-repeat -4px 0;}#tabs-bottom{background:#f9f9f9;height:32px;border:1px solid #dfdfdf;border-radius:0 0 3px 3px;}#tabs{position:relative;}p.nofields{margin-top:20px;}ul#field-group-tabs{float:left;padding:0 0 0 15px;margin:0;display:none;}ul#field-group-tabs li{float:left;margin-bottom:-1px;background-color:transparent;margin-right:8px;}ul#field-group-tabs li.ui-state-hover{background-color:#fafafa;}ul#field-group-tabs li.ui-state-hover a.ui-tab{border-color:#dfdfdf #dfdfdf #f9f9f9 #dfdfdf;color:#d54e21;}ul#field-group-tabs li.ui-state-acceptable a.ui-tab{border-color:#5a5 #5a5 #ccc #5a5;color:#8a8;background-color:#efe;}ul#field-group-tabs li.ui-tabs-selected.ui-state-acceptable a.ui-tab{background-color:#f9f9f9;}ul#field-group-tabs li.drop-candidate a.ui-tab{background-color:#ffc;border-color:#aa5 #aa5 #ccc #aa5;color:#aa8;}ul#field-group-tabs li a.ui-tab{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:14px;display:block;margin-top:3px;padding:5px 10px 5px;border:1px solid #dfdfdf;border-bottom:none;border-radius:3px 3px 0 0;text-decoration:none;color:#aaa;}ul#field-group-tabs li.ui-tabs-selected a.ui-tab{background-color:#f9f9f9;margin-top:-1px;padding:7px 10px 7px;border:1px solid #dfdfdf;border-bottom:1px solid transparent;color:#000;}.tab-toolbar{background:#f9f9f9;border-width:1px 1px 0;border-radius:3px 3px 0 0;margin:-20px -21px 20px -21px;clear:left;padding:10px;border:1px solid #dfdfdf;}.field-wrapper a.deletion,.tab-toolbar a.deletion{color:#f00;border-bottom:1px solid #f00;font-size:12px;text-decoration:none;padding:0;margin:-2px 0 0 5px;}div.tab-toolbar a.button-primary{color:#fff!important;}div.tab-wrapper{background-color:#fff;clear:left;padding:20px;border-left:1px solid #ccc;border-right:1px solid #ccc;border-radius:3px 3px 0 0;}.tab-wrapper fieldset{position:relative;cursor:default!important;background:inherit;}.tab-wrapper fieldset legend{padding-bottom:15px;font-weight:bold;}.tab-wrapper .xprofile-field{position:relative;}.tab-wrapper fieldset fieldset{position:relative;border:1px solid #ddd;border-radius:3px;margin:10px 0 0 0;cursor:move!important;background:#f9f9f9;}.tab-wrapper fieldset fieldset legend{position:absolute!important;top:0;left:0;width:80%;padding:30px;}.tab-wrapper fieldset fieldset legend span{position:absolute;top:6px;left:10px;font-weight:bold;width:100%;}.field-group fieldset:hover{background-color:#fafafa;border-color:#ccc;}fieldset div.field-wrapper{padding:40px 10px 10px;}fieldset.radio div div,fieldset.checkbox div{float:left;}fieldset.radio div div label,fieldset.checkbox div label{margin-right:20px;}fieldset.clear-value{margin-left:10px;}.field-group div.actions{position:absolute;right:8px;top:10px;}.field-group fieldset:hover div.actions{display:block;}.field-group fieldset.ui-sortable-placeholder{border:1px dashed #999;background-color:#eee;visibility:visible!important;}ul.forTab{list-style:none;padding:0;margin:0 0 0 1em;}ul.forTab li{margin:0 0 1em 0;}ul.forTab li label{display:block;}ul.forTab li input{font-size:1.4em;}p.success{background:green;}p.err{border-top:2px solid red;border-bottom:2px solid red;color:red;padding:5px 0;width:40%;}span.desc,span.signup-description{display:block;font-size:11px;color:#555;}select.multi-select{width:90%;height:10em!important;}ul.multi-checkbox{margin:0 5px 0 0;padding:.5em .9em;height:10em;overflow:auto;list-style:none;border:solid 1px #ccc;width:90%;}ul.multi-checkbox li{padding:0;margin:0;}div.options-box{margin-left:20px!important;margin-right:10px!important;border-left:4px solid #EAF3FA;padding-left:15px;}th a{background:#fff;padding:2px 5px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;top:-2px;}textarea#description{border:1px solid #ddd;width:85%;}
     1div#icon-buddypress{background:url(../../../bp-core/images/icons32.png) no-repeat -4px 0}#tabs-bottom{background:#f9f9f9;height:32px;border:1px solid #dfdfdf;border-radius:0 0 3px 3px}#tabs{position:relative}p.nofields{margin-top:20px}ul#field-group-tabs{float:left;padding:0 0 0 15px;margin:0;display:none}ul#field-group-tabs li{float:left;margin-bottom:-1px;background-color:transparent;margin-right:8px}ul#field-group-tabs li.ui-state-hover{background-color:#fafafa}ul#field-group-tabs li.ui-state-hover a.ui-tab{border-color:#dfdfdf #dfdfdf #f9f9f9 #dfdfdf;color:#d54e21}ul#field-group-tabs li.ui-state-acceptable a.ui-tab{border-color:#5a5 #5a5 #ccc #5a5;color:#8a8;background-color:#efe}ul#field-group-tabs li.ui-tabs-selected.ui-state-acceptable a.ui-tab{background-color:#f9f9f9}ul#field-group-tabs li.drop-candidate a.ui-tab{background-color:#ffc;border-color:#aa5 #aa5 #ccc #aa5;color:#aa8}ul#field-group-tabs li a.ui-tab{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:14px;display:block;margin-top:3px;padding:5px 10px 5px;border:1px solid #dfdfdf;border-bottom:0;border-radius:3px 3px 0 0;text-decoration:none;color:#aaa}ul#field-group-tabs li.ui-tabs-selected a.ui-tab{background-color:#f9f9f9;margin-top:-1px;padding:7px 10px 7px;border:1px solid #dfdfdf;border-bottom:1px solid transparent;color:#000}.tab-toolbar{background:#f9f9f9;border-width:1px 1px 0;border-radius:3px 3px 0 0;margin:-20px -21px 20px -21px;clear:left;padding:10px;border:1px solid #dfdfdf}.field-wrapper a.deletion,.tab-toolbar a.deletion{color:#f00;border-bottom:1px solid #f00;font-size:12px;text-decoration:none;padding:0;margin:-2px 0 0 5px}div.tab-toolbar a.button-primary{color:#fff!important}div.tab-wrapper{background-color:#fff;clear:left;padding:20px;border-left:1px solid #ccc;border-right:1px solid #ccc;border-radius:3px 3px 0 0}.tab-wrapper fieldset{position:relative;cursor:default!important;background:inherit}.tab-wrapper fieldset legend{padding-bottom:15px;font-weight:bold}.tab-wrapper .xprofile-field{position:relative}.tab-wrapper fieldset fieldset{position:relative;border:1px solid #ddd;border-radius:3px;margin:10px 0 0 0;cursor:move!important;background:#f9f9f9}.tab-wrapper fieldset fieldset legend{position:absolute!important;top:0;left:0;width:80%;padding:30px}.tab-wrapper fieldset fieldset legend span{position:absolute;top:6px;left:10px;font-weight:bold;width:100%}.field-group fieldset:hover{background-color:#fafafa;border-color:#ccc}fieldset div.field-wrapper{padding:40px 10px 10px}fieldset.radio div div label,fieldset.checkbox div label{margin-right:20px}fieldset.clear-value{margin-left:10px}.field-group div.actions{float:none;border-top:1px solid #ddd;margin:20px 0 0;padding-top:10px}.field-group div.actions a,.field-group div.actions button,.field-group div.actions input{float:none}.field-group fieldset:hover div.actions{display:block}.field-group fieldset.ui-sortable-placeholder{border:1px dashed #999;background-color:#eee;visibility:visible!important}ul.forTab{list-style:none;padding:0;margin:0 0 0 1em}ul.forTab li{margin:0 0 1em 0}ul.forTab li label{display:block}ul.forTab li input{font-size:1.4em}p.success{background:green}p.err{border-top:2px solid red;border-bottom:2px solid red;color:red;padding:5px 0;width:40%}span.desc,span.signup-description{display:block;font-size:11px;color:#555}select.multi-select{width:90%;height:10em!important}ul.multi-checkbox{margin:0 5px 0 0;padding:.5em .9em;height:10em;overflow:auto;list-style:none;border:solid 1px #ccc;width:90%}ul.multi-checkbox li{padding:0;margin:0}div.options-box{margin-left:20px!important;margin-right:10px!important;border-left:4px solid #eaf3fa;padding-left:15px}th a{background:#fff;padding:2px 5px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;top:-2px}textarea#description{border:1px solid #ddd;width:85%}
  • trunk/bp-xprofile/admin/css/admin.dev.css

    r5591 r5599  
    149149            padding: 40px 10px 10px;
    150150        }
    151     fieldset.radio div div,
    152     fieldset.checkbox div {
    153         float: left;
    154     }
    155151    fieldset.radio div div label,
    156152    fieldset.checkbox div label {
     
    162158    }
    163159    .field-group div.actions {
    164         position: absolute;
    165         right: 8px;
    166         top: 10px;
     160        float: none;
     161        border-top: 1px solid #ddd;
     162        margin: 20px 0 0;
     163        padding-top: 10px;
     164    }
     165    .field-group div.actions a,
     166    .field-group div.actions button,
     167    .field-group div.actions input {
     168        float: none;
    167169    }
    168170    .field-group fieldset:hover div.actions {
  • trunk/bp-xprofile/admin/js/admin.dev.js

    r3771 r5599  
    11function add_option(forWhat) {
    2     var holder = document.getElementById(forWhat + "_more");
    3     var theId = document.getElementById(forWhat + '_option_number').value;
    4 
    5     var newDiv = document.createElement('p');
     2    var holder    = document.getElementById(forWhat + "_more");
     3    var theId     = document.getElementById(forWhat + '_option_number').value;
     4    var newDiv    = document.createElement('p');
     5    var newOption = document.createElement('input');
     6    var label     = document.createElement( 'label' );
     7    var txt       = document.createTextNode( "Option " + theId + ": " );
     8    var isDefault = document.createElement( 'input' );
     9    var label1    = document.createElement( 'label' );
     10    var txt1      = document.createTextNode( " Default Value " );
     11
    612    newDiv.setAttribute('id', forWhat + '_div' + theId);
    7 
    8     var newOption = document.createElement('input');
    9     newOption.setAttribute('type', 'text');
    10     newOption.setAttribute('name', forWhat + '_option[' + theId + ']');
    11     newOption.setAttribute('id', forWhat + '_option' + theId);
    12 
    13     var label = document.createElement('label');
    14     label.setAttribute('for', forWhat + '_option' + theId);
    15 
    16     var txt = document.createTextNode("Option " + theId + ": ");
    17     label.appendChild(txt);
    18 
    19     var isDefault = document.createElement('input');
    20 
    21     if(forWhat == 'checkbox' || forWhat == 'multiselectbox') {
    22         isDefault.setAttribute('type', 'checkbox');
    23         isDefault.setAttribute('name', 'isDefault_' + forWhat + '_option[' + theId + ']');
     13   
     14    newOption.setAttribute( 'type', 'text' );
     15    newOption.setAttribute( 'name', forWhat + '_option[' + theId + ']' );
     16    newOption.setAttribute( 'id', forWhat + '_option' + theId );
     17
     18    label.setAttribute( 'for', forWhat + '_option' + theId );
     19    label.appendChild( txt );
     20
     21    if ( forWhat == 'checkbox' || forWhat == 'multiselectbox' ) {
     22        isDefault.setAttribute( 'type', 'checkbox' );
     23        isDefault.setAttribute( 'name', 'isDefault_' + forWhat + '_option[' + theId + ']' );
    2424    } else {
    25         isDefault.setAttribute('type', 'radio');
    26         isDefault.setAttribute('name', 'isDefault_' + forWhat + '_option');
     25        isDefault.setAttribute( 'type', 'radio' );
     26        isDefault.setAttribute( 'name', 'isDefault_' + forWhat + '_option' );
    2727    }
    2828
    29     isDefault.setAttribute('value', theId);
    30 
    31     var label1 = document.createElement('label');
    32     var txt1 = document.createTextNode(" Default Value ");
    33 
    34     label1.appendChild(txt1);
    35     label1.setAttribute('for', 'isDefault_' + forWhat + '_option[]');
    36     toDelete = document.createElement('a');
    37 
    38     toDeleteText = document.createTextNode('[x]');
    39     toDelete.setAttribute('href',"javascript:hide('" + forWhat + '_div' + theId + "')");
    40 
    41     toDelete.setAttribute('class','delete');
    42 
    43     toDelete.appendChild(toDeleteText);
    44 
    45     newDiv.appendChild(label);
    46     newDiv.appendChild(newOption);
    47     newDiv.appendChild(document.createTextNode(" "));
    48     newDiv.appendChild(isDefault);
    49     newDiv.appendChild(label1);
    50     newDiv.appendChild(toDelete);
    51     holder.appendChild(newDiv);
     29    isDefault.setAttribute( 'value', theId );
     30
     31    label1.appendChild( txt1 );
     32    label1.setAttribute( 'for', 'isDefault_' + forWhat + '_option[]' );
     33
     34    toDelete     = document.createElement( 'a' );
     35    toDeleteText = document.createTextNode( '[x]' );
     36
     37    toDelete.setAttribute( 'href', "javascript:hide('" + forWhat + '_div' + theId + "')" );
     38    toDelete.setAttribute( 'class', 'delete' );
     39    toDelete.appendChild( toDeleteText );
     40
     41    newDiv.appendChild( label );
     42    newDiv.appendChild( newOption );
     43    newDiv.appendChild( document.createTextNode( " " ) );
     44    newDiv.appendChild( isDefault );
     45    newDiv.appendChild( label1 );
     46    newDiv.appendChild( toDelete );
     47    holder.appendChild( newDiv );
    5248
    5349
    5450    theId++
     51
    5552    document.getElementById(forWhat + "_option_number").value = theId;
    5653}
    5754
    5855function show_options(forWhat) {
    59     document.getElementById("radio").style.display = "none";
    60     document.getElementById("selectbox").style.display = "none";
    61     document.getElementById("multiselectbox").style.display = "none";
    62     document.getElementById("checkbox").style.display = "none";
    63 
    64     if(forWhat == "radio")
    65         document.getElementById("radio").style.display = "";
    66 
    67     if(forWhat == "selectbox")
    68         document.getElementById("selectbox").style.display = "";
    69 
    70     if(forWhat == "multiselectbox")
    71         document.getElementById("multiselectbox").style.display = "";
    72 
    73     if(forWhat == "checkbox")
    74         document.getElementById("checkbox").style.display = "";
     56    document.getElementById( 'radio'          ).style.display = 'none';
     57    document.getElementById( 'selectbox'      ).style.display = 'none';
     58    document.getElementById( 'multiselectbox' ).style.display = 'none';
     59    document.getElementById( 'checkbox'       ).style.display = 'none';
     60
     61    if ( forWhat == 'radio' )
     62        document.getElementById( 'radio' ).style.display = "";
     63
     64    if ( forWhat == 'selectbox' )
     65        document.getElementById( 'selectbox' ).style.display = "";
     66
     67    if ( forWhat == 'multiselectbox' )
     68        document.getElementById( 'multiselectbox' ).style.display = "";
     69
     70    if ( forWhat == 'checkbox' )
     71        document.getElementById( 'checkbox' ).style.display = "";
    7572}
    7673
    77 function hide(id) {
    78     if ( !document.getElementById(id) ) return false;
    79 
    80     document.getElementById(id).style.display = "none";
    81     document.getElementById(id).value = '';
     74function hide( id ) {
     75    if ( !document.getElementById( id ) ) return false;
     76
     77    document.getElementById( id ).style.display = "none";
     78    document.getElementById( id ).value = '';
    8279}
    83 
    84 // Set up deleting options ajax
    85 jQuery(document).ready( function() {
    86 
    87     jQuery("a.ajax-option-delete").click(
    88         function() {
    89             var theId = this.id.split('-');
    90             theId = theId[1];
    91 
    92             jQuery.post( ajaxurl, {
    93                 action: 'xprofile_delete_option',
    94                 'cookie': encodeURIComponent(document.cookie),
    95                 '_wpnonce': jQuery("input#_wpnonce").val(),
    96 
    97                 'option_id': theId
    98             },
    99             function(response)
    100             {});
    101         }
    102     );
    103 });
    10480
    10581var fixHelper = function(e, ui) {
     
    11086};
    11187
    112 // Main XProfile behavior layer
    113 jQuery(document).ready( function() {
    114     /* Show object if JS is enabled */
    115     jQuery( "ul#field-group-tabs" ).show();
    116 
    117     /* Allow reordering of field group tabs */
    118     jQuery( "ul#field-group-tabs" ).sortable( {
     88// Set up deleting options ajax
     89jQuery( document ).ready( function() {
     90
     91    jQuery( 'a.ajax-option-delete' ).click(
     92        function() {
     93            var theId = this.id.split( '-' );
     94            theId = theId[1];
     95
     96            jQuery.post( ajaxurl, {
     97                action: 'xprofile_delete_option',
     98                'cookie': encodeURIComponent( document.cookie ),
     99                '_wpnonce': jQuery('input#_wpnonce').val(),
     100                'option_id': theId
     101            },
     102            function( response ) {} );
     103        }
     104    );
     105
     106    // Show object if JS is enabled
     107    jQuery( 'ul#field-group-tabs' ).show();
     108
     109    // Allow reordering of field group tabs
     110    jQuery( 'ul#field-group-tabs' ).sortable( {
    119111        cursor: 'move',
    120112        axis: 'x',
     
    126118            jQuery.post( ajaxurl, {
    127119                action: 'xprofile_reorder_groups',
    128                 'cookie': encodeURIComponent(document.cookie),
    129                 '_wpnonce_reorder_groups': jQuery( "input#_wpnonce_reorder_groups" ).val(),
    130                 'group_order': jQuery(this).sortable( 'serialize' )
    131             },
    132             function(response){});
     120                'cookie': encodeURIComponent( document.cookie ),
     121                '_wpnonce_reorder_groups': jQuery( 'input#_wpnonce_reorder_groups' ).val(),
     122                'group_order': jQuery( this ).sortable( 'serialize' )
     123            },
     124            function( response ) {} );
    133125        }
    134126    }).disableSelection();
    135127
    136     /* Allow reordering of fields within groups */
    137     jQuery( "fieldset.field-group" ).sortable({
     128    // Allow reordering of fields within groups
     129    jQuery( 'fieldset.field-group' ).sortable({
    138130        cursor: 'move',
    139131        opacity: 0.3,
     
    145137                action: 'xprofile_reorder_fields',
    146138                'cookie': encodeURIComponent(document.cookie),
    147                 '_wpnonce_reorder_fields': jQuery( "input#_wpnonce_reorder_fields" ).val(),
     139                '_wpnonce_reorder_fields': jQuery( 'input#_wpnonce_reorder_fields' ).val(),
    148140                'field_order': jQuery(this).sortable( 'serialize' ),
    149141                'field_group_id': jQuery(this).attr( 'id' )
    150142            },
    151             function(response)
    152             {});
     143            function( response ) {} );
    153144        }
    154145    })
    155146
    156     /* Disallow text selection */
     147    // Disallow text selection
    157148    .disableSelection()
    158149
    159     /* Change cursor to move if JS is enabled */
     150    // Change cursor to move if JS is enabled
    160151    .css( 'cursor', 'move' );
    161152
    162     /* tabs init with a custom tab template and an "add" callback filling in the content */
     153    // tabs init with a custom tab template and an "add" callback filling in the content
    163154    var $tab_items;
    164     var $tabs = jQuery( "#tabs" ).tabs();
     155    var $tabs = jQuery( '#tabs' ).tabs();
    165156    set_tab_items( $tabs );
    166157
    167158    function set_tab_items( $tabs ) {
    168         $tab_items = jQuery( "ul:first li", $tabs ).droppable({
    169             accept: ".connectedSortable fieldset",
    170             hoverClass: "ui-state-hover",
    171             activeClass: "ui-state-acceptable",
    172             touch: "pointer",
    173             tolerance: "pointer",
    174 
    175             /* When field is dropped on tab */
     159        $tab_items = jQuery( 'ul:first li', $tabs ).droppable({
     160            accept: '.connectedSortable fieldset',
     161            hoverClass: 'ui-state-hover',
     162            activeClass: 'ui-state-acceptable',
     163            touch: 'pointer',
     164            tolerance: 'pointer',
     165
     166            // When field is dropped on tab
    176167            drop: function( ev, ui ) {
    177                 /* The tab */
     168                // The tab
    178169                var $item = jQuery(this);
    179170
    180                 /* The tab body */
     171                // The tab body
    181172                var $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' );
    182173
    183                 /* Remove helper class */
     174                // Remove helper class
    184175                jQuery($item).removeClass( 'drop-candidate' );
    185176
    186                 /* Hide field, change selected tab, and show new placement */
     177                // Hide field, change selected tab, and show new placement
    187178                ui.draggable.hide( 'slow', function() {
    188179
    189                     /* Select new tab as current */
     180                    // Select new tab as current
    190181                    $tabs.tabs( 'select', $tab_items.index( $item ) );
    191182
    192                     /* Show new placement */
     183                    // Show new placement
    193184                    jQuery(this).appendTo($list).show( 'slow' ).animate( {opacity: "1"}, 500 );
    194185
    195                     /* Refresh $list variable */
     186                    // Refresh $list variable
    196187                    $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' );
    197188                    jQuery($list).find( 'p.nofields' ).hide( 'slow' );
    198189
    199                     /* Ajax update field locations and orders */
     190                    // Ajax update field locations and orders
    200191                    jQuery.post( ajaxurl, {
    201192                        action: 'xprofile_reorder_fields',
     
    205196                        'field_group_id': jQuery( $list ).attr( 'id' )
    206197                    },
    207                     function(response){});
     198                    function( response ) {} );
    208199                });
    209200            },
  • trunk/bp-xprofile/admin/js/admin.js

    r3771 r5599  
    1 function add_option(f){var h=document.getElementById(f+"_more");var j=document.getElementById(f+"_option_number").value;var a=document.createElement("p");a.setAttribute("id",f+"_div"+j);var g=document.createElement("input");g.setAttribute("type","text");g.setAttribute("name",f+"_option["+j+"]");g.setAttribute("id",f+"_option"+j);var i=document.createElement("label");i.setAttribute("for",f+"_option"+j);var e=document.createTextNode("Option "+j+": ");i.appendChild(e);var b=document.createElement("input");if(f=="checkbox"||f=="multiselectbox"){b.setAttribute("type","checkbox");b.setAttribute("name","isDefault_"+f+"_option["+j+"]")}else{b.setAttribute("type","radio");b.setAttribute("name","isDefault_"+f+"_option")}b.setAttribute("value",j);var d=document.createElement("label");var c=document.createTextNode(" Default Value ");d.appendChild(c);d.setAttribute("for","isDefault_"+f+"_option[]");toDelete=document.createElement("a");toDeleteText=document.createTextNode("[x]");toDelete.setAttribute("href","javascript:hide('"+f+"_div"+j+"')");toDelete.setAttribute("class","delete");toDelete.appendChild(toDeleteText);a.appendChild(i);a.appendChild(g);a.appendChild(document.createTextNode(" "));a.appendChild(b);a.appendChild(d);a.appendChild(toDelete);h.appendChild(a);j++;document.getElementById(f+"_option_number").value=j}function show_options(a){document.getElementById("radio").style.display="none";document.getElementById("selectbox").style.display="none";document.getElementById("multiselectbox").style.display="none";document.getElementById("checkbox").style.display="none";if(a=="radio"){document.getElementById("radio").style.display=""}if(a=="selectbox"){document.getElementById("selectbox").style.display=""}if(a=="multiselectbox"){document.getElementById("multiselectbox").style.display=""}if(a=="checkbox"){document.getElementById("checkbox").style.display=""}}function hide(a){if(!document.getElementById(a)){return false}document.getElementById(a).style.display="none";document.getElementById(a).value=""}jQuery(document).ready(function(){jQuery("a.ajax-option-delete").click(function(){var a=this.id.split("-");a=a[1];jQuery.post(ajaxurl,{action:"xprofile_delete_option",cookie:encodeURIComponent(document.cookie),_wpnonce:jQuery("input#_wpnonce").val(),option_id:a},function(b){})})});var fixHelper=function(b,a){a.children().each(function(){jQuery(this).width(jQuery(this).width())});return a};jQuery(document).ready(function(){jQuery("ul#field-group-tabs").show();jQuery("ul#field-group-tabs").sortable({cursor:"move",axis:"x",opacity:0.6,items:"li",tolerance:"pointer",update:function(){jQuery.post(ajaxurl,{action:"xprofile_reorder_groups",cookie:encodeURIComponent(document.cookie),_wpnonce_reorder_groups:jQuery("input#_wpnonce_reorder_groups").val(),group_order:jQuery(this).sortable("serialize")},function(d){})}}).disableSelection();jQuery("fieldset.field-group").sortable({cursor:"move",opacity:0.3,items:"fieldset",tolerance:"pointer",update:function(){jQuery.post(ajaxurl,{action:"xprofile_reorder_fields",cookie:encodeURIComponent(document.cookie),_wpnonce_reorder_fields:jQuery("input#_wpnonce_reorder_fields").val(),field_order:jQuery(this).sortable("serialize"),field_group_id:jQuery(this).attr("id")},function(d){})}}).disableSelection().css("cursor","move");var b;var a=jQuery("#tabs").tabs();c(a);function c(d){b=jQuery("ul:first li",d).droppable({accept:".connectedSortable fieldset",hoverClass:"ui-state-hover",activeClass:"ui-state-acceptable",touch:"pointer",tolerance:"pointer",drop:function(g,h){var e=jQuery(this);var f=jQuery(e.find("a").attr("href")).find(".connectedSortable");jQuery(e).removeClass("drop-candidate");h.draggable.hide("slow",function(){d.tabs("select",b.index(e));jQuery(this).appendTo(f).show("slow").animate({opacity:"1"},500);f=jQuery(e.find("a").attr("href")).find(".connectedSortable");jQuery(f).find("p.nofields").hide("slow");jQuery.post(ajaxurl,{action:"xprofile_reorder_fields",cookie:encodeURIComponent(document.cookie),_wpnonce_reorder_fields:jQuery("input#_wpnonce_reorder_fields").val(),field_order:jQuery(f).sortable("serialize"),field_group_id:jQuery(f).attr("id")},function(i){})})},over:function(e,f){jQuery(this).addClass("drop-candidate")},out:function(e,f){jQuery(this).removeClass("drop-candidate")}})}});
     1function add_option(f){var h=document.getElementById(f+"_more");var j=document.getElementById(f+"_option_number").value;var a=document.createElement("p");var g=document.createElement("input");var i=document.createElement("label");var e=document.createTextNode("Option "+j+": ");var b=document.createElement("input");var d=document.createElement("label");var c=document.createTextNode(" Default Value ");a.setAttribute("id",f+"_div"+j);g.setAttribute("type","text");g.setAttribute("name",f+"_option["+j+"]");g.setAttribute("id",f+"_option"+j);i.setAttribute("for",f+"_option"+j);i.appendChild(e);if(f=="checkbox"||f=="multiselectbox"){b.setAttribute("type","checkbox");b.setAttribute("name","isDefault_"+f+"_option["+j+"]")}else{b.setAttribute("type","radio");b.setAttribute("name","isDefault_"+f+"_option")}b.setAttribute("value",j);d.appendChild(c);d.setAttribute("for","isDefault_"+f+"_option[]");toDelete=document.createElement("a");toDeleteText=document.createTextNode("[x]");toDelete.setAttribute("href","javascript:hide('"+f+"_div"+j+"')");toDelete.setAttribute("class","delete");toDelete.appendChild(toDeleteText);a.appendChild(i);a.appendChild(g);a.appendChild(document.createTextNode(" "));a.appendChild(b);a.appendChild(d);a.appendChild(toDelete);h.appendChild(a);j++;document.getElementById(f+"_option_number").value=j}function show_options(a){document.getElementById("radio").style.display="none";document.getElementById("selectbox").style.display="none";document.getElementById("multiselectbox").style.display="none";document.getElementById("checkbox").style.display="none";if(a=="radio"){document.getElementById("radio").style.display=""}if(a=="selectbox"){document.getElementById("selectbox").style.display=""}if(a=="multiselectbox"){document.getElementById("multiselectbox").style.display=""}if(a=="checkbox"){document.getElementById("checkbox").style.display=""}}function hide(a){if(!document.getElementById(a)){return false}document.getElementById(a).style.display="none";document.getElementById(a).value=""}var fixHelper=function(b,a){a.children().each(function(){jQuery(this).width(jQuery(this).width())});return a};jQuery(document).ready(function(){jQuery("a.ajax-option-delete").click(function(){var d=this.id.split("-");d=d[1];jQuery.post(ajaxurl,{action:"xprofile_delete_option",cookie:encodeURIComponent(document.cookie),_wpnonce:jQuery("input#_wpnonce").val(),option_id:d},function(e){})});jQuery("ul#field-group-tabs").show();jQuery("ul#field-group-tabs").sortable({cursor:"move",axis:"x",opacity:0.6,items:"li",tolerance:"pointer",update:function(){jQuery.post(ajaxurl,{action:"xprofile_reorder_groups",cookie:encodeURIComponent(document.cookie),_wpnonce_reorder_groups:jQuery("input#_wpnonce_reorder_groups").val(),group_order:jQuery(this).sortable("serialize")},function(d){})}}).disableSelection();jQuery("fieldset.field-group").sortable({cursor:"move",opacity:0.3,items:"fieldset",tolerance:"pointer",update:function(){jQuery.post(ajaxurl,{action:"xprofile_reorder_fields",cookie:encodeURIComponent(document.cookie),_wpnonce_reorder_fields:jQuery("input#_wpnonce_reorder_fields").val(),field_order:jQuery(this).sortable("serialize"),field_group_id:jQuery(this).attr("id")},function(d){})}}).disableSelection().css("cursor","move");var b;var a=jQuery("#tabs").tabs();c(a);function c(d){b=jQuery("ul:first li",d).droppable({accept:".connectedSortable fieldset",hoverClass:"ui-state-hover",activeClass:"ui-state-acceptable",touch:"pointer",tolerance:"pointer",drop:function(g,h){var e=jQuery(this);var f=jQuery(e.find("a").attr("href")).find(".connectedSortable");jQuery(e).removeClass("drop-candidate");h.draggable.hide("slow",function(){d.tabs("select",b.index(e));jQuery(this).appendTo(f).show("slow").animate({opacity:"1"},500);f=jQuery(e.find("a").attr("href")).find(".connectedSortable");jQuery(f).find("p.nofields").hide("slow");jQuery.post(ajaxurl,{action:"xprofile_reorder_fields",cookie:encodeURIComponent(document.cookie),_wpnonce_reorder_fields:jQuery("input#_wpnonce_reorder_fields").val(),field_order:jQuery(f).sortable("serialize"),field_group_id:jQuery(f).attr("id")},function(i){})})},over:function(e,f){jQuery(this).addClass("drop-candidate")},out:function(e,f){jQuery(this).removeClass("drop-candidate")}})}});
  • trunk/bp-xprofile/bp-xprofile-cssjs.php

    r5574 r5599  
    11<?php
     2
    23// Exit if accessed directly
    34if ( !defined( 'ABSPATH' ) ) exit;
    45
     6/**
     7 * Enqueue the CSS for XProfile admin styling
     8 *
     9 * @since BuddyPress (1.1)
     10 */
    511function xprofile_add_admin_css() {
    6     $version = '20111212';
     12    $version = '20111224';
     13
    714    if ( !empty( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) {
    8         if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
     15        if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
    916            wp_enqueue_style( 'xprofile-admin-css', BP_PLUGIN_URL . 'bp-xprofile/admin/css/admin.dev.css', array(), $version );
    10         else
     17        } else {
    1118            wp_enqueue_style( 'xprofile-admin-css', BP_PLUGIN_URL . 'bp-xprofile/admin/css/admin.css',     array(), $version );
     19        }
    1220    }
    1321}
    1422add_action( bp_core_admin_hook(), 'xprofile_add_admin_css' );
    1523
     24/**
     25 * Enqueue the jQuery libraries for handling drag/drop/sort
     26 *
     27 * @since BuddyPres (1.5)
     28 */
    1629function xprofile_add_admin_js() {
    1730    if ( !empty( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) {
     
    2336        wp_enqueue_script( 'jquery-ui-sortable'  );
    2437
    25         $version = '20111212';
    26         if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
     38        $version = '20111224';
     39
     40        if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
    2741            wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . 'bp-xprofile/admin/js/admin.dev.js', array( 'jquery', 'jquery-ui-sortable' ), $version );
    28         else
     42        } else {
    2943            wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . 'bp-xprofile/admin/js/admin.js',     array( 'jquery', 'jquery-ui-sortable' ), $version );
     44        }
    3045    }
    3146}
    3247add_action( bp_core_admin_hook(), 'xprofile_add_admin_js', 1 );
     48
    3349?>
Note: See TracChangeset for help on using the changeset viewer.