Beispiel #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   Builds the url for the lang. html editor control
        /// </summary>
        /// <param name = "name"></param>
        /// <returns></returns>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///   [vmasanas]	07/10/2004	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected string OpenFullEditor(string name)
        {
            string file = null;

            file = SelectedResourceFile.Replace(Server.MapPath(Globals.ApplicationPath + "/"), "");
            return(EditUrl("Name",
                           name,
                           "EditResourceKey",
                           "Locale=" + Locale,
                           "ResourceFile=" + Globals.QueryStringEncode(file.Replace("\\", "/")),
                           "Mode=" + rbMode.SelectedValue,
                           "Highlight=" + chkHighlight.Checked.ToString().ToLower()));
        }
 private void AddPrintAction()
 {
     var action = new ModuleAction(GetNextActionID())
                      {
                          Title = Localization.GetString(ModuleActionType.PrintModule, Localization.GlobalResourceFile),
                          CommandName = ModuleActionType.PrintModule,
                          CommandArgument = "",
                          Icon = "action_print.gif",
                          Url = NavigateUrl(TabId,
                                          "",
                                          false,
                                          "mid=" + ModuleId,
                                          "SkinSrc=" + Globals.QueryStringEncode("[G]" + SkinController.RootSkin + "/" + Globals.glbHostSkinFolder + "/" + "No Skin"),
                                          "ContainerSrc=" + Globals.QueryStringEncode("[G]" + SkinController.RootContainer + "/" + Globals.glbHostSkinFolder + "/" + "No Container"),
                                          "dnnprintmode=true"),
                          Secure = SecurityAccessLevel.Anonymous,
                          UseActionEvent = true,
                          Visible = true,
                          NewWindow = true
                      };
     _moduleGenericActions.Actions.Add(action);
 }
        private string ProcessContainers(string strFolderPath)
        {
            string strGallery = "";
            int    intIndex   = 0;

            if (Directory.Exists(strFolderPath))
            {
                if (cboContainers.Items.FindByValue(strFolderPath.Replace(Globals.ApplicationMapPath.ToLower(), "")) != null)
                {
                    cboContainers.Items.FindByValue(strFolderPath.Replace(Globals.ApplicationMapPath.ToLower(), "")).Selected = true;
                }

                string strContainerType;
                if (strFolderPath.ToLower().IndexOf(Globals.HostMapPath.ToLower()) != -1)
                {
                    strContainerType = "G";
                }
                else
                {
                    strContainerType = "L";
                }

                strGallery  = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">";
                strGallery += "<tr><td align=\"center\" bgcolor=\"#CCCCCC\" class=\"Head\">" + Localization.GetString("plContainers.Text", this.LocalResourceFile) + "</td></tr>";
                strGallery += "<tr><td align=\"center\">";
                strGallery += "<table border=\"0\" cellspacing=\"4\" cellpadding=\"4\"><tr>";

                string[] arrFiles = Directory.GetFiles(strFolderPath, "*.ascx");
                if (arrFiles.Length == 0)
                {
                    strGallery += "<td align=\"center\" valign=\"bottom\" class=\"NormalBold\">" + Localization.GetString("NoContainer.ErrorMessage", this.LocalResourceFile) + "</td>";
                }
                //string strFolder = strFolderPath.Substring( strFolderPath.LastIndexOf( "\\" ) + 1 - 1 );
                string strFolder = strFolderPath.Substring(strFolderPath.LastIndexOf("\\") + 1);
                foreach (string tempLoopVar_strFile in arrFiles)
                {
                    string strFile = tempLoopVar_strFile;
                    intIndex++;
                    if (intIndex == 4)
                    {
                        strGallery += "</tr><tr>";
                        intIndex    = 0;
                    }

                    // name
                    strFile     = strFile.ToLower();
                    strGallery += "<td align=\"center\" valign=\"bottom\" class=\"NormalBold\">";
                    strGallery += Path.GetFileNameWithoutExtension(strFile) + "<br>";
                    // thumbnail
                    string strURL;
                    if (File.Exists(strFile.Replace(".ascx", ".jpg")))
                    {
                        strURL      = strFile.Substring(strFile.IndexOf("\\portals\\"));
                        strGallery += "<a href=\"" + ResolveUrl("~" + strURL.Replace(".ascx", ".jpg")) + "\" target=\"_new\"><img src=\"" + CreateThumbnail(strFile.Replace(".ascx", ".jpg")) + "\" border=\"1\"></a>";
                    }
                    else
                    {
                        strGallery += "<img src=\"" + ResolveUrl("~/images/thumbnail.jpg") + "\" border=\"1\">";
                    }
                    // options
                    strURL = strFile.Substring(strFile.IndexOf("\\" + SkinInfo.RootContainer.ToLower() + "\\"));
                    strURL.Replace(".ascx", "");
                    strGallery += "<br><a class=\"CommandButton\" href=\"" + Globals.NavigateURL(PortalSettings.HomeTabId) + "?ContainerSrc=[" + strContainerType + "]" + Globals.QueryStringEncode(strURL.Replace(".ascx", "").Replace("\\", "/")) + "\" target=\"_new\">" + Localization.GetString("cmdPreview", this.LocalResourceFile) + "</a>";
                    strGallery += "&nbsp;&nbsp;|&nbsp;&nbsp;";
                    strGallery += "<a class=\"CommandButton\" href=\"" + Globals.ApplicationPath + Globals.ApplicationURL().Replace("~", "") + "&Root=" + SkinInfo.RootContainer + "&Type=" + strContainerType + "&Name=" + strFolder + "&Src=" + Path.GetFileName(strFile) + "&action=apply\">" + Localization.GetString("cmdApply", this.LocalResourceFile) + "</a>";
                    if (UserInfo.IsSuperUser || strContainerType == "L")
                    {
                        strGallery += "&nbsp;&nbsp;|&nbsp;&nbsp;";
                        strGallery += "<a class=\"CommandButton\" href=\"" + Globals.ApplicationPath + Globals.ApplicationURL().Replace("~", "") + "&Root=" + SkinInfo.RootContainer + "&Type=" + strContainerType + "&Name=" + strFolder + "&Src=" + Path.GetFileName(strFile) + "&action=delete\">" + Localization.GetString("cmdDelete") + "</a>";
                    }
                    strGallery += "</td>";
                }

                strGallery += "</tr></table></td></tr>";
                if (File.Exists(strFolderPath + "/" + Globals.glbAboutPage))
                {
                    strGallery += AddCopyright(strFolderPath + "/" + Globals.glbAboutPage, strFolder);
                }
                strGallery += "</table><br>";
            }

            return(strGallery);
        }
Beispiel #4
0
        /// <summary>
        /// LoadActions loads the Actions collections
        /// </summary>
        /// <remarks>
        /// </remarks>
        private void LoadActions()
        {
            _actions = new ModuleActionCollection();
            int maxActionId = Null.NullInteger;

            //check if module Implements Entities.Modules.IActionable interface
            if (this is IActionable)
            {
                // load module actions
                ModuleActionCollection ModuleActions = ((IActionable)this).ModuleActions;

                foreach (ModuleAction action in ModuleActions)
                {
                    if (CanAddAction(action.Secure, false))
                    {
                        if (action.Icon == "")
                        {
                            action.Icon = "edit.gif";
                        }
                        if (action.ID > maxActionId)
                        {
                            maxActionId = action.ID;
                        }
                        _actions.Add(action);
                    }
                }
            }

            //Make sure the Next Action Id counter is correct
            int actionCount = GetActionsCount(_actions.Count, _actions);

            if (_nextActionId < maxActionId)
            {
                _nextActionId = maxActionId;
            }
            if (_nextActionId < actionCount)
            {
                _nextActionId = actionCount;
            }

            if (!(string.IsNullOrEmpty(ModuleConfiguration.BusinessControllerClass)))
            {
                // check if module implements IPortable interface, and user has Admin permissions
                if (ModuleConfiguration.IsPortable & CanAddAction(SecurityAccessLevel.Admin, true))
                {
                    _actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.ImportModule, Localization.GlobalResourceFile), "", "", "rt.gif", Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "ImportModule", "moduleid=" + ModuleId), "", false, SecurityAccessLevel.Admin, EditMode, false);
                    _actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.ExportModule, Localization.GlobalResourceFile), "", "", "lt.gif", Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "ExportModule", "moduleid=" + ModuleId), "", false, SecurityAccessLevel.Admin, EditMode, false);
                }

                //If TypeOf objPortalModuleBase Is ISearchable Then
                if (ModuleConfiguration.IsSearchable & CanAddAction(SecurityAccessLevel.Anonymous, true))
                {
                    _actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.SyndicateModule, Localization.GlobalResourceFile), ModuleActionType.SyndicateModule, "", "xml.gif", Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "", "moduleid=" + ModuleId).Replace(Globals.glbDefaultPage, "RSS.aspx"), "", false, SecurityAccessLevel.Anonymous, true, true);
                }
            }

            // help module actions available to content editors and administrators
            if (ModuleConfiguration.ControlType != SecurityAccessLevel.Anonymous & Request.QueryString["ctl"] != "Help")
            {
                SetHelpVisibility();
            }

            //Add Print Action
            if (ModuleConfiguration.DisplayPrint & CanAddAction(SecurityAccessLevel.Anonymous, true))
            {
                // print module action available to everyone
                _actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.PrintModule, Localization.GlobalResourceFile), ModuleActionType.PrintModule, "", "print.gif", Globals.NavigateURL(TabId, "", "mid=" + ModuleId, "SkinSrc=" + Globals.QueryStringEncode("[G]" + SkinInfo.RootSkin + "/" + Globals.glbHostSkinFolder + "/" + "No Skin"), "ContainerSrc=" + Globals.QueryStringEncode("[G]" + SkinInfo.RootContainer + "/" + Globals.glbHostSkinFolder + "/" + "No Container"), "dnnprintmode=true"), "", false, SecurityAccessLevel.Anonymous, true, true);
            }

            // core module actions only available to administrators
            if (CanAddAction(SecurityAccessLevel.Admin, true))
            {
                // module settings
                _actions.Add(GetNextActionID(), "~", "");
                _actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.ModuleSettings, Localization.GlobalResourceFile), ModuleActionType.ModuleSettings, "", "settings.gif", Globals.NavigateURL(TabId, "Module", "ModuleId=" + ModuleId), false, SecurityAccessLevel.Admin, true);
                _actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.DeleteModule, Localization.GlobalResourceFile), ModuleActionType.DeleteModule, ModuleConfiguration.ModuleID.ToString(), "delete.gif", "", "confirm('" + ClientAPI.GetSafeJSString(Localization.GetString("DeleteModule.Confirm")) + "')", false, SecurityAccessLevel.Admin, true, false);
                if (ModuleConfiguration.CacheTime != 0)
                {
                    _actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.ClearCache, Localization.GlobalResourceFile), ModuleActionType.ClearCache, ModuleConfiguration.ModuleID.ToString(), "restore.gif", "", false, SecurityAccessLevel.Admin, true);
                }

                // module movement
                _actions.Add(GetNextActionID(), "~", "");
                ModuleAction MoveActionRoot = new ModuleAction(GetNextActionID(), Localization.GetString(ModuleActionType.MoveRoot, Localization.GlobalResourceFile), "", "", "", "", "", false, SecurityAccessLevel.Admin, EditMode);

                // move module up/down
                if (ModuleConfiguration != null)
                {
                    SetMoveMenuVisibility(MoveActionRoot.Actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.MoveTop, Localization.GlobalResourceFile), ModuleActionType.MoveTop, ModuleConfiguration.PaneName, "top.gif", "", false, SecurityAccessLevel.Admin, EditMode));
                    SetMoveMenuVisibility(MoveActionRoot.Actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.MoveUp, Localization.GlobalResourceFile), ModuleActionType.MoveUp, ModuleConfiguration.PaneName, "up.gif", "", false, SecurityAccessLevel.Admin, EditMode));
                    SetMoveMenuVisibility(MoveActionRoot.Actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.MoveDown, Localization.GlobalResourceFile), ModuleActionType.MoveDown, ModuleConfiguration.PaneName, "dn.gif", "", false, SecurityAccessLevel.Admin, EditMode));
                    SetMoveMenuVisibility(MoveActionRoot.Actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.MoveBottom, Localization.GlobalResourceFile), ModuleActionType.MoveBottom, ModuleConfiguration.PaneName, "bottom.gif", "", false, SecurityAccessLevel.Admin, EditMode));
                }

                // move module to pane
                for (int intItem = 0; intItem < PortalSettings.ActiveTab.Panes.Count; intItem++)
                {
                    SetMoveMenuVisibility(MoveActionRoot.Actions.Add(GetNextActionID(), Localization.GetString(ModuleActionType.MovePane, Localization.GlobalResourceFile) + " " + Convert.ToString(PortalSettings.ActiveTab.Panes[intItem]), ModuleActionType.MovePane, Convert.ToString(PortalSettings.ActiveTab.Panes[intItem]), "move.gif", "", false, SecurityAccessLevel.Admin, EditMode));
                }
                foreach (ModuleAction ma in MoveActionRoot.Actions)
                {
                    if (ma.Visible)
                    {
                        _actions.Add(MoveActionRoot);
                        break;
                    }
                }
            }
        }
Beispiel #5
0
        protected void cmdPreview_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(SkinSrc))
            {
                string strType = SkinRoot.Substring(0, SkinRoot.Length - 1);

                string strURL = Globals.AddHTTP(Globals.GetDomainName(Request)) + Globals.ApplicationURL(_objPortal.HomeTabId).Replace("~", "");
                //detect if there is already a '?' in the URL (in case of a child portal)
                if (strURL.IndexOf("?") > 0)
                {
                    strURL += "&";
                }
                else
                {
                    strURL += "?";
                }
                strURL += "portalid=" + _objPortal.PortalID + "&" + strType + "Src=" + Globals.QueryStringEncode(SkinSrc.Replace(".ascx", ""));

                if (SkinRoot == SkinInfo.RootContainer)
                {
                    if (Request.QueryString["ModuleId"] != null)
                    {
                        strURL += "&ModuleId=" + Request.QueryString["ModuleId"];
                    }
                }

                Response.Write("<script>window.open('" + strURL + "','_blank')</script>");
            }
        }
        /// <summary>
        /// Builds the url for the lang. html editor control
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [vmasanas]	07/10/2004	Created
        /// </history>
        protected string OpenFullEditor(string name)
        {
            string file;

            file = SelectedResourceFile.Replace(Server.MapPath(Globals.ApplicationPath + "/"), "");
            return(EditUrl("name", name, "fulleditor", "locale=" + cboLocales.SelectedValue, "resourcefile=" + Globals.QueryStringEncode(file), "mode=" + rbMode.SelectedValue));
        }