DO NOT DOWNLOAD. YOU KNOW THE DRILL

more ie8 bug fixing

[TFS Changeset #60263]
This commit is contained in:
slace
2009-10-19 13:14:53 +00:00
parent 48bc230d38
commit 4a76637b69
2 changed files with 110 additions and 96 deletions

View File

@@ -5,6 +5,7 @@ using umbraco.cms.presentation.Trees;
using ClientDependency.Core;
using umbraco.presentation;
using ClientDependency.Core.Controls;
using umbraco.interfaces;
namespace umbraco.editorControls
{
/// <summary>
@@ -15,7 +16,7 @@ namespace umbraco.editorControls
//TODO: Work out how to include this: , InvokeJavascriptMethodOnLoad = "initPopUp"
[ClientDependency(102, ClientDependencyType.Javascript, "js/submodal/submodal.js", "UmbracoRoot")]
[ValidationProperty("Value")]
public class mediaChooser : System.Web.UI.WebControls.HiddenField, interfaces.IDataEditor
public class mediaChooser : System.Web.UI.WebControls.HiddenField, IDataEditor
{
interfaces.IData _data;
bool _showpreview;
@@ -26,6 +27,12 @@ namespace umbraco.editorControls
_data = Data;
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
Page.ClientScript.RegisterStartupScript(typeof(IDataEditor), "initPopUp", "jQuery(document).ready(function() { initPopUp(); } );", true);
}
public mediaChooser(interfaces.IData Data, bool ShowPreview, bool ShowAdvanced)
{
_data = Data;

View File

@@ -5,120 +5,127 @@ using umbraco.cms.presentation.Trees;
using ClientDependency.Core;
using umbraco.presentation;
using ClientDependency.Core.Controls;
using umbraco.interfaces;
namespace umbraco.editorControls
{
/// <summary>
/// Summary description for pagePicker.
/// </summary>
[ClientDependency(100, ClientDependencyType.Css, "js/submodal/submodal.css", "UmbracoRoot")]
/// <summary>
/// Summary description for pagePicker.
/// </summary>
[ClientDependency(100, ClientDependencyType.Css, "js/submodal/submodal.css", "UmbracoRoot")]
[ClientDependency(101, ClientDependencyType.Javascript, "js/submodal/common.js", "UmbracoRoot")]
//TODO: Work out how to include this: , InvokeJavascriptMethodOnLoad = "initPopUp"
[ClientDependency(102, ClientDependencyType.Javascript, "js/submodal/submodal.js", "UmbracoRoot")]
[ClientDependency(102, ClientDependencyType.Javascript, "js/submodal/submodal.js", "UmbracoRoot")]
[ValidationProperty("Value")]
public class pagePicker : System.Web.UI.WebControls.HiddenField, interfaces.IDataEditor
{
interfaces.IData _data;
public pagePicker(interfaces.IData Data)
{
_data = Data;
}
#region IDataField Members
public class pagePicker : System.Web.UI.WebControls.HiddenField, IDataEditor
{
interfaces.IData _data;
public pagePicker(interfaces.IData Data)
{
_data = Data;
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
Page.ClientScript.RegisterStartupScript(typeof(IDataEditor), "initPopUp", "jQuery(document).ready(function() { initPopUp(); } );", true);
}
//private string _text;
#region IDataField Members
//private string _text;
public System.Web.UI.Control Editor { get { return this; } }
public System.Web.UI.Control Editor { get { return this; } }
public virtual bool TreatAsRichTextEditor
{
get { return false; }
}
public bool ShowLabel
{
get
{
return true;
}
}
public virtual bool TreatAsRichTextEditor
{
get { return false; }
}
public bool ShowLabel
{
get
{
return true;
}
}
public void Save()
{
//_text = helper.Request(this.ClientID);
if (base.Value.Trim() != "")
_data.Value = base.Value.Trim();
else
_data.Value = null;
}
public void Save()
{
//_text = helper.Request(this.ClientID);
if (base.Value.Trim() != "")
_data.Value = base.Value.Trim();
else
_data.Value = null;
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// We need to make sure we have a reference to the legacy ajax calls in the scriptmanager
if (!UmbracoContext.Current.LiveEditingContext.Enabled)
presentation.webservices.ajaxHelpers.EnsureLegacyCalls(base.Page);
else
ClientDependencyLoader.Instance.RegisterDependency("webservices/legacyAjaxCalls.asmx/js", "UmbracoRoot", ClientDependencyType.Javascript);
if (!UmbracoContext.Current.LiveEditingContext.Enabled)
presentation.webservices.ajaxHelpers.EnsureLegacyCalls(base.Page);
else
ClientDependencyLoader.Instance.RegisterDependency("webservices/legacyAjaxCalls.asmx/js", "UmbracoRoot", ClientDependencyType.Javascript);
if (_data != null && _data.Value != null)
base.Value = _data.Value.ToString();
}
base.Value = _data.Value.ToString();
}
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
string tempTitle = "";
string deleteLink = " &nbsp; <a href=\"javascript:" + this.ClientID + "_clear();\" style=\"color: red\">" + ui.Text("delete") + "</a> &nbsp; ";
try
{
if (base.Value.Trim() != "")
{
tempTitle = new cms.businesslogic.CMSNode(int.Parse(base.Value.Trim())).Text;
}
}
catch { }
string tempTitle = "";
string deleteLink = " &nbsp; <a href=\"javascript:" + this.ClientID + "_clear();\" style=\"color: red\">" + ui.Text("delete") + "</a> &nbsp; ";
try
{
if (base.Value.Trim() != "")
{
tempTitle = new cms.businesslogic.CMSNode(int.Parse(base.Value.Trim())).Text;
}
}
catch { }
string strScript = "function " + this.ClientID + "_chooseId() {" +
"\nshowPopWin('" + TreeService.GetPickerUrl(true,"content","content") + "', 300, 400, " + ClientID + "_saveId);" +
//"\nvar treePicker = window.showModalDialog(, 'treePicker', 'dialogWidth=350px;dialogHeight=300px;scrollbars=no;center=yes;border=thin;help=no;status=no') " +
"\n}" +
"\nfunction " + ClientID + "_saveId(treePicker) {" +
"\nsetTimeout('" + ClientID + "_saveIdDo(' + treePicker + ')', 200);" +
"\n}" +
"\nfunction " + ClientID + "_saveIdDo(treePicker) {" +
"\nif (treePicker != undefined) {" +
"\ndocument.getElementById(\"" + this.ClientID + "\").value = treePicker;" +
"\nif (treePicker > 0) {" +
string strScript = "function " + this.ClientID + "_chooseId() {" +
"\nshowPopWin('" + TreeService.GetPickerUrl(true, "content", "content") + "', 300, 400, " + ClientID + "_saveId);" +
//"\nvar treePicker = window.showModalDialog(, 'treePicker', 'dialogWidth=350px;dialogHeight=300px;scrollbars=no;center=yes;border=thin;help=no;status=no') " +
"\n}" +
"\nfunction " + ClientID + "_saveId(treePicker) {" +
"\nsetTimeout('" + ClientID + "_saveIdDo(' + treePicker + ')', 200);" +
"\n}" +
"\nfunction " + ClientID + "_saveIdDo(treePicker) {" +
"\nif (treePicker != undefined) {" +
"\ndocument.getElementById(\"" + this.ClientID + "\").value = treePicker;" +
"\nif (treePicker > 0) {" +
"\numbraco.presentation.webservices.legacyAjaxCalls.GetNodeName(treePicker, " + this.ClientID + "_updateContentTitle" + ");" +
"\n} " +
"\n}" +
"\n} " +
"\nfunction " + this.ClientID + "_updateContentTitle(retVal) {" +
"\ndocument.getElementById(\"" + this.ClientID + "_title\").innerHTML = \"<strong>\" + retVal + \"</strong>" + deleteLink.Replace("\"", "\\\"") + "\";" +
"\n}" +
"\nfunction " + this.ClientID + "_clear() {" +
"\ndocument.getElementById(\"" + this.ClientID + "_title\").innerHTML = \"\";" +
"\ndocument.getElementById(\"" + this.ClientID + "\").value = \"\";" +
"\n}";
"\n}" +
"\n} " +
"\nfunction " + this.ClientID + "_updateContentTitle(retVal) {" +
"\ndocument.getElementById(\"" + this.ClientID + "_title\").innerHTML = \"<strong>\" + retVal + \"</strong>" + deleteLink.Replace("\"", "\\\"") + "\";" +
"\n}" +
"\nfunction " + this.ClientID + "_clear() {" +
"\ndocument.getElementById(\"" + this.ClientID + "_title\").innerHTML = \"\";" +
"\ndocument.getElementById(\"" + this.ClientID + "\").value = \"\";" +
"\n}";
try
{
if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), this.ClientID + "_chooseId", strScript, true);
else
Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID + "_chooseId", strScript, true);
}
catch
{
Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID + "_chooseId", strScript, true);
}
// Clear remove link if text if empty
if (base.Value.Trim() == "")
deleteLink = "";
writer.WriteLine("<span id=\"" + this.ClientID + "_title\"><b>" + tempTitle + "</b>" + deleteLink + "</span><a href=\"javascript:" + this.ClientID + "_chooseId()\">" + ui.Text("choose") + "...</a> &nbsp; ");//<input type=\"hidden\" id=\"" + this.ClientID + "\" name=\"" + this.ClientID + "\" value=\"" + this.Text + "\">");
base.Render(writer);
}
#endregion
}
try
{
if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), this.ClientID + "_chooseId", strScript, true);
else
Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID + "_chooseId", strScript, true);
}
catch
{
Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID + "_chooseId", strScript, true);
}
// Clear remove link if text if empty
if (base.Value.Trim() == "")
deleteLink = "";
writer.WriteLine("<span id=\"" + this.ClientID + "_title\"><b>" + tempTitle + "</b>" + deleteLink + "</span><a href=\"javascript:" + this.ClientID + "_chooseId()\">" + ui.Text("choose") + "...</a> &nbsp; ");//<input type=\"hidden\" id=\"" + this.ClientID + "\" name=\"" + this.ClientID + "\" value=\"" + this.Text + "\">");
base.Render(writer);
}
#endregion
}
}