<commit_before>﻿//
//  FeedbackButton.ascx.cs
//
//  Author:
//       <NAME> <<EMAIL>>
//
//  Copyright (c) 2015-2016 <NAME>
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Affero General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Affero General Public License for more details.
//
//  You should have received a copy of the GNU Affero General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Linq;
using System.Web.UI.WebControls;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using R7.Epsilon.Components;

namespace R7.Epsilon
{
    public class FeedbackButton : EpsilonSkinObjectBase
    {
        #region Controls

        protected HyperLink linkFeedback;

        #endregion

        #region Properties

        public int FeedbackTabId { get; set; }

        public string Target { get; set; }

        public string CssClass { get; set; }

        #endregion

        protected override void OnInit (EventArgs e)
        {
            base.OnInit (e);

            // find feedback module
            var feedbackModule = ModuleController.Instance.GetModulesByDefinition (PortalSettings.PortalId, "Feedback")
                                                 .Cast<ModuleInfo> ()
                                                 .FirstOrDefault (m => m.TabID == Config.FeedbackTabId);
            
            if (feedbackModule != null) {
                var feedbackUrl = UrlUtils.PopUpUrl (Globals.NavigateURL (feedbackModule.TabID, "", "mid", feedbackModule.ModuleID.ToString ()),
                                                     PortalSettings.Current, false, false, 550, 950);

                linkFeedback.CssClass = "unselectable " + CssClass;
                linkFeedback.ToolTip = Localizer.GetString ("FeedBackButton.Tooltip");
                linkFeedback.Text = Localizer.GetString  ("FeedBackButton.Text");
                linkFeedback.Attributes.Add ("data-feedback-url", feedbackUrl);
                linkFeedback.Attributes.Add ("onclick", string.Format ("javascript:return skin_setup_feedback_url(this,{0})",
                                                                       feedbackModule.ModuleID));
            }
            else {
                // no feedback module found, hide the button
                linkFeedback.Visible = false;
            }
        }
    }
}<commit_msg>Close feedback popup w/o page reload<commit_after>﻿//
//  FeedbackButton.ascx.cs
//
//  Author:
//       <NAME> <<EMAIL>>
//
//  Copyright (c) 2015-2016 <NAME>
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Affero General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Affero General Public License for more details.
//
//  You should have received a copy of the GNU Affero General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Linq;
using System.Web.UI.WebControls;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using R7.Epsilon.Components;

namespace R7.Epsilon
{
    public class FeedbackButton : EpsilonSkinObjectBase
    {
        #region Controls

        protected HyperLink linkFeedback;

        #endregion

        #region Properties

        public int FeedbackTabId { get; set; }

        public string Target { get; set; }

        public string CssClass { get; set; }

        #endregion

        protected override void OnInit (EventArgs e)
        {
            base.OnInit (e);

            // find feedback module
            var feedbackModule = ModuleController.Instance.GetModulesByDefinition (PortalSettings.PortalId, "Feedback")
                                                 .Cast<ModuleInfo> ()
                                                 .FirstOrDefault (m => m.TabID == Config.FeedbackTabId);
            
            if (feedbackModule != null) {
                var feedbackUrl = UrlUtils.PopUpUrl (Globals.NavigateURL (feedbackModule.TabID, "", "mid", feedbackModule.ModuleID.ToString ()),
                                                     this, PortalSettings.Current, false, false, 550, 950, false, "");

                linkFeedback.CssClass = "unselectable " + CssClass;
                linkFeedback.ToolTip = Localizer.GetString ("FeedBackButton.Tooltip");
                linkFeedback.Text = Localizer.GetString  ("FeedBackButton.Text");
                linkFeedback.Attributes.Add ("data-feedback-url", feedbackUrl);
                linkFeedback.Attributes.Add ("onclick", string.Format ("javascript:return skin_setup_feedback_url(this,{0})",
                                                                       feedbackModule.ModuleID));
            }
            else {
                // no feedback module found, hide the button
                linkFeedback.Visible = false;
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.08976597974152986, 'fraction_numerical': 0.0062871114215857496, 'mean_word_length': 1.9797086368366286, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2883123', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1430, 'n_words': 449}