Skip to content

Commit

Permalink
Make user visible text customizable timetheoretical#59
Browse files Browse the repository at this point in the history
Add install-time options to change the
- application name
- meeting button label and logo
- text body message and disclaimer
  • Loading branch information
Achim Leitner committed May 12, 2023
1 parent 960c842 commit c3c66ce
Show file tree
Hide file tree
Showing 13 changed files with 234 additions and 14 deletions.
24 changes: 19 additions & 5 deletions JitsiMeetOutlook/AppointmentRibbonGroup.controls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private void initialise()
Outlook.Inspector inspector = (Outlook.Inspector)this.Context;
appointmentItem = inspector.CurrentItem as Outlook.AppointmentItem;

if (appointmentItem.Location == "Jitsi Meet")
if (appointmentItem.Location == Properties.Settings.Default.appName)
{
groupJitsiMeetControls.Visible = true;
groupNewMeeting.Visible = false;
Expand Down Expand Up @@ -130,7 +130,14 @@ public async System.Threading.Tasks.Task appendNewMeetingText()
endSel.MoveDown(Word.WdUnits.wdLine);
endSel.InsertAfter("\n");
endSel.MoveDown(Word.WdUnits.wdLine);
endSel.InsertAfter(Globals.ThisAddIn.getElementTranslation("appointmentItem", "textBodyMessage"));
if (string.IsNullOrWhiteSpace(Properties.Settings.Default.textBodyMessage))
{
endSel.InsertAfter(Globals.ThisAddIn.getElementTranslation("appointmentItem", "textBodyMessage"));
}
else
{
endSel.InsertAfter(Properties.Settings.Default.textBodyMessage.Replace(@"\n", "\r\n"));
}
endSel.EndKey(Word.WdUnits.wdLine);
wordDocument.Hyperlinks.Add(endSel.Range, link, ref missing, ref missing, link, ref missing);
endSel.EndKey(Word.WdUnits.wdLine);
Expand Down Expand Up @@ -168,7 +175,15 @@ public async System.Threading.Tasks.Task appendNewMeetingText()
endSel.InsertAfter("\n");
endSel.MoveDown(Word.WdUnits.wdLine);

IEnumerable<KeyValuePair<bool, string>> disclaimer = Utils.SplitToTextAndHyperlinks(Globals.ThisAddIn.getElementTranslation("appointmentItem", "textBodyDisclaimer"));
IEnumerable<KeyValuePair<bool, string>> disclaimer;
if (string.IsNullOrWhiteSpace(Properties.Settings.Default.textBodyDisclaimer))
{
disclaimer = Utils.SplitToTextAndHyperlinks(Globals.ThisAddIn.getElementTranslation("appointmentItem", "textBodyDisclaimer"));
}
else
{
disclaimer = Utils.SplitToTextAndHyperlinks(Properties.Settings.Default.textBodyDisclaimer.Replace(@"\n", "\r\n"));
}
foreach (var textblock in disclaimer)
{
if (textblock.Key)
Expand Down Expand Up @@ -269,9 +284,8 @@ public void toggleRequireName()

private void addJitsiMeeting()
{
appointmentItem.Location = "Jitsi Meet";
appointmentItem.Location = Properties.Settings.Default.appName;
initialise();

}

private void toggleSetting(string setting)
Expand Down
24 changes: 22 additions & 2 deletions JitsiMeetOutlook/AppointmentRibbonGroup.language.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Text.Json;
using System;
using System.IO;
using System.Drawing;

namespace JitsiMeetOutlook
{
Expand All @@ -13,8 +16,25 @@ private void setLanguage()
this.buttonRequireDisplayName.Label = Globals.ThisAddIn.getElementTranslation("appointmentRibbonGroup", "buttonRequireDisplayName");
this.buttonStartWithAudioMuted.Label = Globals.ThisAddIn.getElementTranslation("appointmentRibbonGroup", "buttonStartWithAudioMuted");
this.buttonStartWithVideoMuted.Label = Globals.ThisAddIn.getElementTranslation("appointmentRibbonGroup", "buttonStartWithVideoMuted");

this.groupJitsiMeetControls.Label = Properties.Settings.Default.appName;
this.groupNewMeeting.Label = Properties.Settings.Default.appName;
if (string.IsNullOrWhiteSpace(Properties.Settings.Default.meetingButtonLabel))
{
this.buttonNewJitsiMeeting.Label = Globals.ThisAddIn.getElementTranslation("calendarRibbonButton", "buttonNewJitsiMeeting");
}
else
{
this.buttonNewJitsiMeeting.Label = Properties.Settings.Default.meetingButtonLabel;
}
if (! string.IsNullOrWhiteSpace(Properties.Settings.Default.meetingButtonLogo))
{
// See https://stackoverflow.com/a/31962116
byte[] bytes = Convert.FromBase64String(Properties.Settings.Default.meetingButtonLogo);
using (MemoryStream ms = new MemoryStream(bytes))
{
this.buttonNewJitsiMeeting.Image = Image.FromStream(ms);
}
}
}
}

}
2 changes: 1 addition & 1 deletion JitsiMeetOutlook/CalendarRibbonButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private async void buttonNewJitsiMeeting_Click(object sender, RibbonControlEvent

// Appointment details
newAppointment.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;
newAppointment.Location = "Jitsi Meet";
newAppointment.Location = Properties.Settings.Default.appName;

// Set appointment date if selected in calendar
if (view.ViewType == Outlook.OlViewType.olCalendarView)
Expand Down
22 changes: 21 additions & 1 deletion JitsiMeetOutlook/CalendarRibbonButton.language.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
using System.Text.Json;
using System;
using System.IO;
using System.Drawing;

namespace JitsiMeetOutlook
{
public partial class CalendarRibbonButton
{
private void setLanguage()
{
this.buttonNewJitsiMeeting.Label = Globals.ThisAddIn.getElementTranslation("calendarRibbonButton", "buttonNewJitsiMeeting");
this.JitsiMeet.Label = Properties.Settings.Default.appName;
if (string.IsNullOrWhiteSpace(Properties.Settings.Default.meetingButtonLabel))
{
this.buttonNewJitsiMeeting.Label = Globals.ThisAddIn.getElementTranslation("calendarRibbonButton", "buttonNewJitsiMeeting");
}
else
{
this.buttonNewJitsiMeeting.Label = Properties.Settings.Default.meetingButtonLabel;
}
if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.meetingButtonLogo))
{
// See https://stackoverflow.com/a/31962116
byte[] bytes = Convert.FromBase64String(Properties.Settings.Default.meetingButtonLogo);
using (MemoryStream ms = new MemoryStream(bytes))
{
this.buttonNewJitsiMeeting.Image = Image.FromStream(ms);
}
}
}
}
}
2 changes: 1 addition & 1 deletion JitsiMeetOutlook/FormSettings.language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private void setLanguage()
this.labelStartWithAudioMuted.Text = Globals.ThisAddIn.getElementTranslation("settings", "labelStartWithAudioMuted");
this.labelStartWithVideoMuted.Text = Globals.ThisAddIn.getElementTranslation("settings", "labelStartWithVideoMuted");
this.groupBoxLanguage.Text = Globals.ThisAddIn.getElementTranslation("settings", "groupBoxLanguage");

this.Text = Properties.Settings.Default.appName + " Settings";
}


Expand Down
62 changes: 61 additions & 1 deletion JitsiMeetOutlook/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions JitsiMeetOutlook/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,20 @@
<Setting Name="conferenceSchedulerEndpointSecret" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="appName" Type="System.String" Scope="User">
<Value Profile="(Default)">Jitsi Meet</Value>
</Setting>
<Setting Name="meetingButtonLabel" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="meetingButtonLogo" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="textBodyMessage" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="textBodyDisclaimer" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
28 changes: 28 additions & 0 deletions JitsiMeetOutlook/Settings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace JitsiMeetOutlook.Properties {


// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {

public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}

private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}

private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}
2 changes: 1 addition & 1 deletion JitsiMeetOutlook/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private static string escapeDomain(string domain)

public static string GetUrl(string oldBody, string domain)
{
return Regex.Match(oldBody, "http[s]*://" + escapeDomain(domain) + "[\\w\\/#%\\.=]+").Value;
return Regex.Match(oldBody, @"https?://" + escapeDomain(domain) + @"[\w_\-/#%&.=]+").Value;
}

public static bool SettingIsActive(string url, string setting)
Expand Down
15 changes: 15 additions & 0 deletions JitsiMeetOutlook/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@
<setting name="conferenceSchedulerEndpointSecret" serializeAs="String">
<value />
</setting>
<setting name="appName" serializeAs="String">
<value>Jitsi Meet</value>
</setting>
<setting name="meetingButtonLabel" serializeAs="String">
<value />
</setting>
<setting name="meetingButtonLogo" serializeAs="String">
<value />
</setting>
<setting name="textBodyMessage" serializeAs="String">
<value />
</setting>
<setting name="textBodyDisclaimer" serializeAs="String">
<value />
</setting>
</JitsiMeetOutlook.Properties.Settings>
</userSettings>
<runtime>
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ As of v0.4.0, the add-in can be installed via command line with custom setting p
- `PHONENUMBERLIST_ENDPOINT`: Endpoint to get the Phone Number from to call in
- `CONFERENCESCHEDULER_ENDPOINT`: Endpoint to send the conference information to in advance, in order to make the call available for call in before the first person joins
- `CONFERENCESCHEDULER_ENDPOINT_SECRET`: Secret for the `CONFERENCESCHEDULER_ENDPOINT`, used for JWT generation.
- `APP_NAME`: Defaults to "Jitsi Meet". Modify if your local deployment uses a different name. Will be used as name for the ribbon groups and the meeting location.
- `MEETING_BUTTON_LABEL`: Defaults to "New Jitsi Meeting". Modify if your local deployment uses a different name.
- `MEETING_BUTTON_LOGO`: Defaults to the Jitsi logo. Provide custom logo as base64-encoded PNG image, 64x64 pixel, with a transparent background.
- `TEXT_BODY_MESSAGE`: Customize introductory text to meeting URL. `"\n"` is replaced with a line break. Defaults to `"\n\n\nJitsi-Meeting\n\nJoin the meeting: "``
- `TEXT_BODY_DISCLAIMER`: Add a disclaimer after the meeting URL. `"\n"` is replaced with a line break.

Example install command: `msiexec /i "C:\Downloads\JitsiMeetOutlook-v0.6.0-windows-anycpu.msi" TARGETDIR="C:\Program Files (x86)\Jitsi Meet Outlook" DOMAIN="my.domain.com" ROOMID="PermanentRoomName" MODE="string" REQNAME="True" NOAUDIO="True" NOVIDEO="True" LANG="en" CONFERENCEMAPPER_ENDPOINT="https://my.domain.com/conferenceMapper" PHONENUMBERLIST_ENDPOINT="https://my.domain.com/phoneNumberList" /passive`

Expand Down
45 changes: 44 additions & 1 deletion SettingsInstallerParameters/CustomAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private static void updateConfigXml(Session session)
session.Log($"Setting display language: {getLanguage(session)}");
navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='language']/value").SetValue(getLanguage(session));

session.Log($"Setting random ID generator mode: {getLanguage(session)}");
session.Log($"Setting random ID generator mode: {getRandomRoomIdGeneratorMode(session)}");
navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='randomRoomIdGeneratorMode']/value").SetValue(getRandomRoomIdGeneratorMode(session));

if (getConferenceMapperEndpoint(session).Length != 0)
Expand Down Expand Up @@ -103,6 +103,24 @@ private static void updateConfigXml(Session session)
navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='conferenceSchedulerEndpointSecret']/value").SetValue(getConferenceSchedulerEndpointSecret(session));
}

if (getAppName(session).Length != 0)
{
session.Log($"Setting application name: {getAppName(session)}");
navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='appName']/value").SetValue(getAppName(session));
}

session.Log($"Setting button label: {getMeetingButtonLabel(session)}");
navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='meetingButtonLabel']/value").SetValue(getMeetingButtonLabel(session));

session.Log($"Setting button logo: {getMeetingButtonLogo(session)}");
navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='meetingButtonLogo']/value").SetValue(getMeetingButtonLogo(session));

session.Log($"Setting text of body message: {getTextBodyMessage(session)}");
navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='textBodyMessage']/value").SetValue(getTextBodyMessage(session));

session.Log($"Setting text of body disclaimer: {getTextBodyDisclaimer(session)}");
navigator.SelectSingleNode(@"/configuration/userSettings/JitsiMeetOutlook.Properties.Settings/setting[@name='textBodyDisclaimer']/value").SetValue(getTextBodyDisclaimer(session));

session.Log($"Saving settings to: {xmlPath}");
document.Save(xmlPath);
}
Expand Down Expand Up @@ -189,6 +207,31 @@ private static string getRandomRoomIdGeneratorMode(Session session)

}

private static string getAppName(Session session)
{
return session.CustomActionData["appName"];
}

private static string getMeetingButtonLabel(Session session)
{
return session.CustomActionData["meetingButtonLabel"];
}

private static string getMeetingButtonLogo(Session session)
{
return session.CustomActionData["meetingButtonLogo"];
}

private static string getTextBodyMessage(Session session)
{
return session.CustomActionData["textBodyMessage"];
}

private static string getTextBodyDisclaimer(Session session)
{
return session.CustomActionData["textBodyDisclaimer"];
}


private static string getBooleanParameter(Session session, string parameter)
{
Expand Down
2 changes: 1 addition & 1 deletion setup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

<!-- Reference custom action to update settings xml -->
<CustomAction Id="UpdateConfigXml" BinaryKey="SettingsInstallerParameters.CA" DllEntry="UpdateConfigXml" Execute="deferred" Return="check" Impersonate="no" />
<CustomAction Id="SetCMDParameters" Property="UpdateConfigXml" Value="InstallDir=[INSTALLFOLDER];Domain=[DOMAIN];roomID=[ROOMID];requireDisplayName=[REQNAME];startWithAudioMuted=[NOAUDIO];startWithVideoMuted=[NOVIDEO];language=[LANG];randomRoomIdGeneratorMode=[MODE];conferenceMapperEndpoint=[CONFERENCEMAPPER_ENDPOINT];phoneNumberListEndpoint=[PHONENUMBERLIST_ENDPOINT];conferenceSchedulerEndpoint=[CONFERENCESCHEDULER_ENDPOINT];conferenceSchedulerEndpointSecret=[CONFERENCESCHEDULER_ENDPOINT_SECRET]" />
<CustomAction Id="SetCMDParameters" Property="UpdateConfigXml" Value="InstallDir=[INSTALLFOLDER];Domain=[DOMAIN];roomID=[ROOMID];requireDisplayName=[REQNAME];startWithAudioMuted=[NOAUDIO];startWithVideoMuted=[NOVIDEO];language=[LANG];randomRoomIdGeneratorMode=[MODE];conferenceMapperEndpoint=[CONFERENCEMAPPER_ENDPOINT];phoneNumberListEndpoint=[PHONENUMBERLIST_ENDPOINT];conferenceSchedulerEndpoint=[CONFERENCESCHEDULER_ENDPOINT];conferenceSchedulerEndpointSecret=[CONFERENCESCHEDULER_ENDPOINT_SECRET];appName=[APP_NAME];meetingButtonLabel=[MEETING_BUTTON_LABEL];meetingButtonLogo=[MEETING_BUTTON_LOGO];textBodyMessage=[TEXT_BODY_MESSAGE];textBodyDisclaimer=[TEXT_BODY_DISCLAIMER]" />
<Binary Id="SettingsInstallerParameters.CA" SourceFile="$(var.JitsiMeetOutlook.ProjectDir)..\SettingsInstallerParameters\bin\Release\SettingsInstallerParameters.CA.dll" />

<InstallExecuteSequence>
Expand Down

0 comments on commit c3c66ce

Please sign in to comment.