merge with sanj

This commit is contained in:
Johnson Chetty 2012-10-05 16:21:36 +02:00
commit e323ad885c
3 changed files with 13 additions and 3 deletions

View File

@ -87,6 +87,8 @@ def stops(request):
def stop(request, slug): def stop(request, slug):
srid = int(request.GET.get("srid", 4326)) srid = int(request.GET.get("srid", 4326))
if request.POST and request.POST.has_key('geojson'): if request.POST and request.POST.has_key('geojson'):
if not request.user.is_staff:
return render_to_json_response({'errors': 'No permission'})
if not slug: if not slug:
stop = Stop() #FIXME: should this return an error instead? stop = Stop() #FIXME: should this return an error instead?
else: else:

View File

@ -92,7 +92,7 @@ var API_BASE = "/1.0/",
stopsGeojson.features = stopsWithGeom; stopsGeojson.features = stopsWithGeom;
var currFeatures = jsonLayer.features; var currFeatures = jsonLayer.features;
jsonLayer.removeFeatures(currFeatures); jsonLayer.removeFeatures(currFeatures);
console.log(stopsWithGeom); //console.log(stopsWithGeom);
if (stopsWithGeom.length !== 0) { if (stopsWithGeom.length !== 0) {
jsonLayer.addFeatures(geojson_format.read(stopsGeojson)); jsonLayer.addFeatures(geojson_format.read(stopsGeojson));
var maxExtent = jsonLayer.getDataExtent(); var maxExtent = jsonLayer.getDataExtent();
@ -129,6 +129,7 @@ var API_BASE = "/1.0/",
var $ul = $('<ul />') var $ul = $('<ul />')
.addClass("stopsList") .addClass("stopsList")
.click(function(e) { .click(function(e) {
//e.stopPropagation();
var $target = $(e.target); var $target = $(e.target);
if ($target.hasClass("selectedStop")) { if ($target.hasClass("selectedStop")) {
return; return;
@ -136,8 +137,11 @@ var API_BASE = "/1.0/",
// $('.selectedStop').removeClass("selectedStop"); // $('.selectedStop').removeClass("selectedStop");
// $target.addClass("selectedStop"); // $target.addClass("selectedStop");
var props = $target.data("properties"); var props = $target.data("properties");
//console.log($target, props);
var geom = $target.data("geometry"); var geom = $target.data("geometry");
var $form = getStopForm(props, geom); var $form = getStopForm(props, geom);
//GLOB_FORM = $form;
//console.log($form);
var slug = $target.data("slug"); var slug = $target.data("slug");
if ($target.hasClass("has_point")) { if ($target.hasClass("has_point")) {
selectStopOnMap(slug); selectStopOnMap(slug);
@ -169,6 +173,7 @@ var API_BASE = "/1.0/",
function getStopForm(stop, geom) { function getStopForm(stop, geom) {
// console.log(stop); // console.log(stop);
// console.log(geom); // console.log(geom);
//console.log(stop);
var lon = !$.isEmptyObject(geom) ? geom.coordinates[0] : ''; var lon = !$.isEmptyObject(geom) ? geom.coordinates[0] : '';
var lat = !$.isEmptyObject(geom) ? geom.coordinates[1] : ''; var lat = !$.isEmptyObject(geom) ? geom.coordinates[1] : '';
var $div = $('<div />'); var $div = $('<div />');
@ -334,7 +339,7 @@ var API_BASE = "/1.0/",
//alert("selected " + slug); //alert("selected " + slug);
$('.selectedStop').removeClass("selectedStop"); $('.selectedStop').removeClass("selectedStop");
highlightStop(slug); highlightStop(slug);
var stop = e.feature.attributes; var stop = $('.selectedStop').data("properties");
var geom = { var geom = {
'coordinates': [e.feature.geometry.x, e.feature.geometry.y] 'coordinates': [e.feature.geometry.x, e.feature.geometry.y]
}; };

View File

@ -121,6 +121,9 @@ $(function() {
<!-- <h1> Short Instructions</h1> --> <!-- <h1> Short Instructions</h1> -->
<h2> Welcome!</h2> <h2> Welcome!</h2>
<br />
<a href="http://chalobest.in/sms">click here for instructions</a>
<!--
<ul><li class="english"> With this service, you can send and receive simple queries by SMS about bus stops, bus numbers and routing on BEST.<br><br>Send SMS to <number>9619524420</number> and you will receive a return SMS with the information you need. <ul><li class="english"> With this service, you can send and receive simple queries by SMS about bus stops, bus numbers and routing on BEST.<br><br>Send SMS to <number>9619524420</number> and you will receive a return SMS with the information you need.
</li><li class="marathi"> चलोबेस्टद्वारे आपल्याला वेगवेगळ्या बेस्ट बसस्थानकांची, बसक्रमांकाची तसेच बसमार्गांची माहिती SMS ने मिळू शकते. <br><br>आपला SMS <number>९६१९५२४४२०</number> या क्रमांकावर पाठवावा, आम्ही आपल्याला पाहिजे असलेली माहिती SMS द्वारे परत पाठवू. </li><li class="marathi"> चलोबेस्टद्वारे आपल्याला वेगवेगळ्या बेस्ट बसस्थानकांची, बसक्रमांकाची तसेच बसमार्गांची माहिती SMS ने मिळू शकते. <br><br>आपला SMS <number>९६१९५२४४२०</number> या क्रमांकावर पाठवावा, आम्ही आपल्याला पाहिजे असलेली माहिती SMS द्वारे परत पाठवू.
</li><li class="hindi"> इस सुविधा से आप साधारण SMS के ज़रिये बेस्ट बस स्टॉप, बस क्रमांक और मार्गों की जानकारी पा सकते हैं| <br><br><number>9619524420</number> ईस नंबर पर SMS भेजनेपर आपको जवाबी SMS से जरुरी जानकारी मिलेगी। </li><li class="hindi"> इस सुविधा से आप साधारण SMS के ज़रिये बेस्ट बस स्टॉप, बस क्रमांक और मार्गों की जानकारी पा सकते हैं| <br><br><number>9619524420</number> ईस नंबर पर SMS भेजनेपर आपको जवाबी SMS से जरुरी जानकारी मिलेगी।
@ -154,7 +157,7 @@ $(function() {
</li><li class="hindi"> चलोबेस्ट सेवा की फिलहाल जाँच शुरु है। जल्दही हम ये सेवा पुरी तरह से शुरु करेंगे। ईस सेवा के बारे में आपके विचार और प्रतिक्रिया जानने पर हमें खुशी होगी। आप हमें info@chalobest.in ईस ईमेल पर अपनी राय दे सकते है। </li><li class="hindi"> चलोबेस्ट सेवा की फिलहाल जाँच शुरु है। जल्दही हम ये सेवा पुरी तरह से शुरु करेंगे। ईस सेवा के बारे में आपके विचार और प्रतिक्रिया जानने पर हमें खुशी होगी। आप हमें info@chalobest.in ईस ईमेल पर अपनी राय दे सकते है।
</li><li class="gujarati"> ચલોબેસ્ટ હાલ પ્રાયોગિક ધોરણે દાખલ કરેલ છે. જાહેર ઉપયોગ માટે ટૂંક સમય માં એનું વિમોચન થશે. info@chalobest.in પર ઈ-મેઈલ દ્વારા તમારી પ્રતિક્રિયા તેમજ સૂચન નું આવકાર છે. </li><li class="gujarati"> ચલોબેસ્ટ હાલ પ્રાયોગિક ધોરણે દાખલ કરેલ છે. જાહેર ઉપયોગ માટે ટૂંક સમય માં એનું વિમોચન થશે. info@chalobest.in પર ઈ-મેઈલ દ્વારા તમારી પ્રતિક્રિયા તેમજ સૂચન નું આવકાર છે.
</li></ul> </li></ul>
-->
</div> </div>
<!-- <!--