|
CalendarXP.net Support Most forums here are private and invisible to public.
|
View previous topic :: View next topic |
Author |
Message |
jackb
Joined: 11 Sep 2006 Posts: 27
|
Posted: Thu Sep 14, 2006 8:06 am Post subject: Open new url in current window when date is clicked |
|
|
I can't seem to figure out how to get this function to work. I have read and tried the sticky here and also looked and folled the section in the tutorials.
I have set the gAgendaMask for "action" to -1 and I have tested with the sample code in tutorial -->
fAddEvent(2004,1,18," Hello World! ", "popup('/anypath/mypage.html', '_top')", "#87ceeb", "dodgerblue", null, "gold");
All of the other paramaters seem to work fine, except for the action one.
Please Help!
Cheers,
Joe
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Thu Sep 14, 2006 12:12 pm Post subject: |
|
|
Did you see any errors in the javascript console when using FireFox? If so, what are they?
I'd suggest checking the plugins.js first to make sure the popup() function is defined there.
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
jackb
Joined: 11 Sep 2006 Posts: 27
|
Posted: Thu Sep 14, 2006 6:44 pm Post subject: Open new url |
|
|
No Errors received in javascript console when using FireFox or Explorer.
popup() function is defined in plugins.js as follows:
function popup(url,framename) {
var w=parent.open(url,framename,"top=200,left=200,width=400,height=200,scrollbars=1,resizable=1");
if (w&&url.split(":")[0]=="mailto") w.close();
else if (w&&!framename) w.focus();
}
Here is a copy of the js that is rendered for this agenda:
fAddEvent(2006,9,30,"","popup('/anypath/mypage.html', '_top')",
"0000ff","","","","");
fAddEvent(2006,9,28,"","popup('/anypath/mypage.html', '_top')",
"0000ff","","","","");
fAddEvent(2006,9,20,"","popup('/anypath/mypage.html', '_top')",
"0000ff","","","","");
I also tried the "popup" function in the html bit using your example:
fAddEvent(2006,9,20," Hello World! ", "", "#87ceeb", "dodgerblue", null, false, "<div align=left class='MsgBoard' onmousedown='popup(\"mailto:who@anyemail.address?subject=test\", \"_blank\")'>My Meeting</div>");
And it worked fine
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Fri Sep 15, 2006 3:20 am Post subject: |
|
|
It's because the calendar will automatically disable the action parameter if the fgcolor is set to "", which means to use the same color as background color.
Simply modify your script be like following will solve the problem:
Code: | fAddEvent(2006,9,30,"","popup('/anypath/mypage.html', '_top')",
"#0000ff","null","","",""); |
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
jackb
Joined: 11 Sep 2006 Posts: 27
|
Posted: Fri Sep 15, 2006 3:37 am Post subject: still dosn't work |
|
|
I set fgcolor to null and also tried setting it to a color code, but still nothing. When I click the date it just renders the "selected" color.
Joe
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Fri Sep 15, 2006 3:54 am Post subject: |
|
|
Could you please make sure to clear the browser cache before trying?
Do you have a link for us to test? If not, please let us know which demo or theme you are working with (as we've tested the above with the Mockup theme that works smoothly).
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
jackb
Joined: 11 Sep 2006 Posts: 27
|
Posted: Fri Sep 15, 2006 4:19 am Post subject: |
|
|
I am using the "normal" theme.
Attatched is a sample link
Last edited by jackb on Sat Sep 16, 2006 9:42 am; edited 1 time in total |
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Fri Sep 15, 2006 4:58 am Post subject: |
|
|
OK, I got it - you are using multi-select plugin which disables the default setDate action to achieve multiple selections. Check the last line in fOnDrag():
Code: | return true; // cancel setDate action, 'cause we use multi-select now. |
Once setDate being cancelled, the action parameter will never be called.
Because multi-select and jump-to-new-link are 2 mutually exclusive functions, you can only have 1 of them at the same time.
In your case, you may simply remove the fOnDrag() from your plugins1.js so that the setDate(), which in turn activates the popup(), can be functional.
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
jackb
Joined: 11 Sep 2006 Posts: 27
|
Posted: Fri Sep 15, 2006 5:53 am Post subject: |
|
|
Thanks! I think we are almost there - O.K. so now it works that when I click an agenda with the action set it takes me to a new url. But correcting for the one problem now creates more problems
1. Now I can't select a individule date.
2. I can select the "multiple days - by clicking on the day of the week at the top of the calenda" but it also selects the agenda days. Is there a way to keep this function but have it not select the agenda days?
Basically, I can do without the OnDrag, but I still need to be able to select multiple dates to send to the database. And dates that are already in the database (and thus are highlighted in the agenda) sould not be selectable. As I do not want to duplicate them in the database.
Is there some other adjustment I can make so that I am still able to select dates that are not in the ajenda? Can we put some kind of if{}else{} statement in so that if the date has an agenda the setDate is cancelled, else it is available?
Thanks
Joe
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Sat Sep 16, 2006 4:48 pm Post subject: |
|
|
Joe, sorry for the delay as we were trying to create a solution for you.
Here is it:
1) Replace the fAddRange() in plugins.js with the following one:
Code: | function fAddRange(y,m,d,bBatch) {
var dt=Date.UTC(y,m-1,d);
if (_ls==null||!bBatch) {
fAddDate(y,m,d);
_ls=dt;
_pds.push([dt,dt]);
} else {
var pd=[_ls,_ls];
_ls=dt;
if (dt<pd[0]) pd[0]=dt;
else if (pd[1]<dt) pd[1]=dt;
for (var i=pd[0];i<=pd[1];i+=MILLIDAY) {
var di=new Date(i);
var he=fGetEvent(di.getUTCFullYear(), di.getUTCMonth()+1,di.getUTCDate());
if (he&&he[1].length>1) {
var tpd = pd.slice(0);
tpd[1] = new Date(i-MILLIDAY);
_pds.push(tpd);
pd[0] = new Date(i+MILLIDAY);
} else
fAddDate(di.getUTCFullYear(),di.getUTCMonth()+1,di.getUTCDate());
}
_pds.push(pd);
}
fMergePDS();
} |
2) Replace the fOnDrag() with the following one:
Code: | function fOnDrag(y,m,d,aStat,e) {
if (aStat==2) return false; // discard dragover
var bRangeClick=true;
if (aStat==0) {
bRangeClick=e?fCheckKeyPressed(1+2+4,e):false;
}
var ag=fGetAgenda(y,m,d,true);
if (ag==null||ag[1]&&ag[1].length>1) return false;
if (fIsSelected(y,m,d))
fRemoveRange(y,m,d,bRangeClick||(e?e.button==2||e.which==3:false));
else
fAddRange(y,m,d,bRangeClick);
fRepaint();
return false;
} |
3) Clear your browser cache and reload the page - now all agendas with an action string, whose length is more than 1 char, will be excluded from the selection.
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
jackb
Joined: 11 Sep 2006 Posts: 27
|
Posted: Sat Sep 16, 2006 6:58 pm Post subject: |
|
|
Thats great!
Just one more thing and we will have a truly all in one calendar.
Can you please post the code adjustment needed for
function fOnDoWClick so that when the (day of week) is clicked it does not select any dates with agendas. Right now it avoids agenda's without the action param (which is good), but it still selects agendas with the action param.
Thank you very much!
Joe
|
|
Back to top |
|
|
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Sun Sep 17, 2006 3:57 pm Post subject: |
|
|
Please use the following code to replace the ones in plugins.js:
Code: | ////////////////// Calendar fOnWeekClick Handler ///////////////////////
// It's triggered when the week number is clicked.
// NOTE: DO NOT define this handler unless you really need to use it.
////////////////////////////////////////////////////////////////////
function fOnWeekClick(year, weekNo) {
var wmark=fGetEvent(year, -weekNo, 0);
for (var i=1; i<=7; i++) {
var dts=fW2Date(year,weekNo,i);
var ag=fGetAgenda(dts[0],dts[1],dts[2],true);
if (ag==null||ag[1]&&ag[1].length>1)
continue;
if (wmark) {
fRemoveRange(dts[0],dts[1],dts[2],false);
} else {
fAddRange(dts[0],dts[1],dts[2],false);
}
}
if (wmark) {
fRemoveEvent(year, -weekNo, 0);
} else {
fAddEvent(year, -weekNo, 0, "selected");
}
fRepaint();
}
////////////////// Calendar fOnDoWClick Handler ///////////////////////
// It's triggered when the week head (day of week) is clicked.
// dow ranged from 0-6 while 0 denotes Sunday, 6 denotes Saturday.
// NOTE: DO NOT define this handler unless you really need to use it.
////////////////////////////////////////////////////////////////////
function fOnDoWClick(year, month, dow) {
var dmark=fGetEvent(year, month, -1-dow);
var eom=fGetDays(year)[month];
var d=fGetDateByDOW(year,month,1,dow);
while (d<=eom) {
var ag=fGetAgenda(year,month,d,true);
if (!(ag==null||ag[1]&&ag[1].length>1))
if (dmark) {
fRemoveRange(year,month,d,false);
} else {
fAddRange(year,month,d,false);
}
d+=7;
}
if (dmark) {
fRemoveEvent(year, month, -1-dow);
} else {
fAddEvent(year, month, -1-dow, "selected");
}
fRepaint();
}
|
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
|
jackb
Joined: 11 Sep 2006 Posts: 27
|
Posted: Sun Sep 17, 2006 7:43 pm Post subject: Thank you |
|
|
Thats it!
Thank you so much for your time! Your calendar is absolutly AWESOME!!!
Thanks!!!!!!!!!!!!!!!!!!!!
Joe
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group
|