Changeset 31537 for main/trunk/greenstone3/web/interfaces/default
- Timestamp:
- 2017-03-24T21:37:12+13:00 (7 years ago)
- Location:
- main/trunk/greenstone3/web/interfaces/default
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js
r31529 r31537 422 422 } 423 423 424 function callMetadataServer(callingFunction, url, responseFunction) 424 // No function overloading in JavaScript. Can pass a custom object, however, see 425 // http://stackoverflow.com/questions/456177/function-overloading-in-javascript-best-practices 426 function callMetadataServer(callingFunction, url, responseFunction, opts) 425 427 { 426 428 var async_setting = true; // Internal processing of 'read' operations (get meta) is not order dependent … … 445 447 } // otherwise, such as for get- metadata operation, we proceed as before, which will not require authentication 446 448 449 if (opts != null && opts["forceSync"] != null) { 450 async_setting = (!opts["forceSync"]); 451 } 452 453 console.log("Away to call: " + url); 454 var ajaxResponse = null; 447 455 448 456 $.ajax(url, {async: async_setting}) … … 451 459 console.log("(" + callingFunction + ") Response received from server: " + response); 452 460 461 ajaxResponse = response; 462 453 463 //var xml = $.parseXML(response); 454 464 //console.log(xml); … … 456 466 if(responseFunction != null) 457 467 { 458 responseFunction(response); 468 469 responseFunction(response); 459 470 } 460 471 }) … … 463 474 console.log("(" + callingFunction + ") Failed"); 464 475 }); 476 477 console.log("Finished ajax call to: " + url); 478 479 console.log("Got response: " + ajaxResponse); 480 return ajaxResponse; 465 481 } 466 482 … … 513 529 } 514 530 531 // New. Modified version of the GS2 version of this method in gsajaxapi.js. 532 // The where parameter can be specified as one or more of: import, archives, index, live 533 // separated by |. If null, it is assumed to be index which is the original default 534 // behaviour of calling set-metadata-array. E.g. where=import|archives|index 535 // THIS METHOD IS SYNCHRONOUS 536 gs.functions.setMetadataArray = function(collection, site, docArray, metamode, where, responseFunction) 537 { 538 docArrayJSON = JSON.stringify(docArray); 539 540 var params = "a=" + escape("set-metadata-array"); //"a=set-metadata-array"; 541 if(where != null) { 542 params += "&where=" + escape(where); // if where not specified, meta-server will default to setting index meta 543 //} else { 544 // params += "&where=import|archives|index"; 545 } 546 params += "&c="+escape(collection); 547 params += "&site="+escape(site); 548 params += "&json="+escape(docArrayJSON); 549 550 if (metamode!=null) { 551 params += "&metamode=" + escape(metamode); 552 } 553 554 555 var response = callMetadataServer("Setting metadata in "+where, "cgi-bin/metadata-server.pl?"+params, responseFunction); 556 557 return response; 558 // return this.urlPostSync(mdserver,params); // gsajaxapi.js version for GS2 559 } 560 561 515 562 /************************* 516 563 * GET METADATA FUNCTIONS * 517 564 *************************/ 518 565 566 // New. Modified version of the GS2 version of this method in gsajaxapi.js. 567 // See description for setMetadataArray above for information about the 'where' parameter. 568 // THIS METHOD IS SYNCHRONOUS BY DEFAULT. Set forceSync to false to override this default behaviour 569 gs.functions.getMetadataArray = function(collection, site, docArray, where, forceSync, responseFunction) 570 { 571 docArrayJSON = JSON.stringify(docArray); 572 573 var params = "a=" + escape("get-metadata-array"); //"a=set-metadata-array"; 574 if(where != null) { 575 params += "&where=" + escape(where); // if where not specified, meta-server will default to setting index meta 576 //} else { 577 // params += "&where=import|archives|index"; 578 } 579 params += "&c="+escape(collection); 580 params += "&site="+escape(site); 581 params += "&json="+escape(docArrayJSON); 582 583 // get operations are generally asynchronous, but allow calling function to force ajax call 584 // to be synchronous or not. Default is synchronous, as it was for GS2 585 if(forceSync == null) { 586 forceSync = true; 587 } 588 // Objects/maps can use identifiers or strings for property names 589 // http://stackoverflow.com/questions/456177/function-overloading-in-javascript-best-practices 590 // https://www.w3schools.com/js/js_objects.asp 591 var response = callMetadataServer("Getting metadata from "+where, "cgi-bin/metadata-server.pl?"+params, responseFunction, {"forceSync":forceSync}); 592 593 return response; 594 //return this.urlPostSync(mdserver,params); // gsajaxapi.js version for GS2 595 } 596 597 519 598 gs.functions.getImportMetadata = function(collection, site, documentID, metadataName, responseFunction) 520 599 { -
main/trunk/greenstone3/web/interfaces/default/style/core.css
r31530 r31537 1240 1240 } 1241 1241 1242 /* User comments area: display of existing user comments and display of the form and of the add user/logout links */ 1243 1244 #usercomments, #usercommentform, #usercommentlink a, #usercommentlogoutlink a { 1245 font-family: sans-serif; 1246 font-size: 12px; 1247 } 1248 1249 #usercomments { 1250 margin: 10px 0; 1251 } 1252 1253 .usercommentheading { 1254 font-weight: bold; 1255 color: #006666; 1256 border-top: solid 1px black; 1257 } 1258 1259 .usercomment { 1260 margin: 10px 0; 1261 } 1262 1263 #usercommentlink, #usercommentlogoutlink { 1264 margin: 10px 0 20px 0; 1265 } 1266 1267 #usercommentlink a, #usercommentlogoutlink a { 1268 text-decoration: none; 1269 font-weight: bold; 1270 color: #006666; 1271 } 1272 #usercommentlink a:visited, #usercommentlogoutlink a:visited { 1273 color: #006666; 1274 } 1275 1276 .centrediv { 1277 width:50%; 1278 margin: 0 auto; 1279 } -
main/trunk/greenstone3/web/interfaces/default/transform/config_format.xsl
r31179 r31537 110 110 when the XSLT processes it (which would then result in it 111 111 being changed into a self-closing element, which then is 112 incorrectly rendered as HTML). Doing thi ngwith the112 incorrectly rendered as HTML). Doing this with the 113 113 value-of is better then injecting an xsl:comment in 114 114 (another approach we have used in the past) as the … … 116 116 HTML. This can lead to further complications if 117 117 Javascript using the 'empty' div truely expects it to 118 have no con nent of any form.118 have no content of any form. 119 119 --> 120 120 -
main/trunk/greenstone3/web/interfaces/default/transform/layouts/header.xsl
r31399 r31537 409 409 410 410 </xsl:template> 411 411 412 <xsl:template name="generateLoginURL"> 412 413 <xsl:value-of select="$library_name"/> … … 431 432 </xsl:for-each> 432 433 434 </xsl:template> 435 436 <!-- Writing the reverse of generateLoginURL since the toggleUserMenuScript does a lot more than I want. --> 437 <!-- https://www.w3schools.com/xml/xsl_functions.asp#string --> 438 <xsl:template name="generateLogoutURL"> 439 440 <xsl:variable name="url" select="/page/pageRequest/@fullURL"/> 441 <xsl:variable name="tmpURL" select="substring-before($url, '&amp;logout=')"/> 442 <xsl:variable name="beforeHash" select="substring-before($url, '#')"/> 443 <xsl:variable name="afterHash" select="substring-after($url, '#')"/> 444 <!-- Get rid of any lingering &logout= already in the URL. 445 Can't use fn:replace() as it's only been defined since XSLT 2.0. We use XSLT 1.x --> 446 <xsl:variable name="fullURL"> 447 <xsl:choose> 448 <xsl:when test="$tmpURL != ''"><xsl:value-of select="$tmpURL" /></xsl:when> 449 <xsl:otherwise><xsl:value-of select="$url" /></xsl:otherwise> 450 </xsl:choose> 451 </xsl:variable> 452 453 <!-- Output the logout link: the current page's URL (with any lingering logout suffix removed) 454 followed by ?logout= or &logout= followed by any # portion of the current page's URL --> 455 <xsl:choose> 456 <xsl:when test="$beforeHash != ''"><xsl:value-of select="$beforeHash" /></xsl:when> 457 <xsl:otherwise><xsl:value-of select="$fullURL" /></xsl:otherwise> 458 </xsl:choose> 459 <xsl:choose> 460 <xsl:when test="contains($fullURL, '?')"><xsl:text>&logout=</xsl:text></xsl:when> 461 <xsl:otherwise>?logout=</xsl:otherwise> 462 </xsl:choose> 463 <xsl:if test="$afterHash != ''">#<xsl:value-of select="$afterHash" /></xsl:if> 433 464 </xsl:template> 434 465 -
main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl
r31534 r31537 12 12 <xsl:import href="layouts/main.xsl"/> 13 13 <xsl:import href="layouts/toc.xsl"/> 14 15 <!-- templates for adding user comments --> 16 <xsl:import href="layouts/usercomments.xsl"/> 14 17 15 18 <xsl:variable name="bookswitch"> … … 367 370 <xsl:call-template name="documentHeading"/><br/> 368 371 <xsl:call-template name="documentContent"/> 372 <br /><xsl:call-template name="userCommentsSection"/> 369 373 </xsl:when> 370 374 <xsl:otherwise> <!-- display the standard greenstone document -->
Note:
See TracChangeset
for help on using the changeset viewer.