Merge branch '#94-FlexitimePolicyTab' into Release0.2
This commit is contained in:
commit
5b10b5d546
@ -55,7 +55,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CardDataPost.cs" />
|
||||
<Compile Include="CircularBuffer.cs" />
|
||||
<Compile Include="ConfigurationManager.cs" />
|
||||
<Compile Include="ConfigurationProperty.cs" />
|
||||
<Compile Include="ConfigurationType.cs" />
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
then
|
||||
echo "No arguments supplied, supply the base path"
|
||||
fi
|
||||
echo "Installing dependencies"
|
||||
@ -22,3 +22,4 @@ rm *.vshost.exe.config
|
||||
rm *.vshost.exe.manifest
|
||||
echo "Starting application........."
|
||||
service supervisor restart
|
||||
|
||||
|
||||
@ -58,12 +58,12 @@
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll</HintPath>
|
||||
<Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Extensions.Xml, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.Xml.3.2.0.0\lib\net45-full\Ninject.Extensions.Xml.dll</HintPath>
|
||||
<Reference Include="Ninject.Extensions.Xml, Version=3.3.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.Xml.3.3.0\lib\net45\Ninject.Extensions.Xml.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="pcsc-sharp, Version=3.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\CardReaderService\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
||||
@ -112,5 +112,9 @@ namespace Interfaces
|
||||
OperationResponse DeleteLog(TimeLog log);
|
||||
OperationResponse CreateLog(TimeLog log);
|
||||
OperationResponse UpdateLog(TimeLog log);
|
||||
|
||||
Policy GetPolicy();
|
||||
|
||||
void SavePolicy(Policy policy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@
|
||||
<Compile Include="IdentifierList.cs" />
|
||||
<Compile Include="ManualLog.cs" />
|
||||
<Compile Include="OperationResponse.cs" />
|
||||
<Compile Include="Policy.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TimeLog.cs" />
|
||||
<Compile Include="TimeLogList.cs" />
|
||||
|
||||
18
DataCenter_Windows/WindowsDataCenter/Interfaces/Policy.cs
Normal file
18
DataCenter_Windows/WindowsDataCenter/Interfaces/Policy.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Interfaces
|
||||
{
|
||||
public class Policy
|
||||
{
|
||||
public DateTime ChangeDate { get; set; }
|
||||
public string ChangeDescription { get; set; }
|
||||
public string ChangeAuthor { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string Markdown { get; set; }
|
||||
public string Html { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
using Interfaces;
|
||||
|
||||
namespace SQLiteRepository.Converters
|
||||
{
|
||||
static class IdentifierConverter
|
||||
{
|
||||
public static Identifier ConvertToIdentifierDto(CardUniqueId ident)
|
||||
{
|
||||
return new Identifier
|
||||
{
|
||||
Id = ident.Id,
|
||||
UniqueId = ident.CardUId,
|
||||
IsAssociatedToUser = ident.UserId_FK != Constants.UNASSIGNED_CARD_USER_ID,
|
||||
LastUsed = ident.LastUsed.DateTime
|
||||
};
|
||||
}
|
||||
|
||||
public static CardUniqueId ConvertFromIdentifierDto(Identifier ident, int userId)
|
||||
{
|
||||
return new CardUniqueId
|
||||
{
|
||||
CardUId = ident.UniqueId,
|
||||
Id = ident.Id,
|
||||
UserId_FK = userId,
|
||||
LastUsed = ident.LastUsed
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
using Interfaces;
|
||||
|
||||
namespace SQLiteRepository.Converters
|
||||
{
|
||||
static class PolicyConverter
|
||||
{
|
||||
public static Policy ConvertToPolicyDto(PolicyDb policyDb)
|
||||
{
|
||||
if (policyDb == null) return null;
|
||||
return new Policy
|
||||
{
|
||||
ChangeDescription = policyDb.ChangeDescription,
|
||||
ChangeDate = policyDb.ChangeDate.UtcDateTime,
|
||||
Html = policyDb.Html,
|
||||
Version = policyDb.Version,
|
||||
ChangeAuthor = policyDb.ChangeAuthor,
|
||||
Markdown = policyDb.Markdown
|
||||
};
|
||||
}
|
||||
|
||||
public static PolicyDb ConvertFromPolicyDto(Policy policy)
|
||||
{
|
||||
if (policy == null) return null;
|
||||
return new PolicyDb
|
||||
{
|
||||
ChangeDescription = policy.ChangeDescription,
|
||||
ChangeDate = policy.ChangeDate,
|
||||
Html = policy.Html,
|
||||
Version = policy.Version,
|
||||
ChangeAuthor = policy.ChangeAuthor,
|
||||
Markdown = policy.Markdown
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -29,29 +29,4 @@ namespace SQLiteRepository.Converters
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static class IdentifierConverter
|
||||
{
|
||||
public static Identifier ConvertToIdentifierDto(CardUniqueId ident)
|
||||
{
|
||||
return new Identifier
|
||||
{
|
||||
Id = ident.Id,
|
||||
UniqueId = ident.CardUId,
|
||||
IsAssociatedToUser = ident.UserId_FK != Constants.UNASSIGNED_CARD_USER_ID,
|
||||
LastUsed = ident.LastUsed.DateTime
|
||||
};
|
||||
}
|
||||
|
||||
public static CardUniqueId ConvertFromIdentifierDto(Identifier ident, int userId)
|
||||
{
|
||||
return new CardUniqueId
|
||||
{
|
||||
CardUId = ident.UniqueId,
|
||||
Id = ident.Id,
|
||||
UserId_FK = userId,
|
||||
LastUsed = ident.LastUsed
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SQLite.Net.Attributes;
|
||||
|
||||
namespace SQLiteRepository
|
||||
{
|
||||
internal class PolicyDb
|
||||
{
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public int Id { get; set; }
|
||||
public DateTimeOffset ChangeDate { get; set; }
|
||||
|
||||
public string ChangeDescription { get; set; }
|
||||
|
||||
public string ChangeAuthor { get; set; }
|
||||
|
||||
public string Version { get; set; }
|
||||
|
||||
public string Markdown { get; set; }
|
||||
|
||||
public string Html { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@ namespace SQLiteRepository
|
||||
internal static class SQLiteProcedures
|
||||
{
|
||||
public const string GET_LOGS_IN_LAST_X_MINUTES =
|
||||
"select * from TimeLogDb where " + nameof(TimeLogDb.SwipeEventDateTime) + " > ? AND " +
|
||||
"select * from " + nameof(TimeLogDb) + " where " + nameof(TimeLogDb.SwipeEventDateTime) + " > ? AND " +
|
||||
nameof(TimeLogDb.UserId_FK) + "=?";
|
||||
|
||||
public const string GET_TIMELOGS =
|
||||
@ -108,7 +108,7 @@ namespace SQLiteRepository
|
||||
"on ujdb." + nameof(UserGroupJoinDb.GroupId_FK) + " = gp." + nameof(GroupDb.GroupId) +
|
||||
" group by gp." + nameof(GroupDb.GroupId);
|
||||
|
||||
public const string GET_GROUPS_FOR_USER = "select gdb." + nameof(GroupDb.GroupId) + ", gdb." + nameof(GroupDb.GroupName) + ", gdb.AssignedUserCount" +
|
||||
public const string GET_GROUPS_FOR_USER = "select gdb." + nameof(GroupDb.GroupId) + ", gdb." + nameof(GroupDb.GroupName) + ", gdb." + nameof(GroupDb.AssignedUserCount) + "" +
|
||||
" from " + nameof(GroupDb) + " gdb" +
|
||||
" left join " + nameof(UserGroupJoinDb) + " ujdb" +
|
||||
" on gdb." + nameof(GroupDb.GroupId) + " = ujdb." + nameof(UserGroupJoinDb.GroupId_FK) +
|
||||
@ -141,7 +141,7 @@ namespace SQLiteRepository
|
||||
+ nameof(TimeLogDb.Source) + "=? "
|
||||
+ "where " + nameof(TimeLogDb.Id) + "=?";
|
||||
|
||||
public const string GET_DB_VERSION = "select * from DbVersion";
|
||||
public const string GET_DB_VERSION = "select * from " + nameof(DbVersion);
|
||||
|
||||
/// <summary>
|
||||
/// This works on the tokenisation of the query string.
|
||||
|
||||
@ -38,6 +38,8 @@ namespace SQLiteRepository
|
||||
_connection.CreateTable<GroupDb>();
|
||||
_connection.CreateTable<UserGroupJoinDb>();
|
||||
_connection.CreateTable<DbVersion>();
|
||||
_connection.CreateTable<PolicyDb>();
|
||||
|
||||
_logger.Trace("Initialised SQLite Repository");
|
||||
_logger.Trace("Checking For Upgrades");
|
||||
CheckForDbUpgrade();
|
||||
@ -520,6 +522,34 @@ namespace SQLiteRepository
|
||||
return OperationResponse.UPDATED;
|
||||
}
|
||||
|
||||
public Policy GetPolicy()
|
||||
{
|
||||
var query = $"select * from {nameof(PolicyDb)}";
|
||||
var policies = _connection.Query<PolicyDb>(query);
|
||||
|
||||
|
||||
return PolicyConverter.ConvertToPolicyDto(policies.OrderByDescending(x => x.Version).FirstOrDefault());
|
||||
}
|
||||
|
||||
public void SavePolicy(Policy policy)
|
||||
{
|
||||
if (string.IsNullOrEmpty(policy.Version))
|
||||
{
|
||||
policy.Version = (GetNextPolicyVersion()+1).ToString();
|
||||
}
|
||||
var policyDb = PolicyConverter.ConvertFromPolicyDto(policy);
|
||||
_connection.Insert(policyDb);
|
||||
}
|
||||
|
||||
private int GetNextPolicyVersion()
|
||||
{
|
||||
var query = $"select Max({nameof(PolicyDb.Id)}) from {nameof(PolicyDb)}";
|
||||
|
||||
var id = _connection.ExecuteScalar<int>(query);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
private int GetUserCount()
|
||||
{
|
||||
return _connection.ExecuteScalar<int>(SQLiteProcedures.GET_TOTAL_USER_COUNT);
|
||||
|
||||
@ -78,14 +78,17 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CardUniqueId.cs" />
|
||||
<Compile Include="Converters\IdentifierConverter.cs" />
|
||||
<Compile Include="Converters\LogDirectionConverter.cs" />
|
||||
<Compile Include="Converters\LogSourceConverter.cs" />
|
||||
<Compile Include="Converters\PolicyConverter.cs" />
|
||||
<Compile Include="Converters\TimeLogConverter.cs" />
|
||||
<Compile Include="Converters\UserConverter.cs" />
|
||||
<Compile Include="DBVersion.cs" />
|
||||
<Compile Include="Extensions\Extensions.cs" />
|
||||
<Compile Include="GroupDb.cs" />
|
||||
<Compile Include="LogSourceDb.cs" />
|
||||
<Compile Include="PolicyDb.cs" />
|
||||
<Compile Include="SQLiteRepository.cs" />
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@ -106,10 +109,10 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<EmbeddedResource Include="UpgradeScripts\0.2.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="UpgradeScripts\0.2.sql" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets')" />
|
||||
|
||||
@ -0,0 +1,66 @@
|
||||
[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(WindowsDataCenter.App_Start.NinjectWebCommon), "Start")]
|
||||
[assembly: WebActivatorEx.ApplicationShutdownMethodAttribute(typeof(WindowsDataCenter.App_Start.NinjectWebCommon), "Stop")]
|
||||
|
||||
namespace WindowsDataCenter.App_Start
|
||||
{
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
|
||||
|
||||
using Ninject;
|
||||
using Ninject.Web.Common;
|
||||
using Ninject.Web.Common.WebHost;
|
||||
|
||||
public static class NinjectWebCommon
|
||||
{
|
||||
private static readonly Bootstrapper bootstrapper = new Bootstrapper();
|
||||
|
||||
/// <summary>
|
||||
/// Starts the application
|
||||
/// </summary>
|
||||
public static void Start()
|
||||
{
|
||||
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
|
||||
DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
|
||||
bootstrapper.Initialize(CreateKernel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the application.
|
||||
/// </summary>
|
||||
public static void Stop()
|
||||
{
|
||||
bootstrapper.ShutDown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the kernel that will manage your application.
|
||||
/// </summary>
|
||||
/// <returns>The created kernel.</returns>
|
||||
private static IKernel CreateKernel()
|
||||
{
|
||||
var kernel = new StandardKernel();
|
||||
try
|
||||
{
|
||||
kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
|
||||
kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
|
||||
RegisterServices(kernel);
|
||||
return kernel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
kernel.Dispose();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load your modules or register your services here!
|
||||
/// </summary>
|
||||
/// <param name="kernel">The kernel.</param>
|
||||
private static void RegisterServices(IKernel kernel)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using System.Reflection;
|
||||
using System.Web.Http;
|
||||
using WindowsDataCenter.Helpers;
|
||||
using Interfaces;
|
||||
|
||||
namespace WindowsDataCenter
|
||||
@ -7,6 +8,12 @@ namespace WindowsDataCenter
|
||||
[RoutePrefix("api/app")]
|
||||
public class ApplicationController:ApiController
|
||||
{
|
||||
private IRepository _repo;
|
||||
public ApplicationController(IRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
[Route("")]
|
||||
public IHttpActionResult GetAppDetails()
|
||||
{
|
||||
@ -22,5 +29,23 @@ namespace WindowsDataCenter
|
||||
|
||||
return Ok(appDetails);
|
||||
}
|
||||
|
||||
[Route("policy")]
|
||||
[HttpGet]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult GetPolicy()
|
||||
{
|
||||
Policy policy = _repo.GetPolicy();
|
||||
return Json(policy);
|
||||
}
|
||||
|
||||
[Route("policy")]
|
||||
[HttpPost]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult SavePolicy(Policy policy)
|
||||
{
|
||||
_repo.SavePolicy(policy);
|
||||
return Ok(new {}); //empty to ensure ajax triggers Success..
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,12 +58,16 @@
|
||||
<DocumentationFile>bin\ReleaseInstallers\WindowsDataCenter.XML</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Castle.Core.4.2.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="DalSoft.WebApi.HelpPage, Version=0.0.7.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DalSoft.WebApi.HelpPage.0.0.7.0\lib\net451\DalSoft.WebApi.HelpPage.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.1.0\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.FileSystems, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
@ -90,36 +94,44 @@
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll</HintPath>
|
||||
<Reference Include="Ninject, Version=3.3.4.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.3.3.4\lib\net45\Ninject.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Extensions.ContextPreservation, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.ContextPreservation.3.2.0.0\lib\net45-full\Ninject.Extensions.ContextPreservation.dll</HintPath>
|
||||
<Reference Include="Ninject.Extensions.ContextPreservation, Version=3.3.1.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.ContextPreservation.3.3.1\lib\net45\Ninject.Extensions.ContextPreservation.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Extensions.NamedScope, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.NamedScope.3.2.0.0\lib\net45-full\Ninject.Extensions.NamedScope.dll</HintPath>
|
||||
<Reference Include="Ninject.Extensions.Factory, Version=3.3.2.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Extensions.Xml, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.Xml.3.2.0.0\lib\net45-full\Ninject.Extensions.Xml.dll</HintPath>
|
||||
<Reference Include="Ninject.Extensions.NamedScope, Version=3.3.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.NamedScope.3.3.0\lib\net45\Ninject.Extensions.NamedScope.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.Common, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.Common.3.2.3.0\lib\net45-full\Ninject.Web.Common.dll</HintPath>
|
||||
<Reference Include="Ninject.Extensions.Xml, Version=3.3.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Extensions.Xml.3.3.0\lib\net45\Ninject.Extensions.Xml.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.Common.OwinHost, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.Common.OwinHost.3.2.3.0\lib\net45-full\Ninject.Web.Common.OwinHost.dll</HintPath>
|
||||
<Reference Include="Ninject.Web.Common, Version=3.3.1.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.Common.3.3.1\lib\net45\Ninject.Web.Common.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.WebApi, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.WebApi.3.2.4.0\lib\net45-full\Ninject.Web.WebApi.dll</HintPath>
|
||||
<Reference Include="Ninject.Web.Common.OwinHost, Version=3.3.1.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.Common.OwinHost.3.3.1\lib\net45\Ninject.Web.Common.OwinHost.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.WebApi.OwinHost, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.WebApi.OwinHost.3.2.4.0\lib\net45-full\Ninject.Web.WebApi.OwinHost.dll</HintPath>
|
||||
<Reference Include="Ninject.Web.Common.WebHost, Version=3.3.1.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.Common.WebHost.3.3.1\lib\net45\Ninject.Web.Common.WebHost.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.WebApi, Version=3.3.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.WebApi.3.3.0\lib\net45\Ninject.Web.WebApi.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.WebApi.OwinHost, Version=3.3.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Ninject.Web.WebApi.OwinHost.3.3.0\lib\net45\Ninject.Web.WebApi.OwinHost.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
@ -155,6 +167,10 @@
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.0.0\lib\net45\System.Web.Http.WebHost.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Razor.3.0.0\lib\net45\System.Web.Razor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@ -163,11 +179,12 @@
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WebActivatorEx, Version=2.0.0.0, Culture=neutral, PublicKeyToken=7b26dc2a43f6a0d4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\WebActivatorEx.2.0\lib\net40\WebActivatorEx.dll</HintPath>
|
||||
<HintPath>..\packages\WebActivatorEx.2.2.0\lib\net40\WebActivatorEx.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App_Start\Ninject.Web.Common.cs" />
|
||||
<Compile Include="CardData.cs" />
|
||||
<Compile Include="Controllers\ApplicationController.cs" />
|
||||
<Compile Include="Controllers\CardsController.cs" />
|
||||
@ -197,6 +214,9 @@
|
||||
<Compile Include="Controllers\ValuesController.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Help\DalSoft.WebApi.HelpPage.Views\HelpPage.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Minifier\MinifierConfig.xml" />
|
||||
<Content Include="NinjectConfig.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
@ -222,6 +242,9 @@
|
||||
<Content Include="www\css\bootstrap.min.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="www\css\highlightjs.min.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="www\css\knockout.contextmenu.css">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -246,9 +269,27 @@
|
||||
<Content Include="www\js\bootstrap.min.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="www\css\easymde.min.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="www\js\easymde.min.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="www\js\highlightjs.min.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="www\js\htmlparser.min.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="www\js\knockout.contextmenu.js">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="www\js\marked.min.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="www\js\PolicyObject.js">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="www\spa.css">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -310,9 +351,6 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Help\DalSoft.WebApi.HelpPage.Views\HelpPage.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="sqlite3.def" />
|
||||
<Content Include="sqlite3.dll" />
|
||||
</ItemGroup>
|
||||
@ -331,6 +369,9 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>call "$(ProjectDir)Minifier\Minify.bat" "$(SolutionDir)"</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
@ -338,9 +379,6 @@
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets'))" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>call "$(ProjectDir)Minifier\Minify.bat" "$(SolutionDir)"</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- 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.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@ -23,10 +23,11 @@
|
||||
<package id="Ninject.Extensions.Xml" version="3.3.0" targetFramework="net452" />
|
||||
<package id="Ninject.Web.Common" version="3.3.1" targetFramework="net452" />
|
||||
<package id="Ninject.Web.Common.OwinHost" version="3.3.1" targetFramework="net452" />
|
||||
<package id="Ninject.Web.Common.WebHost" version="3.3.1" targetFramework="net452" />
|
||||
<package id="Ninject.Web.WebApi" version="3.3.0" targetFramework="net452" />
|
||||
<package id="Ninject.Web.WebApi.OwinHost" version="3.3.0" targetFramework="net452" />
|
||||
<package id="Owin" version="1.0" targetFramework="net452" />
|
||||
<package id="RazorEngine" version="3.7.2" targetFramework="net452" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.104.0" targetFramework="net452" />
|
||||
<package id="WebActivatorEx" version="2.0" targetFramework="net452" />
|
||||
<package id="WebActivatorEx" version="2.2.0" targetFramework="net452" />
|
||||
</packages>
|
||||
@ -9,8 +9,11 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.0.0/knockout-min.js" type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/momentjs/2.10.6/moment.min.js" type="text/javascript"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/sammy.js/0.7.6/sammy.js" type="text/javascript"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="css/easymde.min.css" />
|
||||
<link rel="stylesheet" href="css/highlightjs.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-default">
|
||||
@ -37,14 +40,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="GroupAdminPage" class="container">
|
||||
<div id="GroupAdminPage" class="container">
|
||||
<div class="row">
|
||||
<h2 class="col-md-4">Groups</h2>
|
||||
<button class="col-md-1 btn btn-default pull-right" style="margin-top: 20px;" data-bind="click: $root.newGroupForm">
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</button>
|
||||
</div>
|
||||
<hr/>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div data-bind="with: groupsList, css:{'col-md-8': !$root.groupFormHidden(), 'col-md-12':$root.groupFormHidden()}">
|
||||
<table class="table table-striped">
|
||||
@ -68,15 +71,17 @@
|
||||
<input type="hidden" name="id" data-bind="value: Id">
|
||||
<div class="form-group">
|
||||
<label for="groupNameEdit">Group Name</label>
|
||||
<input for="Name" type="text" class="form-control" id="groupNameEdit" placeholder="Group Name" data-bind="value: Name"/>
|
||||
<input for="Name" type="text" class="form-control" id="groupNameEdit" placeholder="Group Name" data-bind="value: Name" />
|
||||
</div>
|
||||
<button pageDestination="Users" class="btn btn-secondary" type="button"
|
||||
data-bind="click: $root.hideGroupForm">Cancel</button>
|
||||
data-bind="click: $root.hideGroupForm">
|
||||
Cancel
|
||||
</button>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="CardManagement" class="container">
|
||||
<div class="row">
|
||||
<h2 class="col-md-4">Unassigned Cards</h2>
|
||||
@ -103,7 +108,64 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="PolicyManagement" class="container">
|
||||
<div id="row">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#edit" data-toggle="tab">Edit</a></li>
|
||||
<li><a href="#preview" data-toggle="tab">Preview</a></li>
|
||||
</ul>
|
||||
<div class="tab-content" style="max-height: 500px; min-height: 400px;overflow-y: auto">
|
||||
<div id="edit" class="tab-pane fade in active">
|
||||
<textarea id="policyEditor"></textarea>
|
||||
</div>
|
||||
<div id="preview" class="tab-pane fade in">
|
||||
<div data-bind="html: policyData.html" class="well-lg"></div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary pull-right" data-toggle="modal" data-target="#saveDialog">Save</button><!--data-bind="click: $root.policySave"-->
|
||||
<button class="btn btn-secondary pull-right" data-bind="click: $root.policyReload">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="saveDialog" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4>Change Details</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Change Author</th>
|
||||
<td><input class="form-control" id="changeAuthorInput" type="text" data-bind="value: policyData.ChangeAuthor" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Change Date</th>
|
||||
<td><input class="form-control" id="changeDatePicker" type="datetime-local" data-bind="value: policyData.ChangeDate" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Version</th>
|
||||
<td><input class="form-control" id="versionInput" type="text" data-bind="value: policyData.Version" readonly /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Change Description</th>
|
||||
<td><input class="form-control" id="changeDescription" type="text" data-bind="value: policyData.ChangeDescription" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary pull-right" data-bind="click: $root.policySave">Save</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="js/PolicyObject.js" type="text/javascript"></script>
|
||||
<script src="Helpers.min.js" type="text/javascript"></script>
|
||||
<script src="js/easymde.min.js" type="text/javascript"></script>
|
||||
<script src="js/highlightjs.min.js" type="text/javascript"></script>
|
||||
<script src="js/htmlparser.min.js" type="text/javascript"></script>
|
||||
<script src="js/marked.min.js"></script>
|
||||
<script src="admin.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
@ -4,6 +4,70 @@
|
||||
self.groupEditItem = ko.observable(null);
|
||||
self.unassignedCardList = ko.observable(null);
|
||||
self.helpers = new Helpers();
|
||||
self.policyMarkdown = "";
|
||||
self.policyData = new policy();
|
||||
self.renderer = new marked.Renderer();
|
||||
self.renderer.blockquote = function(quote) {
|
||||
return "<blockquote class=\"blockquote\">" + quote + "</blockquote>";
|
||||
};
|
||||
self.renderer.heading = function (text, level) {
|
||||
|
||||
var parserHandler = new Tautologistics.NodeHtmlParser.DefaultHandler(function (error) {
|
||||
if (error)
|
||||
throw new Error("Cannot parse \"" + text + "\" in markdown file.");
|
||||
});
|
||||
var parser = new Tautologistics.NodeHtmlParser.Parser(parserHandler);
|
||||
|
||||
parser.parseComplete(text);
|
||||
var escaped = "unknown";
|
||||
|
||||
if (parserHandler.dom.length > 0) {
|
||||
escaped = parserHandler.dom[0].raw.toLowerCase().trim().replace(/ /g, "-");
|
||||
}
|
||||
|
||||
return "<h" + level + " id=\"" + escaped + "\">"
|
||||
// NOTE: We're setting display none INLINE, so you have
|
||||
// to override with !important if you want it to show.
|
||||
+ " <a class=\"heading-anchor\" style=\"display:none;\" href=\"#" + escaped + '">'
|
||||
+ " <i class=\"oi oi-link-intact\"></i>"
|
||||
+ " </a>"
|
||||
+ text
|
||||
+ "</h" + level + ">";
|
||||
};
|
||||
self.renderer.table = function(header, body) {
|
||||
return "<table class=\"table\">" +
|
||||
"<thead class=\"thead-default\">" +
|
||||
header +
|
||||
"</thead>" +
|
||||
"<tbody>" +
|
||||
body +
|
||||
"</tbody>" +
|
||||
"</table>";
|
||||
};
|
||||
/*
|
||||
* Adds highlight.js classes to `code` blocks
|
||||
*/
|
||||
self.renderer.code = function(code, language) {
|
||||
|
||||
var valid = !!(language && hljs.getLanguage(language));
|
||||
var highlighted = valid ? hljs.highlight(language, code).value : code
|
||||
|
||||
return "<pre><code class=\"hljs lang-" + language + "\">" + highlighted + "</code></pre>";
|
||||
};
|
||||
self.editor = new EasyMDE({
|
||||
element: document.getElementById("policyEditor"),
|
||||
showIcons: ["bold", "italic", "strikethrough", "heading", "heading-smaller", "heading-bigger", "heading-1", "heading-2", "heading-3", "code", "quote", "unordered-list", "ordered-list", "clean-block", "link", "table", "horizontal-rule", "guide", "table"],
|
||||
hideIcons: ["preview", "side-by-side", "fullscreen"],
|
||||
renderingConfig: {
|
||||
markedOptions: {
|
||||
renderer: self.renderer
|
||||
}
|
||||
}
|
||||
});
|
||||
self.editor.codemirror.on("changes",
|
||||
function () {
|
||||
self.policyData.html(self.editor.options.previewRender(self.editor.value()));
|
||||
});
|
||||
self.uiPages = {
|
||||
overview: "overview",
|
||||
group: "groups",
|
||||
@ -14,7 +78,9 @@
|
||||
getGroups: "/api/groups",
|
||||
editGroup: "/api/groups/edit",
|
||||
getUnassignedCards: "/api/cards/unassigned",
|
||||
clearUnassignedCards: "/api/cards/unassigned"
|
||||
clearUnassignedCards: "/api/cards/unassigned",
|
||||
getPolicy:"/api/app/policy",
|
||||
savePolicy:"/api/app/policy"
|
||||
};
|
||||
self.clearGroupForm = function () {
|
||||
self.helpers.goToMenuOption(self.uiPages.group);
|
||||
@ -50,7 +116,7 @@
|
||||
false);
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'DELETE',
|
||||
type: "DELETE",
|
||||
success: function () {
|
||||
console.log("deleted " + groupId);
|
||||
self.hideGroupForm();
|
||||
@ -100,6 +166,34 @@
|
||||
self.padNumber = function (number) {
|
||||
return (number < 10 ? "0" : "") + number;
|
||||
};
|
||||
self.policySave = function () {
|
||||
var url = self.helpers.createRequestUrl(self.apiEndpoints.savePolicy, null, false);
|
||||
self.policyData.Markdown(self.editor.value()); //make sure we update it, as it doesnt push the value back into the variable
|
||||
//console.log(self.policyData());
|
||||
$.post(url, self.policyData(), function() {
|
||||
}, "json") //todo: check this serialisation as the object is now complex.
|
||||
.done(function() {
|
||||
self.policyReload();
|
||||
}).fail(function(resp, status, error) {
|
||||
var errorObj = self.helpers.processRequestFailure(resp, status, error);
|
||||
console.log(errorObj);
|
||||
});
|
||||
};
|
||||
self.policyReload = function() {
|
||||
var url = self.helpers.createRequestUrl(self.apiEndpoints.getPolicy,
|
||||
[], false, false);
|
||||
$.getJSON(url, function (res) {
|
||||
//console.log(res);
|
||||
self.editor.value(res.Markdown);
|
||||
res.Version = (parseInt(res.Version) + 1).toString();
|
||||
self.policyData.update(res);
|
||||
$('#saveDialog').modal('hide');
|
||||
}).fail(function (resp, status, error) {
|
||||
console.log("error - policyReload");
|
||||
var errObj = self.helpers.processRequestFailure(resp, status, error);
|
||||
self.assignErrorObject(errObj.errorCode, errObj.errorMessage, "policyReload");
|
||||
});
|
||||
};
|
||||
self.convertToDisplayDateTime = function (dateValue) {
|
||||
var date = new Date(dateValue); // dd MM YY HH:mm:ss e.g.: 01 Mar 17 17:34:02
|
||||
return date.getDate() + " "
|
||||
@ -114,6 +208,7 @@
|
||||
this.get("#overview", function () {
|
||||
self.getGroups();
|
||||
self.getUnassignedCardData();
|
||||
self.policyReload();
|
||||
});
|
||||
this.post("#editgroup", function () {
|
||||
self.submitGroupEdit(self.groupEditItem());
|
||||
|
||||
File diff suppressed because one or more lines are too long
7
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/css/easymde.min.css
vendored
Normal file
7
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/css/easymde.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/css/highlightjs.min.css
vendored
Normal file
1
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/css/highlightjs.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.hljs{display:block;overflow-x:auto;padding:.5em;background:#F0F0F0}.hljs,.hljs-subst{color:#444}.hljs-comment{color:#888888}.hljs-keyword,.hljs-attribute,.hljs-selector-tag,.hljs-meta-keyword,.hljs-doctag,.hljs-name{font-weight:bold}.hljs-type,.hljs-string,.hljs-number,.hljs-selector-id,.hljs-selector-class,.hljs-quote,.hljs-template-tag,.hljs-deletion{color:#880000}.hljs-title,.hljs-section{color:#880000;font-weight:bold}.hljs-regexp,.hljs-symbol,.hljs-variable,.hljs-template-variable,.hljs-link,.hljs-selector-attr,.hljs-selector-pseudo{color:#BC6060}.hljs-literal{color:#78A960}.hljs-built_in,.hljs-bullet,.hljs-code,.hljs-addition{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta-string{color:#4d99bf}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold}
|
||||
@ -303,6 +303,11 @@
|
||||
</menu>-->
|
||||
</div>
|
||||
|
||||
<div class="container" data-bind="with: policyData">
|
||||
<div class="row" data-bind="html:Html">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="aboutDialog" class="modal fade" role="dialog" data-bind="with: appDetails">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
function policy(data) {
|
||||
var self = this;
|
||||
if (typeof data === "undefined") {
|
||||
data = createDefaultPolicy();
|
||||
}
|
||||
self.changeDate = ko.observable(data.changeDate);
|
||||
self.description = ko.observable(data.description);
|
||||
self.changeAuthor = ko.observable(data.changeAuthor);
|
||||
self.version = ko.observable(data.version);
|
||||
self.markdown = ko.observable(data.markdown);
|
||||
self.html = ko.observable(data.html);
|
||||
function createDefaultPolicy() {
|
||||
return {
|
||||
changeDate: moment().format(),
|
||||
description: "",
|
||||
changeAuthor: "",
|
||||
version: -1,
|
||||
markdown: "",
|
||||
html: ""
|
||||
};
|
||||
}
|
||||
self.update = function(data) {
|
||||
self.changeDate(data.changeDate);
|
||||
self.description(data.description);
|
||||
self.changeAuthor(data.changeAuthor);
|
||||
self.version(data.version);
|
||||
self.markdown(data.markdown);
|
||||
self.html(data.html);
|
||||
}
|
||||
}
|
||||
7
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/js/easymde.min.js
vendored
Normal file
7
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/js/easymde.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/js/highlightjs.min.js
vendored
Normal file
2
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/js/highlightjs.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/js/htmlparser.min.js
vendored
Normal file
22
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/js/htmlparser.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/js/marked.min.js
vendored
Normal file
6
DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/www/js/marked.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
||||
"use strict";
|
||||
var self = this;
|
||||
self.helpers = new Helpers();
|
||||
self.menuOptions = ["Home"];
|
||||
self.menuOptions = ["Home", "Policy"];
|
||||
self.possibleLogDirections = ko.observableArray([
|
||||
{ Text: "In", value: 1 },
|
||||
{ Text: "Out", value: 2 }
|
||||
@ -19,6 +19,10 @@
|
||||
self.selectedCalendarWeek = ko.observable(0);
|
||||
self.errorData = ko.observable(null);
|
||||
self.manualLog = ko.observable(null);
|
||||
self.policyData = ko.observable(null);
|
||||
self.policyChangeDate = ko.observable(null);
|
||||
self.policyChangeAuthor = ko.observable(null);
|
||||
self.policyVersion = ko.observable(null);
|
||||
self.apiEndpoints = {
|
||||
root: "http://localhost:8800",
|
||||
getUserList: "/api/users",
|
||||
@ -29,7 +33,8 @@
|
||||
getGroups: "/api/groups",
|
||||
getAppDetails: "/api/app",
|
||||
manualLogsCreate: "/api/logs/create",
|
||||
manualLogsDelete: "/api/logs/delete"
|
||||
manualLogsDelete: "/api/logs/delete",
|
||||
getPolicy: "/api/app/policy"
|
||||
};
|
||||
self.uiPages = {
|
||||
users: "users",
|
||||
@ -336,13 +341,25 @@
|
||||
self.assignErrorObject(errObj.errorCode, errObj.errorMessage, "getGroups");
|
||||
});
|
||||
};
|
||||
self.getPolicyData = function () {
|
||||
var url = self.helpers.createRequestUrl(self.apiEndpoints.getPolicy, null, false);
|
||||
$.getJSON(url, function (res) {
|
||||
console.log(res);
|
||||
self.policyData(res);
|
||||
}).fail(function (resp, status, error) {
|
||||
console.log("error - getPolicyData");
|
||||
var errObj = self.helpers.processRequestFailure(resp, status, error);
|
||||
self.assignErrorObject(errObj.errorCode, errObj.errorMessage, "getPolicyData");
|
||||
});
|
||||
|
||||
};
|
||||
self.createManualLog = function(newLog) {
|
||||
var url = self.helpers.createRequestUrl(self.apiEndpoints.manualLogsCreate, null, false, false);
|
||||
$.post(url, newLog, function () {
|
||||
}, "json")
|
||||
.done(function () {
|
||||
self.manualLog(null);
|
||||
$('#manualLogDialog').modal("hide");
|
||||
$("#manualLogDialog").modal("hide");
|
||||
location.reload(); //stay on this users logs page, but just reload the timelogs.
|
||||
})
|
||||
.fail(function (resp, status, error) {
|
||||
@ -419,6 +436,7 @@
|
||||
self.chosenUserDetails(null);
|
||||
self.userList(null);
|
||||
self.userTimeLogData(null);
|
||||
self.policyData(null);
|
||||
self.manualLog(null);
|
||||
if (self.appDetails() === null) {
|
||||
self.getAppDetails();
|
||||
@ -437,6 +455,7 @@
|
||||
self.chosenUserDetails(null);
|
||||
self.userList(null);
|
||||
self.userTimeLogData(null);
|
||||
self.policyData(null);
|
||||
self.manualLog(null);
|
||||
self.getUserDetails(this.params.userId);
|
||||
self.getUnassignedCardData();
|
||||
@ -454,12 +473,14 @@
|
||||
self.userList(null);
|
||||
self.userTimeLogData(null);
|
||||
self.manualLog(null);
|
||||
self.policyData(null);
|
||||
self.getTimeLogData(this.params.userId, self.selectedTimeLogDate());
|
||||
});
|
||||
this.get("#newUser", function () {
|
||||
self.chosenMenuItemId("newUser");
|
||||
self.userList(null);
|
||||
self.userTimeLogData(null);
|
||||
self.policyData(null);
|
||||
self.chosenUserDetails({
|
||||
"UserId": -1,
|
||||
"FirstName": null,
|
||||
@ -478,6 +499,16 @@
|
||||
this.get("#stats", function () {
|
||||
self.goToMenuOption("users");
|
||||
});
|
||||
this.get("#Policy",
|
||||
function () {
|
||||
self.groupsList(null);
|
||||
self.chosenUserDetails(null);
|
||||
self.userList(null);
|
||||
self.userTimeLogData(null);
|
||||
self.manualLog(null);
|
||||
|
||||
self.getPolicyData();
|
||||
});
|
||||
this.post("#edituser", function () {
|
||||
$.each(self.chosenUserDetails().AssociatedIdentifiers,
|
||||
function (k, v) {
|
||||
|
||||
@ -57,6 +57,10 @@
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.FileSystems, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
||||
BIN
Tools/Sentinel.zip
Normal file
BIN
Tools/Sentinel.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user