﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>DotNetNuke</title>
    <description>DotNetNuke</description>
    <link>http://dataquadrant.com/Blog/tabid/54/BlogId/2/Default.aspx</link>
    <language>en-US</language>
    <webMaster>md@dumitrascu.net</webMaster>
    <pubDate>Sat, 04 Sep 2010 12:43:58 GMT</pubDate>
    <lastBuildDate>Sat, 04 Sep 2010 12:43:58 GMT</lastBuildDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Blog RSS Generator Version 3.5.1.40272</generator>
    <item>
      <title>How to Check if Current Page is in Edit or Preview Mode</title>
      <description>&lt;div style="margin: 0in 0in 0pt"&gt;As part of the sequel “How to do simple things in DotNetNuke after you created your first module”, I’ll show you today how to recognize inside your module, when the page is in edit mode and when is in preview mode. &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt; Me.EditMode property is not enough to show this state of the page. You need also to evaluate the a cookie used to indicate if the page is in preview or not.&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt;  &lt;/div&gt;
&lt;pre style="margin: 0in 0in 0pt"&gt;&lt;font color="#0000ff"&gt;If Me.EditMode Then&lt;br /&gt;   Dim objPreview As HttpCookie&lt;br /&gt;   objPreview = Request.Cookies("_Tab_Admin_Preview" &amp; PortalSettings.PortalId.ToString)&lt;br /&gt;   If Not objPreview Is Nothing AndAlso CType(objPreview.Value, Boolean) Then&lt;br /&gt;     'the page is in preview mode&lt;br /&gt;     '...&lt;br /&gt;    &lt;br /&gt;   Else&lt;br /&gt;     'the page is in edit mode&lt;br /&gt;     '...&lt;br /&gt;  &lt;br /&gt;   End If&lt;br /&gt;End If&lt;/font&gt;&lt;/pre&gt;
&lt;div style="margin: 0in 0in 0pt"&gt;  &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt;This is useful, obviously when you want to show different things when the page is in edit mode rather than preview.&lt;/div&gt;</description>
      <link>http://dataquadrant/Blog/tabid/54/EntryId/13/How-to-Check-if-Current-Page-is-in-Edit-or-Preview-Mode.aspx</link>
      <comments>http://dataquadrant/Blog/tabid/54/EntryId/13/How-to-Check-if-Current-Page-is-in-Edit-or-Preview-Mode.aspx#Comments</comments>
      <guid isPermaLink="true">http://dataquadrant/Blog/tabid/54/EntryId/13/How-to-Check-if-Current-Page-is-in-Edit-or-Preview-Mode.aspx</guid>
      <pubDate>Tue, 31 Jul 2007 01:34:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://dataquadrant.com/DesktopModules/Blog/Trackback.aspx?id=13</trackback:ping>
    </item>
    <item>
      <title>How to Create a Page Programmatically in DotNetNuke</title>
      <description>&lt;div style="margin: 0in 0in 0pt"&gt;This snippet of code shows you how to programmatically create a page (tab) in DotNetNuke 4.x from a template.&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt;It is called from the context of a module, so we have access to some of the main objects of DNN framework, such as PortalSettings.&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt;Few properties are copied from the current active page: TabPermissions, SkinSrc, ContainerSrc. With a little effort you can specify your own values, if these ones are not appropriate.&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt;The most important point is the use of the page template. By default, DotNetNuke comes with one template that is adding a HTML module to the main ContentPane. This template is placed in “…\Portals\_default\Templates\ Default.page.template” file. It is a XML file and you can easily change it or clone it to create your own template.&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt;
&lt;div style="margin: 0in 0in 0pt"&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="font-size: x-small"&gt;&lt;span style="font-family: Courier New"&gt;        'create new hidden page &lt;br /&gt;
        Dim ctrTab As New DotNetNuke.Entities.Tabs.TabController&lt;br /&gt;
        Dim objTab As New DotNetNuke.Entities.Tabs.TabInfo&lt;br /&gt;
        Dim objActiveTab As DotNetNuke.Entities.Tabs.TabInfo&lt;br /&gt;
        objActiveTab = Me.PortalSettings.ActiveTab&lt;br /&gt;
        objTab.IsVisible = False&lt;br /&gt;
        objTab.PortalID = Me.PortalId&lt;br /&gt;
        objTab.TabID = Null.NullInteger&lt;br /&gt;
        objTab.PortalID = PortalId&lt;br /&gt;
        objTab.TabName = "Page Name"&lt;br /&gt;
        objTab.Title = "Page Name"&lt;br /&gt;
        objTab.Description = "Description"&lt;br /&gt;
        objTab.KeyWords = ""&lt;br /&gt;
        'we make it hidden this time&lt;br /&gt;
        objTab.IsVisible = False&lt;br /&gt;
        objTab.DisableLink = False&lt;br /&gt;
        objTab.ParentId = -1&lt;br /&gt;
        objTab.IconFile = ""&lt;br /&gt;
        objTab.IsDeleted = False&lt;br /&gt;
        objTab.Url = "N"&lt;br /&gt;
        'get the same permissions as the current active page&lt;br /&gt;
        objTab.TabPermissions = objActiveTab.TabPermissions&lt;br /&gt;
        'get the same skin as the current active page&lt;br /&gt;
        objTab.SkinSrc = objActiveTab.SkinSrc&lt;br /&gt;
        objTab.ContainerSrc = objActiveTab.ContainerSrc&lt;br /&gt;
        objTab.TabPath = GenerateTabPath(objTab.ParentId, objTab.TabName)&lt;br /&gt;
        objTab.StartDate = Null.NullDate&lt;br /&gt;
        objTab.EndDate = Null.NullDate&lt;br /&gt;
        objTab.PageHeadText = ""&lt;br /&gt;
        objTab.TabID = ctrTab.AddTab(objTab)&lt;br /&gt;
        'create the page from our template&lt;br /&gt;
        Dim xmlDoc As New System.Xml.XmlDocument&lt;br /&gt;
        xmlDoc.Load(Server.MapPath(Me.Page.TemplateSourceDirectory &amp; "/Portals/_default/Templates") &amp; _&lt;br /&gt;
        "\Default.page.template")&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="font-size: x-small"&gt;&lt;span style="font-family: Courier New"&gt;        Dim objPortals As New PortalController&lt;br /&gt;
        objPortals.ParsePanes(xmlDoc.SelectSingleNode("//portal/tabs/tab/panes"), _&lt;br /&gt;
                              objTab.PortalID, objTab.TabID, PortalTemplateModuleAction.Ignore, New Hashtable)&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt"&gt;I will conclude that creating pages programmatically is not complicated in DotNetNuke, and can be useful in the process of custom module creation, when we want to save the admin user few extra steps.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;</description>
      <link>http://dataquadrant/Blog/tabid/54/EntryId/12/How-to-Create-a-Page-Programmatically-in-DotNetNuke.aspx</link>
      <comments>http://dataquadrant/Blog/tabid/54/EntryId/12/How-to-Create-a-Page-Programmatically-in-DotNetNuke.aspx#Comments</comments>
      <guid isPermaLink="true">http://dataquadrant/Blog/tabid/54/EntryId/12/How-to-Create-a-Page-Programmatically-in-DotNetNuke.aspx</guid>
      <pubDate>Mon, 30 Jul 2007 09:44:00 GMT</pubDate>
      <slash:comments>6</slash:comments>
      <trackback:ping>http://dataquadrant.com/DesktopModules/Blog/Trackback.aspx?id=12</trackback:ping>
    </item>
    <item>
      <title>Workaround Module Installer Problems With Same Filename In Different Locations</title>
      <description>The problem I have with dnn module installer/packager is that I cannot pack files with same name that reside in different locations of your module subfolders.&lt;a href=http://dataquadrant/Blog/tabid/54/EntryId/10/Workaround-Module-Installer-Problems-With-Same-Filename-In-Different-Locations.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://dataquadrant/Blog/tabid/54/EntryId/10/Workaround-Module-Installer-Problems-With-Same-Filename-In-Different-Locations.aspx</link>
      <comments>http://dataquadrant/Blog/tabid/54/EntryId/10/Workaround-Module-Installer-Problems-With-Same-Filename-In-Different-Locations.aspx#Comments</comments>
      <guid isPermaLink="true">http://dataquadrant/Blog/tabid/54/EntryId/10/Workaround-Module-Installer-Problems-With-Same-Filename-In-Different-Locations.aspx</guid>
      <pubDate>Mon, 04 Jun 2007 06:52:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://dataquadrant.com/DesktopModules/Blog/Trackback.aspx?id=10</trackback:ping>
    </item>
    <item>
      <title>How to Migrate HTML module source code from DNN 3.x to DNN 4.x</title>
      <description>Four steps for migrating HTML module source code  from DNN 3 to DNN 4&lt;a href=http://dataquadrant/Blog/tabid/54/EntryId/1/How-to-Migrate-HTML-module-source-code-from-DNN-3-x-to-DNN-4-x.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://dataquadrant/Blog/tabid/54/EntryId/1/How-to-Migrate-HTML-module-source-code-from-DNN-3-x-to-DNN-4-x.aspx</link>
      <comments>http://dataquadrant/Blog/tabid/54/EntryId/1/How-to-Migrate-HTML-module-source-code-from-DNN-3-x-to-DNN-4-x.aspx#Comments</comments>
      <guid isPermaLink="true">http://dataquadrant/Blog/tabid/54/EntryId/1/How-to-Migrate-HTML-module-source-code-from-DNN-3-x-to-DNN-4-x.aspx</guid>
      <pubDate>Mon, 24 Jul 2006 01:47:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://dataquadrant.com/DesktopModules/Blog/Trackback.aspx?id=1</trackback:ping>
    </item>
  </channel>
</rss>