var _imageZoomEnabled = false;
var _linkCellMap = new Array();
var _onCells = new Array();
/* some vars for document editing */
/* if true, will look through all the metadata for the document, and add each namespace into the list of metadata sets. If set to false, will only add in the ones defined in setStaticMetadataSets function (defined below) - override this function to make a custom list of sets */
var dynamic_metadata_set_list = true;
/* if true, will make the editing controls stay visible even on page scrolling */
var keep_editing_controls_visible = true;
/* Here you can choose which save buttons you like. Choose from 'save', 'rebuild', 'saveandrebuild' */
var save_and_rebuild_buttons = ["saveandrebuild"];
var save_button_text = "Save changes";
var rebuild_button_text = "Rebuild";
var save_and_rebuild_button_text = "Save and Rebuild";
/* What kind of metadata element selection do we provide?
plain: just a text input box
fixedlist: a drop down menu with a fixed list of options (provided by the availableMetadataElements list)
autocomplete: a text input box with a list of suggestions to choose from (provided by the availableMetadataElements list). Allows additional input other than the fixed list
*/
var new_metadata_field_input_type = "plain";
/* Metadata elements to be used in the fixedlist/autocomplete options above */
var availableMetadataElements = ["dc.Title", "dc.Subject"];
/********************
* EXPANSION SCRIPTS *
********************/
function getTextForSection(sectionID, callback)
{
if(!callback)
{
console.log("Cannot get text as the callback function is not defined");
}
var template = "";
template += '
Expand document | Collapse document |
");
_linkRow.append(col);
col.addClass("pageSliderCol");
_links[i].cell = col;
var link = $("");
col.append(link);
_links[i].link = link;
var href = $(_links[i]).attr("href");
link.attr("href", href.replace(/\)/, ", 0, true)"));
if(!_linkCellMap[href])
{
_linkCellMap[href] = new Array();
}
_linkCellMap[href].push(_links[i]);
var loadingText = $(" Loading image "); link.append(loadingText); var image = $(""); link.append(image); image.attr("src", gs.imageURLs.loading); _links[i].image = image; var title = $(_links[i]).html(); if(title.search(/^[^ ]+ [^ ]+$/) != -1) { var section = title.replace(/^([^ ]+) [^ ]+$/, "$1"); var page = title.replace(/^[^ ]+ ([^ ]+)$/, "$1"); if(page.search(/^[0-9]+$/) != -1) { title = page; } } _titles.push([title, _links[i]]); col.append($("")); col.append(title); } setUpFilterBox(); startCheckFunction(); } /*********************** * HIGHLIGHTING SCRIPTS * ***********************/ function swapHighlight(imageClicked) { var hlCheckbox = $("#highlightOption"); if(imageClicked) { // toggle the state of the checkbox $(hlCheckbox).prop("checked", !$(hlCheckbox).prop("checked")); } var from; var to; if(hlCheckbox.prop("checked")) { from = "noTermHighlight"; to = "termHighlight"; } else { from = "termHighlight"; to = "noTermHighlight"; } var spans = $("span").each(function() { if($(this).hasClass(from)) { $(this).removeClass(from); $(this).addClass(to); } }); } /************************** * REALISTIC BOOKS SCRIPTS * **************************/ function bookInit() { loadBook(); hideText(); showBook(); swapLinkJavascript(false); } function hideText() { $("#gs-document-text").css("visibility", "hidden"); } function showText() { $("#gs-document-text").css("visibility", "visible"); } function hideBook() { $("#bookDiv, #bookObject, #bookEmbed").css({"visibility": "hidden", "height": "0px"}); } function showBook() { $("#bookDiv, #bookObject, #bookEmbed").css({"visibility": "visible", "height": "600px"}); } function swapLinkJavascript(rbOn) { var option = $("#rbOption"); var optionImage = $("#rbOptionImage"); if(rbOn) { option.attr("onclick", "hideText(); showBook(); swapLinkJavascript(false);"); optionImage.attr("onclick", "hideText(); showBook(); swapLinkJavascript(false);"); $(option).prop("checked", false); } else { option.attr("onclick", "hideBook(); showText(); swapLinkJavascript(true);"); optionImage.attr("onclick", "hideBook(); showText(); swapLinkJavascript(true);"); $(option).prop("checked", true); } } function loadBook() { var doc_url = document.URL; doc_url = doc_url.replace(/(&|\?)book=[a-z]+/gi,''); doc_url += '&book=flashxml'; var img_cover = gs.collectionMetadata.httpPath + '/index/assoc/' + gs.documentMetadata.assocfilepath + '/cover.jpg'; var flash_plug_html = "" flash_plug_html += '\n'; $("#bookdiv").html(flash_plug_html); } /************************ * METADATA EDIT SCRIPTS * ************************/ function addEditMetadataLink(cell) { cell = $(cell); var id = cell.attr("id").substring(6); var metaTable = gs.jqGet("meta" + id); var row = cell.parent(); var newCell = $(" | ", {"style": "font-size:0.7em; padding:0px 10px", "class": "editMetadataButton"});
var linkSpan = $("", {"class": "ui-state-default ui-corner-all", "style": "padding: 2px; float:left;"});
var linkLabel = $("edit metadata");
var linkIcon = $("", {"class": "ui-icon ui-icon-folder-collapsed"});
newCell.linkIcon = linkIcon;
newCell.linkLabel = linkLabel;
var uList = $("
|