diff --git a/Wlog.Library/BLL/Classes/Constants.cs b/Wlog.Library/BLL/Classes/Constants.cs index 7d4c593..966b3be 100644 --- a/Wlog.Library/BLL/Classes/Constants.cs +++ b/Wlog.Library/BLL/Classes/Constants.cs @@ -15,7 +15,11 @@ namespace Wlog.BLL.Classes { public static class Constants { - public static class Roles + public static class DictionaryNames + { + public const string Main = "MAIN"; + } + public static class Roles { public const string Admin = "ADMIN"; public const string WriteLog = "WRITELOG"; diff --git a/Wlog.Library/BLL/Classes/EntityRepository.cs b/Wlog.Library/BLL/Classes/EntityRepository.cs index d12bdc8..2b75e93 100644 --- a/Wlog.Library/BLL/Classes/EntityRepository.cs +++ b/Wlog.Library/BLL/Classes/EntityRepository.cs @@ -92,7 +92,7 @@ public virtual IPagedList Find(Expression> where, int pageNumbe int rowCount = count.Count(); List result = query.ToList(); - return new StaticPagedList(result, pageNumber, pageSize, rowCount); + return new StaticPagedList(result, pageNumber+1, pageSize, rowCount); } @@ -165,7 +165,7 @@ private static IQueryable GetQuery(Expression> where, int start if (numberOfRow > 0) { - query = query.Skip(numberOfRow); + query = query.Take(numberOfRow); } if (sortField != null && sordDirection == SortDirection.ASC) diff --git a/Wlog.Library/BLL/Entities/DictionaryEntity.cs b/Wlog.Library/BLL/Entities/DictionaryEntity.cs new file mode 100644 index 0000000..da48b12 --- /dev/null +++ b/Wlog.Library/BLL/Entities/DictionaryEntity.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Wlog.Library.BLL.Interfaces; + +namespace Wlog.BLL.Entities +{ + + public class DictionaryEntity : IEntityBase + { + public virtual string Name { get; set; } + public virtual Guid ApplicationId { get; set; } + + } +} diff --git a/Wlog.Library/BLL/Entities/KeyPairEntity.cs b/Wlog.Library/BLL/Entities/KeyPairEntity.cs new file mode 100644 index 0000000..9b0c77c --- /dev/null +++ b/Wlog.Library/BLL/Entities/KeyPairEntity.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Wlog.Library.BLL.Interfaces; + +namespace Wlog.BLL.Entities +{ + public class KeyPairEntity : IEntityBase + { + public virtual string ItemKey { get; set; } + public virtual string ItemValue { get; set; } + public virtual Guid DictionaryId { get; set; } + } +} diff --git a/Wlog.Library/BLL/Reporitories/DBKeyPairRepository.cs b/Wlog.Library/BLL/Reporitories/DBKeyPairRepository.cs new file mode 100644 index 0000000..aa93f23 --- /dev/null +++ b/Wlog.Library/BLL/Reporitories/DBKeyPairRepository.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using PagedList; +using Wlog.BLL.Entities; +using Wlog.Library.BLL.Classes; +using Wlog.Library.BLL.Reporitories.Interfaces; + +namespace Wlog.Library.BLL.Reporitories +{ + public class DBKeyPairRepository : EntityRepository, IKeyPairRepository + { + public DictionaryEntity CreateDictionary(DictionaryEntity d) + { + using (var op = this.BeginUnitOfWork()) + { + op.SaveOrUpdate(d); + op.Commit(); + return d; + } + } + + public string GetByKey(Guid dictionaryId, string key) + { + using (var op = this.BeginUnitOfWork()) + { + var item = op.Query().Where(x => x.DictionaryId.CompareTo(dictionaryId) == 0 && x.ItemKey.Equals(key)).FirstOrDefault(); + if (item == null) return null; + return item.ItemValue; + } + } + + public IPagedList GetDictionaries(Guid applicationId, string dictionaryName, int start, int count) + { + using (var op = this.BeginUnitOfWork()) + { + var query = op.Query(); + if (applicationId != null) + { + query = query.Where(x => x.ApplicationId == applicationId); + } + + if (dictionaryName != null) + { + query = query.Where(x => x.Name.Contains(dictionaryName)); + } + + if (start > 0) + { + query = query.Skip(start); + } + + + int total = query.Count(); + + if (count > 0) + { + query = query.Take(count); + } + + var items = query.ToList(); + var page = 1; + if (start > 0 && count > 0) + { + page = (start / count)+1; + } + if (count == 0) count = int.MaxValue; + return new StaticPagedList(items, page, count, total); + } + } + + public KeyPairEntity Save(Guid dictionaryId, string key, string value) + { + + + + using (var op = this.BeginUnitOfWork()) + { + op.BeginTransaction(); + + var kpe = op.Query().Where(x => x.ItemKey == key && x.DictionaryId == dictionaryId).FirstOrDefault(); + if (kpe == null) + { + kpe = new KeyPairEntity() + { + DictionaryId = dictionaryId, + + }; + } + + kpe.ItemKey = key; + kpe.ItemValue = value; + + op.SaveOrUpdate(kpe); + op.Commit(); + return kpe; + } + + } + + public IPagedList Search(Guid dictionaryId, string key, int start, int count) + { + using (var op = this.BeginUnitOfWork()) + { + var query = op.Query(); + if (dictionaryId != null) + { + query = query.Where(x => x.DictionaryId == dictionaryId); + } + + if (key != null) + { + query = query.Where(x => x.ItemKey.Contains(key)); + } + + int total = query.Count(); + + + if (start > 0) + { + query = query.Skip(start); + } + + + if (count > 0) + { + query = query.Take(count); + } + + var items = query.ToList(); + var page = 1; + if (start > 0 && count > 0) + { + page = (start / count) + 1; + } + if (count == 0) count = int.MaxValue; + return new StaticPagedList(items, page, count, total); + } + } + } +} diff --git a/Wlog.Library/BLL/Reporitories/DeletedLogRepository.cs b/Wlog.Library/BLL/Reporitories/DeletedLogRepository.cs index 025afff..6d875cf 100644 --- a/Wlog.Library/BLL/Reporitories/DeletedLogRepository.cs +++ b/Wlog.Library/BLL/Reporitories/DeletedLogRepository.cs @@ -8,6 +8,7 @@ using Interfaces; using NLog; using System.Diagnostics; + using BLL.Interfaces; /// /// Repository to store deleted logs diff --git a/Wlog.Library/BLL/Reporitories/Interfaces/IKeyPairRepository.cs b/Wlog.Library/BLL/Reporitories/Interfaces/IKeyPairRepository.cs new file mode 100644 index 0000000..28f882e --- /dev/null +++ b/Wlog.Library/BLL/Reporitories/Interfaces/IKeyPairRepository.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using PagedList; +using Wlog.BLL.Entities; + +namespace Wlog.Library.BLL.Reporitories.Interfaces +{ + public interface IKeyPairRepository + { + string GetByKey(Guid dictionaryId,string key); + + KeyPairEntity GetById(Guid itemId); + + KeyPairEntity Save(Guid dictionaryId, string key, string value); + + + IPagedList Search(Guid dictionaryId, string key, int start, int count); + + + + IPagedList GetDictionaries(Guid id, string dictionaryName, int start, int count); + DictionaryEntity CreateDictionary(DictionaryEntity d); + bool Delete(KeyPairEntity value); + } +} diff --git a/Wlog.Library/BLL/Reporitories/RepositoryContext.cs b/Wlog.Library/BLL/Reporitories/RepositoryContext.cs index 308fda1..7f7184b 100644 --- a/Wlog.Library/BLL/Reporitories/RepositoryContext.cs +++ b/Wlog.Library/BLL/Reporitories/RepositoryContext.cs @@ -12,6 +12,7 @@ using System.Text; using System.Threading.Tasks; using NLog; +using Wlog.Library.BLL.Reporitories.Interfaces; namespace Wlog.Library.BLL.Reporitories { @@ -51,6 +52,8 @@ public class RepositoryContext public JobInstanceRespository JobInstance { get; private set; } + public IKeyPairRepository KeyPairRepository { get; private set; } + private static RepositoryContext current; public static RepositoryContext Current @@ -76,6 +79,7 @@ public static RepositoryContext Current current.JobDefinition = new JobDefinitionRepository(); current.DeletedLogs = new DeletedLogRepository(); current.JobInstance = new JobInstanceRespository(); + current.KeyPairRepository = new DBKeyPairRepository(); } return current; diff --git a/Wlog.Library/BLL/Utils/SystemDataInitialisation.cs b/Wlog.Library/BLL/Utils/SystemDataInitialisation.cs index 50a9766..2fd551f 100644 --- a/Wlog.Library/BLL/Utils/SystemDataInitialisation.cs +++ b/Wlog.Library/BLL/Utils/SystemDataInitialisation.cs @@ -116,6 +116,25 @@ public void EnsureSampleData() } } + public void InsertMissingDictionary() + { + var apps=RepositoryContext.Current.Applications.Find(null, 0, int.MaxValue, null, Enums.SortDirection.ASC); + foreach(var app in apps) + { + var dict=RepositoryContext.Current.KeyPairRepository.GetDictionaries(app.Id,Constants.DictionaryNames.Main,0,0); + if (dict == null || dict.Count == 0) + { + DictionaryEntity d = new DictionaryEntity() + { + ApplicationId = app.Id, + Name = Constants.DictionaryNames.Main + }; + + RepositoryContext.Current.KeyPairRepository.CreateDictionary(d); + } + } + } + private RolesEntity InsertRoleIfNotExists(string rolename, bool global, bool application) { _logger.Debug("[SystemDataHelper]: InsertRoleIfNotExists"); diff --git a/Wlog.Library/BLL/Entities/ApplicationRoleEntry.cs b/Wlog.Library/DAL/Nhibernate/Mappings/DictionaryMap.cs similarity index 55% rename from Wlog.Library/BLL/Entities/ApplicationRoleEntry.cs rename to Wlog.Library/DAL/Nhibernate/Mappings/DictionaryMap.cs index ca65626..5b3f8c3 100644 --- a/Wlog.Library/BLL/Entities/ApplicationRoleEntry.cs +++ b/Wlog.Library/DAL/Nhibernate/Mappings/DictionaryMap.cs @@ -6,24 +6,28 @@ // Daniele Fontani, Emanuele Bucaelli // true //****************************************************************************** -using NHibernate.Mapping.ByCode; -using NHibernate.Mapping.ByCode.Conformist; using System; using System.Collections.Generic; using System.Linq; -using System.Web; -using MongoDB.Bson.Serialization.Attributes; -using Wlog.Library.BLL.Interfaces; +using System.Text; +using System.Threading.Tasks; +using NHibernate.Mapping.ByCode.Conformist; +using Wlog.BLL.Entities; +using NHibernate.Mapping.ByCode; -namespace Wlog.BLL.Entities +namespace Wlog.Library.DAL.Nhibernate.Mappings { - public class ApplicationRoleEntity : IEntityBase + public class DictionaryMap : ClassMapping { - [BsonId] - public override Guid Id { get; set; } - public virtual Guid ApplicationId { get; set; } - public virtual Guid RoleId{ get; set; } - } + public DictionaryMap() + { + Table("wl_dictionary"); + //Schema("dbo"); + + Id(x => x.Id, map => { map.Column("DictionaryId"); map.Generator(Generators.Guid); }); - -} \ No newline at end of file + Property(x => x.ApplicationId); + Property(x => x.Name,m=> { m.Index("idx_name");m.Unique(true); }); + } + } +} diff --git a/Wlog.Library/DAL/Nhibernate/Mappings/KeyPairMap.cs b/Wlog.Library/DAL/Nhibernate/Mappings/KeyPairMap.cs new file mode 100644 index 0000000..b6e41df --- /dev/null +++ b/Wlog.Library/DAL/Nhibernate/Mappings/KeyPairMap.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using NHibernate.Mapping.ByCode; +using NHibernate.Mapping.ByCode.Conformist; +using Wlog.BLL.Entities; + +namespace Wlog.Library.DAL.Nhibernate.Mappings +{ + public class KeyPairMap : ClassMapping + { + public KeyPairMap() + { + Table("wl_keypair"); + //Schema("dbo"); + + Id(x => x.Id, map => { map.Column("KeyPairId"); map.Generator(Generators.Guid); }); + + Property(x => x.DictionaryId, map => { map.UniqueKey("idx_dictuk"); }); + Property(x => x.ItemKey, map=> { map.UniqueKey("idx_dictuk"); }); + Property(x => x.ItemValue); + } + } + +} diff --git a/Wlog.Library/Wlog.Library.csproj b/Wlog.Library/Wlog.Library.csproj index 24a2824..5ca4eb6 100644 --- a/Wlog.Library/Wlog.Library.csproj +++ b/Wlog.Library/Wlog.Library.csproj @@ -179,7 +179,9 @@ + + @@ -200,8 +202,10 @@ + + @@ -222,10 +226,12 @@ + + diff --git a/Wlog.Web/App_Start/BundleConfig.cs b/Wlog.Web/App_Start/BundleConfig.cs index 95869e0..9933893 100644 --- a/Wlog.Web/App_Start/BundleConfig.cs +++ b/Wlog.Web/App_Start/BundleConfig.cs @@ -50,7 +50,11 @@ public static void RegisterBundles(BundleCollection bundles) "~/Scripts/DataTables/dataTables.buttons.min.js", "~/Scripts/DataTables/buttons.bootstrap.min.js", - "~/Scripts/DataTables/buttons.colVis.min.js" + "~/Scripts/DataTables/buttons.colVis.min.js", + "~/Scripts/DataTables/buttons.colVis.min.js", + + + "~/Scripts/DataTables/dataTables.select.min.js", } )); diff --git a/Wlog.Web/Controllers/PrivateController.cs b/Wlog.Web/Controllers/PrivateController.cs index 6ea5174..09679c0 100644 --- a/Wlog.Web/Controllers/PrivateController.cs +++ b/Wlog.Web/Controllers/PrivateController.cs @@ -30,6 +30,7 @@ using Wlog.Web.Models.Application; using Wlog.Web.Models.User; using Wlog.Web.Resources; +using Wlog.Web.Models.Dictionary; namespace Wlog.Web.Controllers { @@ -275,7 +276,169 @@ public ActionResult DeleteUser(UserData user) return View(user); } - #region Logs + [AuthorizeRoles(Constants.Roles.Admin, Constants.Roles.WriteLog, Constants.Roles.ReadLog)] + public ActionResult Dictionary(Guid? applicationId, string level, string sortOrder, string sortBy, string searchMessage, int? page, int? pageSize) + { + _logger.Debug("[Private]: Logs"); + //TDOD: CHECK USER + List alloweApps = RepositoryContext.Current.Applications.GetAppplicationsIdsByUsername(Membership.GetUser().UserName); + + LogListModel mm = new LogListModel() + { + ApplicationId = applicationId ?? alloweApps.FirstOrDefault() + }; + MembershipUser current = Membership.GetUser(); + mm.Apps = RepositoryContext.Current.Applications.GetAppplicationsByUsername(current.UserName); + + return View(mm); + } + + + #region Dictionary + + [AuthorizeRoles(Constants.Roles.Admin, Constants.Roles.ReadLog)] + public JsonResult DeleteDictionaryItemById(Guid id) + { + var result = new JsonResult(); + result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; + + try + { + var value = RepositoryContext.Current.KeyPairRepository.GetById(id); + + RepositoryContext.Current.KeyPairRepository.Delete(value); + + result.Data = value; + } + catch (Exception err) + { + _logger.Error(err); + result.Data = new { error = true, message = err.Message }; + } + + return result; + } + + + [AuthorizeRoles(Constants.Roles.Admin, Constants.Roles.ReadLog)] + public JsonResult GetDictionaryItemById(Guid id) + { + var result = new JsonResult(); + result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; + + + + + + try + { + var value = RepositoryContext.Current.KeyPairRepository.GetById(id); + + result.Data = value; + } + catch (Exception err) + { + _logger.Error(err); + result.Data = new { error = true, message = err.Message }; + } + + return result; + } + + [AuthorizeRoles(Constants.Roles.Admin, Constants.Roles.ReadLog)] + public JsonResult GetDictionaryItem(Guid dictionaryId, string key) + { + + var result = new JsonResult(); + result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; + + + + + + try + { + var value=RepositoryContext.Current.KeyPairRepository.GetByKey(dictionaryId, key); + + result.Data = value; + } + catch (Exception err) + { + _logger.Error(err); + result.Data = new { error = true, message = err.Message }; + } + + return result; + } + [HttpPost] + [AuthorizeRoles(Constants.Roles.Admin, Constants.Roles.ReadLog)] + public JsonResult SaveDictionaryItem(KeyValueItemModel itemToSave) + { + var appId= new Guid(itemToSave.ApplicationId); + List alloweApps = RepositoryContext.Current.Applications.GetAppplicationsIdsByUsername(Membership.GetUser().UserName); + + if (!alloweApps.Contains(appId)) throw new Exception("Application Not Allowed"); + + + var dictionary=RepositoryContext.Current.KeyPairRepository.GetDictionaries(appId, itemToSave.DictionaryName, 0, 1); + if (dictionary == null || dictionary.Count!=1) throw new Exception("Dictionary not found"); + + var result = new JsonResult(); + + try + { + RepositoryContext.Current.KeyPairRepository.Save(dictionary[0].Id, itemToSave.ItemKey, itemToSave.ItemValue); + + result.Data = new { error = false, message = "" }; + } + catch (Exception err) + { + _logger.Error(err); + result.Data = new { error = true, message = err.Message}; + } + + return result; + + } + + [AuthorizeRoles(Constants.Roles.Admin, Constants.Roles.ReadLog)] + public JsonResult SearchDictionary(Guid? applicationId, string sortOrder, string sortBy, string key, int page, int pageSize) + { + _logger.Debug("[Private]: Search"); + //TDOD: CHECK USER + var result = new JsonResult(); + + + if (!applicationId.HasValue) + { + throw new Exception("Missing app id"); + } + + List alloweApps = RepositoryContext.Current.Applications.GetAppplicationsIdsByUsername(Membership.GetUser().UserName); + if (!alloweApps.Contains(applicationId.Value)) throw new Exception("Application Not Allowed"); + + + var dict =RepositoryContext.Current.KeyPairRepository.GetDictionaries(applicationId.Value, Constants.DictionaryNames.Main, 0, 0); + if (dict == null || dict.Count != 1) throw new Exception("unexpected number of dictionaries"); + + + + IPagedList list = RepositoryContext.Current.KeyPairRepository.Search(dict[0].Id, key, (page-1) * pageSize, pageSize); + result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; + + result.Data = new + { + draw = Request["draw"], + recordsTotal = list.TotalItemCount, + recordsFiltered = list.TotalItemCount, + data = list + }; + return result; + } + #endregion + + #region Logs + [AuthorizeRoles(Constants.Roles.Admin, Constants.Roles.ReadLog)] public JsonResult Search(Guid? applicationId, string sortOrder, string sortBy, string searchMessage, int page, int pageSize) { diff --git a/Wlog.Web/Global.asax.cs b/Wlog.Web/Global.asax.cs index 1b83bcf..2ff69d4 100644 --- a/Wlog.Web/Global.asax.cs +++ b/Wlog.Web/Global.asax.cs @@ -28,7 +28,7 @@ public class WebApiApplication : System.Web.HttpApplication private static Logger _logger = LogManager.GetCurrentClassLogger(); private bool installed = "True".Equals(ConfigurationManager.AppSettings["WlogInstalled"], StringComparison.InvariantCultureIgnoreCase); - protected void Application_Start() + protected void Application_Start(object sender, EventArgs e) { try @@ -46,6 +46,8 @@ protected void Application_Start() Mapper.Initialize(cfg => cfg.AddProfile(new ApplicationProfile())); + + @@ -76,6 +78,8 @@ protected void Application_Start() SystemDataInitialisation.Instance.InsertRolesAndProfiles(); SystemDataInitialisation.Instance.EnsureSampleData(); SystemDataInitialisation.Instance.InsertJobsDefinitions(); + SystemDataInitialisation.Instance.InsertMissingDictionary(); + _logger.Info("Application started"); } diff --git a/Wlog.Web/Models/Dictionary/KeyValueItem.cs b/Wlog.Web/Models/Dictionary/KeyValueItem.cs new file mode 100644 index 0000000..e7e9123 --- /dev/null +++ b/Wlog.Web/Models/Dictionary/KeyValueItem.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Wlog.Web.Models.Dictionary +{ + public class KeyValueItemModel + { + public string ItemKey { get; set; } + public string ItemValue { get; set; } + public string ApplicationId { get; set; } + public string DictionaryName { get; set; } + } +} \ No newline at end of file diff --git a/Wlog.Web/Scripts/bootbox.min.js b/Wlog.Web/Scripts/bootbox.min.js new file mode 100644 index 0000000..0dc0cbd --- /dev/null +++ b/Wlog.Web/Scripts/bootbox.min.js @@ -0,0 +1,6 @@ +/** + * bootbox.js v4.4.0 + * + * http://bootboxjs.com/license.txt + */ +!function(a,b){"use strict";"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):a.bootbox=b(a.jQuery)}(this,function a(b,c){"use strict";function d(a){var b=q[o.locale];return b?b[a]:q.en[a]}function e(a,c,d){a.stopPropagation(),a.preventDefault();var e=b.isFunction(d)&&d.call(c,a)===!1;e||c.modal("hide")}function f(a){var b,c=0;for(b in a)c++;return c}function g(a,c){var d=0;b.each(a,function(a,b){c(a,b,d++)})}function h(a){var c,d;if("object"!=typeof a)throw new Error("Please supply an object of options");if(!a.message)throw new Error("Please specify a message");return a=b.extend({},o,a),a.buttons||(a.buttons={}),c=a.buttons,d=f(c),g(c,function(a,e,f){if(b.isFunction(e)&&(e=c[a]={callback:e}),"object"!==b.type(e))throw new Error("button with key "+a+" must be an object");e.label||(e.label=a),e.className||(e.className=2>=d&&f===d-1?"btn-primary":"btn-default")}),a}function i(a,b){var c=a.length,d={};if(1>c||c>2)throw new Error("Invalid argument length");return 2===c||"string"==typeof a[0]?(d[b[0]]=a[0],d[b[1]]=a[1]):d=a[0],d}function j(a,c,d){return b.extend(!0,{},a,i(c,d))}function k(a,b,c,d){var e={className:"bootbox-"+a,buttons:l.apply(null,b)};return m(j(e,d,c),b)}function l(){for(var a={},b=0,c=arguments.length;c>b;b++){var e=arguments[b],f=e.toLowerCase(),g=e.toUpperCase();a[f]={label:d(g)}}return a}function m(a,b){var d={};return g(b,function(a,b){d[b]=!0}),g(a.buttons,function(a){if(d[a]===c)throw new Error("button key "+a+" is not allowed (options are "+b.join("\n")+")")}),a}var n={dialog:"",header:"",footer:"",closeButton:"",form:"
",inputs:{text:"",textarea:"",email:"",select:"",checkbox:"
",date:"",time:"",number:"",password:""}},o={locale:"en",backdrop:"static",animate:!0,className:null,closeButton:!0,show:!0,container:"body"},p={};p.alert=function(){var a;if(a=k("alert",["ok"],["message","callback"],arguments),a.callback&&!b.isFunction(a.callback))throw new Error("alert requires callback property to be a function when provided");return a.buttons.ok.callback=a.onEscape=function(){return b.isFunction(a.callback)?a.callback.call(this):!0},p.dialog(a)},p.confirm=function(){var a;if(a=k("confirm",["cancel","confirm"],["message","callback"],arguments),a.buttons.cancel.callback=a.onEscape=function(){return a.callback.call(this,!1)},a.buttons.confirm.callback=function(){return a.callback.call(this,!0)},!b.isFunction(a.callback))throw new Error("confirm requires a callback");return p.dialog(a)},p.prompt=function(){var a,d,e,f,h,i,k;if(f=b(n.form),d={className:"bootbox-prompt",buttons:l("cancel","confirm"),value:"",inputType:"text"},a=m(j(d,arguments,["title","callback"]),["cancel","confirm"]),i=a.show===c?!0:a.show,a.message=f,a.buttons.cancel.callback=a.onEscape=function(){return a.callback.call(this,null)},a.buttons.confirm.callback=function(){var c;switch(a.inputType){case"text":case"textarea":case"email":case"select":case"date":case"time":case"number":case"password":c=h.val();break;case"checkbox":var d=h.find("input:checked");c=[],g(d,function(a,d){c.push(b(d).val())})}return a.callback.call(this,c)},a.show=!1,!a.title)throw new Error("prompt requires a title");if(!b.isFunction(a.callback))throw new Error("prompt requires a callback");if(!n.inputs[a.inputType])throw new Error("invalid prompt type");switch(h=b(n.inputs[a.inputType]),a.inputType){case"text":case"textarea":case"email":case"date":case"time":case"number":case"password":h.val(a.value);break;case"select":var o={};if(k=a.inputOptions||[],!b.isArray(k))throw new Error("Please pass an array of input options");if(!k.length)throw new Error("prompt with select requires options");g(k,function(a,d){var e=h;if(d.value===c||d.text===c)throw new Error("given options in wrong format");d.group&&(o[d.group]||(o[d.group]=b("").attr("label",d.group)),e=o[d.group]),e.append("")}),g(o,function(a,b){h.append(b)}),h.val(a.value);break;case"checkbox":var q=b.isArray(a.value)?a.value:[a.value];if(k=a.inputOptions||[],!k.length)throw new Error("prompt with checkbox requires options");if(!k[0].value||!k[0].text)throw new Error("given options in wrong format");h=b("
"),g(k,function(c,d){var e=b(n.inputs[a.inputType]);e.find("input").attr("value",d.value),e.find("label").append(d.text),g(q,function(a,b){b===d.value&&e.find("input").prop("checked",!0)}),h.append(e)})}return a.placeholder&&h.attr("placeholder",a.placeholder),a.pattern&&h.attr("pattern",a.pattern),a.maxlength&&h.attr("maxlength",a.maxlength),f.append(h),f.on("submit",function(a){a.preventDefault(),a.stopPropagation(),e.find(".btn-primary").click()}),e=p.dialog(a),e.off("shown.bs.modal"),e.on("shown.bs.modal",function(){h.focus()}),i===!0&&e.modal("show"),e},p.dialog=function(a){a=h(a);var d=b(n.dialog),f=d.find(".modal-dialog"),i=d.find(".modal-body"),j=a.buttons,k="",l={onEscape:a.onEscape};if(b.fn.modal===c)throw new Error("$.fn.modal is not defined; please double check you have included the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ for more details.");if(g(j,function(a,b){k+="",l[a]=b.callback}),i.find(".bootbox-body").html(a.message),a.animate===!0&&d.addClass("fade"),a.className&&d.addClass(a.className),"large"===a.size?f.addClass("modal-lg"):"small"===a.size&&f.addClass("modal-sm"),a.title&&i.before(n.header),a.closeButton){var m=b(n.closeButton);a.title?d.find(".modal-header").prepend(m):m.css("margin-top","-10px").prependTo(i)}return a.title&&d.find(".modal-title").html(a.title),k.length&&(i.after(n.footer),d.find(".modal-footer").html(k)),d.on("hidden.bs.modal",function(a){a.target===this&&d.remove()}),d.on("shown.bs.modal",function(){d.find(".btn-primary:first").focus()}),"static"!==a.backdrop&&d.on("click.dismiss.bs.modal",function(a){d.children(".modal-backdrop").length&&(a.currentTarget=d.children(".modal-backdrop").get(0)),a.target===a.currentTarget&&d.trigger("escape.close.bb")}),d.on("escape.close.bb",function(a){l.onEscape&&e(a,d,l.onEscape)}),d.on("click",".modal-footer button",function(a){var c=b(this).data("bb-handler");e(a,d,l[c])}),d.on("click",".bootbox-close-button",function(a){e(a,d,l.onEscape)}),d.on("keyup",function(a){27===a.which&&d.trigger("escape.close.bb")}),b(a.container).append(d),d.modal({backdrop:a.backdrop?"static":!1,keyboard:!1,show:!1}),a.show&&d.modal("show"),d},p.setDefaults=function(){var a={};2===arguments.length?a[arguments[0]]=arguments[1]:a=arguments[0],b.extend(o,a)},p.hideAll=function(){return b(".bootbox").modal("hide"),p};var q={bg_BG:{OK:"Ок",CANCEL:"Отказ",CONFIRM:"Потвърждавам"},br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},cs:{OK:"OK",CANCEL:"Zrušit",CONFIRM:"Potvrdit"},da:{OK:"OK",CANCEL:"Annuller",CONFIRM:"Accepter"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},el:{OK:"Εντάξει",CANCEL:"Ακύρωση",CONFIRM:"Επιβεβαίωση"},en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},et:{OK:"OK",CANCEL:"Katkesta",CONFIRM:"OK"},fa:{OK:"قبول",CANCEL:"لغو",CONFIRM:"تایید"},fi:{OK:"OK",CANCEL:"Peruuta",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},he:{OK:"אישור",CANCEL:"ביטול",CONFIRM:"אישור"},hu:{OK:"OK",CANCEL:"Mégsem",CONFIRM:"Megerősít"},hr:{OK:"OK",CANCEL:"Odustani",CONFIRM:"Potvrdi"},id:{OK:"OK",CANCEL:"Batal",CONFIRM:"OK"},it:{OK:"OK",CANCEL:"Annulla",CONFIRM:"Conferma"},ja:{OK:"OK",CANCEL:"キャンセル",CONFIRM:"確認"},lt:{OK:"Gerai",CANCEL:"Atšaukti",CONFIRM:"Patvirtinti"},lv:{OK:"Labi",CANCEL:"Atcelt",CONFIRM:"Apstiprināt"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},no:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},pl:{OK:"OK",CANCEL:"Anuluj",CONFIRM:"Potwierdź"},pt:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Confirmar"},ru:{OK:"OK",CANCEL:"Отмена",CONFIRM:"Применить"},sq:{OK:"OK",CANCEL:"Anulo",CONFIRM:"Prano"},sv:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},th:{OK:"ตกลง",CANCEL:"ยกเลิก",CONFIRM:"ยืนยัน"},tr:{OK:"Tamam",CANCEL:"İptal",CONFIRM:"Onayla"},zh_CN:{OK:"OK",CANCEL:"取消",CONFIRM:"确认"},zh_TW:{OK:"OK",CANCEL:"取消",CONFIRM:"確認"}};return p.addLocale=function(a,c){return b.each(["OK","CANCEL","CONFIRM"],function(a,b){if(!c[b])throw new Error("Please supply a translation for '"+b+"'")}),q[a]={OK:c.OK,CANCEL:c.CANCEL,CONFIRM:c.CONFIRM},p},p.removeLocale=function(a){return delete q[a],p},p.setLocale=function(a){return p.setDefaults("locale",a)},p.init=function(c){return a(c||b)},p}); \ No newline at end of file diff --git a/Wlog.Web/Views/Private/Dictionary.cshtml b/Wlog.Web/Views/Private/Dictionary.cshtml new file mode 100644 index 0000000..6ccf240 --- /dev/null +++ b/Wlog.Web/Views/Private/Dictionary.cshtml @@ -0,0 +1,425 @@ +@using PagedList.Mvc + +@model Wlog.Web.Models.LogListModel + + + +@{ + Layout = "~/Views/Shared/_LayoutInternal.cshtml"; + + + +} + + + + + + +
+
+

  Dictionary

+
+ +
+ + +
+ + + + +
+ +
+ +
+ + + + + +
+
+ @Html.DropDownListFor(m => m.ApplicationId, + new SelectList(Model.Apps, "Id", "ApplicationName", Model.ApplicationId), + new { @class = " form-control ApplicationSelect", @style = "width:200px;background-color: #eee;" }) +
+ + + + + + +
+ + + +
+ + +
+ +
+ +
+
+
+ + + + +
+ + + + +
+ + + + + + diff --git a/Wlog.Web/Views/Shared/_LayoutInternal.cshtml b/Wlog.Web/Views/Shared/_LayoutInternal.cshtml index 4b084d9..b0b4f71 100644 --- a/Wlog.Web/Views/Shared/_LayoutInternal.cshtml +++ b/Wlog.Web/Views/Shared/_LayoutInternal.cshtml @@ -22,6 +22,8 @@ @Scripts.Render("~/Scripts/jquery.textcomplete.min.js") @Scripts.Render("~/Scripts/moment.min.js") @Scripts.Render("~/bundles/datatables") + + diff --git a/Wlog.Web/Web.config b/Wlog.Web/Web.config index fa5c513..2766bb0 100644 --- a/Wlog.Web/Web.config +++ b/Wlog.Web/Web.config @@ -66,6 +66,7 @@ + diff --git a/Wlog.Web/Wlog.Web.csproj b/Wlog.Web/Wlog.Web.csproj index 87d34a9..0938a60 100644 --- a/Wlog.Web/Wlog.Web.csproj +++ b/Wlog.Web/Wlog.Web.csproj @@ -223,6 +223,7 @@ + @@ -397,6 +398,7 @@ + @@ -489,6 +491,7 @@ Web.config + @@ -617,6 +620,7 @@ +