Skip to content

Commit

Permalink
Merge branch 'develop' containing the new version for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
kunzstef committed May 19, 2016
2 parents 57fdbac + ca19358 commit 4b3985b
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 110 deletions.
16 changes: 12 additions & 4 deletions Code.gs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2015 University of Passau
/* Copyright 2016 University of Passau
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -42,6 +42,7 @@ function onInstall(e) {
*/
function showSidebar() {
var ui = HtmlService.createTemplateFromFile('Sidebar').evaluate()
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setTitle('E-Explorer');
DocumentApp.getUi().showSidebar(ui);
}
Expand All @@ -52,7 +53,9 @@ function showSidebar() {
* @return {string} The file's content.
*/
function include(file) {
return HtmlService.createTemplateFromFile(file).evaluate().getContent();
return HtmlService.createTemplateFromFile(file).evaluate()
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.getContent();
}

/**
Expand Down Expand Up @@ -194,8 +197,13 @@ var defaultMessages;
*/
function msg(key) {
if (!messages){
messages = JSON.parse(HtmlService.createTemplateFromFile('messages_' + getLocale()).evaluate().getContent());
defaultMessages = JSON.parse(HtmlService.createTemplateFromFile('messages_' + DEFAULT_LOCALE).evaluate().getContent());
messages = JSON.parse(
HtmlService.createTemplateFromFile('messages_' + getLocale()).evaluate()
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.getContent());
defaultMessages = JSON.parse(HtmlService.createTemplateFromFile('messages_' + DEFAULT_LOCALE).evaluate()
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.getContent());
}

var msg = messages[key];
Expand Down
8 changes: 8 additions & 0 deletions Help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
![EEXCESS](http://eexcess.eu/wp-content/uploads/2013/04/eexcess_Logo_neu1.jpg "EEXCESS")

# Troubleshooting
In case the menu only shows "E-Explorer->Help" and "Start" is missing, do the following:

- click on "Addons->Manage Add-ons"
- Select E-Explorer and "Use in this document"
- RELOAD the document in the browser
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ The add-on installation is tied to your Google Account, so it works in all your
3. Select a piece of text or use the search bar to search for recommendations. After a short while the recommendations will be displayed in the sidebar.
4. To submit multiple words as one keyword surround them with "

## Troubleshooting
In case the menu only shows "E-Explorer->Help" and "Start" is missing, do the following:

- click on "Addons->Manage Add-ons"
- Select E-Explorer and "Activate for this document"
- RELOAD the document in the browser

## Source Code

The source code can be found (and edited) directly inside the browser. If you want to do this, you have to open the Script Editor (Top Menu: Tools -> Script Editor).
Expand Down
12 changes: 6 additions & 6 deletions SearchResultList.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

// messages
this._messages = $('<div id="messages"></div>');
this._loader = $('<img id="ajax-loader" src="http://www.dimis.fim.uni-passau.de/eexcess/ajax-loader.gif" alt="<?!= msg('LOADING') ?>" />');
this._loader = $('<img id="ajax-loader" src="https://www.dimis.fim.uni-passau.de/eexcess/ajax-loader.gif" alt="<?!= msg('LOADING') ?>" />');
this._error = $('<span id="error-msg" class="error"></span>');
this._info = $('<span id="info-msg"></span>');

Expand Down Expand Up @@ -179,7 +179,7 @@
// insert link buttons
var insertAsLinkButton = $(
'<div class="image-button">' +
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_LINK') ?>" src="http://www.dimis.fim.uni-passau.de/eexcess/link.png">' +
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_LINK') ?>" src="https://www.dimis.fim.uni-passau.de/eexcess/link.png">' +
'</div>');
insertAsLinkButton.data('displayName', title);
insertAsLinkButton.data('documentBadge', item.documentBadge);
Expand All @@ -202,12 +202,12 @@
if (typeof image === 'undefined' || image === '') {
image = previewImageUrl + mediaType;
} else { // add item to image gallery and insert button
this._addImageToGallery(image, title, item.documentBadge);
this._addImageToGallery(image, title, item.documentBadge, queryID);

// insert image button
var insertImageButton = $(
'<div class="image-button result-btn-insert-image">' +
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_IMAGE') ?>" src="http://www.dimis.fim.uni-passau.de/eexcess/photo.png">' +
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_IMAGE') ?>" src="https://www.dimis.fim.uni-passau.de/eexcess/photo.png">' +
'</div>');
insertImageButton.data('image', image);
insertImageButton.data('documentBadge', item.documentBadge);
Expand Down Expand Up @@ -322,7 +322,7 @@
* @param title recommendation's title
* @param documentBadge recommendation's document badge
*/
SearchResultList.prototype._addImageToGallery = function(image, title, documentBadge) {
SearchResultList.prototype._addImageToGallery = function(image, title, documentBadge, queryID) {
var uri = documentBadge.uri;
var div = $('<div class="gallery-item"></div>');

Expand All @@ -349,7 +349,7 @@
// add insert button
var insertButton = $(
'<div class="image-button gallery-btn-insert-image">' +
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_IMAGE') ?>" src="http://www.dimis.fim.uni-passau.de/eexcess/photo.png">' +
'<img title="<?!= msg('SEARCH_RESULT_LIST_INSERT_IMAGE') ?>" src="https://www.dimis.fim.uni-passau.de/eexcess/photo.png">' +
'</div>');
insertButton.data('image', image);
insertButton.data('documentBadge', documentBadge);
Expand Down
181 changes: 94 additions & 87 deletions SettingsDialog.html
Original file line number Diff line number Diff line change
@@ -1,53 +1,58 @@
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css">
<!-- The CSS package above applies Google styling to buttons and other elements. -->

<style>
.settings-label {
font-size: 1.1em;
margin-bottom: 10px;
}

#input-result-number {
margin-right: 5px;
width: 60px;
}
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css">
<!-- The CSS package above applies Google styling to buttons and other elements. -->

<style>
.settings-label {
font-size: 1.1em;
margin-bottom: 10px;
}

.provider-settings {
position: absolute;
top: 83px;
right: 8px;
left: 8px;
width: auto;
}
#input-result-number {
margin-right: 5px;
width: 60px;
}

#ajax-loader {
width: 16px;
height: 16px;
margin-left: auto;
margin-right: auto;
display: block;
padding: 10px;
}
.provider-settings {
position: absolute;
top: 83px;
right: 8px;
left: 8px;
width: auto;
}

#providers {
position: absolute;
top: 111px;
bottom: 67px;
overflow-y: auto;
left: 8px;
right: 8px;
overflow-x: hidden;
}
#ajax-loader {
width: 16px;
height: 16px;
margin-left: auto;
margin-right: auto;
display: block;
padding: 10px;
}

.settings-buttons {
position: absolute;
bottom: 8px;
left: 8px;
height: 29px;
right: 8px;
}
</style>
#providers {
position: absolute;
top: 111px;
bottom: 67px;
overflow-y: auto;
left: 8px;
right: 8px;
overflow-x: hidden;
}

.settings-buttons {
position: absolute;
bottom: 8px;
left: 8px;
height: 29px;
right: 8px;
}
</style>
</head>
<body>
<div class="modal-dialog-content script-prompt-contents">
<div class="settings-label"><?!= msg('SETTINGS_RESULT_NUM') ?>:</div>
<div>
Expand All @@ -57,7 +62,7 @@

<div class="settings-label provider-settings"><?!= msg('SETTINGS_PROVIDERS') ?>:</div>
<div id="providers">
<img id="ajax-loader" src="http://www.dimis.fim.uni-passau.de/eexcess/ajax-loader.gif" alt="<?!= msg('LOADING') ?>" />
<img id="ajax-loader" src="https://www.dimis.fim.uni-passau.de/eexcess/ajax-loader.gif" alt="<?!= msg('LOADING') ?>" />
</div>
</div>

Expand All @@ -75,46 +80,46 @@
// load settings
google.script.run
.withSuccessHandler(
function (settings) {
try {
settings = JSON.parse(settings);
} catch (e) {
settings = [];
}

$('#ajax-loader').hide();

for (var i = 0; i < settings.length; i++) {
var partner = settings[i];
var div = $('<div></div>');

if (partner.active) {
div.append('<input type="checkbox" id="checkbox' + i + '" checked>');
} else {
div.append('<input type="checkbox" id="checkbox' + i + '">');
}

div.append('<label for="checkbox' + i + '">' + partner.name + '</label>');
$('#providers').append(div);
}
})
function (settings) {
try {
settings = JSON.parse(settings);
} catch (e) {
settings = [];
}

$('#ajax-loader').hide();

for (var i = 0; i < settings.length; i++) {
var partner = settings[i];
var div = $('<div></div>');

if (partner.active) {
div.append('<input type="checkbox" id="checkbox' + i + '" checked>');
} else {
div.append('<input type="checkbox" id="checkbox' + i + '">');
}

div.append('<label for="checkbox' + i + '">' + partner.name + '</label>');
$('#providers').append(div);
}
})
.withFailureHandler(
function (error) {
// ignore errors
alert(error); // TODO rm
})
function (error) {
// ignore errors
alert(error); // TODO rm
})
.getPartnerSettings();

google.script.run
.withSuccessHandler(
function (resultNumber) {
$('#input-result-number').val(resultNumber);
})
function (resultNumber) {
$('#input-result-number').val(resultNumber);
})
.withFailureHandler(
function (error) {
// ignore errors
alert(error); // TODO rm
})
function (error) {
// ignore errors
alert(error); // TODO rm
})
.getResultNumber();

// store settings
Expand Down Expand Up @@ -147,13 +152,13 @@
// make settings persistent on server
google.script.run
.withSuccessHandler(
function () {
google.script.host.close();
})
function () {
google.script.host.close();
})
.withFailureHandler(
function () {
showError('<?!= msg('ERROR') ?>');
})
function () {
showError('<?!= msg('ERROR') ?>');
})
.saveSettings(resultNumber, partnerSettings);
}

Expand All @@ -166,4 +171,6 @@
function hideError() {
$('#result-number-error').hide();
}
</script>
</script>
</body>
</html>
19 changes: 13 additions & 6 deletions Sidebar.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<?!= include('Stylesheet') ?>

<!DOCTYPE html>
<html>
<head>
<base target="_top">
<?!= include('Stylesheet') ?>
</head>
<body>
<div id="header" class="sidebar fixed-top">
<div id="search-container" class="form-group inline-form">
<input id="eexcess-search" placeholder="Search" aria-label="<?!= msg('SEARCHBAR_SEARCH') ?>" type="text" />
<input id="eexcess-search" placeholder="Search" aria-label="<?!= msg('SEARCHBAR_SEARCH') ?>" type="text"/>
<button class="action" id="btn-search"><?!= msg('SEARCHBAR_SEARCH') ?></button>
</div>
<div class="tab-container">
Expand All @@ -21,7 +26,7 @@
</li>
</ul>
<div id="settings-button" class="image-button">
<img title="<?!= msg('SETTINGS') ?>" src="http://www.dimis.fim.uni-passau.de/eexcess/settings.png">
<img title="<?!= msg('SETTINGS') ?>" src="https://www.dimis.fim.uni-passau.de/eexcess/settings.png">
</div>
</div>
</div>
Expand All @@ -32,7 +37,7 @@
<div class="block"></div>
<a href="http://eexcess.eu/" title="EEXCESS" target="_blank">
<div class="branding-container">
<img alt="Add-on logo" class="logo" src="http://dimis.fim.uni-passau.de/eexcess/eexcess_Logo_neu1.jpg">
<img alt="Add-on logo" class="logo" src="https://www.dimis.fim.uni-passau.de/eexcess/eexcess_Logo_neu1.jpg">
</div>
<div class="branding-text">
<span class="gray"><?!= msg('BRANDING_TEXT') ?></span>
Expand All @@ -41,4 +46,6 @@
</div>

<?!= include('SearchResultList') ?>
<?!= include('Scripts') ?>
<?!= include('Scripts') ?>
</body>
</html>

0 comments on commit 4b3985b

Please sign in to comment.