Version Description
Fixed some layout issues with the previous and next calendar buttons in WordPress 3.5.
We are now properly saving new posts in the drafts drawer in WordPress 3.5.
Added unit tests to cover creating a new post in the drafts drawer.
Added a few performance improvements to the calendar like making sure we only load our code in the admin console.
Download this release
Release Info
Developer | zgrossbart |
Plugin | Editorial Calendar |
Version | 2.6 |
Comparing to | |
See all releases |
Code changes from version 2.5 to 2.6
- edcal.php +26 -19
- edcal_test.js +62 -0
- readme.txt +14 -4
edcal.php
CHANGED
@@ -18,18 +18,18 @@
|
|
18 |
/*
|
19 |
Plugin Name: WordPress Editorial Calendar
|
20 |
Description: The Editorial Calendar makes it possible to see all your posts and drag and drop them to manage your blog.
|
21 |
-
Version: 2.
|
22 |
Author: Colin Vernon, Justin Evans, Joachim Kudish, Mary Vogt, and Zack Grossbart
|
23 |
Author URI: http://www.zackgrossbart.com
|
24 |
Plugin URI: http://stresslimitdesign.com/editorial-calendar-plugin
|
25 |
*/
|
26 |
|
27 |
|
28 |
-
|
29 |
-
global $edcal;
|
30 |
-
if( empty($edcal) )
|
31 |
-
|
32 |
-
|
33 |
|
34 |
|
35 |
/*
|
@@ -142,7 +142,6 @@ class EdCal {
|
|
142 |
* generates the divs that we need for the JavaScript to work.
|
143 |
*/
|
144 |
function edcal_list_admin() {
|
145 |
-
include_once('edcal.php');
|
146 |
|
147 |
/*
|
148 |
* We want to count the number of times they load the calendar
|
@@ -388,16 +387,16 @@ class EdCal {
|
|
388 |
<a href="#" title="<?php echo(__('Jump back', 'editorial-calendar')) ?>" class="prev page-numbers" id="prevmonth">‹</a>
|
389 |
<span id="currentRange"></span>
|
390 |
<a href="#" title="<?php echo(__('Skip ahead', 'editorial-calendar')) ?>" class="next page-numbers" id="nextmonth">›</a>
|
391 |
-
<a class="
|
392 |
|
393 |
-
<a class="
|
394 |
|
395 |
|
396 |
</h3>
|
397 |
</div>
|
398 |
|
399 |
<div id="topright" class="tablenav-pages alignright">
|
400 |
-
<a class="
|
401 |
</div>
|
402 |
</div>
|
403 |
|
@@ -1006,11 +1005,11 @@ class EdCal {
|
|
1006 |
$my_post = array();
|
1007 |
|
1008 |
// If the post id is not specified, we're creating a new post
|
1009 |
-
if($_POST['id']) {
|
1010 |
$my_post['ID'] = intval($_POST['id']);
|
1011 |
} else {
|
1012 |
// We have a new post
|
1013 |
-
|
1014 |
|
1015 |
// Set the status to draft unless the user otherwise specifies
|
1016 |
if ($_POST['status']) {
|
@@ -1023,10 +1022,18 @@ class EdCal {
|
|
1023 |
$my_post['post_title'] = isset($_POST["title"])?$_POST["title"]:null;
|
1024 |
$my_post['post_content'] = isset($_POST["content"])?$_POST["content"]:null;
|
1025 |
|
1026 |
-
$my_post['
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1030 |
$my_post['post_status'] = $_POST['status'];
|
1031 |
|
1032 |
/*
|
@@ -1047,9 +1054,9 @@ class EdCal {
|
|
1047 |
$my_post_id = wp_update_post($my_post);
|
1048 |
} else {
|
1049 |
// We have a new post, insert the post into the database
|
1050 |
-
$my_post_id = wp_insert_post($my_post);
|
1051 |
}
|
1052 |
-
|
1053 |
// TODO: throw error if update/insert or getsinglepost fails
|
1054 |
/*
|
1055 |
* We finish by returning the latest data for the post in the JSON
|
@@ -1364,4 +1371,4 @@ class EdCal {
|
|
1364 |
|
1365 |
}
|
1366 |
|
1367 |
-
|
18 |
/*
|
19 |
Plugin Name: WordPress Editorial Calendar
|
20 |
Description: The Editorial Calendar makes it possible to see all your posts and drag and drop them to manage your blog.
|
21 |
+
Version: 2.6
|
22 |
Author: Colin Vernon, Justin Evans, Joachim Kudish, Mary Vogt, and Zack Grossbart
|
23 |
Author URI: http://www.zackgrossbart.com
|
24 |
Plugin URI: http://stresslimitdesign.com/editorial-calendar-plugin
|
25 |
*/
|
26 |
|
27 |
|
28 |
+
if ( is_admin() ) {
|
29 |
+
global $edcal;
|
30 |
+
if ( empty($edcal) )
|
31 |
+
$edcal = new EdCal();
|
32 |
+
}
|
33 |
|
34 |
|
35 |
/*
|
142 |
* generates the divs that we need for the JavaScript to work.
|
143 |
*/
|
144 |
function edcal_list_admin() {
|
|
|
145 |
|
146 |
/*
|
147 |
* We want to count the number of times they load the calendar
|
387 |
<a href="#" title="<?php echo(__('Jump back', 'editorial-calendar')) ?>" class="prev page-numbers" id="prevmonth">‹</a>
|
388 |
<span id="currentRange"></span>
|
389 |
<a href="#" title="<?php echo(__('Skip ahead', 'editorial-calendar')) ?>" class="next page-numbers" id="nextmonth">›</a>
|
390 |
+
<a class="next page-numbers" title="<?php echo(__('Scroll the calendar and make the last post visible', 'editorial-calendar')) ?>" id="moveToLast">»</a>
|
391 |
|
392 |
+
<a class="next page-numbers" title="<?php echo(__('Scroll the calendar and make the today visible', 'editorial-calendar')) ?>" id="moveToToday"><?php echo(__('Show Today', 'editorial-calendar')) ?></a>
|
393 |
|
394 |
|
395 |
</h3>
|
396 |
</div>
|
397 |
|
398 |
<div id="topright" class="tablenav-pages alignright">
|
399 |
+
<a class="next page-numbers" title="<?php echo(__('Show unscheduled posts', 'editorial-calendar')) ?>" id="showdraftsdrawer"><?php echo(__('Show Unscheduled Drafts', 'editorial-calendar')) ?></a>
|
400 |
</div>
|
401 |
</div>
|
402 |
|
1005 |
$my_post = array();
|
1006 |
|
1007 |
// If the post id is not specified, we're creating a new post
|
1008 |
+
if($_POST['id'] && intval($_POST['id']) > 0) {
|
1009 |
$my_post['ID'] = intval($_POST['id']);
|
1010 |
} else {
|
1011 |
// We have a new post
|
1012 |
+
//$my_post['ID'] = 0; // and the post ID to 0
|
1013 |
|
1014 |
// Set the status to draft unless the user otherwise specifies
|
1015 |
if ($_POST['status']) {
|
1022 |
$my_post['post_title'] = isset($_POST["title"])?$_POST["title"]:null;
|
1023 |
$my_post['post_content'] = isset($_POST["content"])?$_POST["content"]:null;
|
1024 |
|
1025 |
+
if ($edcal_date_gmt != '0000-00-00 00:00:00' || $my_post['ID'] > 0) {
|
1026 |
+
/*
|
1027 |
+
* We don't want to set a date if this a new post in the drafts
|
1028 |
+
* drawer since WordPress 3.5 will reject new posts with a 0000
|
1029 |
+
* GMT date.
|
1030 |
+
*/
|
1031 |
+
$my_post['post_date'] = $edcal_date;
|
1032 |
+
$my_post['post_date_gmt'] = $edcal_date_gmt;
|
1033 |
+
$my_post['post_modified'] = $edcal_date;
|
1034 |
+
$my_post['post_modified_gmt'] = $edcal_date_gmt;
|
1035 |
+
}
|
1036 |
+
|
1037 |
$my_post['post_status'] = $_POST['status'];
|
1038 |
|
1039 |
/*
|
1054 |
$my_post_id = wp_update_post($my_post);
|
1055 |
} else {
|
1056 |
// We have a new post, insert the post into the database
|
1057 |
+
$my_post_id = wp_insert_post($my_post, true);
|
1058 |
}
|
1059 |
+
|
1060 |
// TODO: throw error if update/insert or getsinglepost fails
|
1061 |
/*
|
1062 |
* We finish by returning the latest data for the post in the JSON
|
1371 |
|
1372 |
}
|
1373 |
|
1374 |
+
?>
|
edcal_test.js
CHANGED
@@ -494,6 +494,68 @@ var edcal_test = {
|
|
494 |
asyncTest('Delete the post created for testing', function() {
|
495 |
expect(1);
|
496 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
edcal.deletePost(edcal_test.post.id, function(res)
|
498 |
{
|
499 |
if (!res.post) {
|
494 |
asyncTest('Delete the post created for testing', function() {
|
495 |
expect(1);
|
496 |
|
497 |
+
edcal.deletePost(edcal_test.post.id, function(res)
|
498 |
+
{
|
499 |
+
if (!res.post) {
|
500 |
+
ok(false, 'There was an error creating the new post.');
|
501 |
+
start();
|
502 |
+
return;
|
503 |
+
}
|
504 |
+
|
505 |
+
equals(jQuery('#post-' + res.post.id).length, 0, 'The post should now be deleted from the calendar.');
|
506 |
+
start();
|
507 |
+
|
508 |
+
edcal_test.testCreateDraftDrawerPost();
|
509 |
+
|
510 |
+
});
|
511 |
+
});
|
512 |
+
},
|
513 |
+
|
514 |
+
testCreateDraftDrawerPost: function() {
|
515 |
+
/*
|
516 |
+
* Now we'll create a new post in the drafts drawer
|
517 |
+
*/
|
518 |
+
|
519 |
+
asyncTest('Create a new drafts drawer post', function() {
|
520 |
+
expect(2);
|
521 |
+
|
522 |
+
edcal_test.post.title = 'Unit Test Drafts Drawer Post';
|
523 |
+
edcal_test.post.content = edcal_test.testContent;
|
524 |
+
edcal_test.post.status = 'draft';
|
525 |
+
edcal_test.post.time = edcal.NO_DATE;
|
526 |
+
edcal_test.post.date = edcal.NO_DATE;
|
527 |
+
edcal_test.post.id = '0';
|
528 |
+
|
529 |
+
edcal.savePost(edcal_test.post, false, false, function(res) {
|
530 |
+
if (!res.post) {
|
531 |
+
ok(false, 'There was an error creating the new post.');
|
532 |
+
start();
|
533 |
+
return;
|
534 |
+
}
|
535 |
+
|
536 |
+
equals(res.post.title, edcal_test.post.title, 'The resulting post should have the same title as the request');
|
537 |
+
|
538 |
+
equals(jQuery('#post-' + res.post.id).length, 1, 'The post should be added in only one place in the calendar.');
|
539 |
+
|
540 |
+
edcal_test.post = res.post;
|
541 |
+
|
542 |
+
start();
|
543 |
+
|
544 |
+
edcal_test.testDeleteDraftDrawerPost();
|
545 |
+
});
|
546 |
+
});
|
547 |
+
|
548 |
+
},
|
549 |
+
|
550 |
+
testDeleteDraftDrawerPost: function() {
|
551 |
+
|
552 |
+
/*
|
553 |
+
* The last step is to delete the post we made so
|
554 |
+
* the test cleans up after itself.
|
555 |
+
*/
|
556 |
+
asyncTest('Delete the post created for drafts drawer testing', function() {
|
557 |
+
expect(1);
|
558 |
+
|
559 |
edcal.deletePost(edcal_test.post.id, function(res)
|
560 |
{
|
561 |
if (!res.post) {
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: cvernon, justinstresslimit, jkudish, MaryVogt, zgrossbart
|
3 |
Tags: posts, post, calendar, AJAX, admin, administration
|
4 |
Requires at least: 2.8.5
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag: 2.
|
7 |
|
8 |
The Editorial Calendar makes it possible to see all your posts and drag and drop them to manage your blog.
|
9 |
|
@@ -60,8 +60,8 @@ From time to time people write articles about the editorial calendar. We apprec
|
|
60 |
|
61 |
<a href="http://www.smashingmagazine.com/2010/08/30/the-importance-of-consistency-using-editorial-calendars-and-style-guides/">Blogging For Web Designers: Editorial Calendars and Style Guides</a> by <a href="http://jessica.smashingmagazine.com/">Jessica Bordeau</a> at <a href="http://www.smashingmagazine.com/">Smashing Magazine</a>
|
62 |
|
63 |
-
<a href="http://
|
64 |
-
Editorial Calendar WordPress plugin review</a> by <a href="http://
|
65 |
|
66 |
<a href="http://www.disruptiveconversations.com/2010/09/brogan-is-right-the-editorial-calendar-wordpress-plugin-truly-rocks.html">Brogan is right - the "Editorial Calendar" WordPress plugin truly rocks!</a> by <a href="http://www.danyork.com/">Dan York</a>
|
67 |
|
@@ -173,6 +173,16 @@ Moving published posts can cause problems with some RSS feeds and is generally n
|
|
173 |
|
174 |
== Changelog ==
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
= 2.5 =
|
177 |
|
178 |
The calendar is now handling the post ID in the same way for each call it uses to get data about each post when returning post data to the calendar to avoid some PHP warnings.
|
2 |
Contributors: cvernon, justinstresslimit, jkudish, MaryVogt, zgrossbart
|
3 |
Tags: posts, post, calendar, AJAX, admin, administration
|
4 |
Requires at least: 2.8.5
|
5 |
+
Tested up to: 3.5
|
6 |
+
Stable tag: 2.6
|
7 |
|
8 |
The Editorial Calendar makes it possible to see all your posts and drag and drop them to manage your blog.
|
9 |
|
60 |
|
61 |
<a href="http://www.smashingmagazine.com/2010/08/30/the-importance-of-consistency-using-editorial-calendars-and-style-guides/">Blogging For Web Designers: Editorial Calendars and Style Guides</a> by <a href="http://jessica.smashingmagazine.com/">Jessica Bordeau</a> at <a href="http://www.smashingmagazine.com/">Smashing Magazine</a>
|
62 |
|
63 |
+
<a href="http://mydigitalinternet.com/2010/editorial-calendar-wordpress-plugin-review">
|
64 |
+
Editorial Calendar WordPress plugin review</a> by Stephen Duckworth at <a href="http://mydigitalinternet.com/">My Digital Internet</a>
|
65 |
|
66 |
<a href="http://www.disruptiveconversations.com/2010/09/brogan-is-right-the-editorial-calendar-wordpress-plugin-truly-rocks.html">Brogan is right - the "Editorial Calendar" WordPress plugin truly rocks!</a> by <a href="http://www.danyork.com/">Dan York</a>
|
67 |
|
173 |
|
174 |
== Changelog ==
|
175 |
|
176 |
+
= 2.6 =
|
177 |
+
|
178 |
+
Fixed some layout issues with the previous and next calendar buttons in WordPress 3.5.
|
179 |
+
|
180 |
+
We are now properly saving new posts in the drafts drawer in WordPress 3.5.
|
181 |
+
|
182 |
+
Added unit tests to cover creating a new post in the drafts drawer.
|
183 |
+
|
184 |
+
Added a few performance improvements to the calendar like making sure we only load our code in the admin console.
|
185 |
+
|
186 |
= 2.5 =
|
187 |
|
188 |
The calendar is now handling the post ID in the same way for each call it uses to get data about each post when returning post data to the calendar to avoid some PHP warnings.
|