Skip to content
This repository has been archived by the owner on Apr 30, 2018. It is now read-only.

Commit

Permalink
Fix logic for storages
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado-x committed Dec 10, 2014
1 parent ea0eac8 commit 0e4aafb
Show file tree
Hide file tree
Showing 14 changed files with 208 additions and 186 deletions.
2 changes: 1 addition & 1 deletion Site/DynamicData/FieldTemplates/FileImage.ascx.cs
Expand Up @@ -17,7 +17,7 @@ public override string FieldValueString
{
if (!url.ToLower().Contains("http://"))
{
url = Global.Context.FileStorageUrl + url;
url = Global.Context.StorageUrl + url;
}


Expand Down
2 changes: 1 addition & 1 deletion Site/DynamicData/FieldTemplates/FileImage_Edit.ascx
Expand Up @@ -2,7 +2,7 @@


<span class="thumbnail">
<asp:Image ID="ImageEdit" ImageUrl="<%# String.IsNullOrEmpty(FieldValueString) ? String.Empty : X.DynamicData.Core.Global.Context.FileStorageUrl + FieldValueString %>" runat="server" />
<asp:Image ID="ImageEdit" ImageUrl="<%# String.IsNullOrEmpty(FieldValueString) ? String.Empty : X.DynamicData.Core.Global.Context.StorageUrl + FieldValueString %>" runat="server" />
</span>

<br />
Expand Down
4 changes: 2 additions & 2 deletions Site/DynamicData/FieldTemplates/FileImage_Edit.ascx.cs
Expand Up @@ -69,7 +69,7 @@ protected override void OnDataBinding(EventArgs e)

if (!String.IsNullOrEmpty(fileName))
{
ImageEdit.ImageUrl = Global.Context.FileStorageUrl + fileName;
ImageEdit.ImageUrl = Global.Context.StorageUrl + fileName;
image_name.Value = fileName;
ImageEdit.Visible = true;
}
Expand All @@ -91,7 +91,7 @@ protected override void ExtractValues(IOrderedDictionary dictionary)
Global.UploadFile(FileUploadEdit.FileBytes, fileName);

image_name.Value = fileName;
ImageEdit.ImageUrl = Global.Context.FileStorageUrl + fileName;
ImageEdit.ImageUrl = Global.Context.StorageUrl + fileName;
}
catch (Exception ex)
{
Expand Down
2 changes: 1 addition & 1 deletion Site/DynamicData/FieldTemplates/FileUpload_Edit.ascx.cs
Expand Up @@ -32,7 +32,7 @@ protected override void OnDataBinding(EventArgs e)
: FieldValueString.Replace("&amp;", "&");

HyperLink1.Text = "Загрузить файл";
HyperLink1.NavigateUrl = Global.Context.FileStorageUrl + fileName;
HyperLink1.NavigateUrl = Global.Context.StorageUrl + fileName;

}

Expand Down
6 changes: 3 additions & 3 deletions Site/Properties/AssemblyInfo.cs
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Data Management System")]
[assembly: AssemblyCopyright("Copyright Ernado © 2014")]
[assembly: AssemblyCopyright("Copyright Andrew Gubskiy © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -31,5 +31,5 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.8.5.*")]
[assembly: AssemblyFileVersion("1.8.5.580")]
[assembly: AssemblyVersion("1.9.5.*")]
[assembly: AssemblyFileVersion("1.9.5.1000")]
2 changes: 0 additions & 2 deletions Site/Site.csproj
Expand Up @@ -601,8 +601,6 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="robots.txt" />
<Content Include="Scripts\bootbox.js" />
<Content Include="Scripts\bootbox.min.js" />
<Content Include="Scripts\bootstrap-datepicker.js" />
<Content Include="Scripts\bootstrap.js" />
<Content Include="Scripts\bootstrap.min.js" />
Expand Down
1 change: 0 additions & 1 deletion Site/System/Logs.aspx
Expand Up @@ -39,7 +39,6 @@
</div>
<!-- /.modal -->

<%--<a href="#" onclick="javascript:bootbox.alert('<%# Eval("Message") %>');"><%=Resources.Global.ShowMessage %></a>--%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
Expand Down
8 changes: 4 additions & 4 deletions Site/System/SystemInformation.aspx.cs
Expand Up @@ -39,12 +39,12 @@ protected override void OnLoad(EventArgs e)

OpenTable(sb, Resources.Global.Project);
AppendUrlLine(sb, Resources.Global.WebApplicationAddress, Global.Context.WebsiteUrl);
AppendLine(sb, Resources.Global.WebsiteStorageConnectionString, Global.Context.WebsiteStorageConnectionString);
AppendLine(sb, Resources.Global.WebsiteStorageConnectionString, Global.Context.ApplicationStorageConnectionString);
CloseTable(sb);

OpenTable(sb, Resources.Global.FileUploadPageTitle);
AppendLine(sb, Resources.Global.FileStorageConnectionString, Global.Context.FileStorageConnectionString);
AppendUrlLine(sb, Resources.Global.FileStorageUrl, Global.Context.FileStorageUrl);
AppendLine(sb, Resources.Global.FileStorageConnectionString, Global.Context.StorageConnectionString);
AppendUrlLine(sb, Resources.Global.FileStorageUrl, Global.Context.StorageUrl);
CloseTable(sb);

information.InnerHtml = sb.ToString();
Expand Down Expand Up @@ -72,7 +72,7 @@ private static void AppendUrlLine(StringBuilder sb, String title, String value)

private static void AppendLine(StringBuilder sb, String title, String value)
{
sb.AppendFormat("<tr><th scope=\"row\">{0}</th><td>{1}<td></tr>", title, value);
sb.AppendFormat("<tr><th scope=\"row\">{0}</th><td>{1}</td></tr>", title, value);
}
}
}
119 changes: 65 additions & 54 deletions Site/web .config.example
@@ -1,57 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>

<connectionStrings>
<add name="Entities" connectionString="" providerName="System.Data.EntityClient" />
<add name="Entities" connectionString="connection-string-here" providerName="System.Data.EntityClient" />
</connectionStrings>

<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="true" />
<add key="enableSimpleMembership" value="false" />
<add key="autoFormsAuthentication" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />

<add key="Title" value="" />
<add key="Logo" value="" />

<add key="WebsiteUrl" value="" />
<add key="WebsiteStorageConnectionString" value="" />

<add key="FileStorageConnectionString" value="" />
<add key="FileStorageUrl" value="" />

<add key="BlobContainerName" value="" />

<add key="ScaffoldAllTables" value="" />

<add key="DataContextAssemblyLocation" value="~/DAL.dll" />
<add key="title" value="Example Application" />
<add key="website-url" value="http://example.com/" />
<add key="storage-connection-string" value="c:\www\example.com\files" />
<add key="storage-url" value="http://example.com/files" />
<add key="application-storage-connection-string" value=""/>
<add key="scaffold-all-tables" value="false" />
<add key="show-logs-in-menu" value="true" />
<add key="logo" value="http://exmaple.com/logo.svg" />
<add key="data-context-assembly-location" value="C:\X\microkhim.com.ua\Site\bin\DAL.dll" />
</appSettings>

<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>

<system.web>
<httpRuntime requestValidationMode="2.0" targetFramework="4.5" />
<compilation targetFramework="4.5" debug="true" />
<roleManager enabled="true" />
<pages controlRenderingCompatibilityVersion="4.0">
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
<pages>
<controls>
<add tagPrefix="ef" assembly="Microsoft.AspNet.EntityDataSource" namespace="Microsoft.AspNet.EntityDataSource" />
</controls>
</pages>

<compilation debug="true" />

<authentication mode="Forms">
<forms name="auth" loginUrl="~/System/Login.aspx" protection="All" timeout="30">
<credentials passwordFormat="Clear">
Expand All @@ -60,15 +49,19 @@
</credentials>
</forms>
</authentication>

<membership defaultProvider="CredentialsMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="CredentialsMembershipProvider" type="X.Web.Security.CredentialsMembershipProvider" />
<add name="CredentialsMembershipProvider" type="X.Web.CredentialsMembershipProvider" />
</providers>
</membership>

<globalization uiCulture="ru" />

</system.web>
<system.webServer>

<!--<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
Expand All @@ -78,7 +71,7 @@
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</system.webServer>-->

<!--
AUTH START
Expand All @@ -90,23 +83,41 @@
AUTH END
-->

<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31BF3856AD364E35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31BF3856AD364E35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

</configuration>
4 changes: 2 additions & 2 deletions UnitTests/FtpFileUploadTests.cs
Expand Up @@ -20,8 +20,8 @@ public void TestFileUpload()
bytes = stream.ToArray();
}

X.DynamicData.Core.Global.Context.FileStorageConnectionString = "ftp://user:passrd@exmple.com";
X.DynamicData.Core.Global.Context.FileStorageUrl = "http://exmple.com/static/";
X.DynamicData.Core.Global.Context.StorageConnectionString = "ftp://user:passrd@exmple.com";
X.DynamicData.Core.Global.Context.StorageUrl = "http://exmple.com/static/";

var url = X.DynamicData.Core.Global.UploadFile(bytes, "test.txt");

Expand Down

0 comments on commit 0e4aafb

Please sign in to comment.