Version Description
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.
The calendar is now more careful about PHP warnings so it still works if the blog is set to show PHP warnings.
The unit tests are now using the correct CSS reference so they show up properly.
Moved the setting for the default post time to the edcal.php so it's easier to change without recompiling the JavaScript.
The calendar now supports Russian thanks to Danny Zawacki and Lyudmila Kostryka. Danny blogs at http://dannyzawacki.com
We have started to namespace css classes to avoid conflicts with other plugins & themes.
Download this release
Release Info
Developer | zgrossbart |
Plugin | Editorial Calendar |
Version | 2.5 |
Comparing to | |
See all releases |
Code changes from version 2.4 to 2.5
- edcal.css +5 -1
- edcal.js +7 -6
- edcal.min.js +7 -7
- edcal.php +172 -152
- edcal_test.js +3 -3
- languages/editorial-calendar-ru_RU.mo +0 -0
- languages/editorial-calendar-ru_RU.po +189 -0
- lib/languages/date-ru-RU.js +104 -0
- readme.txt +18 -4
edcal.css
CHANGED
@@ -234,7 +234,7 @@ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockq
|
|
234 |
|
235 |
/* Rows */
|
236 |
|
237 |
-
.
|
238 |
height: 100%;
|
239 |
}
|
240 |
|
@@ -597,3 +597,7 @@ TinyMCE Rich Editor and Media buttons are not currently used
|
|
597 |
#moveToToday {
|
598 |
margin-left: 1.5em;
|
599 |
}
|
|
|
|
|
|
|
|
234 |
|
235 |
/* Rows */
|
236 |
|
237 |
+
.edcal_row {
|
238 |
height: 100%;
|
239 |
}
|
240 |
|
597 |
#moveToToday {
|
598 |
margin-left: 1.5em;
|
599 |
}
|
600 |
+
|
601 |
+
.tablenav .tablenav-pages a {
|
602 |
+
background-position-y: -380px;
|
603 |
+
}
|
edcal.js
CHANGED
@@ -754,7 +754,7 @@ var edcal = {
|
|
754 |
var _date = edcal._wDate.clone();
|
755 |
|
756 |
var newrow = '<div class="rowcont" id="' + 'row' + edcal._wDate.toString(edcal.internalDateFormat) + '">' +
|
757 |
-
'<div id="' + 'row' + edcal._wDate.toString(edcal.internalDateFormat) + 'row" class="
|
758 |
for (var i = 0; i < 7; i++) {
|
759 |
/*
|
760 |
* Adding all of these calls in the string is kind of messy. We
|
@@ -1102,7 +1102,7 @@ var edcal = {
|
|
1102 |
|
1103 |
var date = jQuery(this).parent().parent().attr('id');
|
1104 |
|
1105 |
-
var formattedtime =
|
1106 |
if (edcal.timeFormat !== 'H:i' && edcal.timeFormat !== 'G:i') {
|
1107 |
formattedtime += ' AM';
|
1108 |
}
|
@@ -1191,7 +1191,7 @@ var edcal = {
|
|
1191 |
if (post.time !== '') {
|
1192 |
time = Date.parse(post.time);
|
1193 |
} else {
|
1194 |
-
time = Date.parse(
|
1195 |
}
|
1196 |
|
1197 |
var formattedDate;
|
@@ -1208,7 +1208,8 @@ var edcal = {
|
|
1208 |
'&title=' + encodeURIComponent(post.title) +
|
1209 |
'&content=' + encodeURIComponent(post.content) +
|
1210 |
'&id=' + encodeURIComponent(post.id) +
|
1211 |
-
'&status=' + encodeURIComponent(post.status)
|
|
|
1212 |
|
1213 |
if (time === null || time === edcal.NO_DATE) {
|
1214 |
postData += '&date_gmt=' + encodeURIComponent('0000-00-00 00:00:00');
|
@@ -1821,8 +1822,8 @@ var edcal = {
|
|
1821 |
last day in the last week. We call children twice to
|
1822 |
work around a small JQuery issue.
|
1823 |
*/
|
1824 |
-
var firstDate = edcal.getDayFromDayId(items.eq(0).children('.
|
1825 |
-
var lastDate = edcal.getDayFromDayId(items.eq(edcal.weeksPref - 1).children('.
|
1826 |
|
1827 |
jQuery('#currentRange').text(edcal.chineseAposWorkaround(firstDate.toString(Date.CultureInfo.formatPatterns.yearMonth)) + ' - ' +
|
1828 |
edcal.chineseAposWorkaround(lastDate.toString(Date.CultureInfo.formatPatterns.yearMonth)));
|
754 |
var _date = edcal._wDate.clone();
|
755 |
|
756 |
var newrow = '<div class="rowcont" id="' + 'row' + edcal._wDate.toString(edcal.internalDateFormat) + '">' +
|
757 |
+
'<div id="' + 'row' + edcal._wDate.toString(edcal.internalDateFormat) + 'row" class="edcal_row">';
|
758 |
for (var i = 0; i < 7; i++) {
|
759 |
/*
|
760 |
* Adding all of these calls in the string is kind of messy. We
|
1102 |
|
1103 |
var date = jQuery(this).parent().parent().attr('id');
|
1104 |
|
1105 |
+
var formattedtime = edcal.defaultTime;
|
1106 |
if (edcal.timeFormat !== 'H:i' && edcal.timeFormat !== 'G:i') {
|
1107 |
formattedtime += ' AM';
|
1108 |
}
|
1191 |
if (post.time !== '') {
|
1192 |
time = Date.parse(post.time);
|
1193 |
} else {
|
1194 |
+
time = Date.parse(edcal.defaultTime); // If we don't have a time set, default it to 10am
|
1195 |
}
|
1196 |
|
1197 |
var formattedDate;
|
1208 |
'&title=' + encodeURIComponent(post.title) +
|
1209 |
'&content=' + encodeURIComponent(post.content) +
|
1210 |
'&id=' + encodeURIComponent(post.id) +
|
1211 |
+
'&status=' + encodeURIComponent(post.status) +
|
1212 |
+
'&orig_status=' + encodeURIComponent(post.orig_status);
|
1213 |
|
1214 |
if (time === null || time === edcal.NO_DATE) {
|
1215 |
postData += '&date_gmt=' + encodeURIComponent('0000-00-00 00:00:00');
|
1822 |
last day in the last week. We call children twice to
|
1823 |
work around a small JQuery issue.
|
1824 |
*/
|
1825 |
+
var firstDate = edcal.getDayFromDayId(items.eq(0).children('.edcal_row').children('.day:first').attr('id'));
|
1826 |
+
var lastDate = edcal.getDayFromDayId(items.eq(edcal.weeksPref - 1).children('.edcal_row').children('.day:last').attr('id'));
|
1827 |
|
1828 |
jQuery('#currentRange').text(edcal.chineseAposWorkaround(firstDate.toString(Date.CultureInfo.formatPatterns.yearMonth)) + ' - ' +
|
1829 |
edcal.chineseAposWorkaround(lastDate.toString(Date.CultureInfo.formatPatterns.yearMonth)));
|
edcal.min.js
CHANGED
@@ -12,7 +12,7 @@ jQuery("#unscheduled").mouseout(function(){jQuery("#unscheduledNewLink").hide()}
|
|
12 |
c+e,h++;else for(i=a.length-1;-1<i;i--)a.eq(i).css({width:c+"%",height:d+"%",position:"absolute",left:f+"%",top:g+"%"}),0===h%b?(f=0,g+=d+e):f+=c+e,h++})}},alignCal:function(){edcal.alignGrid("#cal",1,100,100/edcal.weeksPref-1,1)},createDaysHeader:function(){var a=Date.today().next().sunday();edcal.nextStartOfWeek(a);var b='<div class="dayheadcont"><div class="dayhead firstday">'+a.add(edcal.startOfWeek).days().toString("dddd")+"</div>",b=b+('<div class="dayhead">'+a.add(1).days().toString("dddd")+
|
13 |
"</div>"),b=b+('<div class="dayhead">'+a.add(1).days().toString("dddd")+"</div>"),b=b+('<div class="dayhead">'+a.add(1).days().toString("dddd")+"</div>"),b=b+('<div class="dayhead">'+a.add(1).days().toString("dddd")+"</div>"),b=b+('<div class="dayhead">'+a.add(1).days().toString("dddd")+"</div>"),b=b+('<div class="dayhead lastday">'+a.add(1).days().toString("dddd")+"</div>");jQuery("#cal_cont").prepend(b);edcal.alignGrid(".dayheadcont",7,13.8,100,0.5)},getDateClass:function(a){var b,c;c=-1===a.compareTo(Date.today())?
|
14 |
"beforeToday":"todayAndAfter";edcal.firstDayOfMonth||(edcal.firstDayOfMonth=Date.today().moveToFirstDayOfMonth().clearTime(),edcal.firstDayOfNextMonth=Date.today().moveToLastDayOfMonth().clearTime());a.between(edcal.firstDayOfMonth,edcal.firstDayOfNextMonth)?b="month-present":1===a.compareTo(edcal.firstDayOfMonth)?b="month-future":-1===a.compareTo(edcal.firstDayOfNextMonth)&&(b="month-past");"01"===a.toString("dd")&&(c+=" firstOfMonth");return b+" "+c},showAddPostLink:function(a){edcal.inDrag||(a=
|
15 |
-
jQuery("#"+a+" a.daynewlink"),a.css("display","block"),a.bind("click",edcal.addPost))},hideAddPostLink:function(a){jQuery("#"+a+" a.daynewlink").hide().unbind("click",edcal.addPost)},createRow:function(a,b){for(var c=edcal._wDate.clone(),d='<div class="rowcont" id="row'+edcal._wDate.toString(edcal.internalDateFormat)+'"><div id="row'+edcal._wDate.toString(edcal.internalDateFormat)+'row" class="
|
16 |
"');\" onmouseout=\"edcal.hideAddPostLink('"+c.toString(edcal.internalDateFormat)+'\');" id="'+c.toString(edcal.internalDateFormat)+'" class="day '+edcal.getDateClass(c)+" "+c.toString("dddd").toLowerCase()+" month-"+c.toString("MM").toLowerCase()+'">',d+='<div class="dayobj">',d+='<a href="#" adddate="'+c.toString("MMMM d")+'" class="daynewlink" title="'+sprintf(edcal.str_newpost,edcal.chineseAposWorkaround(c.toString(Date.CultureInfo.formatPatterns.monthDay)))+'" onclick="return false;">'+edcal.str_addPostLink+
|
17 |
"</a>",d="01"===c.toString("dd")?d+('<div class="daylabel">'+c.toString("MMM d")):d+('<div class="daylabel">'+c.toString("d")),d+="</div>",d+='<ul class="postlist">',d+=edcal.getPostItems(c.toString(edcal.internalDateFormat)),d+="</ul>",d+="</div>",d+="</div>",c.add(1).days();d+="</div></div>";b?a.append(d):a.prepend(d);edcal.alignGrid("#row"+edcal._wDate.toString(edcal.internalDateFormat)+"row",7,13.9,100,0.5);edcal.draggablePost("#row"+edcal._wDate.toString(edcal.internalDateFormat)+" li.post");
|
18 |
edcal.makeDroppable(jQuery("#row"+edcal._wDate.toString(edcal.internalDateFormat)+" > div > div.day"));return jQuery("row"+edcal._wDate.toString(edcal.internalDateFormat))},makeDroppable:function(a){a.droppable({hoverClass:"day-active",accept:function(a){return jQuery(this).hasClass("beforeToday")?a.hasClass("draft")?!0:!1:!0},greedy:!0,tolerance:"pointer",drop:function(a,c){var d=c.draggable.parent().parent().parent().attr("id");edcal.doDrop(d,c.draggable.attr("id"),jQuery(this).attr("id"))}})},
|
@@ -20,11 +20,11 @@ doDrop:function(a,b,c,d){var e=edcal.findPostForId(a,b);edcal.removePostFromMap(
|
|
20 |
appendTo:"body",helper:"clone",distance:1,addClasses:!1,start:function(){edcal.inDrag=!0},stop:function(){edcal.inDrag=!1},drag:function(a,b){edcal.handleDrag(a,b)},scroll:!1,refreshPositions:!0}),jQuery(this).addClass("draggable"))})},handleDrag:function(a){!edcal.isMoving&&!edcal.isDragScrolling&&(edcal.isDragScrolling=!0,a.pageY<edcal.position.top+10?edcal.move(1,!1):a.pageY>edcal.position.bottom-10&&edcal.move(1,!0),setTimeout(function(){edcal.isDragScrolling=!1},300))},removePostFromMap:function(a,
|
21 |
b){if(edcal.posts[a])for(var c=0;c<edcal.posts[a].length;c++)if(edcal.posts[a][c]&&"post-"+edcal.posts[a][c].id===b)return edcal.posts[a][c]=null,!0;return!1},addPostItem:function(a,b){jQuery("#"+b+" > div > ul").append(edcal.createPostItem(a,b))},addPostItemDragAndToolltip:function(a){edcal.draggablePost("#"+a+" > div > ul > li")},deletePost:function(a,b){var c=edcal.ajax_url()+"&action=edcal_deletepost&postid="+a;jQuery.ajax({url:c,type:"POST",processData:!1,timeout:1E5,dataType:"json",success:function(a){a.post.date_gmt===
|
22 |
edcal.NO_DATE?edcal.removePostItem(a.post.date_gmt,"post-"+a.post.id):edcal.removePostItem(a.post.date,"post-"+a.post.id);a.error?a.error===edcal.NONCE_ERROR&&edcal.showError(edcal.checksum_error):edcal.output('Finished deleting the post: "'+a.post.title+'"');b&&b(a)},error:function(a){edcal.showError(edcal.general_error);a.responseText&&edcal.output("deletePost xhr.responseText: "+a.responseText)}})},confirmDelete:function(a){return confirm(edcal.str_del_msg1+a+edcal.str_del_msg2)?!0:!1},ajax_url:function(){return ajaxurl+
|
23 |
-
"?_wpnonce="+edcal.wp_nonce},getMediaBar:function(){return jQuery("#cal_mediabar").html()},addPost:function(){jQuery("#newPostScheduleButton").addClass("disabled");var a=jQuery(this).parent().parent().attr("id"),b=
|
24 |
-
formatteddate:edcal.NO_DATE,time:edcal.NO_DATE,status:"draft"};edcal.showForm(a);return!1},editPost:function(a){jQuery("#newPostScheduleButton").removeClass("disabled");edcal.getPost(a,edcal.showForm);return!1},savePost:function(a,b,c,d){if("undefined"===typeof a||null===a)a=edcal.serializePost();if(!a.title||""===a.title)return!1;edcal.output("savePost("+a.date+", "+a.title+")");jQuery("#edit-slug-buttons").addClass("tiploading");var e=a.time.toUpperCase();"12"===e.slice(0,2)&&
|
25 |
-
2,e.length)?a.time="12:"+e.slice(3,5):"12"===e.slice(0,2)&&"AM"===e.slice(a.time.length-2,a.time.length)&&(a.time="00:"+e.slice(3,5));var e=""!==a.time?Date.parse(a.time):Date.parse(
|
26 |
-
"&content="+encodeURIComponent(a.content)+"&id="+encodeURIComponent(a.id)+"&status="+encodeURIComponent(a.status);if(null===e||e===edcal.NO_DATE)a+="&date_gmt="+encodeURIComponent("0000-00-00 00:00:00");edcal.getUrlVars().post_type&&(a+="&post_type="+encodeURIComponent(edcal.getUrlVars().post_type));c&&(a+="&dopublish="+encodeURIComponent("future"));jQuery.ajax({url:g,type:"POST",processData:!1,data:a,timeout:1E5,dataType:"json",
|
27 |
-
jQuery("#edcal_quickedit").hide();jQuery("#edcal_scrollable").data("scrollable").getConf().keyboard=true;if(a.error){a.error===edcal.NONCE_ERROR&&edcal.showError(edcal.checksum_error);return false}if(a.post)if(b)window.location=a.post.editlink.replace("&","&");else{var c=a.post.date;if(a.post.date_gmt===edcal.NO_DATE)c=a.post.date_gmt;a.post.id&&edcal.removePostItem(c,"post-"+a.post.id);edcal.addPostItem(a.post,c);edcal.addPostItemDragAndToolltip(c)}else edcal.showError("There was an error creating a new post for your blog.");
|
28 |
d&&d(a);return true},error:function(a){jQuery("#edit-slug-buttons").removeClass("tiploading");jQuery("#edcal_quickedit").hide();jQuery("#edcal_scrollable").data("scrollable").getConf().keyboard=true;edcal.showError(edcal.general_error);a.responseText&&edcal.output("savePost xhr.responseText: "+a.responseText)}});return!1},serializePost:function(){var a={};jQuery("#edcal_quickedit").find("input, textarea, select").each(function(){a[this.name]=this.value});return a},showForm:function(a){edcal.resetForm();
|
29 |
a.formatteddate===edcal.NO_DATE||a.date_gmt===edcal.NO_DATE?jQuery("#timeEditControls").hide():jQuery("#timeEditControls").show();jQuery("#edcal_quickedit").center().show();jQuery("#edcal_scrollable").data("scrollable").getConf().keyboard=!1;a.id?(jQuery("#tooltiptitle").text(sprintf(edcal.str_edit_post_title,a.typeTitle,edcal.getDayFromDayId(a.date).toString(edcal.previewDateFormat))),jQuery("#edcal-title-new-field").val(a.title),jQuery("#content").val(a.content)):a.formatteddate===edcal.NO_DATE?
|
30 |
jQuery("#tooltiptitle").text(edcal.str_newdraft_title):jQuery("#tooltiptitle").text(edcal.str_newpost_title+a.formatteddate);"future"===a.status&&jQuery("#newPostScheduleButton").text(edcal.str_update);a.status?(jQuery("#edcal-status").val(a.status),edcal.updatePublishButton()):(jQuery("#edcal-status").val("draft"),jQuery("#newPostScheduleButton").text(edcal.str_save));a.status&&("draft"!==a.status&&"future"!==a.status&&"pending"!==a.status)&&(jQuery("#edcal-status").attr("disabled","true"),jQuery("#edcal-status").append('<option class="temp" value="'+
|
@@ -39,7 +39,7 @@ edcal.actionLinksElem=null},1E3)},isPostMovable:function(a){return a.editlink&&"
|
|
39 |
a.id+'" class="post '+a.status+" "+edcal.getPostEditableClass(a)+'"><div class="postlink "><span>'+b+'</span></div><div class="postactions"><a href="'+a.editlink+'">'+edcal.str_republish+'</a> | <a href="'+a.permalink+'">'+edcal.str_view+"</a></div></li>"},setClassforToday:function(){jQuery("#"+Date.today().toString(edcal.internalDateFormat)).addClass("today")},getCalHeight:function(){var a=jQuery(window).height()-jQuery("#footer").height()-jQuery("#wphead").height()-150;return Math.max(a,500)},move:function(a,
|
40 |
b,c){if(!jQuery("#edcal_quickedit").is(":visible")){edcal.currentDirection!==b&&(edcal._wDate=b?edcal._wDate.add(7*(edcal.weeksPref+7)).days():edcal._wDate.add(-(7*(edcal.weeksPref+7))).days(),edcal.steps=0,edcal.moveDate=edcal._wDate);edcal.currentDirection=b;var d;if(b)for(d=0;d<a;d++)jQuery("#cal > div:first").remove(),edcal.createRow(jQuery("#cal"),!0),edcal._wDate.add(7).days();else for(d=0;d<a;d++)jQuery("#cal > div:last").remove(),edcal.createRow(jQuery("#cal"),!1),edcal._wDate.add(-7).days();
|
41 |
edcal.alignCal();edcal.setClassforToday();edcal.setDateLabel();edcal.steps+=a;edcal.tID?clearTimeout(edcal.tID):edcal.moveDate=edcal._wDate;edcal.tID=setTimeout(function(){b?edcal.getPosts(edcal._wDate.clone().add(-7*(edcal.steps+1)).days(),edcal._wDate.clone(),c):edcal.getPosts(edcal._wDate.clone(),edcal._wDate.clone().add(7*(edcal.steps+1)).days(),c);edcal.steps=0;edcal.tID=null;edcal.moveDate=edcal._wDate},1E3);b?jQuery.cookie("edcal_date",edcal._wDate.clone().add(-(edcal.weeksPref+4)).weeks().toString("yyyy-dd-MM")):
|
42 |
-
jQuery.cookie("edcal_date",edcal._wDate.clone().add(3).weeks().toString("yyyy-dd-MM"))}},getDayFromDayId:function(a){return Date.parseExact(a.substring(2,4)+"/"+a.substring(0,2)+"/"+a.substring(4),"MM/dd/yyyy")},setDateLabel:function(){var a=jQuery("#edcal_scrollable").scrollable().getVisibleItems(),b=edcal.getDayFromDayId(a.eq(0).children(".
|
43 |
" - "+edcal.chineseAposWorkaround(a.toString(Date.CultureInfo.formatPatterns.yearMonth)))},nextStartOfWeek:function(a){a=a.clone();if(null===edcal.startOfWeek)if(edcal.locale){var b=edcal.locale.toUpperCase();edcal.startOfWeek=edcal.endsWith(b,"AS")||edcal.endsWith(b,"AZ")||edcal.endsWith(b,"BW")||edcal.endsWith(b,"CA")||edcal.endsWith(b,"CN")||edcal.endsWith(b,"FO")||edcal.endsWith(b,"GB")||edcal.endsWith(b,"GE")||edcal.endsWith(b,"GL")||edcal.endsWith(b,"GU")||edcal.endsWith(b,"HK")||edcal.endsWith(b,
|
44 |
"IE")||edcal.endsWith(b,"IL")||edcal.endsWith(b,"IN")||edcal.endsWith(b,"IS")||edcal.endsWith(b,"JM")||edcal.endsWith(b,"JP")||edcal.endsWith(b,"KG")||edcal.endsWith(b,"KR")||edcal.endsWith(b,"LA")||edcal.endsWith(b,"MH")||edcal.endsWith(b,"MN")||edcal.endsWith(b,"MO")||edcal.endsWith(b,"MP")||edcal.endsWith(b,"MT")||edcal.endsWith(b,"NZ")||edcal.endsWith(b,"PH")||edcal.endsWith(b,"PK")||edcal.endsWith(b,"SG")||edcal.endsWith(b,"SY")||edcal.endsWith(b,"TH")||edcal.endsWith(b,"TT")||edcal.endsWith(b,
|
45 |
"TW")||edcal.endsWith(b,"UM")||edcal.endsWith(b,"US")||edcal.endsWith(b,"UZ")||edcal.endsWith(b,"VI")||edcal.endsWith(b,"ZW")?0:edcal.endsWith(b,"MV")?5:edcal.endsWith(b,"AF")||edcal.endsWith(b,"BH")||edcal.endsWith(b,"DJ")||edcal.endsWith(b,"DZ")||edcal.endsWith(b,"EG")||edcal.endsWith(b,"ER")||edcal.endsWith(b,"ET")||edcal.endsWith(b,"IQ")||edcal.endsWith(b,"IR")||edcal.endsWith(b,"JO")||edcal.endsWith(b,"KE")||edcal.endsWith(b,"KW")||edcal.endsWith(b,"LY")||edcal.endsWith(b,"MA")||edcal.endsWith(b,
|
12 |
c+e,h++;else for(i=a.length-1;-1<i;i--)a.eq(i).css({width:c+"%",height:d+"%",position:"absolute",left:f+"%",top:g+"%"}),0===h%b?(f=0,g+=d+e):f+=c+e,h++})}},alignCal:function(){edcal.alignGrid("#cal",1,100,100/edcal.weeksPref-1,1)},createDaysHeader:function(){var a=Date.today().next().sunday();edcal.nextStartOfWeek(a);var b='<div class="dayheadcont"><div class="dayhead firstday">'+a.add(edcal.startOfWeek).days().toString("dddd")+"</div>",b=b+('<div class="dayhead">'+a.add(1).days().toString("dddd")+
|
13 |
"</div>"),b=b+('<div class="dayhead">'+a.add(1).days().toString("dddd")+"</div>"),b=b+('<div class="dayhead">'+a.add(1).days().toString("dddd")+"</div>"),b=b+('<div class="dayhead">'+a.add(1).days().toString("dddd")+"</div>"),b=b+('<div class="dayhead">'+a.add(1).days().toString("dddd")+"</div>"),b=b+('<div class="dayhead lastday">'+a.add(1).days().toString("dddd")+"</div>");jQuery("#cal_cont").prepend(b);edcal.alignGrid(".dayheadcont",7,13.8,100,0.5)},getDateClass:function(a){var b,c;c=-1===a.compareTo(Date.today())?
|
14 |
"beforeToday":"todayAndAfter";edcal.firstDayOfMonth||(edcal.firstDayOfMonth=Date.today().moveToFirstDayOfMonth().clearTime(),edcal.firstDayOfNextMonth=Date.today().moveToLastDayOfMonth().clearTime());a.between(edcal.firstDayOfMonth,edcal.firstDayOfNextMonth)?b="month-present":1===a.compareTo(edcal.firstDayOfMonth)?b="month-future":-1===a.compareTo(edcal.firstDayOfNextMonth)&&(b="month-past");"01"===a.toString("dd")&&(c+=" firstOfMonth");return b+" "+c},showAddPostLink:function(a){edcal.inDrag||(a=
|
15 |
+
jQuery("#"+a+" a.daynewlink"),a.css("display","block"),a.bind("click",edcal.addPost))},hideAddPostLink:function(a){jQuery("#"+a+" a.daynewlink").hide().unbind("click",edcal.addPost)},createRow:function(a,b){for(var c=edcal._wDate.clone(),d='<div class="rowcont" id="row'+edcal._wDate.toString(edcal.internalDateFormat)+'"><div id="row'+edcal._wDate.toString(edcal.internalDateFormat)+'row" class="edcal_row">',e=0;7>e;e++)d+="<div onmouseover=\"edcal.showAddPostLink('"+c.toString(edcal.internalDateFormat)+
|
16 |
"');\" onmouseout=\"edcal.hideAddPostLink('"+c.toString(edcal.internalDateFormat)+'\');" id="'+c.toString(edcal.internalDateFormat)+'" class="day '+edcal.getDateClass(c)+" "+c.toString("dddd").toLowerCase()+" month-"+c.toString("MM").toLowerCase()+'">',d+='<div class="dayobj">',d+='<a href="#" adddate="'+c.toString("MMMM d")+'" class="daynewlink" title="'+sprintf(edcal.str_newpost,edcal.chineseAposWorkaround(c.toString(Date.CultureInfo.formatPatterns.monthDay)))+'" onclick="return false;">'+edcal.str_addPostLink+
|
17 |
"</a>",d="01"===c.toString("dd")?d+('<div class="daylabel">'+c.toString("MMM d")):d+('<div class="daylabel">'+c.toString("d")),d+="</div>",d+='<ul class="postlist">',d+=edcal.getPostItems(c.toString(edcal.internalDateFormat)),d+="</ul>",d+="</div>",d+="</div>",c.add(1).days();d+="</div></div>";b?a.append(d):a.prepend(d);edcal.alignGrid("#row"+edcal._wDate.toString(edcal.internalDateFormat)+"row",7,13.9,100,0.5);edcal.draggablePost("#row"+edcal._wDate.toString(edcal.internalDateFormat)+" li.post");
|
18 |
edcal.makeDroppable(jQuery("#row"+edcal._wDate.toString(edcal.internalDateFormat)+" > div > div.day"));return jQuery("row"+edcal._wDate.toString(edcal.internalDateFormat))},makeDroppable:function(a){a.droppable({hoverClass:"day-active",accept:function(a){return jQuery(this).hasClass("beforeToday")?a.hasClass("draft")?!0:!1:!0},greedy:!0,tolerance:"pointer",drop:function(a,c){var d=c.draggable.parent().parent().parent().attr("id");edcal.doDrop(d,c.draggable.attr("id"),jQuery(this).attr("id"))}})},
|
20 |
appendTo:"body",helper:"clone",distance:1,addClasses:!1,start:function(){edcal.inDrag=!0},stop:function(){edcal.inDrag=!1},drag:function(a,b){edcal.handleDrag(a,b)},scroll:!1,refreshPositions:!0}),jQuery(this).addClass("draggable"))})},handleDrag:function(a){!edcal.isMoving&&!edcal.isDragScrolling&&(edcal.isDragScrolling=!0,a.pageY<edcal.position.top+10?edcal.move(1,!1):a.pageY>edcal.position.bottom-10&&edcal.move(1,!0),setTimeout(function(){edcal.isDragScrolling=!1},300))},removePostFromMap:function(a,
|
21 |
b){if(edcal.posts[a])for(var c=0;c<edcal.posts[a].length;c++)if(edcal.posts[a][c]&&"post-"+edcal.posts[a][c].id===b)return edcal.posts[a][c]=null,!0;return!1},addPostItem:function(a,b){jQuery("#"+b+" > div > ul").append(edcal.createPostItem(a,b))},addPostItemDragAndToolltip:function(a){edcal.draggablePost("#"+a+" > div > ul > li")},deletePost:function(a,b){var c=edcal.ajax_url()+"&action=edcal_deletepost&postid="+a;jQuery.ajax({url:c,type:"POST",processData:!1,timeout:1E5,dataType:"json",success:function(a){a.post.date_gmt===
|
22 |
edcal.NO_DATE?edcal.removePostItem(a.post.date_gmt,"post-"+a.post.id):edcal.removePostItem(a.post.date,"post-"+a.post.id);a.error?a.error===edcal.NONCE_ERROR&&edcal.showError(edcal.checksum_error):edcal.output('Finished deleting the post: "'+a.post.title+'"');b&&b(a)},error:function(a){edcal.showError(edcal.general_error);a.responseText&&edcal.output("deletePost xhr.responseText: "+a.responseText)}})},confirmDelete:function(a){return confirm(edcal.str_del_msg1+a+edcal.str_del_msg2)?!0:!1},ajax_url:function(){return ajaxurl+
|
23 |
+
"?_wpnonce="+edcal.wp_nonce},getMediaBar:function(){return jQuery("#cal_mediabar").html()},addPost:function(){jQuery("#newPostScheduleButton").addClass("disabled");var a=jQuery(this).parent().parent().attr("id"),b=edcal.defaultTime;"H:i"!==edcal.timeFormat&&"G:i"!==edcal.timeFormat&&(b+=" AM");a={id:0,date:a,formatteddate:edcal.getDayFromDayId(a).toString(edcal.previewDateFormat),time:b};edcal.showForm(a);return!1},addDraft:function(){jQuery("#newPostScheduleButton").addClass("disabled");var a={id:0,
|
24 |
+
date:Date.today(),formatteddate:edcal.NO_DATE,time:edcal.NO_DATE,status:"draft"};edcal.showForm(a);return!1},editPost:function(a){jQuery("#newPostScheduleButton").removeClass("disabled");edcal.getPost(a,edcal.showForm);return!1},savePost:function(a,b,c,d){if("undefined"===typeof a||null===a)a=edcal.serializePost();if(!a.title||""===a.title)return!1;edcal.output("savePost("+a.date+", "+a.title+")");jQuery("#edit-slug-buttons").addClass("tiploading");var e=a.time.toUpperCase();"12"===e.slice(0,2)&&
|
25 |
+
"PM"===e.slice(e.length-2,e.length)?a.time="12:"+e.slice(3,5):"12"===e.slice(0,2)&&"AM"===e.slice(a.time.length-2,a.time.length)&&(a.time="00:"+e.slice(3,5));var e=""!==a.time?Date.parse(a.time):Date.parse(edcal.defaultTime),f;if(null!==e&&e!==edcal.NO_DATE){var g=e.format("H:i:s");f=encodeURIComponent(edcal.getDayFromDayId(a.date).toString(edcal.wp_dateFormat)+" "+g)}else f=encodeURIComponent(a.date.toString(edcal.wp_dateFormat+" H:i:s"));g=edcal.ajax_url()+"&action=edcal_savepost";a="date="+f+"&title="+
|
26 |
+
encodeURIComponent(a.title)+"&content="+encodeURIComponent(a.content)+"&id="+encodeURIComponent(a.id)+"&status="+encodeURIComponent(a.status)+"&orig_status="+encodeURIComponent(a.orig_status);if(null===e||e===edcal.NO_DATE)a+="&date_gmt="+encodeURIComponent("0000-00-00 00:00:00");edcal.getUrlVars().post_type&&(a+="&post_type="+encodeURIComponent(edcal.getUrlVars().post_type));c&&(a+="&dopublish="+encodeURIComponent("future"));jQuery.ajax({url:g,type:"POST",processData:!1,data:a,timeout:1E5,dataType:"json",
|
27 |
+
success:function(a){jQuery("#edit-slug-buttons").removeClass("tiploading");jQuery("#edcal_quickedit").hide();jQuery("#edcal_scrollable").data("scrollable").getConf().keyboard=true;if(a.error){a.error===edcal.NONCE_ERROR&&edcal.showError(edcal.checksum_error);return false}if(a.post)if(b)window.location=a.post.editlink.replace("&","&");else{var c=a.post.date;if(a.post.date_gmt===edcal.NO_DATE)c=a.post.date_gmt;a.post.id&&edcal.removePostItem(c,"post-"+a.post.id);edcal.addPostItem(a.post,c);edcal.addPostItemDragAndToolltip(c)}else edcal.showError("There was an error creating a new post for your blog.");
|
28 |
d&&d(a);return true},error:function(a){jQuery("#edit-slug-buttons").removeClass("tiploading");jQuery("#edcal_quickedit").hide();jQuery("#edcal_scrollable").data("scrollable").getConf().keyboard=true;edcal.showError(edcal.general_error);a.responseText&&edcal.output("savePost xhr.responseText: "+a.responseText)}});return!1},serializePost:function(){var a={};jQuery("#edcal_quickedit").find("input, textarea, select").each(function(){a[this.name]=this.value});return a},showForm:function(a){edcal.resetForm();
|
29 |
a.formatteddate===edcal.NO_DATE||a.date_gmt===edcal.NO_DATE?jQuery("#timeEditControls").hide():jQuery("#timeEditControls").show();jQuery("#edcal_quickedit").center().show();jQuery("#edcal_scrollable").data("scrollable").getConf().keyboard=!1;a.id?(jQuery("#tooltiptitle").text(sprintf(edcal.str_edit_post_title,a.typeTitle,edcal.getDayFromDayId(a.date).toString(edcal.previewDateFormat))),jQuery("#edcal-title-new-field").val(a.title),jQuery("#content").val(a.content)):a.formatteddate===edcal.NO_DATE?
|
30 |
jQuery("#tooltiptitle").text(edcal.str_newdraft_title):jQuery("#tooltiptitle").text(edcal.str_newpost_title+a.formatteddate);"future"===a.status&&jQuery("#newPostScheduleButton").text(edcal.str_update);a.status?(jQuery("#edcal-status").val(a.status),edcal.updatePublishButton()):(jQuery("#edcal-status").val("draft"),jQuery("#newPostScheduleButton").text(edcal.str_save));a.status&&("draft"!==a.status&&"future"!==a.status&&"pending"!==a.status)&&(jQuery("#edcal-status").attr("disabled","true"),jQuery("#edcal-status").append('<option class="temp" value="'+
|
39 |
a.id+'" class="post '+a.status+" "+edcal.getPostEditableClass(a)+'"><div class="postlink "><span>'+b+'</span></div><div class="postactions"><a href="'+a.editlink+'">'+edcal.str_republish+'</a> | <a href="'+a.permalink+'">'+edcal.str_view+"</a></div></li>"},setClassforToday:function(){jQuery("#"+Date.today().toString(edcal.internalDateFormat)).addClass("today")},getCalHeight:function(){var a=jQuery(window).height()-jQuery("#footer").height()-jQuery("#wphead").height()-150;return Math.max(a,500)},move:function(a,
|
40 |
b,c){if(!jQuery("#edcal_quickedit").is(":visible")){edcal.currentDirection!==b&&(edcal._wDate=b?edcal._wDate.add(7*(edcal.weeksPref+7)).days():edcal._wDate.add(-(7*(edcal.weeksPref+7))).days(),edcal.steps=0,edcal.moveDate=edcal._wDate);edcal.currentDirection=b;var d;if(b)for(d=0;d<a;d++)jQuery("#cal > div:first").remove(),edcal.createRow(jQuery("#cal"),!0),edcal._wDate.add(7).days();else for(d=0;d<a;d++)jQuery("#cal > div:last").remove(),edcal.createRow(jQuery("#cal"),!1),edcal._wDate.add(-7).days();
|
41 |
edcal.alignCal();edcal.setClassforToday();edcal.setDateLabel();edcal.steps+=a;edcal.tID?clearTimeout(edcal.tID):edcal.moveDate=edcal._wDate;edcal.tID=setTimeout(function(){b?edcal.getPosts(edcal._wDate.clone().add(-7*(edcal.steps+1)).days(),edcal._wDate.clone(),c):edcal.getPosts(edcal._wDate.clone(),edcal._wDate.clone().add(7*(edcal.steps+1)).days(),c);edcal.steps=0;edcal.tID=null;edcal.moveDate=edcal._wDate},1E3);b?jQuery.cookie("edcal_date",edcal._wDate.clone().add(-(edcal.weeksPref+4)).weeks().toString("yyyy-dd-MM")):
|
42 |
+
jQuery.cookie("edcal_date",edcal._wDate.clone().add(3).weeks().toString("yyyy-dd-MM"))}},getDayFromDayId:function(a){return Date.parseExact(a.substring(2,4)+"/"+a.substring(0,2)+"/"+a.substring(4),"MM/dd/yyyy")},setDateLabel:function(){var a=jQuery("#edcal_scrollable").scrollable().getVisibleItems(),b=edcal.getDayFromDayId(a.eq(0).children(".edcal_row").children(".day:first").attr("id")),a=edcal.getDayFromDayId(a.eq(edcal.weeksPref-1).children(".edcal_row").children(".day:last").attr("id"));jQuery("#currentRange").text(edcal.chineseAposWorkaround(b.toString(Date.CultureInfo.formatPatterns.yearMonth))+
|
43 |
" - "+edcal.chineseAposWorkaround(a.toString(Date.CultureInfo.formatPatterns.yearMonth)))},nextStartOfWeek:function(a){a=a.clone();if(null===edcal.startOfWeek)if(edcal.locale){var b=edcal.locale.toUpperCase();edcal.startOfWeek=edcal.endsWith(b,"AS")||edcal.endsWith(b,"AZ")||edcal.endsWith(b,"BW")||edcal.endsWith(b,"CA")||edcal.endsWith(b,"CN")||edcal.endsWith(b,"FO")||edcal.endsWith(b,"GB")||edcal.endsWith(b,"GE")||edcal.endsWith(b,"GL")||edcal.endsWith(b,"GU")||edcal.endsWith(b,"HK")||edcal.endsWith(b,
|
44 |
"IE")||edcal.endsWith(b,"IL")||edcal.endsWith(b,"IN")||edcal.endsWith(b,"IS")||edcal.endsWith(b,"JM")||edcal.endsWith(b,"JP")||edcal.endsWith(b,"KG")||edcal.endsWith(b,"KR")||edcal.endsWith(b,"LA")||edcal.endsWith(b,"MH")||edcal.endsWith(b,"MN")||edcal.endsWith(b,"MO")||edcal.endsWith(b,"MP")||edcal.endsWith(b,"MT")||edcal.endsWith(b,"NZ")||edcal.endsWith(b,"PH")||edcal.endsWith(b,"PK")||edcal.endsWith(b,"SG")||edcal.endsWith(b,"SY")||edcal.endsWith(b,"TH")||edcal.endsWith(b,"TT")||edcal.endsWith(b,
|
45 |
"TW")||edcal.endsWith(b,"UM")||edcal.endsWith(b,"US")||edcal.endsWith(b,"UZ")||edcal.endsWith(b,"VI")||edcal.endsWith(b,"ZW")?0:edcal.endsWith(b,"MV")?5:edcal.endsWith(b,"AF")||edcal.endsWith(b,"BH")||edcal.endsWith(b,"DJ")||edcal.endsWith(b,"DZ")||edcal.endsWith(b,"EG")||edcal.endsWith(b,"ER")||edcal.endsWith(b,"ET")||edcal.endsWith(b,"IQ")||edcal.endsWith(b,"IR")||edcal.endsWith(b,"JO")||edcal.endsWith(b,"KE")||edcal.endsWith(b,"KW")||edcal.endsWith(b,"LY")||edcal.endsWith(b,"MA")||edcal.endsWith(b,
|
edcal.php
CHANGED
@@ -18,7 +18,7 @@
|
|
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
|
@@ -28,7 +28,7 @@ Plugin URI: http://stresslimitdesign.com/editorial-calendar-plugin
|
|
28 |
|
29 |
global $edcal;
|
30 |
if( empty($edcal) )
|
31 |
-
|
32 |
|
33 |
|
34 |
|
@@ -48,12 +48,11 @@ define( 'EDCAL_PERMISSION_ERROR', 5 );
|
|
48 |
define( 'EDCAL_NONCE_ERROR', 6 );
|
49 |
|
50 |
class EdCal {
|
51 |
-
|
52 |
-
|
53 |
protected $default_time;
|
54 |
|
55 |
function __construct() {
|
56 |
-
|
57 |
add_action('wp_ajax_edcal_saveoptions', array(&$this, 'edcal_saveoptions'));
|
58 |
add_action('wp_ajax_edcal_changedate', array(&$this, 'edcal_changedate'));
|
59 |
add_action('wp_ajax_edcal_savepost', array(&$this, 'edcal_savepost'));
|
@@ -92,30 +91,30 @@ class EdCal {
|
|
92 |
/*
|
93 |
* This function adds our calendar page to the admin UI
|
94 |
*/
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
|
100 |
-
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
|
118 |
-
|
119 |
$show_this_post_type = apply_filters("edcal_show_calendar_$post_type", true);
|
120 |
if ($show_this_post_type) {
|
121 |
$page = add_submenu_page('edit.php?post_type=' . $post_type, __('Calendar', 'editorial-calendar'), __('Calendar', 'editorial-calendar'), 'edit_posts', 'cal_' . $post_type, array(&$this, 'edcal_list_admin'));
|
@@ -123,8 +122,8 @@ class EdCal {
|
|
123 |
}
|
124 |
}
|
125 |
}
|
126 |
-
|
127 |
-
|
128 |
|
129 |
/*
|
130 |
* This is a utility function to open a file add it to our
|
@@ -174,7 +173,7 @@ class EdCal {
|
|
174 |
echo '<style type="text/css">';
|
175 |
$this->edcal_echoFile(dirname( __FILE__ ) . "/lib/timePicker.css");
|
176 |
echo '</style>';
|
177 |
-
|
178 |
echo '<!-- This is the styles from humanmsg.css -->';
|
179 |
echo '<style type="text/css">';
|
180 |
$this->edcal_echoFile(dirname( __FILE__ ) . "/lib/humanmsg.css");
|
@@ -202,6 +201,7 @@ class EdCal {
|
|
202 |
<!-- This is just a little script so we can pass the AJAX URL and some localized strings -->
|
203 |
<script type="text/javascript">
|
204 |
jQuery(document).ready(function(){
|
|
|
205 |
edcal.wp_nonce = '<?php echo wp_create_nonce("edit-calendar"); ?>';
|
206 |
<?php
|
207 |
if (get_option("edcal_weeks_pref") != "") {
|
@@ -353,7 +353,7 @@ class EdCal {
|
|
353 |
}
|
354 |
|
355 |
#tipclose {
|
356 |
-
background-image: url('<?php echo(
|
357 |
}
|
358 |
|
359 |
.day.today .daylabel {
|
@@ -390,14 +390,14 @@ class EdCal {
|
|
390 |
<a href="#" title="<?php echo(__('Skip ahead', 'editorial-calendar')) ?>" class="next page-numbers" id="nextmonth">›</a>
|
391 |
<a class="save button" title="<?php echo(__('Scroll the calendar and make the last post visible', 'editorial-calendar')) ?>" id="moveToLast">»</a>
|
392 |
|
393 |
-
|
394 |
|
395 |
|
396 |
</h3>
|
397 |
</div>
|
398 |
|
399 |
<div id="topright" class="tablenav-pages alignright">
|
400 |
-
|
401 |
</div>
|
402 |
</div>
|
403 |
|
@@ -437,14 +437,14 @@ class EdCal {
|
|
437 |
<a href="#" id="tipclose" onclick="edcal.hideForm(); return false;" title="close"> </a>
|
438 |
</div>
|
439 |
|
440 |
-
|
441 |
|
442 |
<fieldset>
|
443 |
|
444 |
<label>
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
|
449 |
<label>
|
450 |
<span class="title"><?php _e('Content', 'editorial-calendar') ?></span>
|
@@ -478,7 +478,7 @@ class EdCal {
|
|
478 |
*/ ?>
|
479 |
</fieldset>
|
480 |
|
481 |
-
|
482 |
<a class="button-primary disabled" id="newPostScheduleButton" href="#"><?php _e('Schedule', 'editorial-calendar') ?></a>
|
483 |
<a href="#" onclick="edcal.hideForm(); return false;" class="button-secondary cancel"><?php _e('Cancel', 'editorial-calendar') ?></a>
|
484 |
</p>
|
@@ -519,7 +519,7 @@ class EdCal {
|
|
519 |
wp_enqueue_script('jquery-ui-draggable');
|
520 |
wp_enqueue_script('jquery-ui-droppable');
|
521 |
|
522 |
-
|
523 |
|
524 |
wp_enqueue_script("edcal-date", plugins_url("lib/languages/date-".__('en-US', 'editorial-calendar').".js", __FILE__ ));
|
525 |
wp_enqueue_script("edcal-lib", plugins_url("lib/edcallib.min.js", __FILE__ ), array( 'jquery' ));
|
@@ -538,7 +538,7 @@ class EdCal {
|
|
538 |
wp_enqueue_script("bgiframe", plugins_url("lib/jquery.bgiframe.js", __FILE__ ), array( 'jquery' ));
|
539 |
wp_enqueue_script("humanMsg", plugins_url("lib/humanmsg.js", __FILE__ ), array( 'jquery' ));
|
540 |
wp_enqueue_script("jquery-timepicker", plugins_url("lib/jquery.timepicker.js", __FILE__ ), array( 'jquery' ));
|
541 |
-
|
542 |
wp_enqueue_script("scrollable", plugins_url("lib/tools.scrollable-1.1.2.js", __FILE__ ), array( 'jquery' ));
|
543 |
wp_enqueue_script("mouse-wheel", plugins_url("lib/lib/tools.scrollable.mousewheel-1.0.1.js", __FILE__ ), array( 'jquery' ));
|
544 |
|
@@ -597,7 +597,7 @@ class EdCal {
|
|
597 |
<?php
|
598 |
$size = sizeof($myposts);
|
599 |
|
600 |
-
for($i = 0; $i < $size; $i++) {
|
601 |
$post = $myposts[$i];
|
602 |
$this->edcal_postJSON($post, $i < $size - 1);
|
603 |
}
|
@@ -652,19 +652,19 @@ class EdCal {
|
|
652 |
* This is for an AJAX call that returns a post with the specified ID
|
653 |
*/
|
654 |
function edcal_getpost() {
|
655 |
-
|
656 |
-
|
657 |
$this->edcal_addNoCacheHeaders();
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
die();
|
662 |
}
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
|
669 |
$args = array(
|
670 |
'post__in' => array($post_id)
|
@@ -678,23 +678,23 @@ class EdCal {
|
|
678 |
if ($post_type) {
|
679 |
$args['post_type'] = $post_type;
|
680 |
}
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
}
|
699 |
|
700 |
/*
|
@@ -776,12 +776,12 @@ class EdCal {
|
|
776 |
* and this extra data will become useful. Right now we
|
777 |
* are using this data for the title on the quick edit form.
|
778 |
*/
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
|
786 |
$post_date_gmt = date('dmY',strtotime($post->post_date_gmt));
|
787 |
if ($post_date_gmt == '01011970') {
|
@@ -807,26 +807,27 @@ class EdCal {
|
|
807 |
"sticky" : "<?php echo is_sticky($post->ID) ?>",
|
808 |
"url" : "<?php $this->edcal_json_encode(the_permalink()) ?>",
|
809 |
"status" : "<?php echo get_post_status() ?>",
|
|
|
810 |
"title" : <?php echo $this->edcal_json_encode(get_the_title()) ?>,
|
811 |
"author" : <?php echo $this->edcal_json_encode(get_the_author()) ?>,
|
812 |
"type" : "<?php echo get_post_type( $post ) ?>",
|
813 |
"typeTitle" : "<?php echo $postTypeTitle ?>",
|
814 |
|
815 |
<?php if ( current_user_can('edit_post', $post->ID) ) {?>
|
816 |
-
"editlink" : "<?php echo get_edit_post_link($
|
817 |
<?php } ?>
|
818 |
|
819 |
<?php if ( current_user_can('delete_post', $post->ID) ) {?>
|
820 |
"dellink" : "javascript:edcal.deletePost(<?php echo $post->ID ?>)",
|
821 |
<?php } ?>
|
822 |
|
823 |
-
"permalink" : "<?php echo get_permalink($
|
824 |
"id" : "<?php the_ID(); ?>"
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
}
|
831 |
<?php
|
832 |
if ($addComma) {
|
@@ -841,46 +842,46 @@ class EdCal {
|
|
841 |
* It is not called unless the user has permission to delete the post.
|
842 |
*/
|
843 |
function edcal_deletepost() {
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
|
848 |
header("Content-Type: application/json");
|
849 |
$this->edcal_addNoCacheHeaders();
|
850 |
|
851 |
$edcal_postid = isset($_GET['postid'])?$_GET['postid']:null;
|
852 |
$post = get_post($edcal_postid, ARRAY_A);
|
853 |
-
|
854 |
-
|
855 |
$date_gmt = date('dmY',strtotime($post['post_date_gmt']));
|
856 |
if ($date_gmt == '01011970') {
|
857 |
$date_gmt = '00000000';
|
858 |
}
|
859 |
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
//
|
871 |
?>
|
872 |
{
|
873 |
"post" :
|
874 |
-
|
875 |
"date" : "<?php echo $date ?>",
|
876 |
"title" : "<?php echo $title ?>",
|
877 |
"id" : "<?php echo $edcal_postid ?>",
|
878 |
"date_gmt" : "<?php echo $date_gmt; ?>"
|
879 |
-
|
880 |
}
|
881 |
<?php
|
882 |
|
883 |
-
|
884 |
}
|
885 |
|
886 |
/*
|
@@ -984,10 +985,17 @@ class EdCal {
|
|
984 |
* or update an existing post.
|
985 |
*/
|
986 |
function edcal_savepost() {
|
987 |
-
|
988 |
-
|
989 |
die();
|
990 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
991 |
|
992 |
header("Content-Type: application/json");
|
993 |
$this->edcal_addNoCacheHeaders();
|
@@ -996,14 +1004,22 @@ class EdCal {
|
|
996 |
$edcal_date_gmt = isset($_POST["date_gmt"])?$_POST["date_gmt"]:get_gmt_from_date($edcal_date);
|
997 |
|
998 |
$my_post = array();
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
} else {
|
1004 |
-
|
1005 |
-
|
1006 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1007 |
$my_post['post_title'] = isset($_POST["title"])?$_POST["title"]:null;
|
1008 |
$my_post['post_content'] = isset($_POST["content"])?$_POST["content"]:null;
|
1009 |
|
@@ -1011,6 +1027,7 @@ class EdCal {
|
|
1011 |
$my_post['post_date_gmt'] = $edcal_date_gmt;
|
1012 |
$my_post['post_modified'] = $edcal_date;
|
1013 |
$my_post['post_modified_gmt'] = $edcal_date_gmt;
|
|
|
1014 |
|
1015 |
/*
|
1016 |
* When we create a new post we need to specify the post type
|
@@ -1020,22 +1037,21 @@ class EdCal {
|
|
1020 |
if ($post_type) {
|
1021 |
$my_post['post_type'] = $post_type;
|
1022 |
}
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
$
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
if($my_post['ID']) {
|
1032 |
-
$my_post_id = wp_update_post( $my_post );
|
1033 |
} else {
|
1034 |
-
|
|
|
1035 |
}
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
* We finish by returning the latest data for the post in the JSON
|
1040 |
*/
|
1041 |
$args = array(
|
@@ -1045,22 +1061,25 @@ class EdCal {
|
|
1045 |
if ($post_type) {
|
1046 |
$args['post_type'] = $post_type;
|
1047 |
}
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
|
|
|
|
|
|
1064 |
}
|
1065 |
|
1066 |
/*
|
@@ -1154,14 +1173,14 @@ class EdCal {
|
|
1154 |
*/
|
1155 |
$error = EDCAL_PERMISSION_ERROR;
|
1156 |
} else if ( date('Y-m-d', strtotime($post->post_date)) != date('Y-m-d', strtotime($edcal_oldDate)) ) {
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
$error = EDCAL_CONCURRENCY_ERROR;
|
1166 |
}
|
1167 |
|
@@ -1187,9 +1206,9 @@ class EdCal {
|
|
1187 |
$updated_post = array();
|
1188 |
$updated_post['ID'] = $edcal_postid;
|
1189 |
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
|
1194 |
/*
|
1195 |
* When a user creates a draft and never sets a date or publishes it
|
@@ -1200,18 +1219,18 @@ class EdCal {
|
|
1200 |
*/
|
1201 |
$needsEditDate = preg_match( '/^0000/', $post->post_date_gmt );
|
1202 |
|
1203 |
-
|
1204 |
-
|
1205 |
$updated_post['edit_date'] = $edcal_newDate . substr($post->post_date, strlen($edcal_newDate));
|
1206 |
}
|
1207 |
|
1208 |
if ( $move_to_drawer ) {
|
1209 |
$updated_post['post_date_gmt'] = "0000-00-00 00:00:00";
|
1210 |
$updated_post['edit_date'] = $post->post_date;
|
1211 |
-
|
1212 |
$updated_post['post_date_gmt'] = get_gmt_from_date($post->post_date);
|
1213 |
$updated_post['post_modified_gmt'] = get_gmt_from_date($post->post_date);
|
1214 |
-
|
1215 |
|
1216 |
/*
|
1217 |
* We need to make sure to use the GMT formatting for the date.
|
@@ -1345,3 +1364,4 @@ class EdCal {
|
|
1345 |
|
1346 |
}
|
1347 |
|
|
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.5
|
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
|
28 |
|
29 |
global $edcal;
|
30 |
if( empty($edcal) )
|
31 |
+
$edcal = new EdCal();
|
32 |
|
33 |
|
34 |
|
48 |
define( 'EDCAL_NONCE_ERROR', 6 );
|
49 |
|
50 |
class EdCal {
|
51 |
+
|
52 |
+
protected $supports_custom_types;
|
53 |
protected $default_time;
|
54 |
|
55 |
function __construct() {
|
|
|
56 |
add_action('wp_ajax_edcal_saveoptions', array(&$this, 'edcal_saveoptions'));
|
57 |
add_action('wp_ajax_edcal_changedate', array(&$this, 'edcal_changedate'));
|
58 |
add_action('wp_ajax_edcal_savepost', array(&$this, 'edcal_savepost'));
|
91 |
/*
|
92 |
* This function adds our calendar page to the admin UI
|
93 |
*/
|
94 |
+
function edcal_list_add_management_page() {
|
95 |
+
if (function_exists('add_management_page') ) {
|
96 |
+
$page = add_posts_page( __('Calendar', 'editorial-calendar'), __('Calendar', 'editorial-calendar'), 'edit_posts', 'cal', array(&$this, 'edcal_list_admin'));
|
97 |
+
add_action( "admin_print_scripts-$page", array(&$this, 'edcal_scripts'));
|
98 |
|
99 |
+
if( $this->supports_custom_types ) {
|
100 |
|
101 |
+
/*
|
102 |
+
* We add one calendar for Posts and then we add a separate calendar for each
|
103 |
+
* custom post type. This calendar will have an URL like this:
|
104 |
+
* /wp-admin/edit.php?post_type=podcasts&page=cal_podcasts
|
105 |
+
*
|
106 |
+
* We can then use the post_type parameter to show the posts of just that custom
|
107 |
+
* type and update the labels for each post type.
|
108 |
+
*/
|
109 |
+
$args = array(
|
110 |
+
'public' => true,
|
111 |
+
'_builtin' => false
|
112 |
+
);
|
113 |
+
$output = 'names'; // names or objects
|
114 |
+
$operator = 'and'; // 'and' or 'or'
|
115 |
+
$post_types = get_post_types($args,$output,$operator);
|
116 |
|
117 |
+
foreach ($post_types as $post_type) {
|
118 |
$show_this_post_type = apply_filters("edcal_show_calendar_$post_type", true);
|
119 |
if ($show_this_post_type) {
|
120 |
$page = add_submenu_page('edit.php?post_type=' . $post_type, __('Calendar', 'editorial-calendar'), __('Calendar', 'editorial-calendar'), 'edit_posts', 'cal_' . $post_type, array(&$this, 'edcal_list_admin'));
|
122 |
}
|
123 |
}
|
124 |
}
|
125 |
+
}
|
126 |
+
}
|
127 |
|
128 |
/*
|
129 |
* This is a utility function to open a file add it to our
|
173 |
echo '<style type="text/css">';
|
174 |
$this->edcal_echoFile(dirname( __FILE__ ) . "/lib/timePicker.css");
|
175 |
echo '</style>';
|
176 |
+
|
177 |
echo '<!-- This is the styles from humanmsg.css -->';
|
178 |
echo '<style type="text/css">';
|
179 |
$this->edcal_echoFile(dirname( __FILE__ ) . "/lib/humanmsg.css");
|
201 |
<!-- This is just a little script so we can pass the AJAX URL and some localized strings -->
|
202 |
<script type="text/javascript">
|
203 |
jQuery(document).ready(function(){
|
204 |
+
edcal.plugin_url = '<?php echo(plugins_url("/", __FILE__ )); ?>';
|
205 |
edcal.wp_nonce = '<?php echo wp_create_nonce("edit-calendar"); ?>';
|
206 |
<?php
|
207 |
if (get_option("edcal_weeks_pref") != "") {
|
353 |
}
|
354 |
|
355 |
#tipclose {
|
356 |
+
background-image: url('<?php echo(plugins_url("images/tip_close.png", __FILE__ )); ?>');
|
357 |
}
|
358 |
|
359 |
.day.today .daylabel {
|
390 |
<a href="#" title="<?php echo(__('Skip ahead', 'editorial-calendar')) ?>" class="next page-numbers" id="nextmonth">›</a>
|
391 |
<a class="save button" title="<?php echo(__('Scroll the calendar and make the last post visible', 'editorial-calendar')) ?>" id="moveToLast">»</a>
|
392 |
|
393 |
+
<a class="save button" title="<?php echo(__('Scroll the calendar and make the today visible', 'editorial-calendar')) ?>" id="moveToToday"><?php echo(__('Show Today', 'editorial-calendar')) ?></a>
|
394 |
|
395 |
|
396 |
</h3>
|
397 |
</div>
|
398 |
|
399 |
<div id="topright" class="tablenav-pages alignright">
|
400 |
+
<a class="save button" title="<?php echo(__('Show unscheduled posts', 'editorial-calendar')) ?>" id="showdraftsdrawer"><?php echo(__('Show Unscheduled Drafts', 'editorial-calendar')) ?></a>
|
401 |
</div>
|
402 |
</div>
|
403 |
|
437 |
<a href="#" id="tipclose" onclick="edcal.hideForm(); return false;" title="close"> </a>
|
438 |
</div>
|
439 |
|
440 |
+
<div class="edcal_quickedit inline-edit-row">
|
441 |
|
442 |
<fieldset>
|
443 |
|
444 |
<label>
|
445 |
+
<span class="title"><?php _e('Title', 'editorial-calendar') ?></span>
|
446 |
+
<span class="input-text-wrap"><input type="text" class="ptitle" id="edcal-title-new-field" name="title" /></span>
|
447 |
+
</label>
|
448 |
|
449 |
<label>
|
450 |
<span class="title"><?php _e('Content', 'editorial-calendar') ?></span>
|
478 |
*/ ?>
|
479 |
</fieldset>
|
480 |
|
481 |
+
<p class="submit inline-edit-save" id="edit-slug-buttons">
|
482 |
<a class="button-primary disabled" id="newPostScheduleButton" href="#"><?php _e('Schedule', 'editorial-calendar') ?></a>
|
483 |
<a href="#" onclick="edcal.hideForm(); return false;" class="button-secondary cancel"><?php _e('Cancel', 'editorial-calendar') ?></a>
|
484 |
</p>
|
519 |
wp_enqueue_script('jquery-ui-draggable');
|
520 |
wp_enqueue_script('jquery-ui-droppable');
|
521 |
|
522 |
+
//wp_enqueue_script("date-extras", plugins_url("lib/date.extras.js", __FILE__ ), array( 'jquery' ));
|
523 |
|
524 |
wp_enqueue_script("edcal-date", plugins_url("lib/languages/date-".__('en-US', 'editorial-calendar').".js", __FILE__ ));
|
525 |
wp_enqueue_script("edcal-lib", plugins_url("lib/edcallib.min.js", __FILE__ ), array( 'jquery' ));
|
538 |
wp_enqueue_script("bgiframe", plugins_url("lib/jquery.bgiframe.js", __FILE__ ), array( 'jquery' ));
|
539 |
wp_enqueue_script("humanMsg", plugins_url("lib/humanmsg.js", __FILE__ ), array( 'jquery' ));
|
540 |
wp_enqueue_script("jquery-timepicker", plugins_url("lib/jquery.timepicker.js", __FILE__ ), array( 'jquery' ));
|
541 |
+
|
542 |
wp_enqueue_script("scrollable", plugins_url("lib/tools.scrollable-1.1.2.js", __FILE__ ), array( 'jquery' ));
|
543 |
wp_enqueue_script("mouse-wheel", plugins_url("lib/lib/tools.scrollable.mousewheel-1.0.1.js", __FILE__ ), array( 'jquery' ));
|
544 |
|
597 |
<?php
|
598 |
$size = sizeof($myposts);
|
599 |
|
600 |
+
for($i = 0; $i < $size; $i++) {
|
601 |
$post = $myposts[$i];
|
602 |
$this->edcal_postJSON($post, $i < $size - 1);
|
603 |
}
|
652 |
* This is for an AJAX call that returns a post with the specified ID
|
653 |
*/
|
654 |
function edcal_getpost() {
|
655 |
+
|
656 |
+
header("Content-Type: application/json");
|
657 |
$this->edcal_addNoCacheHeaders();
|
658 |
+
|
659 |
+
// If nonce fails, return
|
660 |
+
if (!$this->edcal_checknonce()) {
|
661 |
die();
|
662 |
}
|
663 |
+
|
664 |
+
$post_id = isset($_GET['postid'])?intval($_GET['postid']):-1;
|
665 |
+
|
666 |
+
// If a proper post_id wasn't passed, return
|
667 |
+
if(!$post_id) die();
|
668 |
|
669 |
$args = array(
|
670 |
'post__in' => array($post_id)
|
678 |
if ($post_type) {
|
679 |
$args['post_type'] = $post_type;
|
680 |
}
|
681 |
+
|
682 |
+
$post = query_posts($args);
|
683 |
+
|
684 |
+
// get_post and setup_postdata don't get along, so we're doing a mini-loop
|
685 |
+
if(have_posts()) :
|
686 |
+
while(have_posts()) : the_post();
|
687 |
+
?>
|
688 |
+
{
|
689 |
+
"post" :
|
690 |
+
<?php
|
691 |
+
$this->edcal_postJSON($post[0], false, true);
|
692 |
+
?>
|
693 |
+
}
|
694 |
+
<?php
|
695 |
+
endwhile;
|
696 |
+
endif;
|
697 |
+
die();
|
698 |
}
|
699 |
|
700 |
/*
|
776 |
* and this extra data will become useful. Right now we
|
777 |
* are using this data for the title on the quick edit form.
|
778 |
*/
|
779 |
+
if( $this->supports_custom_types ) {
|
780 |
+
$postTypeObj = get_post_type_object(get_post_type( $post ));
|
781 |
+
$postTypeTitle = $postTypeObj->labels->singular_name;
|
782 |
+
} else {
|
783 |
+
$postTypeTitle = 'post';
|
784 |
+
}
|
785 |
|
786 |
$post_date_gmt = date('dmY',strtotime($post->post_date_gmt));
|
787 |
if ($post_date_gmt == '01011970') {
|
807 |
"sticky" : "<?php echo is_sticky($post->ID) ?>",
|
808 |
"url" : "<?php $this->edcal_json_encode(the_permalink()) ?>",
|
809 |
"status" : "<?php echo get_post_status() ?>",
|
810 |
+
"orig_status" : "<?php echo get_post_status() ?>",
|
811 |
"title" : <?php echo $this->edcal_json_encode(get_the_title()) ?>,
|
812 |
"author" : <?php echo $this->edcal_json_encode(get_the_author()) ?>,
|
813 |
"type" : "<?php echo get_post_type( $post ) ?>",
|
814 |
"typeTitle" : "<?php echo $postTypeTitle ?>",
|
815 |
|
816 |
<?php if ( current_user_can('edit_post', $post->ID) ) {?>
|
817 |
+
"editlink" : "<?php echo get_edit_post_link($post->ID) ?>",
|
818 |
<?php } ?>
|
819 |
|
820 |
<?php if ( current_user_can('delete_post', $post->ID) ) {?>
|
821 |
"dellink" : "javascript:edcal.deletePost(<?php echo $post->ID ?>)",
|
822 |
<?php } ?>
|
823 |
|
824 |
+
"permalink" : "<?php echo get_permalink($post->ID) ?>",
|
825 |
"id" : "<?php the_ID(); ?>"
|
826 |
+
|
827 |
+
<?php if($fullPost) : ?>
|
828 |
+
, "content" : <?php echo $this->edcal_json_encode($post->post_content) ?>
|
829 |
+
|
830 |
+
<?php endif; ?>
|
831 |
}
|
832 |
<?php
|
833 |
if ($addComma) {
|
842 |
* It is not called unless the user has permission to delete the post.
|
843 |
*/
|
844 |
function edcal_deletepost() {
|
845 |
+
if (!$this->edcal_checknonce()) {
|
846 |
+
die();
|
847 |
+
}
|
848 |
|
849 |
header("Content-Type: application/json");
|
850 |
$this->edcal_addNoCacheHeaders();
|
851 |
|
852 |
$edcal_postid = isset($_GET['postid'])?$_GET['postid']:null;
|
853 |
$post = get_post($edcal_postid, ARRAY_A);
|
854 |
+
$title = $post['post_title'];
|
855 |
+
$date = date('dmY', strtotime($post['post_date'])); // [TODO] : is there a better way to generate the date string ... ??
|
856 |
$date_gmt = date('dmY',strtotime($post['post_date_gmt']));
|
857 |
if ($date_gmt == '01011970') {
|
858 |
$date_gmt = '00000000';
|
859 |
}
|
860 |
|
861 |
+
$force = !EMPTY_TRASH_DAYS; // wordpress 2.9 thing. deleted post hangs around (ie in a recycle bin) after deleted for this # of days
|
862 |
+
if ( isset($post->post_type) && ($post->post_type == 'attachment' )) {
|
863 |
+
$force = ( $force || !MEDIA_TRASH );
|
864 |
+
if ( ! wp_delete_attachment($edcal_postid, $force) )
|
865 |
+
wp_die( __('Error in deleting...') );
|
866 |
+
} else {
|
867 |
+
if ( !wp_delete_post($edcal_postid, $force) )
|
868 |
+
wp_die( __('Error in deleting...') );
|
869 |
+
}
|
870 |
+
|
871 |
+
// return the following info so that jQuery can then remove post from edcal display :
|
872 |
?>
|
873 |
{
|
874 |
"post" :
|
875 |
+
{
|
876 |
"date" : "<?php echo $date ?>",
|
877 |
"title" : "<?php echo $title ?>",
|
878 |
"id" : "<?php echo $edcal_postid ?>",
|
879 |
"date_gmt" : "<?php echo $date_gmt; ?>"
|
880 |
+
}
|
881 |
}
|
882 |
<?php
|
883 |
|
884 |
+
die();
|
885 |
}
|
886 |
|
887 |
/*
|
985 |
* or update an existing post.
|
986 |
*/
|
987 |
function edcal_savepost() {
|
988 |
+
|
989 |
+
if (!$this->edcal_checknonce()) {
|
990 |
die();
|
991 |
}
|
992 |
+
|
993 |
+
// Most blogs have warnings turned off by default, but if they're
|
994 |
+
// turned on the warnings can cause errors in the JSON data when
|
995 |
+
// we change the post status so we set the warning level to hide
|
996 |
+
// warnings and then reset it at the end of this function.
|
997 |
+
$my_error_level = error_reporting();
|
998 |
+
error_reporting(E_ERROR);
|
999 |
|
1000 |
header("Content-Type: application/json");
|
1001 |
$this->edcal_addNoCacheHeaders();
|
1004 |
$edcal_date_gmt = isset($_POST["date_gmt"])?$_POST["date_gmt"]:get_gmt_from_date($edcal_date);
|
1005 |
|
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 |
+
$my_post['ID'] = 0; // and the post ID to 0
|
1014 |
|
1015 |
+
// Set the status to draft unless the user otherwise specifies
|
1016 |
+
if ($_POST['status']) {
|
1017 |
+
$my_post['post_status'] = $_POST['status'];
|
1018 |
+
} else {
|
1019 |
+
$my_post['post_status'] = 'draft';
|
1020 |
+
}
|
1021 |
+
}
|
1022 |
+
|
1023 |
$my_post['post_title'] = isset($_POST["title"])?$_POST["title"]:null;
|
1024 |
$my_post['post_content'] = isset($_POST["content"])?$_POST["content"]:null;
|
1025 |
|
1027 |
$my_post['post_date_gmt'] = $edcal_date_gmt;
|
1028 |
$my_post['post_modified'] = $edcal_date;
|
1029 |
$my_post['post_modified_gmt'] = $edcal_date_gmt;
|
1030 |
+
$my_post['post_status'] = $_POST['status'];
|
1031 |
|
1032 |
/*
|
1033 |
* When we create a new post we need to specify the post type
|
1037 |
if ($post_type) {
|
1038 |
$my_post['post_type'] = $post_type;
|
1039 |
}
|
1040 |
+
|
1041 |
+
// If we are updating a post
|
1042 |
+
if($_POST['id']) {
|
1043 |
+
if ($_POST['status'] != $_POST['orig_status']) {
|
1044 |
+
wp_transition_post_status($_POST['status'], $_POST['orig_status'], $my_post);
|
1045 |
+
$my_post['post_status'] = $_POST['status'];
|
1046 |
+
}
|
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
|
1056 |
*/
|
1057 |
$args = array(
|
1061 |
if ($post_type) {
|
1062 |
$args['post_type'] = $post_type;
|
1063 |
}
|
1064 |
+
$post = query_posts($args);
|
1065 |
+
|
1066 |
+
// get_post and setup_postdata don't get along, so we're doing a mini-loop
|
1067 |
+
if(have_posts()) :
|
1068 |
+
while(have_posts()) : the_post();
|
1069 |
+
?>
|
1070 |
+
{
|
1071 |
+
"post" :
|
1072 |
+
<?php
|
1073 |
+
$this->edcal_postJSON($post[0], false);
|
1074 |
+
?>
|
1075 |
+
}
|
1076 |
+
<?php
|
1077 |
+
endwhile;
|
1078 |
+
endif;
|
1079 |
+
|
1080 |
+
error_reporting($my_error_level);
|
1081 |
+
|
1082 |
+
die();
|
1083 |
}
|
1084 |
|
1085 |
/*
|
1173 |
*/
|
1174 |
$error = EDCAL_PERMISSION_ERROR;
|
1175 |
} else if ( date('Y-m-d', strtotime($post->post_date)) != date('Y-m-d', strtotime($edcal_oldDate)) ) {
|
1176 |
+
/*
|
1177 |
+
* We are doing optimistic concurrency checking on the dates. If
|
1178 |
+
* the user tries to move a post we want to make sure nobody else
|
1179 |
+
* has moved that post since the page was last updated. If the
|
1180 |
+
* old date in the database doesn't match the old date from the
|
1181 |
+
* browser then we return an error to the browser along with the
|
1182 |
+
* updated post data.
|
1183 |
+
*/
|
1184 |
$error = EDCAL_CONCURRENCY_ERROR;
|
1185 |
}
|
1186 |
|
1206 |
$updated_post = array();
|
1207 |
$updated_post['ID'] = $edcal_postid;
|
1208 |
|
1209 |
+
if ( !$move_to_drawer ) {
|
1210 |
+
$updated_post['post_date'] = $edcal_newDate . substr($post->post_date, strlen($edcal_newDate));
|
1211 |
+
}
|
1212 |
|
1213 |
/*
|
1214 |
* When a user creates a draft and never sets a date or publishes it
|
1219 |
*/
|
1220 |
$needsEditDate = preg_match( '/^0000/', $post->post_date_gmt );
|
1221 |
|
1222 |
+
if ( $needsEditDate ) {
|
1223 |
+
// echo "\r\nneeds edit date\r\n";
|
1224 |
$updated_post['edit_date'] = $edcal_newDate . substr($post->post_date, strlen($edcal_newDate));
|
1225 |
}
|
1226 |
|
1227 |
if ( $move_to_drawer ) {
|
1228 |
$updated_post['post_date_gmt'] = "0000-00-00 00:00:00";
|
1229 |
$updated_post['edit_date'] = $post->post_date;
|
1230 |
+
} else if ( $move_from_drawer ) {
|
1231 |
$updated_post['post_date_gmt'] = get_gmt_from_date($post->post_date);
|
1232 |
$updated_post['post_modified_gmt'] = get_gmt_from_date($post->post_date);
|
1233 |
+
}
|
1234 |
|
1235 |
/*
|
1236 |
* We need to make sure to use the GMT formatting for the date.
|
1364 |
|
1365 |
}
|
1366 |
|
1367 |
+
|
edcal_test.js
CHANGED
@@ -40,7 +40,7 @@ var edcal_test = {
|
|
40 |
css.attr({
|
41 |
rel: 'stylesheet',
|
42 |
type: 'text/css',
|
43 |
-
href: '
|
44 |
});
|
45 |
|
46 |
jQuery('#wpbody-content .wrap').append('<div id="edcal-qunit"></div>');
|
@@ -60,14 +60,14 @@ var edcal_test = {
|
|
60 |
var api = jQuery('#edcal_scrollable').scrollable();
|
61 |
var items = api.getVisibleItems();
|
62 |
|
63 |
-
return edcal.getDayFromDayId(items.eq(0).children('.
|
64 |
},
|
65 |
|
66 |
getLastDate: function() {
|
67 |
var api = jQuery('#edcal_scrollable').scrollable();
|
68 |
var items = api.getVisibleItems();
|
69 |
|
70 |
-
return edcal.getDayFromDayId(items.eq(edcal.weeksPref - 1).children('.
|
71 |
},
|
72 |
|
73 |
moveTests: function() {
|
40 |
css.attr({
|
41 |
rel: 'stylesheet',
|
42 |
type: 'text/css',
|
43 |
+
href: edcal.plugin_url + '/lib/qunit.css'
|
44 |
});
|
45 |
|
46 |
jQuery('#wpbody-content .wrap').append('<div id="edcal-qunit"></div>');
|
60 |
var api = jQuery('#edcal_scrollable').scrollable();
|
61 |
var items = api.getVisibleItems();
|
62 |
|
63 |
+
return edcal.getDayFromDayId(items.eq(0).children('.edcal_row').children('.day:first').attr('id'));
|
64 |
},
|
65 |
|
66 |
getLastDate: function() {
|
67 |
var api = jQuery('#edcal_scrollable').scrollable();
|
68 |
var items = api.getVisibleItems();
|
69 |
|
70 |
+
return edcal.getDayFromDayId(items.eq(edcal.weeksPref - 1).children('.edcal_row').children('.day:last').attr('id'));
|
71 |
},
|
72 |
|
73 |
moveTests: function() {
|
languages/editorial-calendar-ru_RU.mo
ADDED
Binary file
|
languages/editorial-calendar-ru_RU.po
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Translation of WordPress Editorial Calendar in Russian
|
2 |
+
# This file is distributed under the same license as the WordPress Editorial Calendar package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"PO-Revision-Date: 2012-08-16 14:19-0500\n"
|
6 |
+
"MIME-Version: 1.0\n"
|
7 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
8 |
+
"Content-Transfer-Encoding: 8bit\n"
|
9 |
+
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
10 |
+
"X-Generator: GlotPress/0.1\n"
|
11 |
+
"Project-Id-Version: WordPress Editorial Calendar\n"
|
12 |
+
"POT-Creation-Date: \n"
|
13 |
+
"Last-Translator: Zack Grossbart <zack@grossbart.com>\n"
|
14 |
+
"Language-Team: \n"
|
15 |
+
|
16 |
+
msgid "%1$s Calendar"
|
17 |
+
msgstr "%1$s Календарь"
|
18 |
+
|
19 |
+
msgid "Calendar"
|
20 |
+
msgstr "Календарь"
|
21 |
+
|
22 |
+
msgid "en-US"
|
23 |
+
msgstr "ru-RU"
|
24 |
+
|
25 |
+
msgid "%1$s by %2$s"
|
26 |
+
msgstr "%1$s по %2$s"
|
27 |
+
|
28 |
+
msgid "New Post"
|
29 |
+
msgstr "новый публикация"
|
30 |
+
|
31 |
+
msgid " [DRAFT]"
|
32 |
+
msgstr "[черновой вариант]"
|
33 |
+
|
34 |
+
msgid " [PENDING]"
|
35 |
+
msgstr "в ожидании"
|
36 |
+
|
37 |
+
msgid " [STICKY]"
|
38 |
+
msgstr "[Важно]"
|
39 |
+
|
40 |
+
msgid " [DRAFT, STICKY]"
|
41 |
+
msgstr "[черновой вариант, Важно]"
|
42 |
+
|
43 |
+
msgid " [PENDING, STICKY]"
|
44 |
+
msgstr "[в ожидании, Важно]"
|
45 |
+
|
46 |
+
msgid "Edit"
|
47 |
+
msgstr "отредактировать"
|
48 |
+
|
49 |
+
msgid "Quick Edit"
|
50 |
+
msgstr "быстрое редактирование"
|
51 |
+
|
52 |
+
msgid "Delete"
|
53 |
+
msgstr "удалить"
|
54 |
+
|
55 |
+
msgid "View"
|
56 |
+
msgstr "смотреть"
|
57 |
+
|
58 |
+
msgid "Status:"
|
59 |
+
msgstr "статус"
|
60 |
+
|
61 |
+
msgid "Cancel"
|
62 |
+
msgstr "отменить"
|
63 |
+
|
64 |
+
msgid "Title"
|
65 |
+
msgstr "название"
|
66 |
+
|
67 |
+
msgid "Content"
|
68 |
+
msgstr "содержание"
|
69 |
+
|
70 |
+
msgid "Add a new post on %s"
|
71 |
+
msgstr "Добавить новую публикацию на %s"
|
72 |
+
|
73 |
+
msgid "New %s - "
|
74 |
+
msgstr "новая %s"
|
75 |
+
|
76 |
+
msgid "Update"
|
77 |
+
msgstr "обновить"
|
78 |
+
|
79 |
+
msgid "Schedule"
|
80 |
+
msgstr "планировать"
|
81 |
+
|
82 |
+
msgid "Submit for Review"
|
83 |
+
msgstr "Отправить на проверку"
|
84 |
+
|
85 |
+
msgid "Save"
|
86 |
+
msgstr "сохранить"
|
87 |
+
|
88 |
+
msgid "Edit %1$s - %2$s"
|
89 |
+
msgstr "отредактировать %1$s - %2$s"
|
90 |
+
|
91 |
+
msgid "Scheduled"
|
92 |
+
msgstr "Запланированно"
|
93 |
+
|
94 |
+
msgid "You are about to delete the post \""
|
95 |
+
msgstr "Вы собираетесь удалить публикацию \""
|
96 |
+
|
97 |
+
msgid "\". Press Cancel to stop, OK to delete."
|
98 |
+
msgstr "\". Нажмите кнопку Отмена, чтобы остановить, ОК, чтобы удалить."
|
99 |
+
|
100 |
+
msgid "Looks like someone else already moved this post."
|
101 |
+
msgstr "Похоже, кто-то уже переместил этот публикацию."
|
102 |
+
|
103 |
+
msgid "You do not have permission to edit posts."
|
104 |
+
msgstr "У вас нет разрешения редактировать публикацию."
|
105 |
+
|
106 |
+
msgid "Invalid checksum for post. This is commonly a cross-site scripting error."
|
107 |
+
msgstr "Неверная чексам для публикаций. Обычно это межсайтовый скриптинг ошибки."
|
108 |
+
|
109 |
+
msgid "There was an error contacting your blog."
|
110 |
+
msgstr "произошла ошибка соединения с блогом."
|
111 |
+
|
112 |
+
msgid "Screen Options"
|
113 |
+
msgstr "Настройки экрана"
|
114 |
+
|
115 |
+
msgid "Colors"
|
116 |
+
msgstr "Цвета"
|
117 |
+
|
118 |
+
msgid "Drafts: "
|
119 |
+
msgstr "черновики"
|
120 |
+
|
121 |
+
msgid "Apply"
|
122 |
+
msgstr "применить"
|
123 |
+
|
124 |
+
msgid "Show on screen"
|
125 |
+
msgstr "Показать на экране"
|
126 |
+
|
127 |
+
msgid " weeks at a time"
|
128 |
+
msgstr "недели за один раз"
|
129 |
+
|
130 |
+
msgid "Show in Calendar Cell"
|
131 |
+
msgstr "Показать в ячейке календаря"
|
132 |
+
|
133 |
+
msgid "Author"
|
134 |
+
msgstr "автор"
|
135 |
+
|
136 |
+
msgid "Status"
|
137 |
+
msgstr "статус"
|
138 |
+
|
139 |
+
msgid "Time of day"
|
140 |
+
msgstr "Время дня"
|
141 |
+
|
142 |
+
msgid "An error occurred while loading the calendar: "
|
143 |
+
msgstr "Произошла ошибка при загрузке календаря:"
|
144 |
+
|
145 |
+
msgid "The calendar can only show between 1 and 5 weeks at a time."
|
146 |
+
msgstr "Календарь может показывать только от 1 до 5 недель за один раз."
|
147 |
+
|
148 |
+
msgid "Select the number of weeks for the calendar to show."
|
149 |
+
msgstr "Выберите количество недель для календаря, чтобы показать."
|
150 |
+
|
151 |
+
msgid "<h2>We're done</h2>We've finished collecting data. Thank you for helping us make the calendar better."
|
152 |
+
msgstr "<h2>Мы закончили</h2> Мы закончили сбор данных. Спасибо за помощь в улучшении календаря."
|
153 |
+
|
154 |
+
msgid "Jump back"
|
155 |
+
msgstr "Перейти обратно"
|
156 |
+
|
157 |
+
msgid "Skip ahead"
|
158 |
+
msgstr "Перейдите"
|
159 |
+
|
160 |
+
msgid "Scroll the calendar and make the today visible"
|
161 |
+
msgstr "перекрутите календарь к сегоднешнему дню "
|
162 |
+
|
163 |
+
msgid "Show Today"
|
164 |
+
msgstr "Покажите сегодня"
|
165 |
+
|
166 |
+
msgid "Edit Post"
|
167 |
+
msgstr "Редактировать публикацию"
|
168 |
+
|
169 |
+
msgid "Time"
|
170 |
+
msgstr "время"
|
171 |
+
|
172 |
+
msgid "Draft"
|
173 |
+
msgstr "черновой вариант"
|
174 |
+
|
175 |
+
msgid "Pending Review"
|
176 |
+
msgstr "ожидает рассмотрения"
|
177 |
+
|
178 |
+
msgid "Posts "
|
179 |
+
msgstr "публикации"
|
180 |
+
|
181 |
+
msgid "Post "
|
182 |
+
msgstr "публикацию"
|
183 |
+
|
184 |
+
msgid "Error in deleting..."
|
185 |
+
msgstr "Ошибка при удалении ..."
|
186 |
+
|
187 |
+
msgid "ltr"
|
188 |
+
msgstr "ltr"
|
189 |
+
|
lib/languages/date-ru-RU.js
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Version: 1.0 Alpha-1
|
3 |
+
* Build Date: 13-Nov-2007
|
4 |
+
* Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
|
5 |
+
* License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
|
6 |
+
* Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
|
7 |
+
*/
|
8 |
+
Date.CultureInfo={name:"ru-RU",englishName:"Russian (Russia)",nativeName:"русский (Россия)",dayNames:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],abbreviatedDayNames:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],shortestDayNames:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],firstLetterDayNames:["В","П","В","С","Ч","П","С"],monthNames:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],abbreviatedMonthNames:["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек"],amDesignator:"",pmDesignator:"",firstDayOfWeek:1,twoDigitYearMax:2029,dateElementOrder:"dmy",formatPatterns:{shortDate:"dd.MM.yyyy",longDate:"d MMMM yyyy 'г.'",shortTime:"H:mm",longTime:"H:mm:ss",fullDateTime:"d MMMM yyyy 'г.' H:mm:ss",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM yyyy 'г.'"},regexPatterns:{jan:/^янв(арь)?/i,feb:/^фев(раль)?/i,mar:/^мар(т)?/i,apr:/^апр(ель)?/i,may:/^май/i,jun:/^июн(ь)?/i,jul:/^июл(ь)?/i,aug:/^авг(уст)?/i,sep:/^сен(тябрь)?/i,oct:/^окт(ябрь)?/i,nov:/^ноя(брь)?/i,dec:/^дек(абрь)?/i,sun:/^воскресенье/i,mon:/^понедельник/i,tue:/^вторник/i,wed:/^среда/i,thu:/^четверг/i,fri:/^пятница/i,sat:/^суббота/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
|
9 |
+
Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
|
10 |
+
return-1;};Date.getDayNumberFromName=function(name){var n=Date.CultureInfo.dayNames,m=Date.CultureInfo.abbreviatedDayNames,o=Date.CultureInfo.shortestDayNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
|
11 |
+
return-1;};Date.isLeapYear=function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0));};Date.getDaysInMonth=function(year,month){return[31,(Date.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];};Date.getTimezoneOffset=function(s,dst){return(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST[s.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[s.toUpperCase()];};Date.getTimezoneAbbreviation=function(offset,dst){var n=(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,p;for(p in n){if(n[p]===offset){return p;}}
|
12 |
+
return null;};Date.prototype.clone=function(){return new Date(this.getTime());};Date.prototype.compareTo=function(date){if(isNaN(this)){throw new Error(this);}
|
13 |
+
if(date instanceof Date&&!isNaN(date)){return(this>date)?1:(this<date)?-1:0;}else{throw new TypeError(date);}};Date.prototype.equals=function(date){return(this.compareTo(date)===0);};Date.prototype.between=function(start,end){var t=this.getTime();return t>=start.getTime()&&t<=end.getTime();};Date.prototype.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};Date.prototype.addSeconds=function(value){return this.addMilliseconds(value*1000);};Date.prototype.addMinutes=function(value){return this.addMilliseconds(value*60000);};Date.prototype.addHours=function(value){return this.addMilliseconds(value*3600000);};Date.prototype.addDays=function(value){return this.addMilliseconds(value*86400000);};Date.prototype.addWeeks=function(value){return this.addMilliseconds(value*604800000);};Date.prototype.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,this.getDaysInMonth()));return this;};Date.prototype.addYears=function(value){return this.addMonths(value*12);};Date.prototype.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
|
14 |
+
var x=config;if(x.millisecond||x.milliseconds){this.addMilliseconds(x.millisecond||x.milliseconds);}
|
15 |
+
if(x.second||x.seconds){this.addSeconds(x.second||x.seconds);}
|
16 |
+
if(x.minute||x.minutes){this.addMinutes(x.minute||x.minutes);}
|
17 |
+
if(x.hour||x.hours){this.addHours(x.hour||x.hours);}
|
18 |
+
if(x.month||x.months){this.addMonths(x.month||x.months);}
|
19 |
+
if(x.year||x.years){this.addYears(x.year||x.years);}
|
20 |
+
if(x.day||x.days){this.addDays(x.day||x.days);}
|
21 |
+
return this;};Date._validate=function(value,min,max,name){if(typeof value!="number"){throw new TypeError(value+" is not a Number.");}else if(value<min||value>max){throw new RangeError(value+" is not a valid value for "+name+".");}
|
22 |
+
return true;};Date.validateMillisecond=function(n){return Date._validate(n,0,999,"milliseconds");};Date.validateSecond=function(n){return Date._validate(n,0,59,"seconds");};Date.validateMinute=function(n){return Date._validate(n,0,59,"minutes");};Date.validateHour=function(n){return Date._validate(n,0,23,"hours");};Date.validateDay=function(n,year,month){return Date._validate(n,1,Date.getDaysInMonth(year,month),"days");};Date.validateMonth=function(n){return Date._validate(n,0,11,"months");};Date.validateYear=function(n){return Date._validate(n,1,9999,"seconds");};Date.prototype.set=function(config){var x=config;if(!x.millisecond&&x.millisecond!==0){x.millisecond=-1;}
|
23 |
+
if(!x.second&&x.second!==0){x.second=-1;}
|
24 |
+
if(!x.minute&&x.minute!==0){x.minute=-1;}
|
25 |
+
if(!x.hour&&x.hour!==0){x.hour=-1;}
|
26 |
+
if(!x.day&&x.day!==0){x.day=-1;}
|
27 |
+
if(!x.month&&x.month!==0){x.month=-1;}
|
28 |
+
if(!x.year&&x.year!==0){x.year=-1;}
|
29 |
+
if(x.millisecond!=-1&&Date.validateMillisecond(x.millisecond)){this.addMilliseconds(x.millisecond-this.getMilliseconds());}
|
30 |
+
if(x.second!=-1&&Date.validateSecond(x.second)){this.addSeconds(x.second-this.getSeconds());}
|
31 |
+
if(x.minute!=-1&&Date.validateMinute(x.minute)){this.addMinutes(x.minute-this.getMinutes());}
|
32 |
+
if(x.hour!=-1&&Date.validateHour(x.hour)){this.addHours(x.hour-this.getHours());}
|
33 |
+
if(x.month!==-1&&Date.validateMonth(x.month)){this.addMonths(x.month-this.getMonth());}
|
34 |
+
if(x.year!=-1&&Date.validateYear(x.year)){this.addYears(x.year-this.getFullYear());}
|
35 |
+
if(x.day!=-1&&Date.validateDay(x.day,this.getFullYear(),this.getMonth())){this.addDays(x.day-this.getDate());}
|
36 |
+
if(x.timezone){this.setTimezone(x.timezone);}
|
37 |
+
if(x.timezoneOffset){this.setTimezoneOffset(x.timezoneOffset);}
|
38 |
+
return this;};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};Date.prototype.isLeapYear=function(){var y=this.getFullYear();return(((y%4===0)&&(y%100!==0))||(y%400===0));};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun());};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth());};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1});};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()});};Date.prototype.moveToDayOfWeek=function(day,orient){var diff=(day-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};Date.prototype.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};Date.prototype.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||Date.CultureInfo.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;}
|
39 |
+
var daynum=((Date.UTC(y,m,d,0,0,0)-Date.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}}
|
40 |
+
return w;};Date.prototype.isDST=function(){console.log('isDST');return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D";};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST());};Date.prototype.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;this.addMinutes(there-here);return this;};Date.prototype.setTimezone=function(s){return this.setTimezoneOffset(Date.getTimezoneOffset(s));};Date.prototype.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};Date.prototype.getDayName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()];};Date.prototype.getMonthName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()];};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(format){var self=this;var p=function p(s){return(s.toString().length==1)?"0"+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return self.getHours()<13?self.getHours():(self.getHours()-12);case"HH":return p(self.getHours());case"H":return self.getHours();case"mm":return p(self.getMinutes());case"m":return self.getMinutes();case"ss":return p(self.getSeconds());case"s":return self.getSeconds();case"yyyy":return self.getFullYear();case"yy":return self.getFullYear().toString().substring(2,4);case"dddd":return self.getDayName();case"ddd":return self.getDayName(true);case"dd":return p(self.getDate());case"d":return self.getDate().toString();case"MMMM":return self.getMonthName();case"MMM":return self.getMonthName(true);case"MM":return p((self.getMonth()+1));case"M":return self.getMonth()+1;case"t":return self.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return self.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();};
|
41 |
+
Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
|
42 |
+
return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i<dx.length;i++){$D[dx[i]]=$D[dx[i].substring(0,3)]=df(i);}
|
43 |
+
var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;}
|
44 |
+
return this.moveToMonth(n,this._orient);};};for(var j=0;j<mx.length;j++){$D[mx[j]]=$D[mx[j].substring(0,3)]=mf(j);}
|
45 |
+
var ef=function(j){return function(){if(j.substring(j.length-1)!="s"){j+="s";}
|
46 |
+
return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$D[de]=$D[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ");};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern);};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern);};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern);};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};
|
47 |
+
(function(){Date.Parsing={Exception:function(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
|
48 |
+
break;}
|
49 |
+
return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
|
50 |
+
rx.push(r[0]);s=r[1];}
|
51 |
+
return[rx,s];};},optional:function(p){return function(s){var r=null;try{r=p.call(this,s);}catch(e){return[null,s];}
|
52 |
+
return[r[0],r[1]];};},not:function(p){return function(s){try{p.call(this,s);}catch(e){return[null,s];}
|
53 |
+
throw new $P.Exception(s);};},ignore:function(p){return p?function(s){var r=null;r=p.call(this,s);return[null,r[1]];}:null;},product:function(){var px=arguments[0],qx=Array.prototype.slice.call(arguments,1),rx=[];for(var i=0;i<px.length;i++){rx.push(_.each(px[i],qx));}
|
54 |
+
return rx;},cache:function(rule){var cache={},r=null;return function(s){try{r=cache[s]=(cache[s]||rule.call(this,s));}catch(e){r=cache[s]=e;}
|
55 |
+
if(r instanceof $P.Exception){throw r;}else{return r;}};},any:function(){var px=arguments;return function(s){var r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
|
56 |
+
try{r=(px[i].call(this,s));}catch(e){r=null;}
|
57 |
+
if(r){return r;}}
|
58 |
+
throw new $P.Exception(s);};},each:function(){var px=arguments;return function(s){var rx=[],r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
|
59 |
+
try{r=(px[i].call(this,s));}catch(e){throw new $P.Exception(s);}
|
60 |
+
rx.push(r[0]);s=r[1];}
|
61 |
+
return[rx,s];};},all:function(){var px=arguments,_=_;return _.each(_.optional(px));},sequence:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;if(px.length==1){return px[0];}
|
62 |
+
return function(s){var r=null,q=null;var rx=[];for(var i=0;i<px.length;i++){try{r=px[i].call(this,s);}catch(e){break;}
|
63 |
+
rx.push(r[0]);try{q=d.call(this,r[1]);}catch(ex){q=null;break;}
|
64 |
+
s=q[1];}
|
65 |
+
if(!r){throw new $P.Exception(s);}
|
66 |
+
if(q){throw new $P.Exception(q[1]);}
|
67 |
+
if(c){try{r=c.call(this,r[1]);}catch(ey){throw new $P.Exception(r[1]);}}
|
68 |
+
return[rx,(r?r[1]:s)];};},between:function(d1,p,d2){d2=d2||d1;var _fn=_.each(_.ignore(d1),p,_.ignore(d2));return function(s){var rx=_fn.call(this,s);return[[rx[0][0],r[0][2]],rx[1]];};},list:function(p,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return(p instanceof Array?_.each(_.product(p.slice(0,-1),_.ignore(d)),p.slice(-1),_.ignore(c)):_.each(_.many(_.each(p,_.ignore(d))),px,_.ignore(c)));},set:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return function(s){var r=null,p=null,q=null,rx=null,best=[[],s],last=false;for(var i=0;i<px.length;i++){q=null;p=null;r=null;last=(px.length==1);try{r=px[i].call(this,s);}catch(e){continue;}
|
69 |
+
rx=[[r[0]],r[1]];if(r[1].length>0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
|
70 |
+
if(!last&&q[1].length===0){last=true;}
|
71 |
+
if(!last){var qx=[];for(var j=0;j<px.length;j++){if(i!=j){qx.push(px[j]);}}
|
72 |
+
p=_.set(qx,d).call(this,q[1]);if(p[0].length>0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
|
73 |
+
if(rx[1].length<best[1].length){best=rx;}
|
74 |
+
if(best[1].length===0){break;}}
|
75 |
+
if(best[0].length===0){return best;}
|
76 |
+
if(c){try{q=c.call(this,best[1]);}catch(ey){throw new $P.Exception(best[1]);}
|
77 |
+
best[1]=q[1];}
|
78 |
+
return best;};},forward:function(gr,fname){return function(s){return gr[fname].call(this,s);};},replace:function(rule,repl){return function(s){var r=rule.call(this,s);return[repl,r[1]];};},process:function(rule,fn){return function(s){var r=rule.call(this,s);return[fn.call(this,r[0]),r[1]];};},min:function(min,rule){return function(s){var rx=rule.call(this,s);if(rx[0].length<min){throw new $P.Exception(s);}
|
79 |
+
return rx;};}};var _generator=function(op){return function(){var args=null,rx=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
|
80 |
+
if(args){for(var i=0,px=args.shift();i<px.length;i++){args.unshift(px[i]);rx.push(op.apply(null,args));args.shift();return rx;}}else{return op.apply(null,arguments);}};};var gx="optional not ignore cache".split(/\s/);for(var i=0;i<gx.length;i++){_[gx[i]]=_generator(_[gx[i]]);}
|
81 |
+
var _vector=function(op){return function(){if(arguments[0]instanceof Array){return op.apply(null,arguments[0]);}else{return op.apply(null,arguments);}};};var vx="each any all".split(/\s/);for(var j=0;j<vx.length;j++){_[vx[j]]=_vector(_[vx[j]]);}}());(function(){var flattenAndCompact=function(ax){var rx=[];for(var i=0;i<ax.length;i++){if(ax[i]instanceof Array){rx=rx.concat(flattenAndCompact(ax[i]));}else{if(ax[i]){rx.push(ax[i]);}}}
|
82 |
+
return rx;};Date.Grammar={};Date.Translator={hour:function(s){return function(){this.hour=Number(s);};},minute:function(s){return function(){this.minute=Number(s);};},second:function(s){return function(){this.second=Number(s);};},meridian:function(s){return function(){this.meridian=s.slice(0,1).toLowerCase();};},timezone:function(s){return function(){var n=s.replace(/[^\d\+\-]/g,"");if(n.length){this.timezoneOffset=Number(n);}else{this.timezone=s.toLowerCase();}};},day:function(x){var s=x[0];return function(){this.day=Number(s.match(/\d+/)[0]);};},month:function(s){return function(){this.month=((s.length==3)?Date.getMonthNumberFromName(s):(Number(s)-1));};},year:function(s){return function(){var n=Number(s);this.year=((s.length>2)?n:(n+(((n+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];var now=new Date();this.year=now.getFullYear();this.month=now.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var i=0;i<x.length;i++){if(x[i]){x[i].call(this);}}
|
83 |
+
this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
|
84 |
+
var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
|
85 |
+
return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
|
86 |
+
for(var i=0;i<x.length;i++){if(typeof x[i]=="function"){x[i].call(this);}}
|
87 |
+
if(this.now){return new Date();}
|
88 |
+
var today=Date.today();var method=null;var expression=!!(this.days!=null||this.orient||this.operator);if(expression){var gap,mod,orient;orient=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";gap=(Date.getDayNumberFromName(this.weekday)-today.getDay());mod=7;this.days=gap?((gap+(orient*mod))%mod):(orient*mod);}
|
89 |
+
if(this.month){this.unit="month";gap=(this.month-today.getMonth());mod=12;this.months=gap?((gap+(orient*mod))%mod):(orient*mod);this.month=null;}
|
90 |
+
if(!this.unit){this.unit="day";}
|
91 |
+
if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1;}
|
92 |
+
if(this.unit=="week"){this.unit="day";this.value=this.value*7;}
|
93 |
+
this[this.unit+"s"]=this.value*orient;}
|
94 |
+
return today.add(this);}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour;}
|
95 |
+
if(this.weekday&&!this.day){this.day=(today.addDays((Date.getDayNumberFromName(this.weekday)-today.getDay()))).getDate();}
|
96 |
+
if(this.month&&!this.day){this.day=1;}
|
97 |
+
return today.set(this);}}};var _=Date.Parsing.Operators,g=Date.Grammar,t=Date.Translator,_fn;g.datePartDelimiter=_.rtoken(/^([\s\-\.\,\/\x27]+)/);g.timePartDelimiter=_.stoken(":");g.whiteSpace=_.rtoken(/^\s*/);g.generalDelimiter=_.rtoken(/^(([\s\,]|at|on)+)/);var _C={};g.ctoken=function(keys){var fn=_C[keys];if(!fn){var c=Date.CultureInfo.regexPatterns;var kx=keys.split(/\s+/),px=[];for(var i=0;i<kx.length;i++){px.push(_.replace(_.rtoken(c[kx[i]]),kx[i]));}
|
98 |
+
fn=_C[keys]=_.any.apply(null,px);}
|
99 |
+
return fn;};g.ctoken2=function(key){return _.rtoken(Date.CultureInfo.regexPatterns[key]);};g.h=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),t.hour));g.hh=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/),t.hour));g.H=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),t.hour));g.HH=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/),t.hour));g.m=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.minute));g.mm=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.minute));g.s=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.second));g.ss=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.second));g.hms=_.cache(_.sequence([g.H,g.mm,g.ss],g.timePartDelimiter));g.t=_.cache(_.process(g.ctoken2("shortMeridian"),t.meridian));g.tt=_.cache(_.process(g.ctoken2("longMeridian"),t.meridian));g.z=_.cache(_.process(_.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),t.timezone));g.zz=_.cache(_.process(_.rtoken(/^(\+|\-)\s*\d\d\d\d/),t.timezone));g.zzz=_.cache(_.process(g.ctoken2("timezone"),t.timezone));g.timeSuffix=_.each(_.ignore(g.whiteSpace),_.set([g.tt,g.zzz]));g.time=_.each(_.optional(_.ignore(_.stoken("T"))),g.hms,g.timeSuffix);g.d=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.dd=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.ddd=g.dddd=_.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),function(s){return function(){this.weekday=s;};}));g.M=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/),t.month));g.MM=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/),t.month));g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),t.month));g.y=_.cache(_.process(_.rtoken(/^(\d\d?)/),t.year));g.yy=_.cache(_.process(_.rtoken(/^(\d\d)/),t.year));g.yyy=_.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/),t.year));g.yyyy=_.cache(_.process(_.rtoken(/^(\d\d\d\d)/),t.year));_fn=function(){return _.each(_.any.apply(null,arguments),_.not(g.ctoken2("timeContext")));};g.day=_fn(g.d,g.dd);g.month=_fn(g.M,g.MMM);g.year=_fn(g.yyyy,g.yy);g.orientation=_.process(g.ctoken("past future"),function(s){return function(){this.orient=s;};});g.operator=_.process(g.ctoken("add subtract"),function(s){return function(){this.operator=s;};});g.rday=_.process(g.ctoken("yesterday tomorrow today now"),t.rday);g.unit=_.process(g.ctoken("minute hour day week month year"),function(s){return function(){this.unit=s;};});g.value=_.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/),function(s){return function(){this.value=s.replace(/\D/g,"");};});g.expression=_.set([g.rday,g.operator,g.value,g.unit,g.orientation,g.ddd,g.MMM]);_fn=function(){return _.set(arguments,g.datePartDelimiter);};g.mdy=_fn(g.ddd,g.month,g.day,g.year);g.ymd=_fn(g.ddd,g.year,g.month,g.day);g.dmy=_fn(g.ddd,g.day,g.month,g.year);g.date=function(s){return((g[Date.CultureInfo.dateElementOrder]||g.mdy).call(this,s));};g.format=_.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(fmt){if(g[fmt]){return g[fmt];}else{throw Date.Parsing.Exception(fmt);}}),_.process(_.rtoken(/^[^dMyhHmstz]+/),function(s){return _.ignore(_.stoken(s));}))),function(rules){return _.process(_.each.apply(null,rules),t.finishExact);});var _F={};var _get=function(f){return _F[f]=(_F[f]||g.format(f)[0]);};g.formats=function(fx){if(fx instanceof Array){var rx=[];for(var i=0;i<fx.length;i++){rx.push(_get(fx[i]));}
|
100 |
+
return _.any.apply(null,rx);}else{return _get(fx);}};g._formats=g.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);g._start=_.process(_.set([g.date,g.time,g.expression],g.generalDelimiter,g.whiteSpace),t.finish);g.start=function(s){try{var r=g._formats.call({},s);if(r[1].length===0){return r;}}catch(e){}
|
101 |
+
return g._start.call({},s);};}());Date._parse=Date.parse;Date.parse=function(s){var r=null;if(!s){return null;}
|
102 |
+
try{r=Date.Grammar.start.call({},s);}catch(e){return null;}
|
103 |
+
return((r[1].length===0)?r[0]:null);};Date.getParseFunction=function(fx){var fn=Date.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
|
104 |
+
return((r[1].length===0)?r[0]:null);};};Date.parseExact=function(s,fx){return Date.getParseFunction(fx)(s);};
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
|
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.4.1
|
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 |
|
@@ -13,7 +13,7 @@ Did you remember to write a post for next Tuesday? What about the Tuesday after
|
|
13 |
|
14 |
<h4>Watch the video</h4>
|
15 |
|
16 |
-
[vimeo http://vimeo.com/
|
17 |
|
18 |
<h4>Try it out</h4>
|
19 |
Try the calendar before you install it. Check out the demo installation at <a href="http://www.zackgrossbart.com/extras/sandbox/wp-admin/edit.php?page=cal">Zack's WordPress Sandbox</a>.
|
@@ -109,7 +109,7 @@ The editorial calendar follows the Week Starts On preference on the WordPress Ge
|
|
109 |
|
110 |
= What languages does the calendar support? =
|
111 |
|
112 |
-
The calendar is available in Brazilian Portuguese, Croatian, Czech, Dutch, English, French, German, Greek, Hebrew, Japanese, Lithuanian, Norwegian, Polish, Spanish, and Swedish.
|
113 |
|
114 |
= Can I add new languages? =
|
115 |
|
@@ -173,6 +173,20 @@ Moving published posts can cause problems with some RSS feeds and is generally n
|
|
173 |
|
174 |
== Changelog ==
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
= 2.4 =
|
177 |
|
178 |
Creating a new unscheduled draft is now working properly from the calendar.
|
1 |
+
=== Editorial Calendar ===
|
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.4.1
|
6 |
+
Stable tag: 2.5
|
7 |
|
8 |
The Editorial Calendar makes it possible to see all your posts and drag and drop them to manage your blog.
|
9 |
|
13 |
|
14 |
<h4>Watch the video</h4>
|
15 |
|
16 |
+
[vimeo http://vimeo.com/47251750]
|
17 |
|
18 |
<h4>Try it out</h4>
|
19 |
Try the calendar before you install it. Check out the demo installation at <a href="http://www.zackgrossbart.com/extras/sandbox/wp-admin/edit.php?page=cal">Zack's WordPress Sandbox</a>.
|
109 |
|
110 |
= What languages does the calendar support? =
|
111 |
|
112 |
+
The calendar is available in Brazilian Portuguese, Croatian, Czech, Dutch, English, French, German, Greek, Hebrew, Japanese, Lithuanian, Norwegian, Polish, Russian, Spanish, and Swedish.
|
113 |
|
114 |
= Can I add new languages? =
|
115 |
|
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.
|
179 |
+
|
180 |
+
The calendar is now more careful about PHP warnings so it still works if the blog is set to show PHP warnings.
|
181 |
+
|
182 |
+
The unit tests are now using the correct CSS reference so they show up properly.
|
183 |
+
|
184 |
+
Moved the setting for the default post time to the edcal.php so it's easier to change without recompiling the JavaScript.
|
185 |
+
|
186 |
+
The calendar now supports Russian thanks to Danny Zawacki and Lyudmila Kostryka. Danny blogs at http://dannyzawacki.com
|
187 |
+
|
188 |
+
We have started to namespace css classes to avoid conflicts with other plugins & themes.
|
189 |
+
|
190 |
= 2.4 =
|
191 |
|
192 |
Creating a new unscheduled draft is now working properly from the calendar.
|