rem: var lastDay = cal.getActualMaximum(java.util.Calendar.DATE); var startAt = cal.get(java.util.Calendar.DAY_OF_WEEK) - cal.getFirstDayOfWeek(); var currMonth = cal.get(java.util.Calendar.MONTH); calParam.month = cal.getTime().format("MMMM"); 
add:  var pre = (7-cal.getFirstDayOfWeek()+cal.get(java.util.Calendar.DAY_OF_WEEK)) % 7; var days = cal.getActualMaximum(java.util.Calendar.DATE); var weeks = Math.ceil((pre + days) / 7); var daycnt = 1;  tsParam.format = "MMMM"; calParam.month = this.formatTimestamp(cal.getTime(),tsParam);  
context: function calendar_macro() {   // define variables needed in this function   var now = new Date();   var calParam = new HopObject();   calParam.calendar = "";   var dayParam = new HopObject();   var weekParam = new HopObject();      // create new calendar-object   var cal = new java.util.GregorianCalendar();   cal.set(java.util.Calendar.DATE,1);   if (req.data.show) {      var reqYear = parseInt(req.data.show.substring(0,4),10);      var reqMonth = parseInt(req.data.show.substring(4,6),10) - 1;      if (reqYear && reqMonth) {         cal.set(java.util.Calendar.YEAR,reqYear);         cal.set(java.util.Calendar.MONTH,reqMonth);      }   }   var lastDay = cal.getActualMaximum(java.util.Calendar.DATE);   var startAt = cal.get(java.util.Calendar.DAY_OF_WEEK) - cal.getFirstDayOfWeek();   var currMonth = cal.get(java.util.Calendar.MONTH);   calParam.month = cal.getTime().format("MMMM");   calParam.year = cal.getTime().format("yyyy");   calParam.back = this.renderLinkToPrev(cal.clone());   for (var i=0;i<Math.ceil((startAt + lastDay) / 7);i++) {      weekParam.week = "";      for (var j=0;j<7;j++) {         if(i==0 && j<startAt) {            dayParam.day = "&nbsp;";         } else {            if (cal.get(java.util.Calendar.MONTH) != currMonth) {               dayParam.day = "&nbsp;";            } else {               var currGroupname = cal.getTime().format("yyyyMMdd");               dayParam.day = this.renderCalendarDay(currGroupname,cal.get(java.util.Calendar.DATE));            }            // check which skin we should render            if (req.data.show && cal.getTime().format("yyyyMMdd") == req.data.show)               dayParam.useskin = "calendarselday";            else               dayParam.useskin = "calendarday";            // render the link to next month (if it makes sense)            if (cal.get(java.util.Calendar.DATE) == lastDay)               calParam.forward = this.renderLinkToNext(cal.clone());            cal.add(java.util.Calendar.DATE,1);         }         weekParam.week += this.renderSkinAsString((dayParam.useskin ? dayParam.useskin : "calendarday"),dayParam);      }      calParam.calendar += this.renderSkinAsString("calendarweek",weekParam);   }   this.renderSkin("calendar",calParam);}
meta: 993	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/993/b2d8700ec8499cc6fb4814c85368bc95f98b3ef7/macros.js/clean/code/Site/macros.js