Changeset 428757
- Timestamp:
- 08/25/2011 06:04:51 PM (15 years ago)
- Location:
- people-lists/trunk
- Files:
-
- 4 edited
-
css/people-lists.css (modified) (4 diffs)
-
js/people-lists.js (modified) (2 diffs)
-
people-lists.php (modified) (16 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
people-lists/trunk/css/people-lists.css
r368937 r428757 107 107 color: #111; 108 108 font-weight: bold; 109 letter-spacing: -.4 px;109 letter-spacing: -.45px; 110 110 } 111 111 … … 231 231 float:left; 232 232 } 233 #sortable1 li, 234 #sortable2 li { 233 .ui-state-default-list{ 235 234 margin: 5px; 236 235 padding: 5px; … … 267 266 border-radius: 2px; /* Opera 10.5, IE 9 */ 268 267 } 269 #sortable-profile-field li { 270 margin: 5px; 271 padding: 5px; 272 font-size: 1em; 273 width: 220px; 274 background: #EEE; 275 cursor: move; 276 -moz-border-radius: 2px; /* FF1+ */ 277 -webkit-border-radius: 2px; /* Saf3+, Chrome */ 278 border-radius: 2px; /* Opera 10.5, IE 9 */ 279 } 268 280 269 .listDiv { 281 270 width: 260px; … … 320 309 } 321 310 .template-tabbed{ 322 width: 330px;311 width:430px; 323 312 clear:left; 324 313 float:left; 314 } 315 #header-before-after span{ font-weight: bold; } 316 #before_after ul{ 317 border:1px solid #DFDFDF; 318 padding: 10px; 319 } 320 .before-after-item{ 321 position: relative; 322 overflow: hidden; 323 } 324 .after-item { 325 float:right; 326 width: 130px 327 } 328 .before-item{ 329 float: left; 330 width: 130px; 331 } 332 .before-after-item-label{ 333 width: 110px; 334 overflow: hidden; 335 display: block; 336 float: left; 337 margin-top: 4px; 338 margin-left: 5px; 325 339 } 326 340 ul.template-tabs li { -
people-lists/trunk/js/people-lists.js
r368937 r428757 61 61 jQuery(function($) { 62 62 63 63 64 // Initialize jQuery Sortable for lists. 64 65 $("ul.droptrue").sortable({ … … 69 70 // Initializing and storing attributes upon "submit-people-list" button click by user. 70 71 $('#submit-people-list').live( "click", function(){ 71 72 72 73 if(!$('#submit-people-list').attr("disabled")) { 73 74 74 75 var groupList = $("#sortable2").sortable( "serialize", {attribute: "id"}); 75 var list_title = $("#list-title").val(); 76 var avatar_size = $("#avatar_size").val(); 77 var list_id = $("#list-id").val(); 78 var template_text = $("#template-text").val(); 76 77 var people_list_form = $('#people-list-form').serialize(); // serialized data is so much easier to deal with 78 79 79 var data = { 80 80 action : 'people_list_save', 81 81 list : groupList, 82 title: list_title, 83 template: template_text, 84 avatar_size: avatar_size, 85 id: list_id 82 form: people_list_form, 86 83 }; 87 84 if($('#list-title').val() != '') -
people-lists/trunk/people-lists.php
r375311 r428757 9 9 * desired to be displayed. 10 10 * Author: Gagan Sandhu / Enej Bajgoric / CTLT DEV 11 * Version: 1.3. 311 * Version: 1.3.4 12 12 * Author URI: http://www.ctlt.ubc.ca 13 13 * … … 40 40 41 41 42 add_action('admin_footer-user-edit.php', 'wp_ tiny_mce_preload_dialogs', 30 );43 add_action('admin_footer-profile.php', 'wp_ tiny_mce_preload_dialogs', 30 );42 add_action('admin_footer-user-edit.php', 'wp_preload_dialogs', 30 ); 43 add_action('admin_footer-profile.php', 'wp_preload_dialogs', 30 ); 44 44 45 45 // for the media buttons 46 46 add_action('admin_footer-user-edit.php', 'people_lists_media_buttons', 40 ); 47 47 add_action('admin_footer-profile.php', 'people_lists_media_buttons', 40 ); 48 49 50 48 51 49 … … 132 130 $people_list['lists'] = array(); 133 131 $people_list = get_option($option_name); 134 132 135 133 wp_parse_str( $_POST['list'], $list ); 136 $title = $_POST['title']; 137 138 if(is_numeric($_POST['avatar_size'])) 139 $avatar_size = $_POST['avatar_size']; 140 else 141 $avatar_size = 96; 142 143 $template = trim($_POST['template']); 144 145 if( is_numeric( $_POST['id'] ) || is_array($people_list['lists'][$_POST['id']] )): 146 // Updating the list 147 $slug = $people_list['lists'][$_POST['id']]['slug']; 148 $people_list['lists'][$_POST['id']] = array('list'=>$list,'title'=>$title,'slug' => $slug,'template'=> $template, 'avatar_size' =>$avatar_size); 149 _e('update','people-list'); 134 135 136 wp_parse_str($_POST['form'], $data); 137 138 // set the list to be something nice 139 $data['list'] = $list; 140 141 if(!is_numeric($data['avatar_size'])) 142 $data['avatar_size'] = 96; 143 144 if( is_numeric( $data['list_id'] ) || is_array( $people_list['lists'][$data['list_id']] )): 145 // make sure that the slug is beeing passed on 146 $data['slug'] = $people_list['lists'][$data['list_id']]['slug']; 147 $people_list['lists'][$data['list_id']] = $data; 148 echo 'update'; 150 149 else: 151 $slug = people_lists_slug( $ title);150 $slug = people_lists_slug( $data['title'] ); 152 151 // Check if the slug exists 153 152 $counter = 1; 154 while( people_lists_slug_exists($slug,$people_list['lists']))153 while( people_lists_slug_exists($slug,$people_list['lists']) ) 155 154 { 156 $slug = people_lists_slug($ title)."-".$counter;155 $slug = people_lists_slug($data['title'])."-".$counter; 157 156 $counter += 1; 158 157 } 159 158 $data['slug'] = $slug; 160 159 // Saving for the first time 161 $people_list['lists'][] = array('list'=>$list,'title'=>$title, 'slug' => $slug , 'template'=> $template,'avatar_size' =>$avatar_size);162 _e('new','people-list');160 $people_list['lists'][] = $data; 161 echo 'new'; 163 162 endif; 164 163 165 164 update_option( $option_name, $people_list); 166 167 die(); 165 die(); // thats it 168 166 } 169 167 … … 248 246 249 247 wp_enqueue_script('people-lists-tinymce', plugins_url('/people-lists/js/people-lists-tinymce.js'),'jquery'); 248 249 add_filter( 'tiny_mce_before_init', 'clf_base_tiny_filter_remove_fullscreen'); 250 } 251 function people_lists_tiny_filter_remove_fullscreen($initArray){ 252 $initArray["theme_advanced_buttons1"] = str_replace(',fullscreen', '', $initArray["theme_advanced_buttons1"]); 253 return $initArray; 250 254 } 251 255 /** … … 289 293 function people_list_options_init_script(){ 290 294 wp_enqueue_script('people-lists-jquery-sortable', plugins_url('/people-lists/js/jquery-ui.min.js'), array('jquery','jquery-ui-tabs','jquery-ui-sortable')); 291 wp_enqueue_script('people-lists', plugins_url('/people-lists/js/people-lists -min.js'), array('jquery','jquery-ui-tabs','jquery-ui-sortable'));295 wp_enqueue_script('people-lists', plugins_url('/people-lists/js/people-lists.js'), array('jquery','jquery-ui-tabs','jquery-ui-sortable')); 292 296 } 293 297 … … 508 512 <div id="people-list-form-shell"> 509 513 <form method="post" id="people-list-form" action="options.php"> 510 <label for=" list-title"><?php _e('Name','people-list');?></label><br />511 <input type="text" value="<?php echo $list['title'];?>" name=" list-title" id="list-title" size="50" />514 <label for="title"><?php _e('Name','people-list');?></label><br /> 515 <input type="text" value="<?php echo $list['title'];?>" name="title" id="title" size="50" /> 512 516 <p><?php _e('The name helps identify which list you are editing.','people-list');?></p> 513 517 514 518 <a id="template-link" href="#"><?php _e('Template Info','people-list');?></a> 515 519 <div class="template-info" id="template-info" > 516 <label id="avatar_size_label"><?php _e('User Picture size:','people-list');?> <input type="text" id="avatar_size" value="<?php echo $list['avatar_size'];?>" name=" " size="3" />px <span><?php _e('the size of the image that is created when %thumbnail% is called in the template.','people-list');?></span></label>520 <label id="avatar_size_label"><?php _e('User Picture size:','people-list');?> <input type="text" id="avatar_size" value="<?php echo $list['avatar_size'];?>" name="avatar_size" size="3" />px <span><?php _e('the size of the image that is created when %thumbnail% is called in the template.','people-list');?></span></label> 517 521 518 522 <div class="template-tabbed"> … … 522 526 <li><a href="#default_codes" title="Default Codes" class="tabbed"><?php _e('Default Codes','people-list');?></a></li> 523 527 <li><a href="#added_fields" title="Added Fields" class="tabbed" ><?php _e('Added Fields Codes','people-list');?></a></li> 528 <li><a href="#before_after" title="Added Fields" class="tabbed" ><?php _e('Before & After','people-list');?></a></li> 524 529 </ul> 525 530 <div id="default_codes" class="template-content"> … … 545 550 <ul> 546 551 <?php 547 548 552 if( is_array($people_list_option['settings']) ): 549 553 foreach ($people_list_option['settings'] as $index => $field_slug): ?> … … 559 563 </ul> 560 564 </div> 565 <div id="before_after"> 566 <ul> 567 <li id="header-before-after"><span >before</span><span class='after-item'>after</span></li> 568 <?php 569 foreach(array('nickname','email','bio','firstname','lastname','username','thumbnail','website','aim','yahooim','jabbergoogle','id','authorurl') as $item): 570 $before = ( isset($list['before'][$item]) ? $list['before'][$item]: '' ); 571 $after = ( isset($list['after'][$item]) ? $list['after'][$item]: '' ); 572 people_lists_before_after_item($item,$list['before'][$item],$list['after'][$item],$item); 573 endforeach; 574 $item = null; 575 foreach ($people_list_option['settings'] as $item => $field_slug): 576 $before = ( isset($list['before'][$item]) ? $list['before'][$item]: '' ); 577 $after = ( isset($list['after'][$item]) ? $list['after'][$item]: '' ); 578 people_lists_before_after_item( $field_slug, $list['before'][$item], $list['after'][$item], $item ); 579 endforeach; 580 $item = null; 581 $filter_array = array(); 582 $filter_array = apply_filters('people_list_custom_fields',$filter_array); 583 foreach ( $filter_array as $item): 584 $before = ( isset($list['before'][$item]) ? $list['before'][$item]: '' ); 585 $after = ( isset($list['after'][$item]) ? $list['after'][$item]: '' ); 586 people_lists_before_after_item( $item, $list['before'][$item], $list['after'][$item], $item ); 587 endforeach; 588 ?> 589 </ul> 590 591 </div> 561 592 </div> 562 593 </div> 563 <textarea name="template -text" class="template-text" id="template-text"><?php594 <textarea name="template" class="template-text" id="template-text"><?php 564 595 if( !empty($list['template']) ) 565 596 echo stripslashes(trim($list['template'])); … … 578 609 foreach($users_of_blog as $person): 579 610 if(!in_array($person->ID, $list['list']['uid'])): ?> 580 <li class="ui-state-default " id="uid_<?php echo $person->ID; ?>">611 <li class="ui-state-default ui-state-default-list" id="uid_<?php echo $person->ID; ?>"> 581 612 <?php echo get_avatar($person->ID, 32); ?> 582 613 <?php echo $person->display_name; ?><span><?php echo $person->user_email; ?></span></li> … … 595 626 <?php if( is_array($list['list']['uid']) ): 596 627 foreach( $list['list']['uid'] as $person_id ): ?> 597 <li class="ui-state-default " id="uid_<?php echo $selected_people[$person_id]->ID; ?>">628 <li class="ui-state-default ui-state-default-list" id="uid_<?php echo $selected_people[$person_id]->ID; ?>"> 598 629 <?php echo get_avatar($selected_people[$person_id]->ID, 32); ?> 599 630 <?php echo $selected_people[$person_id]->display_name; ?><span><?php echo $selected_people[$person_id]->user_email; ?></span></li> … … 605 636 <p class="submit clear"> 606 637 <?php if(is_numeric($list_id)): ?> 607 <input type="hidden" value="<?php echo $list_id;?>" name="list_id" id="list-id" />638 <input type="hidden" value="<?php echo esc_attr($list_id);?>" name="list_id" id="list-id" /> 608 639 <input id="submit-people-list" type="submit" class="button-primary" value="<?php _e('Update Changes','people-list');?>" /> 609 640 <?php else: ?> … … 645 676 <?php if( is_array($people_list_option['settings']) ): 646 677 foreach ($people_list_option['settings'] as $index => $field_slug):?> 647 <li class="ui-state-default " ><?php echo stripslashes($field_slug); ?><span><?php _e('Template Code','people-list');?>: %<?php echo $index; ?>%<br /><a href="#" class="delete-field-link"><?php _e('Delete','people-list');?></a></span>678 <li class="ui-state-default ui-state-default-list" ><?php echo stripslashes($field_slug); ?><span><?php _e('Template Code','people-list');?>: %<?php echo $index; ?>%<br /><a href="#" class="delete-field-link"><?php _e('Delete','people-list');?></a></span> 648 679 <input type="hidden" value="<?php echo $index; ?>" name="field_slug_list[]" /> 649 680 <input type="hidden" value="<?php echo stripslashes($field_slug); ?>" name="field_name_list[]" /> … … 657 688 } 658 689 690 function people_lists_before_after_item($item = null, $before_value=null,$after_value=null,$id=null) 691 { 692 if( isset($item) ): 693 694 ?> 695 <li class="before-after-item"> 696 <input type="text" name="before[<?php echo $id; ?>]" value="<?php echo esc_attr($before_value); ?>" class="before-item" /> 697 <span class="before-after-item-label"><?php echo $item; ?></span> 698 <input type="text" name="after[<?php echo $id; ?>]" value="<?php echo esc_attr($after_value); ?>" class="after-item" /> 699 </li> 700 <?php endif; 701 } 659 702 /** 660 703 * people_lists_default_template function. … … 730 773 $user_data = get_userdata($id); 731 774 732 733 734 $replacements[0] = $user_data->nickname; 735 $replacements[1] = $user_data->user_email; 736 $replacements[2] = $user_data->description; 737 $replacements[3] = $user_data->first_name; 738 $replacements[4] = $user_data->last_name; 739 $replacements[5] = $user_data->user_login; 740 $replacements[6] = get_avatar($id,$found_people_list['avatar_size']); 741 $replacements[7] = $user_data->user_url; 742 $replacements[8] = $user_data->aim; 743 $replacements[9] = $user_data->yim; 744 $replacements[10] = $user_data->jabber; 745 $replacements[11] = $id; 746 $replacements[12] = get_author_posts_url($id); 775 $replacements[0] = ( !empty($user_data->nickname) ? $found_people_list['before']['nickname']. $user_data->nickname. $found_people_list['after']['nickname']:""); 776 $replacements[1] = ( !empty($user_data->user_email) ? $found_people_list['before']['email']. $user_data->user_email. $found_people_list['after']['email']:""); 777 $replacements[2] = ( !empty($user_data->description) ? $found_people_list['before']['bio']. $user_data->description. $found_people_list['after']['bio']:""); 778 $replacements[3] = ( !empty($user_data->first_name) ? $found_people_list['before']['firstname'].$user_data->first_name. $found_people_list['after']['firstname']:""); 779 $replacements[4] = ( !empty($user_data->last_name) ? $found_people_list['before']['lastname']. $user_data->last_name. $found_people_list['after']['lastname']:""); 780 $replacements[5] = ( !empty($user_data->user_login) ? $found_people_list['before']['username']. $user_data->user_login. $found_people_list['after']['username']:""); 781 $replacements[6] = $found_people_list['before']['thumbnail'].get_avatar($id,$found_people_list['avatar_size']). $found_people_list['after']['thumbnail']; 782 $replacements[7] = ( !empty($user_data->user_url) ? $found_people_list['before']['website']. $user_data->user_url. $found_people_list['after']['website']:""); 783 $replacements[8] = ( !empty($user_data->aim) ? $found_people_list['before']['aim']. $user_data->aim. $found_people_list['after']['aim']:""); 784 $replacements[9] = ( !empty($user_data->yim) ? $found_people_list['before']['yahooim']. $user_data->yim. $found_people_list['after']['yahooim']:""); 785 $replacements[10] = ( !empty($user_data->jabber) ? $found_people_list['before']['jabbergoogle'].$user_data->jabber. $found_people_list['after']['jabbergoogle']:""); 786 $replacements[11] = $found_people_list['before']['id']. $id. $found_people_list['after']['id']; 787 $replacements[12] = $found_people_list['before']['authorurl'].get_author_posts_url($id).$found_people_list['after']['authorurl']; 747 788 $counter = 13; 748 789 … … 750 791 if( is_array($people_list_option['settings']) ): 751 792 foreach($people_list_option['settings'] as $index => $field_slug): 752 $replacements[$counter] = $user_data->$index;793 $replacements[$counter] = ( !empty( $user_data->$index) ? $found_people_list['before'][$index]. $user_data->$index.$found_people_list['before'][$index]: ""); 753 794 $counter++; 754 795 endforeach; 755 796 endif; 756 $replacements = apply_filters('people_list_fields_display',$replacements, $user_data );797 $replacements = apply_filters('people_list_fields_display',$replacements, $user_data, $found_people_list ); 757 798 $html = '<div class="person">'; 758 799 $html .= stripslashes($found_people_list['template']); -
people-lists/trunk/readme.txt
r374823 r428757 3 3 Tags: people lists, people, list, form, user profile, user avatar, thumbnail, upload photo, user, users, profile, biography, profile biography, user profile, description, profile description, rich text, wysiwyg, tinyMCE, photos, images, members, directory, profiles, jQuery, sortable, tabbable, thickbox, overlay, media button, Your Profile 4 4 Requires at least: 3.0 5 Tested up to: 3. 15 Tested up to: 3.2 6 6 Stable Tag: trunk 7 7 … … 96 96 97 97 == Changelog == 98 = 1.3.4 = 99 * bug fix, compatibility with 3.2 100 * added the ability to add before and after strings 98 101 = 1.3.3 = 99 102 * bug fix, readded some of the functionality previously removed. - spotted by flayakaya
Note: See TracChangeset
for help on using the changeset viewer.