Thanks Joe, I have selected mojoPortal now and figured out how to get my free event listings from www.onesportevent.com displaying from your advice, looks really good even inside the default skin!
I've included my source code as I think it would be helpful for other developers to know how to include Javascript or CSS files inside mojoportal in their own modules, don't think we have a section in the docs on that yet. The Javascript was simple enough, the css required a slightly different approach to get it into the page header, like most things, also simple when you know how... just finding the right two lines of code is the tricky part :)
cheers
ewart.
<%@ Control Language="C#" ClassName="OneSportEvent.ascx" Inherits="mojoPortal.Web.SiteModuleControl" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="mojoPortal.Business" %>
<%@ Import Namespace="mojoPortal.Business.WebHelpers" %>
<%@ Import Namespace="mojoPortal.Web.Framework" %>
<%@ Import Namespace="mojoPortal.Web.Controls" %>
<%@ Import Namespace="mojoPortal.Web.Editor" %>
<%@ Import Namespace="mojoPortal.Net" %>
<script runat="server">
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
protected void Page_Load(object sender, EventArgs e)
{
LoadSettings();
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
SetupInstanceScript();
}
private void MakeScriptRunOnStartup()
{
// Script to run on startup
StringBuilder startupScript = new StringBuilder();
startupScript.Append("\n<script type='text/javascript'>");
startupScript.Append("\noseInitEvents();");
startupScript.Append("<" + "/script>");
// Register the startup script
this.Page.ClientScript.RegisterStartupScript(this.GetType(), this.UniqueID + "StartUpScript", startupScript.ToString());
}
public void RegisterStyleSheet()
{
// Add the css include file - can use your own style for formatting
string szCSSLink = "<link href='http://onesportevent.com/API/v3/Styles/oseDefault.css' rel='stylesheet' type='text/css' />";
LiteralControl lcLiteralControl = new LiteralControl(szCSSLink);
this.Page.Header.Controls.Add(lcLiteralControl);
}
private void RegisterApiJavascriptInclude()
{
// The <script> tag has to be split to avoid a ms design-fault build error
// Use the correct API version and WebKey per OneSportEvent api
// Documentation is: http://www.onesportevent.com/plugins/default.aspx
StringBuilder script = new StringBuilder();
script.Append("\n<script type='text/javascript' src='http://onesportevent.com/API/v3/EventAPI.aspx?WebKey=www.testwebkey.com'>");
script.Append("<" + "/script>");
this.Page.ClientScript.RegisterClientScriptBlock(
this.GetType(),
this.UniqueID,
script.ToString());
}
private void SetupInstanceScript()
{
MakeScriptRunOnStartup();
RegisterStyleSheet();
RegisterApiJavascriptInclude();
}
private void LoadSettings()
{
Title1.Visible = !this.RenderInWebPartMode;
if (this.ModuleConfiguration != null)
{
this.Title = this.ModuleConfiguration.ModuleTitle;
this.Description = this.ModuleConfiguration.FeatureName;
}
}
</script>
<mp:CornerRounderTop ID="ctop1" runat="server" />
<asp:Panel ID="pnlWrapper" runat="server" CssClass="panelwrapper linksmodule">
<asp:UpdatePanel ID="upGallery" UpdateMode="Conditional" runat="server">
<contenttemplate>
<portal:ModuleTitleControl id="Title1" runat="server" />
<asp:Panel ID="pnlMyClass" runat="server" CssClass="modulecontent">
<div id="oseEventCanvas"></div>
</asp:Panel>
<div class="modulefooter"></div>
</contenttemplate>
</asp:UpdatePanel>
</asp:Panel>
<mp:CornerRounderBottom ID="cbottom1" runat="server" />