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,8 +22,7 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', { ...@@ -22,8 +22,7 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', {
modal: true, modal: true,
layout: 'border', layout: 'border',
maximizable: true, maximizable: true,
items: [ items: [{
{
xtype: 'gmappanel', xtype: 'gmappanel',
region: 'west', region: 'west',
split: true, split: true,
...@@ -32,32 +31,27 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', { ...@@ -32,32 +31,27 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', {
lat: marker.lat, // Marker latitude lat: marker.lat, // Marker latitude
lng: marker.lng // Marker longitude lng: marker.lng // Marker longitude
}, },
markers: [ markers: [{
{
lat: marker.lat, lat: marker.lat,
lng: marker.lng, lng: marker.lng,
animation: google.maps.Animation.BOUNCE animation: google.maps.Animation.BOUNCE
} }],
],
mapOptions: { mapOptions: {
mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeId: google.maps.MapTypeId.ROADMAP,
zoom: 15 zoom: 15
} }
}, }, {
{
xtype: 'panel', xtype: 'panel',
region: 'center', region: 'center',
layout: 'vbox', layout: 'vbox',
style: 'background-color: white;', style: 'background-color: white;',
items: [ items: [{
{
xtype: 'textfield', xtype: 'textfield',
fieldLabel: 'Title', fieldLabel: 'Title',
reference: 'titleField', reference: 'titleField',
value: marker.title, value: marker.title,
width: '90%' width: '90%'
}, }, {
{
xtype: 'textarea', xtype: 'textarea',
fieldLabel: 'Description', fieldLabel: 'Description',
reference: 'descriptionArea', reference: 'descriptionArea',
...@@ -78,25 +72,72 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', { ...@@ -78,25 +72,72 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', {
dataIndex: 'date', dataIndex: 'date',
flex: 1 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();
} }
], }
}]
buttons: [ }).show()
}
},
{ {
text: 'Update', text: 'Update',
handler: function() { handler: function () {
console.log('updating'); console.log('updating');
} }
}, }, {
{
text: 'Delete', text: 'Delete',
handler: function() { handler: function () {
var i = markers.length; var i = markers.length;
var newMarkers = []; var newMarkers = [];
while(i) { while (i) {
i--; i--;
if(markers[i].access == marker.access) { if (markers[i].access == marker.access) {
markers[i].setMap(null); markers[i].setMap(null);
} else { } else {
newMarkers.push(markers[i]); newMarkers.push(markers[i]);
...@@ -105,64 +146,74 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', { ...@@ -105,64 +146,74 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', {
markers = newMarkers; markers = newMarkers;
dbref.ref('/data/'+marker.access).remove(); dbref.ref('/data/' + marker.access).remove();
win.close(); win.close();
} }
}]
} }
] ]
} }).
] show()
}).show()
}, },
click: function(evt) { click: function (evt) {
var me = this; var me = this;
var map = me.getView(); var map = me.getView();
var key = dbref.ref().child('data').push().key; var key = dbref.ref().child('data').push().key;
var marker = { var marker = {
access: key, access: key,
lat: evt.latLng.lat(), lat: evt.latLng.lat(),
lng: evt.latLng.lng(), lng: evt.latLng.lng(),
title: "", title: "",
description: "", description: "",
performers: [],
animation: google.maps.Animation.DROP animation: google.maps.Animation.DROP
}; };
this.getView().getViewModel().getStore('myStore').each(function (rec) {
marker.performers.push(rec.data);
}
);
var updates = {}; var updates = {};
updates['/data/'+key] = marker; updates['/data/' + key] = marker;
dbref.ref().update(updates); dbref.ref().update(updates);
markers.push(map.addMarker(marker)); markers.push(map.addMarker(marker));
}, },
updateData: function(marker) { updateData: function (marker) {
// stub // stub
}, },
mapready: function() { mapready: function () {
var me = this; var me = this;
var map = me.getView(); 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); map.fireEvent('click', e);
}); });
Ext.Ajax.request({ Ext.Ajax.request({
url: dataURL, url: dataURL,
scope:this, scope: this,
success: function(data) { success: function (data) {
var info = Ext.decode(data.responseText); var info = Ext.decode(data.responseText);
if (info != null) { if (info != null) {
Ext.Object.each(info, function(obj, index) { Ext.Object.each(info, function (obj, index) {
markers.push(map.addMarker(index)); markers.push(map.addMarker(index));
}); });
} }
} }
}); });
} }
} }
} }
} }
...@@ -172,4 +223,6 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', { ...@@ -172,4 +223,6 @@ Ext.define('Evoksi.view.evoksi.EvoksiController', {
var me = this, var me = this,
map = me.getView(); map = me.getView();
} }
}); });
\ No newline at end of file
...@@ -2,15 +2,15 @@ Ext.define('Evoksi.view.evoksi.EvoksiModel', { ...@@ -2,15 +2,15 @@ Ext.define('Evoksi.view.evoksi.EvoksiModel', {
extend: 'Ext.app.ViewModel', extend: 'Ext.app.ViewModel',
alias: 'viewmodel.evoksi', alias: 'viewmodel.evoksi',
stores: { stores: {
myStore:{ myStore: {
StoreId: 'myStore', StoreId: 'myStore',
fields: [ fields: [
'name', 'date' 'name', 'date', 'time'
], ],
data: { data: {
items: [ items: [
{name: 'aaa', date: 'sdfgsdfg'} {name: 'aaa', date: 'sdfgsdfg', time: 'fsadfsa'}
] ]
}, },
...@@ -20,6 +20,7 @@ Ext.define('Evoksi.view.evoksi.EvoksiModel', { ...@@ -20,6 +20,7 @@ Ext.define('Evoksi.view.evoksi.EvoksiModel', {
type: 'json', type: 'json',
rootProperty: 'items' 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