Changeset 32298 for main/trunk/greenstone3/web/interfaces
- Timestamp:
- 2018-07-23T13:59:46+12:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/berrybasket/berrycheckout.js
r30822 r32298 1 // The default link type in the basket - "document" = greenstone version of the document, "source" = link to source file eg pdf. 2 var default_link_type = "document"; // "source" or "document" 3 // use the appropriate one of these to override the default for particular collections. 4 var source_link_collections = new Array(); // or add list of collections like ["pdfberry", "mgppdemo"]; 5 var document_link_collections = new Array(); // or add list of collections as above. 6 1 7 var docList = new Array(); 2 8 var urlonly = false; … … 9 15 var mailwin; 10 16 11 var options = new Array(3); 12 options[0] = 'fullview'; 13 options[1] = 'textview'; 14 options[2] = 'email'; 17 var options = ['fullview', 'textview', 'email']; 15 18 16 19 function navigate(e){ … … 148 151 img.setAttribute("width", "15px"); 149 152 li.appendChild(img); 150 151 a.href =gs.xsltParams.library_name + "?a=d&c="+doc['collection']+"&d="+doc['name']; 152 153 154 a.href=generateURL(doc); 153 155 a.appendChild(document.createTextNode(doc['title'])); 154 156 if (doc['root_title'] != ""){ … … 357 359 } 358 360 361 function getDefaultLinkType(collection) { 362 var link_type; 363 if (document_link_collections.includes(collection)) { 364 link_type = "document"; 365 } else if (source_link_collections.includes(collection)) { 366 link_type = "source"; 367 } 368 else { 369 link_type = default_link_type; 370 if (link_type != "source" && link_type != "document") { 371 link_type = "document"; //the default default 372 } 373 } 374 return link_type; 375 } 376 377 function generateURL(doc) { 378 379 var url; 380 var doc_url = document.URL; 381 var root_url = doc_url.substring(0,doc_url.indexOf('?')); 382 383 var link_type = getDefaultLinkType(doc["collection"]); 384 if (link_type == "document") { 385 url = root_url+"?a=d&c="+doc["collection"]+"&d="+doc["name"]; 386 } else if (link_type == "source") { 387 // remove library 388 root_url = root_url.substring(0, root_url.lastIndexOf('/')); 389 url = root_url+"/sites/"+gs.xsltParams.site_name+"/collect/"+doc['collection']+"/index/assoc/"+doc["assocfilepath"]+"/"+doc["srclinkFile"]; 390 } 391 return url; 392 } 393 394 359 395 function populateUrls(parea){ 360 396 361 397 var urls=""; 362 var doc_url = document.URL;363 var root_url = doc_url.substring(0,doc_url.indexOf('?'));364 365 398 for (var i in docList){ 366 367 urls +=root_url+"?a=d&c="+doc["collection"]+"&d="+doc["name"]+"\n\n";399 var doc = docList[i]; 400 urls += generateURL(doc)+"\n\n"; 368 401 } 369 402 … … 374 407 function populateUrlsAndMetadata(parea){ 375 408 376 var doc_url = document.URL;377 var root_url = doc_url.substring(0,doc_url.indexOf('?'));378 409 var fulltext=""; 379 410 380 411 for (var i in docList){ 381 var doc = docList[i]; 382 var url =root_url+"?a=d&c="+doc['collection']+"&d="+doc['name']+"\n"; 383 var metadata = ""; 412 var doc = docList[i]; 413 var url = generateURL(doc)+"\n"; 414 415 var metadata = ""; 384 416 if (doc['title']) { 385 417 metadata += gs.text.berry.doc_title+": "+doc['title']+"\n";
Note:
See TracChangeset
for help on using the changeset viewer.