Results 1 to 2 of 2

Thread: zimlet developing

  1. #1
    Join Date
    Oct 2010
    Posts
    11
    Rep Power
    5

    Default zimlet developing

    hay,
    i have developed a zimlet which desplay calendar... but it shows more than 31 days per month and the next , prev buttons not working.. can some one check the error with this code..???

    Code:
    com_zimbra_calendar.prototype._displayDialog = 
    function() {
    	if (this._dialog) { //if zimlet dialog already exists...
    		this._dialog.popup(); // simply popup the dialog
    		return;
    	}
    		
    	var view = new DwtComposite(this.getShell()); // creates an empty div as a child of main shell div
    	view.setSize("600", "500"); // set width and height
    	view.getHtmlElement().style.overflow = "auto"; // adds scrollbar
    	view.getHtmlElement().innerHTML = this._createCalendar();// insert my calendat view
    	
    	// pass the title and view information to create dialog box
    	this._dialog = new ZmDialog( { title:"Holiday Calendar Generator", view:view, parent:this.getShell(), standardButtons:[DwtDialog.OK_BUTTON,DwtDialog.CANCEL_BUTTON] } );
    
    	//show the dialog
    	this._dialog.popup();
    };
    Code:
    com_zimbra_calendar.prototype._createCalendar =
    function(){
    
    	var daycounter = 0;
    //var i=0;
    	calendarString = '';
    	//var daycounter = 0;
    	calendarString += '<table width="312" border="1" cellpadding="0" cellspacing="1">';
    	calendarString += '<tr>';
    	calendarString += '<td align=\"center\" valign=\"center\" width=\"40\" height=\"40\"><a href=\"#\" id=\"prevyr\" onMouseOver=\"document.PrevYr.src=\'images\/PrevYrOn40x40\.jpg\';\" onMouseOut=\"document.PrevYr.src=\'images\/PrevYrOff40x40\.jpg\';\" onClick=\"this._changedate()\"><img name=\"PrevYr\" src=\"images\/PrevYrOff40x40\.jpg\" width=\"40\" height=\"40\" border=\"0\" alt=\"Prev Yr\"\/><\/a><\/td>';
    	calendarString += '<td align=\"center\" valign=\"center\" width=\"40\" height=\"40\"><a href=\"#\" id=\"prevmo\" onMouseOver=\"document.PrevMo.src=\'images\/PrevMoOn40x40\.jpg\';\" onMouseOut=\"document.PrevMo.src=\'images\/PrevMoOff40x40\.jpg\';\" onClick=\"this._changedate(\'prevmo\')\"><img name=\"PrevMo\" src=\"images\/PrevMoOff40x40\.jpg\" width=\"40\" height=\"40\" border=\"0\" alt=\"Prev Mo\"\/><\/a><\/td>';
    	calendarString += '<td bgcolor=\"#C8C896\" align=\"center\" valign=\"center\" width=\"128\" height=\"40\" colspan=\"3\"><b>' + wordMonth[monthNum-1] + '&nbsp;&nbsp;' + yearNum + '<\/b><\/td>';
    	calendarString += '<td align=\"center\" valign=\"center\" width=\"40\" height=\"40\"><a href=\"#\" id=\"nextyr\" onMouseOver=\"document.NextMo.src=\'images\/NextMoOn40x40\.jpg\';\" onMouseOut=\"document.NextMo.src=\'images\/NextMoOff40x40\.jpg\';\" onClick=\"this._changedate(\'nextmo\')\"><img name=\"NextMo\" src=\"images\/NextMoOff40x40\.jpg\" width=\"40\" height=\"40\" border=\"0\" alt=\"Next Mo\"\/><\/a><\/td>';
    	calendarString += '<td align=\"center\" valign=\"center\" width=\"40\" height=\"40\"><a href=\"#\" id=\"nextmo\" onMouseOver=\"document.NextYr.src=\'images\/NextYrOn40x40\.jpg\';\" onMouseOut=\"document.NextYr.src=\'images\/NextYrOff40x40\.jpg\';\" onClick=\"this._changedate(\'nextyr\')\"><img name=\"NextYr\" src=\"images\/NextYrOff40x40\.jpg\" width=\"40\" height=\"40\" border=\"0\" alt=\"Next Yr\"\/><\/a><\/td>';
    	calendarString += '<\/tr>';
    	calendarString += '<tr>';
    	calendarString += '<td bgcolor=\"#4A62FF\" align=\"center\" valign=\"center\" width=\"40\" height=\"22\">Sun<\/td>';
    	calendarString += '<td bgcolor=\"#4A62FF\" align=\"center\" valign=\"center\" width=\"40\" height=\"22\">Mon<\/td>';
    	calendarString += '<td bgcolor=\"#4A62FF\" align=\"center\" valign=\"center\" width=\"40\" height=\"22\">Tue<\/td>';
    	calendarString += '<td bgcolor=\"#4A62FF\" align=\"center\" valign=\"center\" width=\"40\" height=\"22\">Wed<\/td>';
    	calendarString += '<td bgcolor=\"#4A62FF\" align=\"center\" valign=\"center\" width=\"40\" height=\"22\">Thu<\/td>';
    	calendarString += '<td bgcolor=\"#4A62FF\" align=\"center\" valign=\"center\" width=\"40\" height=\"22\">Fri<\/td>';
    	calendarString += '<td bgcolor=\"#4A62FF\" align=\"center\" valign=\"center\" width=\"40\" height=\"22\">Sat<\/td>';
    	calendarString += '<\/tr>';
    	//calendarString +=	this.month;
    
    	if(thisDate == 1){
    
    	for (var i = 1; i <= 6; i++) {
    		calendarString += '<tr>';
    		for (var x = 1; x <= 7; x++) {
    			daycounter = (thisDate - firstDay)+1;
    			thisDate++;
    			if ((daycounter > numbDays) || (daycounter < 1)) {
    				calendarString += '<td align=\"center\" bgcolor=\"#888888\" height=\"30\" width=\"40\">&nbsp;<\/td>';
    			} else {
    				if (this.checkevents(daycounter,monthNum,yearNum,i,x) || ((todaysDay == x) && (todaysDate == daycounter) && (todaysMonth == monthNum))){
    					if ((todaysDay == x) && (todaysDate == daycounter) && (todaysMonth == monthNum)) {
    						calendarString += '<td align=\"center\" bgcolor=\"#FFF8C6\" height=\"30\" width=\"40\"><a href=\"javascript:this.showevents(' + daycounter + ',' + monthNum + ',' + yearNum + ',' + i + ',' + x + ')\" onClick=reset>'  + daycounter + '<\/a><\/td>';
    					}
     					else	calendarString += '<td align=\"center\" bgcolor=\"#FAAFBE\" height=\"30\" width=\"40\"><a href=\"javascript:this.showevents(' + daycounter + ',' + monthNum + ',' + yearNum + ',' + i + ',' + x + ')\" onClick=reset>'  + daycounter + '<\/a><\/td>';
    				} else {
    					calendarString += '<td align=\"center\" bgcolor=\"#DDFFFF\" height=\"30\" width=\"40\"><a href=\"javascript:this.showevents(' + daycounter + ',' + monthNum + ',' + yearNum + ',' + i + ',' + x + ')\" onClick=reset>'  + daycounter + '<\/a><\/td>';
    				}
    			}
    		}
    	
    		calendarString += '<\/tr>';
    	}
    }	
    return calendarString;
    	thisDate = 1;
    	
    };
    the next prev buttons run with this code... but when the click happen this function not going to execute..
    Code:
    com_zimbra_calendar.prototype._changedate=
    function(buttonpressed) {
    
    	var butn=buttonpressed;
    	
    if (prevYr) yearNum--;
    	else if (butn == "nextyr") yearNum++;
    	else if (butn == "prevmo") monthNum--;
    	else if (butn == "nextmo") monthNum++;
    	else  if (butn == "return") { 
    		monthNum = todaysMonth;
    		yearNum = todaysYear;
    	}
    
    	if (monthNum == 0) {
    		monthNum = 12;
    		yearNum--;
    	}
    	else if (monthNum == 13) {
    		monthNum = 1;
    		yearNum++
    	}
    
    	lastDate = new Date(String(monthNum+1)+"/0/"+String(yearNum));
    	numbDays = lastDate.getDate();
    	firstDate = new Date(String(monthNum)+"/1/"+String(yearNum));
    	firstDay = firstDate.getDay() + 1;
    	this._createCalendar();
    	return;
    };
    can some one please tell me why this is not going to work with click happend...

    thank...

  2. #2
    Join Date
    Oct 2010
    Posts
    11
    Rep Power
    5

    Default

    I mistakenly publish the code in _changedate function:
    if (prevYr) yearNum--;
    should be

    if (butn=="prevyr") yearNum--;
    and
    in the second code fragment
    onClick=\"this._changedate()\" in the 10th line should be onClick=\"this._changedate(\'prevyr\')\"

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 10:06 AM
  2. Outlook 2007 Beta error
    By bersrker in forum Zimbra Connector for Outlook
    Replies: 13
    Last Post: 07-17-2008, 08:38 AM
  3. Replies: 4
    Last Post: 02-24-2008, 02:29 PM
  4. Replies: 5
    Last Post: 01-11-2008, 05:34 AM
  5. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 11:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •