Skip to content

Commit

Permalink
Changed forbidden & pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-stastny committed Jan 27, 2015
1 parent bd8b300 commit ec361b5
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 44 deletions.
2 changes: 1 addition & 1 deletion client/src/main/resources/k5client.properties
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ mods.roleTerm.Author=Author
mods.roleTerm.Publisher=Publisher
mods.roleTerm.Translator=Translator
mods.page.partType.NormalPage=
mods.page.partType.normalPage=
mods.page.partType.normalPage=
mods.page.partType.FrontCover=front cover
mods.page.partType.TableOfContents=table of contents
mods.page.partType.Advertisement=advertisement
Expand Down
2 changes: 1 addition & 1 deletion client/src/main/webapp/WEB-INF/viewer.vm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<div class="small info translate_title" data-ctx="all" id="vwr_ctx_metadata" data-key="buttons.showinfo" title="$i18n.buttons.showinfo" onclick="K5.gui.selected.toggleInfo();" >#parse("svg/info.svg")</div>


<div class="small translate_title" data-ctx="all" id="vwr_ctx_share" data-key="buttons.share" title="$i18n.buttons.share" onclick="K5.gui.selected.shares.open();" >#parse("svg/share.svg")</div>
<div class="small translate_title" data-ctx="share" id="vwr_ctx_share" data-key="buttons.share" title="$i18n.buttons.share" onclick="K5.gui.selected.shares.open();" >#parse("svg/share.svg")</div>
<div class="small translate_title" data-ctx="download" id="vwr_ctx_download" data-key="buttons.download" title="$i18n.buttons.download" onclick="K5.gui.selected.download.open();" >#parse("svg/download.svg")</div>

<div class="small translate_title" data-ctx="favorite" data-key="buttons.addtofavorite" title="$i18n.buttons.addtofavorite" onclick="K5.authentication.askForAppendToProfile();" >#parse("svg/addfavorite.svg")</div>
Expand Down
2 changes: 1 addition & 1 deletion client/src/main/webapp/WEB-INF/waiting.vm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="loading spinner">
<div class="loading spinner" style="display:none">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
Expand Down
13 changes: 11 additions & 2 deletions client/src/main/webapp/js/breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,26 @@ K5.eventsHandler.addHandler(function(type, data) {
if ((splitted[0] === "api") && (splitted[1] === "item")) {
var pid = splitted[2];
delayedEvent.pid=pid;
if (K5.initialized) {
if (K5.initialized && K5.i18n.ctx.dictionary) {
K5.gui["breadcrumbs"].refresh(pid);
delayedEvent.enabled = false;
} else {
delayedEvent.enabled = true;
}
}
}
if (type === "i18n/dictionary ") {
if (K5.initialized) {
if ((delayedEvent.enabled) && (K5.api.ctx["item"] && K5.api.ctx["item"][delayedEvent.pid])) {
K5.gui["breadcrumbs"].refresh(delayedEvent.pid);
}
}
}
if (type === "application/init/end") {
if ((delayedEvent.enabled) && (K5.api.ctx["item"] && K5.api.ctx["item"][delayedEvent.pid])) {
if (K5.i18n.ctx.dictionary) {
if ((delayedEvent.enabled) && (K5.api.ctx["item"] && K5.api.ctx["item"][delayedEvent.pid])) {
K5.gui["breadcrumbs"].refresh(delayedEvent.pid);
}
}
}

Expand Down
9 changes: 5 additions & 4 deletions client/src/main/webapp/js/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ function I18N(application){

I18N.prototype= {
ctx:{},
/** tests if given key is present in the context */
isKeyReady: function(keys) {
return lookUpKey(keys, this.ctx);

/** tests if given key is present in the context */
isKeyReady: function(keys) {
return lookUpKey(keys, this.ctx);
},


Expand All @@ -39,7 +40,7 @@ I18N.prototype= {



askForText:function(nm, lang, whenready) {
askForText:function(nm, lang, whenready) {
$.getJSON("texts.vm?text=" + nm+"&lang="+lang, _.bind(function(data) {
if (!K5.i18n.isKeyReady("texts")) {
this.ctx['texts']={};
Expand Down
2 changes: 1 addition & 1 deletion client/src/main/webapp/js/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function _eventProcess(pid) {

//_metadatainit();

K5.gui.selected["disabledDisplay"] = false;
K5.gui.selected["disabledDisplay"] = true;
});

K5.gui["viewers"].forbiddenCheck(viewer.object,okfunc,failfunc);
Expand Down
9 changes: 8 additions & 1 deletion client/src/main/webapp/js/item/ctxbtnsutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ function _ctxbuttonsrefresh(viewer) {
if (jQuery.inArray('all', a) > -1) {
$("#contextbuttons").append($(this).clone());
}


// all context
if (jQuery.inArray('share', a) > -1) {
$("#contextbuttons").append($(this).clone());
}

// only selected
if (jQuery.inArray('selected', a) > -1) {
if (K5.gui.clipboard.isCurrentSelected()) {
Expand All @@ -40,7 +47,7 @@ function _ctxbuttonsrefresh(viewer) {
}

// add to favorites
if (jQuery.inArray('favorite', a) > -1) {
if (jQuery.inArray('favorite', a) > -1 ) {
var addf = false;
if (K5.authentication.profileDisplay != null) {
addf = !K5.authentication.profileDisplay.isCurrentPidInFavorites();
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/webapp/js/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Results.prototype = {
}
},
getDocs: function() {
$('.loading').show();
$('.opacityloading').show();
$.get("raw_results.vm?" + $("#search_form").serialize(), _.bind(function(data) {
//console.log(data);
$('#search_results_docs .more_docs').remove();
Expand All @@ -98,7 +98,7 @@ Results.prototype = {
this.srResize();
K5.eventsHandler.trigger("results/loaded", json);
}
$('.loading').hide();
$('.opacityloading').hide();
this.resultsLoaded = true;
}, this));
},
Expand Down
88 changes: 59 additions & 29 deletions client/src/main/webapp/js/viewers/forbidden.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,44 +30,74 @@ Forbidden.prototype.open = function(rect) {
this.disabledDisplay = true;

K5.i18n.k5translate('#forbidden');

K5.eventsHandler.trigger("application/menu/ctxchanged", null);
}

Forbidden.prototype.clearContainer = function() {
$('#forbidden').remove();
}

Forbidden.prototype.addContextButtons= function() {
$("#contextbuttons").html("");
$("#item_menu>div").each(function() {
if ($(this).data("ctx")) {
var a = $(this).data("ctx").split(";");
if (jQuery.inArray('all', a) > -1 || jQuery.inArray('forbidden', a) > -1) {
$("#contextbuttons").append($(this).clone());
}

if (jQuery.inArray('selected', a) > -1) {
if (K5.gui.clipboard.isCurrentSelected()) {
$("#contextbuttons").append($(this).clone());
}
}
$("#contextbuttons").html("");
$("#item_menu>div")
.each(
function() {
if ($(this).data("ctx")) {
var a = $(this).data("ctx").split(";");
if (viewer) {
if (jQuery.inArray(viewer, a) > -1) {
$("#contextbuttons").append($(this).clone());
}
}

if (jQuery.inArray('notselected', a) > -1) {
if (!K5.gui.clipboard.isCurrentSelected()) {
$("#contextbuttons").append($(this).clone());
}
}
// all context
if (jQuery.inArray('all', a) > -1) {
$("#contextbuttons").append($(this).clone());
}

// only clipboard
if (jQuery.inArray('clipboardnotempty', a) > -1) {
if (K5.gui.clipboard.getSelected().length > 0) {
$("#contextbuttons").append($(this).clone());
}
}
}
});
// next context
if (jQuery.inArray('next', a) > -1) {
if (K5.api.ctx["item"][selected]["siblings"]) {
var data = K5.api.ctx["item"][selected]["siblings"];
var arr = data[0]['siblings'];
var index = _.reduce(arr, function(memo,
value, index) {
return (value.selected) ? index : memo;
}, -1);
if (index < arr.length - 1) {
$("#contextbuttons").append(
$(this).clone());
}
}
}

if (!K5.gui["selected"].hasParent()) {
$("#contextbuttons>div.parent").hide();
}
// prev context
if (jQuery.inArray('prev', a) > -1) {
if (K5.api.ctx["item"][selected]["siblings"]) {
var data = K5.api.ctx["item"][selected]["siblings"];
var arr = data[0]['siblings'];
var index = _.reduce(arr, function(memo,
value, index) {
return (value.selected) ? index : memo;
}, -1);
if (index > 0) {
$("#contextbuttons").append(
$(this).clone());
}
}
}

if (jQuery.inArray('parent', a) > -1) {
var pid = K5.api.ctx["item"]["selected"];
var data = K5.api.ctx["item"][pid];
var itemContext = data.context[0]; // jinak?
if (itemContext.length > 1) {
$("#contextbuttons").append($(this).clone());
}
}
}
});
}

Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public static Float ratio(Document document, float percentage,


public static void imageNotAvailable(Document document, TextsService textsService, Provider<Locale> localesProvider, Font font) throws IOException, DocumentException {
String text = textsService.getText("image_not_available",localesProvider.get());
text = text != null ? text : "image_not_available";
String text = textsService.getText("security_fail",localesProvider.get());
text = text != null ? text : "security_fail";
Chunk chunk = new Chunk(text, font);
Paragraph na = new Paragraph();
na.add(chunk);
Expand Down

0 comments on commit ec361b5

Please sign in to comment.