Skip to content

Commit

Permalink
New window page - new option to open URL in lightbox rather than new …
Browse files Browse the repository at this point in the history
…window #758
  • Loading branch information
FayCross committed May 20, 2021
1 parent eb07a2f commit ad4cb87
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 15 deletions.
Expand Up @@ -35,15 +35,12 @@


this.resizeImg = function(firstLoad) {
debugger
var imgMaxW, imgMaxH;
imgMaxW = Math.round($x_pageHolder.width() * 0.55 - 20);
imgMaxH = Math.round($x_pageHolder.height() - 50);
$img.mapster('unbind');
x_scaleImg($img, imgMaxW, imgMaxH, true, firstLoad, false);

debugger

$img.css({
"opacity" :1,
"filter" :'alpha(opacity=100)',
Expand Down Expand Up @@ -88,16 +85,33 @@
}
});

$("#pageContents .newWindowLink").on("click", function() {

if (x_currentPageXML.getAttribute("target") == "lightbox") {
if (x_currentPageXML.getAttribute("htm") != undefined && x_currentPageXML.getAttribute("htm") != "") {
var popupWindow = window.open("", "", "width=" + x_currentPageXML.getAttribute("windowWidth") + ", height=" + x_currentPageXML.getAttribute("windowHeight") + ",scrollbars=1");
popupWindow.document.write(x_currentPageXML.getAttribute("htm"));
popupWindow.focus();
$("#pageContents .newWindowLink").attr({
'data-featherlight': x_currentPageXML.getAttribute("htm"),
'href': '#'
});

} else {
var src = x_currentPageXML.getAttribute("url");
window.open(src, "_blank", "width=" + x_currentPageXML.getAttribute("windowWidth") + ", height=" + x_currentPageXML.getAttribute("windowHeight") + ",scrollbars=1");
$("#pageContents .newWindowLink").attr({
'data-featherlight': 'iframe',
'href': x_currentPageXML.getAttribute("url")
});
}
});

} else {
$("#pageContents .newWindowLink").on("click", function() {
if (x_currentPageXML.getAttribute("htm") != undefined && x_currentPageXML.getAttribute("htm") != "") {
var popupWindow = window.open("", "", "width=" + x_currentPageXML.getAttribute("windowWidth") + ", height=" + x_currentPageXML.getAttribute("windowHeight") + ",scrollbars=1");
popupWindow.document.write(x_currentPageXML.getAttribute("htm"));
popupWindow.focus();
} else {
var src = x_currentPageXML.getAttribute("url");
window.open(src, "_blank", "width=" + x_currentPageXML.getAttribute("windowWidth") + ", height=" + x_currentPageXML.getAttribute("windowHeight") + ",scrollbars=1");
}
});
}
}
}

Expand Down
12 changes: 10 additions & 2 deletions modules/xerte/parent_templates/Nottingham/wizards/en-GB/data.xwd
Expand Up @@ -184,7 +184,7 @@
copypasteinfo="Note: Click the 'Select Text' button to highlight the text on the right and then Ctrl + C to copy this text to the clipboard. You can then paste (Ctrl + V) into another application such as Open Office, Word or an email to save for future reference."
>Enter text for the page here</modelAnswerResults>]]></modelAnswerResults><modify><![CDATA[<modify name="Enter Page Title" instruction="Provide instructions here" text="Provide initial text here" prompt="Provide a prompt here" answer="Provide a model answer here"
answerHeaderTxt="Write your answer here:" feedbackBtnTxt="Feedback" answerFieldLabel="Answer"
/>]]></modify><morphImages><![CDATA[<morphImages name="Enter Page Title" text="Enter Page Text" url="Select Image" tip1="Enter a Description for Accessibility" url2="Select Image" tip2="Enter a Description for Accessibility" zoomSpeed="3" buttonLabel="Zoom"><hotspot name="Zoom Region" x="0" y="0" w="100" h="100" /></morphImages>]]></morphImages><nav><![CDATA[<nav name="Enter Page Title" text="Enter text for the page here" type="Tab" nextBtnTip="Next" prevBtnTip="Previous" slideCount="Slide {i} of {n}"/>]]></nav><newWindow><![CDATA[<newWindow name="Enter Page Title" text="Enter text for the page" url="Enter a URL to launch" descrip="Enter link text" previewImage="Select a preview image" tip="Enter a Description for Accessibility" windowWidth="550" windowHeight="400"/>]]></newWindow><opinion><![CDATA[<opinion name="Enter Page Title" order="sequence" align="left" panelWidth="Medium" instructions="Enter Instruction" showfeedback="true" feedback="Provide feedback here"
/>]]></modify><morphImages><![CDATA[<morphImages name="Enter Page Title" text="Enter Page Text" url="Select Image" tip1="Enter a Description for Accessibility" url2="Select Image" tip2="Enter a Description for Accessibility" zoomSpeed="3" buttonLabel="Zoom"><hotspot name="Zoom Region" x="0" y="0" w="100" h="100" /></morphImages>]]></morphImages><nav><![CDATA[<nav name="Enter Page Title" text="Enter text for the page here" type="Tab" nextBtnTip="Next" prevBtnTip="Previous" slideCount="Slide {i} of {n}"/>]]></nav><newWindow><![CDATA[<newWindow name="Enter Page Title" text="Enter text for the page" url="Enter a URL to launch" descrip="Enter link text" target="new" previewImage="Select a preview image" tip="Enter a Description for Accessibility" windowWidth="550" windowHeight="400"/>]]></newWindow><opinion><![CDATA[<opinion name="Enter Page Title" order="sequence" align="left" panelWidth="Medium" instructions="Enter Instruction" showfeedback="true" feedback="Provide feedback here"
quesCount="Question {i} of {n}"
onCompletion="You have completed the questionnaire" score="You answered {i} / {n}"
submitBtnText="Submit"
Expand Down Expand Up @@ -1604,7 +1604,13 @@
<lightboxCaption type="ComboBox" label="Caption" defaultValue="false" optional="true" options="None,Below Image,Above Image" data="false,below,above" tooltip="Add a caption to lightbox images on this page. The caption text is taken from the 'Description' or 'Alt Text' fields."/>
</lightboxGroup></connectorMenu><cMenuListedPage menuItem="Item" remove="true" icon="icBullet">
<name label="Title" type="TextInput" wysiwyg="true"/>
<pageID label="Destination Page" type="pageList" defaultValue=""/>
<pageID label="Destination Page" type="pageList" defaultValue="" optional="true"/>

<externalGroup type="group" label="External URL" optional="true" tooltip="Open another web page when menu button is clicked">
<externalURL label="External URL" type="TextInput" wysiwyg="false" optional="true"/>
<externalTarget label="Open In" options="This Window,New Window,Lightbox" type="ComboBox" data="this,new,lightbox" defaultValue="this" width="380" optional="true"/>
</externalGroup>

<checkIfVisited label="Check if Visited Page" type="pageList" defaultValue="" optional="true"/>
<btnTxt label="Use Title on Button" type="CheckBox" defaultValue="false" mandatory="true" tooltip="By default the text on the menu button will be the destination page title. Check this box to use the title text from the field above instead."/>
</cMenuListedPage><crossword menu="Games" icon="icCrossword" menuItem="Crossword" hint="A crossword is a word puzzle that usually takes the form of a square or a rectangular grid of white- and black-shaded squares. The game's goal is to fill the white squares with letters, forming words or phrases, by solving clues, which lead to the answers." thumb="thumbs/crossword.jpg" remove="true">
Expand Down Expand Up @@ -4775,6 +4781,8 @@
<descrip label="Text" type="TextInput"/>
</link>

<target label="Open In" options="New Window,Lightbox" type="ComboBox" data="new,lightbox" defaultValue="new" mandatory="true"/>

<image type="group" label="Preview Image">
<previewImage label="File" type="media"/>
<tip label="Description" type="TextInput"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Nottingham/wizards/en-GB/newWindow.xwd
@@ -1 +1 @@
<wizard menus="Links / Feeds"> <pageWizard remove="true" duplicate="false"> <newNodes> <newWindow><![CDATA[<newWindow name="Enter Page Title" text="Enter text for the page" url="Enter a URL to launch" descrip="Enter link text" previewImage="Select a preview image" tip="Enter a Description for Accessibility" windowWidth="550" windowHeight="400"/>]]></newWindow> </newNodes> </pageWizard> <!-- NEW WINDOW=================== --> <newWindow menu="Links / Feeds" menuItem="New Window" hint="Allow the user to launch a new window to a URL." icon="icApplication" thumb="thumbs/newWindow.jpg" example="https://xot.xerte.org.uk/play_116?hide=bottom#newwindow" remove="true"> <name label="Page Title" type="TextInput" wysiwyg="true"/> <text label="Page Text" type="TextArea" height="150"/> <link type="group" label="Link"> <url label="URL" type="TextInput"/> <descrip label="Text" type="TextInput"/> </link> <image type="group" label="Preview Image"> <previewImage label="File" type="media"/> <tip label="Description" type="TextInput"/> </image> <window type="group" label="Window"> <windowWidth label="Width" type="NumericStepper" min="100" max="980" step="10" defaultValue="550" width="100"/> <windowHeight label="Height" type="NumericStepper" min="100" max="720" step="10" defaultValue="400" width="100"/> </window> <htm label="HTML" type="textArea" height="150" optional="true" tooltip="Create your own content to open in the new window"/> </newWindow></wizard>
<wizard menus="Links / Feeds"> <pageWizard remove="true" duplicate="false"> <newNodes> <newWindow><![CDATA[<newWindow name="Enter Page Title" text="Enter text for the page" url="Enter a URL to launch" descrip="Enter link text" target="new" previewImage="Select a preview image" tip="Enter a Description for Accessibility" windowWidth="550" windowHeight="400"/>]]></newWindow> </newNodes> </pageWizard> <!-- NEW WINDOW=================== --> <newWindow menu="Links / Feeds" menuItem="New Window" hint="Allow the user to launch a new window to a URL." icon="icApplication" thumb="thumbs/newWindow.jpg" example="https://xot.xerte.org.uk/play_116?hide=bottom#newwindow" remove="true"> <name label="Page Title" type="TextInput" wysiwyg="true"/> <text label="Page Text" type="TextArea" height="150"/> <link type="group" label="Link"> <url label="URL" type="TextInput"/> <descrip label="Text" type="TextInput"/> </link> <target label="Open In" options="New Window,Lightbox" type="ComboBox" data="new,lightbox" defaultValue="new" mandatory="true"/> <image type="group" label="Preview Image"> <previewImage label="File" type="media"/> <tip label="Description" type="TextInput"/> </image> <window type="group" label="Window"> <windowWidth label="Width" type="NumericStepper" min="100" max="980" step="10" defaultValue="550" width="100"/> <windowHeight label="Height" type="NumericStepper" min="100" max="720" step="10" defaultValue="400" width="100"/> </window> <htm label="HTML" type="textArea" height="150" optional="true" tooltip="Create your own content to open in the new window"/> </newWindow></wizard>
Expand Down
12 changes: 10 additions & 2 deletions src/Nottingham/wizards/en-GB/template.xwd
Expand Up @@ -184,7 +184,7 @@
copypasteinfo="Note: Click the 'Select Text' button to highlight the text on the right and then Ctrl + C to copy this text to the clipboard. You can then paste (Ctrl + V) into another application such as Open Office, Word or an email to save for future reference."
>Enter text for the page here</modelAnswerResults>]]></modelAnswerResults><modify><![CDATA[<modify name="Enter Page Title" instruction="Provide instructions here" text="Provide initial text here" prompt="Provide a prompt here" answer="Provide a model answer here"
answerHeaderTxt="Write your answer here:" feedbackBtnTxt="Feedback" answerFieldLabel="Answer"
/>]]></modify><morphImages><![CDATA[<morphImages name="Enter Page Title" text="Enter Page Text" url="Select Image" tip1="Enter a Description for Accessibility" url2="Select Image" tip2="Enter a Description for Accessibility" zoomSpeed="3" buttonLabel="Zoom"><hotspot name="Zoom Region" x="0" y="0" w="100" h="100" /></morphImages>]]></morphImages><nav><![CDATA[<nav name="Enter Page Title" text="Enter text for the page here" type="Tab" nextBtnTip="Next" prevBtnTip="Previous" slideCount="Slide {i} of {n}"/>]]></nav><newWindow><![CDATA[<newWindow name="Enter Page Title" text="Enter text for the page" url="Enter a URL to launch" descrip="Enter link text" previewImage="Select a preview image" tip="Enter a Description for Accessibility" windowWidth="550" windowHeight="400"/>]]></newWindow><opinion><![CDATA[<opinion name="Enter Page Title" order="sequence" align="left" panelWidth="Medium" instructions="Enter Instruction" showfeedback="true" feedback="Provide feedback here"
/>]]></modify><morphImages><![CDATA[<morphImages name="Enter Page Title" text="Enter Page Text" url="Select Image" tip1="Enter a Description for Accessibility" url2="Select Image" tip2="Enter a Description for Accessibility" zoomSpeed="3" buttonLabel="Zoom"><hotspot name="Zoom Region" x="0" y="0" w="100" h="100" /></morphImages>]]></morphImages><nav><![CDATA[<nav name="Enter Page Title" text="Enter text for the page here" type="Tab" nextBtnTip="Next" prevBtnTip="Previous" slideCount="Slide {i} of {n}"/>]]></nav><newWindow><![CDATA[<newWindow name="Enter Page Title" text="Enter text for the page" url="Enter a URL to launch" descrip="Enter link text" target="new" previewImage="Select a preview image" tip="Enter a Description for Accessibility" windowWidth="550" windowHeight="400"/>]]></newWindow><opinion><![CDATA[<opinion name="Enter Page Title" order="sequence" align="left" panelWidth="Medium" instructions="Enter Instruction" showfeedback="true" feedback="Provide feedback here"
quesCount="Question {i} of {n}"
onCompletion="You have completed the questionnaire" score="You answered {i} / {n}"
submitBtnText="Submit"
Expand Down Expand Up @@ -1604,7 +1604,13 @@
<lightboxCaption type="ComboBox" label="Caption" defaultValue="false" optional="true" options="None,Below Image,Above Image" data="false,below,above" tooltip="Add a caption to lightbox images on this page. The caption text is taken from the 'Description' or 'Alt Text' fields."/>
</lightboxGroup></connectorMenu><cMenuListedPage menuItem="Item" remove="true" icon="icBullet">
<name label="Title" type="TextInput" wysiwyg="true"/>
<pageID label="Destination Page" type="pageList" defaultValue=""/>
<pageID label="Destination Page" type="pageList" defaultValue="" optional="true"/>

<externalGroup type="group" label="External URL" optional="true" tooltip="Open another web page when menu button is clicked">
<externalURL label="External URL" type="TextInput" wysiwyg="false" optional="true"/>
<externalTarget label="Open In" options="This Window,New Window,Lightbox" type="ComboBox" data="this,new,lightbox" defaultValue="this" width="380" optional="true"/>
</externalGroup>

<checkIfVisited label="Check if Visited Page" type="pageList" defaultValue="" optional="true"/>
<btnTxt label="Use Title on Button" type="CheckBox" defaultValue="false" mandatory="true" tooltip="By default the text on the menu button will be the destination page title. Check this box to use the title text from the field above instead."/>
</cMenuListedPage><crossword menu="Games" icon="icCrossword" menuItem="Crossword" hint="A crossword is a word puzzle that usually takes the form of a square or a rectangular grid of white- and black-shaded squares. The game's goal is to fill the white squares with letters, forming words or phrases, by solving clues, which lead to the answers." thumb="thumbs/crossword.jpg" remove="true">
Expand Down Expand Up @@ -4775,6 +4781,8 @@
<descrip label="Text" type="TextInput"/>
</link>

<target label="Open In" options="New Window,Lightbox" type="ComboBox" data="new,lightbox" defaultValue="new" mandatory="true"/>

<image type="group" label="Preview Image">
<previewImage label="File" type="media"/>
<tip label="Description" type="TextInput"/>
Expand Down

0 comments on commit ad4cb87

Please sign in to comment.