r7-labs / r7.dnn.extensions Goto Github PK
View Code? Open in Web Editor NEWA base library for DNN Platform extensions development
License: GNU Lesser General Public License v3.0
A base library for DNN Platform extensions development
License: GNU Lesser General Public License v3.0
Basic implementation:
using System.Collections.Generic;
using System.Linq;
namespace R7.Dnn.UserHtml.Models
{
public static class EnumerableExtensions
{
public static bool IsNullOrEmpty<T> (this IEnumerable<T> source) =>
source == null || !source.Any ();
}
}
More advanced implementation would contain ICollection<T>.Count
checks for better performance. Example: http://blog.vkuznetsov.ru/posts/2011/08/31/csharp-ienumerable-isnullorempty
Deleting file safely includes counting file references, which stored:
Extension which provide safe file deletion (presumably with the corresponding content) will need to:
I think we could provide API endpoint for p.1, while concrete extension should be responsible for implementing p.2 and general algorithm. Implementation of p.3 is problematic.
Allow to cache with provided cache key, timeout and cache priority. Then cache is cleared, config need to re-read from config file.
Need to be more simple and flexible (more configuration options, potential support for Bootstrap 4)
Related issues: GH-13
Enables page refresh on closing popup, i.e. then user trigger some data changes on server. May have issues in mobile browsers.
Reference code: https://github.com/dnnsoftware/Dnn.Platform/blob/d988e269c2d93b86edf8392e816bae54b903df86/Website/js/Debug/dnn.modalpopup.js
// Usage:
// r7_dnnModal.enableRefresh (r7_dnnModal.getPopup (window.parent));
(function ($, window) {
window.r7_dnnModal = {
getPopup: function (_window) {
return _window.jQuery("#iPopUp");
},
enableRefresh: function (popup) {
popup.dialog("option", "refresh", true);
popup.dialog("option", "close", function() {
window.dnnModal.closePopUp(true, popup.dialog("option", "closingUrl"));
// console.log ("custom close!");
});
}
}
}) (jQuery, window);
The R7.Dnn.Extensions name is simple and will help to resolve naming conflicts.
In order to make content review operations faster, cancel button in EditPortalModuleBase should close popup window w/o reloading the page.
Need to port ORM code from https://github.com/roman-yagodin/R7.University This will allow to reuse Entity Framework via abstractions across different R7 extensions.
EF 6.2 vs EF Core 1.1.1:
(+) Will require only 2 more assemblies installed in bin
.
(+) Won't conflict with 2Sic solutions (but may conflict with others).
(+) More functionality onboard.
(-) Will consume additional resources then used with 2Sic solutions.
(-) Is a past.
(-) Poorer testing.
EF Core 1.1.1:
(-) Will require many assemblies to be installed in bin
.
(+) Won't consume additional resources then used with 2Sic solutions.
(+) Is a future.
(-) Doesn't support GROUP BY.
(-) Doesn't support separate entity configurations (added in EF Core 2).
(+) Better testing (e.g. Sqlite in-memory databases).
Conslusion: It looks like EF Core is slightly better choice.
ORM functionality should be provided via separate Nuget/DNN package (R7.Dnn.Extensions.EFCore). Base library should contain only abstractions like IDataContext and IModelContext.
ViewModelContext is sounds like a context of the viewmodel, not a context for the viewmodels.
I think the library should be packaged as DNN library, so it can be installed independently from extensions what using it. Extensions should specify the library package as a dependency via manifests.
Failing to deserialize config then calling outside DNN (e.g. from WebActivator) will broke application.
Current time mark is another context in which viewmodels operate.
Burrow Razor control code from https://github.com/DNN-Connect/SkinControls
Many things are hardcoded, also code looks like it's created for some specific project - while have reusable generic parts.
Could be implemented in separate project or as part of R7.Dnn.Extensions.
It could be useful to use ViewModelContext as a bag of references to general objects - not just DNN-related things and module settings.
GetModuleByMoniker(string moniker, int portalId)
method will help to locate modules by moniker, which will simplify configuration of extensions which require to address specific module instances (the "default module").
SQL equivalent:
select * from dbo.TabModuleSettings
where SettingName = 'Moniker' and SettingValue = 'mymodule'
GetModulesByMoniker(Func<bool,string> match, int portalId)
method will help to get set of modules which moniker value match certain criteria (e.g. same prefix).
System.Web.Mvc
namespace already have ControllerBase
classWhile we enumerate cached objects to remove by cache key, it's looks like it is possible that objects could be added to the cache in that time, so not all of them removed.
Need to evaluate benefits/drawbacks of changing source code license to Apache 2.0 or LGPL v3+.
Extract localizer class to reuse in different scenarios.
It can use different backends (DNN, NGettext).
DNN backend will resource file root file, NGettext backend - text catalog.
Backport some code from R7.Epsilon for the case of "single" resource file for entire extension / subsystem.
DNN backend will need to implement plural forms.
NGettext backend will possibly need to implement DNN-like Host/Portal overrides. E.g. we would have several text catalogs under the hood, and try to get string from Portal one, then from Host one, and only then from System one.
Also would be nice to provide relative benchmarks of both backends.
Viewmodel context classes could reuse existing localizers.
There are too many issues with Globals.LinkClick() at the moment, so having safe replacement would be nice to avoid fixing similar issues in different projects again and again.
Issue examples:
Current implementation via extension methods requires calling Message methods via this
keyword inside module classes.
Debug package will provide debug version of assembly and the .pdb file. Last one should be packaged into the Resources.zip
or separate Debug.zip
inside install package.
CopyCstor not working properly then class implements an interface, which is inherited from another interface.
Possible solution:
static public IEnumerable<PropertyInfo> GetPropertiesAndInterfaceProperties(this Type type, BindingFlags bindingAttr = BindingFlags.Public | BindingFlags.Instance)
{
if (!type.IsInterface) {
return type.GetProperties( bindingAttr);
}
return type.GetInterfaces().Union(new Type[] { type }).SelectMany(i => i.GetProperties(bindingAttr)).Distinct();
}
Source:
Control with buttons (or dropdown list) for each FolderHistory item, linked to DnnUrlControl instances or other selectors.
Control can also have buttons for: current page, last folder created, user folder, configured folders.
Then button is clicked, tries to set selector control to corresponding folder.
Related issues: #23
Things to do:
https://github.com/thecoderok/Unidecode.NET
Possibly better way to do this is just provide some kind of extension/helper which not depend on Unidecode.NET directly, but can be used along with it.
Hi Roman
We recently had a problem with telerik controls being used as a vector to hack some of our dnn instances.
We use some of your R7 DNN extensions a lot for websites we build.
I was wondering when you maybe will be putting out dnn extensions without current telerik dependencies?
Need to review current project structure ("packages", in the UML terminology):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.