Changeset 24948
- Timestamp:
- 2012-01-16T15:02:27+13:00 (12 years ago)
- Location:
- main/trunk/model-cols-dev/peijones
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-cols-dev/peijones/etc/collectionConfig.xml
r24946 r24948 207 207 </script> 208 208 <script text="text/javascript"> 209 209 <xsl:text disable-output-escaping="yes"> 210 210 211 211 var _posCount = 0; … … 243 243 } 244 244 } 245 _posCount--; 245 246 }, 246 247 failed: function(){alert("Failed to delete index metadata of note with id: " + note.id);}, … … 358 359 </script> 359 360 <script text="text/javascript"> 360 361 <xsl:text disable-output-escaping="yes"> 361 362 362 363 function checkLoop(pid, serverFunction, callback) … … 465 466 function saveAndBuildCollection(col) 466 467 { 468 for(var j = 0; j < gs.toDeleteArray.keys.length; j++) 469 { 470 var current = gs.toDeleteArray[gs.toDeleteArray.keys[j]]; 471 if(current == null){continue;} 472 var metaToDelete = ["user", "text", "tags"]; 473 474 for(var l = 0; l < metaToDelete.length; l++) 475 { 476 var deleteArchivesURL = "cgi-bin/metadata-server.pl?\ 477 a=remove-archives-metadata&\ 478 c=" + gs.cgiParams.c + "&\ 479 site=localsite&\ 480 docid=" + gs.cgiParams.d + "&\ 481 metaname=gstext." + metaToDelete[l] + "&\ 482 metavalue=" + ((l == 2) ? (current.user.name) : (current[metaToDelete[l]])); 483 484 var deleteIndexURL = "cgi-bin/metadata-server.pl?\ 485 a=remove-metadata&\ 486 c=" + gs.cgiParams.c + "&\ 487 site=localsite&\ 488 docid=" + gs.cgiParams.d + "&\ 489 metaname=gstext." + metaToDelete[l] + "&\ 490 metavalue=" + ((l == 2) ? (current.user.name) : (current[metaToDelete[l]])); 491 492 var deleteImportURL = "cgi-bin/metadata-server.pl?\ 493 a=remove-import-metadata&\ 494 c=" + gs.cgiParams.c + "&\ 495 site=localsite&\ 496 docid=" + gs.cgiParams.d + "&\ 497 metaname=gstext." + metaToDelete[l] + "&\ 498 metavalue=" + ((l == 2) ? (current.user.name) : (current[metaToDelete[l]])); 499 500 var deleteArchivesCallback = 501 { 502 success:function(){}, 503 failed: function(){alert("Failed to save text annotations index metadata");} 504 } 505 YAHOO.util.Connect.asyncRequest("GET", deleteArchivesURL, deleteArchivesCallback); 506 507 var deleteIndexCallback = 508 { 509 success:function(){}, 510 failed: function(){alert("Failed to save text annotations import metadata");} 511 } 512 YAHOO.util.Connect.asyncRequest("GET", deleteIndexURL, deleteIndexCallback); 513 514 var deleteImportCallback = 515 { 516 success:function(){}, 517 failed: function(){alert("Failed to save text annotations import metadata");} 518 } 519 YAHOO.util.Connect.asyncRequest("GET", deleteImportURL, deleteImportCallback); 520 } 521 } 522 467 523 var json = "["; 468 524 for(var i = 0; i < gs.annotationArray.keys.length; i++) 469 525 { 470 526 var current = gs.annotationArray[gs.annotationArray.keys[i]]; 527 if(current == null){continue;} 471 528 var metaToAdd = ["user", "text", "tags"]; 472 529 … … 481 538 json += '{"docid":"' + gs.cgiParams.d + '", "metaname":"gstext.' + metaToAdd[j] + '", "metavalue":"' + current[metaToAdd[j]] + '"}'; 482 539 } 483 540 484 541 if(j != (metaToAdd.length - 1) || i != (gs.annotationArray.keys.length - 1)) 485 542 { … … 489 546 } 490 547 json += "]"; 491 548 492 549 var saveArchivesURL = "cgi-bin/metadata-server.pl?a=set-archives-metadata-array&c=" + gs.cgiParams.c + "&site=localsite&collect=" + gs.cgiParams.c + "&json=" + json; 493 550 var saveIndexURL = "cgi-bin/metadata-server.pl?a=set-metadata-array&c=" + gs.cgiParams.c + "&site=localsite&collect=" + gs.cgiParams.c + "&json=" + json; 494 var saveImportURL = "cgi-bin/metadata-server.pl?a=set-import-metadata-array&c=" + gs.cgiParams.c + "&site=localsite&collect=" + gs.cgiParams.c + "&json=" + json; //FIX THIS495 551 var saveImportURL = "cgi-bin/metadata-server.pl?a=set-import-metadata-array&c=" + gs.cgiParams.c + "&site=localsite&collect=" + gs.cgiParams.c + "&json=" + json; 552 496 553 var saveArchivesCallback = 497 554 { … … 500 557 } 501 558 YAHOO.util.Connect.asyncRequest("GET", saveArchivesURL, saveArchivesCallback); 502 559 503 560 var saveIndexCallback = 504 561 { … … 507 564 } 508 565 YAHOO.util.Connect.asyncRequest("GET", saveIndexURL, saveIndexCallback); 509 566 510 567 var saveImportCallback = 511 568 { … … 516 573 } 517 574 518 function initAnnotator() 519 { 520 gs.annotationArray = new Array(); 521 gs.annotationArray.keys = new Array(); 522 523 var elem = document.getElementById("gs-document-text"); 524 elem.innerHTML = '<button id="saveButton">Save annotations</button><br/>' + elem.innerHTML; 525 526 var button = document.getElementById("saveButton"); 527 button.onclick = function(){saveAndBuildCollection(gs.cgiParams.c);}; 528 529 jQuery(function ($) { 530 if (typeof $.fn.annotator !== 'function') { 531 alert("Ooops! it looks like you haven't built the Annotator concatenation file. " + "Either download a tagged release from GitHub, or modify the Cakefile to point " + "at your copy of the YUI compressor and run `cake package`."); 532 } else { 533 /* 534 jQuery('#gs-document-text').annotator() 535 .annotator('addPlugin', 'Store', { 536 prefix: 'http://annotateit.org/api', 537 annotationData: {'uri':document.URL} 538 }) 539 .annotator('addPlugin', 'Auth', { 540 userId: 'papitha', // Your AnnotateIt username 541 consumerKey: '39fc339cf058bd22176771b3e33c5dac', // Your Account Key 542 authToken: '852b7fc25396d2aedf9aeb44dd58518faa679dbf027892164bfb81900bd09741' // Your Auth Token 543 }); 544 */ 545 546 jQuery(function ($) { 547 // Include AnnotateIt credentials to load the store plugin. 548 $('#gs-document-text').annotator().annotator('setupPlugins', { 549 userId: 'papitha', 550 userName: 'Papitha', 551 accountId: '39fc339cf058bd22176771b3e33c5dac', 552 authToken: '852b7fc25396d2aedf9aeb44dd58518faa679dbf027892164bfb81900bd09741', 553 }, { 554 Store: 555 { 556 prefix: 'http://localhost:5000', 557 annotationData: {'uri':gs.cgiParams.c + "-" + gs.cgiParams.d}, 558 loadFromSearch: {'uri':gs.cgiParams.c + "-" + gs.cgiParams.d} 559 } 560 }); 561 }); 575 function initAnnotator() 576 { 577 gs.annotationArray = new Array(); 578 gs.annotationArray.keys = new Array(); 579 580 gs.toDeleteArray = new Array(); 581 gs.toDeleteArray.keys = new Array(); 582 583 var elem = document.getElementById("gs-document-text"); 584 elem.innerHTML = '<button id="saveButton">Save annotations</button><br/>' + elem.innerHTML; 585 586 var button = document.getElementById("saveButton"); 587 button.onclick = function(){saveAndBuildCollection(gs.cgiParams.c);}; 588 589 jQuery(function ($) { 590 if (typeof $.fn.annotator !== 'function') { 591 alert("Ooops! it looks like you haven't built the Annotator concatenation file. " + "Either download a tagged release from GitHub, or modify the Cakefile to point " + "at your copy of the YUI compressor and run `cake package`."); 592 } else { 593 jQuery(function ($) { 594 // Include AnnotateIt credentials to load the store plugin. 595 $('#gs-document-text').annotator().annotator('setupPlugins', { 596 userId: 'papitha', 597 userName: 'Papitha', 598 accountId: '39fc339cf058bd22176771b3e33c5dac', 599 authToken: '852b7fc25396d2aedf9aeb44dd58518faa679dbf027892164bfb81900bd09741', 600 }, { 601 Store: 602 { 603 prefix: 'http://localhost:5000', 604 annotationData: {'uri':gs.cgiParams.c + "-" + gs.cgiParams.d}, 605 loadFromSearch: {'uri':gs.cgiParams.c + "-" + gs.cgiParams.d} 562 606 } 563 607 }); 564 } 565 </xsl:text> 608 }); 609 } 610 }); 611 } 612 </xsl:text> 566 613 </script> 567 614 </xsl:template> -
main/trunk/model-cols-dev/peijones/js/annotator/pkg/annotator-full.min.js
r24947 r24948 659 659 var w, v, y, x; 660 660 x = u.highlights; 661 661 662 for (v = 0, y = x.length; v < y; v++) { 662 663 w = x[v]; 663 664 h(w).replaceWith(w.childNodes) 664 665 } 666 667 var rangeString = u.ranges[0].startOffset + "_" + u.ranges[0].endOffset; 668 gs.toDeleteArray[rangeString] = gs.annotationArray[rangeString]; 669 gs.toDeleteArray.keys.push(rangeString); 670 gs.annotationArray[rangeString] = null; 671 665 672 this.publish("annotationDeleted", [u]); 666 673 return u
Note:
See TracChangeset
for help on using the changeset viewer.