logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
dball  
#1 Posted : Friday, November 3, 2017 1:04:39 PM(UTC)
dball


Rank: Guest

Joined: 10/5/2017(UTC)
Posts: 4
United States
Location: Maryland

Was thanked: 1 time(s) in 1 post(s)
So right now I'm making an extension which changes the URL that comes up when you start a new session with the code tab selected. So far it works by simply copying a bit of javascript from the host page and only modifies where the URL is. The only issue is that the text box for renaming a session had to be removed because it interferes/overlaps with the rest of the invite panel which means the URL goes back to default even though the edit is still in there.

Here is what the javascript looks like in the extension:
Code:
SC.event.addGlobalHandler(SC.event.InitializeTab, function (eventArgs) {
    	switch (eventArgs.tabName) {
        	case 'Start':
   				SC.ui.setContents(eventArgs.container, [
						$div({ className: 'InvitationPanel' }, [
							$div({ className: 'InvitationTabList' }, [
								$span([SC.res['InvitationPanel.InvitationTabListMessage'], $nbsp(), $nbsp()]),
								SC.command.createCommandButtons([
									{ commandName: 'Select', commandArgument: 'Code' },
									{ commandName: 'Select', commandArgument: 'Email' },
									{ commandName: 'Select', commandArgument: 'Link' },
									{ commandName: 'Select', commandArgument: 'Calendar' }
								]),
							]),
							$div({ className: 'InvitationTabContent' }, [
								$div({ className: 'CodeTab', _tabName: 'Code' }, [
									$div({ className: 'MoreOptionsButtonContainer' }),
									$p(SC.res['InvitationPanel.CodeTabText']),
									$h3(extensionContext.settingValues.SessionURL),
									$p({ className: 'InvitationInstruction' }),
									$div([
										SC.ui.createEditableInput('SaveInvitationCode', { className: 'EditInvitationCodeBox' }),
									]),
								]),
								$div({ className: 'EmailTab', _tabName: 'Email' }, [
									$dl([
										$dt(SC.res['InvitationPanel.EmailTabLabel']),
										$dd([
											$div([
												$input({ className: 'GuestEmailBox', type: 'text', placeholder: SC.res['InvitationPanel.EmailTabPlaceholder'] }),
												$button({ _commandName: 'SendInvitationEmail' }, SC.res['InvitationPanel.EmailTab.SendButtonText']),
											]),
											$p({ className: 'ResultPanel' })
										]),
										$dt(),
										$dd([
											$span(SC.res['InvitationPanel.EmailTabText']),
											$nbsp(),
											$nbsp(),
											$a({ _commandName: 'Compose', _commandArgument: 'Email' }, SC.res['InvitationPanel.EmailTab.ComposeEmailButtonText']),
										]),
									]),
								]),
								$div({ className: 'LinkTab', _tabName: 'Link' }, [
									$dl([
										$dt(SC.res['InvitationPanel.LinkTabLabel']),
										$dd([
											$div([
												$input({ type: 'text', className: 'ShareableLinkText', readOnly: true }),
												$button({
													_eventHandlerMap: {
														click: function (eventArgs) {
															SC.ui.executeCopyToClipboard(eventArgs.target.parentNode.firstChild, $('.LinkTab .ResultPanel'));
														}
													},
												}, [
														SC.res['InvitationPanel.LinkTab.CopyButtonText'],
													]),
											]),
											$p({ className: 'ResultPanel' })
										])
									]),
								]),
								$div({ className: 'CalendarTab', _tabName: 'Calendar' }, [
									$dl([
										$dd([
											$p({ _textResource: 'InvitationPanel.SendClientEventLinkText' }),
											$p($button({ _commandName: 'Compose', _commandArgument: 'Event' }, SC.res['InvitationPanel.CalendarTab.OpenButtonText'])),
										])
									]),
								]),
							]),
						]),
						$div({ className: 'JoinInfoPanel' }, [
							$div({ className: 'NoGuestJoinedPanel' }, [
								$h3({ _textResource: 'JoinInfoPanel.NoGuestJoinedPanel.Title' }),
								$p({ _textResource: 'JoinInfoPanel.NoGuestJoinedPanelText' }),
							]),
							$div({ className: 'GuestJoinedPanel' }, [
								$h3({ _textResource: 'JoinInfoPanel.GuestJoinedPanel.Title' }),
								$p({ _textResource: 'JoinInfoPanel.GuestJoinedPanelText' }),
							]),
						]),
						$div({ className: 'ScreenshotPanel', _visible: false }, $div(), $p()),
					]);

					var firstTabItem = $$('.InvitationTabList a').find(function (_) {
						return SC.util.getBooleanResource('InvitationPanel.' + _._commandArgument + 'TabVisible');
					});

					if (firstTabItem) {
						SC.ui.setSelected(firstTabItem, true);
						Array.from($('.InvitationTabContent').childNodes).forEach(function (_) { SC.ui.setSelected(_, _._tabName == firstTabItem._commandArgument); });
					}

					return true;
    	}
});


Here is where the edit was made
Code:
$div({ className: 'InvitationTabContent' }, [
								$div({ className: 'CodeTab', _tabName: 'Code' }, [
									$h3(extensionContext.settingValues.SessionURL),

I also added the setting to the manifest.xml.

The part that had to be removed was:
Code:
$dl({ className: 'EditSessionPanel' }, [
							createEditableFieldProc('Name', function (s) { return s.Name; }),
							SC.util.getVisibleCustomPropertyIndices(eventArgs.sessionType)
								.map(function (index) { return createEditableFieldProc(SC.util.getCustomPropertyName(index), createCustomPropertyGetFunc(index)); }),
						]),

This was also above the InvitationPanel div. I also went through each line of this section to see what was causing the issue and it looks like the single $dl line was causing it.


Any help on this would be greatly appreciated.

Thanks.
Ben B  
#2 Posted : Friday, November 3, 2017 6:49:24 PM(UTC)
Ben B


Rank: Administration

Medals: Level 2: Lent a Helping Hand! 10 Thanks!

Joined: 10/2/2015(UTC)
Posts: 281

Thanks: 1 times
Was thanked: 58 time(s) in 54 post(s)
I suggest creating a custom extension with the following Manifest.xml and Initializer.js files to achieve what you're asking:

Manifest.xml:
Code:

<?xml version="1.0" encoding="utf-8"?>
<ExtensionManifest>
	<Version>1.0</Version>
	<Name>Override Code Tab URL</Name>
	<Author>Custom Extension</Author>
	<ShortDescription>Override the URL displayed in the code tab on support sessions</ShortDescription>
	<Components>
		<ClientScriptInitializer SourceFile="Initializer.js" />
	</Components>
	<Settings>
		<Setting Name="UrlToDisplayInCodeTab" IsServerOnly="false">
			<Description>URL to display in the code tab on support sessions</Description>
			<DefaultValue></DefaultValue>
		</Setting>
	</Settings>
</ExtensionManifest>


Initializer.js:
Code:

SC.event.addGlobalHandler(SC.event.InitializeTab, function (eventArgs) {
	var sessionType = eventArgs.sessionType;
	
	if (sessionType == SC.types.SessionType.Support && $('.CodeTab')) {
		if ($('.CodeTab').childNodes.length > 2)
			$('.CodeTab').childNodes[2].innerHTML = extensionContext.settingValues.UrlToDisplayInCodeTab;
	}
});


A Control admin can then set the UrlToDisplayInCodeTab setting value to whatever URL they want, e.g. thebestsupport.thebestcompany.com:

UserPostedImage
ScreenConnect Team
dball  
#3 Posted : Friday, November 3, 2017 6:58:22 PM(UTC)
dball


Rank: Guest

Joined: 10/5/2017(UTC)
Posts: 4
United States
Location: Maryland

Was thanked: 1 time(s) in 1 post(s)
Thanks Ben. I knew there had to be a simpler way for this.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.