Example #1
0
        /// <summary>
        /// Add New album
        /// 1 add tag
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void View_AddNewAlbum(object sender, Args.AlbumEventArgs <Entities.AlbumInfo, string> e)
        {
            //Insert new Album to DataBase
            string[] tags = e.Tags.Split(new[] { ',' });
            if (tags.Length < 2)
            {
                DotNetNuke.UI.Skins.Skin.AddModuleMessage(sender as UserControl, LocalizeString("RequiredTagInput"), ModuleMessage.ModuleMessageType.RedError);
                return;
            }

            var userEnteredTerms = e.Tags.Split(',')
                                   .Where(s => s != string.Empty)
                                   .Select(p => p.Trim())
                                   .Distinct().ToList();

            foreach (var s in userEnteredTerms)
            {
                if (!UtilsGB.ContainsSpecialCharacter(s))
                {
                    continue;
                }
                var msg = Localization.GetString("UnAllowedCharacters", LocalResourceFile);
                msg = msg.Replace("{0}", Constants.DisallowedCharacters);
                DotNetNuke.UI.Skins.Skin.AddModuleMessage(sender as UserControl, msg, ModuleMessage.ModuleMessageType.RedError);
                return;
            }

            try
            {
                //add news term to vocabularyid
                var terms = new List <Term>();
                userEnteredTerms.ForEach(t => terms.Add(TermDnnController.CreateAndReturnTerm(t, VocabularyId)));

                e.AlbumInfo.Terms = terms;
                AlbumController album = new AlbumController();
                album.AddAlbum(e.AlbumInfo, ModuleContext.TabId);

                DotNetNuke.UI.Skins.Skin.AddModuleMessage(sender as UserControl, LocalizeString("SaveSuccess"), ModuleMessage.ModuleMessageType.GreenSuccess);
            }catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
                DotNetNuke.UI.Skins.Skin.AddModuleMessage(sender as UserControl, LocalizeString("SaveError"), ModuleMessage.ModuleMessageType.RedError);
            }
        }
Example #2
0
        public void Refresh()
        {
            UtilsGB.RegisterClientDependencies(Page);

            var ctlDirectory = TemplateSourceDirectory;

            var objControl = LoadControl(ctlDirectory + Model.ControlToLoad) as ModuleUserControlBase;

            if (objControl == null)
            {
                return;
            }

            phUserControl.Controls.Clear();
            objControl.ModuleContext.Configuration = ModuleContext.Configuration;
            objControl.ID = System.IO.Path.GetFileNameWithoutExtension(ctlDirectory + Model.ControlToLoad);
            phUserControl.Controls.Add(objControl);

            if ((string)ViewState["CtlToLoad"] != Model.ControlToLoad)
            {
                ViewState["CtlToLoad"] = Model.ControlToLoad;
            }
        }
Example #3
0
        /// <summary>
        /// This is the friendly URL format for viewing a question (handles re-writting on/off).
        /// </summary>
        /// <param name="questionId"></param>
        /// <param name="questionTitle"></param>
        /// <param name="tab"></param>
        /// <param name="ps"></param>
        /// <returns></returns>
        public static string ViewQuestion(int questionId, string questionTitle, TabInfo tab, PortalSettings ps)
        {
            if (UtilsGB.IsFriendlyUrlModuleInstalled && UtilsGB.UseFriendlyUrls)
            {
                // JS 1/25/12: This check is for removing the .aspx from the question and tags.
                //             There appears to be conflicts between IIS7.5 installations that need to be address
                //if (HttpRuntime.UsingIntegratedPipeline)
                //{
                //    return DotNetNuke.Common.Globals.NavigateURL(tab.TabID).Replace(".aspx", "") + ("/Question/" + questionId + "/" + Utils.CreateFriendlySlug(questionTitle));
                //}

                if (ps.HomeTabId == tab.TabID && DotNetNuke.Common.Globals.NavigateURL(tab.TabID).EndsWith("/"))
                {
                    return(DotNetNuke.Common.Globals.NavigateURL(tab.TabID).Replace(".aspx", "") + tab.IndentedTabName.Replace(" ", "") + ("/" + UtilsGB.GetQuestionUrlName() + "/" + questionId + "/" + UtilsGB.CreateFriendlySlug(questionTitle) + ".aspx"));
                }
                return(DotNetNuke.Common.Globals.NavigateURL(tab.TabID).Replace(".aspx", "") + ("/" + UtilsGB.GetQuestionUrlName() + "/" + questionId + "/" + UtilsGB.CreateFriendlySlug(questionTitle) + ".aspx"));
            }
            return(ViewQuestion(questionId, tab.TabID, ps));
        }
Example #4
0
        public static string ViewTaggedQuestions(string termName, TabInfo tab, PortalSettings ps)
        {
            if (UtilsGB.IsFriendlyUrlModuleInstalled && UtilsGB.UseFriendlyUrls)
            {
                // JS 1/25/12: This check is for removing the .aspx from the question and tags.
                //             There appears to be conflicts between IIS7.5 installations that need to be address
                //if (HttpRuntime.UsingIntegratedPipeline)
                //{
                //    return DotNetNuke.Common.Globals.NavigateURL(tab.TabID).Replace(".aspx", "") + ("/Tag/" + HttpUtility.UrlEncode(termName));
                //}

                termName = termName.Replace(" ", "-");
                if (ps.HomeTabId == tab.TabID && DotNetNuke.Common.Globals.NavigateURL(tab.TabID).EndsWith("/"))
                {
                    return(DotNetNuke.Common.Globals.NavigateURL(tab.TabID) + tab.IndentedTabName.Replace(" ", "") + ("/" + UtilsGB.GetTagUrlName(ps) + "/" + HttpUtility.UrlEncode(termName) + ".aspx"));
                }
                return(DotNetNuke.Common.Globals.NavigateURL(tab.TabID).Replace(".aspx", "") + ("/" + UtilsGB.GetTagUrlName(ps) + "/" + HttpUtility.UrlEncode(termName) + ".aspx"));
            }
            return(DotNetNuke.Common.Globals.NavigateURL(tab.TabID, ps, "", "view=" + Constants.PageScope.Browse.ToString().ToLower(), "tag=" + HttpUtility.UrlEncode(termName)));
        }