Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        public void Refresh()
        {
            dgqHeaderNav.ModContext = ModuleContext;
            hlEdit.NavigateUrl      = Links.EditTag(ModuleContext, ModuleContext.TabId, Model.SelectedTerm.Name);
            hlHistory.NavigateUrl   = Links.ViewTagHistory(ModuleContext, Model.SelectedTerm.Name);
            hlSynonym.NavigateUrl   = Links.ViewTermSynonyms(ModuleContext, Model.SelectedTerm.Name);
            hlAbout.NavigateUrl     = Links.ViewTagDetail(ModuleContext, ModuleContext.TabId, Model.SelectedTerm.Name);

            if (Model.ActiveTermSynonyms.Count > 0)
            {
                tagSynonyms.ModContext = ModuleContext;
                tagSynonyms.ModuleTab  = ModuleContext.PortalSettings.ActiveTab;
                tagSynonyms.DataSource = Model.ActiveTermSynonyms;
                tagSynonyms.DataBind();
            }

            if (Model.SuggestedTermSynonyms.Count > 0)
            {
                rptSuggestedSynonyms.DataSource = Model.SuggestedTermSynonyms;
                rptSuggestedSynonyms.DataBind();
            }

            switch (Model.SelectedView.ToLower())
            {
            case "termsynonyms":
                hlSynonym.CssClass = "qaSortSel";
                divDetail.Visible  = false;
                divSynonym.Visible = true;
                break;

            default:
                hlAbout.CssClass   = "qaSortSel";
                divSynonym.Visible = false;
                divDetail.Visible  = true;
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        public void Refresh()
        {
            dgqHeaderNav.ModContext = ModuleContext;
            litTitle.Text           = Model.HeaderTitle;

            if (Model.SelectedTerm != null)
            {
                hlDetail.NavigateUrl = Model.TagDetailUrl;
                hlEdit.NavigateUrl   = Links.EditTag(ModuleContext, ModuleContext.TabId, Model.SelectedTerm.Name);
                pnlTag.Visible       = true;
            }

            rptQuestions.DataSource = Model.ColQuestions;
            rptQuestions.DataBind();

            pnlNoRecords.Visible = (Model.ColQuestions.Count <= 0);

            switch (Model.SortBy.ToLower())
            {
            case "newest":
                hlNewest.CssClass = "qaSortSel";
                break;

            case "votes":
                hlVotes.CssClass = "qaSortSel";
                break;

            default:                     // active
                hlActive.CssClass = "qaSortSel";
                break;
            }

            if (Model.AppliedFilters.Count > 0)
            {
                if (Model.AppliedKeyword != null)
                {
                    hlNewest.NavigateUrl = Links.KeywordSearchSorted(ModuleContext, Model.AppliedKeyword, "newest");
                    hlVotes.NavigateUrl  = Links.KeywordSearchSorted(ModuleContext, Model.AppliedKeyword, "votes");
                    hlActive.NavigateUrl = Links.KeywordSearch(ModuleContext, Model.AppliedKeyword);
                }
                else if (Model.SelectedTerm != null)
                {
                    hlNewest.NavigateUrl = Links.ViewTaggedQuestionsSorted(ModuleContext, Model.SelectedTerm.Name, "newest");
                    hlVotes.NavigateUrl  = Links.ViewTaggedQuestionsSorted(ModuleContext, Model.SelectedTerm.Name, "votes");
                    hlActive.NavigateUrl = Links.ViewTaggedQuestions(Model.SelectedTerm.Name, ModuleContext.PortalSettings.ActiveTab, ModuleContext.PortalSettings);
                }
                else if (Model.AppliedUser > 0)
                {
                    // check for answers or questions
                    if (Model.AppliedType == "questions")
                    {
                        hlNewest.NavigateUrl = Links.ViewUserQuestionsSorted(ModuleContext, Model.AppliedUser, "newest");
                        hlVotes.NavigateUrl  = Links.ViewUserQuestionsSorted(ModuleContext, Model.AppliedUser, "votes");
                        hlActive.NavigateUrl = Links.ViewUserQuestions(ModuleContext, Model.AppliedUser);
                    }
                    else
                    {
                        hlNewest.NavigateUrl = Links.ViewUserAnswersSorted(ModuleContext, Model.AppliedUser, "newest");
                        hlVotes.NavigateUrl  = Links.ViewUserAnswersSorted(ModuleContext, Model.AppliedUser, "votes");
                        hlActive.NavigateUrl = Links.ViewUserAnswers(ModuleContext, Model.AppliedUser);
                    }
                }
                else
                {
                    // no special filters
                    hlNewest.NavigateUrl = Links.ViewQuestionsSorted(ModuleContext, "newest", Model.ApplyUnanswered, Model.CurrentPage);
                    hlVotes.NavigateUrl  = Links.ViewQuestionsSorted(ModuleContext, "votes", Model.ApplyUnanswered, Model.CurrentPage);
                    hlActive.NavigateUrl = Model.ApplyUnanswered ? Links.ViewUnansweredQuestions(ModuleContext, Model.CurrentPage, "") : Links.ViewQuestions(ModuleContext);
                }
            }

            rptTags.DataSource = Model.RelatedTags;
            rptTags.DataBind();

            hlMyAnswers.NavigateUrl       = Links.ViewUserAnswers(ModuleContext, ModuleContext.PortalSettings.UserId);
            hlMyQuestions.NavigateUrl     = Links.ViewUserQuestions(ModuleContext, ModuleContext.PortalSettings.UserId);
            hlMySubscriptions.NavigateUrl = Links.ViewUserSubscriptions(ModuleContext);
            hlPrivileges.NavigateUrl      = Links.ViewPrivilege(ModuleContext, string.Empty);

            DashboardDataBound(this, new HomeUserEventArgs <HtmlGenericControl, HtmlGenericControl, HtmlGenericControl, HtmlGenericControl, Literal, Literal, Literal, Literal>(headMyDashboard, ulMyDashboard, headFavoriteTags, ulFavoriteTags, litQuestionCount, litAnswerCount, litSubscriptionCount, litUserScore));

            if (Page.IsPostBack)
            {
                return;
            }
            cmdMore.CommandArgument = "1";
            cmdBack.CommandArgument = "0";
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        public void Refresh()
        {
            dgqHeaderNav.ModContext = ModuleContext;

            hlTitle.Text        = Model.SelectedCoreTerm.Name;
            hlTitle.NavigateUrl = Links.ViewTagDetail(ModuleContext, ModuleContext.TabId, Model.SelectedCoreTerm.Name);

            UserInfo objUser;

            if (Model.SelectedCoreTerm.Description.Trim().Length < 1)
            {
                var strMessage = @"<div class='dnnFormMessage dnnFormWarning'>" +
                                 Localization.GetString("NoHistory", LocalResourceFile) + @"</div>";

                if (ModuleContext.PortalSettings.UserId > 0)
                {
                    strMessage = @"<div class='dnnFormMessage dnnFormWarning'><p>" +
                                 Localization.GetString("NoHistory", LocalResourceFile) + @"</p><a class='dnnPrimaryAction' href='" + Links.EditTag(ModuleContext, ModuleContext.TabId, Model.SelectedCoreTerm.Name) + @"'>" + Localization.GetString("Improve", LocalResourceFile) + @"</a></div>";
                }

                litDescription.Text = strMessage;
                objUser             = UserController.GetUserById(ModuleContext.PortalId, Model.SelectedCoreTerm.CreatedByUserID);
            }
            else
            {
                litDescription.Text = Model.SelectedCoreTerm.Description;
                objUser             = UserController.GetUserById(ModuleContext.PortalId, Model.SelectedCoreTerm.LastModifiedByUserID);
            }

            litUpdated.Text       = @"<a href=" + Globals.UserProfileURL(objUser.UserID) + @">" + objUser.DisplayName + @" </a>".Trim();
            dbiUser.AlternateText = objUser.DisplayName;
            dbiUser.ToolTip       = objUser.DisplayName;
            dbiUser.ImageUrl      = objUser.Profile.PhotoURL;

            rptTermHistory.DataSource = Model.TermHistory;
            rptTermHistory.DataBind();
        }
Esempio n. 4
0
        /// <summary>
        /// This method renders the entire user interface for this control.
        /// </summary>
        /// <param name="writer"></param>
        /// <returns></returns>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (Terms != null)
            {
                foreach (var term in Terms)
                {
                    var link       = Links.ViewTaggedQuestions(term.Name, ModuleTab, ModContext.PortalSettings);
                    var detaillink = Links.ViewTagDetail(ModContext, ModuleTab.TabID, term.Name);
                    //var historylink = Links.ViewTagHistory(ModContext, term.Name);
                    var improvelink = Links.EditTag(ModContext, ModuleTab.TabID, term.Name);

                    // <div>
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "qaTooltip");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    // <a />
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "tag");
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, link);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write(term.Name);
                    writer.RenderEndTag();
                    // <div>
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "tag-menu dnnClear");
                    writer.AddAttribute(HtmlTextWriterAttribute.Style, "display:none;");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    // <div>
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    // <div>
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "tm-heading");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    // <span>
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "tm-sub-info");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    writer.Write(Localization.GetString("Tag", SharedResourceFile));
                    writer.Write(term.Name);
                    // <span>
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "tm-sub-links");
                    writer.AddAttribute(HtmlTextWriterAttribute.Style, "float:right;");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    if (ModContext.PortalSettings.UserId > 0)
                    {
                        _cmdSubscribe = (LinkButton)_htTags[term.TermId];
                        // <a />
                        _cmdSubscribe.RenderControl(writer);
                        //// we register this here so that the tooltip is updated after the event action is taken.
                        //AJAX.RegisterPostBackControl(_cmdSubscribe);
                    }
                    // </span>
                    writer.RenderEndTag();
                    // </span>
                    writer.RenderEndTag();
                    // </div>
                    writer.RenderEndTag();
                    // <div />
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "tm-description");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    writer.Write(term.Description);
                    writer.RenderEndTag();
                    // </div>
                    writer.RenderEndTag();
                    // <span>
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "tm-links");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    //// <a />
                    //writer.AddAttribute(HtmlTextWriterAttribute.Href, link);
                    //writer.RenderBeginTag(HtmlTextWriterTag.A);
                    //writer.Write(Localization.GetString("browse.Text", SharedResourceFile));
                    //writer.RenderEndTag();

                    // <a />
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, detaillink);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write(Localization.GetString("about.Text", SharedResourceFile));
                    writer.RenderEndTag();

                    //// <a />
                    //writer.AddAttribute(HtmlTextWriterAttribute.Href, historylink);
                    //writer.RenderBeginTag(HtmlTextWriterTag.A);
                    //writer.Write(Localization.GetString("history.Text", SharedResourceFile));
                    //writer.RenderEndTag();

                    // <span>
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "tm-links");
                    writer.AddAttribute(HtmlTextWriterAttribute.Style, "float:right;");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    // <a />
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, improvelink);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);
                    writer.Write(Localization.GetString("improve.Text", SharedResourceFile));
                    writer.RenderEndTag();
                    // </span>
                    writer.RenderEndTag();

                    // </span>
                    writer.RenderEndTag();
                    // </div>
                    writer.RenderEndTag();

                    //if (ShowCount)
                    //{
                    //    // <span>
                    //    writer.AddAttribute(HtmlTextWriterAttribute.Class, "percentRight");
                    //    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    //    writer.Write(term.DayTermUsage + Localization.GetString("questions", SharedResourceFile));
                    //    // </span>
                    //    writer.RenderEndTag();
                    //}

                    // </div>
                    writer.RenderEndTag();

                    if (CountMode != Constants.TagMode.ShowNoUsage)
                    {
                        // <span>
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "percentRight");
                        writer.RenderBeginTag(HtmlTextWriterTag.Span);

                        switch (CountMode)
                        {
                        case Constants.TagMode.ShowDailyUsage:
                            writer.Write(term.DayTermUsage + Localization.GetString("questions", SharedResourceFile));
                            break;

                        case Constants.TagMode.ShowWeeklyUsage:
                            writer.Write(term.WeekTermUsage + Localization.GetString("questions", SharedResourceFile));
                            break;

                        case Constants.TagMode.ShowMonthlyUsage:
                            writer.Write(term.MonthTermUsage + Localization.GetString("questions", SharedResourceFile));
                            break;

                        case Constants.TagMode.ShowTotalUsage:
                            writer.Write(term.TotalTermUsage + Localization.GetString("questions", SharedResourceFile));
                            break;
                        }



                        // </span>
                        writer.RenderEndTag();
                    }
                }
            }
        }