more readonly handlers

This commit is contained in:
Ilya Zverev 2015-03-27 14:42:34 +03:00
parent 9e31fc992f
commit 56127ae801
2 changed files with 8 additions and 4 deletions

View file

@ -6,7 +6,7 @@ var FILL_ZERO = 'black';
var OLD_BORDERS_NAME; // filled in checkHasOSM()
var IMPORT_ENABLED = false;
var map, borders = {}, bordersLayer, selectedId, editing = false;
var map, borders = {}, bordersLayer, selectedId, editing = false, readonly = false;
var size_good = 5, size_bad = 50;
var tooSmallLayer = null;
var oldBordersLayer = null;
@ -54,6 +54,8 @@ function checkHasOSM() {
if( res.readonly ) {
$('#action_buttons').css('display', 'none');
$('#import_link').css('display', 'none');
$('#backups').css('display', 'none');
readonly = true;
}
if( !res.readonly && IMPORT_ENABLED ) {
$('#import_link').css('display', 'none');
@ -352,7 +354,7 @@ function bImport() {
}
function bShowRename() {
if( !selectedId || !(selectedId in borders) )
if( !selectedId || !(selectedId in borders) || readonly )
return;
$('#b_rename').val(borders[selectedId].name);
$('#rename').css('display', 'block');

View file

@ -61,7 +61,9 @@
<form action="" enctype="multipart/form-data" method="post" id="filefm" target="import_frame">
Импорт <input type="file" accept=".osm,.xml" name="file" id="b_import" onchange="bImport();" style="max-width: 100px;">
</form>
<button onclick="bBackup()">Архив границ</button><br>
<div id="backups">
<button onclick="bBackup()">Архив границ</button><br>
</div>
<div id="old_action">
<input type="checkbox" id="old" onchange="bOldBorders()"><label for="old"> старые границы</label>
</div>
@ -87,7 +89,7 @@
</div>
<div id="info">
<b><a href="#" onclick="bShowRename(); return false;">Название:</a></b>
<b><a href="#" id="name_link" onclick="bShowRename(); return false;">Название:</a></b>
<span id="b_name"></span><br>
<div id="rename">
<input type="text" id="b_rename">