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:
80
components/editorControls/BaseTreePickerEditor.cs
Normal file
80
components/editorControls/BaseTreePickerEditor.cs
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user