Plugin Directory

Changeset 428757


Ignore:
Timestamp:
08/25/2011 06:04:51 PM (15 years ago)
Author:
oltdev
Message:

Updated to 1.3.4

Location:
people-lists/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • people-lists/trunk/css/people-lists.css

    r368937 r428757  
    107107    color: #111;
    108108    font-weight: bold;
    109     letter-spacing: -.4px;
     109    letter-spacing: -.45px;
    110110}   
    111111
     
    231231 float:left;
    232232}
    233 #sortable1 li,
    234 #sortable2 li {
     233.ui-state-default-list{
    235234    margin: 5px;
    236235    padding: 5px;
     
    267266    border-radius: 2px; /* Opera 10.5, IE 9 */
    268267}
    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
    280269.listDiv {
    281270    width: 260px;
     
    320309}
    321310.template-tabbed{
    322     width:330px; 
     311    width:430px; 
    323312    clear:left;
    324313    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;
    325339}
    326340ul.template-tabs li {
  • people-lists/trunk/js/people-lists.js

    r368937 r428757  
    6161jQuery(function($) {               
    6262   
     63   
    6364    // Initialize jQuery Sortable for lists.
    6465    $("ul.droptrue").sortable({
     
    6970    // Initializing and storing attributes upon "submit-people-list" button click by user.
    7071    $('#submit-people-list').live( "click", function(){
    71     
     72    
    7273    if(!$('#submit-people-list').attr("disabled")) {
    7374       
    7475        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               
    7979        var data = {
    8080            action : 'people_list_save',
    8181            list : groupList,
    82             title: list_title,
    83             template: template_text,
    84             avatar_size: avatar_size,
    85             id: list_id
     82            form: people_list_form,
    8683        };
    8784        if($('#list-title').val() != '')
  • people-lists/trunk/people-lists.php

    r375311 r428757  
    99 *              desired to be displayed.     
    1010 * Author: Gagan Sandhu / Enej Bajgoric / CTLT DEV
    11  * Version: 1.3.3
     11 * Version: 1.3.4
    1212 * Author URI: http://www.ctlt.ubc.ca
    1313 * 
     
    4040
    4141
    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 );
     42add_action('admin_footer-user-edit.php', 'wp_preload_dialogs', 30 );
     43add_action('admin_footer-profile.php', 'wp_preload_dialogs', 30 );
    4444
    4545// for the media buttons
    4646add_action('admin_footer-user-edit.php', 'people_lists_media_buttons', 40 );
    4747add_action('admin_footer-profile.php', 'people_lists_media_buttons', 40 );
    48 
    49 
    5048
    5149
     
    132130    $people_list['lists'] = array();
    133131    $people_list = get_option($option_name);
    134        
     132   
    135133    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';
    150149    else:
    151         $slug = people_lists_slug( $title );
     150        $slug = people_lists_slug( $data['title'] );
    152151        // Check if the slug exists
    153152        $counter = 1;
    154         while(people_lists_slug_exists($slug,$people_list['lists']))
     153        while( people_lists_slug_exists($slug,$people_list['lists']) )
    155154        {
    156             $slug = people_lists_slug($title)."-".$counter;
     155            $slug = people_lists_slug($data['title'])."-".$counter;
    157156            $counter += 1;
    158157        }
    159        
     158        $data['slug'] = $slug;
    160159        // 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';
    163162    endif;
    164163   
    165164    update_option( $option_name, $people_list);
    166    
    167     die();
     165    die(); // thats it
    168166}
    169167
     
    248246   
    249247    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}
     251function people_lists_tiny_filter_remove_fullscreen($initArray){
     252    $initArray["theme_advanced_buttons1"] = str_replace(',fullscreen', '', $initArray["theme_advanced_buttons1"]);
     253    return $initArray;
    250254}
    251255/**
     
    289293function people_list_options_init_script(){
    290294    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'));
    292296    }
    293297
     
    508512    <div id="people-list-form-shell">
    509513        <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" />
    512516        <p><?php _e('The name helps identify which list you are editing.','people-list');?></p>
    513517   
    514518        <a id="template-link" href="#"><?php _e('Template Info','people-list');?></a>
    515519        <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>   
    517521
    518522            <div class="template-tabbed">
     
    522526                        <li><a href="#default_codes" title="Default Codes" class="tabbed"><?php _e('Default Codes','people-list');?></a></li>
    523527                        <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>
    524529                    </ul>
    525530                    <div id="default_codes" class="template-content">
     
    545550                        <ul>
    546551                        <?php
    547                            
    548552                         if( is_array($people_list_option['settings']) ):
    549553                            foreach ($people_list_option['settings'] as $index => $field_slug): ?>
     
    559563                        </ul>
    560564                    </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>
    561592                </div>
    562593            </div>
    563             <textarea name="template-text" class="template-text" id="template-text"><?php
     594            <textarea name="template" class="template-text" id="template-text"><?php
    564595                if( !empty($list['template']) )
    565596                    echo  stripslashes(trim($list['template']));   
     
    578609                foreach($users_of_blog as $person):
    579610                    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; ?>">
    581612                        <?php echo get_avatar($person->ID, 32); ?>
    582613                        <?php echo $person->display_name; ?><span><?php echo $person->user_email; ?></span></li>
     
    595626            <?php if( is_array($list['list']['uid']) ):
    596627                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; ?>">
    598629                    <?php echo get_avatar($selected_people[$person_id]->ID, 32); ?>
    599630                    <?php echo $selected_people[$person_id]->display_name; ?><span><?php echo $selected_people[$person_id]->user_email; ?></span></li>
     
    605636        <p class="submit clear">
    606637        <?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" />
    608639            <input id="submit-people-list" type="submit" class="button-primary" value="<?php _e('Update Changes','people-list');?>" />
    609640        <?php else: ?>
     
    645676            <?php if( is_array($people_list_option['settings']) ):
    646677                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>
    648679                        <input type="hidden" value="<?php echo $index; ?>" name="field_slug_list[]" />
    649680                        <input type="hidden" value="<?php echo stripslashes($field_slug); ?>" name="field_name_list[]" />
     
    657688}
    658689
     690function 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}
    659702/**
    660703 * people_lists_default_template function.
     
    730773            $user_data = get_userdata($id);
    731774           
    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'];   
    747788            $counter = 13;
    748789           
     
    750791            if( is_array($people_list_option['settings']) ):
    751792                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]: "");
    753794                    $counter++;
    754795                endforeach;
    755796            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 );
    757798            $html = '<div class="person">';
    758799            $html .= stripslashes($found_people_list['template']);
  • people-lists/trunk/readme.txt

    r374823 r428757  
    33Tags: 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
    44Requires at least: 3.0
    5 Tested up to: 3.1
     5Tested up to: 3.2
    66Stable Tag: trunk
    77
     
    9696
    9797== Changelog ==
     98= 1.3.4 =
     99* bug fix, compatibility with 3.2
     100* added the ability to add before and after strings
    98101= 1.3.3 =
    99102* bug fix, readded some of the functionality previously removed. - spotted by flayakaya
Note: See TracChangeset for help on using the changeset viewer.