WORK IN PROGRESS, GET THE STABLE SOURCE FROM THE THE DOWNLOADS TABS

Mega Commit: New controls: tree control, pickers of all sorts, image viewer, media uploader. Removed a zillion iframes. New modal window standard framework. Fixes some bugs. ClientDependency & Examine DLL updates. Lots of JS enhancements, libs and more methods added to ClientTools.

[TFS Changeset #63838]
This commit is contained in:
Shandem
2010-02-08 02:22:42 +00:00
parent 3372da8225
commit 8ac0e2fa54
220 changed files with 4460 additions and 5436 deletions
+14 -1
View File
@@ -49,4 +49,17 @@ FireBeforeAddToIndex, AfterAddToIndex, FireAfterAddToIndex, Document.Index
* Removed /umbraco/webservices/Search.asmx as the SearchItem object has been removed
* Removed /umbraco/reindex.aspx
* Removed /umbraco/dialogs/editImage.aspx since it didn't do anything at all
* Removed /umbraco/dialogs/editImage.aspx since it didn't do anything at all
* MediaPicker has been completely overhauled in regards to the JavaScript implementation and should now work in live editing mode
* /umbraco/plugins/tinymce3/insertImage.aspx has been overhauled to use the tree control, image viewer control and upload media image control
* /umbraco/treeInit.aspx has been marked obsolete
** All pages that used to use TreeInit now use TreeControl (except for Legacy project)
* /umbraco/dialog/treePicker.aspx has been marked obsolete
* /umbraco/dialog/uploadImage.aspx has been marked obsolete
* /umbraco/dialog/imageViewer.aspx has been marked obsolete
* subModal library moved to legacy and no longer used
* JavaScript Modal window framework overhauled and replaced
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.uicontrols.TreePicker;
using umbraco.interfaces;
namespace umbraco.editorControls
{
/// <summary>
/// A base tree picker class that has all of the functionality built in for an IDataEditor
/// </summary>
public abstract class BaseTreePickerEditor : BaseTreePicker, IDataEditor
{
interfaces.IData _data;
protected int StoredItemId = -1;
public BaseTreePickerEditor()
: base() { }
public BaseTreePickerEditor(IData Data)
: base()
{
_data = Data;
}
private void StoreItemId(IData Data)
{
if (_data != null && _data.Value != null && !String.IsNullOrEmpty(_data.Value.ToString()))
{
int.TryParse(_data.Value.ToString(), out StoredItemId);
}
}
protected override void OnInit(EventArgs e)
{
StoreItemId(_data);
base.OnInit(e);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!Page.IsPostBack)
{
ItemIdValue.Value = StoredItemId != -1 ? StoredItemId.ToString() : "";
}
}
#region IDataField Members
public System.Web.UI.Control Editor { get { return this; } }
public virtual bool TreatAsRichTextEditor
{
get { return false; }
}
public bool ShowLabel
{
get
{
return true;
}
}
public void Save()
{
//_text = helper.Request(this.ClientID);
if (ItemIdValue.Value.Trim() != "")
_data.Value = ItemIdValue.Value.Trim();
else
_data.Value = null;
}
#endregion
}
}
@@ -43,18 +43,22 @@ namespace umbraco.editorControls.macrocontainer
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
base.Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "subModal", "<script type=\"text/javascript\" src=\"" + SystemDirectories.Umbraco + "/js/submodal/common.js\"></script><script type=\"text/javascript\" src=\"" + SystemDirectories.Umbraco + "/js/submodal/subModal.js\"></script><link href=\"" + SystemDirectories.Umbraco + "/js/submodal/subModal.css\" type=\"text/css\" rel=\"stylesheet\"></link>");
//SD: This is useless as it won't work in live editing anyways whilst using MS Ajax/ScriptManager for ajax calls
if (!UmbracoContext.Current.LiveEditingContext.Enabled)
{
presentation.webservices.ajaxHelpers.EnsureLegacyCalls(base.Page);
ScriptManager sm = ScriptManager.GetCurrent(base.Page);
ServiceReference webservicePath = new ServiceReference(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/webservices/MacroContainerService.asmx");
if (!sm.Services.Contains(webservicePath))
sm.Services.Add(webservicePath);
}
else
{
ClientDependencyLoader.Instance.RegisterDependency("webservices/legacyAjaxCalls.asmx/js", "UmbracoRoot", ClientDependencyType.Javascript);
ClientDependencyLoader.Instance.RegisterDependency("webservices/MacroContainerService.asmx/js", "UmbracoRoot", ClientDependencyType.Javascript);
}
_addMacro = new LinkButton();
_addMacro.ID = ID + "_btnaddmacro";
@@ -27,26 +27,15 @@ namespace umbraco.editorControls.macrocontainer
internal static Control GetMacroRenderControlByType(PersistableMacroProperty prop, string uniqueID)
{
Control macroControl;
//Determine the property type
switch (prop.TypeName.ToLower())
Type m = MacroControlTypes.FindLast(delegate(Type macroGuiCcontrol) { return macroGuiCcontrol.ToString() == string.Format("{0}.{1}", prop.AssemblyName, prop.TypeName); });
IMacroGuiRendering typeInstance;
typeInstance = Activator.CreateInstance(m) as IMacroGuiRendering;
if (!string.IsNullOrEmpty(prop.Value))
{
//Use a pagepicker instead of a IMacroGuiRendering control
case "content":
macroControl = new pagePicker(null);
((pagePicker)macroControl).Value = prop.Value;
break;
///Default behaviour
default:
Type m = MacroControlTypes.FindLast(delegate(Type macroGuiCcontrol) { return macroGuiCcontrol.ToString() == string.Format("{0}.{1}", prop.AssemblyName, prop.TypeName); });
IMacroGuiRendering typeInstance;
typeInstance = Activator.CreateInstance(m) as IMacroGuiRendering;
if (!string.IsNullOrEmpty(prop.Value))
{
((IMacroGuiRendering)typeInstance).Value = prop.Value;
}
macroControl = (Control)typeInstance;
break;
((IMacroGuiRendering)typeInstance).Value = prop.Value;
}
macroControl = (Control)typeInstance;
macroControl.ID = uniqueID;
return macroControl;
@@ -59,17 +48,7 @@ namespace umbraco.editorControls.macrocontainer
/// <returns></returns>
internal static string GetValueFromMacroControl(Control macroControl)
{
if (macroControl is pagePicker)
{
//pagePicker Control
return ((pagePicker)macroControl).Value;
}
else
{
///Macro control
return ((IMacroGuiRendering)macroControl).Value;
}
return ((IMacroGuiRendering)macroControl).Value;
}
#endregion
@@ -85,7 +64,7 @@ namespace umbraco.editorControls.macrocontainer
{
//Populate the list with all the types of IMacroGuiRendering
_macroControlTypes = new List<Type>();
_macroControlTypes = TypeFinder.FindClassesOfType<IMacroGuiRendering>(true);
_macroControlTypes = TypeFinder.FindClassesOfType<IMacroGuiRendering>();
}
return _macroControlTypes;
@@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.editorControls.mediapicker {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class MediaChooserScripts {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal MediaChooserScripts() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("umbraco.editorControls.mediapicker.MediaChooserScripts", typeof(MediaChooserScripts).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to /// &lt;reference path=&quot;/umbraco_client/Application/NamespaceManager.js&quot; /&gt;
///
///Umbraco.Sys.registerNamespace(&quot;Umbraco.Controls&quot;);
///
///(function($) {
///
/// Umbraco.Controls.MediaChooser = function(label, hasPreview, mediaIdValueClientID, previewContainerClientID, imgViewerClientID, mediaTitleClientID) {
/// return {
/// _mediaPickerUrl: &apos;/umbraco/dialogs/mediaPicker.aspx&apos;,
/// _webServiceUrl: &quot;/umbraco/webservices/legacyAjaxCalls.asmx/GetNodeName&quot;,
/// _label: label,
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string MediaPicker {
get {
return ResourceManager.GetString("MediaPicker", resourceCulture);
}
}
}
}
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="MediaPicker" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>MediaPicker.js;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>
@@ -0,0 +1,52 @@
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
Umbraco.Sys.registerNamespace("Umbraco.Controls");
(function($) {
Umbraco.Controls.MediaChooser = function(label, mediaIdValueClientID, previewContainerClientID, imgViewerClientID, mediaTitleClientID, mediaPickerUrl, width, height, umbracoPath) {
return {
_mediaPickerUrl: mediaPickerUrl,
_webServiceUrl: umbracoPath + "/webservices/legacyAjaxCalls.asmx/GetNodeName",
_label: label,
_width: width,
_height: height,
_mediaIdValueClientID: mediaIdValueClientID,
_previewContainerClientID: previewContainerClientID,
_imgViewerClientID: imgViewerClientID,
_mediaTitleClientID: mediaTitleClientID,
LaunchPicker: function() {
var _this = this;
UmbClientMgr.openModalWindow(this._mediaPickerUrl, this._label, true, this._width, this._height, 30, 0, ['#cancelbutton'], function(e) { _this.SaveSelection(e); });
},
SaveSelection: function(e) {
if (!e.outVal) {
return;
}
$("#" + this._mediaIdValueClientID).val(e.outVal);
$("#" + this._previewContainerClientID).show();
$("#" + this._imgViewerClientID).UmbracoImageViewerAPI().updateImage(e.outVal);
var _this = this;
$.ajax({
type: "POST",
url: _this._webServiceUrl,
data: '{ "nodeId": ' + e.outVal + ' }',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
$("#" + _this._mediaTitleClientID).html(msg.d);
$("#" + _this._mediaTitleClientID).parent().show();
}
});
},
ClearSelection: function() {
$("#" + this._mediaTitleClientID).parent().hide();
$("#" + this._mediaIdValueClientID).val('');
$("#" + this._previewContainerClientID).hide();
}
};
}
})(jQuery);
@@ -7,201 +7,173 @@ using umbraco.presentation;
using ClientDependency.Core.Controls;
using umbraco.interfaces;
using umbraco.IO;
using umbraco.BasePages;
using umbraco.controls.Images;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Resources;
using umbraco.editorControls.mediapicker;
using umbraco.uicontrols.TreePicker;
namespace umbraco.editorControls
{
/// <summary>
/// Summary description for mediaChooser.
/// </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")]
/// <summary>
/// Summary description for mediaChooser.
/// </summary>
[ValidationProperty("Value")]
public class mediaChooser : System.Web.UI.WebControls.HiddenField, IDataEditor
{
interfaces.IData _data;
bool _showpreview;
bool _showadvanced;
public class mediaChooser : BaseTreePickerEditor
{
bool _showpreview;
bool _showadvanced;
protected ImageViewer ImgViewer;
protected HtmlGenericControl PreviewContainer;
public mediaChooser(interfaces.IData Data)
public mediaChooser(IData data)
: base(data) { }
public mediaChooser(IData data, bool showPreview, bool showAdvanced)
: base(data)
{
_data = Data;
_showpreview = showPreview;
_showadvanced = showAdvanced;
}
public override string ModalWindowTitle
{
get
{
return ui.GetText("general", "choose") + " " + ui.GetText("sections", "media");
}
}
public override string TreePickerUrl
{
get
{
return _showadvanced ? umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/mediaPicker.aspx" : TreeService.GetPickerUrl("media", "media");
}
}
protected override string GetJSScript()
{
if (!_showpreview)
{
return base.GetJSScript();
}
else
{
/* 0 = this control's client id
* 1 = label
* 2 = mediaIdValueClientID
* 3 = previewContainerClientID
* 4 = imgViewerClientID
* 5 = mediaTitleClientID
* 6 = mediaPickerUrl
* 7 = popup width
* 8 = popup height
* 9 = umbraco path
*/
return string.Format(@"
var mc_{0} = new Umbraco.Controls.MediaChooser('{1}','{2}','{3}','{4}','{5}','{6}',{7},{8},'{9}');",
new string[]
{
this.ClientID,
ModalWindowTitle,
ItemIdValue.ClientID,
_showpreview ? PreviewContainer.ClientID : "__NOTSET",
_showpreview ? ImgViewer.ClientID : "_NOTSET",
ItemTitle.ClientID,
TreePickerUrl,
ModalWidth.ToString(),
ModalHeight.ToString(),
umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco).TrimEnd('/')
});
}
}
/// <summary>
/// Renders the required media picker javascript
/// </summary>
protected override void RenderJSComponents()
{
if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "MediaChooser", MediaChooserScripts.MediaPicker, true);
}
else
{
Page.ClientScript.RegisterClientScriptBlock(typeof(mediaChooser), "MediaChooser", MediaChooserScripts.MediaPicker, true);
}
}
protected override void CreateChildControls()
{
base.CreateChildControls();
//if preview is enabled, add it to the wrapper
if (_showpreview)
{
//create the preview wrapper
PreviewContainer = new HtmlGenericControl("div");
PreviewContainer.ID = "preview";
this.Controls.Add(PreviewContainer);
ImgViewer = (ImageViewer)Page.LoadControl(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/controls/Images/ImageViewer.ascx");
ImgViewer.ID = "ImgViewer";
ImgViewer.ViewerStyle = ImageViewer.Style.ImageLink;
PreviewContainer.Style.Add(HtmlTextWriterStyle.MarginTop, "5px");
PreviewContainer.Controls.Add(ImgViewer);
}
}
/// <summary>
/// sets the modal width/height based on properties
/// </summary>
/// <param name="e"></param>
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
ModalWidth = _showadvanced ? 530 : 320;
ModalHeight = _showadvanced ? 565 : 400;
}
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;
_showpreview = ShowPreview;
_showadvanced = ShowAdvanced;
}
public System.Web.UI.Control Editor { get { return this; } }
#region IDataField Members
//private string _text;
public virtual bool TreatAsRichTextEditor
{
get { return false; }
}
public bool ShowLabel
{
get
{
return true;
}
}
public void Save()
{
if (base.Value.Trim() != "")
_data.Value = base.Value;
else
_data.Value = null;
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (_data != null && _data.Value != null && !String.IsNullOrEmpty(_data.Value.ToString()))
{
base.Value = _data.Value.ToString();
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(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);
// And a reference to the media picker calls
if (!UmbracoContext.Current.LiveEditingContext.Enabled)
{
ScriptManager sm = ScriptManager.GetCurrent(base.Page);
ServiceReference webservicePath = new ServiceReference(SystemDirectories.Webservices + "/MediaPickerService.asmx");
if (!sm.Services.Contains(webservicePath))
sm.Services.Add(webservicePath);
}
else
{
ClientDependencyLoader.Instance.RegisterDependency("webservices/MediaPickerService.asmx/js", "UmbracoRoot", ClientDependencyType.Javascript);
}
}
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
string tempTitle = "";
int mediaId = -1;
string deleteLink = " &nbsp; <a href=\"javascript:" + this.ClientID + "_clear();\" style=\"color: red\">" + ui.Text("delete") + "</a> &nbsp; ";
try
{
if (base.Value != "")
{
mediaId = int.Parse(base.Value);
tempTitle = new cms.businesslogic.CMSNode(int.Parse(base.Value)).Text;
}
}
catch { }
string dialog = "\nshowPopWin('" + TreeService.GetPickerUrl(true, "media", "media") + "', 300, 400, " + ClientID + "_saveId)";
if (_showadvanced)
dialog = "\nshowPopWin('" + SystemDirectories.Umbraco + "/dialogs/mediaPicker.aspx" + "', 500, 530, " + ClientID + "_saveId)";
string preview = string.Empty;
if (_showpreview)
preview = "\numbraco.presentation.webservices.MediaPickerService.GetThumbNail(treePicker, " + this.ClientID + "_UpdateThumbNail);" +
"\numbraco.presentation.webservices.MediaPickerService.GetFile(treePicker, " + this.ClientID + "_UpdateLink);";
string strScript = "function " + this.ClientID + "_chooseId() {" +
//"\nshowPopWin('" + TreeService.GetPickerUrl(true, "media", "media") + "', 300, 400, " + ClientID + "_saveId)" +
//"\nshowPopWin('" + umbraco.IO.SystemDirectories.Umbraco + "/dialogs/mediaPicker.aspx" + "', 500, 530, " + ClientID + "_saveId)" +
// "\nvar treePicker = window.showModalDialog(, 'treePicker', 'dialogWidth=350px;dialogHeight=300px;scrollbars=no;center=yes;border=thin;help=no;status=no') " +
dialog +
"\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" + ");" +
preview+
"\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 = \"\";" +
"\ndocument.getElementById(\"" + this.ClientID + "_preview\").style.display = 'none';" +
"\n}" +
"\nfunction " + this.ClientID + "_UpdateThumbNail(retVal){" +
"\nif(retVal != \"\"){" +
"\ndocument.getElementById(\"" + this.ClientID + "_thumbnail\").src = retVal;" +
"\ndocument.getElementById(\"" + this.ClientID + "_preview\").style.display = 'block';}" +
"\nelse{document.getElementById(\"" + this.ClientID + "_preview\").style.display = 'none';}" +
"\n}"+
"\nfunction " + this.ClientID + "_UpdateLink(retVal){" +
"\ndocument.getElementById(\"" + this.ClientID + "_thumbnaillink\").href = retVal;" +
"\n}";
try
{
if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), this.ClientID + "_chooseId", strScript, true);
if (string.IsNullOrEmpty(ItemIdValue.Value))
{
PreviewContainer.Style.Add(HtmlTextWriterStyle.Display, "none");
ImgViewer.MediaId = -1;
}
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 == "")
deleteLink = "";
writer.WriteLine("<span id=\"" + this.ClientID + "_title\"><b>" + tempTitle + "</b>" + deleteLink + "</span><a href=\"javascript:" + this.ClientID + "_chooseId()\">" + ui.Text("choose") + "...</a> &nbsp; ");// &nbsp; <input type=\"hidden\" id=\"" + this.ClientID + "\" name=\"" + this.ClientID + "\" value=\"" + this.Text + "\">");
//Thumbnail preview
if (_showpreview)
{
string thumb = string.Empty;
string link = string.Empty;
string style = "display:none;";
if (mediaId != -1)
{
style = string.Empty;
thumb = string.Format(" src=\"{0}\" ", presentation.webservices.MediaPickerServiceHelpers.GetThumbNail(mediaId));
link = string.Format(" href=\"{0}\" ", presentation.webservices.MediaPickerServiceHelpers.GetFile(mediaId));
ImgViewer.MediaId = int.Parse(ItemIdValue.Value);
}
writer.WriteLine("<div id=\"" + this.ClientID + "_preview\" style=\"margin-top:5px;" + style + "\"><a " + link + "id=\"" + this.ClientID + "_thumbnaillink\" target=\"_blank\" ><img " + thumb + "id=\"" + this.ClientID + "_thumbnail\" /></a></div>");
}
base.Render(writer);
//if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
//{
// //renders the media picker JS class
// ScriptManager.RegisterStartupScript(this, this.GetType(), "MediaChooser", MediaChooserScripts.MediaPicker, true);
// ScriptManager.RegisterStartupScript(this, this.GetType(), this.ClientID + "MediaPicker", strScript, true);
//}
//else
//{
// //renders the media picker JS class
// Page.ClientScript.RegisterClientScriptBlock(typeof(mediaChooser), "MediaChooser", MediaChooserScripts.MediaPicker, true);
// Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID + "MediaPicker", strScript, true);
//}
}
#endregion
}
}
}
@@ -6,126 +6,37 @@ using ClientDependency.Core;
using umbraco.presentation;
using ClientDependency.Core.Controls;
using umbraco.interfaces;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using umbraco.editorControls.pagepicker;
using umbraco.uicontrols.TreePicker;
namespace umbraco.editorControls
{
/// <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")]
[ValidationProperty("Value")]
public class pagePicker : System.Web.UI.WebControls.HiddenField, IDataEditor
public class pagePicker : BaseTreePickerEditor
{
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);
}
#region IDataField Members
//private string _text;
public System.Web.UI.Control Editor { get { return this; } }
public virtual bool TreatAsRichTextEditor
{
get { return false; }
}
public bool ShowLabel
public pagePicker() : base() { }
public pagePicker(interfaces.IData data) : base(data) { }
public override string TreePickerUrl
{
get
{
return true;
return TreeService.GetPickerUrl("content", "content");
}
}
public void Save()
public override string ModalWindowTitle
{
//_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);
// 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 (_data != null && _data.Value != null)
base.Value = _data.Value.ToString();
}
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
get
{
if (base.Value.Trim() != "")
{
tempTitle = new cms.businesslogic.CMSNode(int.Parse(base.Value.Trim())).Text;
}
return ui.GetText("general", "choose") + " " + ui.GetText("sections", "content");
}
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) {" +
"\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}";
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
}
}
@@ -152,9 +152,8 @@
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
</ProjectReference>
<ProjectReference Include="..\..\umbraco\presentation\umbraco.presentation.csproj">
<Name>umbraco.presentation</Name>
<Project>{651E1350-91B6-44B7-BD60-7207006D7003}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
<Name>umbraco.presentation</Name>
</ProjectReference>
<ProjectReference Include="..\umbraco.controls\umbraco.controls.csproj">
<Project>{6EDD2061-82F2-461B-BB6E-879245A832DE}</Project>
@@ -168,6 +167,7 @@
<Compile Include="BaseDataType.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="BaseTreePickerEditor.cs" />
<Compile Include="checkboxlist\CheckBoxDataType.cs">
<SubType>Code</SubType>
</Compile>
@@ -256,6 +256,11 @@
<Compile Include="mediapicker\mediaChooser.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="mediapicker\MediaChooserScripts.Designer.cs">
<DependentUpon>MediaChooserScripts.resx</DependentUpon>
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
</Compile>
<Compile Include="mediapicker\MediaPickerDataType.cs">
<SubType>Code</SubType>
</Compile>
@@ -350,6 +355,11 @@
<EmbeddedResource Include="imagecropper\Resources.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="mediapicker\MediaChooserScripts.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>MediaChooserScripts.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="textfield\textFieldDataEditor.resx">
<DependentUpon>textFieldDataEditor.cs</DependentUpon>
<SubType>Designer</SubType>
@@ -372,6 +382,9 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="mediapicker\MediaPicker.js" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
+18 -94
View File
@@ -5,111 +5,35 @@ using System.Data.SqlClient;
using System.Web.UI;
using ClientDependency.Core;
using umbraco.IO;
using umbraco.interfaces;
using umbraco.uicontrols.TreePicker;
namespace umbraco.macroRenderings
{
/// <summary>
/// Summary description for content.
/// </summary>
[ClientDependency(103, ClientDependencyType.Javascript, "js/submodal/common.js", "UmbracoRoot")]
[ClientDependency(104, ClientDependencyType.Javascript, "js/submodal/subModal.js", "UmbracoRoot")]
[ClientDependency(ClientDependencyType.Css, "js/submodal/subModal.css", "UmbracoRoot")]
public class content : System.Web.UI.WebControls.WebControl, interfaces.IMacroGuiRendering
public class content : SimpleContentPicker, IMacroGuiRendering
{
private string m_value = "";
public bool ShowCaption
{
get {return true;}
}
#region IMacroGuiRendering Members
public string Value
{
get {
if (Page.IsPostBack && !String.IsNullOrEmpty(System.Web.HttpContext.Current.Request[this.ClientID])) {
m_value = System.Web.HttpContext.Current.Request[this.ClientID];
}
return m_value;
string IMacroGuiRendering.Value
{
get
{
return Value;
}
set
{
Value = value;
}
set { m_value = value; }
}
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
ScriptManager sm = ScriptManager.GetCurrent(Page);
ServiceReference legacyPath = new ServiceReference(SystemDirectories.Webservices + "/legacyAjaxCalls.asmx");
if (!sm.Services.Contains(legacyPath))
sm.Services.Add(legacyPath);
}
public content()
{
//
// TODO: Add constructor logic here
//
}
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 (this.Value != "") {
tempTitle = new cms.businesslogic.CMSNode(int.Parse(this.Value)).Text;
}
} catch { }
writer.WriteLine("<script language=\"javascript\">\nfunction " + this.ClientID + "_chooseId() {" +
"\nshowPopWin('" + IOHelper.ResolveUrl( SystemDirectories.Umbraco ) + "/dialogs/treePicker.aspx?useSubModal=true&app=content&treeType=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</script>");
// Clear remove link if text if empty
if (this.Value == "")
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.Value + "\">");
base.Render(writer);
bool IMacroGuiRendering.ShowCaption
{
get { return true; }
}
/*
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
string label = "";
if (this.Value != "")
{
SqlDataReader pageName = SqlHelper.ExecuteReader(umbraco.GlobalSettings.DbDSN,
CommandType.Text, "select text as nodeName from umbracoNode where id = " + this.Value);
if (pageName.Read())
label = pageName.GetString(pageName.GetOrdinal("nodeName")) + "<br/>";
pageName.Close();
}
writer.WriteLine("<b><span id=\"label" + this.ID + "\">" + label + "</span></b>");
writer.WriteLine("<a href=\"javascript:saveTreepickerValue('content','" + this.ID + "');\">Choose item</a>");
writer.WriteLine("<input type=\"hidden\" name=\"" + this.ID + "\" value=\"" + this.Value + "\"/>");
}*/
#endregion
}
}
+19 -98
View File
@@ -6,112 +6,33 @@ using System.Data.SqlClient;
using System.Web.UI;
using ClientDependency.Core;
using umbraco.IO;
using umbraco.interfaces;
using umbraco.uicontrols.TreePicker;
namespace umbraco.macroRenderings
{
/// <summary>
/// Summary description for media.
/// </summary>
[ClientDependency(103, ClientDependencyType.Javascript, "js/submodal/common.js", "UmbracoRoot")]
[ClientDependency(104, ClientDependencyType.Javascript, "js/submodal/subModal.js", "UmbracoRoot")]
[ClientDependency(ClientDependencyType.Css, "js/submodal/subModal.css", "UmbracoRoot")]
public class media : System.Web.UI.WebControls.WebControl, interfaces.IMacroGuiRendering
public class media : SimpleMediaPicker, IMacroGuiRendering
{
private string m_value = "";
#region IMacroGuiRendering Members
public bool ShowCaption
{
get {return true;}
}
public string Value {
get {
if (Page.IsPostBack && !String.IsNullOrEmpty(System.Web.HttpContext.Current.Request[this.ClientID])) {
m_value = System.Web.HttpContext.Current.Request[this.ClientID];
}
return m_value;
string IMacroGuiRendering.Value
{
get
{
return Value;
}
set
{
Value = value;
}
set { m_value = value; }
}
public media()
{
//
// TODO: Add constructor logic here
//
}
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
ScriptManager sm = ScriptManager.GetCurrent(Page);
ServiceReference legacyPath = new ServiceReference(SystemDirectories.Webservices + "/legacyAjaxCalls.asmx");
if (!sm.Services.Contains(legacyPath))
sm.Services.Add(legacyPath);
bool IMacroGuiRendering.ShowCaption
{
get { return true; }
}
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 (this.Value != "") {
tempTitle = new cms.businesslogic.CMSNode(int.Parse(this.Value)).Text;
}
} catch { }
writer.WriteLine("<script language=\"javascript\">\nfunction " + this.ClientID + "_chooseId() {" +
"\nshowPopWin('" + SystemDirectories.Umbraco + "/dialogs/treePicker.aspx?useSubModal=true&app=media&treeType=media', 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</script>");
// Clear remove link if text if empty
if (this.Value == "")
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.Value + "\">");
base.Render(writer);
}
/*
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
string label = "";
if (this.Value != "")
{
SqlDataReader pageName = SqlHelper.ExecuteReader(umbraco.GlobalSettings.DbDSN,
CommandType.Text, "select text as nodeName from umbracoNode where id = " + this.Value);
if (pageName.Read())
label = pageName.GetString(pageName.GetOrdinal("nodeName")) + "<br/>";
pageName.Close();
}
writer.WriteLine("<b><span id=\"label" + this.ID + "\">" + label + "</span></b>");
writer.WriteLine("<a href=\"javascript:saveTreepickerValue('media','" + this.ID + "');\">Choose item</a>");
writer.WriteLine("<input type=\"hidden\" name=\"" + this.ID + "\" value=\"" + this.Value + "\"/>");
}
*/
}
#endregion
}
}
@@ -124,6 +124,10 @@
<Project>{511F6D8D-7717-440A-9A57-A507E9A8B27F}</Project>
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
</ProjectReference>
<ProjectReference Include="..\umbraco.controls\umbraco.controls.csproj">
<Project>{6EDD2061-82F2-461B-BB6E-879245A832DE}</Project>
<Name>umbraco.controls</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs">
+2
View File
@@ -36,10 +36,12 @@ namespace umbraco.uicontrols {
{
get
{
EnsureChildControls();
return CodeTextBox.Text;
}
set
{
EnsureChildControls();
CodeTextBox.Text = value;
}
}
@@ -0,0 +1,223 @@
using System;
using System.Web.UI;
using ClientDependency.Core;
using ClientDependency.Core.Controls;
using umbraco.interfaces;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using umbraco.cms.businesslogic;
namespace umbraco.uicontrols.TreePicker
{
[ClientDependency(0, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")]
[ClientDependency(ClientDependencyType.Css, "modal/style.css", "UmbracoClient")]
[ClientDependency(ClientDependencyType.Javascript, "modal/modal.js", "UmbracoClient")]
[ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoClientManager.js", "UmbracoClient")]
[ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoUtils.js", "UmbracoClient")]
[ValidationProperty("Value")]
public abstract class BaseTreePicker : Control, INamingContainer
{
protected HiddenField ItemIdValue;
protected HtmlAnchor DeleteLink;
protected HtmlAnchor ChooseLink;
protected HtmlGenericControl ItemTitle;
protected HtmlGenericControl ButtonContainer;
public BaseTreePicker()
{
ShowDelete = true;
ModalHeight = 400;
ModalWidth = 300;
ShowHeader = true;
}
/// <summary>
/// Wraps the hidden vield value
/// </summary>
public string Value
{
get
{
EnsureChildControls();
return ItemIdValue.Value;
}
set
{
EnsureChildControls();
ItemIdValue.Value = value;
}
}
public int ModalWidth { get; set; }
public int ModalHeight { get; set; }
public bool ShowDelete { get; set; }
public bool ShowHeader { get; set; }
/// <summary>
/// Need to specify the tree picker url (iframe)
/// </summary>
public abstract string TreePickerUrl { get; }
/// <summary>
/// The title to specify for the picker window
/// </summary>
public abstract string ModalWindowTitle { get; }
/// <summary>
/// If item has been selected or stored, this will query the db for it's title
/// </summary>
/// <returns></returns>
protected virtual string GetItemTitle()
{
if (!string.IsNullOrEmpty(ItemIdValue.Value))
{
try
{
return new CMSNode(int.Parse(ItemIdValue.Value)).Text;
}
catch (ArgumentException ex) { /*the node does not exist! we will ignore*/ }
}
return "";
}
/// <summary>
/// Outputs the JavaScript instances used to make this control work
/// </summary>
protected virtual string GetJSScript()
{
/* 0 = this control's client id
* 1 = label
* 2 = itemIdValueClientID
* 3 = itemTitleClientID
* 4 = itemPickerUrl
* 5 = popup width
* 6 = popup height
* 7 = show header
* 8 = umbraco path
*/
return string.Format(@"
var mc_{0} = new Umbraco.Controls.TreePicker('{0}','{1}','{2}','{3}','{4}',{5},{6},{7},'{8}');",
new string[]
{
this.ClientID,
ModalWindowTitle,
ItemIdValue.ClientID,
ItemTitle.ClientID,
TreePickerUrl,
ModalWidth.ToString(),
ModalHeight.ToString(),
ShowHeader.ToString().ToLower(),
umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco).TrimEnd('/')
});
}
/// <summary>
/// Registers the required JS classes required to make this control work
/// </summary>
protected virtual void RenderJSComponents()
{
if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), this.GetType().ToString(), BaseTreePickerScripts.BaseTreePicker, true);
}
else
{
Page.ClientScript.RegisterClientScriptBlock(typeof(BaseTreePicker), this.GetType().ToString(), BaseTreePickerScripts.BaseTreePicker, true);
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
EnsureChildControls();
//disable view state for this control
this.EnableViewState = false;
}
/// <summary>
/// Create the native .net child controls for this control
/// </summary>
protected override void CreateChildControls()
{
base.CreateChildControls();
//create the hidden field
ItemIdValue = new HiddenField();
ItemIdValue.ID = "ContentIdValue";
this.Controls.Add(ItemIdValue);
ButtonContainer = new HtmlGenericControl("span");
ButtonContainer.ID = "btns";
//add item title with padding
ItemTitle = new HtmlGenericControl("span");
ItemTitle.ID = "title";
ItemTitle.Style.Add(HtmlTextWriterStyle.FontWeight, "bold");
ButtonContainer.Controls.Add(ItemTitle);
ButtonContainer.Controls.Add(new LiteralControl("&nbsp;"));
ButtonContainer.Controls.Add(new LiteralControl("&nbsp;"));
//add the delete link with padding
DeleteLink = new HtmlAnchor();
DeleteLink.HRef = "#"; //set on pre-render
DeleteLink.Style.Add(HtmlTextWriterStyle.Color, "red");
DeleteLink.Title = ui.GetText("delete");
DeleteLink.InnerText = ui.GetText("delete");
ButtonContainer.Controls.Add(DeleteLink);
ButtonContainer.Controls.Add(new LiteralControl("&nbsp;"));
ButtonContainer.Controls.Add(new LiteralControl("&nbsp;"));
if (!ShowDelete)
{
DeleteLink.Style.Add(HtmlTextWriterStyle.Display, "none");
}
this.Controls.Add(ButtonContainer);
//add choose link with padding
ChooseLink = new HtmlAnchor();
ChooseLink.HRef = "#"; //filled in on pre-render
ChooseLink.InnerText = ui.GetText("choose") + "...";
this.Controls.Add(ChooseLink);
}
/// <summary>
/// Registers the JavaScript required for the control to function and hides/shows controls depending on it's properties
/// </summary>
/// <param name="e"></param>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
//hide the buttons if no item, otherwise get the item title
if (string.IsNullOrEmpty(ItemIdValue.Value))
{
ButtonContainer.Style.Add(HtmlTextWriterStyle.Display, "none");
}
else
{
ItemTitle.InnerText = GetItemTitle();
}
ChooseLink.HRef = string.Format("javascript:mc_{0}.LaunchPicker();", this.ClientID);
DeleteLink.HRef = string.Format("javascript:mc_{0}.ClearSelection();", this.ClientID);
RenderJSComponents();
if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), this.ClientID + "TreePicker", GetJSScript(), true);
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID + "TreePicker", GetJSScript(), true);
}
}
}
}
@@ -0,0 +1,70 @@
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
Umbraco.Sys.registerNamespace("Umbraco.Controls");
(function($) {
Umbraco.Controls.TreePicker = function(clientId, label, itemIdValueClientID, itemTitleClientID, itemPickerUrl, width, height, showHeader, umbracoPath) {
var obj = {
_itemPickerUrl: itemPickerUrl,
_webServiceUrl: umbracoPath + "/webservices/legacyAjaxCalls.asmx/GetNodeName",
_label: label,
_width: width,
_height: height,
_itemIdValueClientID: itemIdValueClientID,
_itemTitleClientID: itemTitleClientID,
_showHeader: showHeader,
_clientId: clientId,
GetValue: function() {
return $("#" + this._itemIdValueClientID).val();
},
LaunchPicker: function() {
var _this = this;
UmbClientMgr.openModalWindow(this._itemPickerUrl, this._label, this._showHeader, this._width, this._height, 30, 0, ['#cancelbutton'], function(e) { _this.SaveSelection(e); });
},
SaveSelection: function(e) {
if (!e.outVal) {
return;
}
$("#" + this._itemIdValueClientID).val(e.outVal);
var _this = this;
$.ajax({
type: "POST",
url: _this._webServiceUrl,
data: '{ "nodeId": ' + e.outVal + ' }',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
$("#" + _this._itemTitleClientID).html(msg.d);
$("#" + _this._itemTitleClientID).parent().show();
}
});
},
ClearSelection: function() {
$("#" + this._itemTitleClientID).parent().hide();
$("#" + this._itemIdValueClientID).val('');
}
};
//store this instance (by counter and id) so we can retrieve it later if needed
Umbraco.Controls.TreePicker.inst[++Umbraco.Controls.TreePicker.cntr] = obj;
Umbraco.Controls.TreePicker.inst[clientId] = obj;
return obj;
}
// Static methods
//return the existing picker object based on client id of the control
Umbraco.Controls.TreePicker.GetPickerById = function(id) {
return Umbraco.Controls.TreePicker.inst[id] || null;
};
// instance manager
Umbraco.Controls.TreePicker.cntr = 0;
Umbraco.Controls.TreePicker.inst = {};
})(jQuery);
@@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.uicontrols.TreePicker {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class BaseTreePickerScripts {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal BaseTreePickerScripts() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("umbraco.uicontrols.TreePicker.BaseTreePickerScripts", typeof(BaseTreePickerScripts).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to /// &lt;reference path=&quot;/umbraco_client/Application/NamespaceManager.js&quot; /&gt;
///
///Umbraco.Sys.registerNamespace(&quot;Umbraco.Controls&quot;);
///
///(function($) {
/// Umbraco.Controls.TreePicker = function(label, itemIdValueClientID, itemTitleClientID, itemPickerUrl, width, height, showHeader, umbracoPath) {
/// return {
/// _itemPickerUrl: itemPickerUrl,
/// _webServiceUrl: umbracoPath + &quot;/webservices/legacyAjaxCalls.asmx/GetNodeName&quot;,
/// _label: label,
/// _width: width,
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string BaseTreePicker {
get {
return ResourceManager.GetString("BaseTreePicker", resourceCulture);
}
}
}
}
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="BaseTreePicker" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>BaseTreePicker.js;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace umbraco.uicontrols.TreePicker
{
public class SimpleContentPicker : BaseTreePicker
{
public override string TreePickerUrl
{
get
{
return TreeUrlGenerator.GetPickerUrl("content", "content");
}
}
public override string ModalWindowTitle
{
get
{
return ui.GetText("general", "choose") + " " + ui.GetText("sections", "content");
}
}
}
}
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace umbraco.uicontrols.TreePicker
{
public class SimpleMediaPicker : BaseTreePicker
{
public override string TreePickerUrl
{
get
{
return TreeUrlGenerator.GetPickerUrl("media", "media");
}
}
public override string ModalWindowTitle
{
get
{
return ui.GetText("general", "choose") + " " + ui.GetText("sections", "media");
}
}
}
}
@@ -0,0 +1,202 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace umbraco.uicontrols
{
/// <summary>
/// This class will generate the URLs for iframe tree pages.
/// Generally used to get the a tree picker url.
/// </summary>
/// <remarks>
/// This was created in 4.1 so that this helper class can be exposed to other assemblies since
/// it only existed in the presentation assembly in previous versions
/// </remarks>
public class TreeUrlGenerator
{
public const string TREE_URL = "tree.aspx";
public const string INIT_URL = "treeinit.aspx";
public const string PICKER_URL = "treepicker.aspx";
private int? m_startNodeID;
private string m_treeType;
private bool? m_showContextMenu;
private bool? m_isDialog;
private string m_app;
private string m_nodeKey;
private string m_functionToCall;
#region Public Properties
public string FunctionToCall
{
get { return m_functionToCall; }
set { m_functionToCall = value; }
}
public string NodeKey
{
get { return m_nodeKey; }
set { m_nodeKey = value; }
}
public int StartNodeID
{
get { return m_startNodeID ?? -1; }
set { m_startNodeID = value; }
}
public string TreeType
{
get { return m_treeType; }
set { m_treeType = value; }
}
public bool ShowContextMenu
{
get { return m_showContextMenu ?? true; }
set { m_showContextMenu = value; }
}
public bool IsDialog
{
get { return m_isDialog ?? false; }
set { m_isDialog = value; }
}
public string App
{
get { return m_app; }
set { m_app = value; }
}
#endregion
/// <summary>
/// Returns the url for servicing the xml tree request based on the parameters specified on this class.
/// </summary>
/// <returns>Tree service url as a string</returns>
public string GetServiceUrl()
{
return umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/" + GetUrl(TREE_URL);
}
/// <summary>
/// Static method to return the tree service url with the specified parameters
/// </summary>
/// <param name="startNodeID"></param>
/// <param name="treeType"></param>
/// <param name="showContextMenu"></param>
/// <param name="isDialog"></param>
/// <param name="app"></param>
/// <param name="nodeKey"></param>
/// <param name="functionToCall"></param>
/// <returns></returns>
public static string GetServiceUrl(int? startNodeID, string treeType, bool? showContextMenu,
bool? isDialog, string app, string nodeKey, string functionToCall)
{
TreeUrlGenerator treeSvc = new TreeUrlGenerator()
{
StartNodeID = startNodeID ?? -1,
TreeType = treeType,
ShowContextMenu = showContextMenu ?? true,
IsDialog = isDialog ?? false,
App = app,
NodeKey = nodeKey,
FunctionToCall = functionToCall
};
return treeSvc.GetServiceUrl();
}
/// <summary>
/// Returns the url for initializing the tree based on the parameters specified on this class
/// </summary>
/// <returns></returns>
public string GetInitUrl()
{
return umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/" + GetUrl(INIT_URL);
}
/// <summary>
/// static method to return the tree init url with the specified parameters
/// </summary>
/// <param name="startNodeID"></param>
/// <param name="treeType"></param>
/// <param name="showContextMenu"></param>
/// <param name="isDialog"></param>
/// <param name="app"></param>
/// <param name="nodeKey"></param>
/// <param name="functionToCall"></param>
/// <returns></returns>
public static string GetInitUrl(int? startNodeID, string treeType, bool? showContextMenu,
bool? isDialog, string app, string nodeKey, string functionToCall)
{
TreeUrlGenerator treeSvc = new TreeUrlGenerator()
{
StartNodeID = startNodeID ?? -1,
TreeType = treeType,
ShowContextMenu = showContextMenu ?? true,
IsDialog = isDialog ?? false,
App = app,
NodeKey = nodeKey,
FunctionToCall = functionToCall
};
return treeSvc.GetInitUrl();
}
/// <summary>
/// Returns the url for the tree picker (used on modal windows) based on the parameters specified on this class
/// </summary>
public static string GetPickerUrl(string app, string treeType)
{
TreeUrlGenerator treeSvc = new TreeUrlGenerator();
treeSvc.App = app;
treeSvc.TreeType = treeType;
return treeSvc.GetPickerUrl();
}
/// <summary>
/// Returns the url for the tree picker (used on modal windows) based on the parameters specified on this class
/// </summary>
public string GetPickerUrl()
{
return umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/" + GetUrl(PICKER_URL);
}
[Obsolete("No longer used as useSubModal no longer has any relavence")]
public static string GetPickerUrl(bool useSubModal, string app, string treeType)
{
return GetPickerUrl(app, treeType);
}
[Obsolete("No longer used as useSubModal no longer has any relavence")]
public string GetPickerUrl(bool useSubModal)
{
return GetPickerUrl();
}
/// <summary>
/// Generates the URL parameters for the tree service.
/// </summary>
/// <param name="pageUrl">the base url (i.e. tree.aspx)</param>
/// <returns></returns>
protected virtual string GetUrl(string pageUrl)
{
StringBuilder sb = new StringBuilder();
sb.Append(pageUrl);
//insert random
sb.Append(string.Format("?rnd={0}", Guid.NewGuid().ToString("N")));
sb.Append(string.Format("&id={0}", this.StartNodeID.ToString()));
if (!string.IsNullOrEmpty(this.TreeType)) sb.Append(string.Format("&treeType={0}", this.TreeType));
if (!string.IsNullOrEmpty(this.NodeKey)) sb.Append(string.Format("&nodeKey={0}", this.NodeKey));
sb.Append(string.Format("&contextMenu={0}", this.ShowContextMenu.ToString().ToLower()));
sb.Append(string.Format("&isDialog={0}", this.IsDialog.ToString().ToLower()));
if (!string.IsNullOrEmpty(this.App)) sb.Append(string.Format("&app={0}", this.App));
return sb.ToString();
}
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ namespace umbraco.uicontrols {
styleString += key + ":" + this.Style[key] + ";";
}
writer.WriteLine("<div style=\"" + styleString + "\" class=\"" + type.ToString() + "\"><p>");
writer.WriteLine("<div id=\"" + this.ClientID + "\" style=\"" + styleString + "\" class=\"" + type.ToString() + "\"><p>");
writer.WriteLine(_text);
writer.WriteLine("</p></div>");
}
@@ -7,7 +7,7 @@
<ProjectGuid>{6EDD2061-82F2-461B-BB6E-879245A832DE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>umbraco.controls</RootNamespace>
<RootNamespace>umbraco.uicontrols</RootNamespace>
<AssemblyName>controls</AssemblyName>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
@@ -64,6 +64,15 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ProgressBar.cs" />
<Compile Include="TreePicker\BaseTreePicker.cs" />
<Compile Include="TreePicker\BaseTreePickerScripts.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>BaseTreePickerScripts.resx</DependentUpon>
</Compile>
<Compile Include="TreePicker\SimpleContentPicker.cs" />
<Compile Include="TreePicker\SimpleMediaPicker.cs" />
<Compile Include="TreeUrlGenerator.cs" />
<Compile Include="UmbracoClientDependencyLoader.cs" />
<Compile Include="CodeArea.cs" />
<Compile Include="feedback.cs" />
@@ -86,6 +95,23 @@
<Project>{E469A9CE-1BEC-423F-AC44-713CD72457EA}</Project>
<Name>umbraco.businesslogic</Name>
</ProjectReference>
<ProjectReference Include="..\..\umbraco\cms\umbraco.cms.csproj">
<Project>{CCD75EC3-63DB-4184-B49D-51C1DD337230}</Project>
<Name>umbraco.cms</Name>
</ProjectReference>
<ProjectReference Include="..\..\umbraco\interfaces\umbraco.interfaces.csproj">
<Project>{511F6D8D-7717-440A-9A57-A507E9A8B27F}</Project>
<Name>umbraco.interfaces</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="TreePicker\BaseTreePicker.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="TreePicker\BaseTreePickerScripts.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>BaseTreePickerScripts.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -95,4 +121,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -211,7 +211,7 @@ namespace umbraco.BusinessLogic
{
if (GlobalSettings.Configured) {
List<Type> types = TypeFinder.FindClassesOfType<IApplication>(false);
List<Type> types = TypeFinder.FindClassesOfType<IApplication>();
foreach (Type t in types) {
try
+34 -13
View File
@@ -54,11 +54,23 @@ namespace umbraco.BasePages
public static string MoveNode { get { return GetMainTree + ".moveNode('{0}', '{1}');"; } }
public static string ReloadActionNode { get { return GetMainTree + ".reloadActionNode({0}, {1}, null);"; } }
public static string SetActiveTreeType { get { return GetMainTree + ".setActiveTreeType('{0}');"; } }
public static string CloseModalWindow { get { return GetMainWindow + ".closeModal();"; } }
public static string OpenModalWindow(string url, string name, int height, int width)
{
return string.Format(GetMainWindow + ".openModal('{0}','{1}',{2},{3});", url, name, height, width);
}
public static string CloseModalWindow()
{
return string.Format("{0}.closeModalWindow();", ClientMgrScript);
}
public static string CloseModalWindow(string rVal)
{
return string.Format("{0}.closeModalWindow('{1}');", ClientMgrScript, rVal);
}
public static string OpenModalWindow(string url, string name, int width, int height)
{
return OpenModalWindow(url, name, true, width, height, 0, 0, "", "");
}
public static string OpenModalWindow(string url, string name, bool showHeader, int width, int height, int top, int leftOffset, string closeTriggers, string onCloseCallback)
{
return string.Format("{0}.openModalWindow('{1}', '{2}', {3}, {4}, {5}, {6}, {7}, '{8}', '{9}');",
new object[] { ClientMgrScript, url, name, showHeader.ToString().ToLower(), width, height, top, leftOffset, closeTriggers, onCloseCallback });
}
}
private Page m_page;
@@ -238,14 +250,25 @@ namespace umbraco.BasePages
}
/// <summary>
/// Closes the Umbraco dialog window if it is open
/// Closes the Umbraco dialog window if it is open
/// </summary>
public ClientTools CloseModalWindow()
/// <param name="returnVal">specify a value to return to add to the onCloseCallback method if one was specified in the OpenModalWindow method</param>
/// <returns></returns>
public ClientTools CloseModalWindow(string returnVal)
{
RegisterClientScript(Scripts.CloseModalWindow);
RegisterClientScript(Scripts.CloseModalWindow(returnVal));
return this;
}
/// <summary>
/// Closes the umbraco dialog window if it is open
/// </summary>
/// <returns></returns>
public ClientTools CloseModalWindow()
{
return CloseModalWindow("");
}
/// <summary>
/// Opens a modal window
/// </summary>
@@ -254,13 +277,11 @@ namespace umbraco.BasePages
/// <param name="height"></param>
/// <param name="width"></param>
/// <returns></returns>
public ClientTools OpenModalWindow(string url, string name, int height, int width)
public ClientTools OpenModalWindow(string url, string name, bool showHeader, int width, int height, int top, int leftOffset, string closeTriggers, string onCloseCallback)
{
RegisterClientScript(Scripts.OpenModalWindow(url, name, height, width));
RegisterClientScript(Scripts.OpenModalWindow(url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback));
return this;
}
private Page GetCurrentPage()
{
+35 -8
View File
@@ -14,13 +14,37 @@ namespace umbraco.BusinessLogic.Utils
public static class TypeFinder
{
/// <summary>
/// <summary>
/// Searches all loaded assemblies for classes of the type passed in.
/// </summary>
/// <typeparam name="T">The type of object to search for</typeparam>
/// <returns>A list of found types</returns>
public static List<Type> FindClassesOfType<T>()
{
return FindClassesOfType<T>(true);
}
/// <summary>
/// Searches all loaded assemblies for classes of the type passed in.
/// </summary>
/// <typeparam name="T">The type of object to search for</typeparam>
/// <param name="useSeperateAppDomain">true if a seperate app domain should be used to query the types. This is safer as it is able to clear memory after loading the types.</param>
/// <returns>A list of found types</returns>
public static List<Type> FindClassesOfType<T>(bool useSeperateAppDomain)
{
return FindClassesOfType<T>(useSeperateAppDomain, true);
}
/// <summary>
/// Searches all loaded assemblies for classes of the type passed in.
/// </summary>
/// <typeparam name="T">The type of object to search for</typeparam>
/// <param name="useSeperateAppDomain">true if a seperate app domain should be used to query the types. This is safer as it is able to clear memory after loading the types.</param>
/// <param name="onlyConcreteClasses">True to only return classes that can be constructed</param>
/// <returns>A list of found types</returns>
public static List<Type> FindClassesOfType<T>(bool useSeperateAppDomain)
public static List<Type> FindClassesOfType<T>(bool useSeperateAppDomain, bool onlyConcreteClasses)
{
if (useSeperateAppDomain)
{
@@ -32,10 +56,10 @@ namespace umbraco.BusinessLogic.Utils
foreach (string type in strTypes)
types.Add(Type.GetType(type));
return types;
return types.FindAll(OnlyConcreteClasses(typeof(T), onlyConcreteClasses));
}
else
return FindClassesOfType(typeof(T));
return FindClassesOfType(typeof(T), onlyConcreteClasses);
}
/// <summary>
@@ -43,7 +67,7 @@ namespace umbraco.BusinessLogic.Utils
/// </summary>
/// <param name="type">The type.</param>
/// <returns>A list of found classes</returns>
private static List<Type> FindClassesOfType(Type type)
private static List<Type> FindClassesOfType(Type type, bool onlyConcreteClasses)
{
bool searchGAC = false;
@@ -65,9 +89,7 @@ namespace umbraco.BusinessLogic.Utils
List<Type> listOfTypes = new List<Type>();
listOfTypes.AddRange(publicTypes);
List<Type> foundTypes = listOfTypes.FindAll(
delegate(Type t) { return (type.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract); }
);
List<Type> foundTypes = listOfTypes.FindAll(OnlyConcreteClasses(type, onlyConcreteClasses));
Type[] outputTypes = new Type[foundTypes.Count];
foundTypes.CopyTo(outputTypes);
classesOfType.AddRange(outputTypes);
@@ -76,5 +98,10 @@ namespace umbraco.BusinessLogic.Utils
return classesOfType;
}
private static Predicate<Type> OnlyConcreteClasses(Type type, bool onlyConcreteClasses)
{
return t => (type.IsAssignableFrom(t) && (onlyConcreteClasses ? (t.IsClass && !t.IsAbstract) : true));
}
}
}
+2 -2
View File
@@ -45,7 +45,7 @@ namespace umbraco.BusinessLogic.Actions
if (_actionHandlers.Count > 0)
return;
List<Type> foundIActionHandlers = TypeFinder.FindClassesOfType<IActionHandler>(true);
List<Type> foundIActionHandlers = TypeFinder.FindClassesOfType<IActionHandler>();
foreach (Type type in foundIActionHandlers)
{
IActionHandler typeInstance;
@@ -63,7 +63,7 @@ namespace umbraco.BusinessLogic.Actions
if (_actions.Count > 0)
return;
List<Type> foundIActions = TypeFinder.FindClassesOfType<IAction>(true);
List<Type> foundIActions = TypeFinder.FindClassesOfType<IAction>();
foreach (Type type in foundIActions)
{
IAction typeInstance;
@@ -28,7 +28,7 @@ namespace umbraco.cms.businesslogic.packager {
private static void RegisterPackageActions()
{
List<Type> types = TypeFinder.FindClassesOfType<IPackageAction>(true);
List<Type> types = TypeFinder.FindClassesOfType<IPackageAction>();
foreach (Type t in types)
{
IPackageAction typeInstance = Activator.CreateInstance(t) as IPackageAction;
@@ -72,7 +72,7 @@ namespace umbraco.cms.businesslogic.datatype.controls
private static void Initialize()
{
// Get all datatypes from interface
List<Type> types = TypeFinder.FindClassesOfType<IDataType>(true);
List<Type> types = TypeFinder.FindClassesOfType<IDataType>();
getDataTypes(types);
}
-4
View File
@@ -118,10 +118,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\foreign dlls\TidyNet.dll</HintPath>
</Reference>
<ProjectReference Include="..\..\components\umbraco.controls\umbraco.controls.csproj">
<Project>{6EDD2061-82F2-461B-BB6E-879245A832DE}</Project>
<Name>umbraco.controls</Name>
</ProjectReference>
<ProjectReference Include="..\businesslogic\umbraco.businesslogic.csproj">
<Name>umbraco.businesslogic</Name>
<Project>{E469A9CE-1BEC-423F-AC44-713CD72457EA}</Project>
-12
View File
@@ -31,16 +31,4 @@ namespace umbraco.interfaces
/// <value>The editor.</value>
System.Web.UI.Control Editor{get;}
}
/// <summary>
/// The alternative Data Editor which supports AJAX
/// </summary>
public interface IDataEditorAjaxAlternative
{
/// <summary>
/// Gets the ajax editor.
/// </summary>
/// <value>The ajax editor.</value>
System.Web.UI.Control AjaxEditor { get;}
}
}
@@ -0,0 +1,16 @@
using System;
namespace umbraco.interfaces
{
/// <summary>
/// The alternative Data Editor which supports AJAX
/// </summary>
public interface IDataEditorAjaxAlternative
{
/// <summary>
/// Gets the ajax editor.
/// </summary>
/// <value>The ajax editor.</value>
System.Web.UI.Control AjaxEditor { get; }
}
}
@@ -112,6 +112,7 @@
<Compile Include="IDataEditor.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="IDataEditorAjaxAlternative.cs" />
<Compile Include="IDataFieldWithButtons.cs">
<SubType>Code</SubType>
</Compile>
@@ -23,8 +23,8 @@ More information and documentation can be found on CodePlex: http://umbracoexami
<ExcludeNodeTypes />
</IndexSet>
<!-- This is an example of an index set created for the Creative Website Starter kit
<!-- This is an example of an index set created for the Creative Website Starter kit
<IndexSet SetName="CWSIndex" IndexPath="~/App_Data/ExamineIndexes/CWSIndex/">
<IndexUmbracoFields>
<add Name="id" />
@@ -54,5 +54,6 @@ More information and documentation can be found on CodePlex: http://umbracoexami
</IncludeNodeTypes>
<ExcludeNodeTypes />
</IndexSet>
-->
</ExamineLuceneIndexSets>
@@ -5,7 +5,7 @@ This configuration file can be extended to add your own search/index providers.
Index sets can be defined in the ExamineIndex.config if you're using the standard provider model.
More information and documentation can be found on CodePlex: http://umbracoexamine.codeplex.com
-->
-->
<UmbracoExamine>
<ExamineIndexProviders enableDefaultEventHandler="true" enableAsync="true">
<providers>
@@ -14,6 +14,12 @@ More information and documentation can be found on CodePlex: http://umbracoexami
enabled="true"
debug="false"
supportUnpublished="true"/>
<!-- This is an example of an index provider created for the Creative Website Starter kit
<add name="CWSIndex" type="UmbracoExamine.Providers.LuceneExamineIndexer, UmbracoExamine.Providers"
indexSet="CWSIndex"
enabled="true"
debug="false"/>
-->
</providers>
</ExamineIndexProviders>
<ExamineSearchProviders defaultProvider="InternalSearch">
+4 -3
View File
@@ -48,7 +48,7 @@
}
function openDemoModal(id, name) {
openModal("http://packages.umbraco.org/viewPackageData.aspx?id=" + id, name, 550, 750)
UmbClientMgr.openModalWindow("http://packages.umbraco.org/viewPackageData.aspx?id=" + id, name, true, 750, 550)
return false;
}
</script>
@@ -62,8 +62,9 @@
<umb:CssInclude ID="CssInclude2" runat="server" FilePath="modal/style.css" PathNameAlias="UmbracoClient" />
<umb:JsInclude ID="JsInclude4" runat="server" FilePath="ui/jquery.js" PathNameAlias="UmbracoClient" Priority="0" />
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="modal/modal.js" PathNameAlias="UmbracoClient" Priority="1" />
<umb:JsInclude ID="JsInclude2" runat="server" FilePath="passwordStrength/passwordstrength.js" PathNameAlias="UmbracoClient" Priority="3" />
<umb:JsInclude ID="JsInclude3" runat="server" FilePath="Application/NamespaceManager.js" PathNameAlias="UmbracoClient" Priority="0" />
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="modal/modal.js" PathNameAlias="UmbracoClient" Priority="10" />
<umb:JsInclude ID="JsInclude2" runat="server" FilePath="passwordStrength/passwordstrength.js" PathNameAlias="UmbracoClient" Priority="11" />
<form id="Form1" method="post" runat="server">
<asp:ScriptManager runat="server" ID="umbracoScriptManager">
+9
View File
@@ -49,6 +49,15 @@ namespace umbraco.presentation.install {
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude4;
/// <summary>
/// JsInclude3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude3;
/// <summary>
/// JsInclude1 control.
/// </summary>
@@ -140,7 +140,7 @@
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<Reference Include="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.Services">
<Name>System.Web.Services</Name>
</Reference>
@@ -425,6 +425,24 @@
<Compile Include="umbraco\controls\ContentControl.cs" />
<Compile Include="umbraco\controls\ContentPicker.cs" />
<Compile Include="umbraco\controls\ContentTypeControl.cs" />
<Compile Include="umbraco\controls\Images\ImageViewer.ascx.cs">
<DependentUpon>ImageViewer.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco\controls\Images\ImageViewer.ascx.designer.cs">
<DependentUpon>ImageViewer.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\controls\Images\ImageViewerUpdater.asmx.cs">
<DependentUpon>ImageViewerUpdater.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="umbraco\controls\Images\UploadMediaImage.ascx.cs">
<DependentUpon>UploadMediaImage.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco\controls\Images\UploadMediaImage.ascx.designer.cs">
<DependentUpon>UploadMediaImage.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\controls\ContentTypeControlNew.ascx.cs">
<DependentUpon>ContentTypeControlNew.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -457,17 +475,19 @@
<DependentUpon>passwordChanger.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\controls\ProgressBar.ascx.cs">
<DependentUpon>ProgressBar.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
<DependentUpon>ProgressBar.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\controls\ProgressBar.ascx.designer.cs">
<DependentUpon>ProgressBar.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\controls\TreeControl.ascx.cs">
<Compile Include="umbraco\controls\Tree\JTreeContextMenu.cs" />
<Compile Include="umbraco\controls\Tree\JTreeContextMenuItem.cs" />
<Compile Include="umbraco\controls\Tree\TreeControl.ascx.cs">
<DependentUpon>TreeControl.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="umbraco\controls\TreeControl.ascx.designer.cs">
<Compile Include="umbraco\controls\Tree\TreeControl.ascx.designer.cs">
<DependentUpon>TreeControl.ascx</DependentUpon>
</Compile>
<Compile Include="umbraco\create\DLRScripting.ascx.cs">
@@ -1187,16 +1207,15 @@
<Compile Include="umbraco\Trees\BaseMediaTree.cs" />
<Compile Include="umbraco\Trees\dynamicLoader.cs" />
<Compile Include="umbraco\Trees\loadDLRScripts.cs" />
<Compile Include="umbraco\Trees\ITreeService.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="umbraco\Trees\MediaRecycleBin.cs" />
<Compile Include="umbraco\Trees\TreeRequestParams.cs" />
<Compile Include="umbraco\webservices\MacroContainerService.asmx.cs">
<DependentUpon>MacroContainerService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="umbraco\webservices\MediaPickerService.asmx.cs">
<DependentUpon>MediaPickerService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="umbraco\webservices\MediaPickerServiceHelpers.cs" />
<Compile Include="umbraco\webservices\TreeClientService.asmx.cs">
<DependentUpon>TreeClientService.asmx</DependentUpon>
<SubType>Component</SubType>
@@ -1442,24 +1461,35 @@
<Content Include="config\splashes\booting.aspx" />
<Content Include="config\splashes\noNodes.aspx" />
<Content Include="config\splashes\worker.png" />
<Content Include="umbraco\controls\passwordChanger.ascx" />
<Content Include="umbraco\controls\ProgressBar.ascx" />
<Content Include="web.config.SHOCKING.xslt" />
<Content Include="web.config.UMBRACOTOSH.xslt" />
<Content Include="umbraco\controls\ContentTypeControlNew.ascx" />
<Content Include="umbraco\controls\Extenders\CustomDragDropBehavior.js" />
<Content Include="umbraco\controls\Extenders\CustomFloatingBehavior.js" />
<Content Include="umbraco\controls\GenericProperties\GenericProperty.ascx" />
<Content Include="umbraco\controls\passwordChanger.ascx" />
<Content Include="umbraco\controls\ProgressBar.ascx" />
<Content Include="umbraco\controls\TreeControl.ascx" />
<Content Include="umbraco\create\DLRScripting.ascx" />
<Content Include="umbraco\images\umbraco\developerRuby.gif" />
<Content Include="umbraco\images\umbraco\developerScript.gif" />
<Content Include="umbraco_client\Tree\sprites.png" />
<Content Include="umbraco_client\Tree\sprites_ie6.gif" />
<Content Include="web.config.SHOCKING.xslt" />
<Content Include="umbraco\controls\Images\ImageViewer.ascx" />
<Content Include="umbraco\controls\Images\ImageViewer.js" />
<Content Include="umbraco\controls\Images\ImageViewerUpdater.asmx" />
<Content Include="umbraco\controls\Images\UploadMediaImage.ascx" />
<Content Include="umbraco\controls\Images\UploadMediaImage.js" />
<Content Include="umbraco\controls\Tree\TreeControl.ascx" />
<Content Include="umbraco\images\throbber.gif" />
<Content Include="umbraco\js\UmbracoSpeechBubbleInit.js" />
<Content Include="umbraco\LiveEditing\Modules\ItemEditing\ItemEditingInvoke.js" />
<Content Include="umbraco\Search\QuickSearch.ascx" />
<Content Include="umbraco\images\umbraco\bin.png" />
<Content Include="umbraco\images\umbraco\bin_closed.png" />
<Content Include="umbraco\images\umbraco\bin_empty.png" />
<Content Include="umbraco_client\Application\JQuery\jquery.noconflict-invoke.js" />
<Content Include="umbraco_client\Application\JQuery\VerticalAlign.js" />
<Content Include="umbraco_client\Application\UrlEncoder.js" />
<Content Include="umbraco_client\CodeArea\UmbracoEditor.js" />
<Content Include="umbraco_client\CodeMirror\css\csscolors.css" />
<Content Include="umbraco_client\CodeMirror\css\docs.css" />
@@ -1531,7 +1561,6 @@
<Content Include="umbraco\dialogs\mediaPicker.aspx" />
<Content Include="umbraco\images\editor\spellchecker.gif" />
<Content Include="umbraco\webservices\MacroContainerService.asmx" />
<Content Include="umbraco\webservices\MediaPickerService.asmx" />
<Content Include="umbraco_client\Application\JQuery\jquery.cookie.js" />
<Content Include="umbraco_client\imagecropper\Jcrop.gif" />
<Content Include="umbraco_client\tablesorting\img\bg.gif" />
@@ -1933,10 +1962,6 @@
<Content Include="umbraco\images\umbraco\developerPython.gif" />
<Content Include="umbraco\images\umbraco\package.png" />
<Content Include="umbraco\images\umbraco\settingsScript.gif" />
<Content Include="umbraco\js\submodal\common.js" />
<Content Include="umbraco\js\submodal\maskBG.png" />
<Content Include="umbraco\js\submodal\subModal.css" />
<Content Include="umbraco\js\submodal\subModal.js" />
<Content Include="umbraco\settings\DictionaryItemList.aspx" />
<Content Include="umbraco\settings\scripts\editScript.aspx" />
<Content Include="umbraco\canvas.aspx" />
@@ -2686,7 +2711,6 @@
<None Include="umbraco_client\CodeMirror\LICENSE" />
<None Include="Web References\org.umbraco.update\checkforupgrade.disco" />
<Content Include="web.config.APOWELL-WIN7.xslt" />
<Content Include="web.config.BOMBER.xslt" />
<Content Include="web.config.SONIC.xslt" />
<Content Include="web.STANDARD.config" />
<None Include="Web References\org.umbraco.update\checkforupgrade.wsdl" />
@@ -2752,7 +2776,6 @@
<None Include="umbraco\schemas\umbraco.xsx">
<DependentUpon>umbraco.xsd</DependentUpon>
</None>
<Content Include="web.config" />
<Content Include="config\UrlRewriting.config" />
</ItemGroup>
<ItemGroup>
@@ -17,14 +17,14 @@ namespace umbraco.presentation.LiveEditing.Controls
/// Provides public properties, events and methods for Live Editing controls.
/// Add this control to a (master) page to enable Live Editing.
/// </summary>
//[ClientDependency(2, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")]
//[ClientDependency(3, ClientDependencyType.Javascript, "Application/UmbracoClientManager.js", "UmbracoClient")]
//[ClientDependency(3, ClientDependencyType.Javascript, "js/language.aspx", "UmbracoRoot")]
[ClientDependency(0, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")]
[ClientDependency(1, ClientDependencyType.Css, "LiveEditing/CSS/LiveEditing.css", "UmbracoRoot")]
[ClientDependency(1, ClientDependencyType.Javascript, "ui/jquery.js", "UmbracoClient", InvokeJavascriptMethodOnLoad = "jQuery.noConflict")]
[ClientDependency(2, ClientDependencyType.Javascript, "js/UmbracoSpeechBubble.js", "UmbracoRoot", InvokeJavascriptMethodOnLoad = "InitUmbracoSpeechBubble")]
[ClientDependency(1, ClientDependencyType.Javascript, "ui/jquery.js", "UmbracoClient")]
[ClientDependency(2, ClientDependencyType.Javascript, "Application/JQuery/jquery.noconflict-invoke.js", "UmbracoClient")]
[ClientDependency(3, ClientDependencyType.Javascript, "js/UmbracoSpeechBubble.js", "UmbracoRoot")]
[ClientDependency(4, ClientDependencyType.Javascript, "js/UmbracoSpeechBubbleInit.js", "UmbracoRoot")]
[ClientDependency(10, ClientDependencyType.Javascript, "Application/UmbracoUtils.js", "UmbracoClient")]
[ClientDependency(20, ClientDependencyType.Javascript, "Application/UmbracoClientManager.js", "UmbracoClient")]
public class LiveEditingManager : Control
{
@@ -1,7 +1,7 @@
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxControlToolkit;
//using AjaxControlToolkit;
using umbraco.cms.businesslogic.web;
using umbraco.presentation.LiveEditing.Controls;
using Content = umbraco.cms.businesslogic.Content;
@@ -18,7 +18,7 @@ namespace umbraco.presentation.LiveEditing.Modules.CreateModule
protected ImageButton m_CreateButton = new ImageButton();
protected Panel m_CreateModal = new Panel();
protected ModalPopupExtender m_CreateModalExtender = new ModalPopupExtender();
//protected ModalPopupExtender m_CreateModalExtender = new ModalPopupExtender();
protected TextBox m_NameTextBox = new TextBox();
protected DropDownList m_AllowedDocTypesDropdown = new DropDownList();
@@ -75,14 +75,14 @@ namespace umbraco.presentation.LiveEditing.Modules.CreateModule
m_CancelCreateButton.Text = "Cancel";
m_CancelCreateButton.CssClass = "modalbuton";
Controls.Add(m_CreateModalExtender);
m_CreateModalExtender.ID = "ModalCreate";
m_CreateModalExtender.TargetControlID = m_CreateButton.ID;
m_CreateModalExtender.PopupControlID = m_CreateModal.ID;
m_CreateModalExtender.BackgroundCssClass = "modalBackground";
m_CreateModalExtender.OkControlID = m_ConfirmCreateButton.ID;
m_CreateModalExtender.CancelControlID = m_CancelCreateButton.ID;
m_CreateModalExtender.OnOkScript = string.Format("CreateModuleOk()");
//Controls.Add(m_CreateModalExtender);
//m_CreateModalExtender.ID = "ModalCreate";
//m_CreateModalExtender.TargetControlID = m_CreateButton.ID;
//m_CreateModalExtender.PopupControlID = m_CreateModal.ID;
//m_CreateModalExtender.BackgroundCssClass = "modalBackground";
//m_CreateModalExtender.OkControlID = m_ConfirmCreateButton.ID;
//m_CreateModalExtender.CancelControlID = m_CancelCreateButton.ID;
//m_CreateModalExtender.OnOkScript = string.Format("CreateModuleOk()");
m_CreateModal.Controls.Add(new LiteralControl("</div>"));
@@ -21,8 +21,9 @@ namespace umbraco.presentation.LiveEditing.Modules.ItemEditing
/// Control that wraps the editor control to edit a field in Live Editing mode.
/// </summary>
[ClientDependency(1, ClientDependencyType.Javascript, "ui/jquery.js", "UmbracoClient")]
[ClientDependency(21, ClientDependencyType.Javascript, "LiveEditing/Modules/ItemEditing/ItemEditing.js", "UmbracoRoot", InvokeJavascriptMethodOnLoad = "initializeGlobalItemEditing")]
[ClientDependency(21, ClientDependencyType.Javascript, "tinymce3/tiny_mce_src.js", "UmbracoClient")] //For TinyMCE to work in LiveEdit, we need to ensure that this script is run before it loads...
[ClientDependency(21, ClientDependencyType.Javascript, "LiveEditing/Modules/ItemEditing/ItemEditing.js", "UmbracoRoot")]
[ClientDependency(22, ClientDependencyType.Javascript, "LiveEditing/Modules/ItemEditing/ItemEditingInvoke.js", "UmbracoRoot")]
[ClientDependency(23, ClientDependencyType.Javascript, "tinymce3/tiny_mce_src.js", "UmbracoClient")] //For TinyMCE to work in LiveEdit, we need to ensure that this script is run before it loads...
public class ItemEditor : UpdatePanel
{
#region Protected Constants
@@ -58,7 +58,7 @@ namespace umbraco.cms.presentation.Trees
if (!String.IsNullOrEmpty(this.FunctionToCall))
{
Javascript.Append("function openContent(id) {\n");
Javascript.Append(this.FunctionToCall + "(id)\n");
Javascript.Append(this.FunctionToCall + "(id);\n");
Javascript.Append("}\n");
}
else if (!this.IsDialog)
@@ -70,20 +70,20 @@ function openContent(id) {
}
");
}
else
{
//TODO: SD: Find out how what this does...?
Javascript.Append(
@"
function openContent(id) {
if (parent.opener)
parent.opener.dialogHandler(id);
else
parent.dialogHandler(id);
}
");
}
//TODO: SD: UPDATE ALL TREE CODE SO THAT THE FUNCTIONTOCALL IS EXPLICITLY SET WHEN DIALOGHANDLER IS REQUIRED!
// else
// {
// Javascript.Append(
// @"
//function openContent(id) {
// if (parent.opener)
// parent.opener.dialogHandler(id);
// else
// parent.dialogHandler(id);
//}
//
//");
// }
}
@@ -214,14 +214,14 @@ function openContent(id) {
}
protected void SetActionAttribute(ref XmlTreeNode treeElement, Document dd)
{
//TODO: Work out why the DialogMode isn't working
// Check for dialog behaviour
if (this.DialogMode == TreeDialogModes.fulllink && !this.IsDialog)
if (this.DialogMode == TreeDialogModes.fulllink )
{
string nodeLink = CreateNodeLink(dd);
treeElement.Action = String.Format("javascript:openContent('{0}');", nodeLink);
}
else if (this.IsDialog) //(this.DialogMode == TreeDialogModes.locallink)
else if (this.DialogMode == TreeDialogModes.locallink)
{
string nodeLink = string.Format("{{localLink:{0}}}", dd.Id);
// try to make a niceurl too
@@ -57,7 +57,7 @@ namespace umbraco.cms.presentation.Trees
if (!string.IsNullOrEmpty(this.FunctionToCall))
{
Javascript.Append("function openMedia(id) {\n");
Javascript.Append(this.FunctionToCall + "(id)\n");
Javascript.Append(this.FunctionToCall + "(id);\n");
Javascript.Append("}\n");
}
else if (!this.IsDialog)
@@ -69,19 +69,19 @@ function openMedia(id) {
}
");
}
else
{
//TODO: SD: Find out how what this does...?
Javascript.Append(
@"
function openMedia(id) {
if (parent.opener)
parent.opener.dialogHandler(id);
else
parent.dialogHandler(id);
}
");
}
//TODO: SD: UPDATE ALL TREE CODE SO THAT THE FUNCTIONTOCALL IS EXPLICITLY SET WHEN DIALOGHANDLER IS REQUIRED!
// else
// {
// Javascript.Append(
// @"
//function openMedia(id) {
// if (parent.opener)
// parent.opener.dialogHandler(id);
// else
// parent.dialogHandler(id);
//}
//");
// }
}
public override void Render(ref XmlTree tree)
@@ -291,6 +291,7 @@ namespace umbraco.cms.presentation.Trees
this.IsDialog = treeParams.IsDialog;
this.ShowContextMenu = treeParams.ShowContextMenu;
this.id = treeParams.StartNodeID;
if (!treeParams.ShowContextMenu)
this.RootNode.Menu = null;
}
@@ -97,6 +97,12 @@ namespace umbraco.cms.presentation.Trees
}
}
/// <summary>
/// Override the render js so no duplicate js is rendered.
/// </summary>
/// <param name="Javascript"></param>
public override void RenderJS(ref StringBuilder Javascript) { }
///// <summary>
///// Returns the tree service url to render the tree. Ensures that IsRecycleBin is flagged.
///// </summary>
@@ -0,0 +1,44 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Text;
using System.Web;
using System.Xml;
using System.Configuration;
using umbraco.BasePages;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic;
using umbraco.cms.businesslogic.cache;
using umbraco.cms.businesslogic.contentitem;
using umbraco.cms.businesslogic.datatype;
using umbraco.cms.businesslogic.language;
using umbraco.cms.businesslogic.media;
using umbraco.cms.businesslogic.member;
using umbraco.cms.businesslogic.property;
using umbraco.cms.businesslogic.web;
using umbraco.interfaces;
using umbraco.DataLayer;
using System.Collections.Specialized;
namespace umbraco.cms.presentation.Trees
{
/// <summary>
/// All Trees rely on the properties of an ITreeService interface. This has been created to avoid having trees
/// dependant on the HttpContext
/// </summary>
public interface ITreeService
{
/// <summary>
/// The NodeKey is a string representation of the nodeID. Generally this is used for tree's whos node's unique key value is a string in instead
/// of an integer such as folder names.
/// </summary>
string NodeKey { get; }
int StartNodeID { get; }
bool ShowContextMenu { get; }
bool IsDialog { get; }
TreeDialogModes DialogMode { get; }
string FunctionToCall { get; }
}
}
@@ -81,6 +81,12 @@ namespace umbraco.cms.presentation.Trees
}
}
/// <summary>
/// Override the render js so no duplicate js is rendered.
/// </summary>
/// <param name="Javascript"></param>
public override void RenderJS(ref StringBuilder Javascript) { }
protected override void CreateRootNode(ref XmlTreeNode rootNode)
{
rootNode.Icon = "bin_empty.png";
@@ -141,7 +141,7 @@ namespace umbraco.cms.presentation.Trees
if (this.Count > 0)
return;
List<Type> foundITrees = TypeFinder.FindClassesOfType<ITree>(true);
List<Type> foundITrees = TypeFinder.FindClassesOfType<ITree>();
ApplicationTree[] objTrees = ApplicationTree.getAll();
List<ApplicationTree> appTrees = new List<ApplicationTree>();
@@ -0,0 +1,153 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Text;
using System.Web;
using System.Xml;
using System.Configuration;
using umbraco.BasePages;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic;
using umbraco.cms.businesslogic.cache;
using umbraco.cms.businesslogic.contentitem;
using umbraco.cms.businesslogic.datatype;
using umbraco.cms.businesslogic.language;
using umbraco.cms.businesslogic.media;
using umbraco.cms.businesslogic.member;
using umbraco.cms.businesslogic.property;
using umbraco.cms.businesslogic.web;
using umbraco.interfaces;
using umbraco.DataLayer;
using System.Collections.Specialized;
namespace umbraco.cms.presentation.Trees
{
/// <summary>
/// An ITreeService class that returns the values found in the Query String or any dictionary
/// </summary>
internal class TreeRequestParams : ITreeService
{
private TreeRequestParams() { }
private Dictionary<string, string> m_params;
public static TreeRequestParams FromQueryStrings()
{
Dictionary<string, string> p = new Dictionary<string, string>();
foreach (string key in HttpContext.Current.Request.QueryString.Keys)
{
p.Add(key, HttpContext.Current.Request.QueryString[key]);
//p.Add(item.Key.ToString(), item.Value.ToString());
}
return FromDictionary(p);
}
public static TreeRequestParams FromDictionary(Dictionary<string, string> items)
{
TreeRequestParams treeParams = new TreeRequestParams();
treeParams.m_params = items;
return treeParams;
}
/// <summary>
/// Converts the tree parameters to a tree service object
/// </summary>
/// <returns></returns>
public TreeService CreateTreeService()
{
return new TreeService()
{
ShowContextMenu = this.ShowContextMenu,
IsDialog = this.IsDialog,
DialogMode = this.DialogMode,
App = this.Application,
TreeType = this.TreeType,
NodeKey = this.NodeKey,
StartNodeID = this.StartNodeID,
FunctionToCall = this.FunctionToCall
};
}
public string NodeKey
{
get
{
return (m_params.ContainsKey("nodeKey") ? m_params["nodeKey"] : "");
}
}
public string Application
{
get
{
return (m_params.ContainsKey("app") ? m_params["app"] : m_params.ContainsKey("appAlias") ? m_params["appAlias"] : "");
}
}
public int StartNodeID
{
get
{
string val = (m_params.ContainsKey("id") ? m_params["id"] : "");
int sNodeID;
if (int.TryParse(HttpContext.Current.Request.QueryString["id"], out sNodeID))
return sNodeID;
return -1;
}
}
public string FunctionToCall
{
get
{
return (m_params.ContainsKey("functionToCall") ? m_params["functionToCall"] : "");
}
}
public bool IsDialog
{
get
{
bool value;
if (m_params.ContainsKey("isDialog"))
if (bool.TryParse(m_params["isDialog"], out value))
return value;
return false;
}
}
public TreeDialogModes DialogMode
{
get
{
if (m_params.ContainsKey("dialogMode") && IsDialog)
{
try
{
return (TreeDialogModes)Enum.Parse(typeof(TreeDialogModes), m_params["dialogMode"]);
}
catch
{
return TreeDialogModes.none;
}
}
return TreeDialogModes.none;
}
}
public bool ShowContextMenu
{
get
{
bool value;
if (m_params.ContainsKey("contextMenu"))
if (bool.TryParse(m_params["contextMenu"], out value))
return value;
return true;
}
}
public string TreeType
{
get
{
return (m_params.ContainsKey("treeType") ? m_params["treeType"] : "");
}
}
}
}
+28 -263
View File
@@ -22,39 +22,22 @@ using umbraco.interfaces;
using umbraco.DataLayer;
using System.Collections.Specialized;
using umbraco.IO;
using umbraco.uicontrols;
namespace umbraco.cms.presentation.Trees
{
/// <summary>
/// All Trees rely on the properties of an ITreeService interface. This has been created to avoid having trees
/// dependant on the HttpContext
/// </summary>
public interface ITreeService
{
/// <summary>
/// The NodeKey is a string representation of the nodeID. Generally this is used for tree's whos node's unique key value is a string in instead
/// of an integer such as folder names.
/// </summary>
string NodeKey { get; }
int StartNodeID { get; }
bool ShowContextMenu { get; }
bool IsDialog { get; }
TreeDialogModes DialogMode { get; }
string FunctionToCall { get; }
}
/// <summary>
/// A utility class to aid in creating the URL for returning XML for a tree structure and
/// for reading the parameters from the URL when a request is made.
/// </summary>
public class TreeService : ITreeService
public class TreeService : TreeUrlGenerator, ITreeService
{
/// <summary>
/// Default empty constructor
/// </summary>
public TreeService() { }
public TreeService() : base() { }
/// <summary>
/// Constructor to assign all TreeService properties except nodeKey in one call
@@ -68,12 +51,12 @@ namespace umbraco.cms.presentation.Trees
public TreeService(int? startNodeID, string treeType, bool? showContextMenu,
bool? isDialog, TreeDialogModes dialogMode, string app)
{
m_startNodeID = startNodeID;
m_treeType = treeType;
m_showContextMenu = showContextMenu;
m_isDialog = isDialog;
StartNodeID = startNodeID ?? -1;
TreeType = treeType;
ShowContextMenu = showContextMenu ?? true;
IsDialog = isDialog ?? false;
m_dialogMode = dialogMode;
m_app = app;
App = app;
}
/// <summary>
@@ -89,78 +72,32 @@ namespace umbraco.cms.presentation.Trees
public TreeService(int? startNodeID, string treeType, bool? showContextMenu,
bool? isDialog, TreeDialogModes dialogMode, string app, string nodeKey)
{
m_startNodeID = startNodeID;
m_treeType = treeType;
m_showContextMenu = showContextMenu;
m_isDialog = isDialog;
StartNodeID = startNodeID ?? -1;
TreeType = treeType;
ShowContextMenu = showContextMenu ?? true;
IsDialog = isDialog ?? false;
m_dialogMode = dialogMode;
m_app = app;
m_nodeKey = nodeKey;
App = app;
NodeKey = nodeKey;
}
public TreeService(int? startNodeID, string treeType, bool? showContextMenu,
bool? isDialog, TreeDialogModes dialogMode, string app, string nodeKey, string functionToCall)
{
m_startNodeID = startNodeID;
m_treeType = treeType;
m_showContextMenu = showContextMenu;
m_isDialog = isDialog;
StartNodeID = startNodeID ?? -1;
TreeType = treeType;
ShowContextMenu = showContextMenu ?? true;
IsDialog = isDialog ?? false;
m_dialogMode = dialogMode;
m_app = app;
m_nodeKey = nodeKey;
m_functionToCall = functionToCall;
App = app;
NodeKey = nodeKey;
FunctionToCall = functionToCall;
}
public const string TREE_URL = "tree.aspx";
public const string INIT_URL = "treeinit.aspx";
public const string PICKER_URL = "treepicker.aspx";
private int? m_startNodeID;
private string m_treeType;
private bool? m_showContextMenu;
private bool? m_isDialog;
private TreeDialogModes m_dialogMode;
private string m_app;
private string m_nodeKey;
private string m_functionToCall;
private TreeDialogModes m_dialogMode;
#region Public Properties
public string FunctionToCall
{
get { return m_functionToCall; }
set { m_functionToCall = value; }
}
public string NodeKey
{
get { return m_nodeKey; }
set { m_nodeKey = value; }
}
public int StartNodeID
{
get { return m_startNodeID ?? -1; }
set { m_startNodeID = value; }
}
public string TreeType
{
get { return m_treeType; }
set { m_treeType = value; }
}
public bool ShowContextMenu
{
get { return m_showContextMenu ?? true; }
set { m_showContextMenu = value; }
}
public bool IsDialog
{
get { return m_isDialog ?? false; }
set { m_isDialog = value; }
}
public TreeDialogModes DialogMode
{
@@ -168,22 +105,8 @@ namespace umbraco.cms.presentation.Trees
set { m_dialogMode = value; }
}
public string App
{
get { return m_app; }
set { m_app = value; }
}
#endregion
/// <summary>
/// Returns the url for servicing the xml tree request based on the parameters specified on this class.
/// </summary>
/// <returns>Tree service url as a string</returns>
public string GetServiceUrl()
{
return SystemDirectories.Umbraco + "/" + GetUrl(TREE_URL);
}
/// <summary>
/// Static method to return the tree service url with the specified parameters
/// </summary>
@@ -203,15 +126,6 @@ namespace umbraco.cms.presentation.Trees
return treeSvc.GetServiceUrl();
}
/// <summary>
/// Returns the url for initializing the tree based on the parameters specified on this class
/// </summary>
/// <returns></returns>
public string GetInitUrl()
{
return IOHelper.ResolveUrl( SystemDirectories.Umbraco + "/" + GetUrl(INIT_URL) );
}
/// <summary>
/// static method to return the tree init url with the specified parameters
/// </summary>
@@ -231,161 +145,12 @@ namespace umbraco.cms.presentation.Trees
return treeSvc.GetInitUrl();
}
/// <summary>
/// Returns the url for the tree picker (used on modal windows) based on the parameters specified on this class
/// </summary>
/// <param name="useSubModal"></param>
/// <returns></returns>
public static string GetPickerUrl(bool useSubModal, string app, string treeType)
{
TreeService treeSvc = new TreeService();
treeSvc.App = app;
treeSvc.TreeType = treeType;
return treeSvc.GetPickerUrl(useSubModal);
}
protected override string GetUrl(string pageUrl)
{
StringBuilder sb = new StringBuilder(base.GetUrl(pageUrl));
if (this.DialogMode != TreeDialogModes.none) sb.Append(string.Format("&dialogMode={0}", this.DialogMode.ToString()));
return sb.ToString();
}
/// <summary>
/// Returns the url for the tree picker (used on modal windows) based on the parameters specified on this class
/// </summary>
/// <param name="useSubModal"></param>
/// <returns></returns>
public string GetPickerUrl(bool useSubModal)
{
string url = IOHelper.ResolveUrl( SystemDirectories.Umbraco + "/dialogs/" + GetUrl(PICKER_URL) );
return url + (useSubModal ? "&useSubModal=true" : "");
}
/// <summary>
/// Generates the URL parameters for the tree service.
/// </summary>
/// <param name="pageUrl">the base url (i.e. tree.aspx)</param>
/// <returns></returns>
private string GetUrl(string pageUrl)
{
StringBuilder sb = new StringBuilder();
sb.Append(pageUrl);
//insert random
sb.Append(string.Format("?rnd={0}", Guid.NewGuid()));
sb.Append(string.Format("&id={0}", this.StartNodeID.ToString()));
if (!string.IsNullOrEmpty(this.TreeType)) sb.Append(string.Format("&treeType={0}", this.TreeType));
if (!string.IsNullOrEmpty(this.NodeKey)) sb.Append(string.Format("&nodeKey={0}", this.NodeKey));
sb.Append(string.Format("&contextMenu={0}", this.ShowContextMenu.ToString().ToLower()));
sb.Append(string.Format("&isDialog={0}", this.IsDialog.ToString().ToLower()));
if (this.DialogMode != TreeDialogModes.none) sb.Append(string.Format("&dialogMode={0}", this.DialogMode.ToString()));
if (!string.IsNullOrEmpty(this.App)) sb.Append(string.Format("&app={0}", this.App));
return sb.ToString();
}
}
/// <summary>
/// An ITreeService class that returns the values found in the Query String or any dictionary
/// </summary>
internal class TreeRequestParams : ITreeService
{
private TreeRequestParams() { }
private Dictionary<string, string> m_params;
public static TreeRequestParams FromQueryStrings()
{
Dictionary<string, string> p = new Dictionary<string, string>();
foreach (string key in HttpContext.Current.Request.QueryString.Keys)
{
p.Add(key, HttpContext.Current.Request.QueryString[key]);
//p.Add(item.Key.ToString(), item.Value.ToString());
}
return FromDictionary(p);
}
public static TreeRequestParams FromDictionary(Dictionary<string, string> items)
{
TreeRequestParams treeParams = new TreeRequestParams();
treeParams.m_params = items;
return treeParams;
}
public string NodeKey
{
get
{
return (m_params.ContainsKey("nodeKey") ? m_params["nodeKey"] : "");
}
}
public string Application
{
get
{
return (m_params.ContainsKey("app") ? m_params["app"] : m_params.ContainsKey("appAlias") ? m_params["appAlias"] : "");
}
}
public int StartNodeID
{
get
{
string val = (m_params.ContainsKey("id") ? m_params["id"] : "");
int sNodeID;
if (int.TryParse(HttpContext.Current.Request.QueryString["id"], out sNodeID))
return sNodeID;
return -1;
}
}
public string FunctionToCall
{
get
{
return (m_params.ContainsKey("functionToCall") ? m_params["functionToCall"] : "");
}
}
public bool IsDialog
{
get
{
bool value;
if (m_params.ContainsKey("isDialog"))
if (bool.TryParse(m_params["isDialog"], out value))
return value;
return false;
}
}
public TreeDialogModes DialogMode
{
get
{
if (m_params.ContainsKey("dialogMode") && IsDialog)
{
try
{
return (TreeDialogModes)Enum.Parse(typeof(TreeDialogModes), m_params["dialogMode"]);
}
catch
{
return TreeDialogModes.none;
}
}
return TreeDialogModes.none;
}
}
public bool ShowContextMenu
{
get
{
bool value;
if (m_params.ContainsKey("contextMenu"))
if (bool.TryParse(m_params["contextMenu"], out value))
return value;
return true;
}
}
public string TreeType
{
get
{
return (m_params.ContainsKey("treeType") ? m_params["treeType"] : "");
}
}
}
}
@@ -54,7 +54,7 @@ namespace umbraco
protected override void CreateRootNode(ref XmlTreeNode rootNode)
{
//TODO: SD: Find out what openMedia does!?
if (this.IsDialog)
rootNode.Action = "javascript:openMedia(-1);";
else
+1 -1
View File
@@ -34,7 +34,7 @@ namespace umbraco.presentation.cache
private static void Initialize()
{
List<Type> types = TypeFinder.FindClassesOfType<ICacheRefresher>(true);
List<Type> types = TypeFinder.FindClassesOfType<ICacheRefresher>();
foreach (Type t in types)
{
ICacheRefresher typeInstance = Activator.CreateInstance(t) as ICacheRefresher;
@@ -8,135 +8,70 @@ using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using umbraco.cms.presentation.Trees;
using ClientDependency.Core;
using umbraco.presentation;
using ClientDependency.Core.Controls;
using umbraco.uicontrols.TreePicker;
namespace umbraco.controls
{
[ClientDependency(ClientDependencyType.Javascript, "js/xmlextras.js", "UmbracoRoot")]
[ClientDependency(ClientDependencyType.Javascript, "js/xmlRequest.js", "UmbracoRoot")]
[ClientDependency(ClientDependencyType.Javascript, "webservices/ajax.js", "UmbracoRoot")]
[ClientDependency(ClientDependencyType.Javascript, "js/submodal/common.js", "UmbracoRoot")]
[ClientDependency(ClientDependencyType.Javascript, "js/submodal/subModal.js", "UmbracoRoot")]
[ClientDependency(ClientDependencyType.Css, "js/submodal/subModal.css", "UmbracoRoot")]
public class ContentPicker : System.Web.UI.WebControls.WebControl
public class ContentPicker : BaseTreePicker
{
public System.Web.UI.Control Editor { get { return this; } }
public ContentPicker()
{
AppAlias = "content";
TreeAlias = "content";
}
private string _text = "";
[Obsolete("Use Value property instead, this simply wraps it.")]
public string Text
{
get
{
if (Page.IsPostBack && !String.IsNullOrEmpty(helper.Request(this.ClientID)))
{
_text = helper.Request(this.ClientID);
}
return _text;
return this.Value;
}
set { _text = value; }
set
{
this.Value = value;
}
}
private string _appAlias = "content";
public string AppAlias
{
get { return _appAlias; }
set { _appAlias = value; }
}
public string AppAlias { get; set; }
public string TreeAlias { get; set; }
public override string TreePickerUrl
{
get
{
return TreeService.GetPickerUrl(AppAlias, TreeAlias);
}
}
private string _treeAlias = "content";
public string TreeAlias
{
get { return _treeAlias; }
set { _treeAlias = value; }
}
public override string ModalWindowTitle
{
get
{
return ui.GetText("general", "choose") + " " + ui.GetText("sections", TreeAlias.ToLower());
}
}
private bool _showDelete = true;
public bool ShowDelete
{
get { return _showDelete; }
set { _showDelete = value; }
}
private int m_modalWidth = 300;
public int ModalWidth
{
get { return m_modalWidth; }
set { m_modalWidth = value; }
}
private int m_modalHeight = 400;
public int ModalHeight
{
get { return m_modalHeight; }
set { m_modalHeight = value; }
}
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);
}
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 (this.Text != "" && this.Text != "-1")
{
tempTitle = new cms.businesslogic.CMSNode(int.Parse(this.Text)).Text;
}
else
{
tempTitle = (!string.IsNullOrEmpty(_treeAlias) ? ui.Text(_treeAlias) : ui.Text(_appAlias));
}
}
catch { }
writer.WriteLine("<script language=\"javascript\">\nfunction " + this.ClientID + "_chooseId() {" +
"\nshowPopWin('" + TreeService.GetPickerUrl(true, _appAlias, _treeAlias) + "', " + m_modalWidth + ", " + m_modalHeight + ", " + 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 = \"-1\";" +
"\n}" +
"\n</script>");
// Clear remove link if text if empty
if (this.Text == "" || !_showDelete)
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);
}
protected override string GetItemTitle()
{
string tempTitle = "";
try
{
if (this.Text != "" && this.Text != "-1")
{
tempTitle = new cms.businesslogic.CMSNode(int.Parse(this.Text)).Text;
}
else
{
tempTitle = (!string.IsNullOrEmpty(TreeAlias) ? ui.Text(TreeAlias) : ui.Text(AppAlias));
}
}
catch { }
return tempTitle;
}
}
}
@@ -15,7 +15,7 @@ namespace umbraco.controls
[ClientDependency(ClientDependencyType.Javascript, "ui/jqueryui.js", "UmbracoClient")]
[ClientDependency(ClientDependencyType.Css, "Tree/treeIcons.css", "UmbracoClient")]
[ClientDependency(ClientDependencyType.Css, "Tree/Themes/umbraco/styles.css", "UmbracoClient")]
[ClientDependency(ClientDependencyType.Css, "Tree/Themes/umbraco/style.css", "UmbracoClient")]
public partial class ContentTypeControlNew : System.Web.UI.UserControl
{
public uicontrols.TabPage InfoTabPage;
@@ -13,10 +13,6 @@
<a href="javascript:expandCollapse('<%=this.ClientID%>');"><img src="<%=umbraco.IO.SystemDirectories.Umbraco%>/images/expand.png" style="FLOAT: right"/>
<asp:Literal ID="FullHeader" Runat="server"></asp:Literal>
</a>
<!--
<a href="#" onclick="UmbClientMgr.mainWindow().openModal('dialogs/propertyEditor.aspx?propertyId=<%= this.Id %>&docTypeId=<%= Request.QueryString["id"] %>', 'Edit the property <%= this.Name %>', 500, 600); return false;">Edit</a>
-->
</h3>
</div>
@@ -168,7 +168,7 @@ namespace umbraco.controls.GenericProperties
DeleteButton2.Visible = false;
}
validationLink.NavigateUrl = "#";
validationLink.Attributes["onclick"] = ClientTools.Scripts.OpenModalWindow("dialogs/regexWs.aspx?target=" + tbValidation.ClientID , "Search for regular expression", 500, 600) + ";return false;";
validationLink.Attributes["onclick"] = ClientTools.Scripts.OpenModalWindow("dialogs/regexWs.aspx?target=" + tbValidation.ClientID, "Search for regular expression", 600, 500) + ";return false;";
// Data type definitions
if (_dataTypeDefinitions != null)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -0,0 +1,48 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ImageViewer.ascx.cs" Inherits="umbraco.controls.Images.ImageViewer" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="controls/Images/ImageViewer.js" PathNameAlias="UmbracoRoot" />
<div id="<%#this.ClientID%>" class="imageViewer" >
<asp:MultiView runat="server" ActiveViewIndex='<%#(int)ViewerStyle%>'>
<asp:View runat="server">
<a href="<%#MediaItemPath%>" title="<%#AltText%>" target="<%#LinkTarget%>">
<img src="<%#MediaItemThumbnailPath%>" alt="<%#AltText%>" border="0" class='<%#ImageFound ? "" : "noimage" %>' />
</a>
</asp:View>
<asp:View runat="server">
<img src="<%#MediaItemThumbnailPath%>" alt="<%#AltText%>" border="0" class='<%#ImageFound ? "" : "noimage" %>' />
</asp:View>
<asp:View runat="server">
<div class="bgImage"
style="width: 105px; height: 105px; background: #fff center center no-repeat;border: 1px solid #ccc; background-image: url('<%#MediaItemThumbnailPath.Replace(" ", "%20")%>');">
</div>
</asp:View>
</asp:MultiView>
<%--Register the javascript callback method if any.--%>
<script type="text/javascript">
<%#string.IsNullOrEmpty(ClientCallbackMethod) ? "" : ClientCallbackMethod + "('" + MediaItemPath + "','" + AltText + "','" + FileWidth + "','" + FileHeight + "');" %>
</script>
</div>
<%--Ensure that the client API is registered for the image.--%>
<script type="text/javascript">
var opts = {
umbPath: "<%#umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco)%>",
style: "<%#ViewerStyle.ToString()%>",
linkTarget: "<%#LinkTarget%>"
};
if (jQuery.isReady) {
//because this may be rendered with AJAX, the doc may already be ready! so just wire it up.
jQuery("#<%#this.ClientID%>").UmbracoImageViewer(opts);
}
else {
jQuery(document).ready(function() {
jQuery("#<%#this.ClientID%>").UmbracoImageViewer(opts);
});
}
</script>
@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.cms.businesslogic.media;
namespace umbraco.controls.Images
{
public partial class ImageViewer : System.Web.UI.UserControl
{
public ImageViewer()
{
MediaItemPath = "#";
MediaItemThumbnailPath = umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/images/blank.png";
AltText = "No Image";
ImageFound = false;
ViewerStyle = Style.Basic;
LinkTarget = "_blank";
}
/// <summary>
/// A JS method to invoke when the image is loaded. The method should accept the media ID.
/// </summary>
public string ClientCallbackMethod { get; set; }
public int MediaId { get; set; }
/// <summary>
/// The style to render the image viewer in
/// </summary>
public enum Style
{
Basic = 0,
ImageLink = 1,
ThumbnailPreview = 2
}
public Style ViewerStyle { get; set; }
public string LinkTarget { get; set; }
public string MediaItemPath { get; private set; }
public string MediaItemThumbnailPath { get; private set; }
public string AltText { get; private set; }
public int FileWidth { get { return m_FileWidth; } }
public int FileHeight { get { return m_FileHeight; } }
protected bool ImageFound { get; private set; }
private int m_FileWidth = 0;
private int m_FileHeight = 0;
private bool m_IsBound = false;
/// <summary>
/// automatically bind if it's not explicitly called.
/// </summary>
/// <param name="e"></param>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (!m_IsBound)
{
DataBind();
}
}
public override void DataBind()
{
LookupData();
base.DataBind();
this.m_IsBound = true;
}
private void LookupData()
{
if (MediaId > 0)
{
Media m = new Media(MediaId);
// TODO: Remove "Magic strings" from code.
var pFile = m.getProperty("fileName");
if (pFile == null) pFile = m.getProperty("umbracoFile");
if (pFile == null) pFile = m.getProperty("file");
if (pFile == null)
{
//the media requested does not correspond with the standard umbraco properties
return;
}
MediaItemPath = pFile.Value != null && !string.IsNullOrEmpty(pFile.Value.ToString())
? umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/.." + pFile.Value.ToString()
: "#";
AltText = MediaItemPath != "#" ? m.Text : ui.GetText("no") + " " + ui.GetText("media");
var pWidth = m.getProperty("umbracoWidth");
var pHeight = m.getProperty("umbracoHeight");
if (pWidth != null && pWidth.Value != null && pHeight != null && pHeight.Value != null)
{
int.TryParse(pHeight.Value.ToString(), out m_FileWidth);
int.TryParse(pHeight.Value.ToString(), out m_FileHeight);
}
string ext = MediaItemPath.Substring(MediaItemPath.LastIndexOf(".") + 1, MediaItemPath.Length - MediaItemPath.LastIndexOf(".") - 1);
MediaItemThumbnailPath = MediaItemPath.Replace("." + ext, "_thumb.jpg");
ImageFound = true;
}
}
}
}
@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.controls.Images {
public partial class ImageViewer {
/// <summary>
/// JsInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude1;
}
}
@@ -0,0 +1,133 @@
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
/// <reference path="/umbraco_client/ui/jquery.js" />
Umbraco.Sys.registerNamespace("Umbraco.Controls");
(function($) {
//jQuery plugin for Umbraco image viewer control
$.fn.UmbracoImageViewer = function(opts) {
//all options must be specified
var conf = $.extend({
style: false,
linkTarget: "_blank",
umbPath: ""
}, opts);
return this.each(function() {
new Umbraco.Controls.ImageViewer().init($(this), conf);
});
}
$.fn.UmbracoImageViewerAPI = function() {
/// <summary>exposes the Umbraco Image Viewer api for the selected object</summary>
//if there's more than item in the selector, throw exception
if ($(this).length != 1) {
throw "UmbracoImageViewerAPI selector requires that there be exactly one control selected";
};
return Umbraco.Controls.ImageViewer.inst[$(this).attr("id")] || null;
};
Umbraco.Controls.ImageViewer = function() {
return {
_cntr: ++Umbraco.Controls.ImageViewer.cntr,
_containerId: null,
_context: null,
_serviceUrl: "",
_umbPath: "",
_style: false,
_linkTarget: "",
init: function(jItem, opts) {
//this is stored so that we search the current document/iframe for this object
//when calling _getContainer. Before this was not required but for some reason inside the
//TinyMCE popup, when doing an ajax call, the context is lost to the jquery item!
this._context = jItem.get(0).ownerDocument;
//store a reference to this api by the id and the counter
Umbraco.Controls.ImageViewer.inst[this._cntr] = this;
if (!jItem.attr("id")) jItem.attr("id", "UmbImageViewer_" + this._cntr);
Umbraco.Controls.ImageViewer.inst[jItem.attr("id")] = Umbraco.Controls.ImageViewer.inst[this._cntr];
this._containerId = jItem.attr("id");
this._umbPath = opts.umbPath;
this._serviceUrl = this._umbPath + "/controls/Images/ImageViewerUpdater.asmx";
this._style = opts.style;
this._linkTarget = opts.linkTarget;
},
updateImage: function(mediaId, callback) {
/// <summary>Updates the image to show the mediaId parameter using AJAX</summary>
this._showThrobber();
var _this = this;
$.ajax({
type: "POST",
url: _this._serviceUrl + "/UpdateImage",
data: '{ "mediaId": ' + parseInt(mediaId) + ', "style": "' + _this._style + '", "linkTarget": "' + _this._linkTarget + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
var rHtml = $("<div>").append(msg.d.html); //get the full html response wrapped in temp div
_this._updateImageFromAjax(rHtml);
if (typeof callback == "function") {
//build the parameters to pass back to the callback method
var params = {
hasImage: _this._getContainer().find("img.noimage").length == 0,
mediaId: msg.d.mediaId,
width: msg.d.width,
height: msg.d.height,
url: msg.d.url,
alt: msg.d.alt
};
//call the callback method
callback.call(_this, params);
}
}
});
},
showImage: function(path) {
/// <summary>This will force the image to show the path passed in </summary>
if (this._style != "ThumbnailPreview") {
this._getContainer().find("img").attr("src", path);
}
else {
c = this._getContainer().find(".bgImage");
c.css("background-image", "url('" + path + "')");
}
},
_getContainer: function() {
return $("#" + this._containerId, this._context);
},
_updateImageFromAjax: function(rHtml) {
this._getContainer().html(rHtml.find(".imageViewer").html()); //replace the html with the inner html of the image viewer response
},
_showThrobber: function() {
var c = null;
if (this._style != "ThumbnailPreview") {
c = this._getContainer().find("img");
c.attr("src", this._umbPath + "/images/throbber.gif");
c.css("margin-top", ((c.height() - 15) / 2) + "px");
c.css("margin-left", ((c.width() - 15) / 2) + "px");
}
else {
c = this._getContainer().find(".bgImage");
c.css("background-image", "");
c.html("<img id='throbber'/>");
var img = c.find("img");
img.attr("src", this._umbPath + "/images/throbber.gif");
img.css("margin-top", "45px");
img.css("margin-left", "45px");
}
}
}
}
// instance manager
Umbraco.Controls.ImageViewer.cntr = 0;
Umbraco.Controls.ImageViewer.inst = {};
})(jQuery);
@@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="ImageViewerUpdater.asmx.cs" Class="umbraco.controls.Images.ImageViewerUpdater" %>
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Script.Services;
using System.Web.UI;
using umbraco.controls.Images;
using System.IO;
using System.Web.Script.Serialization;
using umbraco.businesslogic.Utils;
namespace umbraco.controls.Images
{
/// <summary>
/// An ajax service to return the html for an image based on a media id
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
[ScriptService]
public class ImageViewerUpdater : System.Web.Services.WebService
{
/// <summary>
/// return the a json object with the properties
/// html = the html returned for rendering the image viewer
/// mediaId = the media id loaded
/// width = the width of the media (0) if not found
/// height = the height of the media (0) if not found
/// url = the url of the image
/// alt = the alt text for the image
/// </summary>
/// <returns></returns>
[WebMethod]
public Dictionary<string, string> UpdateImage(int mediaId, string style, string linkTarget)
{
//load the control with the specified properties and render the output as a string and return it
Page page = new Page();
string path = umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/controls/Images/ImageViewer.ascx";
ImageViewer imageViewer = page.LoadControl(path) as ImageViewer;
imageViewer.MediaId = mediaId;
ImageViewer.Style _style = (ImageViewer.Style)Enum.Parse(typeof(ImageViewer.Style), style);
imageViewer.ViewerStyle = _style;
imageViewer.LinkTarget = linkTarget;
//this adds only the anchor with image to be rendered, not the whole control!
page.Controls.Add(imageViewer);
imageViewer.DataBind();
StringWriter sw = new StringWriter();
HttpContext.Current.Server.Execute(page, sw, false);
Dictionary<string, string> rVal = new Dictionary<string, string>();
rVal.Add("html", sw.ToString());
rVal.Add("mediaId", imageViewer.MediaId.ToString());
rVal.Add("width", imageViewer.FileWidth.ToString());
rVal.Add("height", imageViewer.FileHeight.ToString());
rVal.Add("url", imageViewer.MediaItemPath);
rVal.Add("alt", imageViewer.AltText);
return rVal;
}
}
}
@@ -0,0 +1,28 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UploadMediaImage.ascx.cs"
Inherits="umbraco.controls.Images.UploadMediaImage" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Register TagPrefix="ctl" Namespace="umbraco.controls" Assembly="umbraco" %>
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="controls/Images/UploadMediaImage.js" PathNameAlias="UmbracoRoot" />
<script type="text/javascript">
var uploader_<%=this.ClientID%> = new Umbraco.Controls.UploadMediaImage("<%=TextBoxTitle.ClientID%>", "<%=SubmitButton.ClientID%>", "<%=((Control)UploadField.DataEditor).ClientID%>");
</script>
<cc1:pane id="pane_upload" runat="server">
<cc1:PropertyPanel ID="pp_name" runat="server" Text="Name">
<asp:TextBox id="TextBoxTitle" runat="server"></asp:TextBox>
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="pp_file" runat="server" Text="File">
<asp:PlaceHolder id="UploadControl" runat="server"></asp:PlaceHolder>
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="pp_target" runat="server" Text="Save at...">
<ctl:ContentPicker runat="server" ID="MediaPickerControl" AppAlias="media" TreeAlias="media"
ModalHeight="200" ShowDelete="false" ShowHeader="false" Text='<%#umbraco.BasePages.BasePage.Current.getUser().StartMediaId.ToString()%>' />
</cc1:PropertyPanel>
<cc1:PropertyPanel ID="pp_button" runat="server" Text=" ">
<asp:Button id="SubmitButton" runat="server" Text='<%#umbraco.ui.Text("save")%>' Enabled="false" OnClick="SubmitButton_Click"></asp:Button>
</cc1:PropertyPanel>
</cc1:pane>
<cc1:feedback id="feedback" runat="server" />
@@ -0,0 +1,117 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Linq;
using System.Xml;
using umbraco.BasePages;
using umbraco.uicontrols;
using umbraco.interfaces;
using umbraco.cms.businesslogic.media;
namespace umbraco.controls.Images
{
/// <summary>
/// A control to render out the controls to upload a new image to media.
/// Includes ability to select where in the media you would like it to upload and also supports client
/// callback methods once complete.
/// </summary>
public partial class UploadMediaImage : System.Web.UI.UserControl
{
public UploadMediaImage()
{
OnClientUpload = "";
}
/// <summary>
/// The JavaScript method to be invoked once the image is uploaded, the page is rendered and the document is ready.
/// The method will receive a JSON object with the following parameters:
/// - imagePath
/// - thumbnailPath
/// - width
/// - height
/// - id
/// </summary>
public string OnClientUpload { get; set; }
protected IDataType UploadField = new cms.businesslogic.datatype.controls.Factory().GetNewObject(new Guid("5032a6e6-69e3-491d-bb28-cd31cd11086c"));
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// Get upload field from datafield factory
UploadControl.Controls.Add((Control)UploadField.DataEditor);
}
protected void Page_Load(object sender, EventArgs e)
{
((HtmlInputFile)UploadField.DataEditor).ID = "uploadFile";
if (!IsPostBack)
{
DataBind();
}
}
protected void SubmitButton_Click(object sender, EventArgs e)
{
Media m = Media.MakeNew(TextBoxTitle.Text, cms.businesslogic.media.MediaType.GetByAlias("image"), BasePage.Current.getUser(), int.Parse(MediaPickerControl.Text));
var props = m.getProperties;
foreach (cms.businesslogic.property.Property p in props)
{
if (p.PropertyType.DataTypeDefinition.DataType.Id == UploadField.Id)
{
UploadField.DataTypeDefinitionId = p.PropertyType.DataTypeDefinition.Id;
UploadField.Data.PropertyId = p.Id;
}
}
UploadField.DataEditor.Save();
// Generate xml on image
m.XmlGenerate(new XmlDocument());
pane_upload.Visible = false;
//this seems real ugly since we apparently already have the properties above (props)... but this data layer is insane and undecipherable:)
string mainImage = m.getProperty("umbracoFile").Value.ToString();
string extension = mainImage.Substring(mainImage.LastIndexOf(".") + 1, mainImage.Length - mainImage.LastIndexOf(".") - 1);
var thumbnail = mainImage.Remove(mainImage.Length - extension.Length - 1, extension.Length + 1) + "_thumb.jpg";
string width = m.getProperty("umbracoWidth").Value.ToString();
string height = m.getProperty("umbracoHeight").Value.ToString();
int id = m.Id;
feedback.Style.Add("margin-top", "8px");
feedback.type = uicontrols.Feedback.feedbacktype.success;
feedback.Text += "<div style=\"text-align: center\"> <a target=\"_blank\" href='" + umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/.." + mainImage + "'><img src='" + umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/.." + thumbnail + "' style='border: none;'/><br/><br/>";
feedback.Text += ui.Text("thumbnailimageclickfororiginal") + "</a><br/><br/></div>";
if (!string.IsNullOrEmpty(OnClientUpload))
{
feedback.Text += @"
<script type=""text/javascript"">
jQuery(document).ready(function() {
" + OnClientUpload + @".call(this, {imagePath: '" + mainImage + @"', thumbnailPath: '" + thumbnail + @"', width: " + width + @", height: " + height + @", id: " + id.ToString() + @"});
});
</script>";
}
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
((HtmlInputFile)UploadField.DataEditor).Attributes.Add("onChange", "uploader_" + this.ClientID + ".validateImage();");
}
}
}
@@ -0,0 +1,109 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.controls.Images
{
public partial class UploadMediaImage {
/// <summary>
/// JsInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude1;
/// <summary>
/// pane_upload control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_upload;
/// <summary>
/// pp_name control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_name;
/// <summary>
/// TextBoxTitle control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox TextBoxTitle;
/// <summary>
/// pp_file control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_file;
/// <summary>
/// UploadControl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder UploadControl;
/// <summary>
/// pp_target control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_target;
/// <summary>
/// pp_button control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_button;
/// <summary>
/// SubmitButton control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button SubmitButton;
/// <summary>
/// feedback control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Feedback feedback;
protected global::umbraco.controls.ContentPicker MediaPickerControl;
}
}
@@ -0,0 +1,33 @@
/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
Umbraco.Sys.registerNamespace("Umbraco.Controls");
(function($) {
Umbraco.Controls.UploadMediaImage = function(txtBoxTitleID, btnID, uploadFileID) {
return {
_txtBoxTitleID: txtBoxTitleID,
_btnID: btnID,
_uplaodFileID: uploadFileID,
validateImage: function() {
// Disable save button
var imageTypes = ",jpeg,jpg,gif,bmp,png,tiff,tif,";
var tb_title = document.getElementById(this._txtBoxTitleID);
var bt_submit = $("#" + this._btnID);
var tb_image = document.getElementById(this._uplaodFileID);
bt_submit.attr("disabled","disabled").css("color", "gray");
var imageName = tb_image.value;
if (imageName.length > 0) {
var extension = imageName.substring(imageName.lastIndexOf(".") + 1, imageName.length);
if (imageTypes.indexOf(',' + extension.toLowerCase() + ',') > -1) {
bt_submit.removeAttr("disabled").css("color", "#000");
if (tb_title.value == "")
tb_title.value = imageName.substring(imageName.lastIndexOf("\\") + 1, imageName.length).replace("." + extension, "");
}
}
}
};
}
})(jQuery);
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;
using umbraco.interfaces;
using System.Text.RegularExpressions;
using umbraco.BusinessLogic.Actions;
using umbraco.businesslogic.Utils;
using System.Text;
using umbraco.cms.presentation.Trees;
using umbraco.BasePages;
using System.Web.Services;
namespace umbraco.controls.Tree
{
internal class JTreeContextMenu
{
public string RenderJSONMenu()
{
JSONSerializer jSSerializer = new JSONSerializer();
jSSerializer.RegisterConverters(new List<JavaScriptConverter>()
{
new JTreeContextMenuItem()
});
List<IAction> allActions = new List<IAction>();
foreach (IAction a in global::umbraco.BusinessLogic.Actions.Action.GetAll())
{
if (!string.IsNullOrEmpty(a.Alias) && (!string.IsNullOrEmpty(a.JsFunctionName) || !string.IsNullOrEmpty(a.JsSource)))
{
allActions.Add(a);
}
}
return jSSerializer.Serialize(allActions);
}
}
}
@@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;
using umbraco.interfaces;
using System.Text.RegularExpressions;
using umbraco.BusinessLogic.Actions;
using umbraco.businesslogic.Utils;
using System.Text;
using umbraco.cms.presentation.Trees;
using umbraco.BasePages;
using System.Web.Services;
namespace umbraco.controls.Tree
{
internal class JTreeContextMenuItem : JavaScriptConverter
{
/// <summary>
/// Not implemented as we never need to Deserialize
/// </summary>
/// <param name="dictionary"></param>
/// <param name="type"></param>
/// <param name="serializer"></param>
/// <returns></returns>
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
throw new NotImplementedException();
}
public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
{
//{
// "id": "L",
// "label": "Create",
// "icon": "create.png",
// "visible": function(NODE, TREE_OBJ) { if (NODE.length != 1) return false; return TREE_OBJ.check("creatable", NODE); },
// "action": function(NODE, TREE_OBJ) { TREE_OBJ.create(false, NODE); },
//}
IAction a = (IAction)obj;
Dictionary<string, object> data = new Dictionary<string, object>();
data.Add("id", a.Letter);
data.Add("label", ui.Text(a.Alias));
if (a.Icon.StartsWith("."))
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("<div class='menuSpr {0}'>", a.Icon.TrimStart('.')));
sb.Append("</div>");
sb.Append("<div class='menuLabel'>");
sb.Append(data["label"].ToString());
sb.Append("</div>");
data["label"] = sb.ToString();
}
else
{
data.Add("icon", a.Icon);
}
//required by jsTree
data.Add("visible", JSONSerializer.ToJSONObject("function() {return true;}"));
//The action handler is what is assigned to the IAction, but for flexibility, we'll call our onContextMenuSelect method which will need to return true if the function is to execute.
//TODO: Check if there is a JSSource
data.Add("action", JSONSerializer.ToJSONObject("function(N,T){" + a.JsFunctionName + ";}"));
return data;
}
/// <summary>
/// TODO: Find out why we can't just return IAction as one type (JavaScriptSerializer doesn't seem to pick up on it)
/// </summary>
public override IEnumerable<Type> SupportedTypes
{
get
{
List<Type> types = new List<Type>();
foreach (IAction a in global::umbraco.BusinessLogic.Actions.Action.GetAll())
{
types.Add(a.GetType());
}
return types;
}
}
}
}
@@ -1,4 +1,4 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TreeControl.ascx.cs" Inherits="umbraco.presentation.umbraco.controls.TreeControl" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TreeControl.ascx.cs" Inherits="umbraco.controls.Tree.TreeControl" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<umb:CssInclude ID="CssInclude2" runat="server" FilePath="Tree/treeIcons.css" PathNameAlias="UmbracoClient" Priority="10" />
@@ -17,38 +17,49 @@
<umb:JsInclude ID="JsInclude9" runat="server" FilePath="Tree/NodeDefinition.js" PathNameAlias="UmbracoClient" Priority="12" />
<umb:JsInclude ID="JsInclude10" runat="server" FilePath="Tree/UmbracoTree.js" PathNameAlias="UmbracoClient" Priority="13" />
<script type="text/javascript">
jQuery(document).ready(function() {
var ctxMenu = <%#GetJSONContextMenu() %>;
var initNode = <%#GetJSONInitNode() %>;
var app = "<%#TreeSvc.App%>";
var showContext = <%#TreeSvc.ShowContextMenu.ToString().ToLower()%>;
var isDialog = <%#TreeSvc.IsDialog.ToString().ToLower()%>;
jQuery("#<%#string.IsNullOrEmpty(CustomContainerId) ? "treeContainer" : CustomContainerId %>").UmbracoTree({
var ctxMenu = <%#GetJSONContextMenu() %>;
var app = "<%#App%>";
var showContext = <%#ShowContextMenu.ToString().ToLower()%>;
var isDialog = <%#IsDialog.ToString().ToLower()%>;
var dialogMode = "<%#DialogMode.ToString()%>";
var treeType = "<%#TreeType%>";
var functionToCall = "<%#FunctionToCall%>";
var nodeKey = "<%#NodeKey%>";
//create the javascript tree
jQuery("#<%=ClientID%>").UmbracoTree({
jsonFullMenu: ctxMenu,
jsonInitNode: initNode,
//jsonInitNode: initNode,
appActions: UmbClientMgr.appActions(),
uiKeys: UmbClientMgr.uiKeys(),
app: app,
showContext: showContext,
isDialog: isDialog,
umb_clientFolderRoot: "<%#umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco_client) %>",
treeType: "<%#TreeType.ToString().ToLower()%>",
dataUrl: "<%# umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Webservices) %>/TreeDataService.ashx",
serviceUrl: "<%# umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Webservices) %>/TreeClientService.asmx/GetInitAppTreeData"});
dialogMode: dialogMode,
treeType: treeType,
functionToCall : functionToCall,
nodeKey : nodeKey,
umbClientFolderRoot: "<%#umbraco.GlobalSettings.ClientPath%>",
treeMode: "<%#Mode.ToString().ToLower()%>",
dataUrl: "<%#umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco)%>/webservices/TreeDataService.ashx",
serviceUrl: "<%#umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco)%>/webservices/TreeClientService.asmx/GetInitAppTreeData"});
//add event handler for ajax errors, this will refresh the whole application
UmbClientMgr.mainTree().addEventHandler("ajaxError", function(e) {
if (e.msg == "rebuildTree") {
UmbClientMgr.mainWindow("umbraco.aspx");
}
});
//add event handler for ajax errors, this will refresh the whole application
UmbClientMgr.mainTree().addEventHandler("ajaxError", function(e) {
if (e.msg == "rebuildTree") {
UmbClientMgr.mainWindow("umbraco.aspx");
}
});
});
</script>
<div class="<%#TreeType.ToString().ToLower()%>" id="<%#string.IsNullOrEmpty(CustomContainerId) ? "treeContainer" : CustomContainerId %>">
<div runat="server" id="TreeContainer">
<div id="<%=ClientID%>" class="<%#Mode.ToString().ToLower()%>">
</div>
</div>
@@ -0,0 +1,390 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;
using umbraco.interfaces;
using System.Text.RegularExpressions;
using umbraco.BusinessLogic.Actions;
using umbraco.businesslogic.Utils;
using System.Text;
using umbraco.cms.presentation.Trees;
using umbraco.BasePages;
using System.Web.Services;
using System.Drawing;
namespace umbraco.controls.Tree
{
/// <summary>
/// The Umbraco tree control.
/// <remarks>If this control doesn't exist on an UmbracoEnsuredPage it will not work.</remarks>
/// </summary>
public partial class TreeControl : System.Web.UI.UserControl, ITreeService
{
/// <summary>
/// Set the defaults
/// </summary>
public TreeControl()
{
Width = Unit.Empty;
Height = Unit.Empty;
BackColor = Color.Empty;
CssClass = "";
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
EnableViewState = false;
}
public enum TreeMode
{
Standard, Checkbox, InheritedCheckBox
}
/// <summary>
/// If there is not application or tree specified in a query string then this is the application to load.
/// </summary>
private const string DEFAULT_APP = "content";
private List<BaseTree> m_ActiveTrees = new List<BaseTree>();
private List<BaseTree> m_AllAppTrees = new List<BaseTree>();
private List<TreeDefinition> m_ActiveTreeDefs = null;
private TreeMode m_TreeType = TreeMode.Standard;
private bool m_IsInit = false;
private TreeService m_TreeService = new TreeService();
#region Public Properties
#region Style Properties
public string CssClass { get; set; }
public Unit Height { get; set; }
public Unit Width { get; set; }
public Color BackColor { get; set; }
#endregion
#region TreeService parameters.
public string FunctionToCall
{
get { return m_TreeService.FunctionToCall; }
set
{
m_TreeService.FunctionToCall = value;
}
}
public string NodeKey
{
get { return m_TreeService.NodeKey; }
set
{
m_TreeService.NodeKey = value;
}
}
public int StartNodeID
{
get { return m_TreeService.StartNodeID; }
set
{
m_TreeService.StartNodeID = value;
}
}
public string TreeType
{
get { return m_TreeService.TreeType; }
set
{
m_TreeService.TreeType = value;
}
}
public bool ShowContextMenu
{
get { return m_TreeService.ShowContextMenu; }
set
{
m_TreeService.ShowContextMenu = value;
}
}
public bool IsDialog
{
get { return m_TreeService.IsDialog; }
set
{
m_TreeService.IsDialog = value;
}
}
public TreeDialogModes DialogMode
{
get { return m_TreeService.DialogMode; }
set
{
m_TreeService.DialogMode = value;
}
}
public string App
{
get
{
return GetCurrentApp();
}
set
{
m_TreeService.App = value;
}
}
#endregion
/// <summary>
/// Allows for checkboxes to be used with the tree. Default is standard.
/// </summary>
public TreeMode Mode
{
get
{
return m_TreeType;
}
set
{
m_TreeType = value;
}
}
/// <summary>
/// Returns the requires JavaScript as a string for the current application
/// </summary>
public string JSCurrApp
{
get
{
StringBuilder javascript = new StringBuilder();
foreach (BaseTree bTree in m_AllAppTrees)
bTree.RenderJS(ref javascript);
return javascript.ToString();
}
}
#endregion
/// <summary>
/// Can be set explicitly which will override what is in query strings or what has been set by properties.
/// Useful for rendering out a tree dynamically with an instance of anoterh TreeService.
/// By using this method, it will undo any of the tree service public properties that may be set
/// on this object.
/// </summary>
public void SetTreeService(TreeService srv)
{
m_TreeService = srv;
Initialize();
}
/// <summary>
/// Initializes the control and looks up the tree structures that are required to be rendered.
/// Properties of the control (or SetTreeService) need to be set before pre render or calling
/// GetJSONContextMenu or GetJSONNode
/// </summary>
protected void Initialize()
{
//use the query strings if the TreeParams isn't explicitly set
if (m_TreeService == null)
{
m_TreeService = TreeRequestParams.FromQueryStrings().CreateTreeService();
}
m_TreeService.App = GetCurrentApp();
// Validate permissions
if (!BasePages.BasePage.ValidateUserContextID(BasePages.BasePage.umbracoUserContextID))
return;
UmbracoEnsuredPage page = new UmbracoEnsuredPage();
if (!page.ValidateUserApp(GetCurrentApp()))
throw new ArgumentException("The current user doesn't have access to this application. Please contact the system administrator.");
//find all tree definitions that have the current application alias that are ACTIVE
m_ActiveTreeDefs = TreeDefinitionCollection.Instance.FindActiveTrees(GetCurrentApp());
//find all tree defs that exists for the current application regardless of if they are active
List<TreeDefinition> appTreeDefs = TreeDefinitionCollection.Instance.FindTrees(GetCurrentApp());
//Create the BaseTree's based on the tree definitions found
foreach (TreeDefinition treeDef in appTreeDefs)
{
//create the tree and initialize it
BaseTree bTree = treeDef.CreateInstance();
bTree.SetTreeParameters(m_TreeService);
//store the created tree
m_AllAppTrees.Add(bTree);
if (treeDef.Tree.Initialize)
m_ActiveTrees.Add(bTree);
}
m_IsInit = true;
}
/// <summary>
/// This calls the databind method to bind the data binding syntax on the front-end.
/// <remarks>
/// Databinding was used instead of inline tags in case the tree properties needed to be set
/// by other classes at runtime
/// </remarks>
/// </summary>
/// <param name="e"></param>
/// <remarks>
/// This will initialize the control so all TreeService properties need to be set before hand
/// </remarks>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (!m_IsInit)
Initialize();
//Render out the JavaScript associated with all of the trees for the application
RenderTreeJS();
//apply the styles
if (Width != Unit.Empty)
TreeContainer.Style.Add( HtmlTextWriterStyle.Width, Width.ToString());
if (Height != Unit.Empty)
TreeContainer.Style.Add(HtmlTextWriterStyle.Height, Height.ToString());
if (BackColor != Color.Empty)
TreeContainer.Style.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(BackColor));
if (CssClass != "")
{
TreeContainer.Attributes.Add("class", CssClass);
}
else
{
//add the default class
TreeContainer.Attributes.Add("class", "treeContainer");
}
DataBind();
}
/// <summary>
/// Returns the JSON markup for the full context menu
/// </summary>
public string GetJSONContextMenu()
{
if (ShowContextMenu)
{
JTreeContextMenu menu = new JTreeContextMenu();
return menu.RenderJSONMenu();
}
else
{
return "{}";
}
}
/// <summary>
/// Returns the JSON markup for one node
/// </summary>
/// <param name="treeAlias"></param>
/// <param name="nodeId"></param>
/// <returns></returns>
/// <remarks>
/// This will initialize the control so all TreeService properties need to be set before hand
/// </remarks>
public string GetJSONNode(string nodeId)
{
if (!m_IsInit)
Initialize();
if (string.IsNullOrEmpty(m_TreeService.TreeType))
{
throw new ArgumentException("The TreeType is not set on the tree service");
}
BaseTree tree = m_ActiveTrees.Find(
delegate(BaseTree t)
{
return (t.TreeAlias == m_TreeService.TreeType);
}
);
return tree.GetSerializedNodeData(nodeId);
}
/// <summary>
/// Returns the JSON markup for the first node in the tree
/// </summary>
public string GetJSONInitNode()
{
if (!m_IsInit)
Initialize();
//if there is only one tree to render, we don't want to have a node to hold sub trees, we just want the
//stand alone tree, so we'll just add a TreeType to the TreeService and ensure that the right method gets loaded in tree.aspx
if (m_ActiveTrees.Count == 1)
{
m_TreeService.TreeType = m_ActiveTreeDefs[0].Tree.Alias;
//convert the menu to a string
//string initActions = (TreeSvc.ShowContextMenu ? Action.ToString(m_ActiveTrees[0].RootNodeActions) : "");
//Since there's only 1 tree, render out the tree's RootNode properties
XmlTree xTree = new XmlTree();
xTree.Add(m_ActiveTrees[0].RootNode);
return xTree.ToString();
}
else
{
//If there is more than 1 tree for the application than render out a
//container node labelled with the current application.
XmlTree xTree = new XmlTree();
XmlTreeNode xNode = XmlTreeNode.CreateRoot(new NullTree(GetCurrentApp()));
xNode.Text = ui.Text("sections", GetCurrentApp(), UmbracoEnsuredPage.CurrentUser);
xNode.Source = m_TreeService.GetServiceUrl();
xNode.Action = ClientTools.Scripts.OpenDashboard(GetCurrentApp());
xNode.NodeType = m_TreeService.App.ToLower();
xNode.NodeID = "-1";
xNode.Icon = ".sprTreeFolder";
xTree.Add(xNode);
return xTree.ToString();
}
}
private void RenderTreeJS()
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Trees_" + GetCurrentApp(), JSCurrApp, true);
}
/// <summary>
/// Return the current application alias. If neither the TreeType of Application is specified
/// than return the default application. If the Application is null but there is a TreeType then
/// find the application that the tree type is associated with.
/// </summary>
private string GetCurrentApp()
{
//if theres an treetype specified but no application
if (string.IsNullOrEmpty(m_TreeService.App) &&
!string.IsNullOrEmpty(m_TreeService.TreeType))
{
TreeDefinition treeDef = TreeDefinitionCollection.Instance.FindTree(m_TreeService.TreeType);
if (treeDef != null)
return treeDef.App.alias;
}
else if (!string.IsNullOrEmpty(m_TreeService.App))
return m_TreeService.App;
//if everything is null then return the default app
return DEFAULT_APP;
}
}
}
@@ -1,14 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3603
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.presentation.umbraco.controls {
namespace umbraco.controls.Tree {
public partial class TreeControl {
@@ -138,5 +138,14 @@ namespace umbraco.presentation.umbraco.controls {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude10;
/// <summary>
/// TreeContainer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl TreeContainer;
}
}
@@ -1,383 +0,0 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;
using umbraco.interfaces;
using System.Text.RegularExpressions;
using umbraco.BusinessLogic.Actions;
using umbraco.businesslogic.Utils;
using System.Text;
using umbraco.cms.presentation.Trees;
using umbraco.BasePages;
using System.Web.Services;
namespace umbraco.presentation.umbraco.controls
{
/// <summary>
/// The Umbraco tree control.
/// <remarks>If this control doesn't exist on an UmbracoEnsuredPage it will not work.</remarks>
/// </summary>
public partial class TreeControl : System.Web.UI.UserControl
{
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
EnableViewState = false;
}
public enum TreeMode
{
Standard, Checkbox, InheritedCheckBox
}
/// <summary>
/// If there is not application or tree specified in a query string then this is the application to load.
/// </summary>
private const string DEFAULT_APP = "content";
private List<BaseTree> m_ActiveTrees = new List<BaseTree>();
private List<BaseTree> m_AllAppTrees = new List<BaseTree>();
private List<TreeDefinition> m_ActiveTreeDefs = null;
private TreeMode m_TreeType = TreeMode.Standard;
private bool m_IsInit = false;
private TreeService m_TreeService = null;
/// <summary>
/// returns the current tree service being used to render the tree
/// </summary>
public TreeService TreeSvc
{
get
{
return m_TreeService;
}
}
/// <summary>
/// Can be set explicitly which will override what is in query strings.
/// Useful for rendering out a tree dynamically.
/// </summary>
public void SetTreeService(TreeService srv)
{
m_TreeService = srv;
Initialize();
}
/// <summary>
/// Allows for checkboxes to be used with the tree. Default is standard.
/// </summary>
public TreeMode TreeType
{
get
{
return m_TreeType;
}
set
{
m_TreeType = value;
}
}
/// <summary>
/// Used to create a different container id for the tree control. This is done so that
/// there is a way to differentiate between multiple trees if required. This is currently used
/// to distinguish which tree is the main umbraco tree as opposed to dialog trees.
/// </summary>
public string CustomContainerId { get; set; }
protected void Initialize()
{
//use the query strings if the TreeParams isn't explicitly set
if (m_TreeService == null)
{
TreeRequestParams treeParams = TreeRequestParams.FromQueryStrings();
m_TreeService = new TreeService()
{
ShowContextMenu = treeParams.ShowContextMenu,
IsDialog = treeParams.IsDialog,
DialogMode = treeParams.DialogMode,
App = treeParams.Application,
TreeType = treeParams.TreeType
};
}
//ensure that the application is setup correctly
m_TreeService.App = CurrentApp;
// Validate permissions
if (!BasePages.BasePage.ValidateUserContextID(BasePages.BasePage.umbracoUserContextID))
return;
UmbracoEnsuredPage page = new UmbracoEnsuredPage();
if (!page.ValidateUserApp(TreeSvc.App))
throw new ArgumentException("The current user doesn't have access to this application. Please contact the system administrator.");
//find all tree definitions that have the current application alias that are ACTIVE
m_ActiveTreeDefs = TreeDefinitionCollection.Instance.FindActiveTrees(TreeSvc.App);
//find all tree defs that exists for the current application regardless of if they are active
List<TreeDefinition> appTreeDefs = TreeDefinitionCollection.Instance.FindTrees(TreeSvc.App);
//Create the BaseTree's based on the tree definitions found
foreach (TreeDefinition treeDef in appTreeDefs)
{
//create the tree and initialize it
BaseTree bTree = treeDef.CreateInstance();
bTree.SetTreeParameters(TreeSvc);
//store the created tree
m_AllAppTrees.Add(bTree);
if (treeDef.Tree.Initialize)
m_ActiveTrees.Add(bTree);
}
m_IsInit = true;
}
/// <summary>
/// This calls the databind method to bind the data binding syntax on the front-end.
/// <remarks>
/// Databinding was used instead of inline tags in case the tree properties needed to be set
/// by other classes at runtime
/// </remarks>
/// </summary>
/// <param name="e"></param>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (!m_IsInit)
Initialize();
//Render out the JavaScript associated with all of the trees for the application
RenderTreeJS();
DataBind();
}
/// <summary>
/// Returns the JSON markup for the full context menu
/// </summary>
public string GetJSONContextMenu()
{
JTreeContextMenu menu = new JTreeContextMenu();
return menu.RenderJSONMenu();
}
/// <summary>
/// Returns the JSON markup for one node
/// </summary>
/// <param name="treeAlias"></param>
/// <param name="nodeId"></param>
/// <returns></returns>
public string GetJSONNode(string nodeId)
{
if (!m_IsInit)
Initialize();
if (string.IsNullOrEmpty(TreeSvc.TreeType))
{
throw new ArgumentException("The TreeType is not set on the tree service");
}
BaseTree tree = m_ActiveTrees.Find(
delegate(BaseTree t)
{
return (t.TreeAlias == TreeSvc.TreeType);
}
);
return tree.GetSerializedNodeData(nodeId);
}
/// <summary>
/// Returns the JSON markup for the first node in the tree
/// </summary>
public string GetJSONInitNode()
{
if (!m_IsInit)
Initialize();
//if there is only one tree to render, we don't want to have a node to hold sub trees, we just want the
//stand alone tree, so we'll just add a TreeType to the TreeService and ensure that the right method gets loaded in tree.aspx
if (m_ActiveTrees.Count == 1)
{
TreeSvc.TreeType = m_ActiveTreeDefs[0].Tree.Alias;
//convert the menu to a string
//string initActions = (TreeSvc.ShowContextMenu ? Action.ToString(m_ActiveTrees[0].RootNodeActions) : "");
//Since there's only 1 tree, render out the tree's RootNode properties
XmlTree xTree = new XmlTree();
xTree.Add(m_ActiveTrees[0].RootNode);
return xTree.ToString();
}
else
{
//If there is more than 1 tree for the application than render out a
//container node labelled with the current application.
XmlTree xTree = new XmlTree();
XmlTreeNode xNode = XmlTreeNode.CreateRoot(new NullTree(CurrentApp));
xNode.Text = ui.Text("sections", TreeSvc.App, UmbracoEnsuredPage.CurrentUser);
xNode.Source = TreeSvc.GetServiceUrl();
xNode.Action = ClientTools.Scripts.OpenDashboard(TreeSvc.App);
xNode.NodeType = TreeSvc.App.ToLower();
xNode.NodeID = "-1";
xNode.Icon = ".sprTreeFolder";
xTree.Add(xNode);
return xTree.ToString();
}
}
/// <summary>
/// Returns the requires JavaScript as a string for the current application
/// </summary>
public string JSCurrApp
{
get
{
StringBuilder javascript = new StringBuilder();
foreach (BaseTree bTree in m_AllAppTrees)
bTree.RenderJS(ref javascript);
return javascript.ToString();
}
}
/// <summary>
/// Return the current application alias. If neither the TreeType of Application is specified
/// than return the default application. If the Application is null but there is a TreeType then
/// find the application that the tree type is associated with.
/// </summary>
protected string CurrentApp
{
get
{
//if theres an treetype specified but no application
if (string.IsNullOrEmpty(TreeSvc.App) &&
!string.IsNullOrEmpty(TreeSvc.TreeType))
{
TreeDefinition treeDef = TreeDefinitionCollection.Instance.FindTree(TreeSvc.TreeType);
if (treeDef != null)
return treeDef.App.alias;
}
else if (!string.IsNullOrEmpty(TreeSvc.App))
return TreeSvc.App;
//if everything is null then return the default app
return DEFAULT_APP;
}
}
private void RenderTreeJS()
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Trees", JSCurrApp, true);
}
}
internal class JTreeContextMenu
{
public string RenderJSONMenu()
{
JSONSerializer jSSerializer = new JSONSerializer();
jSSerializer.RegisterConverters(new List<JavaScriptConverter>()
{
new JTreeContextMenuItem()
});
List<IAction> allActions = new List<IAction>();
foreach (IAction a in global::umbraco.BusinessLogic.Actions.Action.GetAll())
{
if (!string.IsNullOrEmpty(a.Alias) && (!string.IsNullOrEmpty(a.JsFunctionName) || !string.IsNullOrEmpty(a.JsSource)))
{
allActions.Add(a);
}
}
return jSSerializer.Serialize(allActions);
}
}
internal class JTreeContextMenuItem : JavaScriptConverter
{
/// <summary>
/// Not implemented as we never need to Deserialize
/// </summary>
/// <param name="dictionary"></param>
/// <param name="type"></param>
/// <param name="serializer"></param>
/// <returns></returns>
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
{
throw new NotImplementedException();
}
public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
{
//{
// "id": "L",
// "label": "Create",
// "icon": "create.png",
// "visible": function(NODE, TREE_OBJ) { if (NODE.length != 1) return false; return TREE_OBJ.check("creatable", NODE); },
// "action": function(NODE, TREE_OBJ) { TREE_OBJ.create(false, NODE); },
//}
IAction a = (IAction)obj;
Dictionary<string, object> data = new Dictionary<string, object>();
data.Add("id", a.Letter);
data.Add("label", ui.Text(a.Alias));
if (a.Icon.StartsWith("."))
{
StringBuilder sb = new StringBuilder();
sb.Append(string.Format("<div class='menuSpr {0}'>", a.Icon.TrimStart('.')));
sb.Append("</div>");
sb.Append("<div class='menuLabel'>");
sb.Append(data["label"].ToString());
sb.Append("</div>");
data["label"] = sb.ToString();
}
else
{
data.Add("icon", a.Icon);
}
//required by jsTree
data.Add("visible", JSONSerializer.ToJSONObject("function() {return true;}"));
//The action handler is what is assigned to the IAction, but for flexibility, we'll call our onContextMenuSelect method which will need to return true if the function is to execute.
//TODO: Check if there is a JSSource
data.Add("action", JSONSerializer.ToJSONObject("function(N,T){" + a.JsFunctionName + ";}"));
return data;
}
/// <summary>
/// TODO: Find out why we can't just return IAction as one type (JavaScriptSerializer doesn't seem to pick up on it)
/// </summary>
public override IEnumerable<Type> SupportedTypes
{
get
{
List<Type> types = new List<Type>();
foreach (IAction a in global::umbraco.BusinessLogic.Actions.Action.GetAll())
{
types.Add(a.GetType());
}
return types;
}
}
}
}
@@ -19,7 +19,7 @@
<div style="margin-right: 15px;">
<asp:Button id="sbmt" Runat="server" style="Width: 90px; margin-right: 6px;" onclick="sbmt_Click"></asp:Button>
<em> or </em>
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.mainWindow().closeModal()"><%=umbraco.ui.Text("cancel")%></a>
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
<!--
<input type="button" value="" onClick="if (confirm('<%=umbraco.ui.Text("areyousure")%>')) window.close()" style="width: 90px; margin-left: 6px;"/>
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -7,5 +7,5 @@
<div style="padding-top: 25px;">
<asp:Button id="sbmt" Runat="server" style="MARGIN-TOP: 14px" Width="90" onclick="sbmt_Click"></asp:Button>
&nbsp; <em><%= umbraco.ui.Text("or") %></em> &nbsp;<a href="#" style="color: blue" onclick="UmbClientMgr.mainWindow().closeModal()"><%=umbraco.ui.Text("cancel")%></a>
&nbsp; <em><%= umbraco.ui.Text("or") %></em> &nbsp;<a href="#" style="color: blue" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
</div>
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -13,5 +13,5 @@
<div style="MARGIN-TOP: 15px;">
<asp:Button id="sbmt" Runat="server" style="MARGIN-TOP: 14px" Width="90" onclick="sbmt_Click"></asp:Button>
<em> or </em>
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.mainWindow().closeModal()"><%=umbraco.ui.Text("cancel")%></a>
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
</div>
+1 -1
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,5 +28,5 @@
<asp:Button ID="sbmt" runat="server" Style="margin-top: 14px" Width="90" OnClick="sbmt_Click">
</asp:Button>
&nbsp; <em>
<%= umbraco.ui.Text("or") %></em> &nbsp;<a href="#" style="color: blue" onclick="UmbClientMgr.mainWindow().closeModal()"><%=umbraco.ui.Text("cancel")%></a>
<%= umbraco.ui.Text("or") %></em> &nbsp;<a href="#" style="color: blue" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
</div>
+1 -1
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -20,5 +20,5 @@
<div style="margin-top: 10px;">
<asp:Button id="sbmt" Runat="server" style="MARGIN-TOP: 14px" Width="90" onclick="sbmt_Click"></asp:Button>
<em> or </em>
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.mainWindow().closeModal()"><%=umbraco.ui.Text("cancel")%></a>
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
</div>
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -18,5 +18,5 @@ Type:<br />
<div style="MARGIN-TOP: 15px;">
<asp:Button id="sbmt" Runat="server" style="MARGIN-TOP: 14px" Width="90"></asp:Button>
<em> or </em>
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.mainWindow().closeModal()"><%=umbraco.ui.Text("cancel")%></a>
<a href="#" style="color: Blue; margin-left: 6px;" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
</div>
+1 -1
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -11,5 +11,5 @@
<div style="padding-top: 25px;">
<asp:Button id="sbmt" Runat="server" style="Width:90px" onclick="sbmt_Click"></asp:Button>
&nbsp; <em><%= umbraco.ui.Text("or") %></em> &nbsp;
<a href="#" style="color: blue" onclick="UmbClientMgr.mainWindow().closeModal()"><%=umbraco.ui.Text("cancel")%></a>
<a href="#" style="color: blue" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
</div>
+1 -1
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -21,5 +21,5 @@ Filename (without .xslt): <asp:RequiredFieldValidator id="RequiredFieldValidator
<div style="MARGIN-TOP: 15px;">
<asp:Button id="sbmt" Runat="server" style="MARGIN-TOP: 14px" Width="90" onclick="sbmt_Click"></asp:Button>
&nbsp; <em><%= umbraco.ui.Text("or") %></em> &nbsp;
<a href="#" style="color: blue" onclick="top.closeModal()"><%=umbraco.ui.Text("cancel")%></a>
<a href="#" style="color: blue" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("cancel")%></a>
</div>
+1 -1
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -19,3 +19,15 @@
{
list-style: none;
}
/* new clearfix */
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
* html .clearfix { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */
@@ -4,9 +4,7 @@
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<asp:Content runat="server" ContentPlaceHolderID="head">
<umb:JsInclude ID="JsInclude6" runat="server" FilePath="Application/UmbracoClientManager.js" PathNameAlias="UmbracoClient" />
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<h3 style="MARGIN-LEFT: 0px"><asp:Label id="AssemblyName" runat="server"></asp:Label></h3>
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -67,14 +67,14 @@ namespace umbraco.cms.presentation.developer
// Check for assemblyBrowser
if (tempMacroType.IndexOf(".ascx") > 0)
assemblyBrowserUserControl.Controls.Add(
new LiteralControl("<br/><button onClick=\"top.openModal('developer/macros/assemblyBrowser.aspx?fileName=" + macroUserControl.Text +
new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('" + umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/developer/macros/assemblyBrowser.aspx?fileName=" + macroUserControl.Text +
"&macroID=" + m_macro.Id.ToString() +
"', 'Browse Properties', 475,500); return false;\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>"));
"', 'Browse Properties', true, 475,500); return false;\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>"));
else if (tempMacroType != string.Empty && tempMacroAssembly != string.Empty)
assemblyBrowser.Controls.Add(
new LiteralControl("<br/><button onClick=\"top.openModal('developer/macros/assemblyBrowser.aspx?fileName=" + macroAssembly.Text +
new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('" + umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/developer/macros/assemblyBrowser.aspx?fileName=" + macroAssembly.Text +
"&macroID=" + m_macro.Id.ToString() + "&type=" + macroType.Text +
"', 'Browse Properties', 475,500); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>"));
"', 'Browse Properties', true, 475,500); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>"));
// Load elements from macro
macroPropertyBind();
@@ -148,14 +148,14 @@ namespace umbraco.cms.presentation.developer
// Check for assemblyBrowser
if (tempMacroType.IndexOf(".ascx") > 0)
assemblyBrowserUserControl.Controls.Add(
new LiteralControl("<br/><button onClick=\"top.openModal('developer/macros/assemblyBrowser.aspx?fileName=" + macroUserControl.Text +
new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('developer/macros/assemblyBrowser.aspx?fileName=" + macroUserControl.Text +
"&macroID=" + Request.QueryString["macroID"] +
"', 'Browse Properties', 475,500); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>"));
"', 'Browse Properties', true, 500, 475); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>"));
else if (tempMacroType != string.Empty && tempMacroAssembly != string.Empty)
assemblyBrowser.Controls.Add(
new LiteralControl("<br/><button onClick=\"top.openModal('developer/macros/assemblyBrowser.aspx?fileName=" + macroAssembly.Text +
new LiteralControl("<br/><button onClick=\"UmbClientMgr.openModalWindow('developer/macros/assemblyBrowser.aspx?fileName=" + macroAssembly.Text +
"&macroID=" + Request.QueryString["macroID"] + "&type=" + macroType.Text +
"', 'Browse Properties', 475,500); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>"));
"', 'Browse Properties', true, 500, 475); return false\" class=\"guiInputButton\"><img src=\"../../images/editor/propertiesNew.gif\" align=\"absmiddle\" style=\"width: 18px; height: 17px; padding-right: 5px;\"/> Browse properties</button>"));
}
}
@@ -16,7 +16,7 @@
}
function openDemoModal(id, title) {
top.openModal("http://packages.umbraco.org/viewPackageData.aspx?id=" + id, title, 550, 750)
UmbClientMgr.openModalWindow("http://packages.umbraco.org/viewPackageData.aspx?id=" + id, title, true, 750, 550)
}
function InstallPackages(button, elementId) {
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3603
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -46,7 +46,7 @@ small a{color: #999; padding-left: 3px !Important; background-image: none !Impor
<script type="text/javascript">
function postPath(path) {
top.right.document.getElementById('<%=target%>').value = path;
UmbClientMgr.mainWindow().closeModal();
UmbClientMgr.closeModalWindow();
}
</script>
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3603
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

Some files were not shown because too many files have changed in this diff Show More