I want to get the ModuleName in a DotNetNuke Module, but I'cant figure out how I can do that?
I feel like it's very difficult to find information about the classes and how to do things in DNN? Are there any good and actual documentations around?
One thing with DNN API's that is important is to understand the terminology, as sometimes things aren't exactly what you think they are.
When talking about a Module, your custom code, is a Module. Therefore its "Name" is the name that you define it. When a user adds a module to a page, there is a "Module Title" that they can access via the little gear icon "Settings" link on the module.
You can get access to this, it appears through the ModuleController class. Using something such as
var mc = new ModuleController();
var myModule = mc.GetModule(this.ModuleId);
var title = myModule.ContentTitle;
There are other title properties there, you might need to look a bit to find the "right" one for your DNN version and needs.
As for the other question regarding documentation. The DNN Wiki is helpful, but it doesn't contain everything.
Related
I know that DNN doesn't support inserting of one module inside another one. But I wonder if 2sxc module has workaround for it and just like you can, lets say, insert gallery application in blog post content, is there a way to insert there external module object?
The short answer is no. 2sxc doesn't have this functionality built in.
BUT: DNN does have some APIs to do this - there were modules that did this kind of stuff. So I would continue in the DNN APIs to figure out how to do this.
I believe that the answer is yes, and that you should take a look at https://docs.2sxc.org/api/dot-net/ToSic.Sxc.Dnn.Factory.html. I think that you should be looking at CmsBlock.
Some other references:
https://docs.2sxc.org/specs/architecture/data-flow.html
https://docs.2sxc.org/api/dot-net/ToSic.Sxc.DataSources.CmsBlock.html
I've never done anything like this, and I'm not really familiar with the content on this page. Perhaps Daniel and give us both some pointers.
I have experience with drupal but not DNN.
I am interested in seeing if DNN has a module or the ability to have a page that each individual user with an account on my dnn site can arrange the modules on their home page. Sort of like a widget system where users can drag modules around or hide them if they choose. However, as the admin, i'd like to limit which modules they can have access to and move.
In drupal, there is a module called "homebox" that allows for this.
To the best of my knowledge the answer is not out of the box.
That said it would be possible to develop something and there may be something available at store.dnnsoftware.com that would do this for you.
not a lot of help but it may save you some time looking for stuff hat is not there.
Is there a debug option that gives better error messages than substring not found. Fort things like missing stores, region not defined in border layout, etc. is there a way to get ExtJS with debug libraries to give more specific errors?
(like "region must be declared in border layout" if one is not defined)
The best way to debug any javascript code snippets is to use firebug (firefox) extension. However it may or may not let you go through deepen into the library errors, but at least you have the idea where the problem may be in the code.
You can add break points to go though line by line debugging, you can add watch, you can use console to get runtime values. What else do you need? :)
For more info, read this link
ExtJS and Sencha Touch is not easy to debug. Most of the error-prone "code" are configuration objects where you cannot place breakpoints. Finding errors in ExtJS is PITA. The official help page Debugging Ext JS applications from Sencha is more or less a joke. Seems like Sencha only wants to sell their trainings and click-tools. The Sencha forum is awkward to read. Thankfully there is SO.
What is missing is a very intelligent Lint-Tool for ExtJS and Sencha Touch. I haven't tried Eclipse plugin for ExtJS, because Eclipse is only a bit more than Notepad regarding JavaScript development. If you have a JetBrains (*) tool like WebStorm, PhpStorm or IntelliJ IDEA, you have very good auto-completion for your configuration objects. In fact, I don't understand how they introspect code and JSDoc comments to know so much about the framework. You even get warnings about unregistered aliases (e.g. xtype)!
One thing that can help a lot in many situations is Illuminations for Developers. Give it a try and see if it helps you.
What sometimes helps me is registering "catch-all" listeners like in this gist.
And during development it doesn't hurt to place code like this in your classes:
Ext.define('MyApp.controller.Main', {
extend: 'Ext.app.Controller',
init: function () {
console.log('controller/Main::init', this.application);
console.log('controller/Main store =', this.application.getFoosStore());
}
}, function () {
console.log('controller/Main loaded');
});
But the problem still remains. Finding bugs in configuration objects is the hell. You need a second screen and always view the API docs when coding. After a couple of years creating ExtJS programs it's getting better...
(*) I have nothing to do with JetBrains. I just like their tools because they save me a lot of time. Maybe NetBeans would be an alternative.
Edit
Similar questions:
"Debugging" ExtJS script
I posted a question on the Drupal forum about whether I should build my database in Drupal using content-types or the database abstraction layer and schema module: [here][1]
Any advice would be greatly appreciated.
[1]: https://drupal.stackexchange.com/questions/98020/should-i-use-content-types-or-database-abstraction-layer
I'd recommend using content types.
For a PHP coder, sometimes using the Drupal User Interface to build things feels non-intuitive, but in the long run you're going to benefit a lot from doing things "the drupal way.
Once you reverse engineer your need into a content type and all it's associated fields, install the modules that provide those field types and set things up, you'll start to see the benefits.
Validation on all the data-entry froms will already be done for you.
Multiple display modes are available for your data (email addresses can be shown with or without mailto: links, images can be shown using any of Drupal's image styles)
Integration with other Drupal modules already exists, and will be supported (almost anything built with fields is available to views)
By writing your own schema you'll need to handle all these things yourself (and more), and not just once, but you'll need to maintain all that custom code over time.
Learn to leverage the community and all the great work that's been done already, you'll save yourself time in the long run :)
What i see you are going to have shop site.
You may tray this:
https://drupal.org/project/commerce_kickstart
, i've found it usefull once. It's drupal distribution with nice themed shop rady to use straight forward.
And of course do it with content type + views + entity reference modules.
Here is a link to a comment that answers the question I asked. It backs up what arpitr outlined in their answer on the orignal post on the drupal forum, whose answer is also in agreement with jenlampton's suggestion above.
https://drupal.org/comment/7848011#comment-7848011
I will implement my system using node entities until the need arises to build a custom entity (if it ever does).
The top answer in this forum give a good way to evaluate whether to use nodes or custom build an entity:
https://drupal.stackexchange.com/questions/22586/when-is-it-appropriate-to-create-an-entity-versus-just-adding-a-new-content-type
I search this question on uncle google, and in this site, but didn't find a explicit answer.
Can you guys teach me how to make an extension point from an existing core functionality on dotnetnuke7?
For example, I want to change the default behaviour of the "add new page" functionality, implementing different permissions according to user's profile.
Sorry for any English mistake, thanks.
DNN is open source meaning you can download the source code and check under the hood how things are done. Then you can make a module that has a custom implementation of what you want to do. Every good module developer always has a copy of the source code for reference. Otherwise you are asking someone to do the work for you. Good luck