Commit 88902e28 by Uros Spasojevic

added various stuff

parent 81fc8662
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -22,147 +22,198 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', {
modal: true,
layout: 'border',
maximizable: true,
items: [
{
xtype: 'gmappanel',
region: 'west',
split: true,
width: 300,
center: {
lat: marker.lat, // Marker latitude
lng: marker.lng // Marker longitude
},
markers: [
{
lat: marker.lat,
lng: marker.lng,
animation: google.maps.Animation.BOUNCE
}
],
mapOptions: {
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoom: 15
}
items: [{
xtype: 'gmappanel',
region: 'west',
split: true,
width: 300,
center: {
lat: marker.lat, // Marker latitude
lng: marker.lng // Marker longitude
},
{
xtype: 'panel',
region: 'center',
layout: 'vbox',
style: 'background-color: white;',
items: [
{
xtype: 'textfield',
fieldLabel: 'Title',
reference: 'titleField',
value: marker.title,
width: '90%'
},
{
xtype: 'textarea',
fieldLabel: 'Description',
reference: 'descriptionArea',
value: marker.description,
width: '90%'
}, {
xtype: 'grid',
reference: 'myGrid',
title: 'Performers',
height: 300,
width: '90%',
store: this.getView().getViewModel().getStore('myStore'),
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Date',
dataIndex: 'date',
flex: 1
}]
}
],
buttons: [
{
text: 'Update',
handler: function() {
console.log('updating');
}
},
{
text: 'Delete',
handler: function() {
var i = markers.length;
var newMarkers = [];
while(i) {
i--;
if(markers[i].access == marker.access) {
markers[i].setMap(null);
} else {
newMarkers.push(markers[i]);
markers: [{
lat: marker.lat,
lng: marker.lng,
animation: google.maps.Animation.BOUNCE
}],
mapOptions: {
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoom: 15
}
}, {
xtype: 'panel',
region: 'center',
layout: 'vbox',
style: 'background-color: white;',
items: [{
xtype: 'textfield',
fieldLabel: 'Title',
reference: 'titleField',
value: marker.title,
width: '90%'
}, {
xtype: 'textarea',
fieldLabel: 'Description',
reference: 'descriptionArea',
value: marker.description,
width: '90%'
}, {
xtype: 'grid',
reference: 'myGrid',
title: 'Performers',
height: 300,
width: '90%',
store: this.getView().getViewModel().getStore('myStore'),
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Date',
dataIndex: 'date',
flex: 1
}, {
text: 'Time',
dataIndex: 'time',
flex: 1
}]
}],
buttons: [{
text: 'Add',
handler: function () {
var popup = new Ext.panel.Panel({
floating: true,
centered: true,
modal: true,
width: 300,
height: 400,
items: [
{
xtype: 'textfield',
fieldLabel: 'Name',
reference: 'name'
},
{
xtype: 'textfield',
fieldLabel: 'Date',
reference: 'date'
},
{
xtype: 'textfield',
fieldLabel: 'Time',
reference: 'time'
}],
buttons: [{
text: 'Save',
formBind: true,
listeners: {
click: function() {
// record.beginEdit();
// record.set("name", popup.items.items[0].value);
// record.set("date", popup.items.items[1].value);
// record.set("time", popup.items.items[2].value);
// record.endEdit();
popup.hide();
}
}
}]
markers = newMarkers;
dbref.ref('/data/'+marker.access).remove();
win.close();
}).show()
}
},
{
text: 'Update',
handler: function () {
console.log('updating');
}
}, {
text: 'Delete',
handler: function () {
var i = markers.length;
var newMarkers = [];
while (i) {
i--;
if (markers[i].access == marker.access) {
markers[i].setMap(null);
} else {
newMarkers.push(markers[i]);
}
}
]
}
]
}).show()
markers = newMarkers;
dbref.ref('/data/' + marker.access).remove();
win.close();
}
}]
}
]
}).
show()
},
click: function(evt) {
click: function (evt) {
var me = this;
var map = me.getView();
var key = dbref.ref().child('data').push().key;
var marker = {
access: key,
lat: evt.latLng.lat(),
lng: evt.latLng.lng(),
title: "",
description: "",
performers: [],
animation: google.maps.Animation.DROP
};
this.getView().getViewModel().getStore('myStore').each(function (rec) {
marker.performers.push(rec.data);
}
);
var updates = {};
updates['/data/'+key] = marker;
updates['/data/' + key] = marker;
dbref.ref().update(updates);
markers.push(map.addMarker(marker));
},
updateData: function(marker) {
updateData: function (marker) {
// stub
},
mapready: function() {
mapready: function () {
var me = this;
var map = me.getView();
google.maps.event.addListener(map.gmap, 'click', function(e) {
google.maps.event.addListener(map.gmap, 'click', function (e) {
map.fireEvent('click', e);
});
Ext.Ajax.request({
url: dataURL,
scope:this,
success: function(data) {
scope: this,
success: function (data) {
var info = Ext.decode(data.responseText);
if (info != null) {
Ext.Object.each(info, function(obj, index) {
Ext.Object.each(info, function (obj, index) {
markers.push(map.addMarker(index));
});
}
}
});
}
}
}
}
......@@ -172,4 +223,6 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', {
var me = this,
map = me.getView();
}
});
\ No newline at end of file
......@@ -2,24 +2,25 @@ Ext.define('Evoksi.view.evoksi.EvoksiModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.evoksi',
stores: {
myStore:{
StoreId: 'myStore',
fields: [
'name', 'date'
],
myStore: {
StoreId: 'myStore',
fields: [
'name', 'date', 'time'
],
data: {
items: [
{name: 'aaa', date: 'sdfgsdfg'}
]
},
data: {
items: [
{name: 'aaa', date: 'sdfgsdfg', time: 'fsadfsa'}
]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
rootProperty: 'items'
proxy: {
type: 'memory',
reader: {
type: 'json',
rootProperty: 'items'
}
}
}}
}
}
});
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment