123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /*------------------------------------------------------------------------------------------------------------------------
- @package: arkiwiJsBoilerplate
- @author: cek
- @www: arkiwi.oeg
- @copyright: COPYRIGHT 18 cek
- @license: MIT
- =============================================================================
- Filename: arkiwi.js
- =============================================================================
- This file is the main entry point for js on the arkiwiJsBoilerplate app.
- --------------------------------------------------------------------------------------------------------------------- */
- var ARKIWI = ARKIWI || {};
- ARKIWI.Aggregator = function (aggregator, defaultParameters) {
- this.aggregator = aggregator;
- this.defaultParameters = defaultParameters || '';
- };
- ARKIWI.Aggregator.constructor = ARKIWI.Aggregator;
- /* Chiede all'aggregatore i metadati su una cartella o un file. */
- ARKIWI.Aggregator.prototype.path = function (path, callback, notBase64) {
- var pathType = notBase64 ? 'path' : 'path64';
- $.getJSON(this.aggregator + '/' + pathType + '/' + path + '/json/?' + this.defaultParameters, function (result) {
- if (callback != undefined)
- callback(result);
- }).fail(function (error) {
- throw 'Arkiwi.path(): status ' + status + ' error ' + error.responseText;
- });
- };
- ARKIWI.Aggregator.prototype.getRSS = function (path, callback, notBase64) {
- var pathType = notBase64 ? 'path' : 'path64';
- $.getJSON(this.aggregator + '/' + pathType + '/' + path + '/rss/?' + this.defaultParameters, function (result) {
- if (callback != undefined)
- callback(result);
- }).fail(function (error) {
- throw 'Arkiwi.getRSS(): status ' + status + ' error ' + error.responseText;
- });
- };
- ARKIWI.Aggregator.prototype.getJsonML = function (path, callback, notBase64) {
- var pathType = notBase64 ? 'path' : 'path64';
- $.getJSON(this.aggregator + '/' + pathType + '/' + path + '/jsonml/?' + this.defaultParameters, function (result) {
- if (callback != undefined)
- callback(result);
- }).fail(function (error) {
- throw 'Arkiwi.getJsonML(): status ' + status + ' error ' + error.responseText;
- });
- };
- /* Esegue un ricerca sull'aggregatore */
- ARKIWI.Aggregator.prototype.search = function (query, callback, jailFolder) {
- var sanitizedQuery = query;
- if (jailFolder) {
- //FIXME non c'è controllo sul contenuto di jailFolder
- sanitizedQuery = '+file:' + jailFolder + '* AND ' + query;
- }
- sanitizedQuery = window.btoa(sanitizedQuery); //convert to Base64
- $.getJSON(this.aggregator + '/search64/' + sanitizedQuery + '/json/?' + this.defaultParameters, function (result) {
- if (callback != undefined)
- callback(result);
- }).fail(function (error) {
- throw 'Arkiwi.search(): status ' + status + ' error ' + error.responseText;
- });
- };
|