Editorial Calendar - Version 3.0

Version Description

This version makes a few small bug fixes to work well with WordPress 3.8. This includes showing the screen options with some better formatting and deleting posts from the drafts drawer properly.

Download this release

Release Info

Developer zgrossbart
Plugin Icon wp plugin Editorial Calendar
Version 3.0
Comparing to
See all releases

Code changes from version 2.9 to 3.0

Files changed (5) hide show
  1. edcal.css +4 -0
  2. edcal.js +5 -4
  3. edcal.min.js +45 -44
  4. edcal.php +1 -1
  5. readme.txt +6 -2
edcal.css CHANGED
@@ -567,6 +567,10 @@ TinyMCE Rich Editor and Media buttons are not currently used
567
  background-position: right -1px;
568
  }
569
 
 
 
 
 
570
  #contextual-help-wrap {
571
  margin-left: 8px;
572
  padding: 0 0 10px;
567
  background-position: right -1px;
568
  }
569
 
570
+ div.metabox-prefs {
571
+ padding-left: 10px;
572
+ }
573
+
574
  #contextual-help-wrap {
575
  margin-left: 8px;
576
  padding: 0 0 10px;
edcal.js CHANGED
@@ -1048,7 +1048,7 @@ var edcal = {
1048
  edcal.showError(edcal.checksum_error);
1049
  }
1050
  } else {
1051
- edcal.output('Finished deleting the post: "' + res.post.title + '"');
1052
  }
1053
 
1054
  if (callback) {
@@ -1446,15 +1446,16 @@ var edcal = {
1446
  * Removes a post from the HTML and the posts cache.
1447
  */
1448
  removePostItem: function(/*string*/ dayobjId, /*string*/ postId) {
1449
- //edcal.output('removePostItem(' + dayobjId + ', ' + postId + ')');
1450
  if (edcal.findPostForId(dayobjId, postId)) {
1451
  for (var i = 0; i < edcal.posts[dayobjId].length; i++) {
1452
  if (edcal.posts[dayobjId][i] && 'post-' + edcal.posts[dayobjId][i].id === postId) {
1453
- edcal.posts[dayobjId][i] = null;
1454
- jQuery('#' + postId).remove();
1455
  }
1456
  }
1457
  }
 
 
1458
  },
1459
 
1460
  /*
1048
  edcal.showError(edcal.checksum_error);
1049
  }
1050
  } else {
1051
+ edcal.output('Finished deleting the post: "' + res.post.title + '" with id:' + res.post.id);
1052
  }
1053
 
1054
  if (callback) {
1446
  * Removes a post from the HTML and the posts cache.
1447
  */
1448
  removePostItem: function(/*string*/ dayobjId, /*string*/ postId) {
1449
+ edcal.output('removePostItem(' + dayobjId + ', ' + postId + ')');
1450
  if (edcal.findPostForId(dayobjId, postId)) {
1451
  for (var i = 0; i < edcal.posts[dayobjId].length; i++) {
1452
  if (edcal.posts[dayobjId][i] && 'post-' + edcal.posts[dayobjId][i].id === postId) {
1453
+ edcal.posts[dayobjId][i] = null;
 
1454
  }
1455
  }
1456
  }
1457
+
1458
+ jQuery('#' + postId).remove();
1459
  },
1460
 
1461
  /*
edcal.min.js CHANGED
@@ -19,47 +19,48 @@ edcal.makeDroppable(jQuery("#row"+edcal._wDate.toString(edcal.internalDateFormat
19
  doDrop:function(a,b,c,d){var e=edcal.findPostForId(a,b);edcal.removePostFromMap(a,b);var f=jQuery("#"+b);f.detach();setTimeout(function(){f.remove()},500);jQuery("#"+c+" .postlist").append(edcal.createPostItem(e,c));a===c?edcal.draggablePost("#"+c+" .post"):edcal.changeDate(c,e,d)},draggablePost:function(a){jQuery(a).each(function(){var a=edcal.findPostForId(jQuery(this).parent().parent().parent().attr("id"),jQuery(this).attr("id"));edcal.isPostMovable(a)&&(jQuery(this).draggable({revert:"invalid",
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("&amp;","&");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="'+
31
- a.status+'">'+a.status+"</option>"),jQuery("#edcal-status").val(a.status));a.formatteddate!==edcal.NO_DATE&&-1===edcal.getDayFromDayId(a.date).compareTo(Date.today())&&jQuery("#edcal-status").attr("disabled","true");var b=a.time;jQuery("#edcal-time").val(b);jQuery("#edcal-date").val(a.date);jQuery("#edcal-id").val(a.id);jQuery("#edcal-title-new-field").focus();jQuery("#edcal-title-new-field").select()},hideForm:function(){jQuery("#edcal_quickedit").hide();jQuery("#edcal_scrollable").data("scrollable").getConf().keyboard=
32
- !0;edcal.resetForm()},resetForm:function(){jQuery("#edcal_quickedit").find("input, textarea, select").each(function(){this.value=""});jQuery("#edcal-status").removeAttr("disabled");jQuery("#newPostScheduleButton").text(edcal.str_publish);jQuery("#tooltiptitle").text("");jQuery("#edcal-status").removeAttr("disabled");jQuery("#edcal-status .temp").remove()},createPostItem:function(a,b){edcal.posts[b]||(edcal.posts[b]=[]);edcal.posts[b][edcal.posts[b].length]=a;return edcal.getPostItemString(a)},findPostForId:function(a,
33
- 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];return null},removePostItem:function(a,b){if(edcal.findPostForId(a,b))for(var c=0;c<edcal.posts[a].length;c++)edcal.posts[a][c]&&"post-"+edcal.posts[a][c].id===b&&(edcal.posts[a][c]=null,jQuery("#"+b).remove())},getPostItems:function(a){var b="";if(edcal.posts[a]){var c=edcal.posts[a];if(50>c.length)for(a=0;a<c.length;a++)c[a]&&(b+=edcal.getPostItemString(c[a]));
34
- else edcal.addPostItems(a,0,50)}return b},addPostItems:function(a,b,c){var d=edcal.posts[a],e="";setTimeout(function(){for(var f=b;f<b+c&&f<d.length;f++)d[f]&&(e+=edcal.getPostItemString(d[f]));jQuery("#"+a+" ul").append(e);b+c<d.length&&edcal.addPostItems(a,b+c,50)},100)},showActionLinks:function(a){edcal.actionTimer&&clearTimeout(edcal.actionTimer);var b=edcal.findPostForId(jQuery("#"+a).parent().parent().parent().attr("id"),a);if(!edcal.inDrag&&edcal.isPostEditable(b)){var c=jQuery("#"+a+" > div.postactions");
35
- edcal.actionLinksElem&&edcal.actionLinksElem.get(0)!==c.get(0)&&edcal.actionLinksElem.slideUp();edcal.actionLinksElem=c;edcal.actionTimer=setTimeout(function(){c.slideDown();if(c.parent().position().top+c.parent().height()>c.parent().parent().height()){var b=jQuery("#"+a+" > div.postactions").parent().parent();b.scrollTop(b.scrollTop()+45)}},250)}},hideActionLinks:function(a){edcal.actionTimer&&clearTimeout(edcal.actionTimer);edcal.actionTimer=setTimeout(function(){jQuery("#"+a+" > div.postactions").slideUp();
36
- edcal.actionLinksElem=null},1E3)},isPostMovable:function(a){return a.editlink&&"publish"!==a.status},isPostEditable:function(a){return a.editlink},getPostEditableClass:function(a){return a.editlink?"":"readonly"},getPostItemString:function(a){var b=a.title;""===b&&(b="[No Title]");edcal.statusPref&&("draft"===a.status&&"1"===a.sticky?b+=edcal.str_draft_sticky:"pending"===a.status&&"1"===a.sticky?b+=edcal.str_pending_sticky:"1"===a.sticky?b+=edcal.str_sticky:"pending"===a.status?b+=edcal.str_pending:
37
- "draft"===a.status?b+=edcal.str_draft:"publish"!==a.status&&("future"!==a.status&&"pending"!==a.status)&&(b+=" ["+a.status+"]"));edcal.timePref&&(b='<span class="posttime">'+a.formattedtime+"</span> "+b);edcal.authorPref&&(b=sprintf(edcal.str_by,b,'<span class="postauthor">'+a.author+"</span>"));return edcal.isPostMovable(a)?"<li onmouseover=\"edcal.showActionLinks('post-"+a.id+"');\" onmouseout=\"edcal.hideActionLinks('post-"+a.id+'\');" id="post-'+a.id+'" class="post '+a.status+" "+edcal.getPostEditableClass(a)+
38
- '"><div class="postlink "><span>'+b+'</span></div><div class="postactions"><a href="'+a.editlink+'">'+edcal.str_edit+'</a> | <a href="#" onclick="edcal.editPost('+a.id+'); return false;">'+edcal.str_quick_edit+'</a> | <a href="'+a.dellink+'" onclick="return edcal.confirmDelete(\''+a.title+"');\">"+edcal.str_del+'</a> | <a href="'+a.permalink+'">'+edcal.str_view+"</a></div></li>":"<li onmouseover=\"edcal.showActionLinks('post-"+a.id+"');\" onmouseout=\"edcal.hideActionLinks('post-"+a.id+'\');" id="post-'+
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,
46
- "OM")||edcal.endsWith(b,"QA")||edcal.endsWith(b,"SA")||edcal.endsWith(b,"SD")||edcal.endsWith(b,"SO")||edcal.endsWith(b,"TN")||edcal.endsWith(b,"YE")?6:1}else edcal.startOfWeek=0;return a.next().sunday().add(edcal.startOfWeek).days()},endsWith:function(a,b){return a.match(b+"$")===b},moveTo:function(a){edcal.isMoving=!0;jQuery("#cal").empty();jQuery.cookie("edcal_date",a.toString("yyyy-dd-MM"));edcal._wDate=edcal.nextStartOfWeek(a).add(-21).days();edcal.currentDirection=!0;for(var a=edcal.weeksPref+
47
- 6,b=0;b<a;b++)edcal.createRow(jQuery("#cal"),!0),edcal._wDate.add(7).days();edcal.alignCal();jQuery("#edcal_scrollable").scrollable().move(2);edcal.setDateLabel();edcal.setClassforToday();edcal.isMoving=!1},savePosition:function(){var a=jQuery("#edcal_scrollable"),b=jQuery("#cal_cont");edcal.position={top:a.offset().top,bottom:a.offset().top+a.height()};jQuery("#edcal_poststyle").remove();a=jQuery(".rowcont:eq(2) .dayobj:first").height()-jQuery(".rowcont:eq(2) .daylabel:first").height()-6;jQuery("head").append('<style id="edcal_poststyle" type="text/css">.ui-draggable-dragging {width: '+
48
- (jQuery(".rowcont:eq(2) .day:first").width()-5)+"px;}.postlist {height: "+a+"px;}</style>");jQuery("#draftsdrawer").css("height",b.height());jQuery("#draftsdrawer .day").css("min-height",b.height()-10-jQuery("#draftsdrawer .draftsdrawerheadcont").height())},addFeedbackSection:function(){3<edcal.visitCount&&edcal.doFeedbackPref&&jQuery("#edcal_main_title").after(edcal.str_feedbackmsg)},doFeedback:function(){jQuery.getScript("http://www.zackgrossbart.com/edcal/mint/?js",function(){edcal.saveFeedbackPref()})},
49
- noFeedback:function(){jQuery("#feedbacksection").hide("fast");edcal.saveFeedbackPref()},saveFeedbackPref:function(){var a=edcal.ajax_url()+"&action=edcal_saveoptions&dofeedback="+encodeURIComponent("done");jQuery.ajax({url:a,type:"POST",processData:!1,timeout:1E5,dataType:"text",success:function(){jQuery("#feedbacksection").html(edcal.str_feedbackdone);setTimeout(function(){jQuery("#feedbacksection").hide("slow")},5E3)},error:function(a){edcal.showError(edcal.general_error);a.responseText&&edcal.output("saveOptions xhr.responseText: "+
50
- a.responseText)}})},updatePublishButton:function(){"future"===jQuery("#edcal-status").val()&&jQuery("#newPostScheduleButton").text(edcal.str_publish);"pending"===jQuery("#edcal-status").val()?jQuery("#newPostScheduleButton").text(edcal.str_review):jQuery("#newPostScheduleButton").text(edcal.str_save)},changeDate:function(a,b,c){edcal.output("changeDate("+a+", "+b+")");var d=a===edcal.NO_DATE,e=b.date_gmt===edcal.NO_DATE,f=d?"0000-00-00":edcal.getDayFromDayId(a).toString(edcal.wp_dateFormat),g=e?b.date_gmt:
51
- edcal.getDayFromDayId(b.date).toString(edcal.wp_dateFormat);d&&(b.status="draft");f=edcal.ajax_url()+"&action=edcal_changedate&postid="+b.id+"&postStatus="+b.status+"&newdate="+f+"&olddate="+g;jQuery("#post-"+b.id).addClass("loadingclass");jQuery.ajax({url:f,type:"POST",processData:!1,timeout:1E5,dataType:"json",success:function(b){edcal.output("res.post.date="+b.post.date);edcal.output(b.post);if(b.error){edcal.removePostItem(a,"post-"+b.post.id);b.error===edcal.CONCURRENCY_ERROR?edcal.displayMessage(edcal.concurrency_error+
52
- "<br />"+b.post.title):b.error===edcal.PERMISSION_ERROR?edcal.displayMessage(edcal.permission_error):b.error===edcal.NONCE_ERROR&&edcal.displayMessage(edcal.checksum_error)}var f=d?"00000000":b.post.date,g=e?a:f;edcal.removePostItem(f,"post-"+b.post.id);edcal.addPostItem(b.post,g);edcal.addPostItemDragAndToolltip(g);c&&c(b)},error:function(a,b,c){edcal.showError(edcal.general_error);edcal.output("textStatus: "+b);edcal.output("error: "+c);a.responseText&&edcal.output("changeDate xhr.responseText: "+
53
- a.responseText)}})},getPosts:function(a,b,c){b||(b="");edcal.cacheDates[a]?c&&c():(edcal.cacheDates[a]=!0,b=edcal.ajax_url()+"&action=edcal_posts&from="+a.toString("yyyy-MM-dd")+"&to="+b.toString("yyyy-MM-dd"),edcal.getUrlVars().post_type&&(b+="&post_type="+encodeURIComponent(edcal.getUrlVars().post_type)),jQuery("#loading").show(),jQuery.ajax({url:b,type:"GET",processData:!1,timeout:1E5,dataType:"text",success:function(b){jQuery("#loading").hide();var e=JSON.parseIt(b);if(e.error)e.error===edcal.NONCE_ERROR&&
54
- edcal.showError(edcal.checksum_error);else{for(var f=[],g=e.length;0<=g;g--){var h=e[g];h&&"trash"!==h.status&&(h.date=h.date.replace(h.date.substring(2,3),h.date.substring(2,3).toUpperCase()),"00000000"===a&&(h.date=a),edcal.removePostItem(h.date,"post-"+h.id),edcal.addPostItem(h,h.date),f[f.length]=h.date)}setTimeout(function(){jQuery.each(f,function(a,b){edcal.addPostItemDragAndToolltip(b)})},300);c&&c(b)}},error:function(a){edcal.showError(edcal.general_error);a.responseText&&edcal.output("getPosts xhr.responseText: "+
55
- a.responseText)}}))},getPost:function(a,b){if(0===a)return!1;jQuery("#loading").show();var c=edcal.ajax_url()+"&action=edcal_getpost&postid="+a;edcal.getUrlVars().post_type&&(c+="&post_type="+encodeURIComponent(edcal.getUrlVars().post_type));jQuery.ajax({url:c,type:"GET",processData:!1,timeout:1E5,dataType:"json",success:function(a){jQuery("#loading").hide();edcal.output("xhr for getPost returned: "+a);if(a.error)return a.error===edcal.NONCE_ERROR&&edcal.showError(edcal.checksum_error),!1;"function"===
56
- typeof b&&b(a.post);return a.post},error:function(a){jQuery("#loading").hide();edcal.showError(edcal.general_error);a.responseText&&edcal.output("getPost xhr.responseText: "+a.responseText);return!1}});return!0},addOptionsSection:function(){var a='<div class="hide-if-no-js screen-meta-toggle" id="screen-options-link-wrap"><a class="show-settings" id="show-edcal-settings-link" onclick="edcal.toggleOptions(); return false;" href="#" >'+edcal.str_screenoptions+"</a></div>";0===jQuery("#screen-meta-links").length&&
57
- jQuery("#screen-meta").after('<div id="screen-meta-links"></div>');jQuery("#screen-meta-links").append(a)},toggleOptions:function(){if(edcal.helpMeta)jQuery("#contextual-help-wrap").slideUp("fast"),jQuery("#contextual-help-wrap").html(edcal.helpMeta),edcal.helpMeta=null,jQuery("#show-edcal-settings-link").removeClass("screen-meta-active"),jQuery("#contextual-help-link-wrap").css("visibility","");else{edcal.helpMeta=jQuery("#contextual-help-wrap").html();for(var a='<div class="metabox-prefs" id="calendar-fields-prefs"><h5>'+
58
- edcal.str_show_opts+'</h5><label for="author-hide"><input type="checkbox" '+edcal.isPrefChecked(edcal.authorPref)+'value="true" id="author-hide" name="author-hide" class="hide-column-tog" />'+edcal.str_opt_author+'</label><label for="status-hide"><input type="checkbox" '+edcal.isPrefChecked(edcal.statusPref)+'value="true" id="status-hide" name="status-hide" class="hide-column-tog" />'+edcal.str_opt_status+'</label><label for="time-hide"><input type="checkbox" '+edcal.isPrefChecked(edcal.timePref)+
59
- 'value="true" id="time-hide" name="time-hide" class="hide-column-tog" />'+edcal.str_opt_time+"</label></div>",a=a+('<div class="metabox-prefs"><h5>'+edcal.str_show_title+'</h5><select id="edcal_weeks_pref" class="screen-per-page" title="'+edcal.str_weekstt+'"> '),b=parseInt(edcal.weeksPref,10),c=1;9>c;c++)a=c===b?a+('<option selected="true">'+c+"</option>"):a+("<option>"+c+"</option>");a+="</select>"+edcal.str_opt_weeks+"</div>";a+='<br /><button id="edcal_applyoptions" onclick="edcal.saveOptions(); return false;" class="save button">'+
60
- edcal.str_apply+"</button>";jQuery("#contextual-help-wrap").html(a);jQuery("#contextual-help-link-wrap").css("visibility","hidden");jQuery("#contextual-help-wrap").slideDown("normal");jQuery("#screen-meta").show();jQuery("#show-edcal-settings-link").addClass("screen-meta-active")}},generateColorPicker:function(a,b,c){var a='<div id="'+b+'" class="optionscolorrow">'+('<span style="background-color: '+c+';" class="colorlabel"> '+a+"</span> "),d="lightred orange yellow lightgreen lightblue purple lightgray".split(" ");
61
- edcal.output("colors.length: "+d.length);for(var e=0;e<d.length;e++)a+='<a href="#" class="optionscolor ',d[e]===c&&(a+="colorselected"),a+='" class='+b+d[e]+'" style="background-color: '+d[e]+"; left: "+(20*e+50)+'px" onclick="edcal.selectColor(\''+b+"', '"+d[e]+"'); return false;\"></a>";return a+"</div>"},selectColor:function(a,b){edcal.output("selectColor("+a+", "+b+")");jQuery("#"+a+" .colorlabel").css("background-color",b);jQuery("#"+a+" .colorselected").removeClass("colorselected");jQuery("#"+
62
- a+"value").addClass("colorselected")},isPrefChecked:function(a){return a?' checked="checked" ':""},saveOptions:function(){var a=parseInt(jQuery("#edcal_weeks_pref").val(),10);if(1>a||8<a)humanMsg.displayMsg(edcal.str_weekserror);else{var b=edcal.ajax_url()+"&action=edcal_saveoptions&weeks="+encodeURIComponent(jQuery("#edcal_weeks_pref").val());jQuery("#calendar-fields-prefs").find("input, textarea, select").each(function(){b+="&"+encodeURIComponent(this.name)+"="+encodeURIComponent(this.checked)});
63
- jQuery.ajax({url:b,type:"POST",processData:!1,timeout:1E5,dataType:"text",success:function(){window.location.href=window.location.href},error:function(a){edcal.showError(edcal.general_error);a.responseText&&edcal.output("saveOptions xhr.responseText: "+a.responseText)}})}},output:function(a){window.console&&console.log(a)},showError:function(a){window.console&&console.error(a);edcal.displayMessage(a)},displayMessage:function(a){humanMsg.displayMsg(a)},getUrlVars:function(){for(var a=[],b,c=window.location.href.slice(window.location.href.indexOf("?")+
64
- 1).split("&"),d=0;d<c.length;d++)b=c[d].split("="),a.push(b[0]),a[b[0]]=b[1];return a},showFatalError:function(a){jQuery("#edcal_main_title").after('<div class="updated below-h2" id="message"><p>'+edcal.str_fatal_error+a+"<br></p></div>");window.console&&console.error(a)},chineseAposWorkaround:function(a){return 0===Date.CultureInfo.name.indexOf("zh")||0===Date.CultureInfo.name.indexOf("ja")?a.replace(/'/g,""):a}};
65
- jQuery.fn.center=function(){this.css("position","absolute");this.css("top",(jQuery(window).height()-this.outerHeight())/2+jQuery(window).scrollTop()+"px");this.css("left",(jQuery(window).width()-this.outerWidth())/2+jQuery(window).scrollLeft()+"px");return this};jQuery(document).ready(function(){try{edcal.init()}catch(a){edcal.output("Error loading calendar: "+a),edcal.showFatalError(a.description)}edcal.getUrlVars().qunit&&edcal_test.runTests()});
 
19
  doDrop:function(a,b,c,d){var e=edcal.findPostForId(a,b);edcal.removePostFromMap(a,b);var f=jQuery("#"+b);f.detach();setTimeout(function(){f.remove()},500);jQuery("#"+c+" .postlist").append(edcal.createPostItem(e,c));a===c?edcal.draggablePost("#"+c+" .post"):edcal.changeDate(c,e,d)},draggablePost:function(a){jQuery(a).each(function(){var a=edcal.findPostForId(jQuery(this).parent().parent().parent().attr("id"),jQuery(this).attr("id"));edcal.isPostMovable(a)&&(jQuery(this).draggable({revert:"invalid",
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+'" with id:'+a.post.id);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)?
23
+ !0:!1},ajax_url:function(){return ajaxurl+"?_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");
24
+ var a={id:0,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,
25
+ 2)&&"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="+
26
+ f+"&title="+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,
27
+ dataType:"json",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("&amp;","&");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,
28
+ c);edcal.addPostItemDragAndToolltip(c)}else edcal.showError("There was an error creating a new post for your blog.");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]=
29
+ this.value});return a},showForm:function(a){edcal.resetForm();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)):
30
+ a.formatteddate===edcal.NO_DATE?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",
31
+ "true"),jQuery("#edcal-status").append('<option class="temp" value="'+a.status+'">'+a.status+"</option>"),jQuery("#edcal-status").val(a.status));a.formatteddate!==edcal.NO_DATE&&-1===edcal.getDayFromDayId(a.date).compareTo(Date.today())&&jQuery("#edcal-status").attr("disabled","true");var b=a.time;jQuery("#edcal-time").val(b);jQuery("#edcal-date").val(a.date);jQuery("#edcal-id").val(a.id);jQuery("#edcal-title-new-field").focus();jQuery("#edcal-title-new-field").select()},hideForm:function(){jQuery("#edcal_quickedit").hide();
32
+ jQuery("#edcal_scrollable").data("scrollable").getConf().keyboard=!0;edcal.resetForm()},resetForm:function(){jQuery("#edcal_quickedit").find("input, textarea, select").each(function(){this.value=""});jQuery("#edcal-status").removeAttr("disabled");jQuery("#newPostScheduleButton").text(edcal.str_publish);jQuery("#tooltiptitle").text("");jQuery("#edcal-status").removeAttr("disabled");jQuery("#edcal-status .temp").remove()},createPostItem:function(a,b){edcal.posts[b]||(edcal.posts[b]=[]);edcal.posts[b][edcal.posts[b].length]=
33
+ a;return edcal.getPostItemString(a)},findPostForId:function(a,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];return null},removePostItem:function(a,b){edcal.output("removePostItem("+a+", "+b+")");if(edcal.findPostForId(a,b))for(var c=0;c<edcal.posts[a].length;c++)edcal.posts[a][c]&&"post-"+edcal.posts[a][c].id===b&&(edcal.posts[a][c]=null);jQuery("#"+b).remove()},getPostItems:function(a){var b="";if(edcal.posts[a]){var c=
34
+ edcal.posts[a];if(50>c.length)for(a=0;a<c.length;a++)c[a]&&(b+=edcal.getPostItemString(c[a]));else edcal.addPostItems(a,0,50)}return b},addPostItems:function(a,b,c){var d=edcal.posts[a],e="";setTimeout(function(){for(var f=b;f<b+c&&f<d.length;f++)d[f]&&(e+=edcal.getPostItemString(d[f]));jQuery("#"+a+" ul").append(e);b+c<d.length&&edcal.addPostItems(a,b+c,50)},100)},showActionLinks:function(a){edcal.actionTimer&&clearTimeout(edcal.actionTimer);var b=edcal.findPostForId(jQuery("#"+a).parent().parent().parent().attr("id"),
35
+ a);if(!edcal.inDrag&&edcal.isPostEditable(b)){var c=jQuery("#"+a+" > div.postactions");edcal.actionLinksElem&&edcal.actionLinksElem.get(0)!==c.get(0)&&edcal.actionLinksElem.slideUp();edcal.actionLinksElem=c;edcal.actionTimer=setTimeout(function(){c.slideDown();if(c.parent().position().top+c.parent().height()>c.parent().parent().height()){var b=jQuery("#"+a+" > div.postactions").parent().parent();b.scrollTop(b.scrollTop()+45)}},250)}},hideActionLinks:function(a){edcal.actionTimer&&clearTimeout(edcal.actionTimer);
36
+ edcal.actionTimer=setTimeout(function(){jQuery("#"+a+" > div.postactions").slideUp();edcal.actionLinksElem=null},1E3)},isPostMovable:function(a){return a.editlink&&"publish"!==a.status},isPostEditable:function(a){return a.editlink},getPostEditableClass:function(a){return a.editlink?"":"readonly"},getPostItemString:function(a){var b=a.title;""===b&&(b="[No Title]");edcal.statusPref&&("draft"===a.status&&"1"===a.sticky?b+=edcal.str_draft_sticky:"pending"===a.status&&"1"===a.sticky?b+=edcal.str_pending_sticky:
37
+ "1"===a.sticky?b+=edcal.str_sticky:"pending"===a.status?b+=edcal.str_pending:"draft"===a.status?b+=edcal.str_draft:"publish"!==a.status&&("future"!==a.status&&"pending"!==a.status)&&(b+=" ["+a.status+"]"));edcal.timePref&&(b='<span class="posttime">'+a.formattedtime+"</span> "+b);edcal.authorPref&&(b=sprintf(edcal.str_by,b,'<span class="postauthor">'+a.author+"</span>"));return edcal.isPostMovable(a)?"<li onmouseover=\"edcal.showActionLinks('post-"+a.id+"');\" onmouseout=\"edcal.hideActionLinks('post-"+
38
+ a.id+'\');" id="post-'+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_edit+'</a> | <a href="#" onclick="edcal.editPost('+a.id+'); return false;">'+edcal.str_quick_edit+'</a> | <a href="'+a.dellink+'" onclick="return edcal.confirmDelete(\''+a.title+"');\">"+edcal.str_del+'</a> | <a href="'+a.permalink+'">'+edcal.str_view+"</a></div></li>":"<li onmouseover=\"edcal.showActionLinks('post-"+
39
+ a.id+"');\" onmouseout=\"edcal.hideActionLinks('post-"+a.id+'\');" id="post-'+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()-
40
+ jQuery("#wphead").height()-150;return Math.max(a,500)},move:function(a,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(),
41
+ edcal.createRow(jQuery("#cal"),!1),edcal._wDate.add(-7).days();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",
42
+ edcal._wDate.clone().add(-(edcal.weeksPref+4)).weeks().toString("yyyy-dd-MM")):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-
43
+ 1).children(".edcal_row").children(".day:last").attr("id"));jQuery("#currentRange").text(edcal.chineseAposWorkaround(b.toString(Date.CultureInfo.formatPatterns.yearMonth))+" - "+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,
44
+ "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,"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,
45
+ "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,"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,
46
+ "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,"OM")||edcal.endsWith(b,"QA")||edcal.endsWith(b,"SA")||edcal.endsWith(b,"SD")||edcal.endsWith(b,"SO")||edcal.endsWith(b,"TN")||edcal.endsWith(b,"YE")?6:1}else edcal.startOfWeek=0;return a.next().sunday().add(edcal.startOfWeek).days()},endsWith:function(a,b){return a.match(b+"$")===b},moveTo:function(a){edcal.isMoving=!0;jQuery("#cal").empty();
47
+ jQuery.cookie("edcal_date",a.toString("yyyy-dd-MM"));edcal._wDate=edcal.nextStartOfWeek(a).add(-21).days();edcal.currentDirection=!0;for(var a=edcal.weeksPref+6,b=0;b<a;b++)edcal.createRow(jQuery("#cal"),!0),edcal._wDate.add(7).days();edcal.alignCal();jQuery("#edcal_scrollable").scrollable().move(2);edcal.setDateLabel();edcal.setClassforToday();edcal.isMoving=!1},savePosition:function(){var a=jQuery("#edcal_scrollable"),b=jQuery("#cal_cont");edcal.position={top:a.offset().top,bottom:a.offset().top+
48
+ a.height()};jQuery("#edcal_poststyle").remove();a=jQuery(".rowcont:eq(2) .dayobj:first").height()-jQuery(".rowcont:eq(2) .daylabel:first").height()-6;jQuery("head").append('<style id="edcal_poststyle" type="text/css">.ui-draggable-dragging {width: '+(jQuery(".rowcont:eq(2) .day:first").width()-5)+"px;}.postlist {height: "+a+"px;}</style>");jQuery("#draftsdrawer").css("height",b.height());jQuery("#draftsdrawer .day").css("min-height",b.height()-10-jQuery("#draftsdrawer .draftsdrawerheadcont").height())},
49
+ addFeedbackSection:function(){3<edcal.visitCount&&edcal.doFeedbackPref&&jQuery("#edcal_main_title").after(edcal.str_feedbackmsg)},doFeedback:function(){jQuery.getScript("http://www.zackgrossbart.com/edcal/mint/?js",function(){edcal.saveFeedbackPref()})},noFeedback:function(){jQuery("#feedbacksection").hide("fast");edcal.saveFeedbackPref()},saveFeedbackPref:function(){var a=edcal.ajax_url()+"&action=edcal_saveoptions&dofeedback="+encodeURIComponent("done");jQuery.ajax({url:a,type:"POST",processData:!1,
50
+ timeout:1E5,dataType:"text",success:function(){jQuery("#feedbacksection").html(edcal.str_feedbackdone);setTimeout(function(){jQuery("#feedbacksection").hide("slow")},5E3)},error:function(a){edcal.showError(edcal.general_error);a.responseText&&edcal.output("saveOptions xhr.responseText: "+a.responseText)}})},updatePublishButton:function(){"future"===jQuery("#edcal-status").val()&&jQuery("#newPostScheduleButton").text(edcal.str_publish);"pending"===jQuery("#edcal-status").val()?jQuery("#newPostScheduleButton").text(edcal.str_review):
51
+ jQuery("#newPostScheduleButton").text(edcal.str_save)},changeDate:function(a,b,c){edcal.output("changeDate("+a+", "+b+")");var d=a===edcal.NO_DATE,e=b.date_gmt===edcal.NO_DATE,f=d?"0000-00-00":edcal.getDayFromDayId(a).toString(edcal.wp_dateFormat),g=e?b.date_gmt:edcal.getDayFromDayId(b.date).toString(edcal.wp_dateFormat);d&&(b.status="draft");f=edcal.ajax_url()+"&action=edcal_changedate&postid="+b.id+"&postStatus="+b.status+"&newdate="+f+"&olddate="+g;jQuery("#post-"+b.id).addClass("loadingclass");
52
+ jQuery.ajax({url:f,type:"POST",processData:!1,timeout:1E5,dataType:"json",success:function(b){edcal.output("res.post.date="+b.post.date);edcal.output(b.post);if(b.error){edcal.removePostItem(a,"post-"+b.post.id);b.error===edcal.CONCURRENCY_ERROR?edcal.displayMessage(edcal.concurrency_error+"<br />"+b.post.title):b.error===edcal.PERMISSION_ERROR?edcal.displayMessage(edcal.permission_error):b.error===edcal.NONCE_ERROR&&edcal.displayMessage(edcal.checksum_error)}var f=d?"00000000":b.post.date,g=e?a:
53
+ f;edcal.removePostItem(f,"post-"+b.post.id);edcal.addPostItem(b.post,g);edcal.addPostItemDragAndToolltip(g);c&&c(b)},error:function(a,b,c){edcal.showError(edcal.general_error);edcal.output("textStatus: "+b);edcal.output("error: "+c);a.responseText&&edcal.output("changeDate xhr.responseText: "+a.responseText)}})},getPosts:function(a,b,c){b||(b="");edcal.cacheDates[a]?c&&c():(edcal.cacheDates[a]=!0,b=edcal.ajax_url()+"&action=edcal_posts&from="+a.toString("yyyy-MM-dd")+"&to="+b.toString("yyyy-MM-dd"),
54
+ edcal.getUrlVars().post_type&&(b+="&post_type="+encodeURIComponent(edcal.getUrlVars().post_type)),jQuery("#loading").show(),jQuery.ajax({url:b,type:"GET",processData:!1,timeout:1E5,dataType:"text",success:function(b){jQuery("#loading").hide();var e=JSON.parseIt(b);if(e.error)e.error===edcal.NONCE_ERROR&&edcal.showError(edcal.checksum_error);else{for(var f=[],g=e.length;0<=g;g--){var h=e[g];h&&"trash"!==h.status&&(h.date=h.date.replace(h.date.substring(2,3),h.date.substring(2,3).toUpperCase()),"00000000"===
55
+ a&&(h.date=a),edcal.removePostItem(h.date,"post-"+h.id),edcal.addPostItem(h,h.date),f[f.length]=h.date)}setTimeout(function(){jQuery.each(f,function(a,b){edcal.addPostItemDragAndToolltip(b)})},300);c&&c(b)}},error:function(a){edcal.showError(edcal.general_error);a.responseText&&edcal.output("getPosts xhr.responseText: "+a.responseText)}}))},getPost:function(a,b){if(0===a)return!1;jQuery("#loading").show();var c=edcal.ajax_url()+"&action=edcal_getpost&postid="+a;edcal.getUrlVars().post_type&&(c+="&post_type="+
56
+ encodeURIComponent(edcal.getUrlVars().post_type));jQuery.ajax({url:c,type:"GET",processData:!1,timeout:1E5,dataType:"json",success:function(a){jQuery("#loading").hide();edcal.output("xhr for getPost returned: "+a);if(a.error)return a.error===edcal.NONCE_ERROR&&edcal.showError(edcal.checksum_error),!1;"function"===typeof b&&b(a.post);return a.post},error:function(a){jQuery("#loading").hide();edcal.showError(edcal.general_error);a.responseText&&edcal.output("getPost xhr.responseText: "+a.responseText);
57
+ return!1}});return!0},addOptionsSection:function(){var a='<div class="hide-if-no-js screen-meta-toggle" id="screen-options-link-wrap"><a class="show-settings" id="show-edcal-settings-link" onclick="edcal.toggleOptions(); return false;" href="#" >'+edcal.str_screenoptions+"</a></div>";0===jQuery("#screen-meta-links").length&&jQuery("#screen-meta").after('<div id="screen-meta-links"></div>');jQuery("#screen-meta-links").append(a)},toggleOptions:function(){if(edcal.helpMeta)jQuery("#contextual-help-wrap").slideUp("fast"),
58
+ jQuery("#contextual-help-wrap").html(edcal.helpMeta),edcal.helpMeta=null,jQuery("#show-edcal-settings-link").removeClass("screen-meta-active"),jQuery("#contextual-help-link-wrap").css("visibility","");else{edcal.helpMeta=jQuery("#contextual-help-wrap").html();for(var a='<div class="metabox-prefs" id="calendar-fields-prefs"><h5>'+edcal.str_show_opts+'</h5><label for="author-hide"><input type="checkbox" '+edcal.isPrefChecked(edcal.authorPref)+'value="true" id="author-hide" name="author-hide" class="hide-column-tog" />'+
59
+ edcal.str_opt_author+'</label><label for="status-hide"><input type="checkbox" '+edcal.isPrefChecked(edcal.statusPref)+'value="true" id="status-hide" name="status-hide" class="hide-column-tog" />'+edcal.str_opt_status+'</label><label for="time-hide"><input type="checkbox" '+edcal.isPrefChecked(edcal.timePref)+'value="true" id="time-hide" name="time-hide" class="hide-column-tog" />'+edcal.str_opt_time+"</label></div>",a=a+('<div class="metabox-prefs"><h5>'+edcal.str_show_title+'</h5><select id="edcal_weeks_pref" class="screen-per-page" title="'+
60
+ edcal.str_weekstt+'"> '),b=parseInt(edcal.weeksPref,10),c=1;9>c;c++)a=c===b?a+('<option selected="true">'+c+"</option>"):a+("<option>"+c+"</option>");a+="</select>"+edcal.str_opt_weeks+"</div>";a+='<br /><button id="edcal_applyoptions" onclick="edcal.saveOptions(); return false;" class="save button">'+edcal.str_apply+"</button>";jQuery("#contextual-help-wrap").html(a);jQuery("#contextual-help-link-wrap").css("visibility","hidden");jQuery("#contextual-help-wrap").slideDown("normal");jQuery("#screen-meta").show();
61
+ jQuery("#show-edcal-settings-link").addClass("screen-meta-active")}},generateColorPicker:function(a,b,c){var a='<div id="'+b+'" class="optionscolorrow">'+('<span style="background-color: '+c+';" class="colorlabel"> '+a+"</span> "),d="lightred orange yellow lightgreen lightblue purple lightgray".split(" ");edcal.output("colors.length: "+d.length);for(var e=0;e<d.length;e++)a+='<a href="#" class="optionscolor ',d[e]===c&&(a+="colorselected"),a+='" class='+b+d[e]+'" style="background-color: '+d[e]+"; left: "+
62
+ (20*e+50)+'px" onclick="edcal.selectColor(\''+b+"', '"+d[e]+"'); return false;\"></a>";return a+"</div>"},selectColor:function(a,b){edcal.output("selectColor("+a+", "+b+")");jQuery("#"+a+" .colorlabel").css("background-color",b);jQuery("#"+a+" .colorselected").removeClass("colorselected");jQuery("#"+a+"value").addClass("colorselected")},isPrefChecked:function(a){return a?' checked="checked" ':""},saveOptions:function(){var a=parseInt(jQuery("#edcal_weeks_pref").val(),10);if(1>a||8<a)humanMsg.displayMsg(edcal.str_weekserror);
63
+ else{var b=edcal.ajax_url()+"&action=edcal_saveoptions&weeks="+encodeURIComponent(jQuery("#edcal_weeks_pref").val());jQuery("#calendar-fields-prefs").find("input, textarea, select").each(function(){b+="&"+encodeURIComponent(this.name)+"="+encodeURIComponent(this.checked)});jQuery.ajax({url:b,type:"POST",processData:!1,timeout:1E5,dataType:"text",success:function(){window.location.href=window.location.href},error:function(a){edcal.showError(edcal.general_error);a.responseText&&edcal.output("saveOptions xhr.responseText: "+
64
+ a.responseText)}})}},output:function(a){window.console&&console.log(a)},showError:function(a){window.console&&console.error(a);edcal.displayMessage(a)},displayMessage:function(a){humanMsg.displayMsg(a)},getUrlVars:function(){for(var a=[],b,c=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),d=0;d<c.length;d++)b=c[d].split("="),a.push(b[0]),a[b[0]]=b[1];return a},showFatalError:function(a){jQuery("#edcal_main_title").after('<div class="updated below-h2" id="message"><p>'+edcal.str_fatal_error+
65
+ a+"<br></p></div>");window.console&&console.error(a)},chineseAposWorkaround:function(a){return 0===Date.CultureInfo.name.indexOf("zh")||0===Date.CultureInfo.name.indexOf("ja")?a.replace(/'/g,""):a}};jQuery.fn.center=function(){this.css("position","absolute");this.css("top",(jQuery(window).height()-this.outerHeight())/2+jQuery(window).scrollTop()+"px");this.css("left",(jQuery(window).width()-this.outerWidth())/2+jQuery(window).scrollLeft()+"px");return this};
66
+ jQuery(document).ready(function(){try{edcal.init()}catch(a){edcal.output("Error loading calendar: "+a),edcal.showFatalError(a.description)}edcal.getUrlVars().qunit&&edcal_test.runTests()});
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.9
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
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: 3.0
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
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: cvernon, justinstresslimit, jkudish, MaryVogt, zgrossbart
3
  Tags: posts, post, calendar, AJAX, admin, administration
4
  Requires at least: 2.8.5
5
- Tested up to: 3.7.1
6
- Stable tag: 2.9
7
 
8
  The Editorial Calendar makes it possible to see all your posts and drag and drop them to manage your blog.
9
 
@@ -173,6 +173,10 @@ Moving published posts can cause problems with some RSS feeds and is generally n
173
 
174
  == Changelog ==
175
 
 
 
 
 
176
  = 2.9 =
177
 
178
  Version 2.9 is another testing release. This version makes sure everything works great with WordPress 3.7.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.8
6
+ Stable tag: 3.0
7
 
8
  The Editorial Calendar makes it possible to see all your posts and drag and drop them to manage your blog.
9
 
173
 
174
  == Changelog ==
175
 
176
+ = 3.0 =
177
+
178
+ This version makes a few small bug fixes to work well with WordPress 3.8. This includes showing the screen options with some better formatting and deleting posts from the drafts drawer properly.
179
+
180
  = 2.9 =
181
 
182
  Version 2.9 is another testing release. This version makes sure everything works great with WordPress 3.7.1.