Fixes macro script editor and syncing, changes over editPython to use correct webforms file format.

This commit is contained in:
Shannon Deminick
2013-05-08 17:01:48 -10:00
parent 78cd51d333
commit dd1983dc55
9 changed files with 228 additions and 240 deletions

View File

@@ -1,54 +1,35 @@
<%@ Page ValidateRequest="false" Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master"
CodeBehind="editPython.aspx.cs" AutoEventWireup="True" Inherits="umbraco.cms.presentation.developer.editPython" %>
CodeBehind="editPython.aspx.cs" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Umbraco.Developer.Python.EditPython" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<asp:Content ID="DocTypeContent" ContentPlaceHolderID="DocType" runat="server">
<!DOCTYPE html>
</asp:Content>
<asp:Content ID="cp0" runat="server" ContentPlaceHolderID="head">
<umb:JsInclude ID="JsInclude2" runat="server" FilePath="Editors/EditMacroScripts.js" PathNameAlias="UmbracoClient" />
<script type="text/javascript">
function closeErrorDiv() {
jQuery('#errorDiv').hide();
}
(function ($) {
$(document).ready(function () {
var editor = new Umbraco.Editors.EditMacroScripts({
nameTxtBox: $('#<%= pythonFileName.ClientID %>'),
originalFileName: '<%= pythonFileName.Text %>',
saveButton: $("#<%= ((Control)SaveButton).ClientID %>"),
editorSourceElement: $('#<%= pythonFileName.ClientID %>'),
skipTestingCheckBox: $("#<%= SkipTesting.ClientID %>"),
});
editor.init();
function doSubmit() {
closeErrorDiv();
var codeVal = jQuery('#<%= pythonSource.ClientID %>').val();
//if CodeMirror is not defined, then the code editor is disabled.
if (typeof (CodeMirror) != "undefined") {
codeVal = UmbEditor.GetCode();
}
umbraco.presentation.webservices.codeEditorSave.SaveDLRScript(jQuery('#<%= pythonFileName.ClientID %>').val(), '<%= pythonFileName.Text %>', codeVal, document.getElementById('<%= SkipTesting.ClientID %>').checked, submitSucces, submitFailure);
}
function submitSucces(t) {
if (t != 'true') {
top.UmbSpeechBubble.ShowMessage('error', 'Saving scripting file failed', '');
jQuery('#errorDiv').html('<p><a href="#" style="position: absolute; right: 10px; top: 10px;" onclick=\'closeErrorDiv()\'>Hide Errors</a><strong>Error occured</strong></p><p>' + t + '</p>');
jQuery('#errorDiv').slideDown('fast');
}
else {
top.UmbSpeechBubble.ShowMessage('save', 'Scripting file saved', '')
}
}
function submitFailure(t) {
top.UmbSpeechBubble.ShowMessage('warning', 'Scripting file could not be saved', '')
}
function showError() {
var id = "#errorDiv";
if (jQuery(id).is(":visible")) {
jQuery(id).hide();
}
}
//bind save shortcut
UmbClientMgr.appActions().bindSaveShortCut();
});
})(jQuery);
</script>
</asp:Content>
<asp:Content ID="cp1" runat="server" ContentPlaceHolderID="body">
@@ -69,9 +50,4 @@
OffSetY="55" runat="server" />
</cc1:Pane>
</cc1:UmbracoPanel>
<script type="text/javascript">
jQuery(document).ready(function () {
UmbClientMgr.appActions().bindSaveShortCut();
});
</script>
</asp:Content>