Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions flash/flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class flashXBlock(XBlock):
scope=Scope.content,
help="The URL for your flash file.")

use_popup = Boolean(display_name="Open in Pop Up Window",
default=True,
scope=Scope.content,
help="Display a button to open the flash file in a separate window.")

allow_download = Boolean(display_name="Flash Download Allowed",
default=True,
scope=Scope.content,
Expand Down Expand Up @@ -71,6 +76,7 @@ def student_view(self, context=None):
context = {
'display_name': self.display_name,
'url': self.url,
'use_popup': self.use_popup,
'allow_download': self.allow_download,
'source_text': self.source_text,
'source_url': self.source_url
Expand All @@ -91,6 +97,7 @@ def studio_view(self, context=None):
context = {
'display_name': self.display_name,
'url': self.url,
'use_popup': self.use_popup,
'allow_download': self.allow_download,
'source_text': self.source_text,
'source_url': self.source_url
Expand All @@ -109,6 +116,7 @@ def save_flash(self, data, suffix=''):
"""
self.display_name = data['display_name']
self.url = data['url']
self.use_popup = True if data['use_popup'] == "True" else False # Str to Bool translation
self.allow_download = True if data['allow_download'] == "True" else False # Str to Bool translation
self.source_text = data['source_text']
self.source_url = data['source_url']
Expand Down
11 changes: 11 additions & 0 deletions flash/static/html/flash_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
<span class="tip setting-help">The URL for your flash file.</span>
</li>

<li class="field comp-setting-entry is-set">
<div class="wrapper-comp-setting">
<label class="label setting-label" for="flash_edit_use_popup">Use pop up window</label>
<select class="input setting-input" id="flash_edit_use_popup">
<option value="True" {% if use_popup %}selected{% endif %}>True</option>
<option value="False" {% if not use_popup %}selected{% endif %}>False</option>
</select>
</div>
<span class="tip setting-help">Display a button that will open this Flash file in a separate window.</span>
</li>

<li class="field comp-setting-entry is-set">
<div class="wrapper-comp-setting">
<label class="label setting-label" for="flash_edit_allow_download">Flash Download Allowed</label>
Expand Down
34 changes: 19 additions & 15 deletions flash/static/html/flash_view.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<div class="flash_block">
<h2>{{ display_name }}</h2>
<embed src="{{ url }}" width="100%" height="500" type="application/x-shockwave-flash" allowFullScreen="true" />
{% if allow_download or source_url != "" %}
<ul>
{% if allow_download %}
<li class="flash-download-button">
<a href="{{ url }}" download>Download the Flash file</a>
</li>
{% if use_popup %}
<ul><li class="flash-download-button"><a onclick="newPopup('{{ url }}')">View {{ display_name }}</a></li></ul>
{% else %}
<h2>{{ display_name }}</h2>
<embed src="{{ url }}" width="100%" height="500" type="application/x-shockwave-flash" allowFullScreen="true" />
{% if allow_download or source_url != "" %}
<ul>
{% if allow_download %}
<li class="flash-download-button">
<a href="{{ url }}" download>Download the Flash file</a>
</li>
{% endif %}
{% if source_url != "" %}
<li class="flash-download-button">
<a href="{{ source_url }}" download>{% if source_text == "" %}Download the source document{% else %}{{ source_text }}{% endif %}</a>
</li>
{% endif %}
</ul>
{% endif %}
{% if source_url != "" %}
<li class="flash-download-button">
<a href="{{ source_url }}" download>{% if source_text == "" %}Download the source document{% else %}{{ source_text }}{% endif %}</a>
</li>
{% endif %}
</ul>
{% endif %}
</div>
</div>
3 changes: 2 additions & 1 deletion flash/static/js/flash_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function flashXBlockInitEdit(runtime, element) {
var data = {
'display_name': $('#flash_edit_display_name').val(),
'url': $('#flash_edit_url').val(),
'use_popup': $('#flash_edit_use_popup').val(),
'allow_download': $('#flash_edit_allow_download').val(),
'source_text': $('#flash_edit_source_text').val(),
'source_url': $('#flash_edit_source_url').val()
Expand All @@ -27,4 +28,4 @@ function flashXBlockInitEdit(runtime, element) {
}
});
});
}
}
6 changes: 6 additions & 0 deletions flash/static/js/flash_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ function flashXBlockInitView(runtime, element) {
* So here I make sure element is the jQuery object */
if(element.innerHTML) element = $(element);
}

function newPopup(url) {
popupWindow = window.open(
null,'popUpWindow','left=10,top=10,width=1024,height=600,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
popupWindow.document.write('<embed src="' + url + '" width="100%" height="500" type="application/x-shockwave-flash" allowFullScreen="true" />');
}