Map
Changes
web-map.sln 8(+1 -7)
web-map/Content/icon.png 0(+0 -0)
web-map/Content/Site.css 11(+11 -0)
web-map/Scripts/SiteScripts/Events.js 110(+109 -1)
web-map/Scripts/SiteScripts/Init.js 28(+11 -17)
web-map/Scripts/SiteScripts/Output.js 22(+22 -0)
web-map/Views/Map/Map.cshtml 30(+22 -8)
Details
web-map.sln 8(+1 -7)
diff --git a/web-map.sln b/web-map.sln
index 5e5b49e..913ce1e 100644
--- a/web-map.sln
+++ b/web-map.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.27703.2047
+VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "web-map", "web-map\web-map.csproj", "{E5B347F9-E5DE-4924-A35C-8EC13B26ED5B}"
ProjectSection(ProjectDependencies) = postProject
@@ -12,8 +12,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModelData", "ModelData\Mode
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools", "Tools\Tools.csproj", "{8B01B5F0-55B0-4992-8629-1C7298F28A7F}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test-app", "..\..\CONSOLE\test-app\test-app.csproj", "{24056192-61C3-4A7B-9CF5-CE255843D8AB}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -32,10 +30,6 @@ Global
{8B01B5F0-55B0-4992-8629-1C7298F28A7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B01B5F0-55B0-4992-8629-1C7298F28A7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B01B5F0-55B0-4992-8629-1C7298F28A7F}.Release|Any CPU.Build.0 = Release|Any CPU
- {24056192-61C3-4A7B-9CF5-CE255843D8AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {24056192-61C3-4A7B-9CF5-CE255843D8AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {24056192-61C3-4A7B-9CF5-CE255843D8AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {24056192-61C3-4A7B-9CF5-CE255843D8AB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
web-map/Content/icon.png 0(+0 -0)
diff --git a/web-map/Content/icon.png b/web-map/Content/icon.png
new file mode 100644
index 0000000..f8c9fd5
Binary files /dev/null and b/web-map/Content/icon.png differ
web-map/Content/Site.css 11(+11 -0)
diff --git a/web-map/Content/Site.css b/web-map/Content/Site.css
index 46ca91d..edb9213 100644
--- a/web-map/Content/Site.css
+++ b/web-map/Content/Site.css
@@ -180,3 +180,14 @@ a.article, a.article:hover {
#sidebar-right.active {
transform: translateX(+115%);
}
+
+#sidebar-right .sidebar-right-header {
+ position: sticky;
+ top: 0px;
+ padding: 15px;
+ background: #4d4d4d; /*#343a40;*/ /*.bg-dark*/
+}
+
+#sidebar-right .sidebar-right-text {
+ padding: 0.2rem 0.2rem;
+}
web-map/Scripts/SiteScripts/Events.js 110(+109 -1)
diff --git a/web-map/Scripts/SiteScripts/Events.js b/web-map/Scripts/SiteScripts/Events.js
index 2161e9c..40337a0 100644
--- a/web-map/Scripts/SiteScripts/Events.js
+++ b/web-map/Scripts/SiteScripts/Events.js
@@ -145,4 +145,112 @@ function compareValues(key, order = 'asc') {
(order == 'desc') ? (comparison * -1) : comparison
);
};
-}
\ No newline at end of file
+}
+
+function OpenRightPanel(addclass) {
+ $('#sidebar-right, #content').removeClass('active');
+ $('#sidebar-right, #content').addClass(addclass);
+ $('.collapse.in').toggleClass('in');
+ $('a[aria-expanded=true]').attr('aria-expanded', 'false');
+}
+
+function CloseRightPanel() {
+ $('#sidebar-right, #content').addClass('active');
+ $('#sidebar-right, #content').removeClass('export');
+ $('#sidebar-right, #content').removeClass('import');
+ $('.collapse.in').toggleClass('in');
+ $('a[aria-expanded=true]').attr('aria-expanded', 'false');
+}
+
+function exportSidebarButton() {
+ // панель закрыта
+ if ($('#sidebar-right, #content').hasClass('active')) {
+ switchRightSidebar('export');
+ OpenRightPanel('export');
+ }// панель открыта
+ else {
+ // был открыт импорт, нужно обновить содержимое
+ if ($('#sidebar-right, #content').hasClass('import')) {
+ switchRightSidebar('export');
+ $('#sidebar-right, #content').removeClass('import');
+ $('#sidebar-right, #content').addClass('export');
+ }
+ // был открыт экспорт, при повторном нажатии нужно скрыть панель
+ else
+ CloseRightPanel();
+ }
+}
+
+function importSidebarButton() {
+ // панель закрыта
+ if ($('#sidebar-right, #content').hasClass('active')) {
+ switchRightSidebar('import');
+ OpenRightPanel('import');
+ }// панель открыта
+ else {
+ // был открыт экспорт, нужно обновить содержимое
+ if ($('#sidebar-right, #content').hasClass('export')) {
+ switchRightSidebar('import');
+ $('#sidebar-right, #content').removeClass('export');
+ $('#sidebar-right, #content').addClass('import');
+ }
+ // был открыт импорт, при повторном нажатии нужно скрыть панель
+ else
+ CloseRightPanel();
+ }
+}
+
+function switchRightSidebar(flag) {
+ if (flag === 'export')
+ {
+ printExportCollection();
+ document.getElementById('sidebar-right-header-title').innerHTML = 'Экспорт';
+ document.getElementById('export-to-word').hidden = false;
+ document.getElementById('export-to-excel').hidden = false;
+ document.getElementById('sidebar-right-text-export').hidden = false;
+
+ document.getElementById('import-button').hidden = true;
+ document.getElementById('sidebar-right-text-import').hidden = true;
+ } else if (flag === 'import')
+ {
+ document.getElementById('sidebar-right-header-title').innerHTML = 'Импорт';
+ document.getElementById('export-to-word').hidden = true;
+ document.getElementById('export-to-excel').hidden = true;
+ document.getElementById('sidebar-right-text-export').hidden = true;
+
+ document.getElementById('import-button').hidden = false;
+ document.getElementById('sidebar-right-text-import').hidden = false;
+ }
+
+}
+
+function checkBoxChange(e) {
+ if (e.checked) {
+ // пользователь передумал и решил вернуть поселение в экспорт
+ var element = new Object();
+ element.name = e.parentElement.innerText;
+ element.url = e.id;
+ Collections.Export.push(element);
+ }
+ else
+ {
+ // пользователь убрал отметку экспорта. удаляем поселение из коллекции
+ // но отрисовку пока не делаем, вдруг он захочет вернуть отметку (т.е. добавить в экспорт)
+ Collections.Export = jQuery.grep(Collections.Export, function (element) {
+ return element.url != e.id;
+ });
+ }
+}
+
+function addToExport() {
+ var element = new Object();
+ element.name = $("#settlement-title")[0].innerHTML;
+ element.url = $("#settlement-url")[0].innerHTML;
+
+ // нельзя добавить уже добавленное поселение
+ if (!Collections.Export.some(currentValue => currentValue.url == element.url)){
+ Collections.Export.push(element);
+ printExportCollection();
+ }
+
+}
web-map/Scripts/SiteScripts/Init.js 28(+11 -17)
diff --git a/web-map/Scripts/SiteScripts/Init.js b/web-map/Scripts/SiteScripts/Init.js
index eb4cf0f..24eccda 100644
--- a/web-map/Scripts/SiteScripts/Init.js
+++ b/web-map/Scripts/SiteScripts/Init.js
@@ -167,24 +167,17 @@ function SliderInit() {
$('a[aria-expanded=true]').attr('aria-expanded', 'false');
});
- // Кнопка сокрытия правой боковой панели
- $('#sidebar-right-export').bind('click', OpenCloseRightPanel);
-
-}
+ // Обработчик кнопки лобавления поселения в экспорт
+ $('#add-to-export-group').bind('click', addToExport);
-// Обработчик кнопки сокрытия правой боковой панели
-function OpenCloseRightPanel() {
- if ($('#sidebar-right, #content').hasClass('active')) {
- // Панель скрыта. Должна выехать
- $('#sidebar-right, #content').removeClass('active');
- $('.collapse.in').toggleClass('in');
- $('a[aria-expanded=true]').attr('aria-expanded', 'false');
- }
- else {
- $('#sidebar-right, #content').addClass('active');
- $('.collapse.in').toggleClass('in');
- $('a[aria-expanded=true]').attr('aria-expanded', 'false');
- }
+ // Обработчик кнопки сокрытия правой боковой панели
+ $('#sidebar-right-close').bind('click', CloseRightPanel);
+
+ // Кнопка открытия правой боковой панели для экспорта
+ $('#sidebar-right-export').bind('click', exportSidebarButton);
+
+ // Кнопка открытия правой боковой панели для импорта
+ $('#sidebar-right-import').bind('click', importSidebarButton);
}
function AutoCompleteInit(data) {
@@ -222,4 +215,5 @@ function CollectionsInit() {
Collections.VisibleCount = 50;
Collections.Names = new Array();
Collections.Export = new Array();
+ Collections.test = '';
}
\ No newline at end of file
web-map/Scripts/SiteScripts/Output.js 22(+22 -0)
diff --git a/web-map/Scripts/SiteScripts/Output.js b/web-map/Scripts/SiteScripts/Output.js
index 935e892..bed5ca0 100644
--- a/web-map/Scripts/SiteScripts/Output.js
+++ b/web-map/Scripts/SiteScripts/Output.js
@@ -8,7 +8,13 @@ function PrintInfoAboutSettlement(info)
//jumbotron
+ /// здесь сохранить в глобал
+ /// потом использовать при редактировании
+ /// присвоить id каждому элементу и по нему вытаскивать в форму редактирования
+ /// сделать 2 класса для осн инф и для редактирования
var text = '<div class="sidebar-left-text-element">';
+ text += Test;
+ text += '<button type="button" class="btn btn-secondary"><img src="/Content/icon.png" width="20" height="20" /></button>';
text += '<p>' + 'Координаты: ' + info.Coordinate.Lat + ' ' + info.Coordinate.Long + '</p>';
if (info.Founder != null)
text += '<p>' + 'Основатель: ' + info.Founder + '</p>';
@@ -54,6 +60,22 @@ function PrintInfoAboutSettlement(info)
document.getElementById('sidebar-left-text').innerHTML = text;
}
+function printExportCollection() {
+ var text = '';
+ // т.к. используются формы (class="form-check...")
+ // то объекты в разметке получают стиль позиции relative
+ // данная позиция не корректно взаимодействует со скроллбаром и шапкой формы, которая имеет позицию sticky
+ // я не знаю как это лучше исправить
+ // предполагаю, что можно убрать классы и оставить только label и checkbox, тогда их позиции станут fixed и все станет норм
+ Collections.Export.forEach(function (element) {
+ text += '<div class="form-check">';//style="position: sticky;"
+ text += ' <input class="form-check-input" type="checkbox" value="" id="' + element.url + '" checked onchange="checkBoxChange(this)">';
+ text += ' <label class="form-check-label" for="' + element.url + '" data-toggle="tooltip" data-placement="top" title="' + element.url + '">' + element.name + '</label>';
+ text += '</div>';
+ });
+ $("#sidebar-right-text-export")[0].innerHTML = text;
+}
+
// Функция выгружает все гео-объекты из данной коллекции на карту
function PlaceFromCollection() {
CollectionVisible.addToMap(Map);
web-map/Views/Map/Map.cshtml 30(+22 -8)
diff --git a/web-map/Views/Map/Map.cshtml b/web-map/Views/Map/Map.cshtml
index f6a2cbd..8740596 100644
--- a/web-map/Views/Map/Map.cshtml
+++ b/web-map/Views/Map/Map.cshtml
@@ -11,6 +11,7 @@
<div class="d-flex justify-content-center btn-group w-100" role="group">
<button id="sidebar-left-close" class="btn btn-secondary" type="button">Скрыть<br>панель</button>
<button id="add-to-export-group" class="btn btn-secondary" type="button">Добавить<br>в экспорт</button>
+
</div>
</div>
<div id="sidebar-left-text" class="sidebar-left-text">
@@ -20,18 +21,22 @@
<div class="wrapper">
<!-- боковая правая панель -->
- <nav id="sidebar-right" class="active rounded-right">
- @*<div id="sidebar-right-header" class="sidebar-right-header display-3 rounded-right">
- <h2 id="settlement-title" class="text-center"></h2>
- <label id="settlement-url" hidden>111111</label>
+ <nav id="sidebar-right" class="active rounded-left">
+ <div id="sidebar-right-header" class="sidebar-right-header display-3 rounded-left">
+ <h2 id="sidebar-right-header-title" class="text-center"></h2>
<div class="d-flex justify-content-center btn-group w-100" role="group">
<button id="sidebar-right-close" class="btn btn-secondary" type="button">Скрыть<br>панель</button>
- <button id="add-to-export-group" class="btn btn-secondary" type="button">Добавить<br>в экспорт</button>
+ <button hidden id="export-to-word" class="btn btn-secondary" type="button">Экспорт<br>в Word</button>
+ <button hidden id="export-to-excel" class="btn btn-secondary" type="button">Экспорт<br>в Excel</button>
+ <button hidden id="import-button" class="btn btn-secondary" type="button">Отправить<br>данные</button>
</div>
</div>
<div id="sidebar-right-text" class="sidebar-right-text">
- </div>*@
- <h2>тут что-то есть</h2>
+ <div hidden id="sidebar-right-text-export"></div>
+ <div hidden id="sidebar-right-text-import">
+ <p>тут импорт</p>
+ </div>
+ </div>
</nav>
</div>
@@ -46,7 +51,7 @@
<button id="sidebar-right-export" type="button" class="btn btn-secondary">Экспорт</button>
@if ((bool)ViewBag.isAuth)
{
- <button id="sidebar-import-export" type="button" class="btn btn-secondary">Импорт</button>
+ <button id="sidebar-right-import" type="button" class="btn btn-secondary">Импорт</button>
}
</div>
</div>
@@ -64,6 +69,15 @@
</div>
<div id="map" style="width: 100%; height: 1000px; padding-left: 0px; "></div>
+<script>
+ var Test = '';
+</script>
+@if ((bool)ViewBag.isAuth)
+{
+ <script>
+ Test = '<p>111111</p>';
+ </script>
+}
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU&apikey=0ea4f7d6-01f0-471d-b717-ada9d94faa49&lang=ru_RU" type="text/javascript"></script>
@section Scripts {@Scripts.Render("~/Scripts/SiteScripts/AjaxQuery.js",