RAZ Registered Users
 Nuke Wiz Posts:119

 |
| 10/09/2006 2:40 AM |
|
I just starting making my own modules, and offcourse I need some help  Where can I find some code samples for DNN?
I am just trying to add page selection in my Module Settings. Can someone help my out ?
RAZ |
|
|
|
|
Jonathan Hebert Registered Users
 Nuke Super Newbie Posts:20

 |
| 10/09/2006 11:15 AM |
|
Not sure what you mean by page selection but the core modules that come with the DNN source code provide great samples of modules that you can learn from. Also, Scotts modules include source code also and you can learn a lot from them too! I would start with those - that's how I started!
Jonathan
|
|
|
|
|
RAZ Registered Users
 Nuke Wiz Posts:119

 |
| 10/10/2006 3:35 AM |
|
Where can I find the code ? shouldn´t it be in some .vb files ?
I only see the .ascx files for example in the Blog module?
RAZ |
|
|
|
|
RAZ Registered Users
 Nuke Wiz Posts:119

 |
| 10/10/2006 3:44 AM |
|
I forgot to explain the "page selection".
I want to add in the module settings a dropdown with all the pages in the portal.
Same as with "Move to Page" but I wanted to use it for PageRedirect
just wondering how I would do that ( code example )
RAZ |
|
|
|
|
Richard Binnington Registered Users
 Nuke Addict Posts:52

 |
| 10/10/2006 7:27 AM |
|
The .vb files are in the
DotNetNuke 4.3.5 Source DotNetNuke 3.3.5 Source
downloads from DotNetNuke.com. If you got either the
DotNetNuke 4.3.5 Install DotNetNuke 3.3.5 Install
They will not have the source files.
Richard
|
|
|
|
|
Cliff Simpkins Registered Users
 Nuke Addict Posts:71


 |
| 10/10/2006 5:25 PM |
|
I think I can help out here. I had originally tried attaching this as a txt file, but the forums were unhappy with the txt and zip extensions...so I'll try my hand at quoting it in.
protected void BindTabs() {
try {
drpTabs.Items.Clear();
ListItem _liNone = new ListItem("None Selected", "");
drpTabs.Items.Add(_liNone);
DotNetNuke.Entities.Tabs.TabController _tabCtrl = new DotNetNuke.Entities.Tabs.TabController();
System.Collections.ArrayList _tabs = _tabCtrl.GetTabs(this.PortalId);
foreach (DotNetNuke.Entities.Tabs.TabInfo _tab in _tabs) {
if (_tab.TabName.ToLower() != "admin" && _tab.TabName.ToLower() != "host") {
string _tabName = _tab.TabPath;
if (_tabName.StartsWith("//")) { _tabName = _tabName.Substring(2); }
_tabName = _tabName.Replace("//", "-->");
ListItem _li = new ListItem(_tabName, _tab.TabID.ToString());
drpTabs.Items.Add(_li);
}
}
} catch { }
}
protected void BindMods() {
try {
drpMods.Items.Clear();
if (drpTabs.SelectedValue != "") {
DotNetNuke.Entities.Tabs.TabController _tabCtrl = new DotNetNuke.Entities.Tabs.TabController();
DotNetNuke.Entities.Tabs.TabInfo _tab = _tabCtrl.GetTab(int.Parse(drpTabs.SelectedValue));
DotNetNuke.Entities.Modules.ModuleController _modCtrl = new ModuleController();
System.Collections.ArrayList _mods = _modCtrl.GetPortalTabModules(this.PortalId, _tab.TabID);
foreach (DotNetNuke.Entities.Modules.ModuleInfo _mod in _mods) {
ListItem _li = new ListItem(_mod.ModuleTitle, _mod.ModuleID.ToString());
drpMods.Items.Add(_li);
}
}
} catch { }
}
}
In the text file are two methods - BindTabs() and BindMods().
What I did was I had two drop-down lists - one that listed DNN pages (tabs) and modules, so that I could link info from one module over to another. And the module drop-down list would be populated based on the input of the tab drop-down list selection.
Hope this helps! |
|
|
|
|
Cliff Simpkins Registered Users
 Nuke Addict Posts:71


 |
| 10/10/2006 5:28 PM |
|
And please feel free to point out where I was using DNN objects or controllers incorrectly or inefficiently...it's my first time working in those parts of the DNN namespace.
And it's my first time putting my code out there - I feel like I just lifted up my kilt. |
|
|
|
|
RAZ Registered Users
 Nuke Wiz Posts:119

 |
| 10/11/2006 3:06 AM |
|
Excelent demo, thanx for showing us your code 
For your modules, what do you preferr to use for your module settings
Do you put your settings in the module settings or use the Edit control ?
Is there maybe a rule for this 
Thanx again for your help
RAZ |
|
|
|
|
Scott McCulloch Administrators
 Nuke Master Posts:12442


 |
| 10/11/2006 9:20 PM |
|
I think the preference for settins is in module settings, the edit control (aka view options) is left over when you couldn't add code to the settings screen. Of course, if you have too many options, then the settings screen might not cut it.
Making your code appear on the settings screen is pretty straight forward, using the 2 methods (save and load I think).
The code sample in the above post is a great posting on how to bind the tabs. When I can't think of how to do stuff, I think where in the core it does it, and take a look at the code. The module samples that come with DNN are great for this too! |
|
Scott McCulloch Site Administrator |
|
|
RAZ Registered Users
 Nuke Wiz Posts:119

 |
| 10/12/2006 2:04 AM |
|
where can I find these module samples ??
I changed the BindTab function a bit,
from if (_tab.TabName.ToLower() != "admin" && _tab.TabName.ToLower() != "host") to if (!_tab.TabPath.ToLower().Contains("admin") && !_tab.TabPath.ToLower().Contains("host"))
did so because I got all the subpages for the admin in the list when to TabName is used |
|
|
|
|
Scott McCulloch Administrators
 Nuke Master Posts:12442


 |
| 10/15/2006 7:47 PM |
|
| If you take a look at the core links module, it does the settings work. |
|
Scott McCulloch Site Administrator |
|
|
RAZ Registered Users
 Nuke Wiz Posts:119

 |
| 10/16/2006 9:51 AM |
|
I am now wondering about the DNN exception handling.
I wan´t to be able to throw an error message with in my module when the user tries to use it and has not yet been logged on.
Instead of showing my module with all the fields I only want a message the says "you have to log in before using the module".
I have been trying to throw the ModuleLoadException and then use the catch in the PageLoad function but I only get that the module is currently unavailable.
Can anyone give me a clue how I can do this (I have seen modules that does not appear unless you have made changes in the settings)
RAZ |
|
|
|
|
Scott McCulloch Administrators
 Nuke Master Posts:12442


 |
| 10/17/2006 6:01 AM |
|
I wouldn't use an exception for the logged in message, rather just a label you can set the visibility of.
Take a look at the login control for an example. |
|
Scott McCulloch Site Administrator |
|
|
RAZ Registered Users
 Nuke Wiz Posts:119

 |
| 10/18/2006 9:46 AM |
|
Where can I find good instruction about creating Private Assembly for DNN 4 
In all .zip that I have there are only 2 .dll files, but when I create mine I get one for each ascx file.
RAZ |
|
|
|
|
RAZ Registered Users
 Nuke Wiz Posts:119

 |
| 11/15/2006 1:20 AM |
|
Posted By razmaster on 10/18/2006 9:46 AM Where can I find good instruction about creating Private Assembly for DNN 4  In all .zip that I have there are only 2 .dll files, but when I create mine I get one for each ascx file. RAZ Can anyone help with this ? I have one module with 5 controls. I use the 4.3 starter Kit instruction to create my PA (publish website method). I always get one .dll for each of my controls, but if I take a look at the Blog module there is only one .dll for all the controls. How can I do this for my modules ?
RAZ
|
|
|
|
|
erik hinds Gold Membership
 Nuke Addict Posts:63

 |
|
RAZ Registered Users
 Nuke Wiz Posts:119

 |
| 12/04/2006 2:55 AM |
|
I have one module with many controls (Like Blog). I that case I want to be sure I am developing this in the right matter. 
Do I create one Controller class for every control or is it enough to have one controller class, but many info classes ?
RAZ |
|
|
|
|
Scott McCulloch Administrators
 Nuke Master Posts:12442


 |
| 12/04/2006 3:00 AM |
|
| It depends, I normally have a controller class for each info class, but it would make sense to have just 1 order controlller, if you had say, a orderinfo, orderiteminfo class, etc. |
|
Scott McCulloch Site Administrator |
|
|