Permalink
Browse files

v. 1.3.20120318

Now allows multiple calendar IDs and Event Colors as |-delimited lists
to display events from multiple calendars on the same calendar.
'Default' extended attribute set of Component/MuraGCal class is no
longer used and is deleted on install/update - see README for details!
  • Loading branch information...
1 parent cdbc906 commit f5090dffbdffb5a81fa37ec68a43872df90efec5 @azadisaryev committed Mar 18, 2012
Showing with 382 additions and 357 deletions.
  1. +19 −10 README
  2. +55 −47 eventHandlers/gcal.cfc
  3. +12 −12 index.cfm
  4. +21 −14 plugin/config.xml.cfm
  5. +275 −274 plugin/plugin.cfc
View
@@ -2,6 +2,14 @@ This plugin extends the Component display object with a MuraGCal sub-type (creat
It allows you to create separate display objects for as many calendars as you want, each with individual display settings, and include them (individually or in any combination) into your pages.
+CHANGELOG:
+1.3.20120318
+- plugin now allows |-delimited list of Calendar IDs and Event Colors to display aggregated calendar of multiple individual calendars
+- IMPORTANT: 'Default' extended attributes set for MuraGCal component sub-type created by the plugin is no longer used and is deleted on install/update! If you have a previous version of this plugin installed and have created component(s) based on it and used the 'Default' attributes set to configure them, make sure you edit the components and copy the 'Default' settings to 'MuraGCal Settings' attributes set in the Extended Attributes tab.
+
+1.3.20111112
+- initial release in Mura Plugin Store
+
I. INSTALLATION / UPDATING
- Download the plugin ZIP file. No need to un-pack it.
- Go to Site Settings->Global Settings->Plugins tab.
@@ -15,11 +23,13 @@ Now the plugin is installed.
Updating the plugin is exactly the same, except in step 3 above first go to Plugin Settings page for MuraGCal Plugin (click on pencil icon in the plugin's row), and click 'Update Plugin Version' link.
+IMPORTANT: Updating to version 1.3.20120318 or later? READ THE IMPORTANT NOTE IN CHANGELOG ABOVE!
+
II. USE
After installing the plugin, you will have a new Component/MuraGCal component type in the Type selector on Components->Add Component page in Mura Admin.
First, create a new MuraGCal type component:
- go to Components->Add Component
-- select "Compenent / MuraGCal" under Type
+- select "Component / MuraGCal" under Type
- enter Title (some descriptive name that will tell you which calendar and view mode this component displays is best, like 'GCal - US Holidays - Month View')
- do not enter anything into Content - it will not be displayed anyway
- click on Extended Attributes tab and configure the calendar (see CONFIGURATION OPTIONS below)
@@ -31,7 +41,7 @@ To display MuraGcal calendar(s) on your page:
- open page for editing in Site Manager
- click on Content Objects tab
- select Components under Available Content Objects
-- select the calendar you want to include in the components list and add it to one of your page's display regions
+- select the calendar component(s) you want to include in the components list and add it to one of your page's display regions. *Make sure your page uses a template that has the display region you add the component to.*
- if necessary, add any other calendar components you created to the same page
- click one of the buttons at the bottom of the page to save your changes
@@ -41,11 +51,11 @@ III. CONFIGURATION OPTIONS
Available config options are the same as allowed by Google Embeddable Calendar Helper (accessible via Calendar Settings in Google Calendar).
-Google Calendar ID [required, numeric] :
-ID of Google Calendar to render. This can be found on Calendar Details tab in Google Calendar settings.
+Google Calendar ID [required, string] :
+ID(s) of Google Calendar(s) to display. This can be found on Calendar Details tab in Google Calendar settings. Separate multiple calendar IDs with | (pipe).
-Calendar Name [optional, string, default=''] :
-Name of Google Calendar. If left blank, default name of selected calendar will be used. Display can be controlled using 'Show Calendar Title?' option below.
+Calendar Title [required, string] :
+Title of Google Calendar. Display can be controlled using 'Show Calendar Title?' option (below). REQUIRED - even if you set 'Show Calendar Title' to No, you still must give the calendar a title.
Calendar Width (px) [required, numeric, default=300] :
Width of calendar container, in pixels.
@@ -80,12 +90,11 @@ Select to show or hide border around calendar container.
Week start day [default=Sunday] :
Select first day of week.
-Color [required, string, default=#36C] :
-HEX code (3 or 6 characters) of calendar's events colour.
-(Note: may be changed to a select drop-down with default Google calendar colours instead to normalize display of events and event text)
+Events Color [required, string, default=#36C] :
+Hex code (3 or 6 characters) of calendar's events colour in #xxx or #xxxxxx format, OR a |-delimited list of such if using multiple calendar IDs.
Background Color [required, string, default=#fff] :
-HEX code of calendar's background colour.
+Hex code of calendar's background colour in #xxx or #xxxxxx format.
Calendar Footer [optional, string, default=''] :
Enter text/html to display below the calendar. Experimental. Use at your own risk :)
View
@@ -1,56 +1,64 @@
<!---
MuraGCal Plugin event handler cfc.
- @version: 1.3.20111112
+ @version: 1.3.20120318
@author: Azadi Sayev azadi.saryev@gmail.com
@url: https://github.com/azadisaryev/mura-gcal-plugin
--->
<cfcomponent extends="mura.plugin.pluginGenericEventHandler">
- <cffunction name="onApplicationLoad">
- <cfargument name="$">
- <cfset variables.pluginConfig.addEventHandler(this)>
- </cffunction>
-
- <cffunction name="onRenderStart">
- <cfargument name="$">
- <cfset $.muraGCal = this>
- </cffunction>
-
- <cffunction name="onComponentMuraGCalBodyRender" output="no" returntype="string">
- <cfargument name="$">
- <cfscript>
- var cBean = $.component();
- var str = "";
- str = '<iframe class="MuraGCal_iframe" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true" src="https://www.google.com/calendar/embed?src=' & urlencodedformat($.component('GCalID')) & '&amp;showCalendars=0&amp;showTz=0&amp;mode=' & $.component('GCalMode') & '&amp;width=' & $.component('GCalWidth') & '&amp;height=' & $.component('GCalHeight') & '&amp;wkst=' & $.component('GCalWeekStart') & '&amp;bgcolor=' & urlencodedformat($.component('GCalBgColor')) & '&amp;color=' & urlencodedformat($.component('GCalColor'));
- if ( not val($.component('GCalTitle')) ) {
- str = str & '&amp;showTitle=0';
- }
- else {
- if ( len(trim($.component('GCalName'))) ) { str = str & '&amp;title=' & urlencodedformat(trim($.component('GCalName'))); }
- }
- if ( not val($.component('GCalDate')) ) { str = str & '&amp;showDate=0'; }
- if ( not val($.component('GCalTabs')) ) { str = str & '&amp;showTabs=0'; }
- if ( not val($.component('GCalNavButtons')) ) { str = str & '&amp;showNav=0'; }
- if ( not val($.component('GCalPrintIcon')) ) { str = str & '&amp;showPrint=0'; }
- str = str & '" width="' & $.component('GCalWidth') & '" height="' & $.component('GCalHeight') & '" frameborder="0" scrolling="no" style="margin:0;';
- if ( val($.component('GCalBorder')) ) {
- str = str & 'border:1px solid ##777;';
- }
- else {
- str = str & 'border-width:0;';
- }
- str = str & 'float:';
- if ( $.component('GCalPosition') eq 'Left' or $.component('GCalPosition') eq 'Right' ) {
- str = str & lcase($.component('GCalPosition')) & ';';
- }
- else {
- str = str & 'none !important;';
- }
- str = str & '"></iframe>';
- if ( len(trim($.component('GCalFooter'))) ) str = str & '<div class="MuraGCal_footer" style="clear:both;">' & trim($.component('GCalFooter')) & '</div>';
- if ( $.component('GCalPosition') eq 'Center' ) { str = '<div class="MuraGCal" style="margin:0 auto;">' & trim(str) & '</div>' }
- </cfscript>
- <cfreturn str />
- </cffunction>
+<cffunction name="onApplicationLoad">
+<cfargument name="$">
+<cfset variables.pluginConfig.addEventHandler(this)>
+</cffunction>
+
+<cffunction name="onRenderStart">
+<cfargument name="$">
+<cfset $.muraGCal = this>
+</cffunction>
+
+<cffunction name="onComponentMuraGCalBodyRender" output="no" returntype="string">
+<cfargument name="$">
+<cfscript>
+var str = "";
+var strCalsColors = "";
+var i = 1;
+var arrSources = listtoarray($.component('GCalID'), "|");
+var arrColors = listtoarray($.component('GCalColor'), "|");
+for ( i=1; i lte arraylen(arrSources); i=i+1 ) {
+ if ( arraylen(arrColors) lt i ) arrayappend(arrColors, arrColors[1]);
+ strCalsColors = strCalsColors & '&amp;src=' & urlencodedformat(arrSources[i]) & '&amp;color=' & urlencodedformat(arrColors[i]);
+}
+str = '<iframe class="MuraGCal_iframe" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="true" src="https://www.google.com/calendar/embed?showCalendars=0&amp;showTz=0' & strCalsColors & '&amp;mode=' & $.component('GCalMode') & '&amp;width=' & $.component('GCalWidth') & '&amp;height=' & $.component('GCalHeight') & '&amp;wkst=' & $.component('GCalWeekStart') & '&amp;bgcolor=' & urlencodedformat($.component('GCalBgColor'));
+if ( not val($.component('GCalTitle')) ) {
+ str = str & '&amp;showTitle=0';
+}
+else {
+ if ( len(trim($.component('GCalName'))) ) { str = str & '&amp;title=' & urlencodedformat(trim($.component('GCalName'))); }
+}
+if ( not val($.component('GCalDate')) ) { str = str & '&amp;showDate=0'; }
+if ( not val($.component('GCalTabs')) ) { str = str & '&amp;showTabs=0'; }
+if ( not val($.component('GCalNavButtons')) ) { str = str & '&amp;showNav=0'; }
+if ( not val($.component('GCalPrintIcon')) ) { str = str & '&amp;showPrint=0'; }
+str = str & '" width="' & $.component('GCalWidth') & '" height="' & $.component('GCalHeight') & '" frameborder="0" scrolling="no" style="margin:0;';
+if ( val($.component('GCalBorder')) ) {
+ str = str & 'border:1px solid ##777;';
+}
+else {
+ str = str & 'border-width:0;';
+}
+str = str & 'float:';
+if ( $.component('GCalPosition') eq 'Left' or $.component('GCalPosition') eq 'Right' ) {
+ str = str & lcase($.component('GCalPosition')) & ';';
+}
+else {
+ str = str & 'none !important;';
+}
+str = str & '"></iframe>';
+if ( len(trim($.component('GCalFooter'))) ) str = str & '<div class="MuraGCal_footer" style="clear:both;">' & trim($.component('GCalFooter')) & '</div>';
+if ( $.component('GCalPosition') eq 'Center' ) { str = '<div class="MuraGCal" style="margin:0 auto;">' & trim(str) & '</div>' }
+
+return str;
+</cfscript>
+</cffunction>
</cfcomponent>
View
@@ -1,17 +1,17 @@
<cfinclude template="plugin/config.cfm" />
<cfsavecontent variable="readme"><cfinclude template="README" /></cfsavecontent>
<cfsavecontent variable="body">
-<cfoutput>
-<p>MuraGCal Mura plugin v1.3.20111112</p>
-<p>Azadi Saryev | azadi.saryev@gmail.com</p>
-<p>@license: CC Attribution Sharealike</p>
-<p>Configurable Plugin to display a public Google Calendar.</p>
+<p>MuraGCal Mura plugin v1.3.20120318</p>
+<p>Configurable Plugin to display a public Google Calendars.</p>
<p>Creates an Extended Component Class Component/MuraGCal.</p>
-<!---<p>#listchangedelims(readme, '<br />', chr(10)&chr(13))#</p>--->
-<textarea style="width:100%; height:300px">#readme#</textarea>
-</cfoutput>
+<p>@author: Azadi Saryev | azadi.saryev@gmail.com</p>
+<p>@license: CC Attribution Sharealike</p>
+<p>@source: <a href="https://github.com/azadisaryev/mura-gcal-plugin" target="_blank">https://github.com/azadisaryev/mura-gcal-plugin</a></p>
+<p>@readme: <a href="https://github.com/azadisaryev/mura-gcal-plugin#readme" target="_blank">https://github.com/azadisaryev/mura-gcal-plugin#readme</a></p>
+<p><strong>IMPORTANT:</strong><br />
+Version 1.3.20120318 and later of this plugin no longer use <em>'Default'</em> extended attributes set of the Component/MuraGCal component class. <em>'Default'</em> extendset is deleted on install/update of the plugin.<br /><br />
+<!---If you are updating previous version of this plugin, and you used the 'Default' extended attributes set of the components you created based on this plugin - they will be deleted.--->
+Before updatng the plugin, make sure you update any components you created based on this plugin and configure the 'MuraGCal Settings' extended attributes set in them (on the Extended Attributes tab).</p>
+<textarea style="width:100%; height:600px"><cfoutput>#readme#</cfoutput></textarea>
</cfsavecontent>
-<cfoutput>
-#application.pluginManager.renderAdminTemplate(body=body,pageTitle=request.pluginConfig.getName())#
-</cfoutput>
-
+<cfoutput>#application.pluginManager.renderAdminTemplate(body=body,pageTitle=request.pluginConfig.getName())#</cfoutput>
View
@@ -1,15 +1,18 @@
-<cfoutput><plugin>
+<cfoutput>
+<plugin>
+
<name>MuraGCal Plugin</name>
<package>MuraGCal</package>
-<version>1.3.20111113</version>
+<version>1.3.20120318</version>
<provider>Azadi Saryev</provider>
<providerURL>https://github.com/azadisaryev/mura-gcal-plugin</providerURL>
<category>Utility</category>
+
<settings>
<setting>
<name>GCalID</name>
<label>Google Calendar ID</label>
- <hint>ID of Google Calendar to render. This can be found on Calendar Details tab in Google Calendar settings.</hint>
+ <hint>ID(s) of Google Calendar(s) to render. This can be found on Calendar Details tab in Google Calendar settings. Separate multiple IDs with | (pipe).</hint>
<type>textBox</type>
<required>false</required>
<validation></validation>
@@ -21,13 +24,13 @@
</setting>
<setting>
<name>GCalName</name>
- <label>Google Calendar Title</label>
- <hint>Title of Google Calendar. If blank, default name of selected Calendar will be used. Control display using 'Show Calendar Title?' option below.</hint>
+ <label>Calendar Title</label>
+ <hint>Title of this Calendar. Control display using 'Show Calendar Title?' option below.</hint>
<type>textBox</type>
<required>false</required>
<validation></validation>
<regex></regex>
- <message>Calendar Name is required</message>
+ <message>Calendar Title is required</message>
<defaultvalue></defaultvalue>
<optionlist></optionlist>
<optionlabellist></optionlabellist>
@@ -177,26 +180,26 @@
</setting>
<setting>
<name>GCalColor</name>
- <label>Color</label>
- <hint>Type Hex code of calendar events' color</hint>
+ <label>Event Colors</label>
+ <hint>Hex code of calendar events' color in ##xxx or ##xxxxxx format. If using multiple calendars, separate colors for each with | (pipe). First color is assumed as default and will be used for any calendar which does not have a color specified (i.e. if you specified 3 calendar IDs but only 2 colors, the 3rd calendar will be displayed using the first color code here).</hint>
<type>textBox</type>
<required>no</required>
<validation>regex</validation>
- <regex>^##([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$</regex>
- <message>Color must be a valid Hex code in ##XXX or ##XXXXXX format</message>
+ <regex>^(##([0-9a-fA-F]{3}){1,2}\|?)+$</regex>
+ <message>Color must be a valid Hex code in ##xxx or ##xxxxxx format, or a |-delimited list of these.</message>
<defaultvalue>##36C</defaultvalue>
<optionlist></optionlist>
<optionlabellist></optionlabellist>
</setting>
<setting>
<name>GCalBgColor</name>
<label>Background Color</label>
- <hint>Type Hex code of calendar' background color</hint>
+ <hint>Type Hex code of calendar' background color in ##xxx or ##xxxxxx format.</hint>
<type>textBox</type>
<required>no</required>
<validation>regex</validation>
- <regex>^##([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$</regex>
- <message>Background Color must be a valid Hex code in ##XXX or ##XXXXXX format</message>
+ <regex>^##([0-9a-fA-F]{3}){1,2}$</regex>
+ <message>Background Color must be a valid Hex code in ##xxx or ##xxxxxx format.</message>
<defaultvalue>##FFF</defaultvalue>
<optionlist></optionlist>
<optionlabellist></optionlabellist>
@@ -215,8 +218,12 @@
<optionlabellist></optionlabellist>
</setting>
</settings>
+
<eventHandlers>
<eventHandler event="onApplicationLoad" component="eventHandlers.gcal" persist="false"/>
</eventHandlers>
+
<displayobjects location="global"/>
-</plugin></cfoutput>
+
+</plugin>
+</cfoutput>
Oops, something went wrong.

0 comments on commit f5090df

Please sign in to comment.