|
|
@@ -244,7 +244,9 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
},
|
|
|
'featuremodified': function(e) {
|
|
|
if (priv.options.debug) console.log('Event: featuremodified modified(', e.feature.attributes._modified, ') ', e.feature.attributes, ' selAttras', (_selectedFeature)? _selectedFeature.attributes : 'null');// TODO: DBG
|
|
|
- _selectedFeature.attributes._modified = 1;
|
|
|
+ if (_selectedFeature && _selectedFeature.attributes) {
|
|
|
+ _selectedFeature.attributes._modified = 1;
|
|
|
+ }
|
|
|
},
|
|
|
'afterfeaturemodified': function(e) {
|
|
|
if (priv.options.debug) console.log('Event: afterfeaturemodified fid('+e.feature.fid+'/'+(_selectedFeature ? _selectedFeature.fid : 'null')+') modified(', e.feature.attributes._modified, ') ', e.feature.attributes, ' selAttras', (_selectedFeature)? _selectedFeature.attributes : 'null');// TODO: DBG
|
|
|
@@ -479,7 +481,7 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
|
|
|
priv.updateState = function() {
|
|
|
// TODO: update state view
|
|
|
- //if (priv.options.debug) console.log('updateState: _selectedFeature:', _selectedFeature, ' _selectedRecordId:', _selectedRecordId);
|
|
|
+ if (priv.options.debug) console.log('updateState: _selectedRecordId:', _selectedRecordId, ' _selectedFeature:', _selectedFeature);
|
|
|
if (_selectedFeature || _selectedRecordId) {
|
|
|
|
|
|
} else {
|
|
|
@@ -489,6 +491,11 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
|
|
|
priv.setSelectedFeature = function(feature) {
|
|
|
_selectedFeature = feature;
|
|
|
+ if (_selectedFeature && _selectedFeature.attributes && _selectedFeature.attributes.recordId > 0) {
|
|
|
+ if (_selectedFeature.attributes.recordId != _selectedRecordId) {
|
|
|
+ _selectedRecordId = _selectedFeature.attributes.recordId;
|
|
|
+ }
|
|
|
+ }
|
|
|
priv.updateState();
|
|
|
};
|
|
|
|
|
|
@@ -510,6 +517,14 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
return (_selectedFeature)? true : false;
|
|
|
};
|
|
|
|
|
|
+ priv.changeSelectedFeatureRecordId = function(recordId) {
|
|
|
+ if (priv.options.debug) console.log('priv.changeSelectedFeatureRecordId(',recordId,')::_selectedFeature:', _selectedFeature);
|
|
|
+ if (_selectedFeature) {
|
|
|
+ _selectedFeature.attributes.recordId = recordId;
|
|
|
+ _selectedFeature.attributes._modified = 1;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
priv.cancelSelectedFeatureModifications = function() {
|
|
|
if (!_selectedFeature) return false;
|
|
|
if (_selectedFeature.attributes._newRecordId) {
|
|
|
@@ -883,6 +898,7 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
if (priv.isSelectedFeature()) {
|
|
|
if (confirm('Aktualnie przypisany rekord to ' + priv.getSelectedRecordId() + ' czy zmienić na ' + recordId + '?')) {
|
|
|
priv.setSelectedRecordId(recordId);
|
|
|
+ priv.changeSelectedFeatureRecordId(recordId);
|
|
|
}
|
|
|
} else {
|
|
|
priv.setSelectedRecordId(recordId);
|