Coder Social home page Coder Social logo

r7-labs / r7.dnn.extensions Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 4.0 7.92 MB

A base library for DNN Platform extensions development

License: GNU Lesser General Public License v3.0

C# 99.08% HTML 0.05% JavaScript 0.30% TSQL 0.57%
dnn dotnetnuke c-sharp nuget lgplv3

r7.dnn.extensions's People

Contributors

roman-yagodin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

r7.dnn.extensions's Issues

Error running on DNN 8

Roman,
Hello. I just installed the latest version of your R7 module. I'm getting an error message. I'm running dnn 8.0.1.

screen shot 2016-07-12 at 2 03 46 pm

Safe file deletion support

Deleting file safely includes counting file references, which stored:

  1. In the DNN content items
  2. In the database table
  3. In the HTML code (links)

Extension which provide safe file deletion (presumably with the corresponding content) will need to:

  • Get DNN content items related to the file
  • Get database records related to the file
  • If file is referenced by any content items or records, which is not about to be deleted along with the file, that file should not be deleted
  • If file is referenced only by content items or records, which is just about to be deleted along with the file, that file can be "safely" deleted
  • Probably it's better to try to delete content item/database records first, and if succeed - delete the file.

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.

Make configs cacheable

Allow to cache with provided cache key, timeout and cache priority. Then cache is cleared, config need to re-read from config file.

Rework of PagingControl

Need to be more simple and flexible (more configuration options, potential support for Bootstrap 4)

Modal popup refresh enabler

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);    

Port ORM code from R7.University

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.

DNN library package

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.

Razor control?

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.

ViewModelContext as a ViewBag

It could be useful to use ViewModelContext as a bag of references to general objects - not just DNN-related things and module settings.

Get module by moniker

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).

Issues with ControllerBase

  • System.Web.Mvc namespace already have ControllerBase class
  • In current state, it is play role of abstract DataProvider

Localizer class

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.

Debug package for DNN

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 and interfaces inheritance

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:

https://stackoverflow.com/questions/358835/getproperties-to-return-all-properties-for-an-interface-inheritance-hierarchy

LinkCompanion control

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

Telerik dependency

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?

Review project structure

Need to review current project structure ("packages", in the UML terminology):

  1. Does separation by three libraries is really needed?
  2. Using single unique namespace is probably better than having multiple namespaces.
  3. Also, wouldn't it be better to keep extension classes in the separate namespace?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.