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:
@@ -36,10 +36,12 @@ namespace umbraco.uicontrols {
|
||||
{
|
||||
get
|
||||
{
|
||||
EnsureChildControls();
|
||||
return CodeTextBox.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
EnsureChildControls();
|
||||
CodeTextBox.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
223
components/umbraco.controls/TreePicker/BaseTreePicker.cs
Normal file
223
components/umbraco.controls/TreePicker/BaseTreePicker.cs
Normal file
@@ -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(" "));
|
||||
ButtonContainer.Controls.Add(new LiteralControl(" "));
|
||||
|
||||
//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(" "));
|
||||
ButtonContainer.Controls.Add(new LiteralControl(" "));
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
70
components/umbraco.controls/TreePicker/BaseTreePicker.js
Normal file
70
components/umbraco.controls/TreePicker/BaseTreePicker.js
Normal file
@@ -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);
|
||||
83
components/umbraco.controls/TreePicker/BaseTreePickerScripts.Designer.cs
generated
Normal file
83
components/umbraco.controls/TreePicker/BaseTreePickerScripts.Designer.cs
generated
Normal file
@@ -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 /// <reference path="/umbraco_client/Application/NamespaceManager.js" />
|
||||
///
|
||||
///Umbraco.Sys.registerNamespace("Umbraco.Controls");
|
||||
///
|
||||
///(function($) {
|
||||
/// Umbraco.Controls.TreePicker = function(label, itemIdValueClientID, itemTitleClientID, itemPickerUrl, width, height, showHeader, umbracoPath) {
|
||||
/// return {
|
||||
/// _itemPickerUrl: itemPickerUrl,
|
||||
/// _webServiceUrl: umbracoPath + "/webservices/legacyAjaxCalls.asmx/GetNodeName",
|
||||
/// _label: label,
|
||||
/// _width: width,
|
||||
/// [rest of string was truncated]";.
|
||||
/// </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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
components/umbraco.controls/TreePicker/SimpleMediaPicker.cs
Normal file
26
components/umbraco.controls/TreePicker/SimpleMediaPicker.cs
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
202
components/umbraco.controls/TreeUrlGenerator.cs
Normal file
202
components/umbraco.controls/TreeUrlGenerator.cs
Normal file
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user