Plugin Directory

Changeset 459568


Ignore:
Timestamp:
11/04/2011 11:23:47 PM (14 years ago)
Author:
stresslimit
Message:

take edge stuff out of 0.1 tag

Location:
socialflow
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • socialflow/tags/0.1/js/socialflow.js

    r459565 r459568  
    4848
    4949    $('.row-actions .sf_publish a').click(function(e){
    50         // e.preventDefault();
    51         var $the_a = $(this);
    52         var the_title = prompt('Please enter the text of the post you want to send:', $the_a.parents('td').find('.row-title').html() );
    53         if ( the_title != null && the_title != "" ) {
    54             return true;
    55             // $the_a.sibling('ajax-loading').css('visibility','visible');
    56             // var sf_message = the_title;
    57             // var data = {
    58             //  action: 'sf-send-msg',
    59             //  sf_message: sf_message
    60             // };
    61             // $.post(ajaxurl, data, function(response) {
    62             //  $the_a.sibling('ajax-loading').css('visibility','hidden');
    63             //  if ( '0'===response )
    64             //      $the_a.html('Sent to SocialFlow');
    65             //  else
    66             //      $the_a.html('There was an error');
    67             // });
    68         } else {
    69             return false;
    70         }
     50        return confirm('Are you sure you want to send this post to SocialFlow?');
    7151    });
    7252
  • socialflow/tags/0.1/socialflow.php

    r459565 r459568  
    4949        add_action( 'wp_dashboard_setup',              array( $this, 'register_dashboard_widget' ) );
    5050        add_action( 'wp_ajax_sf-shorten-msg',          array( $this, 'shorten_message'           ) );
    51         // add_action( 'wp_ajax_sf-send-from-row-action', array( $this, 'send_from_row_action'      ) );    // for ajaxing the list view call in future
    5251        add_action( 'admin_init',                      array( $this, 'admin_init'                ) );
    5352        add_action( 'admin_notices',                   array( $this, 'admin_notices'             ) );
     
    435434    }
    436435
    437     // for ajaxing the list view call in future
    438     // public function send_from_row_action() {
    439     //  return $this->send_message() ? '1' : '0';
    440     // }
    441 
    442436    public function shorten_message( $message = '' ) {
    443437        if ( !$message = $_REQUEST['sf_message'] )
  • socialflow/trunk/js/socialflow.js

    r459523 r459568  
    11jQuery(function($){
     2
     3/* dashboard & shared functions */
     4
     5    $('.shorten-links').click(function() {
     6        $('.ajax-loading').css('visibility','visible');
     7
     8        var sf_message = $('#sf-text').val();
     9        var data = {
     10            action: 'sf-shorten-msg',
     11            sf_message: sf_message
     12        };
     13
     14        $.post(ajaxurl, data, function(response) {
     15            $('#sf-text').val(response);
     16            $('#shorten-links #ajax-loading').css('visibility','hidden');
     17            $('#sf-text').trigger('keyup');
     18        });
     19    });
     20
     21
     22/* add/edit screen functions */
     23
     24    $('#title').keyup(function() {
     25        //if ( 0 == $('#sf-text').val().length || $('#title').val().search( $('#sf-text').val() ) === 0 ) {
     26        $('#sf-text').val( $('#title').val() );
     27        $('#sf-text').trigger('keyup');
     28        //}
     29    });
     30
     31    $('#sf-text').maxlength({
     32        events: [],             // Array of events to be triggerd   
     33        maxCharacters: sf_l10n['max'],      // Characters limit   
     34        statusID: "sf_char_count",
     35        status: true,           // True to show status indicator bewlow the element   
     36        statusClass: "",    // The class on the status div 
     37        statusText: "",                     // The status text 
     38        notificationClass: "notification",  // Will be added when maxlength is reached 
     39        showAlert: false, // True to show a regular alert message   
     40        alertText: "You have typed too many characters.", // Text in alert message   
     41        slider: false // True Use counter slider   
     42    });
     43   
     44
     45/* post listing */
     46
     47
     48
     49    $('.row-actions .sf_publish a').click(function(e){
     50        // e.preventDefault();
     51        // return confirm('Are you sure you want to send this post to SocialFlow?');
     52        var $the_a = $(this);
     53        var the_title = prompt('Please enter the text of the post you want to send:', $the_a.parents('td').find('.row-title').html() );
     54        if ( the_title != null && the_title != "" ) {
     55            return true;
     56            // TODO:
     57            // $the_a.sibling('ajax-loading').css('visibility','visible');
     58            // var sf_message = the_title;
     59            // var data = {
     60            //  action: 'sf-send-msg',
     61            //  sf_message: sf_message
     62            // };
     63            // $.post(ajaxurl, data, function(response) {
     64            //  $the_a.sibling('ajax-loading').css('visibility','hidden');
     65            //  if ( '0'===response )
     66            //      $the_a.html('Sent to SocialFlow');
     67            //  else
     68            //      $the_a.html('There was an error');
     69            // });
     70        } else {
     71            return false;
     72        }
     73    });
     74
     75
     76
     77/* configure settings functions */
     78
    279    $('.edit-sf-auth').click(function() {
    380        $('#sf-auth-div').slideDown('fast');
     
    73150    });
    74151
    75     $('.shorten-links').click(function() {
    76         $('.ajax-loading').css('visibility','visible');
    77152
    78         var sf_message = $('#sf-text').val();
    79         var data = {
    80             action: 'sf-shorten-msg',
    81             sf_message: sf_message
    82         };
    83 
    84         $.post(ajaxurl, data, function(response) {
    85             $('#sf-text').val(response);
    86             $('#shorten-links #ajax-loading').css('visibility','hidden');
    87             $('#sf-text').trigger('keyup');
    88         });
    89     });
    90153});
    91154
    92 jQuery(document).ready(function($){
    93     $('#title').keyup(function() {
    94         //if ( 0 == $('#sf-text').val().length || $('#title').val().search( $('#sf-text').val() ) === 0 ) {
    95             $('#sf-text').val( $('#title').val() );
    96             $('#sf-text').trigger('keyup');
    97         //}
    98     });
    99155
    100   $('#sf-text').maxlength({
    101     events: [],             // Array of events to be triggerd   
    102     maxCharacters: sf_l10n['max'],      // Characters limit   
    103     statusID: "count",
    104     status: true,           // True to show status indicator bewlow the element   
    105     statusClass: "",    // The class on the status div 
    106     statusText: "",                     // The status text 
    107     notificationClass: "notification",  // Will be added when maxlength is reached 
    108     showAlert: false, // True to show a regular alert message   
    109     alertText: "You have typed too many characters.", // Text in alert message   
    110     slider: false // True Use counter slider   
    111   });
    112 });
  • socialflow/trunk/socialflow.php

    r459523 r459568  
    4141        load_plugin_textdomain( 'socialflow', false, basename( dirname( __FILE__ ) ) . '/i18n' );
    4242
    43         add_action( 'post_row_actions',       array( $this, 'row_actions'               ), 10, 2 );
    44         add_action( 'page_row_actions',       array( $this, 'row_actions'               ), 10, 2 );
    45         add_action( 'admin_enqueue_scripts',  array( $this, 'enqueue'                   ), 10, 2 );
    46         add_action( 'transition_post_status', array( $this, 'transition_post_status'    ), 10, 3 );
    47         add_action( 'add_meta_boxes',         array( $this, 'add_meta_box'              ) );
    48         add_action( 'save_post',              array( $this, 'save_post'                 ) );
    49         add_action( 'wp_dashboard_setup',     array( $this, 'register_dashboard_widget' ) );
    50         add_action( 'wp_ajax_sf-shorten-msg', array( $this, 'shorten_message'           ) );
    51         add_action( 'admin_init',             array( $this, 'admin_init'                ) );
    52         add_action( 'admin_notices',          array( $this, 'admin_notices'             ) );
     43        add_action( 'post_row_actions',                array( $this, 'row_actions'               ), 10, 2 );
     44        add_action( 'page_row_actions',                array( $this, 'row_actions'               ), 10, 2 );
     45        add_action( 'admin_enqueue_scripts',           array( $this, 'enqueue'                   ), 10, 2 );
     46        add_action( 'transition_post_status',          array( $this, 'transition_post_status'    ), 10, 3 );
     47        add_action( 'add_meta_boxes',                  array( $this, 'add_meta_box'              ) );
     48        add_action( 'save_post',                       array( $this, 'save_post'                 ) );
     49        add_action( 'wp_dashboard_setup',              array( $this, 'register_dashboard_widget' ) );
     50        add_action( 'wp_ajax_sf-shorten-msg',          array( $this, 'shorten_message'           ) );
     51        // add_action( 'wp_ajax_sf-send-from-row-action', array( $this, 'send_from_row_action'      ) );    // for ajaxing the list view call in future
     52        add_action( 'admin_init',                      array( $this, 'admin_init'                ) );
     53        add_action( 'admin_notices',                   array( $this, 'admin_notices'             ) );
    5354    }
    5455
     
    9293
    9394    public function enqueue( $hook ) {
    94         if ( ! in_array( $hook, array( 'index.php', 'post.php', 'post-new.php' ) ) )
     95        if ( ! in_array( $hook, array( 'index.php', 'post.php', 'post-new.php', 'edit.php' ) ) )
    9596            return;
    9697
     
    104105    #socialflow fieldset { line-height: 1.4em; padding: 10px 0px }
    105106    #socialflow fieldset span { padding-right: 15px }
     107    #socialflow #shorten-explanation { text-align:left; }
    106108    #shorten-links, #count { float: right; margin-left: 25px }
    107109    #minor-publishing #compose { float: left; }
     
    132134     */
    133135    public function row_actions( $actions, $post ) {
    134         $url = add_query_arg( array( 'action' => 'sf-publish', 'post' => $post->ID ), admin_url() );
    135         $timestamp = get_post_meta( $post->ID, 'sf_timestamp', true );
    136         $title = $timestamp ? $timestamp : __( 'Send to SocialFlow', 'socialflow' );
    137         $actions['sf_publish'] = '<a href="' . wp_nonce_url( $url, "sf-publish_{$post->ID}" ) . '" style="color: #532F64;" title="' . esc_attr( $title ) . '">' . __( 'Send to SocialFlow', 'socialflow' ) . '</a>';
     136        if ( 'publish' == $post->post_status ) {
     137            $url = add_query_arg( array( 'action' => 'sf-publish', 'post' => $post->ID ), admin_url() );
     138            $timestamp = get_post_meta( $post->ID, 'sf_timestamp', true );
     139            $title = $timestamp ? $timestamp : __( 'Send to SocialFlow', 'socialflow' );
     140            $actions['sf_publish'] = '<a href="' . wp_nonce_url( $url, "sf-publish_{$post->ID}" ) . '" style="color: #532F64;" title="' . esc_attr( $title ) . '">' . __( 'Send to SocialFlow', 'socialflow' ) . '</a>';
     141        }
    138142        return $actions;
    139143    }
     
    360364                    <ul>
    361365                        <li id='compose'><?php _e( 'Compose', 'socialflow' ); ?></li>
    362                         <li id="count"><span>140</span></li>
     366                        <li id="sf_char_count"><span>140</span></li>
     367<?php   if ( $metabox['args']['post_page'] ) : ?>
     368                        <li id="shorten-explanation"><p class="description"><?php _e('The link to your post will be included when your message is sent.') ?></p></li>
     369<?php   else : ?>
    363370                        <li id="shorten-links">
    364371                            <img src="<?php echo admin_url( 'images/wpspin_light.gif' ); ?>" class="ajax-loading" id="ajax-loading" alt="">
    365372                            <a href="#" class="shorten-links"><?php _e( 'Shorten Links', 'socialflow' ); ?></a>
    366373                        </li>
     374<?php   endif; ?>
    367375                    </ul>
    368376                    <textarea rows="1" cols="40" name="socialflow[text]" tabindex="6" id="sf-text"><?php if ( $metabox['args']['post_page'] ) echo esc_textarea( get_post_meta( $post->ID, 'sf_text', true ) ); ?></textarea>
    369377                </div>
    370                
     378
    371379            <?php if ( empty( $post ) ) : ?>
    372380                <div id="misc-publishing-actions">
     
    427435    }
    428436
    429     public function shorten_message() {
     437    // for ajaxing the list view call in future
     438    // public function send_from_row_action( $message = '' ) {
     439        // TODO: grab the permalink and append to message
     440    //  return $this->send_message() ? '1' : '0';
     441    // }
     442
     443    public function shorten_message( $message = '' ) {
    430444        if ( !$message = $_REQUEST['sf_message'] )
    431445            return;
Note: See TracChangeset for help on using the changeset viewer.