[24930] | 1 | gs.functions = new Array();
|
---|
| 2 |
|
---|
[26396] | 3 | gs.jqGet = function(id)
|
---|
| 4 | {
|
---|
| 5 | return $("#" + id.replace(/\./g, "\\."));
|
---|
| 6 | }
|
---|
| 7 |
|
---|
[24930] | 8 | gs.functions.ajaxRequest = function()
|
---|
| 9 | {
|
---|
| 10 | var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
|
---|
| 11 | if(window.ActiveXObject)
|
---|
| 12 | {
|
---|
| 13 | for (var i=0; i<activexmodes.length; i++)
|
---|
| 14 | {
|
---|
| 15 | try
|
---|
| 16 | {
|
---|
| 17 | return new ActiveXObject(activexmodes[i]);
|
---|
| 18 | }
|
---|
| 19 | catch(e){}
|
---|
| 20 | }
|
---|
| 21 | }
|
---|
| 22 | else if (window.XMLHttpRequest)
|
---|
| 23 | {
|
---|
| 24 | return new XMLHttpRequest();
|
---|
| 25 | }
|
---|
| 26 | else
|
---|
| 27 | {
|
---|
| 28 | return false
|
---|
| 29 | }
|
---|
| 30 | }
|
---|
| 31 |
|
---|
[25364] | 32 | gs.functions.hasClass = function(elem, classVal)
|
---|
| 33 | {
|
---|
| 34 | if(!elem || !elem.getAttribute("class"))
|
---|
| 35 | {
|
---|
| 36 | return false;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | return (elem.getAttribute("class").search(classVal) != -1)
|
---|
| 40 | }
|
---|
| 41 |
|
---|
[25142] | 42 | gs.functions.getElementsByClassName = function(cl)
|
---|
| 43 | {
|
---|
| 44 | var nodes = new Array();
|
---|
| 45 | var classRegEx = new RegExp('\\b'+cl+'\\b');
|
---|
| 46 | var allElems = document.getElementsByTagName('*');
|
---|
| 47 |
|
---|
| 48 | for (var i = 0; i < allElems.length; i++)
|
---|
| 49 | {
|
---|
| 50 | var classes = allElems[i].className;
|
---|
| 51 | if (classRegEx.test(classes))
|
---|
| 52 | {
|
---|
| 53 | nodes.push(allElems[i]);
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 | return nodes;
|
---|
| 57 | };
|
---|
| 58 |
|
---|
[24930] | 59 | gs.functions.makeToggle = function(buttons, divs)
|
---|
| 60 | {
|
---|
| 61 | var buttonArray = (buttons.length) ? buttons : [buttons];
|
---|
| 62 | var divArray = (divs.length) ? divs : [divs];
|
---|
| 63 |
|
---|
| 64 | for(var i = 0; i < buttonArray.length; i++)
|
---|
| 65 | {
|
---|
| 66 | buttonArray[i].onclick = function()
|
---|
| 67 | {
|
---|
| 68 | for(var j = 0; j < divArray.length; j++)
|
---|
| 69 | {
|
---|
| 70 | if(divArray[j].style.display == "none")
|
---|
| 71 | {
|
---|
| 72 | divArray[j].style.display = "block";
|
---|
| 73 | }
|
---|
| 74 | else
|
---|
| 75 | {
|
---|
| 76 | divArray[j].style.display = "none";
|
---|
| 77 | }
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | for(var j = 0; j < buttonArray.length; j++)
|
---|
| 81 | {
|
---|
| 82 | if(buttonArray[j].getAttribute("src") == gs.imageURLs.collapse)
|
---|
| 83 | {
|
---|
| 84 | buttonArray[j].setAttribute("src", gs.imageURLs.expand);
|
---|
| 85 | }
|
---|
| 86 | else if(buttonArray[j].getAttribute("src") == gs.imageURLs.expand)
|
---|
| 87 | {
|
---|
| 88 | buttonArray[j].setAttribute("src", gs.imageURLs.collapse);
|
---|
| 89 | }
|
---|
| 90 | }
|
---|
| 91 | };
|
---|
| 92 | }
|
---|
[25008] | 93 | }
|
---|
| 94 |
|
---|
| 95 | gs.functions.buildCollections = function(collections, finalFunction)
|
---|
| 96 | {
|
---|
| 97 | if(!collections || collections.length == 0)
|
---|
| 98 | {
|
---|
| 99 | console.log("List of collections to build is empty");
|
---|
| 100 | return;
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | var counter = 0;
|
---|
| 104 | var buildFunction = function()
|
---|
| 105 | {
|
---|
| 106 | var ajax = new gs.functions.ajaxRequest();
|
---|
| 107 | ajax.open("GET", _baseURL + "?a=g&rt=r&ro=1&s=BuildCollection&s1.collection=" + collections[counter]);
|
---|
| 108 | ajax.onreadystatechange = function()
|
---|
| 109 | {
|
---|
| 110 | if(ajax.readyState == 4 && ajax.status == 200)
|
---|
| 111 | {
|
---|
| 112 | var text = ajax.responseText;
|
---|
| 113 | var xml = validateXML(text);
|
---|
| 114 |
|
---|
| 115 | if(!xml || checkForErrors(xml))
|
---|
| 116 | {
|
---|
| 117 | console.log("Could not build collection -> " + collections[counter] + ", aborting");
|
---|
| 118 | return;
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | var status = xml.getElementsByTagName("status")[0];
|
---|
| 122 | var pid = status.getAttribute("pid");
|
---|
| 123 |
|
---|
| 124 | startCheckLoop(pid, "BuildCollection", function()
|
---|
| 125 | {
|
---|
| 126 | var localAjax = new gs.functions.ajaxRequest();
|
---|
| 127 | localAjax.open("GET", _baseURL + "?a=g&rt=r&ro=1&s=ActivateCollection&s1.collection=" + collections[counter], true);
|
---|
| 128 | localAjax.onreadystatechange = function()
|
---|
| 129 | {
|
---|
| 130 | if(localAjax.readyState == 4 && localAjax.status == 200)
|
---|
| 131 | {
|
---|
| 132 | var localText = localAjax.responseText;
|
---|
| 133 | var localXML = validateXML(localText);
|
---|
| 134 |
|
---|
| 135 | if(!xml || checkForErrors(xml))
|
---|
| 136 | {
|
---|
| 137 | console.log("Could not activate collection -> " + collections[counter] + ", aborting");
|
---|
| 138 | return;
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | var localStatus = localXML.getElementsByTagName("status")[0];
|
---|
| 142 | if(localStatus)
|
---|
| 143 | {
|
---|
| 144 | var localPID = localStatus.getAttribute("pid");
|
---|
| 145 | startCheckLoop(localPID, "ActivateCollection", function()
|
---|
| 146 | {
|
---|
| 147 | if (++counter == _collections.length)
|
---|
| 148 | {
|
---|
| 149 | //Run this function once we are done building all the collections
|
---|
| 150 | if(finalFunction){finalFunction();}
|
---|
| 151 | }
|
---|
| 152 | else
|
---|
| 153 | {
|
---|
| 154 | buildFunction();
|
---|
| 155 | }
|
---|
| 156 | });
|
---|
| 157 | }
|
---|
| 158 | }
|
---|
| 159 | }
|
---|
| 160 | localAjax.send();
|
---|
| 161 | });
|
---|
| 162 | }
|
---|
| 163 | }
|
---|
| 164 | ajax.send();
|
---|
| 165 | }
|
---|
| 166 | buildFunction();
|
---|
| 167 | }
|
---|
| 168 |
|
---|
| 169 | function startCheckLoop(pid, serverFunction, callbackFunction)
|
---|
| 170 | {
|
---|
| 171 | var ajaxFunction = function()
|
---|
| 172 | {
|
---|
| 173 | var ajax = new gs.functions.ajaxRequest();
|
---|
| 174 | ajax.open("GET", _baseURL + "?a=g&rt=s&ro=1&s=" + serverFunction + "&s1.pid=" + pid, true);
|
---|
| 175 | ajax.onreadystatechange = function()
|
---|
| 176 | {
|
---|
| 177 | if(ajax.readyState == 4 && ajax.status == 200)
|
---|
| 178 | {
|
---|
| 179 | var text = ajax.responseText;
|
---|
| 180 | var xml = validateXML(text);
|
---|
| 181 |
|
---|
| 182 | if(!xml || checkForErrors(xml))
|
---|
| 183 | {
|
---|
| 184 | console.log("Could not check status of " + serverFunction + ", there was an error in the XML, aborting");
|
---|
| 185 | return;
|
---|
| 186 | }
|
---|
| 187 |
|
---|
| 188 | var status = xml.getElementsByTagName("status")[0];
|
---|
| 189 | var code = status.getAttribute("code");
|
---|
| 190 |
|
---|
| 191 | if (code == COMPLETED || code == SUCCESS)
|
---|
| 192 | {
|
---|
| 193 | callbackFunction();
|
---|
| 194 | }
|
---|
| 195 | else if (code == HALTED || code == ERROR)
|
---|
| 196 | {
|
---|
| 197 | console.log("Could not check status of " + serverFunction + ", there was an error on the server, aborting");
|
---|
| 198 | }
|
---|
| 199 | else
|
---|
| 200 | {
|
---|
| 201 | setTimeout(ajaxFunction, 1000);
|
---|
| 202 | }
|
---|
| 203 | }
|
---|
| 204 | }
|
---|
| 205 | ajax.send();
|
---|
| 206 | }
|
---|
| 207 | ajaxFunction();
|
---|
| 208 | }
|
---|
| 209 |
|
---|
[25364] | 210 | function inc(a, b)
|
---|
| 211 | {
|
---|
| 212 | var carry = 0;
|
---|
| 213 | var num = 0;
|
---|
| 214 | var i = 0;
|
---|
| 215 |
|
---|
| 216 | while((carry || (i < a.length) || (i < b.length)) && (i < 100))
|
---|
| 217 | {
|
---|
| 218 | num = carry;
|
---|
| 219 | if(i < a.length){num += a[i];}
|
---|
| 220 | if(i < b.length){num += b[i];}
|
---|
| 221 |
|
---|
| 222 | if(num >= 256)
|
---|
| 223 | {
|
---|
| 224 | num -= 256;
|
---|
| 225 | carry = 1;
|
---|
| 226 | }
|
---|
| 227 | else
|
---|
| 228 | {
|
---|
| 229 | carry = 0;
|
---|
| 230 | }
|
---|
| 231 |
|
---|
| 232 | a[i] = num;
|
---|
| 233 |
|
---|
| 234 | i++;
|
---|
| 235 | }
|
---|
| 236 | }
|
---|
| 237 |
|
---|
| 238 | function ifposDec(a, b)
|
---|
| 239 | {
|
---|
| 240 | var carry = 0;
|
---|
| 241 | var num = 0;
|
---|
| 242 | var i = 0;
|
---|
| 243 |
|
---|
[25440] | 244 | if(b.length > a.length){return a;}
|
---|
[25364] | 245 | if(b.length == a.length)
|
---|
| 246 | {
|
---|
| 247 | i = a.length - 1;
|
---|
| 248 | while(i >= 0)
|
---|
| 249 | {
|
---|
[25440] | 250 | if(a[i] > b[i]){break;}
|
---|
| 251 | if(a[i] < b[i]){return a;}
|
---|
[25364] | 252 | i--;
|
---|
| 253 | }
|
---|
| 254 | }
|
---|
| 255 |
|
---|
| 256 | i = 0;
|
---|
[25440] | 257 | var len = 0;
|
---|
| 258 | var outString = "";
|
---|
[25364] | 259 | while((i < a.length) || (i < b.length))
|
---|
| 260 | {
|
---|
| 261 | num = -carry;
|
---|
| 262 | if(i < a.length){num += a[i];}
|
---|
| 263 | if(i < b.length){num -= b[i];}
|
---|
| 264 |
|
---|
| 265 | if(num < 0)
|
---|
| 266 | {
|
---|
| 267 | num += 256;
|
---|
| 268 | carry = 1;
|
---|
| 269 | }
|
---|
| 270 | else
|
---|
| 271 | {
|
---|
| 272 | carry = 0;
|
---|
| 273 | }
|
---|
| 274 |
|
---|
| 275 | a[i] = num;
|
---|
[25440] | 276 | outString += num + ","
|
---|
[25364] | 277 | i++
|
---|
[25440] | 278 |
|
---|
| 279 | if(num != 0){len = i}
|
---|
[25364] | 280 | }
|
---|
[25440] | 281 |
|
---|
| 282 | if(len < a.length)
|
---|
| 283 | {
|
---|
| 284 | a = a.slice(0, len);
|
---|
| 285 | }
|
---|
[25364] | 286 |
|
---|
[25440] | 287 | return a;
|
---|
[25364] | 288 | }
|
---|
| 289 |
|
---|
| 290 | function convertNum(a)
|
---|
| 291 | {
|
---|
| 292 | var result = new Array();
|
---|
| 293 | var i;
|
---|
| 294 | var convert = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
---|
| 295 |
|
---|
| 296 | if(a.length == 0)
|
---|
| 297 | {
|
---|
| 298 | result.push("0");
|
---|
| 299 | return result;
|
---|
| 300 | }
|
---|
| 301 |
|
---|
| 302 | for(i = a.length - 1; i >= 0; i--)
|
---|
| 303 | {
|
---|
| 304 | result.push(convert[Math.floor(a[i]/16)]);
|
---|
| 305 | result.push(convert[Math.floor(a[i]%16)]);
|
---|
| 306 | }
|
---|
| 307 |
|
---|
| 308 | var resultString = "";
|
---|
| 309 | for(var j = 0; j < result.length; j++)
|
---|
| 310 | {
|
---|
| 311 | resultString += result[j];
|
---|
| 312 | }
|
---|
| 313 |
|
---|
| 314 | return resultString;
|
---|
| 315 | }
|
---|
| 316 |
|
---|
| 317 | gs.functions.hashString = function(str)
|
---|
| 318 | {
|
---|
| 319 | var remainder = new Array();
|
---|
| 320 | var primePow = new Array();
|
---|
| 321 | var pow =
|
---|
| 322 | [
|
---|
| 323 | 255, 255, 255,
|
---|
| 324 | 255, 255, 255,
|
---|
| 325 | 255, 255, 255,
|
---|
| 326 | 255, 255, 1
|
---|
| 327 | ];
|
---|
| 328 |
|
---|
| 329 | for(var i = 0; i < 8; i++)
|
---|
| 330 | {
|
---|
[25440] | 331 | primePow.push(pow.slice()); //The javascript way to do an array copy (yuck!)
|
---|
[25364] | 332 | inc(pow, pow);
|
---|
| 333 | }
|
---|
| 334 |
|
---|
| 335 | for(var i = 0; i < str.length; i++)
|
---|
| 336 | {
|
---|
[25440] | 337 | var c = str.charCodeAt(i);
|
---|
[25364] | 338 |
|
---|
| 339 | if(remainder.length == 99)
|
---|
| 340 | {
|
---|
| 341 | return null;
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | for(var j = remainder.length; j > 0; j--)
|
---|
| 345 | {
|
---|
[25440] | 346 | remainder[j] = remainder[j-1];
|
---|
[25364] | 347 | }
|
---|
| 348 | remainder[0] = c;
|
---|
| 349 |
|
---|
| 350 | for(var j = 7; j >= 0; j--)
|
---|
| 351 | {
|
---|
[25440] | 352 | remainder = ifposDec(remainder, primePow[j]);
|
---|
[25364] | 353 | }
|
---|
| 354 | }
|
---|
| 355 |
|
---|
| 356 | return convertNum(remainder);
|
---|
| 357 | }
|
---|
| 358 |
|
---|
[25008] | 359 | function callMetadataServer(callingFunction, url, responseFunction)
|
---|
| 360 | {
|
---|
| 361 | var ajax = new gs.functions.ajaxRequest();
|
---|
| 362 | ajax.open("GET", url, true);
|
---|
| 363 | ajax.onreadystatechange = function()
|
---|
| 364 | {
|
---|
| 365 | if(ajax.readyState == 4 && ajax.status == 200)
|
---|
| 366 | {
|
---|
| 367 | console.log("(" + callingFunction + ") Response received from server: " + ajax.responseText);
|
---|
| 368 |
|
---|
| 369 | if(responseFunction != null)
|
---|
| 370 | {
|
---|
| 371 | responseFunction(ajax.responseText);
|
---|
| 372 | }
|
---|
| 373 | }
|
---|
| 374 | else if(ajax.readyState == 4)
|
---|
| 375 | {
|
---|
| 376 | console.log("(" + callingFunction + ") Failed");
|
---|
| 377 | }
|
---|
| 378 | }
|
---|
[25096] | 379 | ajax.send();
|
---|
[25008] | 380 | }
|
---|
| 381 |
|
---|
| 382 | /*************************
|
---|
| 383 | * SET METADATA FUNCTIONS *
|
---|
| 384 | *************************/
|
---|
| 385 |
|
---|
[25105] | 386 | gs.functions.setImportMetadata = function(collection, site, documentID, metadataName, metadataValue, prevMetadataValue, metamode, responseFunction)
|
---|
[25008] | 387 | {
|
---|
[25105] | 388 | callMetadataServer("setImportMetadata", "cgi-bin/metadata-server.pl?a=set-import-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&prevmetavalue=" + prevMetadataValue + "&metamode=" + metamode, responseFunction);
|
---|
[25008] | 389 | }
|
---|
| 390 |
|
---|
[25105] | 391 | gs.functions.setArchivesMetadata = function(collection, site, documentID, metadataName, metadataPosition, metadataValue, prevMetadataValue, metamode, responseFunction)
|
---|
[25008] | 392 | {
|
---|
| 393 | if(metadataPosition != null)
|
---|
| 394 | {
|
---|
[25105] | 395 | callMetadataServer("setArchivesMetadata", "cgi-bin/metadata-server.pl?a=set-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metapos=" + metadataPosition + "&metavalue=" + metadataValue + "&metamode=" + metamode, responseFunction);
|
---|
[25008] | 396 | }
|
---|
[25098] | 397 | else if(prevMetadataValue != null)
|
---|
[25008] | 398 | {
|
---|
[25105] | 399 | callMetadataServer("setArchivesMetadata", "cgi-bin/metadata-server.pl?a=set-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&prevmetavalue=" + prevMetadataValue + "&metamode=" + metamode, responseFunction);
|
---|
[25008] | 400 | }
|
---|
[25105] | 401 | else
|
---|
| 402 | {
|
---|
| 403 | callMetadataServer("setArchivesMetadata", "cgi-bin/metadata-server.pl?a=set-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&metamode=" + metamode, responseFunction);
|
---|
| 404 | }
|
---|
[25008] | 405 | }
|
---|
| 406 |
|
---|
[25105] | 407 | gs.functions.setIndexMetadata = function(collection, site, documentID, metadataName, metadataPosition, metadataValue, prevMetadataValue, metamode, responseFunction)
|
---|
[25008] | 408 | {
|
---|
| 409 | if(metadataPosition != null)
|
---|
| 410 | {
|
---|
[25105] | 411 | callMetadataServer("setIndexMetadata", "cgi-bin/metadata-server.pl?a=set-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metapos=" + metadataPosition + "&metavalue=" + metadataValue + "&metamode=" + metamode, responseFunction);
|
---|
[25008] | 412 | }
|
---|
[25098] | 413 | else if(prevMetadataValue != null)
|
---|
[25008] | 414 | {
|
---|
[25105] | 415 | callMetadataServer("setIndexMetadata", "cgi-bin/metadata-server.pl?a=set-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&prevmetavalue=" + prevMetadataValue + "&metamode=" + metamode, responseFunction);
|
---|
[25008] | 416 | }
|
---|
| 417 | }
|
---|
| 418 |
|
---|
[25105] | 419 | gs.functions.setMetadata = function(collection, site, documentID, metadataName, metadataValue, metamode, responseFunction)
|
---|
[25008] | 420 | {
|
---|
| 421 | var nameArray = ["setImportMetadata", "setArchivesMetadata", "setIndexMetadata"];
|
---|
| 422 | var functionArray = ["set-import-metadata", "set-archives-metadata", "set-metadata"];
|
---|
| 423 |
|
---|
| 424 | for(var i = 0; i < nameArray.length; i++)
|
---|
| 425 | {
|
---|
[25105] | 426 | callMetadataServer(nameArray[i], "cgi-bin/metadata-server.pl?a=" + functionArray[i] + "&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue + "&metamode=" + metamode, responseFunction);
|
---|
[25008] | 427 | }
|
---|
| 428 | }
|
---|
| 429 |
|
---|
| 430 | /*************************
|
---|
| 431 | * GET METADATA FUNCTIONS *
|
---|
| 432 | *************************/
|
---|
| 433 |
|
---|
| 434 | gs.functions.getImportMetadata = function(collection, site, documentID, metadataName, responseFunction)
|
---|
| 435 | {
|
---|
| 436 | var url = "cgi-bin/metadata-server.pl?a=get-import-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName;
|
---|
| 437 | callMetadataServer("getImportMetadata", url, function(responseText)
|
---|
| 438 | {
|
---|
| 439 | var metadata = new GSMetadata(collection, site, documentID, metadataName, null, responseText);
|
---|
| 440 | if(responseFunction != null)
|
---|
| 441 | {
|
---|
| 442 | responseFunction(metadata);
|
---|
| 443 | }
|
---|
| 444 | });
|
---|
| 445 | }
|
---|
| 446 |
|
---|
| 447 | gs.functions.getArchivesMetadata = function(collection, site, documentID, metadataName, metadataPosition, responseFunction)
|
---|
| 448 | {
|
---|
| 449 | var url = "cgi-bin/metadata-server.pl?a=get-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName;
|
---|
| 450 | if(metadataPosition != null)
|
---|
| 451 | {
|
---|
| 452 | url += "&metapos=" + metadataPosition;
|
---|
| 453 | }
|
---|
| 454 |
|
---|
| 455 | callMetadataServer("getArchivesMetadata", url, function(responseText)
|
---|
| 456 | {
|
---|
| 457 | var metadata = new GSMetadata(collection, site, documentID, metadataName, metadataPosition, responseText);
|
---|
| 458 | if(responseFunction != null)
|
---|
| 459 | {
|
---|
| 460 | responseFunction(metadata);
|
---|
| 461 | }
|
---|
| 462 | });
|
---|
| 463 | }
|
---|
| 464 |
|
---|
| 465 | gs.functions.getIndexMetadata = function(collection, site, documentID, metadataName, metadataPosition, responseFunction)
|
---|
| 466 | {
|
---|
| 467 | var url = "cgi-bin/metadata-server.pl?a=get-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName;
|
---|
| 468 | if(metadataPosition != null)
|
---|
| 469 | {
|
---|
| 470 | url += "&metapos=" + metadataPosition;
|
---|
| 471 | }
|
---|
| 472 |
|
---|
| 473 | callMetadataServer("getIndexMetadata", url, function(responseText)
|
---|
| 474 | {
|
---|
| 475 | var metadata = new GSMetadata(collection, site, documentID, metadataName, metadataPosition, responseText);
|
---|
| 476 |
|
---|
| 477 | if(responseFunction != null)
|
---|
| 478 | {
|
---|
| 479 | responseFunction(metadata);
|
---|
| 480 | }
|
---|
| 481 | });
|
---|
| 482 | }
|
---|
| 483 |
|
---|
| 484 | /****************************
|
---|
| 485 | * REMOVE METADATA FUNCTIONS *
|
---|
| 486 | ****************************/
|
---|
| 487 |
|
---|
| 488 | gs.functions.removeImportMetadata = function(collection, site, documentID, metadataName, metadataValue, responseFunction)
|
---|
| 489 | {
|
---|
| 490 | callMetadataServer("removeImportMetadata", "cgi-bin/metadata-server.pl?a=remove-import-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue, responseFunction);
|
---|
| 491 | }
|
---|
| 492 |
|
---|
| 493 | gs.functions.removeArchivesMetadata = function(collection, site, documentID, metadataName, metadataPosition, metadataValue, responseFunction)
|
---|
| 494 | {
|
---|
| 495 | if(metadataPosition != null)
|
---|
| 496 | {
|
---|
[25104] | 497 | callMetadataServer("removeArchiveMetadata", "cgi-bin/metadata-server.pl?a=remove-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metapos=" + metadataPosition, responseFunction);
|
---|
[25008] | 498 | }
|
---|
| 499 | else if(metadataValue != null)
|
---|
| 500 | {
|
---|
[25104] | 501 | callMetadataServer("removeArchiveMetadata", "cgi-bin/metadata-server.pl?a=remove-archives-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue, responseFunction);
|
---|
[25008] | 502 | }
|
---|
| 503 | }
|
---|
| 504 |
|
---|
| 505 | gs.functions.removeIndexMetadata = function(collection, site, documentID, metadataName, metadataPosition, metadataValue, responseFunction)
|
---|
| 506 | {
|
---|
| 507 | if(metadataPosition != null)
|
---|
| 508 | {
|
---|
| 509 | callMetadataServer("removeIndexMetadata", "cgi-bin/metadata-server.pl?a=remove-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metapos=" + metadataPosition, responseFunction);
|
---|
| 510 | }
|
---|
| 511 | else if(metadataValue != null)
|
---|
| 512 | {
|
---|
| 513 | callMetadataServer("removeIndexMetadata", "cgi-bin/metadata-server.pl?a=remove-metadata&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue, responseFunction);
|
---|
| 514 | }
|
---|
| 515 | }
|
---|
| 516 |
|
---|
| 517 | gs.functions.removeMetadata = function(collection, site, documentID, metadataName, metadataValue, responseFunction)
|
---|
| 518 | {
|
---|
| 519 | var nameArray = ["removeImportMetadata", "removeArchivesMetadata", "removeIndexMetadata"];
|
---|
| 520 | var functionArray = ["remove-import-metadata", "remove-archives-metadata", "remove-metadata"];
|
---|
| 521 |
|
---|
| 522 | for(var i = 0; i < nameArray.length; i++)
|
---|
| 523 | {
|
---|
| 524 | callMetadataServer(nameArray[i], "cgi-bin/metadata-server.pl?a=" + functionArray[i] + "&c=" + collection + "&site=" + site + "&d=" + documentID + "&metaname=" + metadataName + "&metavalue=" + metadataValue, responseFunction);
|
---|
| 525 | }
|
---|
| 526 | }
|
---|