From e3dacb03ab7c707938bde9826d99c98b52d48ed9 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sun, 27 Jul 2014 01:06:10 +0400 Subject: [PATCH 1/6] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BE=D1=82=20=D0=BD=D0=BE=D0=B2=D1=8B=D1=85=20=D0=BC=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=B5=D0=B9,=20=D0=B8=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B2=20JS,=20=D0=BF=D1=80=D0=B8=20=D0=B1=D0=BB?= =?UTF-8?q?=D0=B8=D0=B7=D0=BA=D0=B8=D1=85=20=D1=82=D0=BE=D1=87=D0=BA=D0=B0?= =?UTF-8?q?=D1=85=20=D0=B8=20=D0=B7=D1=83=D0=BC=D0=BC=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/IndexController.php | 20 ++++++++----------- ground/controllers/JsonController.php | 9 +++------ ground/controllers/PageController.php | 6 ++---- ground/views/modals/addPoint.php | 4 ++-- public/js/map.js | 27 +++++++++++++++----------- 5 files changed, 31 insertions(+), 35 deletions(-) diff --git a/ground/controllers/IndexController.php b/ground/controllers/IndexController.php index 519092e..ffcfbf1 100644 --- a/ground/controllers/IndexController.php +++ b/ground/controllers/IndexController.php @@ -39,10 +39,9 @@ class IndexController extends Controller $category = Category::model()->getAll(); $routes = array(); - if (App::$user) + if (App::$user && App::$user->id) { - $routes = new Route(); - $routes = $routes->getByAuthor(App::$user->id); + $routes = Route::model()->getByAuthor(App::$user->id); } self::addVar('isAdmin', (int)(App::$user && App::$user->isAdmin == 1) ); @@ -56,8 +55,7 @@ class IndexController extends Controller { $id = (int) $_GET['point']; - $point = new Point(); - $point = $point->getByPK($id); + $point = Point::model()->getByPK($id); $point->name = htmlspecialchars($point->name); $point->descriptionHtml = htmlspecialchars($point->description); $point->descriptionHtml .= ' Посмотреть на карте: http://wikipoints.ru/?point='.$id; @@ -90,8 +88,8 @@ class IndexController extends Controller static function actionUser() { - $routes = new Route(); - $routes = $routes->getByAuthor(App::$user->id); + App::error404(); + $routes = Route::model()->getByAuthor(App::$user->id); var_dump($routes); } @@ -109,9 +107,8 @@ class IndexController extends Controller //var_dump($uLoginUser);die; $uLoginUser['identity'] = md5($uLoginUser['uid'].$uLoginUser['network'].'=P'); - $user = new User(); - $user->getByUID($uLoginUser['identity']); -//var_dump($uLoginUser,'

', $user);die; + $user = User::model()->getByUID($uLoginUser['identity']); + if( !$user->id ) { $user = $user->add(array( @@ -137,8 +134,7 @@ class IndexController extends Controller { $xml = new SimpleXMLElement(''); - $points = new Point(); - $points = $points->getAll('', 'ID DESC'); + $points = Point::model()->getAll(array('order' => 'ID DESC', 'asArray' => true)); foreach ($points as $point) { diff --git a/ground/controllers/JsonController.php b/ground/controllers/JsonController.php index bbfd03c..795f421 100644 --- a/ground/controllers/JsonController.php +++ b/ground/controllers/JsonController.php @@ -149,8 +149,7 @@ class JsonController extends Controller 'points' => json_encode($_POST['points']), ); - $route = new Route(); - $route = $route->add($request); + $route = Route::model()->add($request); self::renderPartial('json.php', $route->id); } @@ -160,8 +159,7 @@ class JsonController extends Controller $id = (int) App::getParam('id'); if ($id) { - $route = new Route(); - $route = $route->getByPK($id); + $route = Route::model()->getByPK($id); self::renderPartial('json.php', $route->points); } else { @@ -174,8 +172,7 @@ class JsonController extends Controller $id = (int) App::getParam('id'); if ($id && App::$user) { - $route = new Route(); - $route = $route->getByPK($id); + $route = Route::model()->getByPK($id); if ($route->author == App::$user->id) { diff --git a/ground/controllers/PageController.php b/ground/controllers/PageController.php index 6907926..46d4637 100644 --- a/ground/controllers/PageController.php +++ b/ground/controllers/PageController.php @@ -57,13 +57,11 @@ class PageController extends Controller self::addStyle('/css/bootstrap.min.css'); self::addStyle('/css/bootstrap-theme.min.css'); - $point = new Point(); - $point = $point->getByPK($id); + $point = Point::model()->getByPK($id); $point->descriptionHtml = nl2br($point->description); $point->name = htmlspecialchars($point->name); - $categories = new Category(); - $categories = $categories->getAll(); + $categories = Category::model()->getAll(array('asArray' => true)); $point->categoryIcon = $categories[$point->categoryId]['icon']; $point->categoryName = $categories[$point->categoryId]['name']; diff --git a/ground/views/modals/addPoint.php b/ground/views/modals/addPoint.php index c30efc8..e3e7105 100644 --- a/ground/views/modals/addPoint.php +++ b/ground/views/modals/addPoint.php @@ -28,8 +28,8 @@ diff --git a/public/js/map.js b/public/js/map.js index 41e26bb..239ab1d 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -12,6 +12,7 @@ var route = false; var addPointInProcess = false; var layer; var layers = Array(); +var defaultZoom = 13; categories.im = L.icon({ iconUrl: '/ico/man.png', @@ -40,7 +41,7 @@ ymaps.ready(function(){ * @returns true */ function init(lat, lng) { - myMap = L.map('map',{zoomControl: false}).setView([lat, lng], 11); + myMap = L.map('map',{zoomControl: false}).setView([lat, lng], defaultZoom); markers = new L.MarkerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 45}); layers['quest'] = L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png', {attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox',maxZoom: 18}); @@ -164,11 +165,10 @@ function initPoints() function showInfo(id) { marker = points[id]; - markers.zoomToShowLayer(marker,function() {}); if (!(id in points) || marker.options.description == undefined) { - marker.bindPopup("Загрузка...").openPopup(); + marker.bindPopup("Загрузка...").openPopup(); $.ajax({ url: "/json/point/id/" + id, success: function(data) { @@ -198,14 +198,19 @@ function showInfo(id) description = description + '
'; marker.options.description = description; - marker.bindPopup(marker.options.description, {maxWidth: 500, maxHeight: 300}).openPopup(); + marker.bindPopup(marker.options.description, {maxWidth: 500, maxHeight: 300}); - bounds = myMap.getBounds(); - diff = (bounds._northEast.lat - bounds._southWest.lat)/4; - myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom()); + markers.zoomToShowLayer(marker,function() { + marker.openPopup(); + history.pushState({}, document.title, "/?point=" + id); - history.pushState({}, document.title, "/?point=" + id); - document.title = data.name; + bounds = myMap.getBounds(); + diff = (bounds._northEast.lat - bounds._southWest.lat)/4; + myMap.setView([points[id]._latlng.lat+diff, points[id]._latlng.lng], myMap.getZoom()); + + history.pushState({}, document.title, "/?point=" + id); + document.title = data.name; + }); } }); } else { @@ -258,7 +263,7 @@ function searchAdderess() { if (data.lat && data.lng) { - myMap.setView([data.lat, data.lng], 13); + myMap.setView([data.lat, data.lng], defaultZoom); L.popup() .setLatLng([data.lat, data.lng]) .setContent('Координаты: lat:'+data.lat+' lng:'+data.lng) @@ -281,7 +286,7 @@ function showMeOnTheMap() coords = [pos.coords.latitude, pos.coords.longitude]; myMap.removeLayer(points.im); points.im.setLatLng(coords).addTo(myMap); - myMap.setView(coords, 15); + myMap.setView(coords, defaultZoom); }); } From eab2a90b3438c731a00cc8678fed4146a21a8cc9 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sun, 27 Jul 2014 01:20:40 +0400 Subject: [PATCH 2/6] FIX --- ground/controllers/IndexController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/controllers/IndexController.php b/ground/controllers/IndexController.php index ffcfbf1..04f901e 100644 --- a/ground/controllers/IndexController.php +++ b/ground/controllers/IndexController.php @@ -36,7 +36,7 @@ class IndexController extends Controller if (!App::$user ) self::addScript('//ulogin.ru/js/ulogin.js'); - $category = Category::model()->getAll(); + $category = Category::model()->getAll(array('order' => 'ord ASC')); $routes = array(); if (App::$user && App::$user->id) From 93ba81e0d902af72dcb64f186a9407f830f2f5e2 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sun, 27 Jul 2014 01:26:47 +0400 Subject: [PATCH 3/6] =?UTF-8?q?FIX=20-=20=D1=81=D0=BE=D1=80=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B0,=20=D0=B2=D1=8B=D0=B2=D0=BE?= =?UTF-8?q?=D0=B4=20=D0=BD=D0=B8=D0=BA=D0=B0=20=D0=B2=D0=BC=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=BE=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/JsonController.php | 10 +++++----- ground/controllers/PageController.php | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ground/controllers/JsonController.php b/ground/controllers/JsonController.php index 795f421..b8bff34 100644 --- a/ground/controllers/JsonController.php +++ b/ground/controllers/JsonController.php @@ -9,7 +9,7 @@ class JsonController extends Controller static function actionPoints() { $points = Point::model()->getAll(); - $categories = Category::model()->getAll(array('asArray'=>true)); + $categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true)); $result = array(); @@ -41,9 +41,9 @@ class JsonController extends Controller $point->descriptionHtml = nl2br($point->description); $point->name = htmlspecialchars($point->name); - $categories = Category::model()->getAll(array('asArray'=>true)); + $categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true)); - $point->categoryIcon = $categories[$point->categoryId]['icon']; + $point->categoryIcon = $categories[$point->categoryId]['icon']; $point->categoryName = $categories[$point->categoryId]['name']; self::renderPartial('json.php', $point->getValues()); @@ -58,9 +58,9 @@ class JsonController extends Controller */ static function actionCategories() { - $categories = Category::model()->getAll(array('asArray'=>true)); + $categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true)); - self::renderPartial('json.php', array( + self::renderPartial('json.php', array( 'data' => $categories, )); } diff --git a/ground/controllers/PageController.php b/ground/controllers/PageController.php index 46d4637..9217e40 100644 --- a/ground/controllers/PageController.php +++ b/ground/controllers/PageController.php @@ -15,7 +15,7 @@ class PageController extends Controller $param['order']='id DESC'; $param['where']=App::getParam('category') ? 'categoryId = '.(int)App::getParam('category') : ''; $points = Point::model()->getAll($param); - $categories = Category::model()->getAll(); + $categories = Category::model()->getAll(array('order' => 'ord ASC')); $result = array(); @@ -25,8 +25,8 @@ class PageController extends Controller $result[$id]['name'] = $point->name; $result[$id]['lat'] = $point->lat; $result[$id]['lng'] = $point->lng; - $result[$id]['author'] = $point->authorUser->name; - $result[$id]['categoryId'] = $point->categoryId; + $result[$id]['author'] = $point->authorUser->nick; + $result[$id]['categoryId'] = $point->categoryId; $result[$id]['categoryIcon'] = $categories[$point->categoryId]->icon; } @@ -61,7 +61,7 @@ class PageController extends Controller $point->descriptionHtml = nl2br($point->description); $point->name = htmlspecialchars($point->name); - $categories = Category::model()->getAll(array('asArray' => true)); + $categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true)); $point->categoryIcon = $categories[$point->categoryId]['icon']; $point->categoryName = $categories[$point->categoryId]['name']; From 87bb8b5828356e836a96694c227aeeff4a774da2 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sun, 27 Jul 2014 01:51:09 +0400 Subject: [PATCH 4/6] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B9=20=D1=86?= =?UTF-8?q?=D0=B2=D0=B5=D1=82=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D1=82=D0=BE=D1=87?= =?UTF-8?q?=D0=B5=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/MarkerCluster.Default.css | 12 ++++++------ public/js/map.js | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/public/css/MarkerCluster.Default.css b/public/css/MarkerCluster.Default.css index bbc8c9f..55037d2 100644 --- a/public/css/MarkerCluster.Default.css +++ b/public/css/MarkerCluster.Default.css @@ -1,22 +1,22 @@ .marker-cluster-small { - background-color: rgba(181, 226, 140, 0.6); + background-color: rgba(100, 187, 100, 0.5); } .marker-cluster-small div { - background-color: rgba(110, 204, 57, 0.6); + background-color: rgba(34, 187, 34, 0.6); } .marker-cluster-medium { - background-color: rgba(241, 211, 87, 0.6); + background-color: rgba(255, 193, 100, 0.5); } .marker-cluster-medium div { - background-color: rgba(240, 194, 12, 0.6); + background-color: rgba(255, 193, 31, 0.6); } .marker-cluster-large { - background-color: rgba(253, 156, 115, 0.6); + background-color: rgba(187, 100, 100, 0.5); } .marker-cluster-large div { - background-color: rgba(241, 128, 23, 0.6); + background-color: rgba(187, 34, 34, 0.6); } /* IE 6-8 fallback colors */ diff --git a/public/js/map.js b/public/js/map.js index 239ab1d..c7d2c38 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -59,6 +59,7 @@ function init(lat, lng) { { $('#addPointId').remove(); $('#addPointForm input').val(''); + $('#addPointForm textarea').val(''); $("#addPointCategoryId option" ).attr('selected', null); $('#addPointLat').val(e.latlng.lat); $('#addPointLng').val(e.latlng.lng); From 4afeabf4980e5f4dc5c70eb5115e5e0ed05ec5f9 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Mon, 28 Jul 2014 11:08:47 +0400 Subject: [PATCH 5/6] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20og:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/IndexController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/controllers/IndexController.php b/ground/controllers/IndexController.php index 04f901e..ff0a081 100644 --- a/ground/controllers/IndexController.php +++ b/ground/controllers/IndexController.php @@ -61,8 +61,8 @@ class IndexController extends Controller $point->descriptionHtml .= ' Посмотреть на карте: http://wikipoints.ru/?point='.$id; $point->descriptionHtml .= ' #wikipoints'; - $og['title'] = $point->name . ' - wikipoints.ru'; - $og['description'] = 'http://wikipoints.ru/?point='.$id.' '.$point->descriptionHtml; + $og['title'] = $point->name . ' [wikipoints.ru]'; + $og['description'] = $point->descriptionHtml; $og['site_name'] = 'WikiPoints - '.$res['pointsCount'].' или даже больше поводов не сидеть дома'; $og['type'] = 'article'; $og['url'] = 'http://wikipoints.ru/?point='.$id; From c21d27aa1e53eac18bca58c1b6677ca64e8ae19f Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Mon, 28 Jul 2014 12:27:17 +0400 Subject: [PATCH 6/6] =?UTF-8?q?=D0=9F=D0=BE=D0=BA=D0=B0=D0=B7=20=D0=BC?= =?UTF-8?q?=D0=B5=D1=82=D1=80=D0=B8=D0=BA=D0=B8=20=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=BE=D1=82=D0=BA=D0=BB=D1=8E=D1=87=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/config_template.php | 1 + ground/views/layout.php | 107 ++++++++++++++++++++----------------- 2 files changed, 58 insertions(+), 50 deletions(-) diff --git a/ground/config_template.php b/ground/config_template.php index 856abe3..6fe890a 100644 --- a/ground/config_template.php +++ b/ground/config_template.php @@ -9,5 +9,6 @@ return array( 'dbname' => 'poi', ), //'version' => trim(file_get_contents(dirname(__FILE__).'/version')), + 'metrika' => true, ); diff --git a/ground/views/layout.php b/ground/views/layout.php index 94ee4fc..d6822bf 100644 --- a/ground/views/layout.php +++ b/ground/views/layout.php @@ -7,67 +7,74 @@ <?= App::getConfig('title') ?> - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - + $var): ?> + var = ''; + + + + - - - - - - - + if (w.opera == "[object Opera]") { + d.addEventListener("DOMContentLoaded", f, false); + } else { + f(); + } + })(document, window, "yandex_metrika_callbacks"); + + + + \ No newline at end of file