From 7f61b40fcaee71c4cee46edd73499247cb2064ff Mon Sep 17 00:00:00 2001 From: Michael Tobisch Date: Sun, 11 Jun 2023 09:54:16 +0200 Subject: [PATCH 1/8] Added the ability to change the title of the Results control. Closes #63 --- DNN.Survey/web.Debug.config | 30 ------------------------------ DNN.Survey/web.Release.config | 31 ------------------------------- 2 files changed, 61 deletions(-) delete mode 100644 DNN.Survey/web.Debug.config delete mode 100644 DNN.Survey/web.Release.config diff --git a/DNN.Survey/web.Debug.config b/DNN.Survey/web.Debug.config deleted file mode 100644 index fae9cfe..0000000 --- a/DNN.Survey/web.Debug.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/DNN.Survey/web.Release.config b/DNN.Survey/web.Release.config deleted file mode 100644 index da6e960..0000000 --- a/DNN.Survey/web.Release.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - \ No newline at end of file From 34784cc82aae7c29718517e19ee32b35c77e8f66 Mon Sep 17 00:00:00 2001 From: Michael Tobisch Date: Mon, 12 Jun 2023 19:23:37 +0200 Subject: [PATCH 2/8] Closes #63 Added ControlTitle keys and ModuleHelp --- .../App_LocalResources/Settings.ascx.resx | 3 + .../App_LocalResources/SurveyEdit.ascx.resx | 6 + .../SurveyOrganize.ascx.resx | 7 +- .../SurveyResults.ascx.resx | 6 + .../App_LocalResources/SurveyView.ascx.resx | 3 + DNN.Survey/DNN.Survey.csproj | 7 - DNN.Survey/Settings.ascx | 2 + DNN.Survey/Settings.ascx.designer.cs | 77 ++- DNN.Survey/SurveyEdit.ascx | 2 + DNN.Survey/SurveyEdit.ascx.designer.cs | 633 +++++++++--------- DNN.Survey/SurveyOrganize.ascx | 2 +- DNN.Survey/SurveyOrganize.ascx.designer.cs | 84 +-- DNN.Survey/SurveyResults.ascx | 5 + DNN.Survey/SurveyResults.ascx.cs | 435 ++++++------ DNN.Survey/SurveyResults.ascx.designer.cs | 102 +-- DNN.Survey/SurveyView.ascx | 5 + DNN.Survey/SurveyView.ascx.cs | 12 +- DNN.Survey/SurveyView.ascx.designer.cs | 156 +++-- 18 files changed, 821 insertions(+), 726 deletions(-) diff --git a/DNN.Survey/App_LocalResources/Settings.ascx.resx b/DNN.Survey/App_LocalResources/Settings.ascx.resx index 5b8f357..8329e02 100644 --- a/DNN.Survey/App_LocalResources/Settings.ascx.resx +++ b/DNN.Survey/App_LocalResources/Settings.ascx.resx @@ -204,4 +204,7 @@ Separator + + Need help? See the <a href="https://dnn-survey.readme.io/docs/module-settings" target="_blank">module documentation</a>. + \ No newline at end of file diff --git a/DNN.Survey/App_LocalResources/SurveyEdit.ascx.resx b/DNN.Survey/App_LocalResources/SurveyEdit.ascx.resx index fd3d6eb..600cbb6 100644 --- a/DNN.Survey/App_LocalResources/SurveyEdit.ascx.resx +++ b/DNN.Survey/App_LocalResources/SurveyEdit.ascx.resx @@ -150,6 +150,9 @@ Chart + + Add/Edit Survey Question + If it is the correct answer, activate the checkbox. @@ -168,6 +171,9 @@ Statistical question + + Need help? See the <a href="https://dnn-survey.readme.io/docs/addedit-questions" target="_blank">module documentation</a>. + You can't add a single- or multiple-choice questions and don't provide an answer. diff --git a/DNN.Survey/App_LocalResources/SurveyOrganize.ascx.resx b/DNN.Survey/App_LocalResources/SurveyOrganize.ascx.resx index 208b340..a64bdb3 100644 --- a/DNN.Survey/App_LocalResources/SurveyOrganize.ascx.resx +++ b/DNN.Survey/App_LocalResources/SurveyOrganize.ascx.resx @@ -117,8 +117,11 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Drag and drop the questions to sort, or click the recycle bin image to delete the question. + + Organize survey questions + + + Drag and drop the questions to sort, or click the recycle bin image to delete the question.<br />More help can be found in the <a href="https://dnn-survey.readme.io/docs/organize-survey-questions" target="_blank">module ducumentation</a>. Question diff --git a/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx b/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx index 227a70f..03cf744 100644 --- a/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx +++ b/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx @@ -117,9 +117,15 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Ergebnisse + (Correct answer) + + Need help? See the <a href="https://dnn-survey.readme.io/docs/view-results" target="_blank">module documentation</a>. + You are not allowed to view the results, sorry... diff --git a/DNN.Survey/App_LocalResources/SurveyView.ascx.resx b/DNN.Survey/App_LocalResources/SurveyView.ascx.resx index febfb79..6da60f1 100644 --- a/DNN.Survey/App_LocalResources/SurveyView.ascx.resx +++ b/DNN.Survey/App_LocalResources/SurveyView.ascx.resx @@ -153,6 +153,9 @@ Thank you for your participation. + + Need help? See the <a href="https://dnn-survey.readme.io/docs" target="_blank">module documentation</a>. + You must sign in to vote in this survey. diff --git a/DNN.Survey/DNN.Survey.csproj b/DNN.Survey/DNN.Survey.csproj index 2d8ceda..a093f7f 100644 --- a/DNN.Survey/DNN.Survey.csproj +++ b/DNN.Survey/DNN.Survey.csproj @@ -240,13 +240,6 @@ - - - web.config - - - web.config - 10.0 diff --git a/DNN.Survey/Settings.ascx b/DNN.Survey/Settings.ascx index 68c62da..32955a7 100644 --- a/DNN.Survey/Settings.ascx +++ b/DNN.Survey/Settings.ascx @@ -4,6 +4,8 @@ +
+

diff --git a/DNN.Survey/Settings.ascx.designer.cs b/DNN.Survey/Settings.ascx.designer.cs index 91ca6f4..0fd2591 100644 --- a/DNN.Survey/Settings.ascx.designer.cs +++ b/DNN.Survey/Settings.ascx.designer.cs @@ -15,154 +15,163 @@ public partial class Settings { /// - /// GeneralSettingsLabel-Steuerelement + /// ModuleHelpLabel-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Label ModuleHelpLabel; + + /// + /// GeneralSettingsLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.Label GeneralSettingsLabel; /// - /// SurveyTypeLabel-Steuerelement + /// SurveyTypeLabel-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::DotNetNuke.UI.UserControls.LabelControl SurveyTypeLabel; /// - /// SurveyTypeRadioButtonList-Steuerelement + /// SurveyTypeRadioButtonList-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.RadioButtonList SurveyTypeRadioButtonList; /// - /// SurveyClosingDateLabel-Steuerelement + /// SurveyClosingDateLabel-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::DotNetNuke.UI.UserControls.LabelControl SurveyClosingDateLabel; /// - /// SurveyClosingDateTextBox-Steuerelement + /// SurveyClosingDateTextBox-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.TextBox SurveyClosingDateTextBox; /// - /// AppearanceSecurityOptionsLabel-Steuerelement + /// AppearanceSecurityOptionsLabel-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.Label AppearanceSecurityOptionsLabel; /// - /// ShowClosingDateMessageLabel-Steuerelement + /// ShowClosingDateMessageLabel-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::DotNetNuke.UI.UserControls.LabelControl ShowClosingDateMessageLabel; /// - /// ShowClosingDateMessageCheckBox-Steuerelement + /// ShowClosingDateMessageCheckBox-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.CheckBox ShowClosingDateMessageCheckBox; /// - /// PrivacyConfirmationLabel-Steuerelement + /// PrivacyConfirmationLabel-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::DotNetNuke.UI.UserControls.LabelControl PrivacyConfirmationLabel; /// - /// PrivacyConfirmationCheckBox-Steuerelement + /// PrivacyConfirmationCheckBox-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.CheckBox PrivacyConfirmationCheckBox; /// - /// UseCaptchaLabel-Steuerelement + /// UseCaptchaLabel-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::DotNetNuke.UI.UserControls.LabelControl UseCaptchaLabel; /// - /// UseCaptchaRadioButtonList-Steuerelement + /// UseCaptchaRadioButtonList-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.RadioButtonList UseCaptchaRadioButtonList; /// - /// CSVExportOptionsLabel-Steuerelement + /// CSVExportOptionsLabel-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.Label CSVExportOptionsLabel; /// - /// CSVSeparatorLabel-Steuerelement + /// CSVSeparatorLabel-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::DotNetNuke.UI.UserControls.LabelControl CSVSeparatorLabel; /// - /// CSVSeparatorDropDownlist-Steuerelement + /// CSVSeparatorDropDownlist-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.DropDownList CSVSeparatorDropDownlist; /// - /// CSVTextQualifierLabel-Steuerelement + /// CSVTextQualifierLabel-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::DotNetNuke.UI.UserControls.LabelControl CSVTextQualifierLabel; /// - /// CSVTextQualifierDropDownList-Steuerelement + /// CSVTextQualifierDropDownList-Steuerelement. /// /// - /// Automatisch generiertes Feld + /// Automatisch generiertes Feld. /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.DropDownList CSVTextQualifierDropDownList; diff --git a/DNN.Survey/SurveyEdit.ascx b/DNN.Survey/SurveyEdit.ascx index 4d50642..dfcbad5 100644 --- a/DNN.Survey/SurveyEdit.ascx +++ b/DNN.Survey/SurveyEdit.ascx @@ -5,6 +5,8 @@ +
+

diff --git a/DNN.Survey/SurveyEdit.ascx.designer.cs b/DNN.Survey/SurveyEdit.ascx.designer.cs index 9db6e34..f07c492 100644 --- a/DNN.Survey/SurveyEdit.ascx.designer.cs +++ b/DNN.Survey/SurveyEdit.ascx.designer.cs @@ -7,315 +7,326 @@ // //------------------------------------------------------------------------------ -namespace DNN.Modules.Survey { - - - public partial class SurveyEdit { - - /// - /// QuestionLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::DotNetNuke.UI.UserControls.LabelControl QuestionLabel; - - /// - /// QuestionTextBox-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.TextBox QuestionTextBox; - - /// - /// QuestionValidator-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator QuestionValidator; - - /// - /// QuestionTypeLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::DotNetNuke.UI.UserControls.LabelControl QuestionTypeLabel; - - /// - /// QuestionTypeDropDownList-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.DropDownList QuestionTypeDropDownList; - - /// - /// TextAnswerPanel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Panel TextAnswerPanel; - - /// - /// NumberOfRowsLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::DotNetNuke.UI.UserControls.LabelControl NumberOfRowsLabel; - - /// - /// NumberOfRowsTextBox-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.TextBox NumberOfRowsTextBox; - - /// - /// IsStatisticalPanel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Panel IsStatisticalPanel; - - /// - /// IsStatisticalLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::DotNetNuke.UI.UserControls.LabelControl IsStatisticalLabel; - - /// - /// IsStatisticalCheckBox-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.CheckBox IsStatisticalCheckBox; - - /// - /// RepeatDirectionPanel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Panel RepeatDirectionPanel; - - /// - /// RepeatDirectionLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::DotNetNuke.UI.UserControls.LabelControl RepeatDirectionLabel; - - /// - /// RepeatDirectionDropDownList-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.DropDownList RepeatDirectionDropDownList; - - /// - /// RepeatColumnsLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::DotNetNuke.UI.UserControls.LabelControl RepeatColumnsLabel; - - /// - /// RepeatColumnsTextBox-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.TextBox RepeatColumnsTextBox; - - /// - /// ChartTypeLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::DotNetNuke.UI.UserControls.LabelControl ChartTypeLabel; - - /// - /// ChartTypeDropDownList-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.DropDownList ChartTypeDropDownList; - - /// - /// AnswersPanel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Panel AnswersPanel; - - /// - /// AnswersHeaderLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Label AnswersHeaderLabel; - - /// - /// AnswersGrid-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.DataGrid AnswersGrid; - - /// - /// ErrorMessagePanel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Panel ErrorMessagePanel; - - /// - /// ErrorMessageLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Label ErrorMessageLabel; - - /// - /// AddEditAnswerPanel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Panel AddEditAnswerPanel; - - /// - /// AnswerLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::DotNetNuke.UI.UserControls.LabelControl AnswerLabel; - - /// - /// AnswerTextBox-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.TextBox AnswerTextBox; - - /// - /// AnswerValidator-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator AnswerValidator; - - /// - /// CorrectAnswerPanel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Panel CorrectAnswerPanel; - - /// - /// CorrectAnswerLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::DotNetNuke.UI.UserControls.LabelControl CorrectAnswerLabel; - - /// - /// CorrectAnswerCheckBox-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.CheckBox CorrectAnswerCheckBox; - - /// - /// AddAnswerButton-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.LinkButton AddAnswerButton; - - /// - /// UpdateAnswerButton-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.LinkButton UpdateAnswerButton; - - /// - /// UpdateButton-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.LinkButton UpdateButton; - - /// - /// CancelButton-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.LinkButton CancelButton; - } +namespace DNN.Modules.Survey +{ + + + public partial class SurveyEdit + { + + /// + /// ModuleHelpLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Label ModuleHelpLabel; + + /// + /// QuestionLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::DotNetNuke.UI.UserControls.LabelControl QuestionLabel; + + /// + /// QuestionTextBox-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.TextBox QuestionTextBox; + + /// + /// QuestionValidator-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator QuestionValidator; + + /// + /// QuestionTypeLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::DotNetNuke.UI.UserControls.LabelControl QuestionTypeLabel; + + /// + /// QuestionTypeDropDownList-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.DropDownList QuestionTypeDropDownList; + + /// + /// TextAnswerPanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel TextAnswerPanel; + + /// + /// NumberOfRowsLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::DotNetNuke.UI.UserControls.LabelControl NumberOfRowsLabel; + + /// + /// NumberOfRowsTextBox-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.TextBox NumberOfRowsTextBox; + + /// + /// IsStatisticalPanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel IsStatisticalPanel; + + /// + /// IsStatisticalLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::DotNetNuke.UI.UserControls.LabelControl IsStatisticalLabel; + + /// + /// IsStatisticalCheckBox-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.CheckBox IsStatisticalCheckBox; + + /// + /// RepeatDirectionPanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel RepeatDirectionPanel; + + /// + /// RepeatDirectionLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::DotNetNuke.UI.UserControls.LabelControl RepeatDirectionLabel; + + /// + /// RepeatDirectionDropDownList-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.DropDownList RepeatDirectionDropDownList; + + /// + /// RepeatColumnsLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::DotNetNuke.UI.UserControls.LabelControl RepeatColumnsLabel; + + /// + /// RepeatColumnsTextBox-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.TextBox RepeatColumnsTextBox; + + /// + /// ChartTypeLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::DotNetNuke.UI.UserControls.LabelControl ChartTypeLabel; + + /// + /// ChartTypeDropDownList-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.DropDownList ChartTypeDropDownList; + + /// + /// AnswersPanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel AnswersPanel; + + /// + /// AnswersHeaderLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Label AnswersHeaderLabel; + + /// + /// AnswersGrid-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.DataGrid AnswersGrid; + + /// + /// ErrorMessagePanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel ErrorMessagePanel; + + /// + /// ErrorMessageLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Label ErrorMessageLabel; + + /// + /// AddEditAnswerPanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel AddEditAnswerPanel; + + /// + /// AnswerLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::DotNetNuke.UI.UserControls.LabelControl AnswerLabel; + + /// + /// AnswerTextBox-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.TextBox AnswerTextBox; + + /// + /// AnswerValidator-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator AnswerValidator; + + /// + /// CorrectAnswerPanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel CorrectAnswerPanel; + + /// + /// CorrectAnswerLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::DotNetNuke.UI.UserControls.LabelControl CorrectAnswerLabel; + + /// + /// CorrectAnswerCheckBox-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.CheckBox CorrectAnswerCheckBox; + + /// + /// AddAnswerButton-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.LinkButton AddAnswerButton; + + /// + /// UpdateAnswerButton-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.LinkButton UpdateAnswerButton; + + /// + /// UpdateButton-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.LinkButton UpdateButton; + + /// + /// CancelButton-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.LinkButton CancelButton; + } } diff --git a/DNN.Survey/SurveyOrganize.ascx b/DNN.Survey/SurveyOrganize.ascx index f3f5b3c..222b012 100644 --- a/DNN.Survey/SurveyOrganize.ascx +++ b/DNN.Survey/SurveyOrganize.ascx @@ -1,7 +1,7 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SurveyOrganize.ascx.cs" Inherits="DNN.Modules.Survey.SurveyOrganize" %> <%@ Register TagPrefix="dnn" Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" %> -
+
//------------------------------------------------------------------------------ -namespace DNN.Modules.Survey { - - - public partial class SurveyOrganize { - - /// - /// SortHelpLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Label SortHelpLabel; - - /// - /// QuestionsGrid-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.DataGrid QuestionsGrid; - - /// - /// UpdateButton-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.LinkButton UpdateButton; - - /// - /// CancelButton-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.LinkButton CancelButton; - } +namespace DNN.Modules.Survey +{ + + + public partial class SurveyOrganize + { + + /// + /// ModuleHelpLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Label ModuleHelpLabel; + + /// + /// QuestionsGrid-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.DataGrid QuestionsGrid; + + /// + /// UpdateButton-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.LinkButton UpdateButton; + + /// + /// CancelButton-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.LinkButton CancelButton; + } } diff --git a/DNN.Survey/SurveyResults.ascx b/DNN.Survey/SurveyResults.ascx index b3b0e35..304d22a 100644 --- a/DNN.Survey/SurveyResults.ascx +++ b/DNN.Survey/SurveyResults.ascx @@ -1,5 +1,10 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SurveyResults.ascx.cs" Inherits="DNN.Modules.Survey.SurveyResults" %> + + + +
0)) - { - hasVoted = (SurveysController.HasVoted(ModuleId, UserId)); - } - else - { - hasVoted = (Request.Cookies[_cookie] != null); - } - } - return hasVoted; - } - } - - protected bool AuthorizedUsersOnly - { - get - { - bool authorizedUsersOnly = true; - ModulePermissionCollection permissions = ModulePermissionController.GetModulePermissions(ModuleId, TabId); - foreach (ModulePermissionInfo permission in permissions) - { - if ((permission.PermissionCode == ModuleSecurity.PERMISSION_CODE) && (permission.PermissionKey == ModuleSecurity.PARTICIPATE_PERMISSION) && ((permission.RoleID == -1) || (permission.RoleID == -3))) - { - authorizedUsersOnly = false; - break; - } - } - return (authorizedUsersOnly); - } - } - protected bool HasViewResultsPermission - { - get - { - return ModulePermissionController.HasModulePermission(ModulePermissionCollection, ModuleSecurity.VIEW_RESULTS_PERMISSION); - } - } - - protected bool HasParticipatePermission - { - get - { - return ModulePermissionController.HasModulePermission(ModulePermissionCollection, ModuleSecurity.PARTICIPATE_PERMISSION); - } - } - - #region Settings - protected DateTime SurveyClosingDate - { - get - { - object surveyClosingDate = Settings["SurveyClosingDate"]; - if (surveyClosingDate == null) - return DateTime.MinValue; - else - return Convert.ToDateTime(surveyClosingDate); - } - } - - protected int ResultsVersion - { - // This is: If the results are cleared, this number increases - therefore the cookie changes and users can vote again. - get - { - object resultsVersion = Settings["ResultsVersion"]; - if (resultsVersion == null) - return 0; - else - return Convert.ToInt32(resultsVersion); - } - } - #endregion - - #region Control Events - protected override void OnInit(EventArgs e) - { - JavaScript.RequestRegistration(CommonJs.DnnPlugins); - JavaScript.RequestRegistration(CommonJs.jQuery); - ClientResourceManager.RegisterScript(this.Page, "DesktopModules/Survey/js/Chart.min.js", DotNetNuke.Web.Client.FileOrder.Js.DefaultPriority, DotNetNuke.Web.Client.Providers.DnnFormBottomProvider.DefaultName); - _cookie = string.Format("_Module_{0}_Survey_{1}_", ModuleId, ResultsVersion); - base.OnInit(e); - } - - protected override void OnLoad(EventArgs e) - { - if (HasViewResultsPermission) - { - if (IsSurveyExpired) - { - SurveyMessageLabel.Text = String.Format(Localization.GetString("SurveyClosed.Text", LocalResourceFile), SurveyClosingDate); - SurveyMessageLabel.CssClass = "dnnFormMessage dnnFormWarning"; - SurveyMessageLabel.Visible = true; - } - } - else - { - SurveyMessageLabel.Text = Localization.GetString("ResultsNotPublicMessage", LocalResourceFile); - SurveyMessageLabel.CssClass = "dnnFormMessage dnnFormValidationSummary"; - SurveyMessageLabel.Visible = true; - ResultsPanel.Visible = false; - } - - if (((!(HasParticipatePermission)) || (IsSurveyExpired) || (HasVoted)) && (!(PortalSecurity.IsInRole("Administrators")))) - { - ViewSurveyButton.Visible = false; - } - - base.OnLoad(e); - } - - protected override void OnPreRender(EventArgs e) - { - List surveys = SurveysController.GetAll(ModuleId); - - foreach (SurveysInfo survey in surveys) - { - List result = SurveyResultsController.Get(survey.SurveyID); - StringBuilder labelBuilder = new StringBuilder(); - StringBuilder dataBuilder = new StringBuilder(); - StringBuilder bgColorsBuilder = new StringBuilder(); - StringBuilder bColorsBuilder = new StringBuilder(); - foreach (SurveyResultInfo r in result) - { - labelBuilder.Append(string.Format("\"{0}\"", String.Format("{0}{1}", ClientAPI.GetSafeJSString(r.OptionName), r.IsCorrect ? string.Format(" {0}", Localization.GetString("CorrectAnswer.Text", LocalResourceFile)) : string.Empty))); - dataBuilder.Append(r.Votes); - bgColorsBuilder.Append(string.Format("\"{0}\"", Base.GetColor(result.IndexOf(r), (!(r.IsCorrect))))); - bColorsBuilder.Append(string.Format("\"{0}\"", r.IsCorrect ? "rgba(0,170,0,1)" : Base.GetColor(result.IndexOf(r), false))); - if (result.IndexOf(r) < result.Count - 1) - { - labelBuilder.Append(","); - dataBuilder.Append(","); - bgColorsBuilder.Append(","); - bColorsBuilder.Append(","); - } - } - - CanvasControl canvas = (CanvasControl)LoadControl("Controls/CanvasControl.ascx"); - canvas.Header = survey.Question; - canvas.Labels = labelBuilder.ToString(); - canvas.Data = dataBuilder.ToString(); - canvas.BackgroundColors = bgColorsBuilder.ToString(); - canvas.BorderColors = bColorsBuilder.ToString(); - canvas.ChartType = survey.ChartType; - ChartPlaceHolder.Controls.Add(canvas); - } - - base.OnPreRender(e); - } - - protected void ViewSurveyButton_Click(object sender, EventArgs e) - { - Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(), false); - } - #endregion - } + public partial class SurveyResults : PortalModuleBase + { + private ModulePermissionCollection _modulePermissionCollection = null; + private SurveysController _surveysController = null; + private SurveyResultsController _surveyResultsController = null; + private string _cookie; + + protected ModulePermissionCollection ModulePermissionCollection + { + get + { + if (_modulePermissionCollection == null) + _modulePermissionCollection = ModulePermissionController.GetModulePermissions(ModuleId, TabId); + return _modulePermissionCollection; + } + } + + protected SurveysController SurveysController + { + get + { + if (_surveysController == null) + _surveysController = new SurveysController(); + return _surveysController; + } + } + + protected SurveyResultsController SurveyResultsController + { + get + { + if (_surveyResultsController == null) + _surveyResultsController = new SurveyResultsController(); + return _surveyResultsController; + } + } + + protected bool IsSurveyExpired + { + get + { + return ((SurveyClosingDate != DateTime.MinValue) && (SurveyClosingDate < DateTime.Now)); + } + } + + protected bool HasVoted + { + get + { + bool hasVoted; + if (PortalSecurity.IsInRole("Administrators")) + { + // Administrators may always see the survey (and may vote more than once) + hasVoted = false; + } + else + { + if ((AuthorizedUsersOnly) || (UserId > 0)) + { + hasVoted = (SurveysController.HasVoted(ModuleId, UserId)); + } + else + { + hasVoted = (Request.Cookies[_cookie] != null); + } + } + return hasVoted; + } + } + + protected bool AuthorizedUsersOnly + { + get + { + bool authorizedUsersOnly = true; + ModulePermissionCollection permissions = ModulePermissionController.GetModulePermissions(ModuleId, TabId); + foreach (ModulePermissionInfo permission in permissions) + { + if ((permission.PermissionCode == ModuleSecurity.PERMISSION_CODE) && (permission.PermissionKey == ModuleSecurity.PARTICIPATE_PERMISSION) && ((permission.RoleID == -1) || (permission.RoleID == -3))) + { + authorizedUsersOnly = false; + break; + } + } + return (authorizedUsersOnly); + } + } + + protected bool HasViewResultsPermission + { + get + { + return ModulePermissionController.HasModulePermission(ModulePermissionCollection, ModuleSecurity.VIEW_RESULTS_PERMISSION); + } + } + + protected bool HasParticipatePermission + { + get + { + return ModulePermissionController.HasModulePermission(ModulePermissionCollection, ModuleSecurity.PARTICIPATE_PERMISSION); + } + } + + protected bool HasEditPermission + { + get + { + return ModulePermissionController.HasModulePermission(ModulePermissionCollection, ModuleSecurity.EDIT_PERMISSION); + } + } + + + #region Settings + protected DateTime SurveyClosingDate + { + get + { + object surveyClosingDate = Settings["SurveyClosingDate"]; + if (surveyClosingDate == null) + return DateTime.MinValue; + else + return Convert.ToDateTime(surveyClosingDate); + } + } + + protected int ResultsVersion + { + // This is: If the results are cleared, this number increases - therefore the cookie changes and users can vote again. + get + { + object resultsVersion = Settings["ResultsVersion"]; + if (resultsVersion == null) + return 0; + else + return Convert.ToInt32(resultsVersion); + } + } + #endregion + + #region Control Events + protected override void OnInit(EventArgs e) + { + JavaScript.RequestRegistration(CommonJs.DnnPlugins); + JavaScript.RequestRegistration(CommonJs.jQuery); + ClientResourceManager.RegisterScript(this.Page, "DesktopModules/Survey/js/Chart.min.js", DotNetNuke.Web.Client.FileOrder.Js.DefaultPriority, DotNetNuke.Web.Client.Providers.DnnFormBottomProvider.DefaultName); + _cookie = string.Format("_Module_{0}_Survey_{1}_", ModuleId, ResultsVersion); + base.OnInit(e); + } + + protected override void OnLoad(EventArgs e) + { + if (HasViewResultsPermission) + { + if (IsSurveyExpired) + { + SurveyMessageLabel.Text = String.Format(Localization.GetString("SurveyClosed.Text", LocalResourceFile), SurveyClosingDate); + SurveyMessageLabel.CssClass = "dnnFormMessage dnnFormWarning"; + SurveyMessageLabel.Visible = true; + } + ModuleHelpPanel.Visible = HasEditPermission; + } + else + { + SurveyMessageLabel.Text = Localization.GetString("ResultsNotPublicMessage", LocalResourceFile); + SurveyMessageLabel.CssClass = "dnnFormMessage dnnFormValidationSummary"; + SurveyMessageLabel.Visible = true; + ResultsPanel.Visible = false; + } + + if (((!(HasParticipatePermission)) || (IsSurveyExpired) || (HasVoted)) && (!(PortalSecurity.IsInRole("Administrators")))) + { + ViewSurveyButton.Visible = false; + } + + base.OnLoad(e); + } + + protected override void OnPreRender(EventArgs e) + { + List surveys = SurveysController.GetAll(ModuleId); + + foreach (SurveysInfo survey in surveys) + { + List result = SurveyResultsController.Get(survey.SurveyID); + StringBuilder labelBuilder = new StringBuilder(); + StringBuilder dataBuilder = new StringBuilder(); + StringBuilder bgColorsBuilder = new StringBuilder(); + StringBuilder bColorsBuilder = new StringBuilder(); + foreach (SurveyResultInfo r in result) + { + labelBuilder.Append(string.Format("\"{0}\"", String.Format("{0}{1}", ClientAPI.GetSafeJSString(r.OptionName), r.IsCorrect ? string.Format(" {0}", Localization.GetString("CorrectAnswer.Text", LocalResourceFile)) : string.Empty))); + dataBuilder.Append(r.Votes); + bgColorsBuilder.Append(string.Format("\"{0}\"", Base.GetColor(result.IndexOf(r), (!(r.IsCorrect))))); + bColorsBuilder.Append(string.Format("\"{0}\"", r.IsCorrect ? "rgba(0,170,0,1)" : Base.GetColor(result.IndexOf(r), false))); + if (result.IndexOf(r) < result.Count - 1) + { + labelBuilder.Append(","); + dataBuilder.Append(","); + bgColorsBuilder.Append(","); + bColorsBuilder.Append(","); + } + } + + CanvasControl canvas = (CanvasControl)LoadControl("Controls/CanvasControl.ascx"); + canvas.Header = survey.Question; + canvas.Labels = labelBuilder.ToString(); + canvas.Data = dataBuilder.ToString(); + canvas.BackgroundColors = bgColorsBuilder.ToString(); + canvas.BorderColors = bColorsBuilder.ToString(); + canvas.ChartType = survey.ChartType; + ChartPlaceHolder.Controls.Add(canvas); + } + + base.OnPreRender(e); + } + + protected void ViewSurveyButton_Click(object sender, EventArgs e) + { + Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(), false); + } + #endregion + } } \ No newline at end of file diff --git a/DNN.Survey/SurveyResults.ascx.designer.cs b/DNN.Survey/SurveyResults.ascx.designer.cs index 16fa1b5..8e6b172 100644 --- a/DNN.Survey/SurveyResults.ascx.designer.cs +++ b/DNN.Survey/SurveyResults.ascx.designer.cs @@ -7,45 +7,65 @@ // //------------------------------------------------------------------------------ -namespace DNN.Modules.Survey { - - - public partial class SurveyResults { - - /// - /// SurveyMessageLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Label SurveyMessageLabel; - - /// - /// ResultsPanel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Panel ResultsPanel; - - /// - /// ChartPlaceHolder-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.PlaceHolder ChartPlaceHolder; - - /// - /// ViewSurveyButton-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.LinkButton ViewSurveyButton; - } +namespace DNN.Modules.Survey +{ + + + public partial class SurveyResults + { + + /// + /// ModuleHelpPanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel ModuleHelpPanel; + + /// + /// ModuleHelpLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Label ModuleHelpLabel; + + /// + /// SurveyMessageLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Label SurveyMessageLabel; + + /// + /// ResultsPanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel ResultsPanel; + + /// + /// ChartPlaceHolder-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.PlaceHolder ChartPlaceHolder; + + /// + /// ViewSurveyButton-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.LinkButton ViewSurveyButton; + } } diff --git a/DNN.Survey/SurveyView.ascx b/DNN.Survey/SurveyView.ascx index cc3a0c0..2fe2162 100644 --- a/DNN.Survey/SurveyView.ascx +++ b/DNN.Survey/SurveyView.ascx @@ -1,6 +1,11 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SurveyView.ascx.cs" Inherits="DNN.Modules.Survey.SurveyView" %> <%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> + + + +
//------------------------------------------------------------------------------ -namespace DNN.Modules.Survey { - - - public partial class SurveyView { - - /// - /// SurveyMessageLabel-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.Label SurveyMessageLabel; - - /// - /// ContactByFaxOnly-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::DotNetNuke.UI.UserControls.LabelControl ContactByFaxOnly; - - /// - /// ContactByFaxOnlyCheckBox-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.CheckBox ContactByFaxOnlyCheckBox; - - /// - /// SurveyPlaceHolder-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.PlaceHolder SurveyPlaceHolder; - - /// - /// SubmitSurveyButton-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.LinkButton SubmitSurveyButton; - - /// - /// ViewResultsButton-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.LinkButton ViewResultsButton; - - /// - /// ExportToCsvButton-Steuerelement - /// - /// - /// Automatisch generiertes Feld - /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. - /// - protected global::System.Web.UI.WebControls.LinkButton ExportToCsvButton; - } +namespace DNN.Modules.Survey +{ + + + public partial class SurveyView + { + + /// + /// ModuleHelpPanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel ModuleHelpPanel; + + /// + /// ModuleHelpLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Label ModuleHelpLabel; + + /// + /// SurveyMessageLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Label SurveyMessageLabel; + + /// + /// ContactByFaxOnly-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::DotNetNuke.UI.UserControls.LabelControl ContactByFaxOnly; + + /// + /// ContactByFaxOnlyCheckBox-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.CheckBox ContactByFaxOnlyCheckBox; + + /// + /// SurveyPlaceHolder-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.PlaceHolder SurveyPlaceHolder; + + /// + /// SubmitSurveyButton-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.LinkButton SubmitSurveyButton; + + /// + /// ViewResultsButton-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.LinkButton ViewResultsButton; + + /// + /// ExportToCsvButton-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.LinkButton ExportToCsvButton; + } } From 6211f9745b50475198c2aed5e91b55991cfd0deb Mon Sep 17 00:00:00 2001 From: Michael Tobisch Date: Tue, 13 Jun 2023 08:22:51 +0200 Subject: [PATCH 3/8] Update SurveyResults.ascx.resx Corrected a value in the resource file that was in German for some reason (in fact to test ist, but forgot to turn it back to English...) --- DNN.Survey/App_LocalResources/SurveyResults.ascx.resx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx b/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx index 03cf744..9357c23 100644 --- a/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx +++ b/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Ergebnisse + DNN Survey Results (Correct answer) @@ -132,4 +132,4 @@ View survey - \ No newline at end of file + From 9f09b17add48c464b15b09d687e0f74eaede8846 Mon Sep 17 00:00:00 2001 From: Michael Tobisch Date: Fri, 7 Jul 2023 15:00:58 +0200 Subject: [PATCH 4/8] Close #64 Close #65 --- .../App_LocalResources/SurveyEdit.ascx.resx | 6 + .../SurveyResults.ascx.resx | 8 +- DNN.Survey/Components/Base.cs | 4 +- DNN.Survey/Module.css | 33 ++++ DNN.Survey/SurveyEdit.ascx.cs | 25 ++- DNN.Survey/SurveyResults.ascx.cs | 149 ++++++++++++------ 6 files changed, 177 insertions(+), 48 deletions(-) diff --git a/DNN.Survey/App_LocalResources/SurveyEdit.ascx.resx b/DNN.Survey/App_LocalResources/SurveyEdit.ascx.resx index 600cbb6..3dfc0f7 100644 --- a/DNN.Survey/App_LocalResources/SurveyEdit.ascx.resx +++ b/DNN.Survey/App_LocalResources/SurveyEdit.ascx.resx @@ -144,9 +144,15 @@ Horizontal Bar + + List + Pie + + Table + Chart diff --git a/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx b/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx index 9357c23..d46bc1d 100644 --- a/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx +++ b/DNN.Survey/App_LocalResources/SurveyResults.ascx.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Answer + DNN Survey Results @@ -126,10 +129,13 @@ Need help? See the <a href="https://dnn-survey.readme.io/docs/view-results" target="_blank">module documentation</a>. + + Question + You are not allowed to view the results, sorry... View survey - + \ No newline at end of file diff --git a/DNN.Survey/Components/Base.cs b/DNN.Survey/Components/Base.cs index 67024b2..5408d92 100644 --- a/DNN.Survey/Components/Base.cs +++ b/DNN.Survey/Components/Base.cs @@ -34,7 +34,9 @@ public enum ChartType Bar = 0, HorizontalBar = 1, Pie = 2, - Doughnut = 3 + Doughnut = 3, + List = 4, + Table = 5 } public enum UseCaptcha diff --git a/DNN.Survey/Module.css b/DNN.Survey/Module.css index e92d214..688e9a7 100644 --- a/DNN.Survey/Module.css +++ b/DNN.Survey/Module.css @@ -38,4 +38,37 @@ div.surveyQuizResult { font-size: 18px !important; font-weight: bold; +} + +table.surveyResultsTable +{ + width: 98%; + padding: 0; + border: 0; + font-size: 1.2em; +} + +tr.surveyResultsGridHeader { + vertical-align: top; + padding: 0.5em; + font-weight: bold; +} + +tr.surveyGridItem { + background-color: #ffffff; +} + +tr.surveyGridAltItem { + background-color: #f1f1f1; +} + +td.surveyQuestionsRow { + padding: 0.5em; + width: 90%; +} + +td.surveyVotesRow { + text-align: right; + padding: 0.5em; + width: 10%; } \ No newline at end of file diff --git a/DNN.Survey/SurveyEdit.ascx.cs b/DNN.Survey/SurveyEdit.ascx.cs index bd52b1d..89896e0 100644 --- a/DNN.Survey/SurveyEdit.ascx.cs +++ b/DNN.Survey/SurveyEdit.ascx.cs @@ -293,6 +293,21 @@ protected override void OnLoad(EventArgs e) MaxViewOrder = Answers.Count; ChartTypeChanged = true; } + if ((Survey.OptionType == QuestionType.RadioButtons) || (Survey.OptionType == QuestionType.CheckBoxes)) + { + foreach (ListItem li in ChartTypeDropDownList.Items) + { + li.Enabled = true; + } + } + else + { + foreach (ListItem li in ChartTypeDropDownList.Items) + { + li.Enabled = ((li.Value == Convert.ToInt32(ChartType.List).ToString()) || (li.Value == Convert.ToInt32(ChartType.Table).ToString())); + } + } + if (SurveyType == SurveyType.Quiz) { IsStatisticalPanel.Visible = true; @@ -571,6 +586,10 @@ protected void QuestionTypeDropDownList_SelectedIndexChanged(object sender, Even IsStatisticalCheckBox.Enabled = true; CorrectAnswerPanel.Visible = true; } + foreach (ListItem li in ChartTypeDropDownList.Items) + { + li.Enabled = true; + } } else { @@ -579,7 +598,7 @@ protected void QuestionTypeDropDownList_SelectedIndexChanged(object sender, Even TextAnswerPanel.Visible = true; if (!(ChartTypeChanged)) { - ChartTypeDropDownList.SelectedValue = Convert.ToInt32(ChartType.HorizontalBar).ToString(); + ChartTypeDropDownList.SelectedValue = Convert.ToInt32(ChartType.List).ToString(); ChartTypeChanged = false; } if (SurveyType == SurveyType.Quiz) @@ -589,6 +608,10 @@ protected void QuestionTypeDropDownList_SelectedIndexChanged(object sender, Even IsStatisticalCheckBox.Enabled = false; CorrectAnswerPanel.Visible = false; } + foreach (ListItem li in ChartTypeDropDownList.Items) + { + li.Enabled = ((li.Value == Convert.ToInt32(ChartType.List).ToString()) || (li.Value == Convert.ToInt32(ChartType.Table).ToString())); + } } } diff --git a/DNN.Survey/SurveyResults.ascx.cs b/DNN.Survey/SurveyResults.ascx.cs index 4cfa06b..4f4edd3 100644 --- a/DNN.Survey/SurveyResults.ascx.cs +++ b/DNN.Survey/SurveyResults.ascx.cs @@ -21,9 +21,7 @@ using DNN.Modules.Survey.Components; using DNN.Modules.Survey.Components.Controllers; using DNN.Modules.Survey.Components.Entities; -using DNN.Modules.Survey.Components.UI; using DNN.Modules.Survey.Controls; -using DotNetNuke.Common; using DotNetNuke.Entities.Modules; using DotNetNuke.Framework.JavaScriptLibraries; using DotNetNuke.Security; @@ -34,11 +32,13 @@ using System; using System.Collections.Generic; using System.Text; +using System.Web.UI.WebControls; namespace DNN.Modules.Survey { public partial class SurveyResults : PortalModuleBase { + #region "Private Properties private ModulePermissionCollection _modulePermissionCollection = null; private SurveysController _surveysController = null; private SurveyResultsController _surveyResultsController = null; @@ -141,25 +141,29 @@ protected bool HasParticipatePermission } } - protected bool HasEditPermission - { - get + protected bool HasEditPermission { - return ModulePermissionController.HasModulePermission(ModulePermissionCollection, ModuleSecurity.EDIT_PERMISSION); + get + { + return ModulePermissionController.HasModulePermission(ModulePermissionCollection, ModuleSecurity.EDIT_PERMISSION); + } } - } - + #endregion - #region Settings - protected DateTime SurveyClosingDate + #region Settings + protected DateTime SurveyClosingDate { get { - object surveyClosingDate = Settings["SurveyClosingDate"]; - if (surveyClosingDate == null) - return DateTime.MinValue; - else - return Convert.ToDateTime(surveyClosingDate); + object surveyClosingDate = Settings["SurveyClosingDate"]; + if (surveyClosingDate == null) + { + return DateTime.MinValue; + } + else + { + return Convert.ToDateTime(surveyClosingDate); + } } } @@ -168,11 +172,31 @@ protected int ResultsVersion // This is: If the results are cleared, this number increases - therefore the cookie changes and users can vote again. get { - object resultsVersion = Settings["ResultsVersion"]; - if (resultsVersion == null) - return 0; - else - return Convert.ToInt32(resultsVersion); + object resultsVersion = Settings["ResultsVersion"]; + if (resultsVersion == null) + { + return 0; + } + else + { + return Convert.ToInt32(resultsVersion); + } + } + } + + protected SurveyType SurveyType + { + get + { + object surveyType = Settings["SurveyType"]; + if (surveyType == null) + { + return SurveyType.Survey; + } + else + { + return (SurveyType)Convert.ToInt32(surveyType); + } } } #endregion @@ -221,34 +245,69 @@ protected override void OnPreRender(EventArgs e) foreach (SurveysInfo survey in surveys) { - List result = SurveyResultsController.Get(survey.SurveyID); - StringBuilder labelBuilder = new StringBuilder(); - StringBuilder dataBuilder = new StringBuilder(); - StringBuilder bgColorsBuilder = new StringBuilder(); - StringBuilder bColorsBuilder = new StringBuilder(); - foreach (SurveyResultInfo r in result) - { - labelBuilder.Append(string.Format("\"{0}\"", String.Format("{0}{1}", ClientAPI.GetSafeJSString(r.OptionName), r.IsCorrect ? string.Format(" {0}", Localization.GetString("CorrectAnswer.Text", LocalResourceFile)) : string.Empty))); - dataBuilder.Append(r.Votes); - bgColorsBuilder.Append(string.Format("\"{0}\"", Base.GetColor(result.IndexOf(r), (!(r.IsCorrect))))); - bColorsBuilder.Append(string.Format("\"{0}\"", r.IsCorrect ? "rgba(0,170,0,1)" : Base.GetColor(result.IndexOf(r), false))); - if (result.IndexOf(r) < result.Count - 1) + List result = SurveyResultsController.Get(survey.SurveyID); + StringBuilder labelBuilder = new StringBuilder(); + StringBuilder dataBuilder = new StringBuilder(); + + switch (survey.ChartType) + { + case ChartType.List: + labelBuilder.Append(string.Format("

{0}

", survey.Question)); + ChartPlaceHolder.Controls.Add(new Label() { Text = labelBuilder.ToString() }); + dataBuilder.Append("
    "); + foreach (SurveyResultInfo r in result) { - labelBuilder.Append(","); - dataBuilder.Append(","); - bgColorsBuilder.Append(","); - bColorsBuilder.Append(","); + dataBuilder.Append(string.Format("
  • {0}{1} ({2})
  • ", r.IsCorrect ? string.Format("{0}: ", Localization.GetString("CorrectAnswer.Text", LocalResourceFile)) : string.Empty, ClientAPI.GetSafeJSString(r.OptionName), r.Votes)); + } + dataBuilder.Append("
"); + ChartPlaceHolder.Controls.Add(new Label() { Text = dataBuilder.ToString() }); + break; + case ChartType.Table: + labelBuilder.Append(string.Format("

{0}

", survey.Question)); + ChartPlaceHolder.Controls.Add(new Label() { Text = labelBuilder.ToString() }); + dataBuilder.Append(""); + dataBuilder.Append(string.Format("")); + dataBuilder.Append(string.Format("", Localization.GetString("Question", LocalResourceFile), Localization.GetString("Answer", LocalResourceFile))); + dataBuilder.Append(""); + int lineNumber = 1; + foreach (SurveyResultInfo r in result) + { + dataBuilder.Append(string.Format("", lineNumber % 2 == 1 ? "dnnGridItem surveyGridItem" : "dnnGridAltItem surveyGridAltItem")); + dataBuilder.Append(string.Format("", r.OptionName, r.Votes)); + dataBuilder.Append(""); + lineNumber++; + } + dataBuilder.Append("
{0}{1}
{0}{1}
"); + ChartPlaceHolder.Controls.Add(new Label() { Text = dataBuilder.ToString() }); + break; + default: + StringBuilder bgColorsBuilder = new StringBuilder(); + StringBuilder bColorsBuilder = new StringBuilder(); + foreach (SurveyResultInfo r in result) + { + labelBuilder.Append(string.Format("\"{0}\"", String.Format("{0}{1}", ClientAPI.GetSafeJSString(r.OptionName), r.IsCorrect ? string.Format("{0}", Localization.GetString("CorrectAnswer.Text", LocalResourceFile)) : string.Empty))); + dataBuilder.Append(r.Votes); + bgColorsBuilder.Append(string.Format("\"{0}\"", Base.GetColor(result.IndexOf(r), (!(r.IsCorrect))))); + bColorsBuilder.Append(string.Format("\"{0}\"", r.IsCorrect ? "rgba(0,170,0,1)" : Base.GetColor(result.IndexOf(r), false))); + if (result.IndexOf(r) < result.Count - 1) + { + labelBuilder.Append(","); + dataBuilder.Append(","); + bgColorsBuilder.Append(","); + bColorsBuilder.Append(","); + } } - } - CanvasControl canvas = (CanvasControl)LoadControl("Controls/CanvasControl.ascx"); - canvas.Header = survey.Question; - canvas.Labels = labelBuilder.ToString(); - canvas.Data = dataBuilder.ToString(); - canvas.BackgroundColors = bgColorsBuilder.ToString(); - canvas.BorderColors = bColorsBuilder.ToString(); - canvas.ChartType = survey.ChartType; - ChartPlaceHolder.Controls.Add(canvas); + CanvasControl canvas = (CanvasControl)LoadControl("Controls/CanvasControl.ascx"); + canvas.Header = survey.Question; + canvas.Labels = labelBuilder.ToString(); + canvas.Data = dataBuilder.ToString(); + canvas.BackgroundColors = bgColorsBuilder.ToString(); + canvas.BorderColors = bColorsBuilder.ToString(); + canvas.ChartType = survey.ChartType; + ChartPlaceHolder.Controls.Add(canvas); + break; + } } base.OnPreRender(e); From 154cf9652c0d5f45172a61cd0b98e1ee4d9b5800 Mon Sep 17 00:00:00 2001 From: Michael Tobisch Date: Sun, 9 Jul 2023 08:15:28 +0200 Subject: [PATCH 5/8] Solves #62 --- .../App_LocalResources/SurveyView.ascx.resx | 3 ++ .../Controllers/SurveyResultsController.cs | 10 ++++++ DNN.Survey/DNN.Survey.csproj | 1 + .../SqlDataProvider/09.02.00.SqlDataProvider | 32 +++++++++++++++++++ .../SqlDataProvider/Uninstall.SqlDataProvider | 6 +++- DNN.Survey/SurveyView.ascx | 5 +++ DNN.Survey/SurveyView.ascx.cs | 21 ++++++++++-- DNN.Survey/SurveyView.ascx.designer.cs | 18 +++++++++++ 8 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 DNN.Survey/Providers/DataProviders/SqlDataProvider/09.02.00.SqlDataProvider diff --git a/DNN.Survey/App_LocalResources/SurveyView.ascx.resx b/DNN.Survey/App_LocalResources/SurveyView.ascx.resx index 6da60f1..b7fd450 100644 --- a/DNN.Survey/App_LocalResources/SurveyView.ascx.resx +++ b/DNN.Survey/App_LocalResources/SurveyView.ascx.resx @@ -144,6 +144,9 @@ Correct answers + + The survey has been submitted {0} times. + Delete results diff --git a/DNN.Survey/Components/Controllers/SurveyResultsController.cs b/DNN.Survey/Components/Controllers/SurveyResultsController.cs index c8891b2..4fb57a1 100644 --- a/DNN.Survey/Components/Controllers/SurveyResultsController.cs +++ b/DNN.Survey/Components/Controllers/SurveyResultsController.cs @@ -82,6 +82,16 @@ public List Get(int surveyID) } return surveyResult.ToList(); } + + public int GetCount(int moduleID) + { + int count = 0; + using (IDataContext ctx = DataContext.Instance()) + { + count = ctx.ExecuteScalar(CommandType.StoredProcedure, "{databaseOwner}{objectQualifier}SurveyResults_Count", moduleID); + } + return count; + } #endregion } } \ No newline at end of file diff --git a/DNN.Survey/DNN.Survey.csproj b/DNN.Survey/DNN.Survey.csproj index a093f7f..e08d862 100644 --- a/DNN.Survey/DNN.Survey.csproj +++ b/DNN.Survey/DNN.Survey.csproj @@ -240,6 +240,7 @@ + 10.0 diff --git a/DNN.Survey/Providers/DataProviders/SqlDataProvider/09.02.00.SqlDataProvider b/DNN.Survey/Providers/DataProviders/SqlDataProvider/09.02.00.SqlDataProvider new file mode 100644 index 0000000..0a6e0f5 --- /dev/null +++ b/DNN.Survey/Providers/DataProviders/SqlDataProvider/09.02.00.SqlDataProvider @@ -0,0 +1,32 @@ +/************************************************************/ +/***** SqlDataProvider *****/ +/***** Version: 09.02.00 *****/ +/***** *****/ +/***** Note: To manually execute this script you must *****/ +/***** perform a search and replace operation *****/ +/***** for {databaseOwner} and {objectQualifier} *****/ +/***** *****/ +/************************************************************/ + +IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}SurveyResults_Count') AND type = N'P') + DROP PROCEDURE {databaseOwner}{objectQualifier}SurveyResults_Count +GO + +CREATE PROCEDURE {databaseOwner}{objectQualifier}SurveyResults_Count + @ModuleID int +AS +BEGIN + SELECT + COUNT(*) + FROM + {databaseOwner}{objectQualifier}Surveys s + INNER JOIN {databaseOwner}{objectQualifier}SurveyOptions so ON so.SurveyID = s.SurveyID + INNER JOIN {databaseOwner}{objectQualifier}SurveyResults sr ON sr.SurveyOptionID = so.SurveyOptionID + WHERE + s.ModuleID = @ModuleID +END +GO + +/************************************************************/ +/***** SqlDataProvider *****/ +/************************************************************/ diff --git a/DNN.Survey/Providers/DataProviders/SqlDataProvider/Uninstall.SqlDataProvider b/DNN.Survey/Providers/DataProviders/SqlDataProvider/Uninstall.SqlDataProvider index 285d1cb..aa21d67 100644 --- a/DNN.Survey/Providers/DataProviders/SqlDataProvider/Uninstall.SqlDataProvider +++ b/DNN.Survey/Providers/DataProviders/SqlDataProvider/Uninstall.SqlDataProvider @@ -1,6 +1,6 @@ /************************************************************/ /***** Uninstall.SqlDataProvider *****/ -/***** Version: 09.00.00 *****/ +/***** Version: 09.02.00 *****/ /***** *****/ /***** Note: To manually execute this script you must *****/ /***** perform a search and replace operation *****/ @@ -56,6 +56,10 @@ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwne DROP PROCEDURE {databaseOwner}{objectQualifier}SurveyResults_Get GO +IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}SurveyResults_Count') AND type = N'P') + DROP PROCEDURE {databaseOwner}{objectQualifier}SurveyResults_Count +GO + IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'{databaseOwner}{objectQualifier}vSurveys_CsvExport') AND type = N'V') DROP VIEW {databaseOwner}{objectQualifier}vSurveys_CsvExport GO diff --git a/DNN.Survey/SurveyView.ascx b/DNN.Survey/SurveyView.ascx index 2fe2162..c55c6b0 100644 --- a/DNN.Survey/SurveyView.ascx +++ b/DNN.Survey/SurveyView.ascx @@ -52,4 +52,9 @@ Visible="false" /> + + + +
diff --git a/DNN.Survey/SurveyView.ascx.cs b/DNN.Survey/SurveyView.ascx.cs index d339bc8..8782a04 100644 --- a/DNN.Survey/SurveyView.ascx.cs +++ b/DNN.Survey/SurveyView.ascx.cs @@ -55,6 +55,7 @@ public partial class SurveyView : PortalModuleBase, IActionable private PortalSecurity _portalSecurity = null; private string _cookie; + private int? _countResults; protected ModulePermissionCollection ModulePermissionCollection { @@ -198,6 +199,18 @@ protected bool AuthorizedUsersOnly return (authorizedUsersOnly); } } + + protected int CountResults + { + get + { + if (!(_countResults.HasValue)) + { + _countResults = SurveyResultsController.GetCount(ModuleId); + } + return _countResults.Value; + } + } #endregion #region Settings @@ -338,7 +351,7 @@ public ModuleActionCollection ModuleActions // Add Question actions.Add(GetNextActionID(), Localization.GetString("AddQuestion.Action", LocalResourceFile), ModuleActionType.AddContent, string.Empty, string.Empty, EditUrl(), false, SecurityAccessLevel.Edit, true, false); actions.Add(GetNextActionID(), Localization.GetString("OrganizeQuestions.Action", LocalResourceFile), ModuleActionType.AddContent, string.Empty, IconController.IconURL("ViewStats"), EditUrl("Organize"), false, SecurityAccessLevel.Edit, true, false); - if (HasViewResultsPermission) + if (HasViewResultsPermission && (CountResults > 0)) { // View Results actions.Add(GetNextActionID(), Localization.GetString("ViewResults.Action", LocalResourceFile), ModuleActionType.AddContent, string.Empty, IconController.IconURL("View"), EditUrl("SurveyResults"), false, SecurityAccessLevel.View, true, false); @@ -422,9 +435,11 @@ protected override void OnLoad(EventArgs e) } } - ViewResultsButton.Visible = HasViewResultsPermission; - ExportToCsvButton.Visible = HasEditPermission; + ViewResultsButton.Visible = (HasViewResultsPermission && (CountResults > 0)); + ExportToCsvButton.Visible = (HasEditPermission && (CountResults > 0)); ModuleHelpPanel.Visible = HasEditPermission; + CountResultsPanel.Visible = HasViewResultsPermission; + CountResultsLabel.Text = string.Format(Localization.GetString("CountResults", LocalResourceFile), CountResults); base.OnLoad(e); } catch (Exception ex) diff --git a/DNN.Survey/SurveyView.ascx.designer.cs b/DNN.Survey/SurveyView.ascx.designer.cs index ff6dac6..de308a4 100644 --- a/DNN.Survey/SurveyView.ascx.designer.cs +++ b/DNN.Survey/SurveyView.ascx.designer.cs @@ -94,5 +94,23 @@ public partial class SurveyView /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. /// protected global::System.Web.UI.WebControls.LinkButton ExportToCsvButton; + + /// + /// CountResultsPanel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Panel CountResultsPanel; + + /// + /// CountResultsLabel-Steuerelement. + /// + /// + /// Automatisch generiertes Feld. + /// Zum Ändern Felddeklaration aus der Designerdatei in eine Code-Behind-Datei verschieben. + /// + protected global::System.Web.UI.WebControls.Label CountResultsLabel; } } From aa7fa0e124606e2cb3ba56747a31e4cd1c3f8407 Mon Sep 17 00:00:00 2001 From: Michael Tobisch Date: Sun, 9 Jul 2023 14:11:44 +0200 Subject: [PATCH 6/8] Release 09.02.00 --- DNN.Survey/DNN_Survey.dnn | 15 ++++-- DNN.Survey/Documentation/License.html | 2 +- DNN.Survey/Documentation/ReleaseNotes.html | 53 ++++++++++++++++++++-- DNN.Survey/Properties/AssemblyInfo.cs | 4 +- 4 files changed, 63 insertions(+), 11 deletions(-) diff --git a/DNN.Survey/DNN_Survey.dnn b/DNN.Survey/DNN_Survey.dnn index 8bf98ad..84e915a 100644 --- a/DNN.Survey/DNN_Survey.dnn +++ b/DNN.Survey/DNN_Survey.dnn @@ -1,6 +1,6 @@  - + Survey - 09.04.00 + 09.11.00 @@ -674,10 +674,15 @@ 09.01.00.SqlDataProvider 09.01.00 + @@ -765,7 +770,7 @@ DNN.Modules.Survey.Components.Controllers.SurveyBusinessController [DESKTOPMODULEID] - 03.01.00,03.03.00,04.00.20,04.00.60,04.00.70,04.00.85,04.01.00,04.05.00,04.06.00,04.07.00,09.00.00,09.01.00,09.01.01 + 03.01.00,03.03.00,04.00.20,04.00.60,04.00.70,04.00.85,04.01.00,04.05.00,04.06.00,04.07.00,09.00.00,09.01.00,09.01.01,09.02.00 @@ -775,7 +780,7 @@ bin DNN.Modules.Survey.dll - 9.1.1.0 + 9.2.0.0 diff --git a/DNN.Survey/Documentation/License.html b/DNN.Survey/Documentation/License.html index a4ca335..2f99978 100644 --- a/DNN.Survey/Documentation/License.html +++ b/DNN.Survey/Documentation/License.html @@ -2,7 +2,7 @@

License

DNN® - www.dnnsoftware.com
- © 2002-2019 by DNN Corp.
+ © 2002-2023 by DNN Corp.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/DNN.Survey/Documentation/ReleaseNotes.html b/DNN.Survey/Documentation/ReleaseNotes.html index 422adfe..9f1d4ad 100644 --- a/DNN.Survey/Documentation/ReleaseNotes.html +++ b/DNN.Survey/Documentation/ReleaseNotes.html @@ -1,15 +1,15 @@ 

DNN Survey Module

DNN® - www.dnnsoftware.com
- © 2002-2020 by DNN Corp.
+ © 2002-2023 by DNN Corp.

-

DNN Survey Project 09.00.00

+

DNN Survey Project 09.02.00

Minimum System requirements:

    -
  • DNN Platform version 08.00.00 or higher
  • +
  • DNN Platform version 09.11.00 or higher

Changes: @@ -54,4 +54,51 @@

DNN Survey Project 09.01.00

  • #47 - Missing Surveys
  • #48 - Charts don't display when a double quote was entered in a free text response
  • +

    DNN Survey Project 09.01.01

    +

    + Minimum System requirements: +

    +
      +
    • DNN Platform version 09.04.04 or higher
    • +
    +

    + Changes: +

    +
      +
    • Hide buttons related to results when no results available
    • +
    • Added "List" and "Table" as new "chart" options, esp. for free text answers
    • +
    • Allows giving a custom name to the Survey results page
    • +
    +

    + Bugfixes: +

    +
      +
    • #57 - Unable to install Release 9.1.0
    • +
    +

    DNN Survey Project 09.02.00

    +

    + Minimum System requirements: +

    +
      +
    • DNN Platform version 09.11.00 or higher
    • +
    +

    + Changes: +

    +
      +
    • Buttons and action menu option related to results when no results available are hidden
    • +
    • Added "List" and "Table" as new "chart" options, esp. for free text answers
    • +
    • Name to the Survey results page is localizable
    • +
    • Help links are displayed to administrators
    • +
    • Bumps DNN Core version to 09.11.00
    • +
    +

    + Bugfixes: +

    +
      +
    • #62 - Bug/feature? View survey results when there are no responses
    • +
    • #63 - Cannot give a custom name to the Survey results page
    • +
    • #64 - The Survey module doesn't create a 'donuts' chart
    • +
    • #65 - Starttext of a sentence not displayed
    • +
    \ No newline at end of file diff --git a/DNN.Survey/Properties/AssemblyInfo.cs b/DNN.Survey/Properties/AssemblyInfo.cs index a3b247b..35f9496 100644 --- a/DNN.Survey/Properties/AssemblyInfo.cs +++ b/DNN.Survey/Properties/AssemblyInfo.cs @@ -32,8 +32,8 @@ // // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: -[assembly: AssemblyVersion("9.1.1.0")] -[assembly: AssemblyFileVersion("9.1.1.0")] +[assembly: AssemblyVersion("9.2.0.0")] +[assembly: AssemblyFileVersion("9.2.0.0")] // Add assembly reference to allow for WebResource.axd access to JavaScript files // see: http://aspnet.4guysfromrolla.com/articles/080906-1.aspx From d0669f330b2b925707c33077382655c2c4942fb3 Mon Sep 17 00:00:00 2001 From: Michael Tobisch Date: Sun, 9 Jul 2023 14:29:30 +0200 Subject: [PATCH 7/8] Corrected smal bug in SurveyEdit --- DNN.Survey/SurveyEdit.ascx.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/DNN.Survey/SurveyEdit.ascx.cs b/DNN.Survey/SurveyEdit.ascx.cs index 89896e0..c3d9f3a 100644 --- a/DNN.Survey/SurveyEdit.ascx.cs +++ b/DNN.Survey/SurveyEdit.ascx.cs @@ -292,19 +292,19 @@ protected override void OnLoad(EventArgs e) AnswersGrid.DataBind(); MaxViewOrder = Answers.Count; ChartTypeChanged = true; - } - if ((Survey.OptionType == QuestionType.RadioButtons) || (Survey.OptionType == QuestionType.CheckBoxes)) - { - foreach (ListItem li in ChartTypeDropDownList.Items) + if ((Survey.OptionType == QuestionType.RadioButtons) || (Survey.OptionType == QuestionType.CheckBoxes)) { - li.Enabled = true; + foreach (ListItem li in ChartTypeDropDownList.Items) + { + li.Enabled = true; + } } - } - else - { - foreach (ListItem li in ChartTypeDropDownList.Items) + else { - li.Enabled = ((li.Value == Convert.ToInt32(ChartType.List).ToString()) || (li.Value == Convert.ToInt32(ChartType.Table).ToString())); + foreach (ListItem li in ChartTypeDropDownList.Items) + { + li.Enabled = ((li.Value == Convert.ToInt32(ChartType.List).ToString()) || (li.Value == Convert.ToInt32(ChartType.Table).ToString())); + } } } From 1385b5a7be566832012e7b99d1adf481cffa7bd3 Mon Sep 17 00:00:00 2001 From: Michael Tobisch Date: Sun, 9 Jul 2023 14:54:08 +0200 Subject: [PATCH 8/8] Fixed small SQL script issue --- .../DataProviders/SqlDataProvider/09.02.00.SqlDataProvider | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DNN.Survey/Providers/DataProviders/SqlDataProvider/09.02.00.SqlDataProvider b/DNN.Survey/Providers/DataProviders/SqlDataProvider/09.02.00.SqlDataProvider index 0a6e0f5..9e590e2 100644 --- a/DNN.Survey/Providers/DataProviders/SqlDataProvider/09.02.00.SqlDataProvider +++ b/DNN.Survey/Providers/DataProviders/SqlDataProvider/09.02.00.SqlDataProvider @@ -17,13 +17,13 @@ CREATE PROCEDURE {databaseOwner}{objectQualifier}SurveyResults_Count AS BEGIN SELECT - COUNT(*) + COUNT(DISTINCT sr.ResultUserID) FROM {databaseOwner}{objectQualifier}Surveys s INNER JOIN {databaseOwner}{objectQualifier}SurveyOptions so ON so.SurveyID = s.SurveyID INNER JOIN {databaseOwner}{objectQualifier}SurveyResults sr ON sr.SurveyOptionID = so.SurveyOptionID WHERE - s.ModuleID = @ModuleID + ModuleID = @ModuleID END GO