Merge with 4.10.0

This commit is contained in:
Morten@Thinkpad-X220
2012-10-12 05:43:10 -02:00
3 changed files with 17 additions and 64 deletions

View File

@@ -30,7 +30,7 @@
},
doSubmit: function () {
var codeVal = UmbEditor.GetCode();
var codeVal = UmbClientMgr.contentFrame().UmbEditor.GetCode();
var self = this;
umbraco.presentation.webservices.codeEditorSave.SaveTemplate(
@@ -59,7 +59,7 @@
changeMasterPageFile: function ( ) {
//var editor = document.getElementById(this._opts.sourceEditorId);
var templateDropDown = this._opts.masterPageDropDown.get(0);
var templateCode = UmbEditor.GetCode();
var templateCode = UmbClientMgr.contentFrame().UmbEditor.GetCode();
var newValue = templateDropDown.options[templateDropDown.selectedIndex].id;
var layoutDefRegex = new RegExp("(@{[\\s\\S]*?Layout\\s*?=\\s*?)(\"[^\"]*?\"|null)(;[\\s\\S]*?})", "gi");
@@ -80,7 +80,7 @@
}
}
UmbEditor.SetCode(templateCode);
UmbClientMgr.contentFrame().UmbEditor.SetCode(templateCode);
return false;
}

View File

@@ -168,74 +168,24 @@ namespace umbraco.cms.businesslogic
return _propertyTypeCache[key];
}
//Instead of going via API, run this query to find the control type
//by-passes a lot of queries just to determine if this is a true/false data type
//This SQL returns a larger recordset than intended
//causing controlId to sometimes be null instead of correct
//because all properties for the type are returned
//side effect of changing inner join to left join when adding masterContentType
//string sql = "select " +
// "cmsDataType.controlId, masterContentType.alias as masterAlias " +
// "from " +
// "cmsContentType " +
// "inner join cmsPropertyType on (cmsContentType.nodeId = cmsPropertyType.contentTypeId) " +
// "left join cmsDataType on (cmsPropertyType.dataTypeId = cmsDataType.nodeId) and cmsPropertyType.Alias = @propertyAlias " +
// "left join cmsContentType masterContentType on masterContentType.nodeid = cmsContentType.masterContentType " +
// "where cmsContentType.alias = @contentTypeAlias";
//this SQL correctly returns a single row when the property exists, but still returns masterAlias if it doesn't
string sql = "select cmsDataType.controlId, masterContentType.alias as masterAlias " +
"from " +
"cmsContentType " +
"left join cmsPropertyType on (cmsContentType.nodeId = cmsPropertyType.contentTypeId and cmsPropertyType.Alias = @propertyAlias) " +
"left join cmsDataType on (cmsPropertyType.dataTypeId = cmsDataType.nodeId) " +
"left join cmsContentType masterContentType on masterContentType.nodeid = cmsContentType.masterContentType " +
"where " +
"cmsContentType.alias = @contentTypeAlias";
//Ensure that getdatatype doesn't throw an exception
//http://our.umbraco.org/forum/developers/razor/18085-Access-custom-node-properties-with-Razor
//grab the controlid or test for parent
// With 4.10 we can't do this via direct SQL as we have content type mixins
Guid controlId = Guid.Empty;
IRecordsReader reader = null;
try
ContentType ct = GetByAlias(contentTypeAlias);
PropertyType pt = ct.getPropertyType(propertyTypeAlias);
if (pt != null)
{
reader = Application.SqlHelper.ExecuteReader(sql,
Application.SqlHelper.CreateParameter("@contentTypeAlias", contentTypeAlias),
Application.SqlHelper.CreateParameter("@propertyAlias", propertyTypeAlias)
);
if (reader.Read())
{
if (!reader.IsNull("controlId"))
controlId = reader.GetGuid("controlId");
else if (!reader.IsNull("masterAlias") && !String.IsNullOrEmpty(reader.GetString("masterAlias")))
{
controlId = GetDataType(reader.GetString("masterAlias"), propertyTypeAlias);
}
}
}
catch (UmbracoException)
{
_propertyTypeCache.Add(key, controlId);
}
finally
{
if (reader != null)
{
reader.Close();
}
controlId = pt.DataTypeDefinition.DataType.Id;
}
//add to cache
//add to cache (even if empty!)
if (!_propertyTypeCache.ContainsKey(key))
{
_propertyTypeCache.Add(key, controlId);
}
return controlId;
}

View File

@@ -170,10 +170,13 @@ namespace umbraco.uicontrols
OffSetX += 20;
}
jsEventCode += @"
$(function () {
jsEventCode += @"
//TODO: for now this is a global var, need to refactor all this so that is using proper js standards
//with correct objects, and proper accessors to these objects.
var UmbEditor;
$(document).ready(function () {
//create the editor
var UmbEditor = new Umbraco.Controls.CodeEditor.UmbracoEditor(" + (!CodeMirrorEnabled).ToString().ToLower() + @", '" + this.ClientID + @"');
UmbEditor = new Umbraco.Controls.CodeEditor.UmbracoEditor(" + (!CodeMirrorEnabled).ToString().ToLower() + @", '" + this.ClientID + @"');
var m_textEditor = jQuery('#" + this.ClientID + @"');
//with codemirror adding divs for line numbers, we need to target a different element