Commit 9209f9a2 authored by Timothy Steiner's avatar Timothy Steiner
Browse files

[#642] Adding a button for adding event calendar displays.

parent 4431f45b
......@@ -304,6 +304,24 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
}
});
ed.addButton('unlEventMonthWidget', {title: 'Add Month Widget', cmd : 'mceUnlEventMonthWidget', 'class' : 'unlEventMonthWidget'});
ed.addCommand('mceUnlEventCalendarDisplay', function() {
ed.windowManager.open({
file: url + '/event-calendardisplay.html',
width: 500,
height: 200,
inline: 1
});
});
ed.onNodeChange.addToTop(function(ed, cm, n) {
cm.setActive('unlEventCalendarDisplay', n.id == 'wdn_calendarDisplay');
if (n.id == 'wdn_calendarDisplay') {
ed.selection.select(n);
}
});
ed.addButton('unlEventCalendarDisplay', {title: 'Add Calendar Display', cmd : 'mceUnlEventCalendarDisplay', 'class' : 'unlEventCalendarDisplay'});
},
/**
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Add Event Calendar Display</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="../../utils/mctabs.js"></script>
<script type="text/javascript" src="../../utils/form_utils.js"></script>
<script type="text/javascript" src="../../utils/validate.js"></script>
<script type="text/javascript" src="js/event-calendardisplay.js"></script>
<script type="text/javascript" src="editor_plugin.js"></script>
</head>
<body id="link" style="display: none">
<form action="#" id="unlEventCalendarDisplayForm">
<div class="tabs">
<ul>
<li id="general_tab" class="current">
<span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">Add Event Calendar Display</a></span>
</li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td class="nowrap"><label for="href">Event Name:</label></td>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<input id="unlEventName" name="unlEventName" type="text" class="mceFocus" value="" style="width: 200px"" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="nowrap"><label for="href">Event URI:</label></td>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<input id="unlEventUri" name="unlEventUri" type="text" class="mceFocus" value="" style="width: 200px"" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="nowrap"><label for="href">Number Of Events To List:</label></td>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<input id="unlEventLimit" name="unlEventLimit" type="text" class="mceFocus" value="" style="width: 200px"" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
<div class="mceActionPanel">
<input type="submit" id="insert" name="insert" value="Add Event Calendar Display" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
</html>
tinyMCEPopup.requireLangPack();
var UnlCalendarDisplayDialog = {
init : function() {
var selection = tinyMCEPopup.editor.selection;
var node = selection.getNode();
if (node && node.id == 'wdn_calendarDisplay') {
var matches = selection.getContent().match(/UNLevent_monthWidget\.init\(([^)]*)\)/i);
var calendarUri = matches[1].substr(1, matches[1].length - 2);
document.getElementById('unlEventUri').value = calendarUri;
UnlCalendarDisplayDialog.calendarUri = calendarUri;
}
document.getElementById('unlEventCalendarDisplayForm').onsubmit = UnlCalendarDisplayDialog.submit;
},
submit : function() {
var selection = tinyMCEPopup.editor.selection;
var eventName = document.getElementById('unlEventName').value;
var eventUri = document.getElementById('unlEventUri').value;
var eventLimit = document.getElementById('unlEventLimit').value;
var node = selection.getNode();
if (node && node.id == 'wdn_calendarDisplay') {
var html = selection.getContent()
selection.setContent(html.replace(UnlCalendarDisplayDialog.calendarUri, eventUri));
} else {
selection.setContent("<div id=\"wdn_calendarDisplay\"><script type=\"text/javascript\">WDN.initializePlugin('events', function(){WDN.events.calTitle = \"" + eventName + "\";WDN.events.calURL = \"" + eventUri + "\";WDN.events.limit=" + eventLimit + ";WDN.events.initialize();});</script></div>");
}
tinyMCEPopup.close();
return false;
},
calendarUri : ''
};
tinyMCEPopup.onInit.add(UnlCalendarDisplayDialog.init, UnlCalendarDisplayDialog);
......@@ -61,5 +61,13 @@ scrollbar-track-color:#F5F5F5;
#monthwidget {
width:206px;
height:196px;
background-image:url("img/monthwidget.png");
background-image:url(img/monthwidget.png);
}
#wdn_calendarDisplay {
width:100%;
height:300px;
background-image:url(img/upcoming-header.png),url(img/upcoming-item.png);
background-repeat: no-repeat, repeat-y;
background-position: 0px 0px, 0px 54px;
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment