Permalink
Browse files

Fixed date tostring conversions in the legacy api

  • Loading branch information...
tidyui committed Feb 8, 2017
1 parent 89ddc4b commit 485f85f49d3fbfa50445a396673c890062a0c2d1
@@ -43,7 +43,7 @@
<connectionStrings>
<add name="piranha-ce" connectionString="data source=|DataDirectory|Piranha.sdf" providerName="System.Data.SqlServerCe.4.0"/>
<add name="piranha-express" connectionString="data source=.\sqlexpress;initial catalog=piranha-db;user id=user;password=pass;multipleactiveresultsets=true;" providerName="System.Data.SqlClient"/>
<add name="piranha-local" connectionString="data source=(localdb)\v11.0;initial catalog=piranha-db;integrated security=true" providerName="System.Data.SqlClient" />
<add name="piranha-local" connectionString="data source=(localdb)\MSSQLLocalDB;initial catalog=piranha-db;integrated security=true" providerName="System.Data.SqlClient" />
<add name="piranha-sql" connectionString="data source=hostname;initial catalog=piranha-db;user id=user;password=pass;multipleactiveresultsets=true;" providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
@@ -45,8 +45,8 @@ public class CategoryService : BaseService
Name = c.Name,
Permalink = c.Permalink,
Description = c.Description,
Created = c.Created.ToString(),
Updated = c.Updated.ToString()
Created = c.Created.ToString("yyyy-MM-dd HH:mm:ss"),
Updated = c.Updated.ToString("yyyy-MM-dd HH:mm:ss")
};
foreach (var ext in c.GetExtensions()) {
var internalId = Extend.ExtensionManager.Current.GetInternalIdByType(ext.Type);
@@ -50,19 +50,19 @@ public class ChangeService : BaseService
// Get all deleted content
string query = "syslog_parent_type = @0 AND syslog_action = @1 AND syslog_created > @2";
changes.Deleted.Pages = Piranha.Models.SysLog.Get(query, "PAGE", "DEPUBLISH", latest).
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString() }).ToList();
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString("yyyy-MM-dd HH:mm:ss") }).ToList();
changes.Deleted.Posts = Piranha.Models.SysLog.Get(query, "POST", "DEPUBLISH", latest).
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString() }).ToList();
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString("yyyy-MM-dd HH:mm:ss") }).ToList();
changes.Deleted.Content = Piranha.Models.SysLog.Get(query, "CONTENT", "DELETE", latest).
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString() }).ToList();
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString("yyyy-MM-dd HH:mm:ss") }).ToList();
changes.Deleted.Categories = Piranha.Models.SysLog.Get(query, "CATEGORY", "DELETE", latest).
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString() }).ToList();
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString("yyyy-MM-dd HH:mm:ss") }).ToList();
changes.Deleted.PageTemplates = Piranha.Models.SysLog.Get(query, "PAGETEMPLATE", "DELETE", latest).
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString() }).ToList();
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString("yyyy-MM-dd HH:mm:ss") }).ToList();
changes.Deleted.PostTemplates = Piranha.Models.SysLog.Get(query, "POSTTEMPLATE", "DELETE", latest).
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString() }).ToList();
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString("yyyy-MM-dd HH:mm:ss") }).ToList();
changes.Deleted.MediaFolders = Piranha.Models.SysLog.Get(query, "MEDIAFOLDER", "DELETE", latest).
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString() }).ToList();
Select(l => new DeletedItem() { Id = l.ParentId, Deleted = l.Created.ToString("yyyy-MM-dd HH:mm:ss") }).ToList();
// Check if we have deleted pages or pages publised after the given date. If so return the sitemap
if (changes.Deleted.Pages.Count > 0 || Models.Page.GetScalar("SELECT COUNT(page_id) FROM page JOIN sitetree ON page_sitetree_id = sitetree_id WHERE page_last_published > @0 AND sitetree_internal_id = @1", latest, internalid) > 0)
@@ -108,17 +108,17 @@ public class ContentService
ContentUrl = WebPages.WebPiranha.ApplicationPath +
(!draft ? Application.Current.Handlers.GetUrlPrefix("CONTENT") :
Application.Current.Handlers.GetUrlPrefix("CONTENTDRAFT")) + "/" + c.Id,
Created = c.Created.ToString(),
Updated = c.Updated.ToString()
Created = c.Created.ToString("yyyy-MM-dd HH:mm:ss"),
Updated = c.Updated.ToString("yyyy-MM-dd HH:mm:ss")
};
foreach (var cat in Models.Category.GetByContentId(c.Id, false)) {
media.Categories.Add(new Category() {
Id = cat.Id,
Permalink = cat.Permalink,
Name = cat.Name,
Description = cat.Description,
Created = cat.Created.ToString(),
Updated = cat.Updated.ToString()
Created = cat.Created.ToString("yyyy-MM-dd HH:mm:ss"),
Updated = cat.Updated.ToString("yyyy-MM-dd HH:mm:ss")
});
}
return media;
@@ -73,10 +73,10 @@ public class PageService : BaseService
NavigationTitle = pm.Page.NavigationTitle,
Permalink = pm.Page.Permalink,
IsHidden = ((Piranha.Models.Page)pm.Page).IsHidden,
Created = pm.Page.Created.ToString(),
Updated = pm.Page.Updated.ToString(),
Published = pm.Page.Published.ToString(),
LastPublished = pm.Page.LastPublished.ToString()
Created = pm.Page.Created.ToString("yyyy-MM-dd HH:mm:ss"),
Updated = pm.Page.Updated.ToString("yyyy-MM-dd HH:mm:ss"),
Published = pm.Page.Published.ToString("yyyy-MM-dd HH:mm:ss"),
LastPublished = pm.Page.LastPublished.ToString("yyyy-MM-dd HH:mm:ss")
};
// Regions
@@ -62,10 +62,10 @@ public class PostService : BaseService
Permalink = pm.Post.Permalink,
Excerpt = pm.Post.Excerpt,
Body = pm.Post.Body.ToHtmlString(),
Created = pm.Post.Created.ToString(),
Updated = pm.Post.Updated.ToString(),
Published = pm.Post.Published.ToString(),
LastPublished = pm.Post.LastPublished.ToString()
Created = pm.Post.Created.ToString("yyyy-MM-dd HH:mm:ss"),
Updated = pm.Post.Updated.ToString("yyyy-MM-dd HH:mm:ss"),
Published = pm.Post.Published.ToString("yyyy-MM-dd HH:mm:ss"),
LastPublished = pm.Post.LastPublished.ToString("yyyy-MM-dd HH:mm:ss")
};
// Categories
@@ -75,8 +75,8 @@ public class PostService : BaseService
Permalink = cat.Permalink,
Name = cat.Name,
Description = cat.Description,
Created = cat.Created.ToString(),
Updated = cat.Updated.ToString()
Created = cat.Created.ToString("yyyy-MM-dd HH:mm:ss"),
Updated = cat.Updated.ToString("yyyy-MM-dd HH:mm:ss")
});
// Properties
@@ -33,4 +33,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.*")]
[assembly: AssemblyFileVersion("2.2.6.0")]
[assembly: AssemblyFileVersion("2.2.6.2")]
@@ -90,7 +90,7 @@ public class SitemapServices
IsHidden = map.IsHidden,
HasChildren = map.Pages.Count > 0,
ChildNodes = BuildMap(map.Pages),
LastPublished = map.LastPublished.ToString()
LastPublished = map.LastPublished.ToString("yyyy-MM-dd HH:mm:ss")
});
}
});
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>PiranhaCMS.Legacy.Services</id>
<version>1.1.0</version>
<version>1.1.1-beta</version>
<title>Piranha CMS Legacy Services</title>
<authors>Håkan Edling</authors>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
@@ -18,7 +18,7 @@ https://github.com/piranhacms/piranha/wiki/changelog
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="EntityFramework" version="[6.1.3, 6.2.0)" />
<dependency id="PiranhaCMS.Core" version="[2.2.6, 2.3.0)" />
<dependency id="PiranhaCMS.Core" version="[2.2.5, 2.3.0)" />
</group>
</dependencies>
<frameworkAssemblies>
View
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{B9B2FF56-3B77-4403-B692-FE12464EA461}"
ProjectSection(SolutionItems) = preProject
@@ -29,7 +29,7 @@ EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "TemplateSite", "http://localhost:8775", "{FF250F87-B87C-4955-92F0-BF2587EEA49B}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.5"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.6.1"
ProjectReferences = "{73b6e71e-3255-40a1-93ef-5416dc71e940}|Piranha.dll;{3edc9f07-99bf-4ad5-8bb6-b8d1e077bb75}|Piranha.WebPages.dll;"
Debug.AspNetCompiler.VirtualPath = "/localhost_8775"
Debug.AspNetCompiler.PhysicalPath = "Templates\TemplateSite\"
@@ -65,7 +65,7 @@
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
<connectionStrings>
<add name="piranha" connectionString="data source=(localdb)\v11.0;initial catalog=piranha-testdb;integrated security=true" providerName="System.Data.SqlClient" />
<add name="piranha" connectionString="data source=(localdb)\MSSQLLocalDB;initial catalog=piranha-testdb;integrated security=true" providerName="System.Data.SqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@@ -23,7 +23,7 @@
<add key="webPages:Version" value="3.0.0.0" />
</appSettings>
<connectionStrings>
<add name="piranha" connectionString="data source=(localdb)\v11.0;initial catalog=piranha-testdb;integrated security=true" providerName="System.Data.SqlClient" />
<add name="piranha" connectionString="data source=(localdb)\MSSQLLocalDB;initial catalog=piranha-testdb;integrated security=true" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.5">

0 comments on commit 485f85f

Please sign in to comment.