I have created calender using jQuery lib please find the code below:
It's working fine in developer Edition. But same code if I copy in partner enterprise edition it's not displaying information:
Vf page:
<apex:page controller="CalendarExample_Controller" action="{!pageLoad}" sidebar="false" showHeader="true">
<link href="{!$Resource.fullCalendarCSS}" rel="stylesheet" />
<link href="{!$Resource.fullCalendarPrintCSS}" rel="stylesheet" media="print" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="{!$Resource.fullCalendarMinJS}"></script>
<script>
//We need to wrap everything in a doc.ready function so that the code fires after the DOM is loaded
$(document).ready(function() {
//Call the fullCallendar method. You can replace the '#calendar' with the ID of the dom element where you want the calendar to go.
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events:
[
//At run time, this APEX Repeat will reneder the array elements for the events array
<apex:repeat value="{!events}" var="e">
{
title: "{!e.title}",
Stage:"{!e.stage}",
start: '{!e.startString}',
end: '{!e.endString}',
url: '{!e.url}',
allDay: {!e.allDay},
className: '{!e.className}'
},
</apex:repeat>
]
});
});
</script>
<!--some styling. Modify this to fit your needs-->
<style>
#cal-options {float:left;}
#cal-legend { float:right;}
#cal-legend ul {margin:0;padding:0;list-style:none;}
#cal-legend ul li {margin:0;padding:5px;float:left;}
#cal-legend ul li span {display:block; height:16px; width:16px; margin-right:4px; float:left; border-radius:4px;}
#calendar {margin-top:20px;}
#calendar a:hover {color:#fff !important;}
.fc-event-inner {padding:3px;}
.event-birthday {background:#56458c;border-color:#56458c;}
.event-campaign {background:#cc9933;border-color:#cc9933;}
.event-personal {background:#1797c0;border-color:#1797c0;}
.event-Asif {background:#00FF00;border-color:#1797c0;}
.event-Asif1 {background:#1797c0;border-color:#cc9933;}
</style>
<apex:sectionHeader title="Asif Calender"/>
<apex:outputPanel id="calPanel">
<apex:form >
<div id="cal-options">
<apex:commandButton value="{!IF(includeMyEvents,'Hide My Events','Show My Events')}" action="{!toggleMyEvents}"/>
</div>
<div id="cal-legend">
<ul>
<li><span class="event-Asif1"></span>Tentative</li>
<li><span class="event-Asif"></span>Confirmed</li>
<!-- <li style="{!IF(includeMyEvents,'','display:none')}"><span class="event-personal"></span>My Events</li>-->
</ul>
<div style="clear:both;">
<!--fix floats-->
</div>
</div>
<div style="clear:both;">
<!--fix floats-->
</div>
<div id="calendar">
<!-- <apex:datatable value="{!events}" var="e">
<apex:column > <a href="/{!e.Id}" id="{!e.Id}" onblur="LookupHoverDetail.getHover('{!e.Id}').hide();" onfocus="LookupHoverDetail.getHover('{!e.Id}', '/{!e.Id}/m?retURL=%2F{!e.Id}&isAjaxRequest=1').show();" onmouseout="LookupHoverDetail.getHover('{!e.Id}').hide();" onmouseover="LookupHoverDetail.getHover('{!e.Id}', '/{!e.Id}/m?retURL=%2F{!e.Id}&isAjaxRequest=1').show();">{!e.title}</a></apex:column>
</apex:datatable>-->
</div>
</apex:form>
</apex:outputPanel>
</apex:page>
Controller:
public class CalendarExample_Controller {
public Boolean includeMyEvents {get; set;}
public list<calEvent> events {get; set;}
String dtFormat = 'EEE,d MMM yyyy HH:mm:ss z';
public CalendarExample_Controller() {
includeMyEvents = true;
}
public PageReference pageLoad() {
events = new list<calEvent>();
for (Contact cont : [select Id, Birthdate, FirstName, LastName from Contact where Birthdate != null]) {
DateTime startDT = datetime.newInstance(Date.Today().Year(), cont.Birthdate.Month(), cont.Birthdate.Day());
calEvent bday = new calEvent();
bday.title = cont.FirstName + ' ' + cont.LastName + '\'s Birthday!';
bday.allDay = true;
bday.startString = startDT.format(dtFormat);
bday.endString = '';
bday.url = '/' + cont.Id;
bday.className = 'event-birthday';
events.add(bday);
}
for (Campaign camp : [select Id, Name, StartDate, EndDate from Campaign where IsActive = true]) {
DateTime startDT = camp.StartDate;
DateTime endDT = camp.EndDate;
calEvent campEvent = new calEvent();
campEvent.title = camp.Name;
campEvent.allDay = true;
campEvent.startString = startDT.format(dtFormat);
campEvent.endString = endDT.format(dtFormat);
campEvent.url = '/' + camp.Id;
campEvent.className = 'event-campaign';
events.add(campEvent);
}
for (Opportunity camp : [select Id, Name, CloseDate, StageName from Opportunity where StageName = 'Closed Won']) {
DateTime startDT = camp.CloseDate;
calEvent campEvent = new calEvent();
campEvent.title = camp.Name;
campEvent.allDay = true;
campEvent.startString = startDT.format(dtFormat);
campEvent.url = '/' + camp.Id;
campEvent.className = 'event-Asif';
events.add(campEvent);
}
for (Opportunity camp : [select Id, Name, CloseDate, StageName from Opportunity where StageName != 'Closed Won']) {
DateTime startDT = camp.CloseDate;
calEvent campEvent = new calEvent();
campEvent.title = camp.Name;
campEvent.allDay = true;
campEvent.startString = startDT.format(dtFormat);
campEvent.url = '/' + camp.Id;
campEvent.className = 'event-Asif1';
events.add(campEvent);
}
if (includeMyEvents) {
for (Event evnt : [select Id, Subject, isAllDayEvent, StartDateTime, EndDateTime from Event where OwnerID = :UserInfo.getUserId()]) {
DateTime startDT = evnt.StartDateTime;
DateTime endDT = evnt.EndDateTime;
calEvent myEvent = new calEvent();
myEvent.title = evnt.Subject;
myEvent.allDay = evnt.isAllDayEvent;
myEvent.startString = startDT.format(dtFormat);
myEvent.endString = endDT.format(dtFormat);
myEvent.url = '/' + evnt.Id;
myEvent.className = 'event-personal';
events.add(myEvent);
}
}
return null;
}
public PageReference toggleMyEvents() {
if (includeMyEvents) {
includeMyEvents = false;
} else {
includeMyEvents = true;
}
pageload();
return null;
}
public class calEvent {
public String title {get; set;}
public Boolean allDay {get; set;}
public String startString {get; set;}
public String endString {get; set;}
public String url {get; set;}
public String className {get; set;}
}
}
jQuery.noConflict()
andapex:includeScript
. Check following topics: jQuery plugin noConflict, Page cannot use jQuery Plugin as it's registered with $ from Sidebar component