Changeset 1505160
- Timestamp:
- 09/29/2016 02:15:43 PM (10 years ago)
- Location:
- responsive-sticky-notes/trunk
- Files:
-
- 7 edited
-
admin/admin.php (modified) (5 diffs)
-
admin/class-wp-list-table-copy.php (modified) (14 diffs)
-
includes.php (modified) (1 diff)
-
js/sticky-notes-note.js (modified) (1 diff)
-
js/sticky-notes-single.js (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
-
responsive-sticky-notes.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
responsive-sticky-notes/trunk/admin/admin.php
r1430436 r1505160 29 29 */ 30 30 function responsivestickynotes_admin_init(){ 31 register_setting( ' plugin_options_group', 'plugin_options', 'plugin_options_validate' );32 add_settings_section(' plugin_main', 'Main Settings', 'plugin_section_text', 'plugin');33 add_settings_field(' plugin_text_string', 'Plugin Text Input', 'plugin_setting_string', 'plugin', 'plugin_main');31 register_setting( 'responsivestickynotes_options_group', 'responsivestickynotes_options', 'responsivestickynotes_options_validate' ); 32 add_settings_section('responsivestickynotes_main', 'Main Settings', 'responsivestickynotes_section_text', 'responsivestickynotes'); 33 add_settings_field('responsivestickynotes_text_string', 'responsivestickynotes Text Input', 'responsivestickynotes_setting_string', 'responsivestickynotes', 'responsivestickynotes_main'); 34 34 //responsivestickynotes_setupDB(); 35 35 … … 432 432 } 433 433 434 function plugin_section_text() {434 function responsivestickynotes_section_text() { 435 435 echo '<p>Main description of this section here.</p>'; 436 436 } 437 function plugin_setting_string() {438 $options = get_option(' plugin_options');439 echo "<input id=' plugin_text_string' name='plugin_options[text_string]' size='40' type='text' value='{$options['text_string']}' />";440 } 441 442 443 444 445 446 function plugin_options_validate($plugin_options) {437 function responsivestickynotes_setting_string() { 438 $options = get_option('responsivestickynotes_options'); 439 echo "<input id='responsivestickynotes_text_string' name='responsivestickynotes_options[text_string]' size='40' type='text' value='{$options['text_string']}' />"; 440 } 441 442 443 444 445 446 function responsivestickynotes_options_validate($plugin_options) { 447 447 echo "validated!"; 448 448 wp_die(); … … 454 454 $listTable = new responsivestickynotes_List_Table(); 455 455 //Fetch, prepare, sort, and filter our data... 456 456 ?> 457 458 <?php 459 //checkbox in just a few lines of code... how easy is that 460 $showalways = get_option('responsive-sticky-notes_showalways', 1); 461 if (isset($_REQUEST['showalways_submit'])) { 462 $showalways = isset($_REQUEST['showalways']) && $_REQUEST['showalways']=='on' ? 1 : 0; 463 update_option('responsive-sticky-notes_showalways', $showalways); 464 } 465 ?> 466 <form method="post" action="<?php echo esc_url( add_query_arg( array('page' => 'responsive-sticky-notes'), menu_page_url( 'responsivestickynotes', false ) ) ); ?>"> 467 <table><tr><td>Show notes when not logged in: <input type="checkbox" name="showalways" <?php checked( 0 != $showalways ); ?> /></td><td><?php submit_button('Apply',"submit","showalways_submit"); ?></td></tr></table> 468 469 <?php 457 470 $action = null; 458 471 if (isset($_REQUEST['action'])) { … … 462 475 463 476 ?> 464 <div class="wrap">477 <div class="wrap"> 465 478 <div id="icon-edit" class="icon32"></div> 466 467 479 <h1><?php echo esc_html( __( 'Sticky Notes - help', 'responsive-sticky-notes' ) );?></h1> 468 480 <div style="height: 10px"></div> … … 473 485 <p>This plugin lets you add 'sticky' notes to any post or non-admin page. The notes are attached to HTML elements within the page, so are ideal for text annotations or to add extra information to images, etc., and will move with responsive layout changes so they never vanish off the edge of the screen. 474 486 </p> 475 <p>Sticky notes can be added to any post or non-admin page. To add a note, leave the admin area and go to the page you want to add a note to. Then click the 'Add Sticky Note' button in the top admin bar, and move the cursor over the page. As you move the cursor, page elements are highlighted with an outline. Click again to add a note at this position.</p>487 <p>Sticky notes can be added to any post or non-admin page. To add a note, leave the admin area and go to the page you want to add a note to. Then click the 'Add Sticky Note' button in the top admin bar, and move the cursor over the page. As you move the cursor, page elements are highlighted with an outline. Click again to add a note at this position.</p> 476 488 <p>Notes are attached to the beginning of a page element, i.e. at the top left corner of a <p>, <div>, etc. A note can be attached to anything on a page.</p> 477 489 <p>Once you have added a note, click it to open it. Then type text as required - it is saved as you type. -
responsive-sticky-notes/trunk/admin/class-wp-list-table-copy.php
r1430436 r1505160 163 163 if ( empty( $this->modes ) ) { 164 164 $this->modes = array( 165 'list' => __( 'List View', ' sticky-notes' ),166 'excerpt' => __( 'Excerpt View', ' sticky-notes' )165 'list' => __( 'List View', 'responsive-sticky-notes' ), 166 'excerpt' => __( 'Excerpt View', 'responsive-sticky-notes' ) 167 167 ); 168 168 } … … 465 465 echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . __( 'Select bulk action' ) . '</label>'; 466 466 echo '<select name="action' . $two . '" id="bulk-action-selector-' . esc_attr( $which ) . "\">\n"; 467 echo '<option value="-1">' . __( 'Bulk Actions', ' sticky-notes' ) . "</option>\n";467 echo '<option value="-1">' . __( 'Bulk Actions', 'responsive-sticky-notes' ) . "</option>\n"; 468 468 469 469 foreach ( $this->_actions as $name => $title ) { … … 475 475 echo "</select>\n"; 476 476 477 submit_button( __( 'Apply', ' sticky-notes' ), 'action', '', false, array( 'id' => "doaction$two" ) );477 submit_button( __( 'Apply', 'responsive-sticky-notes' ), 'action', '', false, array( 'id' => "doaction$two" ) ); 478 478 echo "\n"; 479 479 } … … 525 525 $out .= '</div>'; 526 526 527 $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details', ' sticky-notes' ) . '</span></button>';527 $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details', 'responsive-sticky-notes' ) . '</span></button>'; 528 528 529 529 return $out; … … 603 603 esc_attr( $arc_row->year . $month ), 604 604 /* translators: 1: month name, 2: 4-digit year */ 605 sprintf( __( '%1$s %2$d', ' sticky-notes' ), $wp_locale->get_month( $month ), $year )605 sprintf( __( '%1$s %2$d', 'responsive-sticky-notes' ), $wp_locale->get_month( $month ), $year ) 606 606 ); 607 607 } … … 662 662 if ( ! $approved_comments && ! $pending_comments ) { 663 663 printf( '<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>', 664 __( 'No comments', ' sticky-notes' )664 __( 'No comments', 'responsive-sticky-notes' ) 665 665 ); 666 666 // Approved comments have different display depending on some conditions. … … 674 674 printf( '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>', 675 675 $approved_comments_number, 676 $pending_comments ? __( 'No approved comments', ' sticky-notes' ) : __( 'No comments', 'sticky-notes' )676 $pending_comments ? __( 'No approved comments', 'responsive-sticky-notes' ) : __( 'No comments', 'responsive-sticky-notes' ) 677 677 ); 678 678 } … … 799 799 $page_links[] = sprintf( "<a class='first-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>", 800 800 esc_url( remove_query_arg( 'paged', $current_url ) ), 801 __( 'First page', ' sticky-notes' ),801 __( 'First page', 'responsive-sticky-notes' ), 802 802 '«' 803 803 ); … … 809 809 $page_links[] = sprintf( "<a class='prev-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>", 810 810 esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ), 811 __( 'Previous page', ' sticky-notes' ),811 __( 'Previous page', 'responsive-sticky-notes' ), 812 812 '‹' 813 813 ); … … 816 816 if ( 'bottom' === $which ) { 817 817 $html_current_page = $current; 818 $total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page', ' sticky-notes' ) . '</span><span id="table-paging" class="paging-input">';818 $total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page', 'responsive-sticky-notes' ) . '</span><span id="table-paging" class="paging-input">'; 819 819 } else { 820 820 $html_current_page = sprintf( "%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' />", 821 '<label for="current-page-selector" class="screen-reader-text">' . __( 'Current Page', ' sticky-notes' ) . '</label>',821 '<label for="current-page-selector" class="screen-reader-text">' . __( 'Current Page', 'responsive-sticky-notes' ) . '</label>', 822 822 $current, 823 823 strlen( $total_pages ) … … 832 832 $page_links[] = sprintf( "<a class='next-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>", 833 833 esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ), 834 __( 'Next page', ' sticky-notes' ),834 __( 'Next page', 'responsive-sticky-notes' ), 835 835 '›' 836 836 ); … … 842 842 $page_links[] = sprintf( "<a class='last-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>", 843 843 esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ), 844 __( 'Last page', ' sticky-notes' ),844 __( 'Last page', 'responsive-sticky-notes' ), 845 845 '»' 846 846 ); … … 1070 1070 if ( ! empty( $columns['cb'] ) ) { 1071 1071 static $cb_counter = 1; 1072 $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', ' sticky-notes' ) . '</label>'1072 $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'responsive-sticky-notes' ) . '</label>' 1073 1073 . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />'; 1074 1074 $cb_counter++; … … 1325 1325 */ 1326 1326 protected function handle_row_actions( $item, $column_name, $primary ) { 1327 return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details', ' sticky-notes' ) . '</span></button>' : '';1327 return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details', 'responsive-sticky-notes' ) . '</span></button>' : ''; 1328 1328 } 1329 1329 -
responsive-sticky-notes/trunk/includes.php
r1430436 r1505160 11 11 require_once('admin/admin.php'); 12 12 13 13 14 } 14 15 -
responsive-sticky-notes/trunk/js/sticky-notes-note.js
r1430436 r1505160 30 30 this.id='responsive-sticky-notes-' + this.postId; 31 31 this.elementChain = responsivestickynotes_obj.stripTrailingHash(this.elementChain); 32 console.log(this.elementChain)33 32 this.obj = jQuery(this.elementChain); 34 33 responsivestickynotes_obj.highestZ++; -
responsive-sticky-notes/trunk/js/sticky-notes-single.js
r1430436 r1505160 289 289 s = classList[i] + s; 290 290 291 console.log(s);292 291 if (i==classList.length) { 293 292 prevS = s; … … 352 351 var note = new responsivestickynote(elementChain,tooltip, text, postId, admin_url, bgcol, col); 353 352 354 },355 updateElementChain: function(id, elementChain) {356 var data = {357 'action': 'responsivestickynotes_update_elementchain',358 'security': responsivestickynotes_vars.postNoteNonce,359 'id':id,360 'elementchain':elementChain361 };362 363 jQuery.ajax({364 url: ajaxurl,365 data: data,366 error: function() {367 console.log("error updating elementchain (1)")368 note.hasChanged = true;369 setTimeout(function() {370 note.checkForChanges();371 },1000);372 },373 success: function(data) {374 if (data=="error") {375 console.log("error updating elementchain: "+ note.numeridId)376 }377 },378 method: 'POST'379 });380 353 }, 381 354 removeNote: function(id) { … … 579 552 error: function(e) { 580 553 // error - remove note 581 responsivestickynotes_obj.removeNote(nextId);582 554 console.log("no id from server (error function) - removing note") 583 555 }, … … 585 557 if (data==="error") { 586 558 //error - remove note 587 responsivestickynotes_obj.removeNote(nextId);588 559 console.log("no id from server (error message returned) - removing note") 589 560 } … … 607 578 //instantiate 608 579 var responsivestickynotes_obj = new responsivestickynotes_object(); 609 jQuery( window).on("load",function() {580 jQuery(document).ready(function() { 610 581 responsivestickynotes_obj.init(); 611 582 }); -
responsive-sticky-notes/trunk/readme.txt
r1495156 r1505160 56 56 Notes are specific to the page they are created on, and cannot currently be shared between posts or pages 57 57 58 = Can notes be shown to anyone or just logged-in users = 59 60 There is an option to 'Show notes when not logged in' on the admin page 61 58 62 == Changelog == 59 63 … … 65 69 * AJAX error will not automatically delete a note 66 70 * Option added to allow notes to be hidden from non-admin users 71 = 1.01 = 72 * Fixed bug where user without edit priviledges could add a note (briefly) 67 73 -
responsive-sticky-notes/trunk/responsive-sticky-notes.php
r1430436 r1505160 3 3 Plugin Name: Responsive Sticky Notes 4 4 Plugin URI: http://www.nantinet.com/ 5 Description: Responsive sticky notes which can be added to posts and pages6 Version: 0.15 Description: Easily add 'sticky' notes which move with responsive layout changes 6 Version: 1.0 7 7 Author: Richard Mark Watton 8 8 Author URI: http://www.nantinet.com 9 9 Text Domain: responsive-sticky-notes 10 Version: 1.011 10 License: GPLv2 or later 12 11 */ … … 47 46 48 47 //ACTIONS 48 49 49 add_action( 'wp_enqueue_scripts', 'responsivestickynotes_loadscripts' ); 50 add_action( 'wp_head','responsivestickynotes_ajaxurl');51 add_action( 'init', 'responsivestickynotes_create_posttype');52 53 if (!is_admin())54 add_action('admin_bar_menu', 'responsivestickynotes_add_admin_button', 999);55 56 50 57 51 function responsivestickynotes_loadscripts() 58 52 { 53 $loadNotes = false; 54 $showalways = get_option('responsive-sticky-notes_showalways',1); //default is to show always, in case of upgrade 59 55 60 wp_register_script( 'todo_notes_note', plugins_url( '/js/sticky-notes-note.js', __FILE__ ), array( 'jquery'), false, true ); 61 wp_register_script( 'todo_notes_single', plugins_url( '/js/sticky-notes-single.js', __FILE__ ), array( 'todo_notes_note'), false, true ); 62 wp_enqueue_script( 'todo_notes_note' ); 63 wp_enqueue_script( 'todo_notes_single' ); 56 if ($showalways != 0) $loadNotes = true; 57 else { 58 $current_user = wp_get_current_user(); 59 $loadNotes = RESPONSIVESTICKYNOTES_note::can_edit(); 60 } 64 61 65 wp_localize_script( 'todo_notes_note', 'responsivestickynotes_vars', array( 66 //nonce will be available as MyAjax.[nonce name] in javascript 67 'postNoteNonce' => wp_create_nonce( 'myajax-post-note-nonce' ), 68 'pageId' => get_the_ID(), 69 'nextId' => RESPONSIVESTICKYNOTES_note::get_next_ID(), 70 'close' => __('Close', 'responsive-sticky-notes'), 71 'more' => __('More', 'responsive-sticky-notes'), 72 'menu' => __('Menu', 'responsive-sticky-notes'), 73 'bin_note' => __('Bin note', 'responsive-sticky-notes'), 74 'set_note_color' => __('Set note color', 'responsive-sticky-notes'), 75 'untitled_note' => __('Untitled note', 'responsive-sticky-notes'), 76 'delete_this_note' => __('Delete this note?', 'responsive-sticky-notes') 77 ) 78 ); 79 wp_enqueue_style( 'responsivestickynotes_styles', plugins_url('/css/responsive-sticky-notes.css', __FILE__ ) ); 62 if ($loadNotes==true) { 63 64 add_action( 'wp_head','responsivestickynotes_ajaxurl'); 65 add_action( 'init', 'responsivestickynotes_create_posttype'); 66 67 if (!is_admin()&&RESPONSIVESTICKYNOTES_note::can_edit()) 68 add_action('admin_bar_menu', 'responsivestickynotes_add_admin_button', 998); 69 70 71 wp_register_script( 'todo_notes_note', plugins_url( '/js/sticky-notes-note.js', __FILE__ ), array( 'jquery'), false, true ); 72 wp_register_script( 'todo_notes_single', plugins_url( '/js/sticky-notes-single.js', __FILE__ ), array( 'todo_notes_note'), false, true ); 73 wp_enqueue_script( 'todo_notes_note' ); 74 wp_enqueue_script( 'todo_notes_single' ); 75 76 wp_localize_script( 'todo_notes_note', 'responsivestickynotes_vars', array( 77 //nonce will be available as MyAjax.[nonce name] in javascript 78 'postNoteNonce' => wp_create_nonce( 'myajax-post-note-nonce' ), 79 'pageId' => get_the_ID(), 80 'nextId' => RESPONSIVESTICKYNOTES_note::get_next_ID(), 81 'close' => __('Close', 'responsive-sticky-notes'), 82 'more' => __('More', 'responsive-sticky-notes'), 83 'menu' => __('Menu', 'responsive-sticky-notes'), 84 'bin_note' => __('Bin note', 'responsive-sticky-notes'), 85 'set_note_color' => __('Set note color', 'responsive-sticky-notes'), 86 'untitled_note' => __('Untitled note', 'responsive-sticky-notes'), 87 'delete_this_note' => __('Delete this note?', 'responsive-sticky-notes') 88 ) 89 ); 90 wp_enqueue_style( 'responsivestickynotes_styles', plugins_url('/css/responsive-sticky-notes.css', __FILE__ ) ); 91 } 80 92 } 81 93
Note: See TracChangeset
for help on using the changeset viewer.