Move uWiki and uRepo
This commit is contained in:
@@ -4750,10 +4750,6 @@
|
||||
<Project>{c5b74e6a-abce-4a9a-896d-89c33fdafcd8}</Project>
|
||||
<Name>uRelease</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\uRepo\uRepo.csproj">
|
||||
<Project>{47fd2b14-1653-4052-ad53-1871a8f85e0e}</Project>
|
||||
<Name>uRepo</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\migrations\" />
|
||||
|
||||
@@ -123,6 +123,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\UmbracoCms.Core.7.2.8-build103\lib\System.Data.SqlServerCe.dll</HintPath>
|
||||
@@ -138,6 +139,7 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -158,6 +160,7 @@
|
||||
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -219,13 +222,50 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Repository\Project.cs" />
|
||||
<Compile Include="Repository\Projects.cs" />
|
||||
<Compile Include="Repository\RepoStartupHandler.cs" />
|
||||
<Compile Include="Repository\StarterKit.cs" />
|
||||
<Compile Include="Repository\StarterKitController.cs" />
|
||||
<Compile Include="Repository\webservices\repository.asmx.cs">
|
||||
<DependentUpon>repository.asmx</DependentUpon>
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Version\Config.cs" />
|
||||
<Compile Include="Version\uWikiFileVerison.cs" />
|
||||
<Compile Include="Wiki\Api\WikiController.cs" />
|
||||
<Compile Include="Wiki\BusinessLogic\Data.cs" />
|
||||
<Compile Include="Wiki\BusinessLogic\Events.cs" />
|
||||
<Compile Include="Wiki\BusinessLogic\UmbracoVersion.cs" />
|
||||
<Compile Include="Wiki\BusinessLogic\WikiFile.cs" />
|
||||
<Compile Include="Wiki\BusinessLogic\WikiHelpRequest.cs" />
|
||||
<Compile Include="Wiki\BusinessLogic\WikiPage.cs" />
|
||||
<Compile Include="Wiki\iNotFoundHandler.cs" />
|
||||
<Compile Include="Wiki\Library\Utils.cs" />
|
||||
<Compile Include="Wiki\Library\xslt.cs" />
|
||||
<Compile Include="Wiki\usercontrols\FileUpload.ascx.cs">
|
||||
<DependentUpon>FileUpload.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Wiki\usercontrols\FileUpload.ascx.designer.cs">
|
||||
<DependentUpon>FileUpload.ascx.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Wiki\WikiFileUploadHandler.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Repository\webservices\repository.asmx" />
|
||||
<Content Include="Wiki\usercontrols\FileUpload.ascx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Repository\webservices\App_Data\" />
|
||||
<Folder Include="Wiki\usercontrols\scripts\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -1,192 +1,192 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace uRepo
|
||||
{
|
||||
[Serializable]
|
||||
[XmlType(Namespace = "http://packages.umbraco.org/webservices/")]
|
||||
public class Package : IComparable
|
||||
{
|
||||
private Guid repoGuid;
|
||||
public Guid RepoGuid
|
||||
{
|
||||
get { return repoGuid; }
|
||||
set { repoGuid = value; }
|
||||
}
|
||||
|
||||
private string text;
|
||||
public string Text
|
||||
{
|
||||
get { return text; }
|
||||
set { text = value; }
|
||||
}
|
||||
|
||||
private string description;
|
||||
public string Description
|
||||
{
|
||||
get { return description; }
|
||||
set { description = value; }
|
||||
}
|
||||
|
||||
private string icon;
|
||||
public string Icon
|
||||
{
|
||||
get { return icon; }
|
||||
set { icon = value; }
|
||||
}
|
||||
|
||||
private string thumbnail;
|
||||
public string Thumbnail
|
||||
{
|
||||
get { return thumbnail; }
|
||||
set { thumbnail = value; }
|
||||
}
|
||||
|
||||
private string documentation;
|
||||
public string Documentation
|
||||
{
|
||||
get { return documentation; }
|
||||
set { documentation = value; }
|
||||
}
|
||||
|
||||
private string demo;
|
||||
public string Demo
|
||||
{
|
||||
get { return demo; }
|
||||
set { demo = value; }
|
||||
}
|
||||
|
||||
private bool accepted;
|
||||
public bool Accepted
|
||||
{
|
||||
get { return accepted; }
|
||||
set { accepted = value; }
|
||||
}
|
||||
|
||||
private bool isModule;
|
||||
public bool IsModule {
|
||||
get { return isModule; }
|
||||
set { isModule = value; }
|
||||
}
|
||||
|
||||
|
||||
private bool editorsPick = false;
|
||||
public bool EditorsPick
|
||||
{
|
||||
get { return editorsPick; }
|
||||
set { editorsPick = value; }
|
||||
}
|
||||
|
||||
private bool m_protected;
|
||||
public bool Protected
|
||||
{
|
||||
get { return m_protected; }
|
||||
set { m_protected = value; }
|
||||
}
|
||||
|
||||
|
||||
private bool hasUpgrade;
|
||||
public bool HasUpgrade
|
||||
{
|
||||
get { return hasUpgrade; }
|
||||
set { hasUpgrade = value; }
|
||||
}
|
||||
|
||||
private string upgradeVersion;
|
||||
public string UpgradeVersion
|
||||
{
|
||||
get { return upgradeVersion; }
|
||||
set { upgradeVersion = value; }
|
||||
}
|
||||
|
||||
private string upgradeReadMe;
|
||||
public string UpgradeReadMe
|
||||
{
|
||||
get { return upgradeReadMe; }
|
||||
set { upgradeReadMe = value; }
|
||||
}
|
||||
|
||||
private string url;
|
||||
public string Url
|
||||
{
|
||||
get { return url; }
|
||||
set { url = value; }
|
||||
}
|
||||
|
||||
public int CompareTo(object other)
|
||||
{
|
||||
return ((Package)other).text.CompareTo(this.text);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[XmlType(Namespace = "http://packages.umbraco.org/webservices/")]
|
||||
public enum SubmitStatus
|
||||
{
|
||||
Complete, Exists, NoAccess, Error
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[XmlType(Namespace = "http://packages.umbraco.org/webservices/")]
|
||||
public class Category : IComparable
|
||||
{
|
||||
public Category()
|
||||
{
|
||||
packages = new List<Package>();
|
||||
}
|
||||
private string text;
|
||||
public string Text
|
||||
{
|
||||
get { return text; }
|
||||
set { text = value; }
|
||||
}
|
||||
|
||||
private string description;
|
||||
public string Description
|
||||
{
|
||||
get { return description; }
|
||||
set { description = value; }
|
||||
}
|
||||
|
||||
private string url;
|
||||
public string Url
|
||||
{
|
||||
get { return url; }
|
||||
set { url = value; }
|
||||
}
|
||||
|
||||
private int id;
|
||||
public int Id
|
||||
{
|
||||
get { return id; }
|
||||
set { id = value; }
|
||||
}
|
||||
|
||||
private List<Package> packages;
|
||||
public List<Package> Packages
|
||||
{
|
||||
get { return packages; }
|
||||
set { packages = value; }
|
||||
}
|
||||
|
||||
#region IComparable Members
|
||||
|
||||
public int CompareTo(object other)
|
||||
{
|
||||
return ((Category)other).text.CompareTo(this.text);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace uRepo
|
||||
{
|
||||
[Serializable]
|
||||
[XmlType(Namespace = "http://packages.umbraco.org/webservices/")]
|
||||
public class Package : IComparable
|
||||
{
|
||||
private Guid repoGuid;
|
||||
public Guid RepoGuid
|
||||
{
|
||||
get { return repoGuid; }
|
||||
set { repoGuid = value; }
|
||||
}
|
||||
|
||||
private string text;
|
||||
public string Text
|
||||
{
|
||||
get { return text; }
|
||||
set { text = value; }
|
||||
}
|
||||
|
||||
private string description;
|
||||
public string Description
|
||||
{
|
||||
get { return description; }
|
||||
set { description = value; }
|
||||
}
|
||||
|
||||
private string icon;
|
||||
public string Icon
|
||||
{
|
||||
get { return icon; }
|
||||
set { icon = value; }
|
||||
}
|
||||
|
||||
private string thumbnail;
|
||||
public string Thumbnail
|
||||
{
|
||||
get { return thumbnail; }
|
||||
set { thumbnail = value; }
|
||||
}
|
||||
|
||||
private string documentation;
|
||||
public string Documentation
|
||||
{
|
||||
get { return documentation; }
|
||||
set { documentation = value; }
|
||||
}
|
||||
|
||||
private string demo;
|
||||
public string Demo
|
||||
{
|
||||
get { return demo; }
|
||||
set { demo = value; }
|
||||
}
|
||||
|
||||
private bool accepted;
|
||||
public bool Accepted
|
||||
{
|
||||
get { return accepted; }
|
||||
set { accepted = value; }
|
||||
}
|
||||
|
||||
private bool isModule;
|
||||
public bool IsModule {
|
||||
get { return isModule; }
|
||||
set { isModule = value; }
|
||||
}
|
||||
|
||||
|
||||
private bool editorsPick = false;
|
||||
public bool EditorsPick
|
||||
{
|
||||
get { return editorsPick; }
|
||||
set { editorsPick = value; }
|
||||
}
|
||||
|
||||
private bool m_protected;
|
||||
public bool Protected
|
||||
{
|
||||
get { return m_protected; }
|
||||
set { m_protected = value; }
|
||||
}
|
||||
|
||||
|
||||
private bool hasUpgrade;
|
||||
public bool HasUpgrade
|
||||
{
|
||||
get { return hasUpgrade; }
|
||||
set { hasUpgrade = value; }
|
||||
}
|
||||
|
||||
private string upgradeVersion;
|
||||
public string UpgradeVersion
|
||||
{
|
||||
get { return upgradeVersion; }
|
||||
set { upgradeVersion = value; }
|
||||
}
|
||||
|
||||
private string upgradeReadMe;
|
||||
public string UpgradeReadMe
|
||||
{
|
||||
get { return upgradeReadMe; }
|
||||
set { upgradeReadMe = value; }
|
||||
}
|
||||
|
||||
private string url;
|
||||
public string Url
|
||||
{
|
||||
get { return url; }
|
||||
set { url = value; }
|
||||
}
|
||||
|
||||
public int CompareTo(object other)
|
||||
{
|
||||
return ((Package)other).text.CompareTo(this.text);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[XmlType(Namespace = "http://packages.umbraco.org/webservices/")]
|
||||
public enum SubmitStatus
|
||||
{
|
||||
Complete, Exists, NoAccess, Error
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[XmlType(Namespace = "http://packages.umbraco.org/webservices/")]
|
||||
public class Category : IComparable
|
||||
{
|
||||
public Category()
|
||||
{
|
||||
packages = new List<Package>();
|
||||
}
|
||||
private string text;
|
||||
public string Text
|
||||
{
|
||||
get { return text; }
|
||||
set { text = value; }
|
||||
}
|
||||
|
||||
private string description;
|
||||
public string Description
|
||||
{
|
||||
get { return description; }
|
||||
set { description = value; }
|
||||
}
|
||||
|
||||
private string url;
|
||||
public string Url
|
||||
{
|
||||
get { return url; }
|
||||
set { url = value; }
|
||||
}
|
||||
|
||||
private int id;
|
||||
public int Id
|
||||
{
|
||||
get { return id; }
|
||||
set { id = value; }
|
||||
}
|
||||
|
||||
private List<Package> packages;
|
||||
public List<Package> Packages
|
||||
{
|
||||
get { return packages; }
|
||||
set { packages = value; }
|
||||
}
|
||||
|
||||
#region IComparable Members
|
||||
|
||||
public int CompareTo(object other)
|
||||
{
|
||||
return ((Category)other).text.CompareTo(this.text);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,394 +1,394 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Xml.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.XPath;
|
||||
using System.Xml;
|
||||
using umbraco.presentation.nodeFactory;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using uWiki.Businesslogic;
|
||||
|
||||
namespace uRepo
|
||||
{
|
||||
public class Packages
|
||||
{
|
||||
protected const int _projectsRoot = 1113;
|
||||
protected const string _projectAlias = "Project";
|
||||
protected const string _projectGroupAlias = "ProjectGroup";
|
||||
|
||||
//used by the repo webservice
|
||||
public static SubmitStatus SubmitPackageAsProject(string authorGuid, string packageGuid, byte[] packageFile, byte[] packageDoc, byte[] packageThumbnail, string name, string description)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (packageFile.Length == 0)
|
||||
return SubmitStatus.Error;
|
||||
|
||||
umbraco.cms.businesslogic.member.Member mem = new umbraco.cms.businesslogic.member.Member(new Guid(authorGuid));
|
||||
Package packageNode = uRepo.Packages.GetPackageByGuid( new Guid(packageGuid));
|
||||
|
||||
if (mem != null)
|
||||
{
|
||||
//existing package...
|
||||
if (packageNode != null)
|
||||
{
|
||||
return SubmitStatus.Exists;
|
||||
}
|
||||
else
|
||||
{
|
||||
Document d = Document.MakeNew(name, DocumentType.GetByAlias(_projectAlias), new umbraco.BusinessLogic.User(0), _projectsRoot);
|
||||
|
||||
d.getProperty("version").Value = "1.0";
|
||||
d.getProperty("description").Value = description;
|
||||
|
||||
d.getProperty("stable").Value = false;
|
||||
|
||||
d.getProperty("demoUrl").Value = "";
|
||||
d.getProperty("sourceUrl").Value = "";
|
||||
d.getProperty("websiteUrl").Value = "";
|
||||
|
||||
d.getProperty("licenseUrl").Value = "";
|
||||
d.getProperty("licenseName").Value = "";
|
||||
|
||||
d.getProperty("vendorUrl").Value = "";
|
||||
|
||||
d.getProperty("owner").Value = mem.Id;
|
||||
d.getProperty("packageGuid").Value = packageGuid;
|
||||
|
||||
uWiki.Businesslogic.WikiFile wf = uWiki.Businesslogic.WikiFile.Create(name,"zip", d.UniqueId, mem.UniqueId, packageFile, "package", new List<UmbracoVersion>(){UmbracoVersion.DefaultVersion()});
|
||||
d.getProperty("file").Value = wf.Id;
|
||||
|
||||
//Create Documentation
|
||||
if (packageDoc.Length > 0)
|
||||
{
|
||||
uWiki.Businesslogic.WikiFile doc = uWiki.Businesslogic.WikiFile.Create("documentation", "pdf", d.UniqueId, mem.UniqueId, packageDoc, "docs", new List<UmbracoVersion>() { UmbracoVersion.DefaultVersion() });
|
||||
d.getProperty("documentation").Value = doc.Id;
|
||||
}
|
||||
|
||||
d.XmlGenerate(new XmlDocument());
|
||||
d.Save();
|
||||
|
||||
d.Publish(new umbraco.BusinessLogic.User(0));
|
||||
umbraco.library.UpdateDocumentCache(d.Id);
|
||||
|
||||
return SubmitStatus.Complete;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return SubmitStatus.NoAccess;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
|
||||
return SubmitStatus.Error;
|
||||
}
|
||||
}
|
||||
|
||||
public static Package GetPackageById(int id)
|
||||
{
|
||||
return convertToPackageFromNode(new Node(id));
|
||||
}
|
||||
|
||||
public static Package GetPackageByGuid(Guid guid)
|
||||
{
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::node[data [@alias = 'packageGuid'] = '" + guid.ToString() + "']");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
if(xpn.Current is IHasXmlNode)
|
||||
{
|
||||
XmlNode node = ((IHasXmlNode)xpn.Current).GetNode();
|
||||
return convertToPackageFromXmlNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Package> GetAllPackages()
|
||||
{
|
||||
string xpath = "/descendant::node [@nodeTypeAlias = '" + _projectAlias + "']";
|
||||
|
||||
List<Package> ps = new List<Package>();
|
||||
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
while(xni.MoveNext()){
|
||||
if(xni.Current is IHasXmlNode)
|
||||
{
|
||||
XmlNode node = ((IHasXmlNode)xni.Current).GetNode();
|
||||
ps.Add(convertToPackageFromXmlNode(node));
|
||||
}
|
||||
}
|
||||
ps.Sort();
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
public static List<Package> GetPackagesByTag(string tag)
|
||||
{
|
||||
return new List<Package>();
|
||||
}
|
||||
|
||||
public static List<Package> GetPackagesByCategory(int category)
|
||||
{
|
||||
string xpath = "/node [@id = " + category.ToString() + "]/descendant::node [@nodeTypeAlias = '" + _projectAlias + "']";
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
return iteratorToPackageList(xni);
|
||||
}
|
||||
|
||||
public static List<Package> GetPackagesByProperty(string propertyAlias, string value) {
|
||||
string xpath = "//" + _projectAlias + "[" + propertyAlias + " = '" + value + "']";
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
return iteratorToPackageList(xni);
|
||||
}
|
||||
public XPathNodeIterator GetProjects()
|
||||
{
|
||||
const string xpath = "//" + _projectAlias;
|
||||
return queryRepo(xpath);
|
||||
}
|
||||
|
||||
public static List<Category> GetPackagesByPropertyCategorized(string propertyAlias, string value) {
|
||||
string xpath = "/descendant::node [@nodeTypeAlias = '" + _projectGroupAlias + "']";
|
||||
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
|
||||
List<Category> ps = new List<Category>();
|
||||
|
||||
while (xni.MoveNext()) {
|
||||
if (xni.Current is IHasXmlNode) {
|
||||
XmlNode node = ((IHasXmlNode)xni.Current).GetNode();
|
||||
|
||||
Category c = convertToCategoryFromXmlNode(node, false);
|
||||
|
||||
string pXpath = "./descendant::node [@nodeTypeAlias = '" + _projectAlias + "' and data [@alias = '" + propertyAlias + "'] = '" + value + "']";
|
||||
|
||||
XPathNodeIterator pI = xni.Current.Select(pXpath);
|
||||
while (pI.MoveNext()) {
|
||||
if (pI.Current is IHasXmlNode) {
|
||||
XmlNode pNode = ((IHasXmlNode)pI.Current).GetNode();
|
||||
Package p = convertToPackageFromXmlNode(pNode);
|
||||
|
||||
if(p != null)
|
||||
c.Packages.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
if (c != null && c.Packages.Count > 0)
|
||||
ps.Add(c);
|
||||
}
|
||||
}
|
||||
|
||||
ps.Sort();
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
public static List<Package> GetPackagesByCategory(string categoryName)
|
||||
{
|
||||
string xpath = "/node [@nodeName = " + categoryName + "]/descendant::node [@nodeTypeAlias = '" + _projectAlias + "']";
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
return iteratorToPackageList(xni);
|
||||
}
|
||||
|
||||
public static List<Category> GetSubCategories(string categoryName, bool includePackages)
|
||||
{
|
||||
string xpath = "/node [@nodeName = " + categoryName + "]/descendant::node [@nodeTypeAlias = '" + _projectGroupAlias + "']";
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
|
||||
return iteratorToCategoryList(xni, includePackages);
|
||||
}
|
||||
|
||||
public static List<Category> GetSubCategories(int id, bool includePackages)
|
||||
{
|
||||
string xpath = "/node [@id = " + id.ToString() + "]/descendant::node [@nodeTypeAlias = '" + _projectGroupAlias + "']";
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
|
||||
return iteratorToCategoryList(xni, includePackages);
|
||||
}
|
||||
|
||||
public static List<Category> Categories(bool includePackages, bool hideHQCategories)
|
||||
{
|
||||
string xpath = "/" + _projectGroupAlias;
|
||||
if(hideHQCategories)
|
||||
xpath += " [hqOnly != '1']";
|
||||
|
||||
XPathNodeIterator xpn = queryRepo(xpath);
|
||||
return iteratorToCategoryList(xpn, includePackages);
|
||||
}
|
||||
|
||||
public static List<Package> Search(string term)
|
||||
{
|
||||
return new List<Package>();
|
||||
}
|
||||
|
||||
//general method for fetching repository specific data...
|
||||
private static XPathNodeIterator queryRepo(string xpath)
|
||||
{
|
||||
return umbraco.library.GetXmlNodeByXPath("descendant-or-self::*[@isDoc and @id = " + _projectsRoot.ToString() + "]" + xpath);
|
||||
}
|
||||
|
||||
private static List<Package> iteratorToPackageList(XPathNodeIterator xni)
|
||||
{
|
||||
List<Package> ps = new List<Package>();
|
||||
|
||||
while (xni.MoveNext())
|
||||
{
|
||||
if (xni.Current is IHasXmlNode)
|
||||
{
|
||||
XmlNode node = ((IHasXmlNode)xni.Current).GetNode();
|
||||
Package p = convertToPackageFromXmlNode(node);
|
||||
|
||||
if (p != null)
|
||||
ps.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
ps.Sort();
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
private static List<Category> iteratorToCategoryList(XPathNodeIterator xni, bool includePackages)
|
||||
{
|
||||
List<Category> ps = new List<Category>();
|
||||
|
||||
while (xni.MoveNext())
|
||||
{
|
||||
if (xni.Current is IHasXmlNode)
|
||||
{
|
||||
XmlNode node = ((IHasXmlNode)xni.Current).GetNode();
|
||||
Category c = convertToCategoryFromXmlNode(node, includePackages);
|
||||
if (c != null)
|
||||
ps.Add(c);
|
||||
}
|
||||
}
|
||||
|
||||
ps.Sort();
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
|
||||
private static Package convertToPackageFromXmlNode(XmlNode node)
|
||||
{
|
||||
return convertToPackageFromNode(new Node(node));
|
||||
}
|
||||
|
||||
private static Package convertToPackageFromNode(Node packageNode)
|
||||
{
|
||||
if (packageNode != null && packageNode.NodeTypeAlias == _projectAlias)
|
||||
{
|
||||
Package retVal = new Package();
|
||||
|
||||
retVal.Text = packageNode.Name;
|
||||
retVal.RepoGuid = new Guid(safeProperty(packageNode,"packageGuid"));
|
||||
retVal.Description = safeProperty(packageNode,"description");
|
||||
retVal.Protected = false;
|
||||
|
||||
retVal.Icon = "";
|
||||
retVal.Thumbnail = safeProperty(packageNode, "defaultScreenshotPath");
|
||||
retVal.Demo = "";
|
||||
|
||||
retVal.IsModule = false;
|
||||
if (safeProperty(packageNode, "isModule") == "1")
|
||||
retVal.IsModule = true;
|
||||
|
||||
if (umbraco.library.NiceUrl(packageNode.Id) != "")
|
||||
{
|
||||
retVal.Url = umbraco.library.NiceUrl(packageNode.Id);
|
||||
retVal.Accepted = true;
|
||||
}
|
||||
|
||||
retVal.HasUpgrade = false;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Category convertToCategoryFromXmlNode(XmlNode node, bool includePackages)
|
||||
{
|
||||
return convertToCategoryFromNode(new Node(node), includePackages);
|
||||
}
|
||||
|
||||
private static Category convertToCategoryFromNode(Node categoryNode, bool includePackages)
|
||||
{
|
||||
if (categoryNode != null && categoryNode.NodeTypeAlias == _projectGroupAlias)
|
||||
{
|
||||
Category retVal = new Category();
|
||||
|
||||
retVal.Text = categoryNode.Name;
|
||||
retVal.Id = categoryNode.Id;
|
||||
retVal.Description = safeProperty(categoryNode,"description");
|
||||
retVal.Url = umbraco.library.NiceUrl(categoryNode.Id);
|
||||
|
||||
if(includePackages){
|
||||
foreach(Node p in categoryNode.Children){
|
||||
Package pack = convertToPackageFromNode(p);
|
||||
if(pack != null)
|
||||
retVal.Packages.Add(pack);
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string safeProperty(umbraco.presentation.nodeFactory.Node n, string alias)
|
||||
{
|
||||
if (n.GetProperty(alias) != null && !string.IsNullOrEmpty(n.GetProperty(alias).Value))
|
||||
return n.GetProperty(alias).Value;
|
||||
else
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
internal static uWiki.Businesslogic.WikiFile PackageFileByGuid(Guid pack)
|
||||
{
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::* [@isDoc and translate(packageGuid,'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = translate('" + pack.ToString() + "','ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
if (xpn.Current is IHasXmlNode)
|
||||
{
|
||||
Node node = new Node(((IHasXmlNode)xpn.Current).GetNode());
|
||||
string fileId = safeProperty(node, "file");
|
||||
int _id;
|
||||
|
||||
if (int.TryParse(fileId, out _id))
|
||||
{
|
||||
string cookieName = "ProjectFileDownload" + fileId;
|
||||
|
||||
//we clear the cookie on the server just to be sure the download is accounted for
|
||||
if (HttpContext.Current.Request.Cookies[cookieName] != null)
|
||||
{
|
||||
HttpCookie myCookie = new HttpCookie(cookieName);
|
||||
myCookie.Expires = DateTime.Now.AddDays(-1d);
|
||||
HttpContext.Current.Response.Cookies.Add(myCookie);
|
||||
}
|
||||
|
||||
uWiki.Businesslogic.WikiFile wf = new uWiki.Businesslogic.WikiFile(_id);
|
||||
wf.UpdateDownloadCounter(true,true);
|
||||
|
||||
return wf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Xml.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.XPath;
|
||||
using System.Xml;
|
||||
using umbraco.presentation.nodeFactory;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using uWiki.Businesslogic;
|
||||
|
||||
namespace uRepo
|
||||
{
|
||||
public class Packages
|
||||
{
|
||||
protected const int _projectsRoot = 1113;
|
||||
protected const string _projectAlias = "Project";
|
||||
protected const string _projectGroupAlias = "ProjectGroup";
|
||||
|
||||
//used by the repo webservice
|
||||
public static SubmitStatus SubmitPackageAsProject(string authorGuid, string packageGuid, byte[] packageFile, byte[] packageDoc, byte[] packageThumbnail, string name, string description)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (packageFile.Length == 0)
|
||||
return SubmitStatus.Error;
|
||||
|
||||
umbraco.cms.businesslogic.member.Member mem = new umbraco.cms.businesslogic.member.Member(new Guid(authorGuid));
|
||||
Package packageNode = uRepo.Packages.GetPackageByGuid( new Guid(packageGuid));
|
||||
|
||||
if (mem != null)
|
||||
{
|
||||
//existing package...
|
||||
if (packageNode != null)
|
||||
{
|
||||
return SubmitStatus.Exists;
|
||||
}
|
||||
else
|
||||
{
|
||||
Document d = Document.MakeNew(name, DocumentType.GetByAlias(_projectAlias), new umbraco.BusinessLogic.User(0), _projectsRoot);
|
||||
|
||||
d.getProperty("version").Value = "1.0";
|
||||
d.getProperty("description").Value = description;
|
||||
|
||||
d.getProperty("stable").Value = false;
|
||||
|
||||
d.getProperty("demoUrl").Value = "";
|
||||
d.getProperty("sourceUrl").Value = "";
|
||||
d.getProperty("websiteUrl").Value = "";
|
||||
|
||||
d.getProperty("licenseUrl").Value = "";
|
||||
d.getProperty("licenseName").Value = "";
|
||||
|
||||
d.getProperty("vendorUrl").Value = "";
|
||||
|
||||
d.getProperty("owner").Value = mem.Id;
|
||||
d.getProperty("packageGuid").Value = packageGuid;
|
||||
|
||||
uWiki.Businesslogic.WikiFile wf = uWiki.Businesslogic.WikiFile.Create(name,"zip", d.UniqueId, mem.UniqueId, packageFile, "package", new List<UmbracoVersion>(){UmbracoVersion.DefaultVersion()});
|
||||
d.getProperty("file").Value = wf.Id;
|
||||
|
||||
//Create Documentation
|
||||
if (packageDoc.Length > 0)
|
||||
{
|
||||
uWiki.Businesslogic.WikiFile doc = uWiki.Businesslogic.WikiFile.Create("documentation", "pdf", d.UniqueId, mem.UniqueId, packageDoc, "docs", new List<UmbracoVersion>() { UmbracoVersion.DefaultVersion() });
|
||||
d.getProperty("documentation").Value = doc.Id;
|
||||
}
|
||||
|
||||
d.XmlGenerate(new XmlDocument());
|
||||
d.Save();
|
||||
|
||||
d.Publish(new umbraco.BusinessLogic.User(0));
|
||||
umbraco.library.UpdateDocumentCache(d.Id);
|
||||
|
||||
return SubmitStatus.Complete;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return SubmitStatus.NoAccess;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
|
||||
return SubmitStatus.Error;
|
||||
}
|
||||
}
|
||||
|
||||
public static Package GetPackageById(int id)
|
||||
{
|
||||
return convertToPackageFromNode(new Node(id));
|
||||
}
|
||||
|
||||
public static Package GetPackageByGuid(Guid guid)
|
||||
{
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::node[data [@alias = 'packageGuid'] = '" + guid.ToString() + "']");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
if(xpn.Current is IHasXmlNode)
|
||||
{
|
||||
XmlNode node = ((IHasXmlNode)xpn.Current).GetNode();
|
||||
return convertToPackageFromXmlNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Package> GetAllPackages()
|
||||
{
|
||||
string xpath = "/descendant::node [@nodeTypeAlias = '" + _projectAlias + "']";
|
||||
|
||||
List<Package> ps = new List<Package>();
|
||||
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
while(xni.MoveNext()){
|
||||
if(xni.Current is IHasXmlNode)
|
||||
{
|
||||
XmlNode node = ((IHasXmlNode)xni.Current).GetNode();
|
||||
ps.Add(convertToPackageFromXmlNode(node));
|
||||
}
|
||||
}
|
||||
ps.Sort();
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
public static List<Package> GetPackagesByTag(string tag)
|
||||
{
|
||||
return new List<Package>();
|
||||
}
|
||||
|
||||
public static List<Package> GetPackagesByCategory(int category)
|
||||
{
|
||||
string xpath = "/node [@id = " + category.ToString() + "]/descendant::node [@nodeTypeAlias = '" + _projectAlias + "']";
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
return iteratorToPackageList(xni);
|
||||
}
|
||||
|
||||
public static List<Package> GetPackagesByProperty(string propertyAlias, string value) {
|
||||
string xpath = "//" + _projectAlias + "[" + propertyAlias + " = '" + value + "']";
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
return iteratorToPackageList(xni);
|
||||
}
|
||||
public XPathNodeIterator GetProjects()
|
||||
{
|
||||
const string xpath = "//" + _projectAlias;
|
||||
return queryRepo(xpath);
|
||||
}
|
||||
|
||||
public static List<Category> GetPackagesByPropertyCategorized(string propertyAlias, string value) {
|
||||
string xpath = "/descendant::node [@nodeTypeAlias = '" + _projectGroupAlias + "']";
|
||||
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
|
||||
List<Category> ps = new List<Category>();
|
||||
|
||||
while (xni.MoveNext()) {
|
||||
if (xni.Current is IHasXmlNode) {
|
||||
XmlNode node = ((IHasXmlNode)xni.Current).GetNode();
|
||||
|
||||
Category c = convertToCategoryFromXmlNode(node, false);
|
||||
|
||||
string pXpath = "./descendant::node [@nodeTypeAlias = '" + _projectAlias + "' and data [@alias = '" + propertyAlias + "'] = '" + value + "']";
|
||||
|
||||
XPathNodeIterator pI = xni.Current.Select(pXpath);
|
||||
while (pI.MoveNext()) {
|
||||
if (pI.Current is IHasXmlNode) {
|
||||
XmlNode pNode = ((IHasXmlNode)pI.Current).GetNode();
|
||||
Package p = convertToPackageFromXmlNode(pNode);
|
||||
|
||||
if(p != null)
|
||||
c.Packages.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
if (c != null && c.Packages.Count > 0)
|
||||
ps.Add(c);
|
||||
}
|
||||
}
|
||||
|
||||
ps.Sort();
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
public static List<Package> GetPackagesByCategory(string categoryName)
|
||||
{
|
||||
string xpath = "/node [@nodeName = " + categoryName + "]/descendant::node [@nodeTypeAlias = '" + _projectAlias + "']";
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
return iteratorToPackageList(xni);
|
||||
}
|
||||
|
||||
public static List<Category> GetSubCategories(string categoryName, bool includePackages)
|
||||
{
|
||||
string xpath = "/node [@nodeName = " + categoryName + "]/descendant::node [@nodeTypeAlias = '" + _projectGroupAlias + "']";
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
|
||||
return iteratorToCategoryList(xni, includePackages);
|
||||
}
|
||||
|
||||
public static List<Category> GetSubCategories(int id, bool includePackages)
|
||||
{
|
||||
string xpath = "/node [@id = " + id.ToString() + "]/descendant::node [@nodeTypeAlias = '" + _projectGroupAlias + "']";
|
||||
XPathNodeIterator xni = queryRepo(xpath);
|
||||
|
||||
return iteratorToCategoryList(xni, includePackages);
|
||||
}
|
||||
|
||||
public static List<Category> Categories(bool includePackages, bool hideHQCategories)
|
||||
{
|
||||
string xpath = "/" + _projectGroupAlias;
|
||||
if(hideHQCategories)
|
||||
xpath += " [hqOnly != '1']";
|
||||
|
||||
XPathNodeIterator xpn = queryRepo(xpath);
|
||||
return iteratorToCategoryList(xpn, includePackages);
|
||||
}
|
||||
|
||||
public static List<Package> Search(string term)
|
||||
{
|
||||
return new List<Package>();
|
||||
}
|
||||
|
||||
//general method for fetching repository specific data...
|
||||
private static XPathNodeIterator queryRepo(string xpath)
|
||||
{
|
||||
return umbraco.library.GetXmlNodeByXPath("descendant-or-self::*[@isDoc and @id = " + _projectsRoot.ToString() + "]" + xpath);
|
||||
}
|
||||
|
||||
private static List<Package> iteratorToPackageList(XPathNodeIterator xni)
|
||||
{
|
||||
List<Package> ps = new List<Package>();
|
||||
|
||||
while (xni.MoveNext())
|
||||
{
|
||||
if (xni.Current is IHasXmlNode)
|
||||
{
|
||||
XmlNode node = ((IHasXmlNode)xni.Current).GetNode();
|
||||
Package p = convertToPackageFromXmlNode(node);
|
||||
|
||||
if (p != null)
|
||||
ps.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
ps.Sort();
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
private static List<Category> iteratorToCategoryList(XPathNodeIterator xni, bool includePackages)
|
||||
{
|
||||
List<Category> ps = new List<Category>();
|
||||
|
||||
while (xni.MoveNext())
|
||||
{
|
||||
if (xni.Current is IHasXmlNode)
|
||||
{
|
||||
XmlNode node = ((IHasXmlNode)xni.Current).GetNode();
|
||||
Category c = convertToCategoryFromXmlNode(node, includePackages);
|
||||
if (c != null)
|
||||
ps.Add(c);
|
||||
}
|
||||
}
|
||||
|
||||
ps.Sort();
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
|
||||
private static Package convertToPackageFromXmlNode(XmlNode node)
|
||||
{
|
||||
return convertToPackageFromNode(new Node(node));
|
||||
}
|
||||
|
||||
private static Package convertToPackageFromNode(Node packageNode)
|
||||
{
|
||||
if (packageNode != null && packageNode.NodeTypeAlias == _projectAlias)
|
||||
{
|
||||
Package retVal = new Package();
|
||||
|
||||
retVal.Text = packageNode.Name;
|
||||
retVal.RepoGuid = new Guid(safeProperty(packageNode,"packageGuid"));
|
||||
retVal.Description = safeProperty(packageNode,"description");
|
||||
retVal.Protected = false;
|
||||
|
||||
retVal.Icon = "";
|
||||
retVal.Thumbnail = safeProperty(packageNode, "defaultScreenshotPath");
|
||||
retVal.Demo = "";
|
||||
|
||||
retVal.IsModule = false;
|
||||
if (safeProperty(packageNode, "isModule") == "1")
|
||||
retVal.IsModule = true;
|
||||
|
||||
if (umbraco.library.NiceUrl(packageNode.Id) != "")
|
||||
{
|
||||
retVal.Url = umbraco.library.NiceUrl(packageNode.Id);
|
||||
retVal.Accepted = true;
|
||||
}
|
||||
|
||||
retVal.HasUpgrade = false;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Category convertToCategoryFromXmlNode(XmlNode node, bool includePackages)
|
||||
{
|
||||
return convertToCategoryFromNode(new Node(node), includePackages);
|
||||
}
|
||||
|
||||
private static Category convertToCategoryFromNode(Node categoryNode, bool includePackages)
|
||||
{
|
||||
if (categoryNode != null && categoryNode.NodeTypeAlias == _projectGroupAlias)
|
||||
{
|
||||
Category retVal = new Category();
|
||||
|
||||
retVal.Text = categoryNode.Name;
|
||||
retVal.Id = categoryNode.Id;
|
||||
retVal.Description = safeProperty(categoryNode,"description");
|
||||
retVal.Url = umbraco.library.NiceUrl(categoryNode.Id);
|
||||
|
||||
if(includePackages){
|
||||
foreach(Node p in categoryNode.Children){
|
||||
Package pack = convertToPackageFromNode(p);
|
||||
if(pack != null)
|
||||
retVal.Packages.Add(pack);
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string safeProperty(umbraco.presentation.nodeFactory.Node n, string alias)
|
||||
{
|
||||
if (n.GetProperty(alias) != null && !string.IsNullOrEmpty(n.GetProperty(alias).Value))
|
||||
return n.GetProperty(alias).Value;
|
||||
else
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
internal static uWiki.Businesslogic.WikiFile PackageFileByGuid(Guid pack)
|
||||
{
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::* [@isDoc and translate(packageGuid,'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = translate('" + pack.ToString() + "','ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
if (xpn.Current is IHasXmlNode)
|
||||
{
|
||||
Node node = new Node(((IHasXmlNode)xpn.Current).GetNode());
|
||||
string fileId = safeProperty(node, "file");
|
||||
int _id;
|
||||
|
||||
if (int.TryParse(fileId, out _id))
|
||||
{
|
||||
string cookieName = "ProjectFileDownload" + fileId;
|
||||
|
||||
//we clear the cookie on the server just to be sure the download is accounted for
|
||||
if (HttpContext.Current.Request.Cookies[cookieName] != null)
|
||||
{
|
||||
HttpCookie myCookie = new HttpCookie(cookieName);
|
||||
myCookie.Expires = DateTime.Now.AddDays(-1d);
|
||||
HttpContext.Current.Response.Cookies.Add(myCookie);
|
||||
}
|
||||
|
||||
uWiki.Businesslogic.WikiFile wf = new uWiki.Businesslogic.WikiFile(_id);
|
||||
wf.UpdateDownloadCounter(true,true);
|
||||
|
||||
return wf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<%@ WebService Language="C#" CodeBehind="repository.asmx.cs" Class="uRepo.webservices.Repository" %>
|
||||
<%@ WebService Language="C#" CodeBehind="repository.asmx.cs" Class="uRepo.webservices.Repository" %>
|
||||
+262
-262
@@ -1,262 +1,262 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.Services.Protocols;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using System.IO;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.BusinessLogic;
|
||||
using System.Xml;
|
||||
|
||||
namespace uRepo.webservices
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Service1
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://packages.umbraco.org/webservices/")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[ToolboxItem(false)]
|
||||
|
||||
public class Repository : System.Web.Services.WebService
|
||||
{
|
||||
private string m_guid;
|
||||
private string m_name;
|
||||
private int m_rootNodeId = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the top level categories for the webservice
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[WebMethod]
|
||||
public List<Category> Categories(string repositoryGuid)
|
||||
{
|
||||
return uRepo.Packages.Categories(false, false);
|
||||
}
|
||||
|
||||
public List<Package> Packages(string repositoryGuid, int categoryId)
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByCategory(categoryId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Package> Modules() {
|
||||
return uRepo.Packages.GetPackagesByProperty("isModule", "1");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Category> ModulesCategorized() {
|
||||
return uRepo.Packages.GetPackagesByPropertyCategorized("isModule", "1");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Package> Nitros()
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByCategory("Nitros");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Category> NitrosCategorized()
|
||||
{
|
||||
return uRepo.Packages.GetSubCategories("Nitros", true);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public string authenticate(string email, string md5Password)
|
||||
{
|
||||
umbraco.cms.businesslogic.member.Member mem = umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(email);
|
||||
|
||||
if (md5(mem.Password) == md5Password)
|
||||
{
|
||||
return mem.UniqueId.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchPackage(string packageGuid)
|
||||
{
|
||||
return uRepo.Packages.PackageFileByGuid(new Guid(packageGuid)).ToByteArray();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchPackageByVersion(string packageGuid, string repoVersion)
|
||||
{
|
||||
//first, translate repo version enum to our.umb version strings
|
||||
//version3 = v31
|
||||
//version4 = v4
|
||||
//version41 = v45
|
||||
//if v45, check if default package is v47 as well, as 4.7 install use v45 when calling the repo (thank god we are moving to nuget)
|
||||
//everything else = v4
|
||||
|
||||
string version = "v4";
|
||||
switch (repoVersion.ToLower())
|
||||
{
|
||||
case "version3":
|
||||
version = "v31";
|
||||
break;
|
||||
case "version4":
|
||||
version = "v4";
|
||||
break;
|
||||
case "version41":
|
||||
version = "v45";
|
||||
break;
|
||||
case "version41legacy":
|
||||
version = "v45l";
|
||||
break;
|
||||
default:
|
||||
version = "v4";
|
||||
break;
|
||||
}
|
||||
|
||||
uWiki.Businesslogic.WikiFile wf = uRepo.Packages.PackageFileByGuid(new Guid(packageGuid));
|
||||
|
||||
|
||||
if(wf != null){
|
||||
|
||||
//if the package doesn't care about the umbraco version needed...
|
||||
if (wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()["nan"]))
|
||||
return wf.ToByteArray();
|
||||
|
||||
//if v45
|
||||
if (wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()["v45"]))
|
||||
{
|
||||
if (wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()["v47"]) || wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()["v45"]))
|
||||
return wf.ToByteArray();
|
||||
else if (!wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()[version]) && !wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()["nan"]))
|
||||
{
|
||||
wf = uWiki.Businesslogic.WikiFile.FindPackageForUmbracoVersion(wf.NodeId, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new byte[0];
|
||||
|
||||
/*
|
||||
if (wf.Version.Version != version && wf.Version.Version != "nan")
|
||||
wf = uWiki.Businesslogic.WikiFile.FindPackageForUmbracoVersion(wf.NodeId, version);
|
||||
|
||||
|
||||
if(wf != null)
|
||||
return wf.ToByteArray();
|
||||
else
|
||||
return new byte[0];*/
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchProtectedPackage(string packageGuid, string memberKey)
|
||||
{
|
||||
|
||||
//Guid package = new Guid(packageGuid);
|
||||
byte[] packageByteArray = new byte[0];
|
||||
|
||||
Package pack = PackageByGuid(packageGuid);
|
||||
umbraco.cms.businesslogic.member.Member mem = new umbraco.cms.businesslogic.member.Member(new Guid(memberKey));
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem packageNode = packageContentItem(packageGuid);
|
||||
|
||||
|
||||
if (pack.Protected && Access.HasAccess(packageNode.Id, packageNode.Path, System.Web.Security.Membership.GetUser(mem.Id)))
|
||||
{
|
||||
|
||||
string FilePath = Server.MapPath(packageNode.getProperty("package").Value.ToString());
|
||||
|
||||
System.IO.FileStream fs1 = null;
|
||||
fs1 = System.IO.File.Open(FilePath, FileMode.Open, FileAccess.Read);
|
||||
|
||||
packageByteArray = new byte[fs1.Length];
|
||||
fs1.Read(packageByteArray, 0, (int)fs1.Length);
|
||||
|
||||
fs1.Close();
|
||||
|
||||
int downloads = 0;
|
||||
string downloadsVal = packageNode.getProperty("downloads").Value.ToString();
|
||||
|
||||
if (downloadsVal != "")
|
||||
downloads = int.Parse(downloadsVal);
|
||||
|
||||
downloads++;
|
||||
|
||||
packageNode.getProperty("downloads").Value = downloads;
|
||||
packageNode.Save();
|
||||
}
|
||||
|
||||
return packageByteArray;
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public SubmitStatus SubmitPackage(string repositoryGuid, string authorGuid, string packageGuid, byte[] packageFile, byte[] packageDoc, byte[] packageThumbnail, string name, string author, string authorUrl, string description)
|
||||
{
|
||||
return uRepo.Packages.SubmitPackageAsProject(authorGuid, packageGuid, packageFile, packageDoc, packageThumbnail, name, description);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public Package PackageByGuid(string packageGuid)
|
||||
{
|
||||
return uRepo.Packages.GetPackageByGuid(new Guid(packageGuid));
|
||||
}
|
||||
|
||||
private static umbraco.cms.businesslogic.contentitem.ContentItem packageContentItem(string guid)
|
||||
{
|
||||
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem item = new umbraco.cms.businesslogic.contentitem.ContentItem(1052);
|
||||
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::node[data [@alias = 'packageGuid'] = '" + guid + "']");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
int id = int.Parse(xpn.Current.GetAttribute("id", "")); ;
|
||||
item = new umbraco.cms.businesslogic.contentitem.ContentItem(id);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static umbraco.cms.businesslogic.contentitem.ContentItem repositoryContentItem(string guid)
|
||||
{
|
||||
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem item = new umbraco.cms.businesslogic.contentitem.ContentItem(1052);
|
||||
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::node[data [@alias = 'repositoryGuid'] = '" + guid + "']");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
|
||||
int id = int.Parse(xpn.Current.GetAttribute("id", "")); ;
|
||||
|
||||
item = new umbraco.cms.businesslogic.contentitem.ContentItem(id);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static string md5(string input)
|
||||
{
|
||||
|
||||
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
||||
byte[] bs = System.Text.Encoding.UTF8.GetBytes(input);
|
||||
|
||||
bs = x.ComputeHash(bs);
|
||||
|
||||
System.Text.StringBuilder s = new System.Text.StringBuilder();
|
||||
|
||||
foreach (byte b in bs)
|
||||
{
|
||||
s.Append(b.ToString("x2").ToLower());
|
||||
}
|
||||
|
||||
return s.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.Services.Protocols;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using System.IO;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.BusinessLogic;
|
||||
using System.Xml;
|
||||
|
||||
namespace uRepo.webservices
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Service1
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://packages.umbraco.org/webservices/")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[ToolboxItem(false)]
|
||||
|
||||
public class Repository : System.Web.Services.WebService
|
||||
{
|
||||
private string m_guid;
|
||||
private string m_name;
|
||||
private int m_rootNodeId = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the top level categories for the webservice
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[WebMethod]
|
||||
public List<Category> Categories(string repositoryGuid)
|
||||
{
|
||||
return uRepo.Packages.Categories(false, false);
|
||||
}
|
||||
|
||||
public List<Package> Packages(string repositoryGuid, int categoryId)
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByCategory(categoryId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Package> Modules() {
|
||||
return uRepo.Packages.GetPackagesByProperty("isModule", "1");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Category> ModulesCategorized() {
|
||||
return uRepo.Packages.GetPackagesByPropertyCategorized("isModule", "1");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Package> Nitros()
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByCategory("Nitros");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Category> NitrosCategorized()
|
||||
{
|
||||
return uRepo.Packages.GetSubCategories("Nitros", true);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public string authenticate(string email, string md5Password)
|
||||
{
|
||||
umbraco.cms.businesslogic.member.Member mem = umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(email);
|
||||
|
||||
if (md5(mem.Password) == md5Password)
|
||||
{
|
||||
return mem.UniqueId.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchPackage(string packageGuid)
|
||||
{
|
||||
return uRepo.Packages.PackageFileByGuid(new Guid(packageGuid)).ToByteArray();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchPackageByVersion(string packageGuid, string repoVersion)
|
||||
{
|
||||
//first, translate repo version enum to our.umb version strings
|
||||
//version3 = v31
|
||||
//version4 = v4
|
||||
//version41 = v45
|
||||
//if v45, check if default package is v47 as well, as 4.7 install use v45 when calling the repo (thank god we are moving to nuget)
|
||||
//everything else = v4
|
||||
|
||||
string version = "v4";
|
||||
switch (repoVersion.ToLower())
|
||||
{
|
||||
case "version3":
|
||||
version = "v31";
|
||||
break;
|
||||
case "version4":
|
||||
version = "v4";
|
||||
break;
|
||||
case "version41":
|
||||
version = "v45";
|
||||
break;
|
||||
case "version41legacy":
|
||||
version = "v45l";
|
||||
break;
|
||||
default:
|
||||
version = "v4";
|
||||
break;
|
||||
}
|
||||
|
||||
uWiki.Businesslogic.WikiFile wf = uRepo.Packages.PackageFileByGuid(new Guid(packageGuid));
|
||||
|
||||
|
||||
if(wf != null){
|
||||
|
||||
//if the package doesn't care about the umbraco version needed...
|
||||
if (wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()["nan"]))
|
||||
return wf.ToByteArray();
|
||||
|
||||
//if v45
|
||||
if (wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()["v45"]))
|
||||
{
|
||||
if (wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()["v47"]) || wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()["v45"]))
|
||||
return wf.ToByteArray();
|
||||
else if (!wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()[version]) && !wf.Versions.Contains(uWiki.Businesslogic.UmbracoVersion.AvailableVersions()["nan"]))
|
||||
{
|
||||
wf = uWiki.Businesslogic.WikiFile.FindPackageForUmbracoVersion(wf.NodeId, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new byte[0];
|
||||
|
||||
/*
|
||||
if (wf.Version.Version != version && wf.Version.Version != "nan")
|
||||
wf = uWiki.Businesslogic.WikiFile.FindPackageForUmbracoVersion(wf.NodeId, version);
|
||||
|
||||
|
||||
if(wf != null)
|
||||
return wf.ToByteArray();
|
||||
else
|
||||
return new byte[0];*/
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchProtectedPackage(string packageGuid, string memberKey)
|
||||
{
|
||||
|
||||
//Guid package = new Guid(packageGuid);
|
||||
byte[] packageByteArray = new byte[0];
|
||||
|
||||
Package pack = PackageByGuid(packageGuid);
|
||||
umbraco.cms.businesslogic.member.Member mem = new umbraco.cms.businesslogic.member.Member(new Guid(memberKey));
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem packageNode = packageContentItem(packageGuid);
|
||||
|
||||
|
||||
if (pack.Protected && Access.HasAccess(packageNode.Id, packageNode.Path, System.Web.Security.Membership.GetUser(mem.Id)))
|
||||
{
|
||||
|
||||
string FilePath = Server.MapPath(packageNode.getProperty("package").Value.ToString());
|
||||
|
||||
System.IO.FileStream fs1 = null;
|
||||
fs1 = System.IO.File.Open(FilePath, FileMode.Open, FileAccess.Read);
|
||||
|
||||
packageByteArray = new byte[fs1.Length];
|
||||
fs1.Read(packageByteArray, 0, (int)fs1.Length);
|
||||
|
||||
fs1.Close();
|
||||
|
||||
int downloads = 0;
|
||||
string downloadsVal = packageNode.getProperty("downloads").Value.ToString();
|
||||
|
||||
if (downloadsVal != "")
|
||||
downloads = int.Parse(downloadsVal);
|
||||
|
||||
downloads++;
|
||||
|
||||
packageNode.getProperty("downloads").Value = downloads;
|
||||
packageNode.Save();
|
||||
}
|
||||
|
||||
return packageByteArray;
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public SubmitStatus SubmitPackage(string repositoryGuid, string authorGuid, string packageGuid, byte[] packageFile, byte[] packageDoc, byte[] packageThumbnail, string name, string author, string authorUrl, string description)
|
||||
{
|
||||
return uRepo.Packages.SubmitPackageAsProject(authorGuid, packageGuid, packageFile, packageDoc, packageThumbnail, name, description);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public Package PackageByGuid(string packageGuid)
|
||||
{
|
||||
return uRepo.Packages.GetPackageByGuid(new Guid(packageGuid));
|
||||
}
|
||||
|
||||
private static umbraco.cms.businesslogic.contentitem.ContentItem packageContentItem(string guid)
|
||||
{
|
||||
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem item = new umbraco.cms.businesslogic.contentitem.ContentItem(1052);
|
||||
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::node[data [@alias = 'packageGuid'] = '" + guid + "']");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
int id = int.Parse(xpn.Current.GetAttribute("id", "")); ;
|
||||
item = new umbraco.cms.businesslogic.contentitem.ContentItem(id);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static umbraco.cms.businesslogic.contentitem.ContentItem repositoryContentItem(string guid)
|
||||
{
|
||||
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem item = new umbraco.cms.businesslogic.contentitem.ContentItem(1052);
|
||||
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::node[data [@alias = 'repositoryGuid'] = '" + guid + "']");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
|
||||
int id = int.Parse(xpn.Current.GetAttribute("id", "")); ;
|
||||
|
||||
item = new umbraco.cms.businesslogic.contentitem.ContentItem(id);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static string md5(string input)
|
||||
{
|
||||
|
||||
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
||||
byte[] bs = System.Text.Encoding.UTF8.GetBytes(input);
|
||||
|
||||
bs = x.ComputeHash(bs);
|
||||
|
||||
System.Text.StringBuilder s = new System.Text.StringBuilder();
|
||||
|
||||
foreach (byte b in bs)
|
||||
{
|
||||
s.Append(b.ToString("x2").ToLower());
|
||||
}
|
||||
|
||||
return s.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+274
-274
@@ -1,274 +1,274 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.Services.Protocols;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using System.IO;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.BusinessLogic;
|
||||
using System.Xml;
|
||||
|
||||
namespace uRepo.webservices
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Service1
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://packages.umbraco.org/webservices/")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[ToolboxItem(false)]
|
||||
|
||||
public class Repository : System.Web.Services.WebService
|
||||
{
|
||||
private string m_guid;
|
||||
private string m_name;
|
||||
private int m_rootNodeId = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the top level categories for the webservice
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[WebMethod]
|
||||
public List<Category> Categories(string repositoryGuid)
|
||||
{
|
||||
return uRepo.Packages.Categories(false, false);
|
||||
}
|
||||
|
||||
public List<Package> Packages(string repositoryGuid, int categoryId)
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByCategory(categoryId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Package> Modules()
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByProperty("isModule", "1");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Category> ModulesCategorized()
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByPropertyCategorized("isModule", "1");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Package> Nitros()
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByCategory("Nitros");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Category> NitrosCategorized()
|
||||
{
|
||||
return uRepo.Packages.GetSubCategories("Nitros", true);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public string authenticate(string email, string md5Password)
|
||||
{
|
||||
umbraco.cms.businesslogic.member.Member mem = umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(email);
|
||||
|
||||
if (md5(mem.Password) == md5Password)
|
||||
{
|
||||
return mem.UniqueId.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchPackage(string packageGuid)
|
||||
{
|
||||
return uRepo.Packages.PackageFileByGuid(new Guid(packageGuid)).ToByteArray();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchPackageByVersion(string packageGuid, string repoVersion)
|
||||
{
|
||||
//first, translate repo version enum to our.umb version strings
|
||||
//version3 = v31
|
||||
//version4 = v4
|
||||
//version41 = v45
|
||||
//if v45, check if default package is v47 as well, as 4.7 install use v45 when calling the repo (thank god we are moving to nuget)
|
||||
//everything else = v4
|
||||
|
||||
string version = "v4";
|
||||
switch (repoVersion.ToLower())
|
||||
{
|
||||
case "version3":
|
||||
version = "v31";
|
||||
break;
|
||||
case "version4":
|
||||
version = "v4";
|
||||
break;
|
||||
case "version41":
|
||||
version = "v45";
|
||||
break;
|
||||
case "version41legacy":
|
||||
version = "v45l";
|
||||
break;
|
||||
default:
|
||||
version = "v4";
|
||||
break;
|
||||
}
|
||||
|
||||
uWiki.Businesslogic.WikiFile wf = uRepo.Packages.PackageFileByGuid(new Guid(packageGuid));
|
||||
|
||||
|
||||
if (wf != null)
|
||||
{
|
||||
|
||||
|
||||
//if the package doesn't care about the umbraco version needed...
|
||||
if (wf.Version.Version == "nan")
|
||||
return wf.ToByteArray();
|
||||
|
||||
|
||||
//if v45
|
||||
if (version == "v45")
|
||||
{
|
||||
int v = 0;
|
||||
if (int.TryParse(wf.Version.Version.Replace("v", ""), out v))
|
||||
if (v >= 45)
|
||||
return wf.ToByteArray();
|
||||
|
||||
|
||||
if (wf.Version.Version == "v47" || wf.Version.Version == "v45")
|
||||
return wf.ToByteArray();
|
||||
else if (wf.Version.Version != version && wf.Version.Version != "nan")
|
||||
{
|
||||
wf = uWiki.Businesslogic.WikiFile.FindPackageForUmbracoVersion(wf.NodeId, version);
|
||||
return wf.ToByteArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new byte[0];
|
||||
|
||||
/*
|
||||
if (wf.Version.Version != version && wf.Version.Version != "nan")
|
||||
wf = uWiki.Businesslogic.WikiFile.FindPackageForUmbracoVersion(wf.NodeId, version);
|
||||
|
||||
|
||||
if(wf != null)
|
||||
return wf.ToByteArray();
|
||||
else
|
||||
return new byte[0];*/
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchProtectedPackage(string packageGuid, string memberKey)
|
||||
{
|
||||
|
||||
//Guid package = new Guid(packageGuid);
|
||||
byte[] packageByteArray = new byte[0];
|
||||
|
||||
Package pack = PackageByGuid(packageGuid);
|
||||
umbraco.cms.businesslogic.member.Member mem = new umbraco.cms.businesslogic.member.Member(new Guid(memberKey));
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem packageNode = packageContentItem(packageGuid);
|
||||
|
||||
|
||||
if (pack.Protected && Access.HasAccess(packageNode.Id, packageNode.Path, System.Web.Security.Membership.GetUser(mem.Id)))
|
||||
{
|
||||
|
||||
string FilePath = Server.MapPath(packageNode.getProperty("package").Value.ToString());
|
||||
|
||||
System.IO.FileStream fs1 = null;
|
||||
fs1 = System.IO.File.Open(FilePath, FileMode.Open, FileAccess.Read);
|
||||
|
||||
packageByteArray = new byte[fs1.Length];
|
||||
fs1.Read(packageByteArray, 0, (int)fs1.Length);
|
||||
|
||||
fs1.Close();
|
||||
|
||||
int downloads = 0;
|
||||
string downloadsVal = packageNode.getProperty("downloads").Value.ToString();
|
||||
|
||||
if (downloadsVal != "")
|
||||
downloads = int.Parse(downloadsVal);
|
||||
|
||||
downloads++;
|
||||
|
||||
packageNode.getProperty("downloads").Value = downloads;
|
||||
packageNode.Save();
|
||||
}
|
||||
|
||||
return packageByteArray;
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public SubmitStatus SubmitPackage(string repositoryGuid, string authorGuid, string packageGuid, byte[] packageFile, byte[] packageDoc, byte[] packageThumbnail, string name, string author, string authorUrl, string description)
|
||||
{
|
||||
return uRepo.Packages.SubmitPackageAsProject(authorGuid, packageGuid, packageFile, packageDoc, packageThumbnail, name, description);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public Package PackageByGuid(string packageGuid)
|
||||
{
|
||||
return uRepo.Packages.GetPackageByGuid(new Guid(packageGuid));
|
||||
}
|
||||
|
||||
private static umbraco.cms.businesslogic.contentitem.ContentItem packageContentItem(string guid)
|
||||
{
|
||||
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem item = new umbraco.cms.businesslogic.contentitem.ContentItem(1052);
|
||||
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::node[data [@alias = 'packageGuid'] = '" + guid + "']");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
int id = int.Parse(xpn.Current.GetAttribute("id", "")); ;
|
||||
item = new umbraco.cms.businesslogic.contentitem.ContentItem(id);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static umbraco.cms.businesslogic.contentitem.ContentItem repositoryContentItem(string guid)
|
||||
{
|
||||
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem item = new umbraco.cms.businesslogic.contentitem.ContentItem(1052);
|
||||
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::node[data [@alias = 'repositoryGuid'] = '" + guid + "']");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
|
||||
int id = int.Parse(xpn.Current.GetAttribute("id", "")); ;
|
||||
|
||||
item = new umbraco.cms.businesslogic.contentitem.ContentItem(id);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static string md5(string input)
|
||||
{
|
||||
|
||||
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
||||
byte[] bs = System.Text.Encoding.UTF8.GetBytes(input);
|
||||
|
||||
bs = x.ComputeHash(bs);
|
||||
|
||||
System.Text.StringBuilder s = new System.Text.StringBuilder();
|
||||
|
||||
foreach (byte b in bs)
|
||||
{
|
||||
s.Append(b.ToString("x2").ToLower());
|
||||
}
|
||||
|
||||
return s.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Services;
|
||||
using System.Web.Services.Protocols;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using System.IO;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.BusinessLogic;
|
||||
using System.Xml;
|
||||
|
||||
namespace uRepo.webservices
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for Service1
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://packages.umbraco.org/webservices/")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[ToolboxItem(false)]
|
||||
|
||||
public class Repository : System.Web.Services.WebService
|
||||
{
|
||||
private string m_guid;
|
||||
private string m_name;
|
||||
private int m_rootNodeId = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the top level categories for the webservice
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[WebMethod]
|
||||
public List<Category> Categories(string repositoryGuid)
|
||||
{
|
||||
return uRepo.Packages.Categories(false, false);
|
||||
}
|
||||
|
||||
public List<Package> Packages(string repositoryGuid, int categoryId)
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByCategory(categoryId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Package> Modules()
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByProperty("isModule", "1");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Category> ModulesCategorized()
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByPropertyCategorized("isModule", "1");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Package> Nitros()
|
||||
{
|
||||
return uRepo.Packages.GetPackagesByCategory("Nitros");
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<Category> NitrosCategorized()
|
||||
{
|
||||
return uRepo.Packages.GetSubCategories("Nitros", true);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public string authenticate(string email, string md5Password)
|
||||
{
|
||||
umbraco.cms.businesslogic.member.Member mem = umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(email);
|
||||
|
||||
if (md5(mem.Password) == md5Password)
|
||||
{
|
||||
return mem.UniqueId.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchPackage(string packageGuid)
|
||||
{
|
||||
return uRepo.Packages.PackageFileByGuid(new Guid(packageGuid)).ToByteArray();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchPackageByVersion(string packageGuid, string repoVersion)
|
||||
{
|
||||
//first, translate repo version enum to our.umb version strings
|
||||
//version3 = v31
|
||||
//version4 = v4
|
||||
//version41 = v45
|
||||
//if v45, check if default package is v47 as well, as 4.7 install use v45 when calling the repo (thank god we are moving to nuget)
|
||||
//everything else = v4
|
||||
|
||||
string version = "v4";
|
||||
switch (repoVersion.ToLower())
|
||||
{
|
||||
case "version3":
|
||||
version = "v31";
|
||||
break;
|
||||
case "version4":
|
||||
version = "v4";
|
||||
break;
|
||||
case "version41":
|
||||
version = "v45";
|
||||
break;
|
||||
case "version41legacy":
|
||||
version = "v45l";
|
||||
break;
|
||||
default:
|
||||
version = "v4";
|
||||
break;
|
||||
}
|
||||
|
||||
uWiki.Businesslogic.WikiFile wf = uRepo.Packages.PackageFileByGuid(new Guid(packageGuid));
|
||||
|
||||
|
||||
if (wf != null)
|
||||
{
|
||||
|
||||
|
||||
//if the package doesn't care about the umbraco version needed...
|
||||
if (wf.Version.Version == "nan")
|
||||
return wf.ToByteArray();
|
||||
|
||||
|
||||
//if v45
|
||||
if (version == "v45")
|
||||
{
|
||||
int v = 0;
|
||||
if (int.TryParse(wf.Version.Version.Replace("v", ""), out v))
|
||||
if (v >= 45)
|
||||
return wf.ToByteArray();
|
||||
|
||||
|
||||
if (wf.Version.Version == "v47" || wf.Version.Version == "v45")
|
||||
return wf.ToByteArray();
|
||||
else if (wf.Version.Version != version && wf.Version.Version != "nan")
|
||||
{
|
||||
wf = uWiki.Businesslogic.WikiFile.FindPackageForUmbracoVersion(wf.NodeId, version);
|
||||
return wf.ToByteArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new byte[0];
|
||||
|
||||
/*
|
||||
if (wf.Version.Version != version && wf.Version.Version != "nan")
|
||||
wf = uWiki.Businesslogic.WikiFile.FindPackageForUmbracoVersion(wf.NodeId, version);
|
||||
|
||||
|
||||
if(wf != null)
|
||||
return wf.ToByteArray();
|
||||
else
|
||||
return new byte[0];*/
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public byte[] fetchProtectedPackage(string packageGuid, string memberKey)
|
||||
{
|
||||
|
||||
//Guid package = new Guid(packageGuid);
|
||||
byte[] packageByteArray = new byte[0];
|
||||
|
||||
Package pack = PackageByGuid(packageGuid);
|
||||
umbraco.cms.businesslogic.member.Member mem = new umbraco.cms.businesslogic.member.Member(new Guid(memberKey));
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem packageNode = packageContentItem(packageGuid);
|
||||
|
||||
|
||||
if (pack.Protected && Access.HasAccess(packageNode.Id, packageNode.Path, System.Web.Security.Membership.GetUser(mem.Id)))
|
||||
{
|
||||
|
||||
string FilePath = Server.MapPath(packageNode.getProperty("package").Value.ToString());
|
||||
|
||||
System.IO.FileStream fs1 = null;
|
||||
fs1 = System.IO.File.Open(FilePath, FileMode.Open, FileAccess.Read);
|
||||
|
||||
packageByteArray = new byte[fs1.Length];
|
||||
fs1.Read(packageByteArray, 0, (int)fs1.Length);
|
||||
|
||||
fs1.Close();
|
||||
|
||||
int downloads = 0;
|
||||
string downloadsVal = packageNode.getProperty("downloads").Value.ToString();
|
||||
|
||||
if (downloadsVal != "")
|
||||
downloads = int.Parse(downloadsVal);
|
||||
|
||||
downloads++;
|
||||
|
||||
packageNode.getProperty("downloads").Value = downloads;
|
||||
packageNode.Save();
|
||||
}
|
||||
|
||||
return packageByteArray;
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public SubmitStatus SubmitPackage(string repositoryGuid, string authorGuid, string packageGuid, byte[] packageFile, byte[] packageDoc, byte[] packageThumbnail, string name, string author, string authorUrl, string description)
|
||||
{
|
||||
return uRepo.Packages.SubmitPackageAsProject(authorGuid, packageGuid, packageFile, packageDoc, packageThumbnail, name, description);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public Package PackageByGuid(string packageGuid)
|
||||
{
|
||||
return uRepo.Packages.GetPackageByGuid(new Guid(packageGuid));
|
||||
}
|
||||
|
||||
private static umbraco.cms.businesslogic.contentitem.ContentItem packageContentItem(string guid)
|
||||
{
|
||||
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem item = new umbraco.cms.businesslogic.contentitem.ContentItem(1052);
|
||||
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::node[data [@alias = 'packageGuid'] = '" + guid + "']");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
int id = int.Parse(xpn.Current.GetAttribute("id", "")); ;
|
||||
item = new umbraco.cms.businesslogic.contentitem.ContentItem(id);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static umbraco.cms.businesslogic.contentitem.ContentItem repositoryContentItem(string guid)
|
||||
{
|
||||
|
||||
umbraco.cms.businesslogic.contentitem.ContentItem item = new umbraco.cms.businesslogic.contentitem.ContentItem(1052);
|
||||
|
||||
XPathNodeIterator xpn = umbraco.library.GetXmlNodeByXPath("descendant::node[data [@alias = 'repositoryGuid'] = '" + guid + "']");
|
||||
|
||||
if (xpn.MoveNext())
|
||||
{
|
||||
|
||||
int id = int.Parse(xpn.Current.GetAttribute("id", "")); ;
|
||||
|
||||
item = new umbraco.cms.businesslogic.contentitem.ContentItem(id);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static string md5(string input)
|
||||
{
|
||||
|
||||
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
|
||||
byte[] bs = System.Text.Encoding.UTF8.GetBytes(input);
|
||||
|
||||
bs = x.ComputeHash(bs);
|
||||
|
||||
System.Text.StringBuilder s = new System.Text.StringBuilder();
|
||||
|
||||
foreach (byte b in bs)
|
||||
{
|
||||
s.Append(b.ToString("x2").ToLower());
|
||||
}
|
||||
|
||||
return s.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,434 +1,434 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using umbraco.DataLayer;
|
||||
using System.Data;
|
||||
using System.Xml;
|
||||
using System.Data.SqlClient;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace uWiki.Businesslogic {
|
||||
public class Data {
|
||||
|
||||
private static string _ConnString = umbraco.GlobalSettings.DbDSN;
|
||||
private static ISqlHelper _sqlHelper;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SQL helper.
|
||||
/// </summary>
|
||||
/// <value>The SQL helper.</value>
|
||||
public static ISqlHelper SqlHelper
|
||||
{
|
||||
get { return _sqlHelper ?? (_sqlHelper = DataLayerHelper.CreateSqlHelper(_ConnString)); }
|
||||
}
|
||||
|
||||
|
||||
public static XmlNode GetDataSetAsNode(string sql, string elementName) {
|
||||
try {
|
||||
DataSet ds = getDataSetFromSql(_ConnString, sql, elementName);
|
||||
XmlDataDocument dataDoc = new XmlDataDocument(ds);
|
||||
return (XmlNode)dataDoc;
|
||||
} catch (Exception e) {
|
||||
// If there's an exception we'll output an error element instead
|
||||
XmlDocument errorDoc = new XmlDocument();
|
||||
return umbraco.xmlHelper.addTextNode(errorDoc, "error", System.Web.HttpUtility.HtmlEncode(e.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
public static XPathNodeIterator GetDataSet(string sql, string elementName) {
|
||||
return GetDataSetAsNode(sql, elementName).CreateNavigator().Select(".");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the dataset from SQL using ADO.NET.
|
||||
/// </summary>
|
||||
/// <param name="connection">The connection.</param>
|
||||
/// <param name="sql">The SQL.</param>
|
||||
/// <param name="setName">Name of the set.</param>
|
||||
/// <returns></returns>
|
||||
private static DataSet getDataSetFromSql(string connection, string sql, string tableName) {
|
||||
SqlConnection con = new SqlConnection(connection);
|
||||
SqlCommand cmd = new SqlCommand(sql, con);
|
||||
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
|
||||
DataSet ds = new DataSet(Pluralizer.ToPlural(tableName));
|
||||
try {
|
||||
con.Open();
|
||||
adapter.Fill(ds, tableName);
|
||||
} finally {
|
||||
con.Close();
|
||||
}
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* **********************************************************************************
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
*
|
||||
* This source code is subject to terms and conditions of the Microsoft Permissive
|
||||
* License (MS-PL). A copy of the license can be found in the license.htm file
|
||||
* included in this distribution.
|
||||
*
|
||||
* You must not remove this notice, or any other, from this software.
|
||||
*
|
||||
* **********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static class Pluralizer {
|
||||
#region public APIs
|
||||
|
||||
public static string ToPlural(string noun) {
|
||||
return AdjustCase(ToPluralInternal(noun), noun);
|
||||
}
|
||||
|
||||
public static string ToSingular(string noun) {
|
||||
return AdjustCase(ToSingularInternal(noun), noun);
|
||||
}
|
||||
|
||||
public static bool IsNounPluralOfNoun(string plural, string singular) {
|
||||
return String.Compare(ToSingularInternal(plural), singular, StringComparison.OrdinalIgnoreCase) == 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Special Words Table
|
||||
|
||||
static string[] _specialWordsStringTable = new string[] {
|
||||
"agendum", "agenda", "",
|
||||
"albino", "albinos", "",
|
||||
"alga", "algae", "",
|
||||
"alumna", "alumnae", "",
|
||||
"apex", "apices", "apexes",
|
||||
"archipelago", "archipelagos", "",
|
||||
"bacterium", "bacteria", "",
|
||||
"beef", "beefs", "beeves",
|
||||
"bison", "", "",
|
||||
"brother", "brothers", "brethren",
|
||||
"candelabrum", "candelabra", "",
|
||||
"carp", "", "",
|
||||
"casino", "casinos", "",
|
||||
"child", "children", "",
|
||||
"chassis", "", "",
|
||||
"chinese", "", "",
|
||||
"clippers", "", "",
|
||||
"cod", "", "",
|
||||
"codex", "codices", "",
|
||||
"commando", "commandos", "",
|
||||
"corps", "", "",
|
||||
"cortex", "cortices", "cortexes",
|
||||
"cow", "cows", "kine",
|
||||
"criterion", "criteria", "",
|
||||
"datum", "data", "",
|
||||
"debris", "", "",
|
||||
"diabetes", "", "",
|
||||
"ditto", "dittos", "",
|
||||
"djinn", "", "",
|
||||
"dynamo", "", "",
|
||||
"elk", "", "",
|
||||
"embryo", "embryos", "",
|
||||
"ephemeris", "ephemeris", "ephemerides",
|
||||
"erratum", "errata", "",
|
||||
"extremum", "extrema", "",
|
||||
"fiasco", "fiascos", "",
|
||||
"fish", "fishes", "fish",
|
||||
"flounder", "", "",
|
||||
"focus", "focuses", "foci",
|
||||
"fungus", "fungi", "funguses",
|
||||
"gallows", "", "",
|
||||
"genie", "genies", "genii",
|
||||
"ghetto", "ghettos", "",
|
||||
"graffiti", "", "",
|
||||
"headquarters", "", "",
|
||||
"herpes", "", "",
|
||||
"homework", "", "",
|
||||
"index", "indices", "indexes",
|
||||
"inferno", "infernos", "",
|
||||
"japanese", "", "",
|
||||
"jumbo", "jumbos", "",
|
||||
"latex", "latices", "latexes",
|
||||
"lingo", "lingos", "",
|
||||
"mackerel", "", "",
|
||||
"macro", "macros", "",
|
||||
"manifesto", "manifestos", "",
|
||||
"measles", "", "",
|
||||
"money", "moneys", "monies",
|
||||
"mongoose", "mongooses", "mongoose",
|
||||
"mumps", "", "",
|
||||
"murex", "murecis", "",
|
||||
"mythos", "mythos", "mythoi",
|
||||
"news", "", "",
|
||||
"octopus", "octopuses", "octopodes",
|
||||
"ovum", "ova", "",
|
||||
"ox", "ox", "oxen",
|
||||
"photo", "photos", "",
|
||||
"pincers", "", "",
|
||||
"pliers", "", "",
|
||||
"pro", "pros", "",
|
||||
"rabies", "", "",
|
||||
"radius", "radiuses", "radii",
|
||||
"rhino", "rhinos", "",
|
||||
"salmon", "", "",
|
||||
"scissors", "", "",
|
||||
"series", "", "",
|
||||
"shears", "", "",
|
||||
"silex", "silices", "",
|
||||
"simplex", "simplices", "simplexes",
|
||||
"soliloquy", "soliloquies", "soliloquy",
|
||||
"species", "", "",
|
||||
"stratum", "strata", "",
|
||||
"swine", "", "",
|
||||
"trout", "", "",
|
||||
"tuna", "", "",
|
||||
"vertebra", "vertebrae", "",
|
||||
"vertex", "vertices", "vertexes",
|
||||
"vortex", "vortices", "vortexes",
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Suffix Rules Table
|
||||
|
||||
static string[] _suffixRulesStringTable = new string[] {
|
||||
"ch", "ches",
|
||||
"sh", "shes",
|
||||
"ss", "sses",
|
||||
|
||||
"ay", "ays",
|
||||
"ey", "eys",
|
||||
"iy", "iys",
|
||||
"oy", "oys",
|
||||
"uy", "uys",
|
||||
"y", "ies",
|
||||
|
||||
"ao", "aos",
|
||||
"eo", "eos",
|
||||
"io", "ios",
|
||||
"oo", "oos",
|
||||
"uo", "uos",
|
||||
"o", "oes",
|
||||
|
||||
"cis", "ces",
|
||||
"sis", "ses",
|
||||
"xis", "xes",
|
||||
|
||||
"louse", "lice",
|
||||
"mouse", "mice",
|
||||
|
||||
"zoon", "zoa",
|
||||
|
||||
"man", "men",
|
||||
|
||||
"deer", "deer",
|
||||
"fish", "fish",
|
||||
"sheep", "sheep",
|
||||
"itis", "itis",
|
||||
"ois", "ois",
|
||||
"pox", "pox",
|
||||
"ox", "oxes",
|
||||
|
||||
"foot", "feet",
|
||||
"goose", "geese",
|
||||
"tooth", "teeth",
|
||||
|
||||
"alf", "alves",
|
||||
"elf", "elves",
|
||||
"olf", "olves",
|
||||
"arf", "arves",
|
||||
"leaf", "leaves",
|
||||
"nife", "nives",
|
||||
"life", "lives",
|
||||
"wife", "wives",
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation Details
|
||||
|
||||
class Word {
|
||||
public readonly string Singular;
|
||||
public readonly string Plural;
|
||||
public readonly string Plural2;
|
||||
|
||||
public Word(string singular, string plural, string plural2) {
|
||||
Singular = singular;
|
||||
Plural = plural;
|
||||
Plural2 = plural2;
|
||||
}
|
||||
}
|
||||
|
||||
class SuffixRule {
|
||||
string _singularSuffix;
|
||||
string _pluralSuffix;
|
||||
|
||||
public SuffixRule(string singular, string plural) {
|
||||
_singularSuffix = singular;
|
||||
_pluralSuffix = plural;
|
||||
}
|
||||
|
||||
public bool TryToPlural(string word, out string plural) {
|
||||
if (word.EndsWith(_singularSuffix, StringComparison.OrdinalIgnoreCase)) {
|
||||
plural = word.Substring(0, word.Length - _singularSuffix.Length) + _pluralSuffix;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
plural = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryToSingular(string word, out string singular) {
|
||||
if (word.EndsWith(_pluralSuffix, StringComparison.OrdinalIgnoreCase)) {
|
||||
singular = word.Substring(0, word.Length - _pluralSuffix.Length) + _singularSuffix;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
singular = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Dictionary<string, Word> _specialSingulars;
|
||||
static Dictionary<string, Word> _specialPlurals;
|
||||
static List<SuffixRule> _suffixRules;
|
||||
|
||||
static Pluralizer() {
|
||||
// populate lookup tables for special words
|
||||
_specialSingulars = new Dictionary<string, Word>(StringComparer.OrdinalIgnoreCase);
|
||||
_specialPlurals = new Dictionary<string, Word>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
for (int i = 0; i < _specialWordsStringTable.Length; i += 3) {
|
||||
string s = _specialWordsStringTable[i];
|
||||
string p = _specialWordsStringTable[i + 1];
|
||||
string p2 = _specialWordsStringTable[i + 2];
|
||||
|
||||
if (string.IsNullOrEmpty(p)) {
|
||||
p = s;
|
||||
}
|
||||
|
||||
Word w = new Word(s, p, p2);
|
||||
|
||||
_specialSingulars.Add(s, w);
|
||||
_specialPlurals.Add(p, w);
|
||||
|
||||
if (!string.IsNullOrEmpty(p2)) {
|
||||
_specialPlurals.Add(p2, w);
|
||||
}
|
||||
}
|
||||
|
||||
// populate suffix rules list
|
||||
_suffixRules = new List<SuffixRule>();
|
||||
|
||||
for (int i = 0; i < _suffixRulesStringTable.Length; i += 2) {
|
||||
string singular = _suffixRulesStringTable[i];
|
||||
string plural = _suffixRulesStringTable[i + 1];
|
||||
_suffixRules.Add(new SuffixRule(singular, plural));
|
||||
}
|
||||
}
|
||||
|
||||
static string ToPluralInternal(string s) {
|
||||
if (string.IsNullOrEmpty(s)) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// lookup special words
|
||||
Word word;
|
||||
|
||||
if (_specialSingulars.TryGetValue(s, out word)) {
|
||||
return word.Plural;
|
||||
}
|
||||
|
||||
// apply suffix rules
|
||||
string plural;
|
||||
|
||||
foreach (SuffixRule rule in _suffixRules) {
|
||||
if (rule.TryToPlural(s, out plural)) {
|
||||
return plural;
|
||||
}
|
||||
}
|
||||
|
||||
// apply the default rule
|
||||
return s + "s";
|
||||
}
|
||||
|
||||
static string ToSingularInternal(string s) {
|
||||
if (string.IsNullOrEmpty(s)) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// lookup special words
|
||||
Word word;
|
||||
|
||||
if (_specialPlurals.TryGetValue(s, out word)) {
|
||||
return word.Singular;
|
||||
}
|
||||
|
||||
// apply suffix rules
|
||||
string singular;
|
||||
|
||||
foreach (SuffixRule rule in _suffixRules) {
|
||||
if (rule.TryToSingular(s, out singular)) {
|
||||
return singular;
|
||||
}
|
||||
}
|
||||
|
||||
// apply the default rule
|
||||
if (s.EndsWith("s", StringComparison.OrdinalIgnoreCase)) {
|
||||
return s.Substring(0, s.Length-1);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static string AdjustCase(string s, string template) {
|
||||
if (string.IsNullOrEmpty(s)) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// determine the type of casing of the template string
|
||||
bool foundUpperOrLower = false;
|
||||
bool allLower = true;
|
||||
bool allUpper = true;
|
||||
bool firstUpper = false;
|
||||
|
||||
for (int i = 0; i < template.Length; i++) {
|
||||
if (Char.IsUpper(template[i])) {
|
||||
if (i == 0) firstUpper = true;
|
||||
allLower = false;
|
||||
foundUpperOrLower = true;
|
||||
}
|
||||
else if (Char.IsLower(template[i])) {
|
||||
allUpper = false;
|
||||
foundUpperOrLower = true;
|
||||
}
|
||||
}
|
||||
|
||||
// change the case according to template
|
||||
if (foundUpperOrLower) {
|
||||
if (allLower) {
|
||||
s = s.ToLowerInvariant();
|
||||
}
|
||||
else if (allUpper) {
|
||||
s = s.ToUpperInvariant();
|
||||
}
|
||||
else if (firstUpper) {
|
||||
if (!Char.IsUpper(s[0])) {
|
||||
s = s.Substring(0, 1).ToUpperInvariant() + s.Substring(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using umbraco.DataLayer;
|
||||
using System.Data;
|
||||
using System.Xml;
|
||||
using System.Data.SqlClient;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace uWiki.Businesslogic {
|
||||
public class Data {
|
||||
|
||||
private static string _ConnString = umbraco.GlobalSettings.DbDSN;
|
||||
private static ISqlHelper _sqlHelper;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SQL helper.
|
||||
/// </summary>
|
||||
/// <value>The SQL helper.</value>
|
||||
public static ISqlHelper SqlHelper
|
||||
{
|
||||
get { return _sqlHelper ?? (_sqlHelper = DataLayerHelper.CreateSqlHelper(_ConnString)); }
|
||||
}
|
||||
|
||||
|
||||
public static XmlNode GetDataSetAsNode(string sql, string elementName) {
|
||||
try {
|
||||
DataSet ds = getDataSetFromSql(_ConnString, sql, elementName);
|
||||
XmlDataDocument dataDoc = new XmlDataDocument(ds);
|
||||
return (XmlNode)dataDoc;
|
||||
} catch (Exception e) {
|
||||
// If there's an exception we'll output an error element instead
|
||||
XmlDocument errorDoc = new XmlDocument();
|
||||
return umbraco.xmlHelper.addTextNode(errorDoc, "error", System.Web.HttpUtility.HtmlEncode(e.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
public static XPathNodeIterator GetDataSet(string sql, string elementName) {
|
||||
return GetDataSetAsNode(sql, elementName).CreateNavigator().Select(".");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the dataset from SQL using ADO.NET.
|
||||
/// </summary>
|
||||
/// <param name="connection">The connection.</param>
|
||||
/// <param name="sql">The SQL.</param>
|
||||
/// <param name="setName">Name of the set.</param>
|
||||
/// <returns></returns>
|
||||
private static DataSet getDataSetFromSql(string connection, string sql, string tableName) {
|
||||
SqlConnection con = new SqlConnection(connection);
|
||||
SqlCommand cmd = new SqlCommand(sql, con);
|
||||
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
|
||||
DataSet ds = new DataSet(Pluralizer.ToPlural(tableName));
|
||||
try {
|
||||
con.Open();
|
||||
adapter.Fill(ds, tableName);
|
||||
} finally {
|
||||
con.Close();
|
||||
}
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* **********************************************************************************
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
*
|
||||
* This source code is subject to terms and conditions of the Microsoft Permissive
|
||||
* License (MS-PL). A copy of the license can be found in the license.htm file
|
||||
* included in this distribution.
|
||||
*
|
||||
* You must not remove this notice, or any other, from this software.
|
||||
*
|
||||
* **********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static class Pluralizer {
|
||||
#region public APIs
|
||||
|
||||
public static string ToPlural(string noun) {
|
||||
return AdjustCase(ToPluralInternal(noun), noun);
|
||||
}
|
||||
|
||||
public static string ToSingular(string noun) {
|
||||
return AdjustCase(ToSingularInternal(noun), noun);
|
||||
}
|
||||
|
||||
public static bool IsNounPluralOfNoun(string plural, string singular) {
|
||||
return String.Compare(ToSingularInternal(plural), singular, StringComparison.OrdinalIgnoreCase) == 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Special Words Table
|
||||
|
||||
static string[] _specialWordsStringTable = new string[] {
|
||||
"agendum", "agenda", "",
|
||||
"albino", "albinos", "",
|
||||
"alga", "algae", "",
|
||||
"alumna", "alumnae", "",
|
||||
"apex", "apices", "apexes",
|
||||
"archipelago", "archipelagos", "",
|
||||
"bacterium", "bacteria", "",
|
||||
"beef", "beefs", "beeves",
|
||||
"bison", "", "",
|
||||
"brother", "brothers", "brethren",
|
||||
"candelabrum", "candelabra", "",
|
||||
"carp", "", "",
|
||||
"casino", "casinos", "",
|
||||
"child", "children", "",
|
||||
"chassis", "", "",
|
||||
"chinese", "", "",
|
||||
"clippers", "", "",
|
||||
"cod", "", "",
|
||||
"codex", "codices", "",
|
||||
"commando", "commandos", "",
|
||||
"corps", "", "",
|
||||
"cortex", "cortices", "cortexes",
|
||||
"cow", "cows", "kine",
|
||||
"criterion", "criteria", "",
|
||||
"datum", "data", "",
|
||||
"debris", "", "",
|
||||
"diabetes", "", "",
|
||||
"ditto", "dittos", "",
|
||||
"djinn", "", "",
|
||||
"dynamo", "", "",
|
||||
"elk", "", "",
|
||||
"embryo", "embryos", "",
|
||||
"ephemeris", "ephemeris", "ephemerides",
|
||||
"erratum", "errata", "",
|
||||
"extremum", "extrema", "",
|
||||
"fiasco", "fiascos", "",
|
||||
"fish", "fishes", "fish",
|
||||
"flounder", "", "",
|
||||
"focus", "focuses", "foci",
|
||||
"fungus", "fungi", "funguses",
|
||||
"gallows", "", "",
|
||||
"genie", "genies", "genii",
|
||||
"ghetto", "ghettos", "",
|
||||
"graffiti", "", "",
|
||||
"headquarters", "", "",
|
||||
"herpes", "", "",
|
||||
"homework", "", "",
|
||||
"index", "indices", "indexes",
|
||||
"inferno", "infernos", "",
|
||||
"japanese", "", "",
|
||||
"jumbo", "jumbos", "",
|
||||
"latex", "latices", "latexes",
|
||||
"lingo", "lingos", "",
|
||||
"mackerel", "", "",
|
||||
"macro", "macros", "",
|
||||
"manifesto", "manifestos", "",
|
||||
"measles", "", "",
|
||||
"money", "moneys", "monies",
|
||||
"mongoose", "mongooses", "mongoose",
|
||||
"mumps", "", "",
|
||||
"murex", "murecis", "",
|
||||
"mythos", "mythos", "mythoi",
|
||||
"news", "", "",
|
||||
"octopus", "octopuses", "octopodes",
|
||||
"ovum", "ova", "",
|
||||
"ox", "ox", "oxen",
|
||||
"photo", "photos", "",
|
||||
"pincers", "", "",
|
||||
"pliers", "", "",
|
||||
"pro", "pros", "",
|
||||
"rabies", "", "",
|
||||
"radius", "radiuses", "radii",
|
||||
"rhino", "rhinos", "",
|
||||
"salmon", "", "",
|
||||
"scissors", "", "",
|
||||
"series", "", "",
|
||||
"shears", "", "",
|
||||
"silex", "silices", "",
|
||||
"simplex", "simplices", "simplexes",
|
||||
"soliloquy", "soliloquies", "soliloquy",
|
||||
"species", "", "",
|
||||
"stratum", "strata", "",
|
||||
"swine", "", "",
|
||||
"trout", "", "",
|
||||
"tuna", "", "",
|
||||
"vertebra", "vertebrae", "",
|
||||
"vertex", "vertices", "vertexes",
|
||||
"vortex", "vortices", "vortexes",
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Suffix Rules Table
|
||||
|
||||
static string[] _suffixRulesStringTable = new string[] {
|
||||
"ch", "ches",
|
||||
"sh", "shes",
|
||||
"ss", "sses",
|
||||
|
||||
"ay", "ays",
|
||||
"ey", "eys",
|
||||
"iy", "iys",
|
||||
"oy", "oys",
|
||||
"uy", "uys",
|
||||
"y", "ies",
|
||||
|
||||
"ao", "aos",
|
||||
"eo", "eos",
|
||||
"io", "ios",
|
||||
"oo", "oos",
|
||||
"uo", "uos",
|
||||
"o", "oes",
|
||||
|
||||
"cis", "ces",
|
||||
"sis", "ses",
|
||||
"xis", "xes",
|
||||
|
||||
"louse", "lice",
|
||||
"mouse", "mice",
|
||||
|
||||
"zoon", "zoa",
|
||||
|
||||
"man", "men",
|
||||
|
||||
"deer", "deer",
|
||||
"fish", "fish",
|
||||
"sheep", "sheep",
|
||||
"itis", "itis",
|
||||
"ois", "ois",
|
||||
"pox", "pox",
|
||||
"ox", "oxes",
|
||||
|
||||
"foot", "feet",
|
||||
"goose", "geese",
|
||||
"tooth", "teeth",
|
||||
|
||||
"alf", "alves",
|
||||
"elf", "elves",
|
||||
"olf", "olves",
|
||||
"arf", "arves",
|
||||
"leaf", "leaves",
|
||||
"nife", "nives",
|
||||
"life", "lives",
|
||||
"wife", "wives",
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation Details
|
||||
|
||||
class Word {
|
||||
public readonly string Singular;
|
||||
public readonly string Plural;
|
||||
public readonly string Plural2;
|
||||
|
||||
public Word(string singular, string plural, string plural2) {
|
||||
Singular = singular;
|
||||
Plural = plural;
|
||||
Plural2 = plural2;
|
||||
}
|
||||
}
|
||||
|
||||
class SuffixRule {
|
||||
string _singularSuffix;
|
||||
string _pluralSuffix;
|
||||
|
||||
public SuffixRule(string singular, string plural) {
|
||||
_singularSuffix = singular;
|
||||
_pluralSuffix = plural;
|
||||
}
|
||||
|
||||
public bool TryToPlural(string word, out string plural) {
|
||||
if (word.EndsWith(_singularSuffix, StringComparison.OrdinalIgnoreCase)) {
|
||||
plural = word.Substring(0, word.Length - _singularSuffix.Length) + _pluralSuffix;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
plural = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryToSingular(string word, out string singular) {
|
||||
if (word.EndsWith(_pluralSuffix, StringComparison.OrdinalIgnoreCase)) {
|
||||
singular = word.Substring(0, word.Length - _pluralSuffix.Length) + _singularSuffix;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
singular = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Dictionary<string, Word> _specialSingulars;
|
||||
static Dictionary<string, Word> _specialPlurals;
|
||||
static List<SuffixRule> _suffixRules;
|
||||
|
||||
static Pluralizer() {
|
||||
// populate lookup tables for special words
|
||||
_specialSingulars = new Dictionary<string, Word>(StringComparer.OrdinalIgnoreCase);
|
||||
_specialPlurals = new Dictionary<string, Word>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
for (int i = 0; i < _specialWordsStringTable.Length; i += 3) {
|
||||
string s = _specialWordsStringTable[i];
|
||||
string p = _specialWordsStringTable[i + 1];
|
||||
string p2 = _specialWordsStringTable[i + 2];
|
||||
|
||||
if (string.IsNullOrEmpty(p)) {
|
||||
p = s;
|
||||
}
|
||||
|
||||
Word w = new Word(s, p, p2);
|
||||
|
||||
_specialSingulars.Add(s, w);
|
||||
_specialPlurals.Add(p, w);
|
||||
|
||||
if (!string.IsNullOrEmpty(p2)) {
|
||||
_specialPlurals.Add(p2, w);
|
||||
}
|
||||
}
|
||||
|
||||
// populate suffix rules list
|
||||
_suffixRules = new List<SuffixRule>();
|
||||
|
||||
for (int i = 0; i < _suffixRulesStringTable.Length; i += 2) {
|
||||
string singular = _suffixRulesStringTable[i];
|
||||
string plural = _suffixRulesStringTable[i + 1];
|
||||
_suffixRules.Add(new SuffixRule(singular, plural));
|
||||
}
|
||||
}
|
||||
|
||||
static string ToPluralInternal(string s) {
|
||||
if (string.IsNullOrEmpty(s)) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// lookup special words
|
||||
Word word;
|
||||
|
||||
if (_specialSingulars.TryGetValue(s, out word)) {
|
||||
return word.Plural;
|
||||
}
|
||||
|
||||
// apply suffix rules
|
||||
string plural;
|
||||
|
||||
foreach (SuffixRule rule in _suffixRules) {
|
||||
if (rule.TryToPlural(s, out plural)) {
|
||||
return plural;
|
||||
}
|
||||
}
|
||||
|
||||
// apply the default rule
|
||||
return s + "s";
|
||||
}
|
||||
|
||||
static string ToSingularInternal(string s) {
|
||||
if (string.IsNullOrEmpty(s)) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// lookup special words
|
||||
Word word;
|
||||
|
||||
if (_specialPlurals.TryGetValue(s, out word)) {
|
||||
return word.Singular;
|
||||
}
|
||||
|
||||
// apply suffix rules
|
||||
string singular;
|
||||
|
||||
foreach (SuffixRule rule in _suffixRules) {
|
||||
if (rule.TryToSingular(s, out singular)) {
|
||||
return singular;
|
||||
}
|
||||
}
|
||||
|
||||
// apply the default rule
|
||||
if (s.EndsWith("s", StringComparison.OrdinalIgnoreCase)) {
|
||||
return s.Substring(0, s.Length-1);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static string AdjustCase(string s, string template) {
|
||||
if (string.IsNullOrEmpty(s)) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// determine the type of casing of the template string
|
||||
bool foundUpperOrLower = false;
|
||||
bool allLower = true;
|
||||
bool allUpper = true;
|
||||
bool firstUpper = false;
|
||||
|
||||
for (int i = 0; i < template.Length; i++) {
|
||||
if (Char.IsUpper(template[i])) {
|
||||
if (i == 0) firstUpper = true;
|
||||
allLower = false;
|
||||
foundUpperOrLower = true;
|
||||
}
|
||||
else if (Char.IsLower(template[i])) {
|
||||
allUpper = false;
|
||||
foundUpperOrLower = true;
|
||||
}
|
||||
}
|
||||
|
||||
// change the case according to template
|
||||
if (foundUpperOrLower) {
|
||||
if (allLower) {
|
||||
s = s.ToLowerInvariant();
|
||||
}
|
||||
else if (allUpper) {
|
||||
s = s.ToUpperInvariant();
|
||||
}
|
||||
else if (firstUpper) {
|
||||
if (!Char.IsUpper(s[0])) {
|
||||
s = s.Substring(0, 1).ToUpperInvariant() + s.Substring(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace uWiki.Businesslogic {
|
||||
//wiki Event args
|
||||
public class FileCreateEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
public class FileUpdateEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
public class FileRemoveEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
public class FileDownloadUpdateEventArgs : EventArgs
|
||||
{
|
||||
public int ProjectId { get; set; }
|
||||
public int Downloads { get; set; }
|
||||
}
|
||||
|
||||
public class CreateEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
public class UpdateEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
|
||||
public class HelpRequestEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
|
||||
public class Events {
|
||||
/// <summary>
|
||||
/// Calls the subscribers of a cancelable event handler,
|
||||
/// stopping at the event handler which cancels the event (if any).
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the event arguments.</typeparam>
|
||||
/// <param name="cancelableEvent">The event to fire.</param>
|
||||
/// <param name="sender">Sender of the event.</param>
|
||||
/// <param name="eventArgs">Event arguments.</param>
|
||||
public virtual void FireCancelableEvent<T>(EventHandler<T> cancelableEvent, object sender, T eventArgs) where T : CancelEventArgs {
|
||||
if (cancelableEvent != null) {
|
||||
foreach (Delegate invocation in cancelableEvent.GetInvocationList()) {
|
||||
invocation.DynamicInvoke(sender, eventArgs);
|
||||
if (eventArgs.Cancel)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace uWiki.Businesslogic {
|
||||
//wiki Event args
|
||||
public class FileCreateEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
public class FileUpdateEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
public class FileRemoveEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
public class FileDownloadUpdateEventArgs : EventArgs
|
||||
{
|
||||
public int ProjectId { get; set; }
|
||||
public int Downloads { get; set; }
|
||||
}
|
||||
|
||||
public class CreateEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
public class UpdateEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
|
||||
public class HelpRequestEventArgs : System.ComponentModel.CancelEventArgs { }
|
||||
|
||||
public class Events {
|
||||
/// <summary>
|
||||
/// Calls the subscribers of a cancelable event handler,
|
||||
/// stopping at the event handler which cancels the event (if any).
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the event arguments.</typeparam>
|
||||
/// <param name="cancelableEvent">The event to fire.</param>
|
||||
/// <param name="sender">Sender of the event.</param>
|
||||
/// <param name="eventArgs">Event arguments.</param>
|
||||
public virtual void FireCancelableEvent<T>(EventHandler<T> cancelableEvent, object sender, T eventArgs) where T : CancelEventArgs {
|
||||
if (cancelableEvent != null) {
|
||||
foreach (Delegate invocation in cancelableEvent.GetInvocationList()) {
|
||||
invocation.DynamicInvoke(sender, eventArgs);
|
||||
if (eventArgs.Cancel)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+54
-54
@@ -1,55 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using OurUmbraco.Version;
|
||||
|
||||
namespace uWiki.Businesslogic
|
||||
{
|
||||
public class UmbracoVersion
|
||||
{
|
||||
public string Version { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
public UmbracoVersion() { }
|
||||
public UmbracoVersion(string version, string name, string description)
|
||||
{
|
||||
this.Version = version;
|
||||
this.Name = name;
|
||||
this.Description = description;
|
||||
}
|
||||
|
||||
public static UmbracoVersion DefaultVersion()
|
||||
{
|
||||
return AvailableVersions()[UWikiFileVersion.DefaultKey()];
|
||||
}
|
||||
|
||||
public static Dictionary<string, UmbracoVersion> AvailableVersions()
|
||||
{
|
||||
Dictionary<string, UmbracoVersion> Versions = new Dictionary<string, UmbracoVersion>();
|
||||
|
||||
//load the wikiFileVersions from the wikiFileVersions.config file
|
||||
var wikiFileVersions = UWikiFileVersion.GetAllVersions();
|
||||
|
||||
foreach (var v in wikiFileVersions)
|
||||
{
|
||||
Versions.Add(v.Key, new UmbracoVersion(v.Key, v.Name, v.Description));
|
||||
}
|
||||
//Versions.Add("v5", new UmbracoVersion("v5", "Version 5.0.x", "Compatible with version 5.0.x"));
|
||||
//Versions.Add("v491", new UmbracoVersion("v491", "Version 4.9.1", "Compatible with version 4.9.1"));
|
||||
//Versions.Add("v49", new UmbracoVersion("v49", "Version 4.9.x", "Compatible with version 4.9.x"));
|
||||
//Versions.Add("v48", new UmbracoVersion("v48", "Version 4.8.x", "Compatible with version 4.8.x"));
|
||||
//Versions.Add("v47", new UmbracoVersion("v47", "Version 4.7.x", "Compatible with version 4.7.x"));
|
||||
//Versions.Add("v46", new UmbracoVersion("v46", "Version 4.6.x", "Compatible with version 4.6.x"));
|
||||
//Versions.Add("v45", new UmbracoVersion("v45", "Version 4.5.x", "Compatible with version 4.5 using the new XML schema"));
|
||||
//Versions.Add("v45l", new UmbracoVersion("v45l", "Version 4.5.x - Legacy Schema Only", "Compatible with version 4.5 but only using the old XML schema"));
|
||||
//Versions.Add("v4", new UmbracoVersion("v4", "Version 4.0.x", "Compatible with version 4.0.x or 4.5 using the legacy schema"));
|
||||
//Versions.Add("v31", new UmbracoVersion("v31", "Version 3.x", "Only compatible with Umbraco version 3.x and incompatible with the version 4 API"));
|
||||
//Versions.Add("nan", new UmbracoVersion("nan", "Not version dependant", "Works with all versions of umbraco, as it does not contain any version dependencies"));
|
||||
|
||||
return Versions;
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using OurUmbraco.Version;
|
||||
|
||||
namespace uWiki.Businesslogic
|
||||
{
|
||||
public class UmbracoVersion
|
||||
{
|
||||
public string Version { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
public UmbracoVersion() { }
|
||||
public UmbracoVersion(string version, string name, string description)
|
||||
{
|
||||
this.Version = version;
|
||||
this.Name = name;
|
||||
this.Description = description;
|
||||
}
|
||||
|
||||
public static UmbracoVersion DefaultVersion()
|
||||
{
|
||||
return AvailableVersions()[UWikiFileVersion.DefaultKey()];
|
||||
}
|
||||
|
||||
public static Dictionary<string, UmbracoVersion> AvailableVersions()
|
||||
{
|
||||
Dictionary<string, UmbracoVersion> Versions = new Dictionary<string, UmbracoVersion>();
|
||||
|
||||
//load the wikiFileVersions from the wikiFileVersions.config file
|
||||
var wikiFileVersions = UWikiFileVersion.GetAllVersions();
|
||||
|
||||
foreach (var v in wikiFileVersions)
|
||||
{
|
||||
Versions.Add(v.Key, new UmbracoVersion(v.Key, v.Name, v.Description));
|
||||
}
|
||||
//Versions.Add("v5", new UmbracoVersion("v5", "Version 5.0.x", "Compatible with version 5.0.x"));
|
||||
//Versions.Add("v491", new UmbracoVersion("v491", "Version 4.9.1", "Compatible with version 4.9.1"));
|
||||
//Versions.Add("v49", new UmbracoVersion("v49", "Version 4.9.x", "Compatible with version 4.9.x"));
|
||||
//Versions.Add("v48", new UmbracoVersion("v48", "Version 4.8.x", "Compatible with version 4.8.x"));
|
||||
//Versions.Add("v47", new UmbracoVersion("v47", "Version 4.7.x", "Compatible with version 4.7.x"));
|
||||
//Versions.Add("v46", new UmbracoVersion("v46", "Version 4.6.x", "Compatible with version 4.6.x"));
|
||||
//Versions.Add("v45", new UmbracoVersion("v45", "Version 4.5.x", "Compatible with version 4.5 using the new XML schema"));
|
||||
//Versions.Add("v45l", new UmbracoVersion("v45l", "Version 4.5.x - Legacy Schema Only", "Compatible with version 4.5 but only using the old XML schema"));
|
||||
//Versions.Add("v4", new UmbracoVersion("v4", "Version 4.0.x", "Compatible with version 4.0.x or 4.5 using the legacy schema"));
|
||||
//Versions.Add("v31", new UmbracoVersion("v31", "Version 3.x", "Only compatible with Umbraco version 3.x and incompatible with the version 4 API"));
|
||||
//Versions.Add("nan", new UmbracoVersion("nan", "Not version dependant", "Works with all versions of umbraco, as it does not contain any version dependencies"));
|
||||
|
||||
return Versions;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+72
-72
@@ -1,73 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace uWiki.Businesslogic
|
||||
{
|
||||
public class WikiHelpRequest
|
||||
{
|
||||
public string Section { get; set; }
|
||||
public string Application { get; set; }
|
||||
public string ApplicationPage { get; set; }
|
||||
public string Url { get; set; }
|
||||
|
||||
private WikiHelpRequest() { }
|
||||
public static WikiHelpRequest Create(string section, string application, string applicationPage, string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
WikiHelpRequest w = new WikiHelpRequest();
|
||||
|
||||
w.Section = section;
|
||||
w.Application = application;
|
||||
w.ApplicationPage = applicationPage;
|
||||
w.Url = url;
|
||||
|
||||
w.Save();
|
||||
|
||||
return w;
|
||||
|
||||
} catch (Exception ex) {
|
||||
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
HelpRequestEventArgs e = new HelpRequestEventArgs();
|
||||
|
||||
FireBeforeSave(e);
|
||||
|
||||
if (!e.Cancel)
|
||||
{
|
||||
Data.SqlHelper.ExecuteNonQuery(
|
||||
"INSERT INTO wikiHelpRequest (section, application, applicationPage, url) VALUES(@section, @application, @applicationPage, @url)",
|
||||
Data.SqlHelper.CreateParameter("@section", Section),
|
||||
Data.SqlHelper.CreateParameter("@application", Application),
|
||||
Data.SqlHelper.CreateParameter("@applicationPage", ApplicationPage),
|
||||
Data.SqlHelper.CreateParameter("@url", Url));
|
||||
|
||||
FireAfterSave(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Events _e = new Events();
|
||||
|
||||
public static event EventHandler<HelpRequestEventArgs> BeforeSave;
|
||||
protected virtual void FireBeforeSave(HelpRequestEventArgs e)
|
||||
{
|
||||
_e.FireCancelableEvent(BeforeSave, this, e);
|
||||
}
|
||||
public static event EventHandler<HelpRequestEventArgs> AfterSave;
|
||||
protected virtual void FireAfterSave(HelpRequestEventArgs e)
|
||||
{
|
||||
if (AfterSave != null)
|
||||
AfterSave(this, e);
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace uWiki.Businesslogic
|
||||
{
|
||||
public class WikiHelpRequest
|
||||
{
|
||||
public string Section { get; set; }
|
||||
public string Application { get; set; }
|
||||
public string ApplicationPage { get; set; }
|
||||
public string Url { get; set; }
|
||||
|
||||
private WikiHelpRequest() { }
|
||||
public static WikiHelpRequest Create(string section, string application, string applicationPage, string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
WikiHelpRequest w = new WikiHelpRequest();
|
||||
|
||||
w.Section = section;
|
||||
w.Application = application;
|
||||
w.ApplicationPage = applicationPage;
|
||||
w.Url = url;
|
||||
|
||||
w.Save();
|
||||
|
||||
return w;
|
||||
|
||||
} catch (Exception ex) {
|
||||
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString());
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
HelpRequestEventArgs e = new HelpRequestEventArgs();
|
||||
|
||||
FireBeforeSave(e);
|
||||
|
||||
if (!e.Cancel)
|
||||
{
|
||||
Data.SqlHelper.ExecuteNonQuery(
|
||||
"INSERT INTO wikiHelpRequest (section, application, applicationPage, url) VALUES(@section, @application, @applicationPage, @url)",
|
||||
Data.SqlHelper.CreateParameter("@section", Section),
|
||||
Data.SqlHelper.CreateParameter("@application", Application),
|
||||
Data.SqlHelper.CreateParameter("@applicationPage", ApplicationPage),
|
||||
Data.SqlHelper.CreateParameter("@url", Url));
|
||||
|
||||
FireAfterSave(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Events _e = new Events();
|
||||
|
||||
public static event EventHandler<HelpRequestEventArgs> BeforeSave;
|
||||
protected virtual void FireBeforeSave(HelpRequestEventArgs e)
|
||||
{
|
||||
_e.FireCancelableEvent(BeforeSave, this, e);
|
||||
}
|
||||
public static event EventHandler<HelpRequestEventArgs> AfterSave;
|
||||
protected virtual void FireAfterSave(HelpRequestEventArgs e)
|
||||
{
|
||||
if (AfterSave != null)
|
||||
AfterSave(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,140 +1,140 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
|
||||
namespace uWiki.Businesslogic {
|
||||
public class WikiPage {
|
||||
|
||||
public int ParentId { get; set; }
|
||||
public int NodeId { get; set; }
|
||||
public string Body { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Keywords { get; set; }
|
||||
public int Author { get; set; }
|
||||
public Guid Version { get; set; }
|
||||
public bool Exists { get; set; }
|
||||
public bool Locked { get; set; }
|
||||
|
||||
|
||||
public umbraco.cms.businesslogic.web.Document Node { get; set; }
|
||||
|
||||
private Events _e = new Events();
|
||||
|
||||
public WikiPage() {
|
||||
Exists = false;
|
||||
}
|
||||
|
||||
public static WikiPage Create(int parentId, int authorId, string body, string title, string keywords) {
|
||||
WikiPage wp = new WikiPage();
|
||||
wp.Exists = false;
|
||||
wp.ParentId = parentId;
|
||||
wp.Author = authorId;
|
||||
wp.Body = body;
|
||||
wp.Title = title;
|
||||
wp.Keywords = keywords;
|
||||
wp.Save();
|
||||
|
||||
return wp;
|
||||
}
|
||||
|
||||
public WikiPage(int id) {
|
||||
umbraco.cms.businesslogic.web.Document doc = new umbraco.cms.businesslogic.web.Document(id);
|
||||
|
||||
if (doc != null) {
|
||||
|
||||
|
||||
if (doc.ContentType.Alias == "WikiPage") {
|
||||
Exists = true;
|
||||
Body = doc.getProperty("bodyText").Value.ToString() ;
|
||||
Locked = (doc.getProperty("umbracoNoEdit").Value.ToString() == "1");
|
||||
|
||||
if(doc.getProperty("keywords") != null)
|
||||
Keywords = doc.getProperty("keywords").Value.ToString();
|
||||
|
||||
Title = doc.Text;
|
||||
Author = (int)doc.getProperty("author").Value;
|
||||
Version = doc.Version;
|
||||
Node = doc;
|
||||
NodeId = doc.Id;
|
||||
ParentId = Node.Parent.Id;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Save() {
|
||||
if (NodeId == 0) {
|
||||
|
||||
if (!string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(Body)) {
|
||||
CreateEventArgs e = new CreateEventArgs();
|
||||
FireBeforeCreate(e);
|
||||
if (!e.Cancel) {
|
||||
|
||||
Document childDoc = Document.MakeNew(Title, DocumentType.GetByAlias("WikiPage"), new umbraco.BusinessLogic.User(0), ParentId);
|
||||
childDoc.getProperty("author").Value = Author;
|
||||
childDoc.getProperty("bodyText").Value = Body;
|
||||
childDoc.getProperty("keywords").Value = Keywords;
|
||||
childDoc.Save();
|
||||
childDoc.Publish(new umbraco.BusinessLogic.User(0));
|
||||
|
||||
umbraco.library.UpdateDocumentCache(childDoc.Id);
|
||||
|
||||
Node = childDoc;
|
||||
NodeId = childDoc.Id;
|
||||
Version = childDoc.Version;
|
||||
Exists = true;
|
||||
|
||||
FireAfterCreate(e);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
UpdateEventArgs e = new UpdateEventArgs();
|
||||
FireBeforeUpdate(e);
|
||||
|
||||
if (!e.Cancel) {
|
||||
|
||||
if (Node == null)
|
||||
Node = new Document(NodeId);
|
||||
|
||||
Node.Text = Title;
|
||||
Node.getProperty("author").Value = Author;
|
||||
Node.getProperty("bodyText").Value = Body;
|
||||
Node.getProperty("keywords").Value = Keywords;
|
||||
Node.Save();
|
||||
Node.Publish(new umbraco.BusinessLogic.User(0));
|
||||
|
||||
umbraco.library.UpdateDocumentCache(Node.Id);
|
||||
|
||||
FireAfterUpdate(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Events */
|
||||
public static event EventHandler<CreateEventArgs> BeforeCreate;
|
||||
protected virtual void FireBeforeCreate(CreateEventArgs e) {
|
||||
_e.FireCancelableEvent(BeforeCreate, this, e);
|
||||
}
|
||||
public static event EventHandler<CreateEventArgs> AfterCreate;
|
||||
protected virtual void FireAfterCreate(CreateEventArgs e) {
|
||||
if (AfterCreate != null)
|
||||
AfterCreate(this, e);
|
||||
}
|
||||
|
||||
public static event EventHandler<UpdateEventArgs> BeforeUpdate;
|
||||
protected virtual void FireBeforeUpdate(UpdateEventArgs e) {
|
||||
_e.FireCancelableEvent(BeforeUpdate, this, e);
|
||||
}
|
||||
public static event EventHandler<UpdateEventArgs> AfterUpdate;
|
||||
protected virtual void FireAfterUpdate(UpdateEventArgs e) {
|
||||
if (AfterUpdate != null)
|
||||
AfterUpdate(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
|
||||
namespace uWiki.Businesslogic {
|
||||
public class WikiPage {
|
||||
|
||||
public int ParentId { get; set; }
|
||||
public int NodeId { get; set; }
|
||||
public string Body { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Keywords { get; set; }
|
||||
public int Author { get; set; }
|
||||
public Guid Version { get; set; }
|
||||
public bool Exists { get; set; }
|
||||
public bool Locked { get; set; }
|
||||
|
||||
|
||||
public umbraco.cms.businesslogic.web.Document Node { get; set; }
|
||||
|
||||
private Events _e = new Events();
|
||||
|
||||
public WikiPage() {
|
||||
Exists = false;
|
||||
}
|
||||
|
||||
public static WikiPage Create(int parentId, int authorId, string body, string title, string keywords) {
|
||||
WikiPage wp = new WikiPage();
|
||||
wp.Exists = false;
|
||||
wp.ParentId = parentId;
|
||||
wp.Author = authorId;
|
||||
wp.Body = body;
|
||||
wp.Title = title;
|
||||
wp.Keywords = keywords;
|
||||
wp.Save();
|
||||
|
||||
return wp;
|
||||
}
|
||||
|
||||
public WikiPage(int id) {
|
||||
umbraco.cms.businesslogic.web.Document doc = new umbraco.cms.businesslogic.web.Document(id);
|
||||
|
||||
if (doc != null) {
|
||||
|
||||
|
||||
if (doc.ContentType.Alias == "WikiPage") {
|
||||
Exists = true;
|
||||
Body = doc.getProperty("bodyText").Value.ToString() ;
|
||||
Locked = (doc.getProperty("umbracoNoEdit").Value.ToString() == "1");
|
||||
|
||||
if(doc.getProperty("keywords") != null)
|
||||
Keywords = doc.getProperty("keywords").Value.ToString();
|
||||
|
||||
Title = doc.Text;
|
||||
Author = (int)doc.getProperty("author").Value;
|
||||
Version = doc.Version;
|
||||
Node = doc;
|
||||
NodeId = doc.Id;
|
||||
ParentId = Node.Parent.Id;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Save() {
|
||||
if (NodeId == 0) {
|
||||
|
||||
if (!string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(Body)) {
|
||||
CreateEventArgs e = new CreateEventArgs();
|
||||
FireBeforeCreate(e);
|
||||
if (!e.Cancel) {
|
||||
|
||||
Document childDoc = Document.MakeNew(Title, DocumentType.GetByAlias("WikiPage"), new umbraco.BusinessLogic.User(0), ParentId);
|
||||
childDoc.getProperty("author").Value = Author;
|
||||
childDoc.getProperty("bodyText").Value = Body;
|
||||
childDoc.getProperty("keywords").Value = Keywords;
|
||||
childDoc.Save();
|
||||
childDoc.Publish(new umbraco.BusinessLogic.User(0));
|
||||
|
||||
umbraco.library.UpdateDocumentCache(childDoc.Id);
|
||||
|
||||
Node = childDoc;
|
||||
NodeId = childDoc.Id;
|
||||
Version = childDoc.Version;
|
||||
Exists = true;
|
||||
|
||||
FireAfterCreate(e);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
UpdateEventArgs e = new UpdateEventArgs();
|
||||
FireBeforeUpdate(e);
|
||||
|
||||
if (!e.Cancel) {
|
||||
|
||||
if (Node == null)
|
||||
Node = new Document(NodeId);
|
||||
|
||||
Node.Text = Title;
|
||||
Node.getProperty("author").Value = Author;
|
||||
Node.getProperty("bodyText").Value = Body;
|
||||
Node.getProperty("keywords").Value = Keywords;
|
||||
Node.Save();
|
||||
Node.Publish(new umbraco.BusinessLogic.User(0));
|
||||
|
||||
umbraco.library.UpdateDocumentCache(Node.Id);
|
||||
|
||||
FireAfterUpdate(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Events */
|
||||
public static event EventHandler<CreateEventArgs> BeforeCreate;
|
||||
protected virtual void FireBeforeCreate(CreateEventArgs e) {
|
||||
_e.FireCancelableEvent(BeforeCreate, this, e);
|
||||
}
|
||||
public static event EventHandler<CreateEventArgs> AfterCreate;
|
||||
protected virtual void FireAfterCreate(CreateEventArgs e) {
|
||||
if (AfterCreate != null)
|
||||
AfterCreate(this, e);
|
||||
}
|
||||
|
||||
public static event EventHandler<UpdateEventArgs> BeforeUpdate;
|
||||
protected virtual void FireBeforeUpdate(UpdateEventArgs e) {
|
||||
_e.FireCancelableEvent(BeforeUpdate, this, e);
|
||||
}
|
||||
public static event EventHandler<UpdateEventArgs> AfterUpdate;
|
||||
protected virtual void FireAfterUpdate(UpdateEventArgs e) {
|
||||
if (AfterUpdate != null)
|
||||
AfterUpdate(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,148 +1,148 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Xml.XPath;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using System.Xml;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using umbraco.cms.businesslogic;
|
||||
using umbraco.cms.businesslogic.property;
|
||||
using umbraco.cms.businesslogic.propertytype;
|
||||
|
||||
namespace uWiki.Library {
|
||||
[Umbraco.Core.Macros.XsltExtension("uWiki")]
|
||||
public class Xslt {
|
||||
public static XPathNodeIterator PageHistory(int nodeId) {
|
||||
Document doc = new Document(nodeId);
|
||||
XmlDocument xd = new XmlDocument();
|
||||
|
||||
XmlNode versions = umbraco.xmlHelper.addTextNode(xd, "versions", "");
|
||||
|
||||
if (doc != null) {
|
||||
DocumentVersionList[] dvlList = doc.GetVersions();
|
||||
PropertyType authorType = doc.getProperty("author").PropertyType;
|
||||
|
||||
foreach (DocumentVersionList dvl in dvlList) {
|
||||
|
||||
Document d = new Document(nodeId, dvl.Version);
|
||||
int author = getPropertyFromVersion<int>(authorType, dvl.Version, "dataInt");
|
||||
|
||||
XmlNode x = umbraco.xmlHelper.addTextNode(xd, "version", "");
|
||||
x.AppendChild(umbraco.xmlHelper.addTextNode(xd, "author", author.ToString()));
|
||||
x.AppendChild(umbraco.xmlHelper.addTextNode(xd, "guid", dvl.Version.ToString()));
|
||||
x.AppendChild(umbraco.xmlHelper.addTextNode(xd, "name", dvl.Text));
|
||||
x.AppendChild(umbraco.xmlHelper.addTextNode(xd, "date", dvl.Date.ToString("s")));
|
||||
|
||||
|
||||
versions.AppendChild( x );
|
||||
|
||||
x = null;
|
||||
d = null;
|
||||
}
|
||||
}
|
||||
|
||||
return versions.CreateNavigator().Select(".");
|
||||
}
|
||||
|
||||
|
||||
private static T getPropertyFromVersion<T>(PropertyType pt, Guid version, string type)
|
||||
{
|
||||
return umbraco.BusinessLogic.Application.SqlHelper.ExecuteScalar<T>("select " + type + " from cmsPropertyData where versionId = @version AND propertyTypeId = @id",
|
||||
umbraco.BusinessLogic.Application.SqlHelper.CreateParameter("@id", pt.Id),
|
||||
umbraco.BusinessLogic.Application.SqlHelper.CreateParameter("@version", version)
|
||||
);
|
||||
}
|
||||
|
||||
public static string GetXmlNodeFromVersion(int id, string guid, bool deep) {
|
||||
|
||||
Document d;
|
||||
|
||||
if (!string.IsNullOrEmpty(guid))
|
||||
d = new Document(id, new Guid(guid));
|
||||
else
|
||||
d = new Document(id);
|
||||
|
||||
XmlDocument xd = new XmlDocument();
|
||||
|
||||
XmlNode x = umbraco.xmlHelper.addTextNode(xd, "node", "");
|
||||
d.XmlPopulate(xd, ref x, deep);
|
||||
|
||||
return x.OuterXml;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static XPathNodeIterator GetAttachedFiles(int id) {
|
||||
return Businesslogic.Data.GetDataSet("SELECT * FROM wikiFiles where nodeId = " + id.ToString(), "file");
|
||||
}
|
||||
|
||||
|
||||
public static XPathNodeIterator GetAttachedFile(int Fileid) {
|
||||
return Businesslogic.Data.GetDataSet("SELECT * FROM wikiFiles where id = " + Fileid.ToString(), "file");
|
||||
}
|
||||
|
||||
public static bool IsMemberInGroup(string GroupName, int memberid)
|
||||
{
|
||||
Member m = Utils.GetMember(memberid);
|
||||
|
||||
foreach (MemberGroup mg in m.Groups.Values)
|
||||
{
|
||||
if (mg.Text == GroupName)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsInGroup(string GroupName)
|
||||
{
|
||||
|
||||
if (umbraco.library.IsLoggedOn())
|
||||
return IsMemberInGroup(GroupName, Member.CurrentMemberId());
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void AddWikiHelpRequest(string section)
|
||||
{
|
||||
string url = HttpContext.Current.Request.Url.AbsoluteUri.ToLower();
|
||||
string application = "";
|
||||
string applicationPage = url.Substring(url.LastIndexOf("/") + 1, url.Length - url.LastIndexOf("/") - 1);
|
||||
|
||||
Businesslogic.WikiHelpRequest.Create(section.ToLower(), application, applicationPage,url);
|
||||
}
|
||||
public static XPathNodeIterator GetWikiHelpRequests()
|
||||
{
|
||||
return Businesslogic.Data.GetDataSet("SELECT applicationPage, COUNT(*) AS numberOfRequests FROM wikiHelpRequest GROUP BY applicationPage ", "requests");
|
||||
}
|
||||
|
||||
public static XPathNodeIterator GetWikiHelpRequests(string section)
|
||||
{
|
||||
return Businesslogic.Data.GetDataSet("SELECT applicationPage, COUNT(*) AS numberOfRequests FROM wikiHelpRequest where section = '" + section + "' GROUP BY applicationPage", "requests");
|
||||
}
|
||||
|
||||
public static XPathNodeIterator FindPackageForUmbracoVersion(int nodeid, string umbracoVersion)
|
||||
{
|
||||
XmlDocument xd = new XmlDocument();
|
||||
|
||||
Businesslogic.WikiFile wf = Businesslogic.WikiFile.FindPackageForUmbracoVersion(nodeid, umbracoVersion);
|
||||
|
||||
if (wf != null)
|
||||
xd.AppendChild(wf.ToXml(xd));
|
||||
|
||||
return xd.CreateNavigator().Select(".");
|
||||
}
|
||||
|
||||
public static XPathNodeIterator FindPackageDocumentationForUmbracoVersion(int nodeid, string umbracoVersion)
|
||||
{
|
||||
XmlDocument xd = new XmlDocument();
|
||||
|
||||
Businesslogic.WikiFile wf = Businesslogic.WikiFile.FindPackageDocumentationForUmbracoVersion(nodeid, umbracoVersion);
|
||||
|
||||
if (wf != null)
|
||||
xd.AppendChild(wf.ToXml(xd));
|
||||
|
||||
return xd.CreateNavigator().Select(".");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Xml.XPath;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using System.Xml;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using umbraco.cms.businesslogic;
|
||||
using umbraco.cms.businesslogic.property;
|
||||
using umbraco.cms.businesslogic.propertytype;
|
||||
|
||||
namespace uWiki.Library {
|
||||
[Umbraco.Core.Macros.XsltExtension("uWiki")]
|
||||
public class Xslt {
|
||||
public static XPathNodeIterator PageHistory(int nodeId) {
|
||||
Document doc = new Document(nodeId);
|
||||
XmlDocument xd = new XmlDocument();
|
||||
|
||||
XmlNode versions = umbraco.xmlHelper.addTextNode(xd, "versions", "");
|
||||
|
||||
if (doc != null) {
|
||||
DocumentVersionList[] dvlList = doc.GetVersions();
|
||||
PropertyType authorType = doc.getProperty("author").PropertyType;
|
||||
|
||||
foreach (DocumentVersionList dvl in dvlList) {
|
||||
|
||||
Document d = new Document(nodeId, dvl.Version);
|
||||
int author = getPropertyFromVersion<int>(authorType, dvl.Version, "dataInt");
|
||||
|
||||
XmlNode x = umbraco.xmlHelper.addTextNode(xd, "version", "");
|
||||
x.AppendChild(umbraco.xmlHelper.addTextNode(xd, "author", author.ToString()));
|
||||
x.AppendChild(umbraco.xmlHelper.addTextNode(xd, "guid", dvl.Version.ToString()));
|
||||
x.AppendChild(umbraco.xmlHelper.addTextNode(xd, "name", dvl.Text));
|
||||
x.AppendChild(umbraco.xmlHelper.addTextNode(xd, "date", dvl.Date.ToString("s")));
|
||||
|
||||
|
||||
versions.AppendChild( x );
|
||||
|
||||
x = null;
|
||||
d = null;
|
||||
}
|
||||
}
|
||||
|
||||
return versions.CreateNavigator().Select(".");
|
||||
}
|
||||
|
||||
|
||||
private static T getPropertyFromVersion<T>(PropertyType pt, Guid version, string type)
|
||||
{
|
||||
return umbraco.BusinessLogic.Application.SqlHelper.ExecuteScalar<T>("select " + type + " from cmsPropertyData where versionId = @version AND propertyTypeId = @id",
|
||||
umbraco.BusinessLogic.Application.SqlHelper.CreateParameter("@id", pt.Id),
|
||||
umbraco.BusinessLogic.Application.SqlHelper.CreateParameter("@version", version)
|
||||
);
|
||||
}
|
||||
|
||||
public static string GetXmlNodeFromVersion(int id, string guid, bool deep) {
|
||||
|
||||
Document d;
|
||||
|
||||
if (!string.IsNullOrEmpty(guid))
|
||||
d = new Document(id, new Guid(guid));
|
||||
else
|
||||
d = new Document(id);
|
||||
|
||||
XmlDocument xd = new XmlDocument();
|
||||
|
||||
XmlNode x = umbraco.xmlHelper.addTextNode(xd, "node", "");
|
||||
d.XmlPopulate(xd, ref x, deep);
|
||||
|
||||
return x.OuterXml;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static XPathNodeIterator GetAttachedFiles(int id) {
|
||||
return Businesslogic.Data.GetDataSet("SELECT * FROM wikiFiles where nodeId = " + id.ToString(), "file");
|
||||
}
|
||||
|
||||
|
||||
public static XPathNodeIterator GetAttachedFile(int Fileid) {
|
||||
return Businesslogic.Data.GetDataSet("SELECT * FROM wikiFiles where id = " + Fileid.ToString(), "file");
|
||||
}
|
||||
|
||||
public static bool IsMemberInGroup(string GroupName, int memberid)
|
||||
{
|
||||
Member m = Utils.GetMember(memberid);
|
||||
|
||||
foreach (MemberGroup mg in m.Groups.Values)
|
||||
{
|
||||
if (mg.Text == GroupName)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsInGroup(string GroupName)
|
||||
{
|
||||
|
||||
if (umbraco.library.IsLoggedOn())
|
||||
return IsMemberInGroup(GroupName, Member.CurrentMemberId());
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void AddWikiHelpRequest(string section)
|
||||
{
|
||||
string url = HttpContext.Current.Request.Url.AbsoluteUri.ToLower();
|
||||
string application = "";
|
||||
string applicationPage = url.Substring(url.LastIndexOf("/") + 1, url.Length - url.LastIndexOf("/") - 1);
|
||||
|
||||
Businesslogic.WikiHelpRequest.Create(section.ToLower(), application, applicationPage,url);
|
||||
}
|
||||
public static XPathNodeIterator GetWikiHelpRequests()
|
||||
{
|
||||
return Businesslogic.Data.GetDataSet("SELECT applicationPage, COUNT(*) AS numberOfRequests FROM wikiHelpRequest GROUP BY applicationPage ", "requests");
|
||||
}
|
||||
|
||||
public static XPathNodeIterator GetWikiHelpRequests(string section)
|
||||
{
|
||||
return Businesslogic.Data.GetDataSet("SELECT applicationPage, COUNT(*) AS numberOfRequests FROM wikiHelpRequest where section = '" + section + "' GROUP BY applicationPage", "requests");
|
||||
}
|
||||
|
||||
public static XPathNodeIterator FindPackageForUmbracoVersion(int nodeid, string umbracoVersion)
|
||||
{
|
||||
XmlDocument xd = new XmlDocument();
|
||||
|
||||
Businesslogic.WikiFile wf = Businesslogic.WikiFile.FindPackageForUmbracoVersion(nodeid, umbracoVersion);
|
||||
|
||||
if (wf != null)
|
||||
xd.AppendChild(wf.ToXml(xd));
|
||||
|
||||
return xd.CreateNavigator().Select(".");
|
||||
}
|
||||
|
||||
public static XPathNodeIterator FindPackageDocumentationForUmbracoVersion(int nodeid, string umbracoVersion)
|
||||
{
|
||||
XmlDocument xd = new XmlDocument();
|
||||
|
||||
Businesslogic.WikiFile wf = Businesslogic.WikiFile.FindPackageDocumentationForUmbracoVersion(nodeid, umbracoVersion);
|
||||
|
||||
if (wf != null)
|
||||
xd.AppendChild(wf.ToXml(xd));
|
||||
|
||||
return xd.CreateNavigator().Select(".");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using uWiki.Businesslogic;
|
||||
|
||||
namespace uWiki
|
||||
{
|
||||
public class WikiFileUploadHandler : IHttpHandler
|
||||
{
|
||||
#region IHttpHandler Members
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
|
||||
//TODO: Authorize this request!!!
|
||||
|
||||
var file = context.Request.Files["Filedata"];
|
||||
var userguid = context.Request.Form["USERGUID"];
|
||||
var nodeguid = context.Request.Form["NODEGUID"];
|
||||
var fileType = context.Request.Form["FILETYPE"];
|
||||
var fileName = context.Request.Form["FILENAME"];
|
||||
var umbracoVersion = context.Request.Form["UMBRACOVERSION"];
|
||||
|
||||
var versions = new List<UmbracoVersion> { UmbracoVersion.DefaultVersion() };
|
||||
|
||||
if (string.IsNullOrWhiteSpace(umbracoVersion) == false)
|
||||
{
|
||||
versions.Clear();
|
||||
versions = WikiFile.GetVersionsFromString(umbracoVersion);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(userguid) == false
|
||||
&& string.IsNullOrWhiteSpace(nodeguid) == false
|
||||
&& string.IsNullOrWhiteSpace(fileType) == false
|
||||
&& string.IsNullOrWhiteSpace(fileName) == false)
|
||||
{
|
||||
WikiFile.Create(fileName, new Guid(nodeguid), new Guid(userguid), file, fileType, versions);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using uWiki.Businesslogic;
|
||||
|
||||
namespace uWiki
|
||||
{
|
||||
public class WikiFileUploadHandler : IHttpHandler
|
||||
{
|
||||
#region IHttpHandler Members
|
||||
|
||||
public bool IsReusable
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void ProcessRequest(HttpContext context)
|
||||
{
|
||||
|
||||
//TODO: Authorize this request!!!
|
||||
|
||||
var file = context.Request.Files["Filedata"];
|
||||
var userguid = context.Request.Form["USERGUID"];
|
||||
var nodeguid = context.Request.Form["NODEGUID"];
|
||||
var fileType = context.Request.Form["FILETYPE"];
|
||||
var fileName = context.Request.Form["FILENAME"];
|
||||
var umbracoVersion = context.Request.Form["UMBRACOVERSION"];
|
||||
|
||||
var versions = new List<UmbracoVersion> { UmbracoVersion.DefaultVersion() };
|
||||
|
||||
if (string.IsNullOrWhiteSpace(umbracoVersion) == false)
|
||||
{
|
||||
versions.Clear();
|
||||
versions = WikiFile.GetVersionsFromString(umbracoVersion);
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(userguid) == false
|
||||
&& string.IsNullOrWhiteSpace(nodeguid) == false
|
||||
&& string.IsNullOrWhiteSpace(fileType) == false
|
||||
&& string.IsNullOrWhiteSpace(fileName) == false)
|
||||
{
|
||||
WikiFile.Create(fileName, new Guid(nodeguid), new Guid(userguid), file, fileType, versions);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,199 +1,199 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Xml;
|
||||
using System.Web;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco;
|
||||
using umbraco.cms.businesslogic.template;
|
||||
using System.Configuration;
|
||||
using umbraco.interfaces;
|
||||
using umbraco.NodeFactory;
|
||||
|
||||
namespace uWiki {
|
||||
public class iNotFoundHandler : umbraco.interfaces.INotFoundHandler {
|
||||
#region INotFoundHandler Members
|
||||
|
||||
private int _redirectID = -1;
|
||||
|
||||
public bool CacheUrl {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool Execute(string url) {
|
||||
|
||||
HttpContext.Current.Trace.Write("umbraco.wikiHandler", "init");
|
||||
|
||||
bool _succes = false;
|
||||
url = url.Replace(".aspx", string.Empty);
|
||||
string currentDomain = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];
|
||||
if (url.Length > 0) {
|
||||
if (url.Substring(0, 1) == "/")
|
||||
url = url.Substring(1, url.Length - 1);
|
||||
|
||||
XmlNode urlNode = null;
|
||||
string topic = "";
|
||||
|
||||
// We're not at domain root
|
||||
if (url.IndexOf("/") != -1) {
|
||||
|
||||
string theRealUrl = url.Substring(0, url.LastIndexOf("/"));
|
||||
string realUrlXPath = CreateXPathQuery(theRealUrl, true);
|
||||
|
||||
urlNode = content.Instance.XmlContent.SelectSingleNode(realUrlXPath);
|
||||
topic = url.Substring(url.LastIndexOf("/") + 1, url.Length - url.LastIndexOf(("/")) - 1);
|
||||
|
||||
}
|
||||
|
||||
if (url.Contains("wiki/umbraco-help"))
|
||||
{
|
||||
string[] urlparts = url.Split('/');
|
||||
|
||||
string section = urlparts[urlparts.Length - 2];
|
||||
string application = "";
|
||||
string applicationPage = urlparts[urlparts.Length - 1];
|
||||
|
||||
//log the request
|
||||
Businesslogic.WikiHelpRequest.Create(section.ToLower(), application, applicationPage, url);
|
||||
|
||||
|
||||
//if it isn't a page create request
|
||||
if (HttpContext.Current.Request["wikiEditor"] == null)
|
||||
{
|
||||
//set redirect id to main umbraco help page
|
||||
if (Library.Utils.GetWikiHelpFallBackPage(section) > 0)
|
||||
{
|
||||
_redirectID = Library.Utils.GetWikiHelpFallBackPage(section);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (urlNode != null && topic != "" && urlNode.Name == "WikiPage") {
|
||||
_redirectID = int.Parse(urlNode.Attributes.GetNamedItem("id").Value);
|
||||
|
||||
HttpContext.Current.Items["altTemplate"] = "createwikipage";
|
||||
HttpContext.Current.Items["topic"] = url.Substring(url.LastIndexOf("/") + 1, url.Length - url.LastIndexOf(("/")) - 1);
|
||||
|
||||
HttpContext.Current.Trace.Write("umbraco.altTemplateHandler",
|
||||
string.Format("Templated changed to: '{0}'",
|
||||
HttpContext.Current.Items["altTemplate"]));
|
||||
_succes = true;
|
||||
}
|
||||
}
|
||||
return _succes;
|
||||
}
|
||||
|
||||
public int redirectID {
|
||||
get {
|
||||
return _redirectID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private const string PageXPathQueryStart = "/root";
|
||||
private const string UrlName = "@urlName";
|
||||
|
||||
public static string CreateXPathQuery(string url, bool checkDomain)
|
||||
{
|
||||
|
||||
string _tempQuery = "";
|
||||
if (GlobalSettings.HideTopLevelNodeFromPath && checkDomain)
|
||||
{
|
||||
_tempQuery = "/root" + GetChildContainerName() + "/*";
|
||||
}
|
||||
else if (checkDomain)
|
||||
_tempQuery = "/root" + GetChildContainerName();
|
||||
|
||||
|
||||
string[] requestRawUrl = url.Split("/".ToCharArray());
|
||||
|
||||
// Check for Domain prefix
|
||||
string domainUrl = "";
|
||||
if (checkDomain && Domain.Exists(HttpContext.Current.Request.ServerVariables["SERVER_NAME"]))
|
||||
{
|
||||
// we need to get the node based on domain
|
||||
INode n = new Node(Domain.GetRootFromDomain(HttpContext.Current.Request.ServerVariables["SERVER_NAME"]));
|
||||
domainUrl = n.UrlName; // we don't use niceUrlFetch as we need more control
|
||||
if (n.Parent != null)
|
||||
{
|
||||
while (n.Parent != null)
|
||||
{
|
||||
n = n.Parent;
|
||||
domainUrl = n.UrlName + "/" + domainUrl;
|
||||
}
|
||||
}
|
||||
domainUrl = "/" + domainUrl;
|
||||
|
||||
// If at domain root
|
||||
if (url == "")
|
||||
{
|
||||
_tempQuery = "";
|
||||
requestRawUrl = domainUrl.Split("/".ToCharArray());
|
||||
HttpContext.Current.Trace.Write("requestHandler",
|
||||
"Redirecting to domain: " +
|
||||
HttpContext.Current.Request.ServerVariables["SERVER_NAME"] +
|
||||
", nodeId: " +
|
||||
Domain.GetRootFromDomain(
|
||||
HttpContext.Current.Request.ServerVariables["SERVER_NAME"]).
|
||||
ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
// if it matches a domain url, skip all other xpaths and use this!
|
||||
string langXpath = CreateXPathQuery(domainUrl + "/" + url, false);
|
||||
if (content.Instance.XmlContent.DocumentElement.SelectSingleNode(langXpath) != null)
|
||||
return langXpath;
|
||||
}
|
||||
}
|
||||
else if (url == "" && !GlobalSettings.HideTopLevelNodeFromPath)
|
||||
_tempQuery += "/*";
|
||||
|
||||
bool rootAdded = false;
|
||||
if (GlobalSettings.HideTopLevelNodeFromPath && requestRawUrl.Length == 1)
|
||||
{
|
||||
HttpContext.Current.Trace.Write("umbracoRequestHandler", "xpath: '" + _tempQuery + "'");
|
||||
if (_tempQuery == "")
|
||||
_tempQuery = "/root" + GetChildContainerName() + "/*";
|
||||
_tempQuery = "/root" + GetChildContainerName() + "/* [" + UrlName +
|
||||
" = \"" + requestRawUrl[0].Replace(".aspx", "").ToLower() + "\"] | " + _tempQuery;
|
||||
HttpContext.Current.Trace.Write("umbracoRequestHandler", "xpath: '" + _tempQuery + "'");
|
||||
rootAdded = true;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i <= requestRawUrl.GetUpperBound(0); i++)
|
||||
{
|
||||
if (requestRawUrl[i] != "")
|
||||
_tempQuery += GetChildContainerName() + "/* [" + UrlName + " = \"" + requestRawUrl[i].Replace(".aspx", "").ToLower() +
|
||||
"\"]";
|
||||
}
|
||||
|
||||
if (GlobalSettings.HideTopLevelNodeFromPath && requestRawUrl.Length == 2)
|
||||
{
|
||||
_tempQuery += " | " + PageXPathQueryStart + GetChildContainerName() + "/* [" + UrlName + " = \"" +
|
||||
requestRawUrl[1].Replace(".aspx", "").ToLower() + "\"]";
|
||||
}
|
||||
HttpContext.Current.Trace.Write("umbracoRequestHandler", "xpath: '" + _tempQuery + "'");
|
||||
|
||||
Debug.Write(_tempQuery + "(" + PageXPathQueryStart + ")");
|
||||
|
||||
if (checkDomain)
|
||||
return _tempQuery;
|
||||
else if (!rootAdded)
|
||||
return PageXPathQueryStart + _tempQuery;
|
||||
else
|
||||
return _tempQuery;
|
||||
}
|
||||
|
||||
private static string GetChildContainerName()
|
||||
{
|
||||
if (string.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME) == false)
|
||||
return "/" + UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME;
|
||||
return "";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Xml;
|
||||
using System.Web;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco;
|
||||
using umbraco.cms.businesslogic.template;
|
||||
using System.Configuration;
|
||||
using umbraco.interfaces;
|
||||
using umbraco.NodeFactory;
|
||||
|
||||
namespace uWiki {
|
||||
public class iNotFoundHandler : umbraco.interfaces.INotFoundHandler {
|
||||
#region INotFoundHandler Members
|
||||
|
||||
private int _redirectID = -1;
|
||||
|
||||
public bool CacheUrl {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool Execute(string url) {
|
||||
|
||||
HttpContext.Current.Trace.Write("umbraco.wikiHandler", "init");
|
||||
|
||||
bool _succes = false;
|
||||
url = url.Replace(".aspx", string.Empty);
|
||||
string currentDomain = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];
|
||||
if (url.Length > 0) {
|
||||
if (url.Substring(0, 1) == "/")
|
||||
url = url.Substring(1, url.Length - 1);
|
||||
|
||||
XmlNode urlNode = null;
|
||||
string topic = "";
|
||||
|
||||
// We're not at domain root
|
||||
if (url.IndexOf("/") != -1) {
|
||||
|
||||
string theRealUrl = url.Substring(0, url.LastIndexOf("/"));
|
||||
string realUrlXPath = CreateXPathQuery(theRealUrl, true);
|
||||
|
||||
urlNode = content.Instance.XmlContent.SelectSingleNode(realUrlXPath);
|
||||
topic = url.Substring(url.LastIndexOf("/") + 1, url.Length - url.LastIndexOf(("/")) - 1);
|
||||
|
||||
}
|
||||
|
||||
if (url.Contains("wiki/umbraco-help"))
|
||||
{
|
||||
string[] urlparts = url.Split('/');
|
||||
|
||||
string section = urlparts[urlparts.Length - 2];
|
||||
string application = "";
|
||||
string applicationPage = urlparts[urlparts.Length - 1];
|
||||
|
||||
//log the request
|
||||
Businesslogic.WikiHelpRequest.Create(section.ToLower(), application, applicationPage, url);
|
||||
|
||||
|
||||
//if it isn't a page create request
|
||||
if (HttpContext.Current.Request["wikiEditor"] == null)
|
||||
{
|
||||
//set redirect id to main umbraco help page
|
||||
if (Library.Utils.GetWikiHelpFallBackPage(section) > 0)
|
||||
{
|
||||
_redirectID = Library.Utils.GetWikiHelpFallBackPage(section);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (urlNode != null && topic != "" && urlNode.Name == "WikiPage") {
|
||||
_redirectID = int.Parse(urlNode.Attributes.GetNamedItem("id").Value);
|
||||
|
||||
HttpContext.Current.Items["altTemplate"] = "createwikipage";
|
||||
HttpContext.Current.Items["topic"] = url.Substring(url.LastIndexOf("/") + 1, url.Length - url.LastIndexOf(("/")) - 1);
|
||||
|
||||
HttpContext.Current.Trace.Write("umbraco.altTemplateHandler",
|
||||
string.Format("Templated changed to: '{0}'",
|
||||
HttpContext.Current.Items["altTemplate"]));
|
||||
_succes = true;
|
||||
}
|
||||
}
|
||||
return _succes;
|
||||
}
|
||||
|
||||
public int redirectID {
|
||||
get {
|
||||
return _redirectID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private const string PageXPathQueryStart = "/root";
|
||||
private const string UrlName = "@urlName";
|
||||
|
||||
public static string CreateXPathQuery(string url, bool checkDomain)
|
||||
{
|
||||
|
||||
string _tempQuery = "";
|
||||
if (GlobalSettings.HideTopLevelNodeFromPath && checkDomain)
|
||||
{
|
||||
_tempQuery = "/root" + GetChildContainerName() + "/*";
|
||||
}
|
||||
else if (checkDomain)
|
||||
_tempQuery = "/root" + GetChildContainerName();
|
||||
|
||||
|
||||
string[] requestRawUrl = url.Split("/".ToCharArray());
|
||||
|
||||
// Check for Domain prefix
|
||||
string domainUrl = "";
|
||||
if (checkDomain && Domain.Exists(HttpContext.Current.Request.ServerVariables["SERVER_NAME"]))
|
||||
{
|
||||
// we need to get the node based on domain
|
||||
INode n = new Node(Domain.GetRootFromDomain(HttpContext.Current.Request.ServerVariables["SERVER_NAME"]));
|
||||
domainUrl = n.UrlName; // we don't use niceUrlFetch as we need more control
|
||||
if (n.Parent != null)
|
||||
{
|
||||
while (n.Parent != null)
|
||||
{
|
||||
n = n.Parent;
|
||||
domainUrl = n.UrlName + "/" + domainUrl;
|
||||
}
|
||||
}
|
||||
domainUrl = "/" + domainUrl;
|
||||
|
||||
// If at domain root
|
||||
if (url == "")
|
||||
{
|
||||
_tempQuery = "";
|
||||
requestRawUrl = domainUrl.Split("/".ToCharArray());
|
||||
HttpContext.Current.Trace.Write("requestHandler",
|
||||
"Redirecting to domain: " +
|
||||
HttpContext.Current.Request.ServerVariables["SERVER_NAME"] +
|
||||
", nodeId: " +
|
||||
Domain.GetRootFromDomain(
|
||||
HttpContext.Current.Request.ServerVariables["SERVER_NAME"]).
|
||||
ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
// if it matches a domain url, skip all other xpaths and use this!
|
||||
string langXpath = CreateXPathQuery(domainUrl + "/" + url, false);
|
||||
if (content.Instance.XmlContent.DocumentElement.SelectSingleNode(langXpath) != null)
|
||||
return langXpath;
|
||||
}
|
||||
}
|
||||
else if (url == "" && !GlobalSettings.HideTopLevelNodeFromPath)
|
||||
_tempQuery += "/*";
|
||||
|
||||
bool rootAdded = false;
|
||||
if (GlobalSettings.HideTopLevelNodeFromPath && requestRawUrl.Length == 1)
|
||||
{
|
||||
HttpContext.Current.Trace.Write("umbracoRequestHandler", "xpath: '" + _tempQuery + "'");
|
||||
if (_tempQuery == "")
|
||||
_tempQuery = "/root" + GetChildContainerName() + "/*";
|
||||
_tempQuery = "/root" + GetChildContainerName() + "/* [" + UrlName +
|
||||
" = \"" + requestRawUrl[0].Replace(".aspx", "").ToLower() + "\"] | " + _tempQuery;
|
||||
HttpContext.Current.Trace.Write("umbracoRequestHandler", "xpath: '" + _tempQuery + "'");
|
||||
rootAdded = true;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i <= requestRawUrl.GetUpperBound(0); i++)
|
||||
{
|
||||
if (requestRawUrl[i] != "")
|
||||
_tempQuery += GetChildContainerName() + "/* [" + UrlName + " = \"" + requestRawUrl[i].Replace(".aspx", "").ToLower() +
|
||||
"\"]";
|
||||
}
|
||||
|
||||
if (GlobalSettings.HideTopLevelNodeFromPath && requestRawUrl.Length == 2)
|
||||
{
|
||||
_tempQuery += " | " + PageXPathQueryStart + GetChildContainerName() + "/* [" + UrlName + " = \"" +
|
||||
requestRawUrl[1].Replace(".aspx", "").ToLower() + "\"]";
|
||||
}
|
||||
HttpContext.Current.Trace.Write("umbracoRequestHandler", "xpath: '" + _tempQuery + "'");
|
||||
|
||||
Debug.Write(_tempQuery + "(" + PageXPathQueryStart + ")");
|
||||
|
||||
if (checkDomain)
|
||||
return _tempQuery;
|
||||
else if (!rootAdded)
|
||||
return PageXPathQueryStart + _tempQuery;
|
||||
else
|
||||
return _tempQuery;
|
||||
}
|
||||
|
||||
private static string GetChildContainerName()
|
||||
{
|
||||
if (string.IsNullOrEmpty(UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME) == false)
|
||||
return "/" + UmbracoSettings.TEMP_FRIENDLY_XML_CHILD_CONTAINER_NODENAME;
|
||||
return "";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+188
-188
@@ -1,189 +1,189 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FileUpload.ascx.cs" Inherits="uWiki.usercontrols.FileUpload" %>
|
||||
|
||||
|
||||
|
||||
<div class="notice" id="notLoggedIn" visible="false" runat="server">
|
||||
<h4 style="text-align: center;">
|
||||
Please <a href="/member/login">login</a> or <a href="/member/signup">sign up</a> to manage wiki attachments
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<asp:PlaceHolder ID="holder" runat="server" Visible="false">
|
||||
<script type="text/javascript">
|
||||
var swfu;
|
||||
|
||||
window.onload = function () {
|
||||
swfu = new SWFUpload({
|
||||
// Backend Settings
|
||||
upload_url: "/umbraco/wiki/upload.aspx",
|
||||
post_params: {
|
||||
"ASPSESSID": "<%=Session.SessionID %>",
|
||||
"NODEGUID": "<%= VersionGuid %>",
|
||||
"USERGUID": "<%= MemberGuid %>",
|
||||
"FILETYPE": jQuery("#wiki_fileType").val(),
|
||||
"UMBRACOVERSION": jQuery("#wiki_version").val()
|
||||
},
|
||||
|
||||
// Flash file settings
|
||||
file_size_limit: "10 MB",
|
||||
file_types: "*.*", // or you could use something like: "*.doc;*.wpd;*.pdf",
|
||||
file_types_description: "All Files",
|
||||
file_upload_limit: "0",
|
||||
file_queue_limit: "1",
|
||||
|
||||
// Event handler settings
|
||||
swfupload_loaded_handler: swfUploadLoaded,
|
||||
|
||||
file_dialog_start_handler: fileDialogStart,
|
||||
file_queued_handler: fileQueued,
|
||||
file_queue_error_handler: fileQueueError,
|
||||
file_dialog_complete_handler: fileDialogComplete,
|
||||
|
||||
//upload_start_handler : uploadStart, // I could do some client/JavaScript validation here, but I don't need to.
|
||||
upload_progress_handler: uploadProgress,
|
||||
upload_error_handler: uploadError,
|
||||
upload_success_handler: uploadSuccess,
|
||||
upload_complete_handler: uploadComplete,
|
||||
|
||||
// Button Settings
|
||||
button_image_url: "XPButtonUploadText_61x22.png",
|
||||
button_placeholder_id: "spanButtonPlaceholder",
|
||||
button_width: 161,
|
||||
button_height: 22,
|
||||
button_text: '<span class="button">Select file <span class="buttonSmall">(10 MB Max)</span></span>',
|
||||
button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold; color: #2244BB; text-decoration: underline; } .buttonSmall { font-size: 10pt; }',
|
||||
|
||||
|
||||
// Flash Settings
|
||||
flash_url: "/scripts/swfupload/swfupload.swf", // Relative to this file
|
||||
|
||||
custom_settings: {
|
||||
progress_target: "fsUploadProgress",
|
||||
upload_successful: false
|
||||
},
|
||||
|
||||
// Debug settings
|
||||
debug: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#wiki_fileType").change(function () {
|
||||
swfu.setPostParams({ ASPSESSID: "<%=Session.SessionID %>", NODEGUID: "<%= VersionGuid %>", USERGUID: "<%= MemberGuid %>", FILETYPE: jQuery("#wiki_fileType").val(), "UMBRACOVERSION": jQuery("#wiki_version").val() });
|
||||
})
|
||||
jQuery("#wiki_version").change(function () {
|
||||
swfu.setPostParams({ ASPSESSID: "<%=Session.SessionID %>", NODEGUID: "<%= VersionGuid %>", USERGUID: "<%= MemberGuid %>", FILETYPE: jQuery("#wiki_fileType").val(), "UMBRACOVERSION": jQuery("#wiki_version").val() });
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div class="form simpleForm" id="registrationForm">
|
||||
|
||||
|
||||
<asp:Repeater ID="rp_files" OnItemDataBound="OnFileBound" Visible="false" runat="server">
|
||||
<ItemTemplate>
|
||||
<tr>
|
||||
<td>
|
||||
<asp:Literal ID="lt_name" runat="server"></asp:Literal>
|
||||
</td>
|
||||
<td>
|
||||
<asp:Literal ID="lt_type" runat="server" />
|
||||
</td>
|
||||
<td>
|
||||
<asp:Literal ID="lt_version" runat="server" />
|
||||
</td>
|
||||
<td>
|
||||
<asp:Literal ID="lt_date" runat="server" />
|
||||
</td>
|
||||
<td>
|
||||
<asp:Button ID="bt_delete" runat="server" OnClientClick="return confirm('Are you sure you want to delete this file?')" OnCommand="DeleteFile" Text="Delete" />
|
||||
</td>
|
||||
</tr>
|
||||
</ItemTemplate>
|
||||
|
||||
<HeaderTemplate>
|
||||
<fieldset>
|
||||
<legend>Current project files</legend>
|
||||
<p>
|
||||
<table style="width: 600px">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>Type</th>
|
||||
<th>Compatible Version</th>
|
||||
<th>Uploaded</th>
|
||||
<th>Archive</th>
|
||||
<th>Delete</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</HeaderTemplate>
|
||||
<FooterTemplate>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
</fieldset>
|
||||
</FooterTemplate>
|
||||
|
||||
</asp:Repeater>
|
||||
|
||||
<fieldset>
|
||||
<legend>Upload file</legend>
|
||||
|
||||
<div id="swfu_container" style="margin: 0px 10px;">
|
||||
|
||||
<div id="swfu_controls">
|
||||
|
||||
<p>
|
||||
<label class="inputLabel">Pick file:</label>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<input type="text" id="txtFileName" disabled="true" class="title" /> <span id="spanButtonPlaceholder"></span>
|
||||
</div>
|
||||
|
||||
<div class="flash" id="fsUploadProgress">
|
||||
<!-- This is where the file progress gets shown. SWFUpload doesn't update the UI directly.
|
||||
The Handlers (in handlers.js) process the upload events and make the UI updates -->
|
||||
</div>
|
||||
<input type="hidden" name="hidFileID" id="hidFileID" value="" />
|
||||
<!-- This is where the file ID is stored after SWFUpload uploads the file and gets the ID back from upload.php -->
|
||||
</div>
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
<label class="inputLabel">Choose filetype</label>
|
||||
|
||||
<select id="wiki_fileType" class="title">
|
||||
<option value="package">Package</option>
|
||||
<option value="docs">Documentation</option>
|
||||
<option value="source">Source Code</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p id="pickVersion">
|
||||
<label class="inputLabel">Choose umbraco version</label>
|
||||
|
||||
<select id="wiki_version" class="title">
|
||||
<asp:literal ID="lt_versions" runat="server" />
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="button" value="Upload file" id="btn_submit" />
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</asp:PlaceHolder>
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FileUpload.ascx.cs" Inherits="uWiki.usercontrols.FileUpload" %>
|
||||
|
||||
|
||||
|
||||
<div class="notice" id="notLoggedIn" visible="false" runat="server">
|
||||
<h4 style="text-align: center;">
|
||||
Please <a href="/member/login">login</a> or <a href="/member/signup">sign up</a> to manage wiki attachments
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<asp:PlaceHolder ID="holder" runat="server" Visible="false">
|
||||
<script type="text/javascript">
|
||||
var swfu;
|
||||
|
||||
window.onload = function () {
|
||||
swfu = new SWFUpload({
|
||||
// Backend Settings
|
||||
upload_url: "/umbraco/wiki/upload.aspx",
|
||||
post_params: {
|
||||
"ASPSESSID": "<%=Session.SessionID %>",
|
||||
"NODEGUID": "<%= VersionGuid %>",
|
||||
"USERGUID": "<%= MemberGuid %>",
|
||||
"FILETYPE": jQuery("#wiki_fileType").val(),
|
||||
"UMBRACOVERSION": jQuery("#wiki_version").val()
|
||||
},
|
||||
|
||||
// Flash file settings
|
||||
file_size_limit: "10 MB",
|
||||
file_types: "*.*", // or you could use something like: "*.doc;*.wpd;*.pdf",
|
||||
file_types_description: "All Files",
|
||||
file_upload_limit: "0",
|
||||
file_queue_limit: "1",
|
||||
|
||||
// Event handler settings
|
||||
swfupload_loaded_handler: swfUploadLoaded,
|
||||
|
||||
file_dialog_start_handler: fileDialogStart,
|
||||
file_queued_handler: fileQueued,
|
||||
file_queue_error_handler: fileQueueError,
|
||||
file_dialog_complete_handler: fileDialogComplete,
|
||||
|
||||
//upload_start_handler : uploadStart, // I could do some client/JavaScript validation here, but I don't need to.
|
||||
upload_progress_handler: uploadProgress,
|
||||
upload_error_handler: uploadError,
|
||||
upload_success_handler: uploadSuccess,
|
||||
upload_complete_handler: uploadComplete,
|
||||
|
||||
// Button Settings
|
||||
button_image_url: "XPButtonUploadText_61x22.png",
|
||||
button_placeholder_id: "spanButtonPlaceholder",
|
||||
button_width: 161,
|
||||
button_height: 22,
|
||||
button_text: '<span class="button">Select file <span class="buttonSmall">(10 MB Max)</span></span>',
|
||||
button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: bold; color: #2244BB; text-decoration: underline; } .buttonSmall { font-size: 10pt; }',
|
||||
|
||||
|
||||
// Flash Settings
|
||||
flash_url: "/scripts/swfupload/swfupload.swf", // Relative to this file
|
||||
|
||||
custom_settings: {
|
||||
progress_target: "fsUploadProgress",
|
||||
upload_successful: false
|
||||
},
|
||||
|
||||
// Debug settings
|
||||
debug: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#wiki_fileType").change(function () {
|
||||
swfu.setPostParams({ ASPSESSID: "<%=Session.SessionID %>", NODEGUID: "<%= VersionGuid %>", USERGUID: "<%= MemberGuid %>", FILETYPE: jQuery("#wiki_fileType").val(), "UMBRACOVERSION": jQuery("#wiki_version").val() });
|
||||
})
|
||||
jQuery("#wiki_version").change(function () {
|
||||
swfu.setPostParams({ ASPSESSID: "<%=Session.SessionID %>", NODEGUID: "<%= VersionGuid %>", USERGUID: "<%= MemberGuid %>", FILETYPE: jQuery("#wiki_fileType").val(), "UMBRACOVERSION": jQuery("#wiki_version").val() });
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div class="form simpleForm" id="registrationForm">
|
||||
|
||||
|
||||
<asp:Repeater ID="rp_files" OnItemDataBound="OnFileBound" Visible="false" runat="server">
|
||||
<ItemTemplate>
|
||||
<tr>
|
||||
<td>
|
||||
<asp:Literal ID="lt_name" runat="server"></asp:Literal>
|
||||
</td>
|
||||
<td>
|
||||
<asp:Literal ID="lt_type" runat="server" />
|
||||
</td>
|
||||
<td>
|
||||
<asp:Literal ID="lt_version" runat="server" />
|
||||
</td>
|
||||
<td>
|
||||
<asp:Literal ID="lt_date" runat="server" />
|
||||
</td>
|
||||
<td>
|
||||
<asp:Button ID="bt_delete" runat="server" OnClientClick="return confirm('Are you sure you want to delete this file?')" OnCommand="DeleteFile" Text="Delete" />
|
||||
</td>
|
||||
</tr>
|
||||
</ItemTemplate>
|
||||
|
||||
<HeaderTemplate>
|
||||
<fieldset>
|
||||
<legend>Current project files</legend>
|
||||
<p>
|
||||
<table style="width: 600px">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>Type</th>
|
||||
<th>Compatible Version</th>
|
||||
<th>Uploaded</th>
|
||||
<th>Archive</th>
|
||||
<th>Delete</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</HeaderTemplate>
|
||||
<FooterTemplate>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
</fieldset>
|
||||
</FooterTemplate>
|
||||
|
||||
</asp:Repeater>
|
||||
|
||||
<fieldset>
|
||||
<legend>Upload file</legend>
|
||||
|
||||
<div id="swfu_container" style="margin: 0px 10px;">
|
||||
|
||||
<div id="swfu_controls">
|
||||
|
||||
<p>
|
||||
<label class="inputLabel">Pick file:</label>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<input type="text" id="txtFileName" disabled="true" class="title" /> <span id="spanButtonPlaceholder"></span>
|
||||
</div>
|
||||
|
||||
<div class="flash" id="fsUploadProgress">
|
||||
<!-- This is where the file progress gets shown. SWFUpload doesn't update the UI directly.
|
||||
The Handlers (in handlers.js) process the upload events and make the UI updates -->
|
||||
</div>
|
||||
<input type="hidden" name="hidFileID" id="hidFileID" value="" />
|
||||
<!-- This is where the file ID is stored after SWFUpload uploads the file and gets the ID back from upload.php -->
|
||||
</div>
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
<label class="inputLabel">Choose filetype</label>
|
||||
|
||||
<select id="wiki_fileType" class="title">
|
||||
<option value="package">Package</option>
|
||||
<option value="docs">Documentation</option>
|
||||
<option value="source">Source Code</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p id="pickVersion">
|
||||
<label class="inputLabel">Choose umbraco version</label>
|
||||
|
||||
<select id="wiki_version" class="title">
|
||||
<asp:literal ID="lt_versions" runat="server" />
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="button" value="Upload file" id="btn_submit" />
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</asp:PlaceHolder>
|
||||
|
||||
+107
-107
@@ -1,108 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using umbraco.presentation.nodeFactory;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
|
||||
namespace uWiki.usercontrols {
|
||||
public partial class FileUpload : System.Web.UI.UserControl {
|
||||
|
||||
public string MemberGuid = "";
|
||||
public string VersionGuid = "";
|
||||
private int pageId = 0;
|
||||
|
||||
private void RebindFiles()
|
||||
{
|
||||
List<uWiki.Businesslogic.WikiFile> files = uWiki.Businesslogic.WikiFile.CurrentFiles(pageId);
|
||||
|
||||
rp_files.DataSource = files;
|
||||
rp_files.Visible = (files.Count > 0);
|
||||
rp_files.DataBind();
|
||||
}
|
||||
|
||||
|
||||
protected void DeleteFile(object sender, CommandEventArgs e)
|
||||
{
|
||||
uWiki.Businesslogic.WikiFile wf = new uWiki.Businesslogic.WikiFile(int.Parse(e.CommandArgument.ToString()));
|
||||
//Member mem = Member.GetCurrentMember();
|
||||
|
||||
//if (wf.CreatedBy == mem.Id)
|
||||
wf.Delete();
|
||||
|
||||
RebindFiles();
|
||||
}
|
||||
|
||||
protected void OnFileBound(object sender, RepeaterItemEventArgs e)
|
||||
{
|
||||
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
|
||||
{
|
||||
uWiki.Businesslogic.WikiFile wf = (uWiki.Businesslogic.WikiFile)e.Item.DataItem;
|
||||
|
||||
Literal _name = (Literal)e.Item.FindControl("lt_name");
|
||||
Literal _date = (Literal)e.Item.FindControl("lt_date");
|
||||
Button _delete = (Button)e.Item.FindControl("bt_delete");
|
||||
Literal _version = (Literal)e.Item.FindControl("lt_version");
|
||||
|
||||
_name.Text = "<a href='" + wf.Path + "'>" + wf.Name + "</a>";
|
||||
_date.Text = wf.CreateDate.ToShortDateString() + " - " + wf.CreateDate.ToShortTimeString();
|
||||
_delete.CommandArgument = wf.Id.ToString();
|
||||
|
||||
if (wf.Versions != null)
|
||||
_version.Text = uWiki.Businesslogic.WikiFile.ToVersionString(wf.Versions);
|
||||
|
||||
if (Member.GetCurrentMember().Id == wf.CreatedBy || uWiki.Library.Utils.IsInGroup("admin"))
|
||||
_delete.Enabled = true;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (umbraco.library.IsLoggedOn())
|
||||
{
|
||||
pageId = umbraco.presentation.nodeFactory.Node.GetCurrent().Id;
|
||||
|
||||
|
||||
Member mem = Member.GetCurrentMember();
|
||||
Document d = new Document(pageId);
|
||||
|
||||
//if (n.GetProperty("owner") != null && n.GetProperty("owner").Value == mem.Id.ToString())
|
||||
//{
|
||||
holder.Visible = true;
|
||||
RebindFiles();
|
||||
|
||||
umbraco.library.RegisterJavaScriptFile("swfUpload", "/scripts/swfupload/SWFUpload.js");
|
||||
umbraco.library.RegisterJavaScriptFile("swfUpload_cb", "/scripts/swfupload/callbacks.js");
|
||||
umbraco.library.RegisterJavaScriptFile("swfUpload_progress", "/scripts/swfupload/fileprogress.js");
|
||||
|
||||
MemberGuid = mem.UniqueId.ToString();
|
||||
VersionGuid = d.Version.ToString();
|
||||
|
||||
string defaultVersion = uWiki.Businesslogic.UmbracoVersion.DefaultVersion().Version;
|
||||
string options = "";
|
||||
|
||||
foreach (uWiki.Businesslogic.UmbracoVersion uv in uWiki.Businesslogic.UmbracoVersion.AvailableVersions().Values)
|
||||
{
|
||||
string selected = "selected='true'";
|
||||
if (uv.Version != defaultVersion)
|
||||
selected = "";
|
||||
options += string.Format("<option value='{0}' {2}>{1}</option>", uv.Version, uv.Name, selected);
|
||||
}
|
||||
|
||||
lt_versions.Text = options;
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
notLoggedIn.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using umbraco.presentation.nodeFactory;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
|
||||
namespace uWiki.usercontrols {
|
||||
public partial class FileUpload : System.Web.UI.UserControl {
|
||||
|
||||
public string MemberGuid = "";
|
||||
public string VersionGuid = "";
|
||||
private int pageId = 0;
|
||||
|
||||
private void RebindFiles()
|
||||
{
|
||||
List<uWiki.Businesslogic.WikiFile> files = uWiki.Businesslogic.WikiFile.CurrentFiles(pageId);
|
||||
|
||||
rp_files.DataSource = files;
|
||||
rp_files.Visible = (files.Count > 0);
|
||||
rp_files.DataBind();
|
||||
}
|
||||
|
||||
|
||||
protected void DeleteFile(object sender, CommandEventArgs e)
|
||||
{
|
||||
uWiki.Businesslogic.WikiFile wf = new uWiki.Businesslogic.WikiFile(int.Parse(e.CommandArgument.ToString()));
|
||||
//Member mem = Member.GetCurrentMember();
|
||||
|
||||
//if (wf.CreatedBy == mem.Id)
|
||||
wf.Delete();
|
||||
|
||||
RebindFiles();
|
||||
}
|
||||
|
||||
protected void OnFileBound(object sender, RepeaterItemEventArgs e)
|
||||
{
|
||||
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
|
||||
{
|
||||
uWiki.Businesslogic.WikiFile wf = (uWiki.Businesslogic.WikiFile)e.Item.DataItem;
|
||||
|
||||
Literal _name = (Literal)e.Item.FindControl("lt_name");
|
||||
Literal _date = (Literal)e.Item.FindControl("lt_date");
|
||||
Button _delete = (Button)e.Item.FindControl("bt_delete");
|
||||
Literal _version = (Literal)e.Item.FindControl("lt_version");
|
||||
|
||||
_name.Text = "<a href='" + wf.Path + "'>" + wf.Name + "</a>";
|
||||
_date.Text = wf.CreateDate.ToShortDateString() + " - " + wf.CreateDate.ToShortTimeString();
|
||||
_delete.CommandArgument = wf.Id.ToString();
|
||||
|
||||
if (wf.Versions != null)
|
||||
_version.Text = uWiki.Businesslogic.WikiFile.ToVersionString(wf.Versions);
|
||||
|
||||
if (Member.GetCurrentMember().Id == wf.CreatedBy || uWiki.Library.Utils.IsInGroup("admin"))
|
||||
_delete.Enabled = true;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (umbraco.library.IsLoggedOn())
|
||||
{
|
||||
pageId = umbraco.presentation.nodeFactory.Node.GetCurrent().Id;
|
||||
|
||||
|
||||
Member mem = Member.GetCurrentMember();
|
||||
Document d = new Document(pageId);
|
||||
|
||||
//if (n.GetProperty("owner") != null && n.GetProperty("owner").Value == mem.Id.ToString())
|
||||
//{
|
||||
holder.Visible = true;
|
||||
RebindFiles();
|
||||
|
||||
umbraco.library.RegisterJavaScriptFile("swfUpload", "/scripts/swfupload/SWFUpload.js");
|
||||
umbraco.library.RegisterJavaScriptFile("swfUpload_cb", "/scripts/swfupload/callbacks.js");
|
||||
umbraco.library.RegisterJavaScriptFile("swfUpload_progress", "/scripts/swfupload/fileprogress.js");
|
||||
|
||||
MemberGuid = mem.UniqueId.ToString();
|
||||
VersionGuid = d.Version.ToString();
|
||||
|
||||
string defaultVersion = uWiki.Businesslogic.UmbracoVersion.DefaultVersion().Version;
|
||||
string options = "";
|
||||
|
||||
foreach (uWiki.Businesslogic.UmbracoVersion uv in uWiki.Businesslogic.UmbracoVersion.AvailableVersions().Values)
|
||||
{
|
||||
string selected = "selected='true'";
|
||||
if (uv.Version != defaultVersion)
|
||||
selected = "";
|
||||
options += string.Format("<option value='{0}' {2}>{1}</option>", uv.Version, uv.Name, selected);
|
||||
}
|
||||
|
||||
lt_versions.Text = options;
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
notLoggedIn.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
-51
@@ -1,51 +1,51 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 uWiki.usercontrols {
|
||||
|
||||
|
||||
public partial class FileUpload {
|
||||
|
||||
/// <summary>
|
||||
/// notLoggedIn 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.HtmlGenericControl notLoggedIn;
|
||||
|
||||
/// <summary>
|
||||
/// holder 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.PlaceHolder holder;
|
||||
|
||||
/// <summary>
|
||||
/// rp_files 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.Repeater rp_files;
|
||||
|
||||
/// <summary>
|
||||
/// lt_versions 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_versions;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 uWiki.usercontrols {
|
||||
|
||||
|
||||
public partial class FileUpload {
|
||||
|
||||
/// <summary>
|
||||
/// notLoggedIn 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.HtmlGenericControl notLoggedIn;
|
||||
|
||||
/// <summary>
|
||||
/// holder 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.PlaceHolder holder;
|
||||
|
||||
/// <summary>
|
||||
/// rp_files 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.Repeater rp_files;
|
||||
|
||||
/// <summary>
|
||||
/// lt_versions 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_versions;
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uPowers", "uPowers\uPowers.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "our.umbraco.org", "our.umbraco.org\our.umbraco.org.csproj", "{A625544F-660A-4C01-BA49-1B467D0322D9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uRepo", "uRepo\uRepo.csproj", "{47FD2B14-1653-4052-AD53-1871A8F85E0E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uEvents", "uEvents\uEvents.csproj", "{F356B339-296A-4594-81B6-CF69A802483E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Notification", "Notification\Notification.csproj", "{80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}"
|
||||
@@ -38,8 +36,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uRelease", "uRelease\uRelea
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uProject", "Marketplace\uProject.csproj", "{6A2B659E-8BAE-4CD5-8764-851DFBE95FBF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uWiki", "uWiki\uWiki.csproj", "{996601FA-5C0E-46A6-B39D-2863BADC80D8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OurUmbraco", "OurUmbraco\OurUmbraco.csproj", "{A8E5C936-ECAB-45B3-BFDA-D12F680EB2A6}"
|
||||
EndProject
|
||||
Global
|
||||
@@ -92,16 +88,6 @@ Global
|
||||
{A625544F-660A-4C01-BA49-1B467D0322D9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{A625544F-660A-4C01-BA49-1B467D0322D9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{A625544F-660A-4C01-BA49-1B467D0322D9}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{47FD2B14-1653-4052-AD53-1871A8F85E0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{47FD2B14-1653-4052-AD53-1871A8F85E0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{47FD2B14-1653-4052-AD53-1871A8F85E0E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{47FD2B14-1653-4052-AD53-1871A8F85E0E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{47FD2B14-1653-4052-AD53-1871A8F85E0E}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{47FD2B14-1653-4052-AD53-1871A8F85E0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{47FD2B14-1653-4052-AD53-1871A8F85E0E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{47FD2B14-1653-4052-AD53-1871A8F85E0E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{47FD2B14-1653-4052-AD53-1871A8F85E0E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{47FD2B14-1653-4052-AD53-1871A8F85E0E}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F356B339-296A-4594-81B6-CF69A802483E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
@@ -162,16 +148,6 @@ Global
|
||||
{6A2B659E-8BAE-4CD5-8764-851DFBE95FBF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{6A2B659E-8BAE-4CD5-8764-851DFBE95FBF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{6A2B659E-8BAE-4CD5-8764-851DFBE95FBF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{996601FA-5C0E-46A6-B39D-2863BADC80D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{996601FA-5C0E-46A6-B39D-2863BADC80D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{996601FA-5C0E-46A6-B39D-2863BADC80D8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{996601FA-5C0E-46A6-B39D-2863BADC80D8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{996601FA-5C0E-46A6-B39D-2863BADC80D8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{996601FA-5C0E-46A6-B39D-2863BADC80D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{996601FA-5C0E-46A6-B39D-2863BADC80D8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{996601FA-5C0E-46A6-B39D-2863BADC80D8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{996601FA-5C0E-46A6-B39D-2863BADC80D8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{996601FA-5C0E-46A6-B39D-2863BADC80D8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A8E5C936-ECAB-45B3-BFDA-D12F680EB2A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A8E5C936-ECAB-45B3-BFDA-D12F680EB2A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A8E5C936-ECAB-45B3-BFDA-D12F680EB2A6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
|
||||
@@ -418,6 +418,10 @@
|
||||
<Project>{6cf53d68-bd81-47bb-8f56-350a1b04f114}</Project>
|
||||
<Name>NotificationsWeb</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OurUmbraco\OurUmbraco.csproj">
|
||||
<Project>{a8e5c936-ecab-45b3-bfda-d12f680eb2a6}</Project>
|
||||
<Name>OurUmbraco</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\uDocumentation\uDocumentation.csproj">
|
||||
<Project>{2040BDAF-A804-462F-8D5F-CA0DF141BF89}</Project>
|
||||
<Name>uDocumentation</Name>
|
||||
@@ -438,14 +442,6 @@
|
||||
<Project>{c5b74e6a-abce-4a9a-896d-89c33fdafcd8}</Project>
|
||||
<Name>uRelease</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\uRepo\uRepo.csproj">
|
||||
<Project>{47fd2b14-1653-4052-ad53-1871a8f85e0e}</Project>
|
||||
<Name>uRepo</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\uWiki\uWiki.csproj">
|
||||
<Project>{996601fa-5c0e-46a6-b39d-2863badc80d8}</Project>
|
||||
<Name>uWiki</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="usercontrols\EventEditor.ascx">
|
||||
|
||||
+1
-15
@@ -239,23 +239,9 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="webservices\repository.asmx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Project.cs" />
|
||||
<Compile Include="Projects.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RepoStartupHandler.cs" />
|
||||
<Compile Include="StarterKit.cs" />
|
||||
<Compile Include="StarterKitController.cs" />
|
||||
<Compile Include="webservices\repository.asmx.cs">
|
||||
<DependentUpon>repository.asmx</DependentUpon>
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="webservices\App_Data\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
|
||||
+1
-26
@@ -233,34 +233,9 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Api\WikiController.cs" />
|
||||
<Compile Include="Businesslogic\Data.cs" />
|
||||
<Compile Include="Businesslogic\Events.cs" />
|
||||
<Compile Include="Businesslogic\UmbracoVersion.cs" />
|
||||
<Compile Include="Businesslogic\WikiFile.cs" />
|
||||
<Compile Include="Businesslogic\WikiHelpRequest.cs" />
|
||||
<Compile Include="Businesslogic\WikiPage.cs" />
|
||||
<Compile Include="iNotFoundHandler.cs" />
|
||||
<Compile Include="Library\Utils.cs" />
|
||||
<Compile Include="Library\xslt.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="usercontrols\FileUpload.ascx.cs">
|
||||
<DependentUpon>FileUpload.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="usercontrols\FileUpload.ascx.designer.cs">
|
||||
<DependentUpon>FileUpload.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WikiFileUploadHandler.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="usercontrols\FileUpload.ascx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="usercontrols\scripts\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
|
||||
Reference in New Issue
Block a user