|
|
@@ -1,11 +1,4 @@
|
|
|
-if (!SYNC_URL) throw "Missing SYNC_URL"; // => $this->syncUrl,
|
|
|
-if (!HTML_ID) throw "Missing HTML_ID"; // => $this->_htmlID,
|
|
|
-if (!NAMESPACE) throw "Missing NAMESPACE"; // => $acl->getNamespace()
|
|
|
if (!URI_BASE) throw "Missing URI_BASE"; // => Request::getPathUri()
|
|
|
-if (!ZASOB_ID) throw "Missing ZASOB_ID"; // => $this->_zasobID
|
|
|
-if (!CLASS_NAME) throw "Missing CLASS_NAME"; // => __CLASS__
|
|
|
-if ("undefined" === typeof HAS_ADDITIONAL_LAYERS) throw "Missing HAS_ADDITIONAL_LAYERS"; // => $this->hasAdditionalLayers()
|
|
|
-if ("undefined" === typeof LABEL_HTML) throw "Missing LABEL_HTML"; // => $this->getLabelHtml()
|
|
|
if (!global.jQuery) throw "Missing jQuery"
|
|
|
var $ = global.jQuery
|
|
|
|
|
|
@@ -17,8 +10,18 @@ var TableAjax = function() {
|
|
|
var defaults = {
|
|
|
namespace: '',
|
|
|
url: '', //webservice url
|
|
|
- urlData: '', //webservice params
|
|
|
urlPost: false, //use POST instead of GET
|
|
|
+ removeTheGeomAjaxUrl: '',
|
|
|
+ moreFunctionsCellAjaxUrl: '',
|
|
|
+ editInlineSaveUrl: '',
|
|
|
+ theGeomSaveUrl: '',
|
|
|
+ pageSizeSave: '',
|
|
|
+ hiddenColsSaveUrl: '',
|
|
|
+ editInlineUrl: '',
|
|
|
+ addUserTableFilterAjaxUrl: '',
|
|
|
+ rmUserTableFilterAjaxUrl: '',
|
|
|
+ hasAdditionalLayers: 0,
|
|
|
+ labelHtml: '',
|
|
|
debug: false, //prints debug info to console
|
|
|
filter: false, //show filter row
|
|
|
filterInit: false,// init filters data
|
|
|
@@ -525,11 +528,11 @@ var TableAjax = function() {
|
|
|
|
|
|
var selectedRecordId = recordID;
|
|
|
superagent
|
|
|
- .post(SYNC_URL + '&_hash=' + HTML_ID + '&_task=removeTheGeomAjax')
|
|
|
+ .post(priv.options.removeTheGeomAjaxUrl)
|
|
|
.type('json') // header ĺapplication/x-www-form-urlencoded' requires type('form');
|
|
|
.send({
|
|
|
ID: recordID,
|
|
|
- namespace: NAMESPACE
|
|
|
+ namespace: priv.options.namespace
|
|
|
})
|
|
|
.set('Accept', 'application/json')
|
|
|
.end(function(err, res) {
|
|
|
@@ -840,7 +843,7 @@ var TableAjax = function() {
|
|
|
|
|
|
_popoverCellAjaxXhr = $.ajax({
|
|
|
type: 'GET',
|
|
|
- url: SYNC_URL + '&_hash=' + HTML_ID + '&_task=moreFunctionsCellAjax&ID=' + rowPK,
|
|
|
+ url: priv.options.moreFunctionsCellAjaxUrl + '&ID=' + rowPK,
|
|
|
dataType: 'json',
|
|
|
contentType: "application/json; charset=utf-8",
|
|
|
data: ''
|
|
|
@@ -1489,7 +1492,7 @@ var TableAjax = function() {
|
|
|
data: data,
|
|
|
dataType: 'json',
|
|
|
type: "POST",
|
|
|
- url: 'index-ajax.php?_zasobID=' + ZASOB_ID + '&_cls=' + CLASS_NAME + '&_hash=' + HTML_ID + '&_task=EDIT_INLINE_SAVE'
|
|
|
+ url: priv.options.editInlineSaveUrl
|
|
|
})
|
|
|
.done(function(data, textStatus, jqXHR){
|
|
|
notifyAjaxCallback(data);
|
|
|
@@ -1562,7 +1565,7 @@ var TableAjax = function() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var exportUrl = 'index.php?_route=ViewTableAjax&_task=export&namespace=' + NAMESPACE;
|
|
|
+ var exportUrl = 'index.php?_route=ViewTableAjax&_task=export&namespace=' + priv.options.namespace;
|
|
|
exportUrl += '&format=' + format;
|
|
|
exportUrl += '&flds=' + exportFields.join(',');
|
|
|
exportUrl += '&sortCol=' + (_state.filters.currSortCol || '');
|
|
|
@@ -1603,7 +1606,7 @@ var TableAjax = function() {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (priv.options.debug) console.log(p5Utils__format('requesting data from url:{0} data:{1}', [priv.options.url, JSON.stringify(priv.options.urlData) || '']));
|
|
|
+ if (priv.options.debug) console.log(p5Utils__format('requesting data from url:{0}', priv.options.url));
|
|
|
|
|
|
var initUrlAdd = '';
|
|
|
var filtersInitSet = false;
|
|
|
@@ -2001,9 +2004,9 @@ var TableAjax = function() {
|
|
|
//debug: true,
|
|
|
wpsUrl: 'http://biuro.biall-net.pl/wps',
|
|
|
wfsUrl: 'http://biuro.biall-net.pl/wps',
|
|
|
- showAddLayerWidget: (HAS_ADDITIONAL_LAYERS) ? true : false,
|
|
|
+ showAddLayerWidget: (priv.options.hasAdditionalLayers) ? true : false,
|
|
|
zoomStrategyActivate: 14,
|
|
|
- layerName: LABEL_HTML,
|
|
|
+ layerName: priv.options.labelHtml,
|
|
|
addBtn: {
|
|
|
title: 'Przenieś mapę do okna',
|
|
|
displayClass: 'mapEditor-btnBackToWindow',
|
|
|
@@ -2051,7 +2054,7 @@ var TableAjax = function() {
|
|
|
data: {polygon: selectedFeatureExtent},
|
|
|
dataType: 'json',
|
|
|
type: "POST",
|
|
|
- url: 'index-ajax.php?_zasobID=' + ZASOB_ID + '&_cls=' + CLASS_NAME + '&_hash=' + HTML_ID + '&_task=THE_GEOM_SAVE&ID=' + selectedRecordId
|
|
|
+ url: priv.options.theGeomSaveUrl + '&ID=' + selectedRecordId
|
|
|
})
|
|
|
.done(function(data, textStatus, jqXHR){
|
|
|
notifyAjaxCallback(data);
|
|
|
@@ -2262,7 +2265,7 @@ var TableAjax = function() {
|
|
|
type: "POST",
|
|
|
dataType: 'json',
|
|
|
// async: true,
|
|
|
- url: 'index-ajax.php?_zasobID=' + ZASOB_ID + '&_cls=' + CLASS_NAME + '&_hash=' + HTML_ID + '&_task=PAGE_SIZE_SAVE'
|
|
|
+ url: priv.options.pageSizeSave
|
|
|
})
|
|
|
.done(function(data, textStatus, jqXHR){
|
|
|
if (data && data.type && data.type == 'info') {
|
|
|
@@ -2290,7 +2293,7 @@ var TableAjax = function() {
|
|
|
type: "POST",
|
|
|
dataType: 'json',
|
|
|
// async: true,
|
|
|
- url: 'index-ajax.php?_zasobID=' + ZASOB_ID + '&_cls=' + CLASS_NAME + '&_hash=' + HTML_ID + '&_task=HIDDEN_COLS_SAVE'
|
|
|
+ url: priv.options.hiddenColsSaveUrl
|
|
|
})
|
|
|
.done(function(data, textStatus, jqXHR){
|
|
|
if (data && data.type && data.type == 'info') {
|
|
|
@@ -2393,14 +2396,14 @@ var TableAjax = function() {
|
|
|
e.stopPropagation()
|
|
|
var filtrName = $(this).data('col_filter')
|
|
|
if (!filtrName) return
|
|
|
- window.fetch(URI_BASE + 'index.php?_route=ViewTableAjax&_task=rmUserTableFilterAjax', {
|
|
|
+ window.fetch(priv.options.rmUserTableFilterAjaxUrl, {
|
|
|
method: 'POST',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json'
|
|
|
},
|
|
|
credentials: 'same-origin',// add cookies
|
|
|
body: JSON.stringify({
|
|
|
- namespace: NAMESPACE,
|
|
|
+ namespace: priv.options.namespace,
|
|
|
filtrName: filtrName,
|
|
|
})
|
|
|
}).then(function (response) {
|
|
|
@@ -2443,14 +2446,14 @@ var TableAjax = function() {
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
if (!filtrName) reject('Proszę podać nazwę filtra')
|
|
|
if (filtrName.length > 255) reject('Nazwa za długa')
|
|
|
- window.fetch(URI_BASE + 'index.php?_route=ViewTableAjax&_task=addUserTableFilterAjax', {
|
|
|
+ window.fetch(priv.options.addUserTableFilterAjaxUrl, {
|
|
|
method: 'POST',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json'
|
|
|
},
|
|
|
credentials: 'same-origin',// add cookies
|
|
|
body: JSON.stringify({
|
|
|
- namespace: NAMESPACE,
|
|
|
+ namespace: priv.options.namespace,
|
|
|
filtrName: filtrName,
|
|
|
visibleCols: Object.keys(_data.cols).filter(function(col) {
|
|
|
return !_data.cols[col].hidden
|
|
|
@@ -2692,7 +2695,7 @@ var TableAjax = function() {
|
|
|
inlineEditBox$Node.find('input[name=col]').val(e.data.col);
|
|
|
inlineEditBox$Node.find('.inlineEditBox-cnt').html('<span class="loading-info"> loading ...</span>');
|
|
|
$.ajax({
|
|
|
- url: 'index-ajax.php?_zasobID=' + ZASOB_ID + '&_cls=' + CLASS_NAME + '&_hash=' + HTML_ID + '&_task=EDIT_INLINE&ID=' + e.data.id + '&col=' + e.data.col,
|
|
|
+ url: priv.options.editInlineUrl + '&ID=' + e.data.id + '&col=' + e.data.col,
|
|
|
type: 'GET',
|
|
|
dataType: 'json',
|
|
|
success: function(data) {
|
|
|
@@ -2770,7 +2773,7 @@ var TableAjax = function() {
|
|
|
|
|
|
_popoverCellAjaxXhr = $.ajax({
|
|
|
type: 'GET',
|
|
|
- url: 'index.php?_route=ViewTableAjax&_task=typeSpecialCell&namespace=' + NAMESPACE + '&ID=' + id + '&col=' + col,
|
|
|
+ url: 'index.php?_route=ViewTableAjax&_task=typeSpecialCell&namespace=' + priv.options.namespace + '&ID=' + id + '&col=' + col,
|
|
|
dataType: 'json',
|
|
|
contentType: "application/json; charset=utf-8",
|
|
|
data: '',
|