Changeset 459568
- Timestamp:
- 11/04/2011 11:23:47 PM (14 years ago)
- Location:
- socialflow
- Files:
-
- 4 edited
-
tags/0.1/js/socialflow.js (modified) (1 diff)
-
tags/0.1/socialflow.php (modified) (2 diffs)
-
trunk/js/socialflow.js (modified) (2 diffs)
-
trunk/socialflow.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
socialflow/tags/0.1/js/socialflow.js
r459565 r459568 48 48 49 49 $('.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?'); 71 51 }); 72 52 -
socialflow/tags/0.1/socialflow.php
r459565 r459568 49 49 add_action( 'wp_dashboard_setup', array( $this, 'register_dashboard_widget' ) ); 50 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 future52 51 add_action( 'admin_init', array( $this, 'admin_init' ) ); 53 52 add_action( 'admin_notices', array( $this, 'admin_notices' ) ); … … 435 434 } 436 435 437 // for ajaxing the list view call in future438 // public function send_from_row_action() {439 // return $this->send_message() ? '1' : '0';440 // }441 442 436 public function shorten_message( $message = '' ) { 443 437 if ( !$message = $_REQUEST['sf_message'] ) -
socialflow/trunk/js/socialflow.js
r459523 r459568 1 1 jQuery(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 2 79 $('.edit-sf-auth').click(function() { 3 80 $('#sf-auth-div').slideDown('fast'); … … 73 150 }); 74 151 75 $('.shorten-links').click(function() {76 $('.ajax-loading').css('visibility','visible');77 152 78 var sf_message = $('#sf-text').val();79 var data = {80 action: 'sf-shorten-msg',81 sf_message: sf_message82 };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 });90 153 }); 91 154 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 });99 155 100 $('#sf-text').maxlength({101 events: [], // Array of events to be triggerd102 maxCharacters: sf_l10n['max'], // Characters limit103 statusID: "count",104 status: true, // True to show status indicator bewlow the element105 statusClass: "", // The class on the status div106 statusText: "", // The status text107 notificationClass: "notification", // Will be added when maxlength is reached108 showAlert: false, // True to show a regular alert message109 alertText: "You have typed too many characters.", // Text in alert message110 slider: false // True Use counter slider111 });112 }); -
socialflow/trunk/socialflow.php
r459523 r459568 41 41 load_plugin_textdomain( 'socialflow', false, basename( dirname( __FILE__ ) ) . '/i18n' ); 42 42 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' ) ); 53 54 } 54 55 … … 92 93 93 94 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' ) ) ) 95 96 return; 96 97 … … 104 105 #socialflow fieldset { line-height: 1.4em; padding: 10px 0px } 105 106 #socialflow fieldset span { padding-right: 15px } 107 #socialflow #shorten-explanation { text-align:left; } 106 108 #shorten-links, #count { float: right; margin-left: 25px } 107 109 #minor-publishing #compose { float: left; } … … 132 134 */ 133 135 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 } 138 142 return $actions; 139 143 } … … 360 364 <ul> 361 365 <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 : ?> 363 370 <li id="shorten-links"> 364 371 <img src="<?php echo admin_url( 'images/wpspin_light.gif' ); ?>" class="ajax-loading" id="ajax-loading" alt=""> 365 372 <a href="#" class="shorten-links"><?php _e( 'Shorten Links', 'socialflow' ); ?></a> 366 373 </li> 374 <?php endif; ?> 367 375 </ul> 368 376 <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> 369 377 </div> 370 378 371 379 <?php if ( empty( $post ) ) : ?> 372 380 <div id="misc-publishing-actions"> … … 427 435 } 428 436 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 = '' ) { 430 444 if ( !$message = $_REQUEST['sf_message'] ) 431 445 return;
Note: See TracChangeset
for help on using the changeset viewer.