Removed files which were added mistakenly discarding merge conflicts.
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="../masterpages/umbracoPage.Master" CodeBehind="default.aspx.cs" Inherits="umbraco.presentation.translation._default" %>
|
||||
<%@ Register TagPrefix="cc1" Namespace="Umbraco.Web._Legacy.Controls" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="head" runat="server">
|
||||
<style type="text/css">
|
||||
.fieldsTable tr{
|
||||
border-color: #D9D7D7 !Important;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="body" runat="server">
|
||||
<cc1:UmbracoPanel ID="Panel2" runat="server">
|
||||
|
||||
<cc1:Feedback ID="feedback" runat="server" />
|
||||
|
||||
<cc1:Pane ID="pane_uploadFile" runat="server" Text="Upload translation file">
|
||||
<p>
|
||||
When you have completed the translation. Upload the edited XML file here. The related translation tasks will automatically be closed when a file is uploaded.
|
||||
</p>
|
||||
|
||||
<cc1:PropertyPanel runat="server">
|
||||
<input type="file" runat="server" id="translationFile" size="30" /> <asp:Button ID="uploadFile" runat="server" Text="Upload file" OnClick="uploadFile_Click" />
|
||||
</cc1:PropertyPanel>
|
||||
</cc1:Pane>
|
||||
|
||||
|
||||
<cc1:Pane ID="pane_tasks" runat="server" Text="Your tasks">
|
||||
<p>
|
||||
<asp:Literal ID="lt_tasksHelp" runat="server"></asp:Literal>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="xml.aspx?task=all" target="_blank"><%= Services.TextService.Localize("translation/downloadAllAsXml") %></a>
|
||||
|
||||
<a href="translationTasks.dtd" target="_blank"><%= Services.TextService.Localize("translation/DownloadXmlDTD")%></a>
|
||||
</p>
|
||||
<asp:GridView GridLines="Horizontal" ID="taskList" runat="server" CssClass="fieldsTable" BorderStyle="None" Width="100%"
|
||||
CellPadding="5" AutoGenerateColumns="false">
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<a href="details.aspx?id=<%#Eval("Id") %>"><%#Eval("NodeName") %></a>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="ReferingUser" />
|
||||
<asp:BoundField DataField="Date" />
|
||||
<asp:HyperLinkField DataNavigateUrlFields="Id" DataNavigateUrlFormatString="details.aspx?id={0}" Text="Details" />
|
||||
<asp:HyperLinkField DataNavigateUrlFields="Id" DataNavigateUrlFormatString="xml.aspx?id={0}" Target="_blank" Text="Download Xml" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</cc1:Pane>
|
||||
|
||||
</cc1:UmbracoPanel>
|
||||
</asp:Content>
|
||||
@@ -1,211 +0,0 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Web.UI.Pages;
|
||||
using Umbraco.Web._Legacy.BusinessLogic;
|
||||
|
||||
namespace umbraco.presentation.translation
|
||||
{
|
||||
public partial class _default : UmbracoEnsuredPage
|
||||
{
|
||||
public _default()
|
||||
{
|
||||
CurrentApp = Constants.Applications.Translation;
|
||||
|
||||
}
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
DataTable tasks = new DataTable();
|
||||
tasks.Columns.Add("Id");
|
||||
tasks.Columns.Add("Date");
|
||||
tasks.Columns.Add("NodeId");
|
||||
tasks.Columns.Add("NodeName");
|
||||
tasks.Columns.Add("ReferingUser");
|
||||
tasks.Columns.Add("Language");
|
||||
|
||||
taskList.Columns[0].HeaderText = Services.TextService.Localize("nodeName");
|
||||
taskList.Columns[1].HeaderText = Services.TextService.Localize("translation/taskAssignedBy");
|
||||
taskList.Columns[2].HeaderText = Services.TextService.Localize("date");
|
||||
|
||||
((System.Web.UI.WebControls.HyperLinkField)taskList.Columns[3]).Text = Services.TextService.Localize("translation/details");
|
||||
((System.Web.UI.WebControls.HyperLinkField)taskList.Columns[4]).Text = Services.TextService.Localize("translation/downloadTaskAsXml");
|
||||
|
||||
Tasks ts = new Tasks();
|
||||
if (Request["mode"] == "owned")
|
||||
{
|
||||
ts = Task.GetOwnedTasks(Security.CurrentUser, false);
|
||||
pane_tasks.Text = Services.TextService.Localize("translation/ownedTasks");
|
||||
Panel2.Text = Services.TextService.Localize("translation/ownedTasks");
|
||||
}
|
||||
else
|
||||
{
|
||||
ts = Task.GetTasks(Security.CurrentUser, false);
|
||||
pane_tasks.Text = Services.TextService.Localize("translation/assignedTasks");
|
||||
Panel2.Text = Services.TextService.Localize("translation/assignedTasks");
|
||||
}
|
||||
|
||||
uploadFile.Text = Services.TextService.Localize("upload");
|
||||
pane_uploadFile.Text = Services.TextService.Localize("translation/uploadTranslationXml");
|
||||
|
||||
foreach (Task t in ts)
|
||||
{
|
||||
if (t.Type.Alias == "toTranslate")
|
||||
{
|
||||
DataRow task = tasks.NewRow();
|
||||
task["Id"] = t.Id;
|
||||
task["Date"] = t.Date;
|
||||
task["NodeId"] = t.TaskEntity.EntityId;
|
||||
task["NodeName"] = t.TaskEntityEntity.Name;
|
||||
task["ReferingUser"] = t.ParentUser.Name;
|
||||
tasks.Rows.Add(task);
|
||||
}
|
||||
}
|
||||
|
||||
taskList.DataSource = tasks;
|
||||
taskList.DataBind();
|
||||
feedback.Style.Add("margin-top", "10px");
|
||||
|
||||
}
|
||||
|
||||
protected void uploadFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Save temp file
|
||||
if (translationFile.PostedFile != null)
|
||||
{
|
||||
string tempFileName;
|
||||
if (translationFile.PostedFile.FileName.ToLower().Contains(".zip"))
|
||||
tempFileName = IOHelper.MapPath(SystemDirectories.Data + "/" + "translationFile_" + Guid.NewGuid().ToString() + ".zip");
|
||||
else
|
||||
tempFileName = IOHelper.MapPath(SystemDirectories.Data + "/" + "translationFile_" + Guid.NewGuid().ToString() + ".xml");
|
||||
|
||||
translationFile.PostedFile.SaveAs(tempFileName);
|
||||
|
||||
// xml or zip file
|
||||
if (new FileInfo(tempFileName).Extension.ToLower() == ".zip")
|
||||
{
|
||||
// Zip Directory
|
||||
string tempPath = IOHelper.MapPath(SystemDirectories.Data + "/" + "translationFiles_" + Guid.NewGuid().ToString());
|
||||
|
||||
// Add the path to the zipfile to viewstate
|
||||
ViewState.Add("zipFile", tempPath);
|
||||
|
||||
// Unpack the zip file
|
||||
|
||||
IOHelper.UnZip(tempFileName, tempPath, true);
|
||||
|
||||
// Test the number of xml files
|
||||
try
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (FileInfo translationFileXml in new DirectoryInfo(ViewState["zipFile"].ToString()).GetFiles("*.xml"))
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (Task translation in ImportTranslatationFile(translationFileXml.FullName))
|
||||
{
|
||||
|
||||
sb.Append("<li>" + translation.TaskEntityEntity.Name + " <a target=\"_blank\" href=\"preview.aspx?id=" + translation.Id + "\">" + Services.TextService.Localize("preview") + "</a></li>");
|
||||
}
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
sb.Append("<li style=\"color: red;\">" + ee.ToString() + "</li>");
|
||||
}
|
||||
}
|
||||
|
||||
feedback.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success;
|
||||
feedback.Text = "<h3>" + Services.TextService.Localize("translation/MultipleTranslationDone") + "</h3><p>" + Services.TextService.Localize("translation/translationDoneHelp") + "</p><ul>" + sb.ToString() + "</ul>";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
feedback.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.error;
|
||||
feedback.Text = "<h3>" + Services.TextService.Localize("translation/translationFailed") + "</h3><p>" + ex.ToString() + "</>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<Task> l = ImportTranslatationFile(tempFileName);
|
||||
|
||||
if (l.Count == 1)
|
||||
{
|
||||
feedback.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success;
|
||||
feedback.Text = "<h3>" + Services.TextService.Localize("translation/translationDone") + "</h3><p>" + Services.TextService.Localize("translation/translationDoneHelp") + "</p><p><a target=\"_blank\" href=\"preview.aspx?id=" + l[0].Id + "\">" + Services.TextService.Localize("preview") + "</a></p>";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
foreach (Task t in l)
|
||||
{
|
||||
sb.Append("<li>" + t.TaskEntityEntity.Name + " <a target=\"_blank\" href=\"preview.aspx?id=" + t.Id + "\">" + Services.TextService.Localize("preview") + "</a></li>");
|
||||
}
|
||||
|
||||
feedback.type = global::Umbraco.Web._Legacy.Controls.Feedback.feedbacktype.success;
|
||||
feedback.Text = "<h3>" + Services.TextService.Localize("translation/MultipleTranslationDone") + "</h3><p>" + Services.TextService.Localize("translation/translationDoneHelp") + "</p><ul>" + sb.ToString() + "</ul>";
|
||||
}
|
||||
}
|
||||
|
||||
// clean up
|
||||
File.Delete(tempFileName);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Task> ImportTranslatationFile(string tempFileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<Task> tl = new List<Task>();
|
||||
|
||||
// open file
|
||||
XmlDocument tf = new XmlDocument();
|
||||
tf.XmlResolver = null;
|
||||
tf.Load(tempFileName);
|
||||
|
||||
// Get task xml node
|
||||
XmlNodeList tasks = tf.SelectNodes("//task");
|
||||
|
||||
foreach (XmlNode taskXml in tasks)
|
||||
{
|
||||
string xpath = "* [@isDoc]";
|
||||
XmlNode taskNode = taskXml.SelectSingleNode(xpath);
|
||||
|
||||
// validate file
|
||||
Task t = new Task(int.Parse(taskXml.Attributes.GetNamedItem("Id").Value));
|
||||
if (t != null)
|
||||
{
|
||||
//user auth and content node validation
|
||||
if (t.TaskEntity.EntityId == int.Parse(taskNode.Attributes.GetNamedItem("id").Value) && (t.User.Id == Security.CurrentUser.Id || t.ParentUser.Id == Security.CurrentUser.Id))
|
||||
{
|
||||
|
||||
//TODO: Make this work again with correct APIs and angularized - so none of this code will exist anymore
|
||||
//// update node contents
|
||||
//var d = new Document(t.Node.Id);
|
||||
//Document.Import(d.ParentId, UmbracoUser, (XmlElement)taskNode);
|
||||
|
||||
////send notifications! TODO: This should be put somewhere centralized instead of hard coded directly here
|
||||
//ApplicationContext.Services.NotificationService.SendNotification(d.Content, ActionTranslate.Instance, ApplicationContext);
|
||||
|
||||
t.Closed = true;
|
||||
t.Save();
|
||||
|
||||
|
||||
tl.Add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tl;
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
throw new Exception("Error importing translation file '" + tempFileName + "': " + ee.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace umbraco.presentation.translation {
|
||||
|
||||
|
||||
public partial class _default {
|
||||
|
||||
/// <summary>
|
||||
/// Panel2 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel Panel2;
|
||||
|
||||
/// <summary>
|
||||
/// feedback control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.Feedback feedback;
|
||||
|
||||
/// <summary>
|
||||
/// pane_uploadFile control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.Pane pane_uploadFile;
|
||||
|
||||
/// <summary>
|
||||
/// translationFile 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.HtmlInputFile translationFile;
|
||||
|
||||
/// <summary>
|
||||
/// uploadFile 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 uploadFile;
|
||||
|
||||
/// <summary>
|
||||
/// pane_tasks control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.Pane pane_tasks;
|
||||
|
||||
/// <summary>
|
||||
/// lt_tasksHelp 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.Literal lt_tasksHelp;
|
||||
|
||||
/// <summary>
|
||||
/// taskList 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.GridView taskList;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="../masterpages/umbracoPage.Master" AutoEventWireup="true" CodeBehind="details.aspx.cs" Inherits="umbraco.presentation.umbraco.translation.details" %>
|
||||
<%@ Register TagPrefix="ui" Namespace="Umbraco.Web._Legacy.Controls" %>
|
||||
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
|
||||
|
||||
<style type="text/css">
|
||||
.fieldsTable tr{
|
||||
border-color: #D9D7D7 !Important;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
|
||||
|
||||
<ui:UmbracoPanel ID="panel1" Text="Details" runat="server" hasMenu="false">
|
||||
|
||||
<ui:Pane runat="server" ID="pane_details" Text="Translation details">
|
||||
<ui:PropertyPanel id="pp_date" runat="server" Text="Task opened"></ui:PropertyPanel>
|
||||
<ui:PropertyPanel ID="pp_owner" runat="server" Text="Assigned to you by"></ui:PropertyPanel>
|
||||
<ui:PropertyPanel ID="pp_totalWords" runat="server" Text="Total words"></ui:PropertyPanel>
|
||||
<ui:PropertyPanel ID="pp_comment" runat="server" Text="Task comment"></ui:PropertyPanel>
|
||||
</ui:Pane>
|
||||
|
||||
|
||||
<ui:Pane ID="pane_tasks" runat="server" Text="Tasks">
|
||||
<ui:PropertyPanel ID="pp_xml" runat="server" Text="Translation xml" />
|
||||
<ui:PropertyPanel ID="pp_upload" runat="server" Text="Upload translation"/>
|
||||
<ui:PropertyPanel ID="pp_closeTask" runat="server" Text="Close task">
|
||||
<asp:Button runat="server" ID="bt_close" Text="Close task" OnClick="closeTask"/>
|
||||
</ui:PropertyPanel>
|
||||
</ui:Pane>
|
||||
|
||||
|
||||
<ui:Pane ID="pane_fields" runat="server" Text="Fields">
|
||||
<asp:DataGrid ID="dg_fields" runat="server" GridLines="Horizontal" HeaderStyle-Font-Bold="true" CssClass="fieldsTable" Width="100%" BorderStyle="None" />
|
||||
</ui:Pane>
|
||||
|
||||
|
||||
</ui:UmbracoPanel>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="footer" runat="server">
|
||||
</asp:Content>
|
||||
@@ -1,107 +0,0 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Web._Legacy.BusinessLogic;
|
||||
using Umbraco.Web;
|
||||
|
||||
namespace umbraco.presentation.umbraco.translation {
|
||||
public partial class details : Umbraco.Web.UI.Pages.UmbracoEnsuredPage {
|
||||
|
||||
public details()
|
||||
{
|
||||
CurrentApp = Constants.Applications.Translation.ToString();
|
||||
|
||||
}
|
||||
protected void closeTask(object sender, EventArgs e) {
|
||||
int translationId = int.Parse(Request["id"]);
|
||||
Task t = new Task(translationId);
|
||||
|
||||
if (t != null && (t.ParentUser.Id == Security.CurrentUser.Id || t.User.Id == Security.CurrentUser.Id)) {
|
||||
t.Closed = true;
|
||||
t.Save();
|
||||
Response.Redirect("default.aspx");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e) {
|
||||
int translationId = int.Parse(Request["id"]);
|
||||
Task t = new Task(translationId);
|
||||
//Document page = new Document(t.Node.Id);
|
||||
var page = Current.Services.ContentService.GetById(t.TaskEntity.EntityId);
|
||||
|
||||
//Bind meta data and language...
|
||||
Literal lt = new Literal();
|
||||
lt.Text = t.Date.ToLongDateString() + " " + t.Date.ToLongTimeString();
|
||||
pp_date.Controls.Add(lt);
|
||||
pp_date.Text = Services.TextService.Localize("translation/taskOpened");
|
||||
|
||||
lt = new Literal();
|
||||
lt.Text = t.ParentUser.Name;
|
||||
pp_owner.Controls.Add(lt);
|
||||
pp_owner.Text = Services.TextService.Localize("translation/taskAssignedBy");
|
||||
|
||||
//TODO: Make this work again with correct APIs and angularized - so none of this code will exist anymore
|
||||
//lt = new Literal();
|
||||
//lt.Text = Translation.CountWords(t.Node.Id).ToString();
|
||||
//pp_totalWords.Controls.Add(lt);
|
||||
//pp_totalWords.Text = Services.TextService.Localize("translation/totalWords");
|
||||
|
||||
lt = new Literal();
|
||||
|
||||
|
||||
var umbHelper = new UmbracoHelper(Current.UmbracoContext, Current.Services, Current.ApplicationCache);
|
||||
lt.Text = umbHelper.ReplaceLineBreaksForHtml(t.Comment).ToString();
|
||||
|
||||
pp_comment.Controls.Add(lt);
|
||||
pp_comment.Text = Services.TextService.Localize("comment");
|
||||
|
||||
lt = new Literal();
|
||||
lt.Text = "<a target=\"_blank\" href=\"xml.aspx?id=" + t.Id + "\">" + Services.TextService.Localize("download") + "</a>";
|
||||
pp_xml.Controls.Add(lt);
|
||||
pp_xml.Text = Services.TextService.Localize("translation/downloadTaskAsXml");
|
||||
|
||||
pane_details.Text = Services.TextService.Localize("translation/details");
|
||||
panel1.Text = Services.TextService.Localize("translation/details");
|
||||
|
||||
pane_fields.Text = Services.TextService.Localize("translation/fields");
|
||||
pane_tasks.Text = Services.TextService.Localize("translation/translationOptions");
|
||||
lt = new Literal();
|
||||
lt.Text = "<a href=\"default.aspx?id=" + t.Id + "\">" + Services.TextService.Localize("upload") + "</a>";
|
||||
pp_upload.Controls.Add(lt);
|
||||
pp_upload.Text = Services.TextService.Localize("translation/uploadTranslationXml");
|
||||
|
||||
if (t.Closed)
|
||||
pp_closeTask.Visible = false;
|
||||
else {
|
||||
pp_closeTask.Text = Services.TextService.Localize("translation/closeTask");
|
||||
bt_close.Text = Services.TextService.Localize("close");
|
||||
}
|
||||
|
||||
|
||||
//Bind page fields
|
||||
DataTable pageTable = new DataTable();
|
||||
pageTable.Columns.Add(Services.TextService.Localize("name"));
|
||||
pageTable.Columns.Add(Services.TextService.Localize("value"));
|
||||
|
||||
DataRow pageRow = pageTable.NewRow();
|
||||
pageRow[Services.TextService.Localize("name")] = Services.TextService.Localize("nodeName");
|
||||
pageRow[Services.TextService.Localize("value")] = page.Name;
|
||||
pageTable.Rows.Add(pageRow);
|
||||
|
||||
//TODO: Make this work again with correct APIs and angularized - so none of this code will exist anymore
|
||||
//foreach (PropertyType pt in page.ContentType.PropertyTypes) {
|
||||
// pageRow = pageTable.NewRow();
|
||||
// pageRow[Services.TextService.Localize("name")] = pt.Name;
|
||||
// pageRow[Services.TextService.Localize("value")] = page.getProperty(pt.Alias).Value;
|
||||
// pageTable.Rows.Add(pageRow);
|
||||
//}
|
||||
|
||||
dg_fields.DataSource = pageTable;
|
||||
dg_fields.DataBind();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace umbraco.presentation.umbraco.translation {
|
||||
|
||||
|
||||
public partial class details {
|
||||
|
||||
/// <summary>
|
||||
/// panel1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.UmbracoPanel panel1;
|
||||
|
||||
/// <summary>
|
||||
/// pane_details control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.Pane pane_details;
|
||||
|
||||
/// <summary>
|
||||
/// pp_date control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_date;
|
||||
|
||||
/// <summary>
|
||||
/// pp_owner control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_owner;
|
||||
|
||||
/// <summary>
|
||||
/// pp_totalWords control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_totalWords;
|
||||
|
||||
/// <summary>
|
||||
/// pp_comment control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_comment;
|
||||
|
||||
/// <summary>
|
||||
/// pane_tasks control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.Pane pane_tasks;
|
||||
|
||||
/// <summary>
|
||||
/// pp_xml control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_xml;
|
||||
|
||||
/// <summary>
|
||||
/// pp_upload control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_upload;
|
||||
|
||||
/// <summary>
|
||||
/// pp_closeTask control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.PropertyPanel pp_closeTask;
|
||||
|
||||
/// <summary>
|
||||
/// bt_close 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 bt_close;
|
||||
|
||||
/// <summary>
|
||||
/// pane_fields control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Umbraco.Web._Legacy.Controls.Pane pane_fields;
|
||||
|
||||
/// <summary>
|
||||
/// dg_fields 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.DataGrid dg_fields;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="../masterpages/umbracoPage.Master" CodeBehind="preview.aspx.cs" Inherits="umbraco.presentation.translation.preview" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="body" runat="server">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" style="text-align: center;">
|
||||
<tr>
|
||||
<td><h2>Translated version</h2></td>
|
||||
<td><h2>Original</h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="notice">
|
||||
<p>
|
||||
<strong>Please notice</strong> that due to templating and unpublished content, the 2 pages can have differences in layout.
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border-right: 1px solid #ccc; padding-right: 15px;">
|
||||
|
||||
<iframe src="<%= translatedUrl %>" frameborder="0" style="border: none"></iframe>
|
||||
</td>
|
||||
<td style="padding-left: 15px;">
|
||||
|
||||
<iframe src="<%= originalUrl %>" frameborder="0" style="border: none"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
var docHeight = jQuery(document).height();
|
||||
var docWidth = jQuery(document).width();
|
||||
|
||||
jQuery("iframe").height(docHeight - 140).width((docWidth / 2) - 31);
|
||||
});
|
||||
</script>
|
||||
|
||||
</asp:Content>
|
||||
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web._Legacy.BusinessLogic;
|
||||
|
||||
namespace umbraco.presentation.translation
|
||||
{
|
||||
public partial class preview : Umbraco.Web.UI.Pages.UmbracoEnsuredPage
|
||||
{
|
||||
public string originalUrl = "";
|
||||
public string translatedUrl = "";
|
||||
|
||||
public preview()
|
||||
{
|
||||
CurrentApp = Constants.Applications.Translation.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
var taskId = int.Parse(Request.GetItemAsString("id"));
|
||||
|
||||
var t = new Task(taskId);
|
||||
|
||||
translatedUrl = string.Format("../dialogs/preview.aspx?id={0}", t.TaskEntity.EntityId);
|
||||
|
||||
var orgRel = Services.RelationService.GetByParentOrChildId(t.TaskEntity.EntityId, "relateDocumentOnCopy").ToArray();
|
||||
|
||||
if (orgRel.Length > 0)
|
||||
{
|
||||
originalUrl = String.Format("../dialogs/preview.aspx?id={0}", orgRel[0].ParentId);
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect(translatedUrl);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace umbraco.presentation.translation {
|
||||
|
||||
|
||||
public partial class preview {
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="xml.aspx.cs" Inherits="umbraco.presentation.translation.xml" %><?xml version="1.0" encoding="UTF-8"?>
|
||||
<asp:literal id="xmlContents" runat="server"></asp:literal>
|
||||
@@ -1,107 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Xml;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Xml;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Web._Legacy.BusinessLogic;
|
||||
|
||||
namespace umbraco.presentation.translation
|
||||
{
|
||||
public partial class xml : Umbraco.Web.UI.Pages.UmbracoEnsuredPage
|
||||
{
|
||||
private readonly XmlDocument _xd = new XmlDocument();
|
||||
|
||||
public xml()
|
||||
{
|
||||
CurrentApp = Constants.Applications.Translation.ToString();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Response.ContentType = "text/xml";
|
||||
int pageId;
|
||||
|
||||
XmlNode root = _xd.CreateElement("tasks");
|
||||
|
||||
if (int.TryParse(Request["id"], out pageId))
|
||||
{
|
||||
var t = new Task(pageId);
|
||||
if (t.User.Id == Security.CurrentUser.Id || t.ParentUser.Id == Security.CurrentUser.Id)
|
||||
{
|
||||
XmlNode x = CreateTaskNode(t, _xd);
|
||||
root.AppendChild(x);
|
||||
|
||||
xmlContents.Text = root.OuterXml;
|
||||
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=" + t.TaskEntityEntity.Name.Replace(" ", "_") + ".xml");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var nodes = new SortedList();
|
||||
int totalWords = 0;
|
||||
|
||||
foreach (Task t in Task.GetTasks(Security.CurrentUser, false))
|
||||
{
|
||||
if (!nodes.ContainsKey(t.TaskEntityEntity.Path))
|
||||
{
|
||||
var xTask = CreateTaskNode(t, _xd);
|
||||
totalWords += int.Parse(xTask.Attributes.GetNamedItem("TotalWords").Value);
|
||||
nodes.Add(t.TaskEntityEntity.Path, xTask);
|
||||
}
|
||||
}
|
||||
|
||||
// Arrange nodes in tree
|
||||
var ide = nodes.GetEnumerator();
|
||||
while (ide.MoveNext())
|
||||
{
|
||||
var x = (XmlElement)ide.Value;
|
||||
var parentXpath = "//* [@isDoc and @id = '" + x.SelectSingleNode("//* [@isDoc]").Attributes.GetNamedItem("parentID").Value + "']";
|
||||
var parent = _xd.SelectSingleNode(parentXpath);
|
||||
|
||||
if (parent == null)
|
||||
parent = root;
|
||||
else
|
||||
parent = parent.ParentNode;
|
||||
|
||||
parent.AppendChild((XmlElement)ide.Value);
|
||||
}
|
||||
|
||||
root.Attributes.Append(XmlHelper.AddAttribute(_xd, "TotalWords", totalWords.ToString()));
|
||||
xmlContents.Text = root.OuterXml;
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=all.xml");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private XmlElement CreateTaskNode(Task t, XmlDocument xd)
|
||||
{
|
||||
//var d = new Document(t.Node.Id);
|
||||
//var x = d.ToPreviewXml(xd);// xd.CreateNode(XmlNodeType.Element, "node", "");
|
||||
|
||||
var content = Current.Services.ContentService.GetById(t.TaskEntity.EntityId);
|
||||
|
||||
const bool published = false; // no idea really
|
||||
var x = EntityXmlSerializer.Serialize(Current.Services.ContentService, Current.Services.DataTypeService, Current.Services.UserService, Current.Services.LocalizationService, Current.UrlSegmentProviders, content, published);
|
||||
|
||||
|
||||
var xTask = xd.CreateElement("task");
|
||||
xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "Id", t.Id.ToString()));
|
||||
xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "Date", t.Date.ToString("s")));
|
||||
xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "NodeId", t.TaskEntity.EntityId.ToString()));
|
||||
//TODO: Make this work again with correct APIs and angularized - so none of this code will exist anymore
|
||||
//xTask.SetAttributeNode(XmlHelper.AddAttribute(xd, "TotalWords", cms.businesslogic.translation.Translation.CountWords(d.Id).ToString()));
|
||||
xTask.AppendChild(XmlHelper.AddCDataNode(xd, "Comment", t.Comment));
|
||||
string protocol = UmbracoConfig.For.GlobalSettings().UseHttps ? "https" : "http";
|
||||
xTask.AppendChild(XmlHelper.AddTextNode(xd, "PreviewUrl", protocol + "://" + Request.ServerVariables["SERVER_NAME"] + SystemDirectories.Umbraco + "/translation/preview.aspx?id=" + t.Id.ToString()));
|
||||
// d.XmlPopulate(xd, ref x, false);
|
||||
xTask.AppendChild(x.ToXmlElement());
|
||||
|
||||
return xTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.3053
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace umbraco.presentation.translation {
|
||||
|
||||
|
||||
public partial class xml {
|
||||
|
||||
/// <summary>
|
||||
/// xmlContents 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.Literal xmlContents;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user