Rebrand to FacilMap

pull/54/merge
Candid Dauth 2016-10-18 21:27:57 +03:00
rodzic 5f5444aebe
commit d3dbd8c446
53 zmienionych plików z 414 dodań i 407 usunięć

Wyświetl plik

@ -4,16 +4,16 @@ MAINTAINER Candid Dauth <cdauth@cdauth.eu>
CMD npm run server
EXPOSE 8080
RUN useradd -m -d /opt/facilpad -s /bin/bash facilpad
WORKDIR /opt/facilpad
RUN useradd -m -d /opt/facilmap -s /bin/bash facilmap
WORKDIR /opt/facilmap
COPY ./ ./
RUN chown -R facilpad:facilpad .
RUN chown -R facilmap:facilmap .
USER facilpad
USER facilmap
RUN npm run deps && npm run clean && npm run build && npm install mysql pg sqlite3 tedious
USER root
RUN chown -R root:root .
USER facilpad
USER facilmap

Wyświetl plik

@ -1,7 +1,7 @@
{
"name": "facilpad",
"name": "facilmap2",
"version": "0.1.0",
"homepage": "https://github.com/rankenstein/facilpad",
"homepage": "https://github.com/FacilMap/facilmap2",
"authors": [
"Candid Dauth <cdauth@cdauth.eu>"
],

Wyświetl plik

@ -1,13 +1,13 @@
module.exports = {
userAgent : process.env.USER_AGENT || 'FacilPad (https://pad.facilmap.org/, cdauth@cdauth.eu)',
userAgent : process.env.USER_AGENT || 'FacilMap (https://pad.facilmap.org/, cdauth@cdauth.eu)',
host : null,
port : 8080,
db : {
type: process.env.DB_TYPE || "mysql", // mysql, postgres, mariadb, sqlite
host: process.env.DB_HOST || "localhost",
port: process.env.DB_PORT || null,
database: process.env.DB_NAME || "facilpad",
user: process.env.DB_USER || "facilpad",
database: process.env.DB_NAME || "facilmap",
user: process.env.DB_USER || "facilmap",
password: process.env.DB_PASSWORD || "password"
}
};

Wyświetl plik

@ -1,10 +1,10 @@
var FacilPad = {
var FacilMap = {
SERVER : "/"
};
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app = angular.module("facilpad", [ "ui.sortable", "ui.bootstrap" ]).config(function($compileProvider, $uibTooltipProvider) {
fm.app = angular.module("facilmap", [ "ui.sortable", "ui.bootstrap" ]).config(function($compileProvider, $uibTooltipProvider) {
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|javascript):/);
$uibTooltipProvider.options({
@ -12,9 +12,9 @@ var FacilPad = {
});
});
fp.app.constant("L", L);
fp.app.constant("linkifyStr", linkifyStr);
fp.app.constant("Clipboard", Clipboard);
fm.app.constant("L", L);
fm.app.constant("linkifyStr", linkifyStr);
fm.app.constant("Clipboard", Clipboard);
// Dereferrer
$(document).on("click", "a", function(e) {
@ -29,12 +29,12 @@ var FacilPad = {
}
});
fp.app.run([ "$rootScope", "fpUtils", function($rootScope, fpUtils) {
fm.app.run(function($rootScope, fmUtils) {
$rootScope.urlPrefix = location.protocol + "//" + location.host + location.pathname.replace(/[^\/]*$/, "");
$rootScope.round = fpUtils.round;
$rootScope.formatTime = fpUtils.formatTime;
$rootScope.routingMode = fpUtils.routingMode;
$rootScope.round = fmUtils.round;
$rootScope.formatTime = fmUtils.formatTime;
$rootScope.routingMode = fmUtils.routingMode;
$rootScope.sortableOptions = {
handle: ".sort-handle",
@ -59,7 +59,7 @@ var FacilPad = {
});
}
};
} ]);
});
function wrapApply($scope, f) {
return function() {
@ -74,15 +74,15 @@ var FacilPad = {
}
}
Function.prototype.fpWrapApply = function($scope) {
Function.prototype.fmWrapApply = function($scope) {
return wrapApply($scope, this);
};
fp.app.controller("PadCtrl", function($scope, fpMap, $timeout) {
fm.app.controller("PadCtrl", function($scope, fmMap, $timeout) {
$scope.padId = location.pathname.match(/[^\/]*$/)[0];
$timeout(function() {
var map = fpMap.getMap("map");
var map = fmMap.getMap("map");
map.socket.$watch("padData.name", function(newVal) {
$scope.padName = newVal;
@ -96,4 +96,4 @@ var FacilPad = {
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,14 +1,14 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.directive("fpTypeField", [ "$parse", "$compile", function($parse, $compile) {
fm.app.directive("fmTypeField", function($parse, $compile) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
if($parse(attrs.fpTypeFieldModel)(scope) == null)
$parse(attrs.fpTypeFieldModel+'='+attrs.fpTypeField+'.default')(scope);
if($parse(attrs.fmTypeFieldModel)(scope) == null)
$parse(attrs.fmTypeFieldModel+'='+attrs.fmTypeField+'.default')(scope);
var update = function() {
var field = $parse(attrs.fpTypeField)(scope);
var field = $parse(attrs.fmTypeField)(scope);
var el;
switch(field.type) {
@ -32,52 +32,52 @@
break;
}
el.attr("ng-model", attrs.fpTypeFieldModel);
el.attr("ng-model", attrs.fmTypeFieldModel);
if(attrs.fpTypeFieldId)
el.attr("id", attrs.fpTypeFieldId);
if(attrs.fmTypeFieldId)
el.attr("id", attrs.fmTypeFieldId);
el.appendTo(element.empty());
$compile(el)(scope);
scope.$evalAsync(); // $compile only replaces variables on next digest
};
scope.$watch(attrs.fpTypeField+".type", update);
scope.$watch(attrs.fpTypeField+".options", update, true);
if(attrs.fpTypeFieldIgnoreDefault == null)
scope.$watch(attrs.fpTypeField+".default", update);
scope.$watch(attrs.fmTypeField+".type", update);
scope.$watch(attrs.fmTypeField+".options", update, true);
if(attrs.fmTypeFieldIgnoreDefault == null)
scope.$watch(attrs.fmTypeField+".default", update);
}
};
} ]);
});
fp.app.directive("fpTypeFieldContent", [ "$parse", "fpTypeFields", function($parse, fpTypeFields) {
fm.app.directive("fmTypeFieldContent", function($parse, fmTypeFields) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var update = function() {
var field = $parse(attrs.fpTypeFieldContent)(scope);
var value = $parse(attrs.fpTypeFieldModel)(scope);
var field = $parse(attrs.fmTypeFieldContent)(scope);
var value = $parse(attrs.fmTypeFieldModel)(scope);
element.empty().append(fpTypeFields.formatField(field, value));
element.empty().append(fmTypeFields.formatField(field, value));
};
scope.$watch(attrs.fpTypeFieldModel, update);
scope.$watch(attrs.fpTypeFieldContent+".type", update);
scope.$watch(attrs.fpTypeFieldContent+".options", update, true);
if(attrs.fpTypeFieldIgnoreDefault == null)
scope.$watch(attrs.fpTypeFieldContent+".default", update);
scope.$watch(attrs.fmTypeFieldModel, update);
scope.$watch(attrs.fmTypeFieldContent+".type", update);
scope.$watch(attrs.fmTypeFieldContent+".options", update, true);
if(attrs.fmTypeFieldIgnoreDefault == null)
scope.$watch(attrs.fmTypeFieldContent+".default", update);
}
}
} ]);
});
fp.app.factory("fpTypeFields", [ "fpMarked", function(fpMarked) {
fm.app.factory("fmTypeFields", function(fmMarked) {
return {
formatField : function(field, value) {
if(value == null)
value = field['default'] || "";
switch(field.type) {
case "textarea":
return fpMarked.block(value);
return fmMarked.block(value);
case "checkbox":
return value == "1" ? "✔" : "✘";
case "dropdown":
@ -97,10 +97,10 @@
return val || "";
case "input":
default:
return fpMarked.inline(value);
return fmMarked.inline(value);
}
}
}
}])
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,9 +1,9 @@
<div class="modal-header">
<button class="close" ng-click="$dismiss()"><span aria-hidden="true">&times;</span></button>
<h3 class="modal-title">About FacilPad</h3>
<h3 class="modal-title">About FacilMap</h3>
</div>
<div class="modal-body">
<p>FacilPad is available under the <a href="https://www.gnu.org/licenses/agpl-3.0.en.html" target="_blank">GNU Affero General Public License, Version 3</a>. The source code can be found <a href="https://github.com/FacilMap/facilpad" target="_blank">on GitHub</a>.</p>
<p>FacilMap is available under the <a href="https://www.gnu.org/licenses/agpl-3.0.en.html" target="_blank">GNU Affero General Public License, Version 3</a>. The source code can be found <a href="https://github.com/FacilMap/facilmap2" target="_blank">on GitHub</a>.</p>
<h4>Programs/libraries</h4>
<ul class="list-inline">
<li><a href="https://nodejs.org/" target="_blank">Node.js</a></li>

Wyświetl plik

@ -1,13 +1,13 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapAbout", function($uibModal) {
fm.app.factory("fmMapAbout", function($uibModal) {
return function(map) {
return {
showAbout : function() {
$uibModal.open({
templateUrl: "map/about/about.html",
scope: map.socket,
controller: "fpMapAboutCtrl",
controller: "fmMapAboutCtrl",
size: "lg",
resolve: {
map: function() { return map; }
@ -18,8 +18,8 @@
};
});
fp.app.controller("fpMapAboutCtrl", function($scope, map) {
fm.app.controller("fmMapAboutCtrl", function($scope, map) {
$scope.layers = map.getLayerInfo();
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,4 +1,4 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
function _parseBbox(bboxStr) {
if(!bboxStr)
@ -18,7 +18,7 @@
return ret;
}
fp.app.factory("fpMapGpx", function(fpSocket, $rootScope, fpTypeFields) {
fm.app.factory("fmMapGpx", function() {
return function(map) {
return {
exportGpx : function() {
@ -33,4 +33,4 @@
};
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,11 +1,11 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapImport", function($q) {
fm.app.factory("fmMapImport", function($q) {
return function(map) {
var fileEl = $('<input type="file" multiple="multiple">').css("display", "none").appendTo("body");
fileEl.one("change", function() {
fpMapImport.importFiles(fileEl.prop("files"));
fmMapImport.importFiles(fileEl.prop("files"));
});
map.el.on("dragenter", false);
@ -13,10 +13,10 @@
map.el.on("drop", function(e) {
e.preventDefault();
fpMapImport.importFiles(e.originalEvent.dataTransfer.files);
fmMapImport.importFiles(e.originalEvent.dataTransfer.files);
});
var fpMapImport = {
var fmMapImport = {
openImportDialog: function() {
fileEl.click();
},
@ -40,8 +40,8 @@
}
};
return fpMapImport;
return fmMapImport;
}
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,4 +1,4 @@
.fp-map-legend {
.fm-map-legend {
position: absolute;
right: 10px;
bottom: 25px;
@ -10,11 +10,11 @@
transition: opacity .7s;
}
.fp-map-legend .mobile-menu-button {
.fm-map-legend .mobile-menu-button {
margin-left: auto;
}
.fp-map-legend .panel {
.fm-map-legend .panel {
overflow-y: auto;
/* Somehow Chrome shows a horizontal scrollbar with anything else than this */
@ -24,60 +24,60 @@
margin-bottom: 0;
}
.fp-map-legend:hover {
.fm-map-legend:hover {
opacity: 1;
}
.fp-map-legend h3 {
.fm-map-legend h3 {
font-size: 1.1em;
margin: 0 0 5px 0;
padding: 0;
font-weight: bold;
}
.fp-map-legend hr {
.fm-map-legend hr {
margin: 10px -8px;
}
.fp-map-legend dl {
.fm-map-legend dl {
margin-bottom: 0px;
}
.fp-map-legend dt {
.fm-map-legend dt {
margin: 0;
width: auto;
padding-right: .3ex;
display: inline;
}
.fp-map-legend dt:after {
.fm-map-legend dt:after {
content: none;
}
.fp-map-legend dd {
.fm-map-legend dd {
line-height: 1.3em;
width: auto;
display: inline;
vertical-align: middle;
}
.fp-map-legend dd:after {
.fm-map-legend dd:after {
content: "\a";
white-space: pre;
}
.fp-map-legend dl:after {
.fm-map-legend dl:after {
content: none;
}
.fp-map-legend-line {
.fm-map-legend-line {
display: inline-block;
width: 50px;
border-radius: 2px;
vertical-align: middle;
}
.fp-map-legend-marker {
.fm-map-legend-marker {
height: 1.3em;
vertical-align: middle;
}

Wyświetl plik

@ -1,4 +1,4 @@
<div class="fp-map-legend">
<div class="fm-map-legend">
<div class="panel panel-default" ng-show="legendItems.length > 0" ng-class="{'hidden-xs': !showXs}">
<div class="panel-body">
<hr ng-repeat-start="type in legendItems" ng-if="$index > 0">

Wyświetl plik

@ -1,20 +1,20 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapLegend", [ "$sce", "fpUtils", "$templateCache", "$compile", function($sce, fpUtils, $templateCache, $compile) {
fm.app.factory("fmMapLegend", function($sce, fmUtils, $templateCache, $compile) {
return function(map) {
var scope = map.socket.$new();
scope.makeSymbol = function(type, item) {
var ret;
if(type == "line") {
ret = $('<span class="fp-map-legend-line"></span>');
ret = $('<span class="fm-map-legend-line"></span>');
ret.css("background-color", "#"+(item.colour || "ffffff"));
ret.css("box-shadow", "0 0 1px #"+fpUtils.makeTextColour(item.colour || "ffffff", 0.7));
ret.css("box-shadow", "0 0 1px #"+fmUtils.makeTextColour(item.colour || "ffffff", 0.7));
ret.css("height", (item.width || 5)+"px");
}
else
ret = $('<img class="fp-map-legend-marker"/>').attr("src", fpUtils.createMarkerGraphic(item.colour, null, "legend"));
ret = $('<img class="fm-map-legend-marker"/>').attr("src", fmUtils.createMarkerGraphic(item.colour, null, "legend"));
return $sce.trustAsHtml($("<div/>").append(ret).html());
};
@ -64,6 +64,6 @@
scope.$watch(getMaxHeight, resize);
$(window).resize(resize);
};
} ]);
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -24,25 +24,25 @@
<div class="form-group" ng-show="canControl('colour')">
<label for="edit-line-colour" class="col-sm-3 control-label">Colour</label>
<div class="col-sm-9"><input id="edit-line-colour" ng-model="line.colour" fp-colour-picker class="form-control"></div>
<div class="col-sm-9"><input id="edit-line-colour" ng-model="line.colour" fm-colour-picker class="form-control"></div>
</div>
<div class="form-group" ng-show="canControl('width')">
<label for="edit-line-width" class="col-sm-3 control-label">Width</label>
<div class="col-sm-9"><input id="edit-line-width" ng-model="line.width" fp-spinner class="form-control" /></div>
<div class="col-sm-9"><input id="edit-line-width" ng-model="line.width" fm-spinner class="form-control" /></div>
</div>
<div class="form-group" ng-repeat="field in types[line.typeId].fields" ng-show="field.type != 'dropdown' || field.options.length > 1">
<label for="line-{{$index}}-input" class="col-sm-3 control-label">{{field.name}}</label>
<div class="col-sm-9" fp-type-field="field" fp-type-field-model="line.data[field.name]" fp-type-field-id="line-{{$index}}-input"></div>
<div class="col-sm-9" fm-type-field="field" fm-type-field-model="line.data[field.name]" fm-type-field-id="line-{{$index}}-input"></div>
</div>
</form>
</div>
<div class="modal-footer">
<div class="btn-group pull-left" uib-dropdown ng-if="(types | fpPropertyCount:{type:'line'}) > 1">
<div class="btn-group pull-left" uib-dropdown ng-if="(types | fmPropertyCount:{type:'line'}) > 1">
<button id="change-type-button" type="button" class="btn btn-default" uib-dropdown-toggle>Change type <span class="caret"></span></button>
<ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="change-type-button" uib-dropdown-menu>
<li role="menuitem" ng-repeat="type in types | fpObjectFilter:{type:'line'}" ng-class="{active: type.id == line.typeId}"><a href="#" ng-click="line.typeId = type.id">{{type.name}}</a></li>
<li role="menuitem" ng-repeat="type in types | fmObjectFilter:{type:'line'}" ng-class="{active: type.id == line.typeId}"><a href="#" ng-click="line.typeId = type.id">{{type.name}}</a></li>
</ul>
</div>

Wyświetl plik

@ -1,6 +1,6 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapLines", function(fpUtils, $uibModal, $templateCache, $compile, $timeout) {
fm.app.factory("fmMapLines", function(fmUtils, $uibModal, $templateCache, $compile, $timeout) {
return function(map) {
var linesById = { };
var editingLineId = null;
@ -46,16 +46,16 @@
.on("popupclose", function(e) {
ng.element(e.popup.getContent()).scope().$destroy();
})
.on("fp-almostover", function(e) {
.on("fm-almostover", function(e) {
if(!linesById[line.id].getTooltip())
linesById[line.id].bindTooltip("", $.extend({}, map.tooltipOptions, { permanent: true, offset: [ 20, 0 ] }));
linesById[line.id].setTooltipContent(fpUtils.quoteHtml(map.socket.lines[line.id].name)).openTooltip(e.latlng);
linesById[line.id].setTooltipContent(fmUtils.quoteHtml(map.socket.lines[line.id].name)).openTooltip(e.latlng);
})
.on("fp-almostmove", function(e) {
.on("fm-almostmove", function(e) {
linesById[line.id].openTooltip(e.latlng)
})
.on("fp-almostout", function() {
.on("fm-almostout", function() {
linesById[line.id].closeTooltip();
});
}
@ -153,7 +153,7 @@
function createTempMarker(huge) {
var marker = L.marker([0,0], {
icon: fpUtils.createMarkerIcon(map.dragMarkerColour, huge),
icon: fmUtils.createMarkerIcon(map.dragMarkerColour, huge),
draggable: true
})
.on("dblclick", function() {
@ -202,7 +202,7 @@
temporaryHoverMarker.remove();
}
linesById[line.id].on("fp-almostover", _over).on("fp-almostmove", _move).on("fp-almostout", _out);
linesById[line.id].on("fm-almostover", _over).on("fm-almostmove", _move).on("fm-almostout", _out);
function makeTemporaryHoverMarker() {
temporaryHoverMarker = createTempMarker(true);
@ -211,11 +211,11 @@
temporaryHoverMarker.once("dragend", function() {
// We have to replace the huge icon with the regular one at the end of the dragging, otherwise
// the dragging gets interrupted
this.setIcon(fpUtils.createMarkerIcon("ffd700"));
this.setIcon(fmUtils.createMarkerIcon("ffd700"));
}, temporaryHoverMarker);
var latlng = temporaryHoverMarker.getLatLng();
var idx = fpUtils.getIndexOnLine(map.map, line.routePoints, line.routePoints, latlng);
var idx = fmUtils.getIndexOnLine(map.map, line.routePoints, line.routePoints, latlng);
markers.splice(idx, 0, temporaryHoverMarker);
line.routePoints.splice(idx, 0, { lat: latlng.lat, lon: latlng.lng });
@ -244,7 +244,7 @@
var dialog = $uibModal.open({
templateUrl: "map/lines/edit-line.html",
scope: map.socket,
controller: "fpMapLineEditCtrl",
controller: "fmMapLineEditCtrl",
size: "lg",
resolve: {
line: function() { return line; },
@ -252,7 +252,8 @@
}
});
var preserve = fpUtils.preserveObject(map.socket, "lines["+fpUtils.quoteJavaScript(line.id)+"]", "line", function() {
// TODO: use child scope!
var preserve = fmUtils.preserveObject(map.socket, "lines["+fmUtils.quoteJavaScript(line.id)+"]", "line", function() {
dialog.dismiss();
});
@ -365,7 +366,7 @@
};
});
fp.app.controller("fpMapLineEditCtrl", function($scope, map, line) {
fm.app.controller("fmMapLineEditCtrl", function($scope, map, line) {
$scope.line = line;
$scope.canControl = function(what) {
@ -391,4 +392,4 @@
});
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -5,7 +5,7 @@
<dd class="distance">{{round(line.distance, 2)}} km <span ng-show="line.time != null">({{formatTime(line.time)}} h {{routingMode(line.mode)}})</span></dd>
<dt ng-repeat-start="field in types[line.typeId].fields" ng-show="field.type != 'dropdown' || field.options.length > 1">{{field.name}}</dt>
<dd ng-repeat-end ng-show="field.type != 'dropdown' || field.options.length > 1" fp-type-field-content="field" fp-type-field-model="line.data[field.name]"></dd>
<dd ng-repeat-end ng-show="field.type != 'dropdown' || field.options.length > 1" fm-type-field-content="field" fm-type-field-model="line.data[field.name]"></dd>
</dl>
</div>
<div class="buttons" ng-if="!readonly">

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 12 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 7.8 KiB

Wyświetl plik

@ -14,7 +14,7 @@
id="svg2"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="logo.svg"
sodipodi:docname="logo_inkscape.svg"
inkscape:export-filename="/home/candid/Documents/workspace/programming/web/osm/facilmap/api/src/resources/img/logo_svg.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
@ -135,9 +135,9 @@
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="-0.37769262"
inkscape:cy="15.295823"
inkscape:zoom="2.8284272"
inkscape:cx="97.20665"
inkscape:cy="71.578505"
inkscape:document-units="px"
inkscape:current-layer="g3065"
showgrid="false"
@ -220,7 +220,7 @@
id="tspan2995"
x="99.433052"
y="83.994766"
style="font-size:19.88685036px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;letter-spacing:-1.23147881;font-family:Open Sans;-inkscape-font-specification:Open Sans Bold">Pad</tspan></text>
style="font-size:19.88685036px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;letter-spacing:-1.23147881;font-family:Open Sans;-inkscape-font-specification:Open Sans Bold">Map</tspan></text>
</g>
</g>
</g>

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 7.8 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 7.8 KiB

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -2,24 +2,24 @@
height: 100%;
}
#map.fp-overFeature {
#map.fm-overFeature {
cursor: pointer;
}
.fp-map {
.fm-map {
width: 100%;
height: 100%;
}
.fp-almostover {
.fm-almostover {
cursor: pointer !important;
}
.leaflet-fpClickListener-pane .leaflet-interactive {
.leaflet-fmClickListener-pane .leaflet-interactive {
cursor: crosshair;
}
.fp-map-disabled-cover {
.fm-map-disabled-cover {
background-color: #888;
opacity: 0.7;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
@ -33,7 +33,7 @@
height: 100%;
}
.fp-map-loading {
.fm-map-loading {
position:absolute;
top:0;
left:0;
@ -46,7 +46,7 @@
font-weight:bold;
}
.fp-map-spinner {
.fm-map-spinner {
position:absolute;
bottom: 7px;
left: 102px;
@ -57,22 +57,22 @@
box-sizing: content-box;
}
.fp-attribution-icon {
.fm-attribution-icon {
position: absolute;
bottom: -45px;
left: -37px;
bottom: -19px;
left: -25px;
}
.fp-popup .leaflet-popup-content {
.fm-popup .leaflet-popup-content {
margin: 0;
}
.fp-popup p {
.fm-popup p {
/* Restore bootstrap style, is overridden by leaflet */
margin: 0 0 10px;
}
.fp-popup .content {
.fm-popup .content {
height: 200px;
overflow: auto;
@ -85,11 +85,11 @@
margin: 20px 0 7px 15px;
}
.fp-popup .content h2 {
.fm-popup .content h2 {
margin-top: 0;
}
.fp-popup .buttons {
.fm-popup .buttons {
position: absolute;
background: #fff;
bottom: 0;
@ -100,12 +100,12 @@
border-bottom-left-radius: 10px;
}
.fp-popup .buttons div {
.fm-popup .buttons div {
display: inline-block;
}
/* Copy dl-horizontal styles, modify sizing, also apply for small screens (as popup size is always the same) */
.fp-popup .dl-horizontal dt {
.fm-popup .dl-horizontal dt {
float: left;
width: 29%;
overflow: hidden;
@ -115,7 +115,7 @@
white-space: nowrap;
}
.fp-popup .dl-horizontal dd {
.fm-popup .dl-horizontal dd {
margin-left: 33%;
}

Wyświetl plik

@ -1,10 +1,10 @@
<div class="fp-map">
<img src="logo.png" class="fp-attribution-icon"/>
<div class="fp-map-spinner" ng-show="loading > 0">
<div class="fm-map">
<img src="logo.png" class="fm-attribution-icon"/>
<div class="fm-map-spinner" ng-show="loading > 0">
<img src="spinner.gif" alt="Loading…">
</div>
</div>
<div class="fp-map-disabled-cover" ng-show="disconnected || serverError"></div>
<div class="fp-map-loading" ng-hide="loaded || serverError">
<div class="fm-map-disabled-cover" ng-show="disconnected || serverError"></div>
<div class="fm-map-loading" ng-hide="loaded || serverError">
Loading...
</div>

Wyświetl plik

@ -1,15 +1,15 @@
(function(fp, $, ng, fm, ol, undefined) {
(function(fm, $, ng, undefined) {
fp.app.directive("fpMap", function(fpMap) {
fm.app.directive("facilmap", function(fmMap) {
return {
restrict: 'EA',
link: function(scope, element, attrs) {
fpMap.initMap(element, attrs.id, attrs.fpPadId);
fmMap.initMap(element, attrs.id, attrs.fmMapId);
}
};
});
fp.app.factory("fpMap", function(fpUtils, fpSocket, fpMapMessages, fpMapMarkers, $templateCache, $compile, fpMapLines, fpMapTypes, fpMapViews, $rootScope, fpMapPad, fpMapToolbox, $timeout, fpMapLegend, fpMapSearch, fpMapGpx, fpMapAbout, $sce, L, fpMapImport) {
fm.app.factory("fmMap", function(fmUtils, fmSocket, fmMapMessages, fmMapMarkers, $templateCache, $compile, fmMapLines, fmMapTypes, fmMapViews, $rootScope, fmMapPad, fmMapToolbox, $timeout, fmMapLegend, fmMapSearch, fmMapGpx, fmMapAbout, $sce, L, fmMapImport) {
var maps = { };
var ret = { };
@ -29,60 +29,65 @@
map.el = el;
map.mapEvents = $rootScope.$new(true); /* Event types: click, layerchange */
map.socket = fpSocket(padId);
map.socket = fmSocket(padId);
map.layers = { };
[
L.gridLayer({
fmName: "Empty",
fmBase: true,
fmKey: "empt"
}),
L.tileLayer("http://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}", {
fpName: "MapSurfer Road",
fpBase: true,
fpKey: "MSfR",
fmName: "MapSurfer Road",
fmBase: true,
fmKey: "MSfR",
attribution: $sce.trustAsHtml('© <a href="http://korona.geog.uni-heidelberg.de/" target="_blank">OpenMapSurfer</a> / <a href="http://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>'),
noWrap: true
}),
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
fpName: "Mapnik",
fpBase: true,
fpKey: "Mpnk",
fmName: "Mapnik",
fmBase: true,
fmKey: "Mpnk",
attribution: $sce.trustAsHtml('© <a href="http://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>'),
noWrap: true
}),
L.tileLayer("https://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png", {
fpName: "OpenCycleMap",
fpBase: true,
fpKey: "OCyc",
fmName: "OpenCycleMap",
fmBase: true,
fmKey: "OCyc",
attribution: $sce.trustAsHtml('© <a href="https://opencyclemap.org/" target="_blank">OpenCycleMap</a> / <a href="http://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>'),
noWrap: true
}),
L.tileLayer("http://{s}.tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png", {
fpName: "Hike & Bike Map",
fpBase: true,
fpKey: "HiBi",
fmName: "Hike & Bike Map",
fmBase: true,
fmKey: "HiBi",
attribution: $sce.trustAsHtml('© <a href="http://hikebikemap.org/" target="_blank">Hike &amp; Bike Map</a> / <a href="http://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>'),
noWrap: true
}),
L.tileLayer("http://openptmap.org/tiles/{z}/{x}/{y}.png", {
fpName: "Public transportation",
fpKey: "OPTM",
fmName: "Public transportation",
fmKey: "OPTM",
attribution: $sce.trustAsHtml('© <a href="http://openptmap.org/" target="_blank">OpenPTMap</a> / <a href="http://www.openstreetmap.org/copyright" target="_blank">OSM Contributors</a>'),
zIndex: 300,
noWrap: true
}),
L.tileLayer("http://korona.geog.uni-heidelberg.de/tiles/asterh/x={x}&y={y}&z={z}", {
fpName: "Relief",
fpKey: "Rlie",
fmName: "Relief",
fmKey: "Rlie",
attribution: $sce.trustAsHtml('© <a href="http://korona.geog.uni-heidelberg.de/" target="_blank">OpenMapSurfer</a> / <a href="http://www.meti.go.jp/english/press/data/20090626_03.html" target="_blank">METI</a> / <a href="https://lpdaac.usgs.gov/products/aster_policies" target="_blank">NASA</a>'),
zIndex: 300,
noWrap: true
})
].forEach(function(it) {
map.layers[it.options.fpKey] = it;
map.layers[it.options.fmKey] = it;
});
map.popupOptions = {
minWidth: 350,
maxWidth: 350,
className: "fp-popup"
className: "fm-popup"
};
map.tooltipOptions = {
@ -96,7 +101,7 @@
el.append(tpl);
$compile(tpl)(scope);
map.map = L.map(el.find(".fp-map")[0]);
map.map = L.map(el.find(".fm-map")[0]);
map.map.almostOver.options.distance = 10;
@ -106,16 +111,16 @@
iconLoading: "glyphicon glyphicon-screenshot"
}).addTo(map.map);
fpUtils.leafletHash(map.map, map.layers);
fmUtils.leafletHash(map.map, map.layers);
map.map.on('almost:over', function(e) {
e.layer.fire('fp-almostover', e);
$(map.map.getContainer()).addClass("fp-almostover");
e.layer.fire('fm-almostover', e);
$(map.map.getContainer()).addClass("fm-almostover");
});
map.map.on('almost:out', function(e) {
e.layer.fire('fp-almostout', e);
$(map.map.getContainer()).removeClass("fp-almostover");
e.layer.fire('fm-almostout', e);
$(map.map.getContainer()).removeClass("fm-almostover");
});
map.map.on('almost:click', function(e) {
@ -123,7 +128,7 @@
});
map.map.on('almost:move', function(e) {
e.layer.fire('fp-almostmove', e);
e.layer.fire('fm-almostmove', e);
});
map.startMarkerColour = "00ff00";
@ -132,7 +137,7 @@
map.map.on("singleclick", function(e) {
map.mapEvents.$emit("click", e.latlng);
}.fpWrapApply($rootScope));
}.fmWrapApply($rootScope));
map.map.on("layeradd", function() {
map.mapEvents.$emit("layerchange");
@ -143,14 +148,14 @@
});
map.getCurrentView = function() {
var ret = fpUtils.leafletToFpBbox(map.map.getBounds());
var ret = fmUtils.leafletToFmBbox(map.map.getBounds());
ret.layers = [ ];
map.map.eachLayer(function(it) {
if(it.options.fpBase)
ret.baseLayer = it.options.fpKey;
else if(it.options.fpKey)
ret.layers.push(it.options.fpKey);
if(it.options.fmBase)
ret.baseLayer = it.options.fmKey;
else if(it.options.fmKey)
ret.layers.push(it.options.fmKey);
});
return ret;
@ -159,7 +164,7 @@
map.displayView = function(view) {
var layers = [ view && map.layers[view.baseLayer] ? view.baseLayer : Object.keys(map.layers)[0] ].concat(view ? view.layers : [ ]);
map.map.eachLayer(function(it) {
if(it.options.fpKey && layers.indexOf(it.options.fpKey) == -1)
if(it.options.fmKey && layers.indexOf(it.options.fmKey) == -1)
map.map.removeLayer(it);
});
layers.forEach(function(it) {
@ -170,7 +175,7 @@
map.map.addLayer(map.layers[it]);
});
var bounds = fpUtils.fpToLeafletBbox(view || { top: -90, bottom: 90, left: -180, right: -180 });
var bounds = fmUtils.fmToLeafletBbox(view || { top: -90, bottom: 90, left: -180, right: -180 });
try {
map.map.getCenter(); // Throws exception if map not initialised
@ -180,11 +185,11 @@
}
};
map.map.createPane("fpClickListener");
$(map.map.getPane("fpClickListener")).css("z-index", 620);
map.map.createPane("fmClickListener");
$(map.map.getPane("fmClickListener")).css("z-index", 620);
var transparentLayer = L.imageOverlay('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', [[90,-180],[-90,180]], {
className: "fp-clickHandler",
pane: "fpClickListener",
className: "fm-clickHandler",
pane: "fmClickListener",
interactive: true
});
@ -219,7 +224,7 @@
var ret = { base: [ ], overlay: [ ] };
for(var i in map.layers) {
var it = map.layers[i];
(it.options.fpBase ? ret.base : ret.overlay).push({ visibility: map.map.hasLayer(it), name: it.options.fpName, permalinkName: it.options.fpKey, attribution: it.options.attribution });
(it.options.fmBase ? ret.base : ret.overlay).push({ visibility: map.map.hasLayer(it), name: it.options.fmName, permalinkName: it.options.fmKey, attribution: it.options.attribution });
}
return ret;
};
@ -228,12 +233,12 @@
if(!map.layers[key])
return;
if(!map.layers[key].options.fpBase) {
if(!map.layers[key].options.fmBase) {
if(!map.map.hasLayer(map.layers[key]) != !show)
show ? map.map.addLayer(map.layers[key]) : map.map.removeLayer(map.layers[key]);
} else if(!map.map.hasLayer(map.layers[key])) {
map.map.eachLayer(function(it) {
if(it.options.fpBase)
if(it.options.fmBase)
map.map.removeLayer(it);
});
@ -259,19 +264,19 @@
map.loadEnd();
});
map.messages = fpMapMessages(map);
map.markersUi = fpMapMarkers(map);
map.linesUi = fpMapLines(map);
map.viewsUi = fpMapViews(map);
map.typesUi = fpMapTypes(map);
map.padUi = fpMapPad(map);
map.gpxUi = fpMapGpx(map);
map.toolboxUi = fpMapToolbox(map);
map.aboutUi = fpMapAbout(map);
map.importUi = fpMapImport(map);
map.searchUi = fpMapSearch(map);
map.messages = fmMapMessages(map);
map.markersUi = fmMapMarkers(map);
map.linesUi = fmMapLines(map);
map.viewsUi = fmMapViews(map);
map.typesUi = fmMapTypes(map);
map.padUi = fmMapPad(map);
map.gpxUi = fmMapGpx(map);
map.toolboxUi = fmMapToolbox(map);
map.aboutUi = fmMapAbout(map);
map.importUi = fmMapImport(map);
map.searchUi = fmMapSearch(map);
fpMapLegend(map);
fmMapLegend(map);
if(padId) {
var loadedWatcher = map.socket.$watch("padData", function(padData) {
@ -308,9 +313,9 @@
map.map.on("moveend", function() {
if(map.socket.padId)
map.socket.updateBbox(fpUtils.leafletToFpBbox(map.map.getBounds(), map.map.getZoom()));
map.socket.updateBbox(fmUtils.leafletToFmBbox(map.map.getBounds(), map.map.getZoom()));
});
}
});
})(FacilPad, jQuery, angular, null, null);
})(FacilMap, jQuery, angular, null);

Wyświetl plik

@ -13,20 +13,20 @@
<div class="form-group" ng-show="canControl('colour')">
<label for="edit-marker-colour" class="col-sm-3 control-label">Colour</label>
<div class="col-sm-9"><input id="edit-marker-colour" ng-model="marker.colour" class="form-control" fp-colour-picker></div>
<div class="col-sm-9"><input id="edit-marker-colour" ng-model="marker.colour" class="form-control" fm-colour-picker></div>
</div>
<div class="form-group" ng-repeat="field in types[marker.typeId].fields" ng-show="field.type != 'dropdown' || field.options.length > 1">
<label for="marker-{{$index}}-input" class="col-sm-3 control-label">{{field.name}}</label>
<div class="col-sm-9" fp-type-field="field" fp-type-field-model="marker.data[field.name]" fp-type-field-id="marker-{{$index}}-input"></div>
<div class="col-sm-9" fm-type-field="field" fm-type-field-model="marker.data[field.name]" fm-type-field-id="marker-{{$index}}-input"></div>
</div>
</form>
</div>
<div class="modal-footer">
<div class="btn-group pull-left" uib-dropdown ng-if="(types | fpPropertyCount:{type:'marker'}) > 1">
<div class="btn-group pull-left" uib-dropdown ng-if="(types | fmPropertyCount:{type:'marker'}) > 1">
<button id="change-type-button" type="button" class="btn btn-default" uib-dropdown-toggle>Change type <span class="caret"></span></button>
<ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="change-type-button" uib-dropdown-menu>
<li role="menuitem" ng-repeat="type in types | fpObjectFilter:{type:'marker'}" ng-class="{active: type.id == marker.typeId}"><a href="#" ng-click="marker.typeId = type.id">{{type.name}}</a></li>
<li role="menuitem" ng-repeat="type in types | fmObjectFilter:{type:'marker'}" ng-class="{active: type.id == marker.typeId}"><a href="#" ng-click="marker.typeId = type.id">{{type.name}}</a></li>
</ul>
</div>

Wyświetl plik

@ -1,6 +1,6 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapMarkers", function($uibModal, fpUtils, $templateCache, $compile, $timeout, L) {
fm.app.factory("fmMapMarkers", function($uibModal, fmUtils, $templateCache, $compile, $timeout, L) {
return function(map) {
var markersById = { };
@ -15,7 +15,7 @@
var markersUi = {
_addMarker : function(marker) {
if(!markersById[marker.id]) {
markersById[marker.id] = L.marker([ 0, 0 ], { icon: fpUtils.createMarkerIcon(marker.colour)}).addTo(map.map)
markersById[marker.id] = L.marker([ 0, 0 ], { icon: fmUtils.createMarkerIcon(marker.colour)}).addTo(map.map)
.bindPopup($("<div/>")[0], map.popupOptions)
.on("popupopen", function(e) {
markersUi._renderMarkerPopup(map.socket.markers[marker.id] || marker);
@ -25,13 +25,13 @@
})
.bindTooltip("", $.extend({}, map.tooltipOptions, { offset: [ 20, -15 ] }))
.on("tooltipopen", function() {
markersById[marker.id].setTooltipContent(fpUtils.quoteHtml(map.socket.markers[marker.id].name));
markersById[marker.id].setTooltipContent(fmUtils.quoteHtml(map.socket.markers[marker.id].name));
});
}
markersById[marker.id]
.setLatLng([ marker.lat, marker.lon ])
.setIcon(fpUtils.createMarkerIcon(marker.colour));
.setIcon(fmUtils.createMarkerIcon(marker.colour));
if(markersById[marker.id].isPopupOpen())
markersUi._renderMarkerPopup(marker);
@ -78,7 +78,7 @@
var dialog = $uibModal.open({
templateUrl: "map/markers/edit-marker.html",
scope: map.socket,
controller: "fpMapMarkerEditCtrl",
controller: "fmMapMarkerEditCtrl",
size: "lg",
resolve: {
marker: function() { return marker; },
@ -86,7 +86,8 @@
}
});
var preserve = fpUtils.preserveObject(map.socket, "markers["+fpUtils.quoteJavaScript(marker.id)+"]", "marker", function() {
// TODO: use child scope!
var preserve = fmUtils.preserveObject(map.socket, "markers["+fmUtils.quoteJavaScript(marker.id)+"]", "marker", function() {
dialog.dismiss();
});
@ -160,7 +161,7 @@
};
});
fp.app.controller("fpMapMarkerEditCtrl", function($scope, map, marker) {
fm.app.controller("fmMapMarkerEditCtrl", function($scope, map, marker) {
$scope.marker = marker;
$scope.canControl = function(what) {
@ -182,4 +183,4 @@
});
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -5,7 +5,7 @@
<dd class="pos">{{round(marker.lat, 5)}}, {{round(marker.lon, 5)}}</dd>
<dt ng-repeat-start="field in types[marker.typeId].fields" ng-show="field.type != 'dropdown' || field.options.length > 1">{{field.name}}</dt>
<dd ng-repeat-end ng-show="field.type != 'dropdown' || field.options.length > 1" fp-type-field-content="field" fp-type-field-model="marker.data[field.name]"></dd>
<dd ng-repeat-end ng-show="field.type != 'dropdown' || field.options.length > 1" fm-type-field-content="field" fm-type-field-model="marker.data[field.name]"></dd>
</dl>
</div>
<div class="buttons" ng-if="!readonly">

Wyświetl plik

@ -1,6 +1,6 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapMessages", [ "$rootScope", "$templateCache", "$compile", function($rootScope, $templateCache, $compile) {
fm.app.factory("fmMapMessages", function($rootScope, $templateCache, $compile) {
return function(map) {
var scope = $rootScope.$new(true);
scope.messages = [ ];
@ -40,6 +40,6 @@
}
};
};
} ]);
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,6 +1,6 @@
<div class="modal-header">
<button class="close" ng-click="$dismiss()"><span aria-hidden="true">&times;</span></button>
<h3 class="modal-title">{{create ? 'Start collaborative map' : 'Pad settings'}}</h3>
<h3 class="modal-title">{{create ? 'Start collaborative map' : 'Map settings'}}</h3>
</div>
<div class="modal-body">
<form class="form-horizontal">
@ -33,7 +33,7 @@
</div>
<div class="form-group">
<label for="pad-name-input" class="col-sm-3 control-label">Pad name</label>
<label for="pad-name-input" class="col-sm-3 control-label">Map name</label>
<div class="col-sm-9"><input id="pad-name-input" ng-model="padName" class="form-control" /></div>
</div>
</form>

Wyświetl plik

@ -1,6 +1,6 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapPad", function($uibModal, fpUtils) {
fm.app.factory("fmMapPad", function($uibModal, fmUtils) {
return function(map) {
var ret = {
createPad : function() {
@ -10,7 +10,7 @@
var dialog = $uibModal.open({
templateUrl: "map/pad/pad-settings.html",
scope: map.socket,
controller: "fpMapPadSettingsCtrl",
controller: "fmMapPadSettingsCtrl",
size: "lg",
resolve: {
map: function() { return map; },
@ -20,7 +20,7 @@
if(!create) {
// TODO: use child scope!
var preserve = fpUtils.preserveObject(map.socket, "padData", "padData", function() {
var preserve = fmUtils.preserveObject(map.socket, "padData", "padData", function() {
dialog.dismiss();
});
@ -30,7 +30,7 @@
};
/*
$scope.copyPadId = fpUtils.generateRandomPadId();
$scope.copyPadId = fmUtils.generateRandomPadId();
$scope.copyPad = function() {
socket.emit("copyPad", { toId: $scope.copyPadId }, function(err) {
if(err) {
@ -41,7 +41,7 @@
$scope.closeDialog();
var url = $scope.urlPrefix + $scope.copyPadId;
$scope.showMessage("success", "The pad has been copied to", [ { label: url, url: url } ]);
$scope.copyPadId = fpUtils.generateRandomPadId();
$scope.copyPadId = fmUtils.generateRandomPadId();
});
};
*/
@ -50,13 +50,13 @@
};
});
fp.app.controller("fpMapPadSettingsCtrl", function($scope, map, create, fpUtils) {
fm.app.controller("fmMapPadSettingsCtrl", function($scope, map, create, fmUtils) {
$scope.create = create;
if(create) {
$scope.writeId = fpUtils.generateRandomPadId(14);
$scope.readId = fpUtils.generateRandomPadId(12);
$scope.padName = "New FacilPad";
$scope.writeId = fmUtils.generateRandomPadId(14);
$scope.readId = fmUtils.generateRandomPadId(12);
$scope.padName = "New FacilMap";
} else {
$scope.writeId = map.socket.padData.writeId;
$scope.readId = map.socket.padData.id;
@ -75,7 +75,7 @@
if(err)
return $scope.error = err;
map.socket.updateBbox(fpUtils.leafletToFpBbox(map.map.getBounds(), map.map.getZoom()));
map.socket.updateBbox(fmUtils.leafletToFmBbox(map.map.getBounds(), map.map.getZoom()));
$scope.$close();
});
@ -90,8 +90,8 @@
};
$scope.copy = function(text) {
fpUtils.copyToClipboard(text);
fmUtils.copyToClipboard(text);
}
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -7,17 +7,17 @@
<dd class="pos" ng-if="result.type != 'coordinates' && result.lat != null && result.lon != null">{{round(result.lat, 5)}}, {{round(result.lon, 5)}}</dd>
<dt ng-repeat-start="(key, value) in result.extratags">{{key}}</dt>
<dd ng-repeat-end ng-bind-html="value | fpRenderOsmTag:key">{{value}}</dd>
<dd ng-repeat-end ng-bind-html="value | fmRenderOsmTag:key">{{value}}</dd>
</dl>
</div>
<div class="buttons" ng-if="!readonly && type">
<div uib-dropdown ng-if="(types | fpPropertyCount:{type:type}) > 1">
<div uib-dropdown ng-if="(types | fmPropertyCount:{type:type}) > 1">
<button id="add-type-button" type="button" class="btn btn-default" uib-dropdown-toggle>Add to map <span class="caret"></span></button>
<ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="add-type-button">
<li role="menuitem" ng-repeat="type in types | fpObjectFilter:{type:type}"><a href="javascript:" ng-click="addToMap(type)">{{type.name}}</a></li>
<li role="menuitem" ng-repeat="type in types | fmObjectFilter:{type:type}"><a href="javascript:" ng-click="addToMap(type)">{{type.name}}</a></li>
</ul>
</div>
<button ng-if="(types | fpPropertyCount:{type:type}) == 1" class="btn btn-default" ng-click="addToMap()">Add to map</button>
<button ng-if="(types | fmPropertyCount:{type:type}) == 1" class="btn btn-default" ng-click="addToMap()">Add to map</button>
<div uib-dropdown>
<button type="button" class="btn btn-default" uib-dropdown-toggle>Use as <span class="caret"></span></button>
<ul class="dropdown-menu" uib-dropdown-menu role="menu">

Wyświetl plik

@ -1,4 +1,4 @@
<div class="fp-search fp-search-route panel panel-default" ng-class="{'fp-hasResults': routes.length > 0}">
<div class="fm-search fm-search-route panel panel-default" ng-class="{'fm-hasResults': routes.length > 0}">
<div class="panel-body">
<form ng-submit="reset(); route()" ui-sortable="sortableOptions" ng-model="destinations">
<div class="form-group" ng-repeat="destination in destinations">
@ -35,22 +35,22 @@
</div>
</div>
<div class="fp-search-results" ng-show="routeObj || routeError">
<div class="fm-search-results" ng-show="routeObj || routeError">
<div uib-alert class="alert-danger no-results" ng-if="routeError">{{routeError}}</div>
<dl ng-show="routeObj">
<dt>Distance</dt>
<dd>{{routeObj.distance | fpRound:2}} km <span ng-show="routeObj.time != null">({{routeObj.time | fpFormatTime}} h {{routeObj.routeMode | fpRoutingMode}})</span></dd>
<dd>{{routeObj.distance | fmRound:2}} km <span ng-show="routeObj.time != null">({{routeObj.time | fmFormatTime}} h {{routeObj.routeMode | fmRoutingMode}})</span></dd>
</dl>
<div class="fp-search-buttons" ng-show="routeObj && !readonly">
<div uib-dropdown ng-if="(types | fpPropertyCount:{type:'line'}) > 1" dropdown-append-to-body="true">
<div class="fm-search-buttons" ng-show="routeObj && !readonly">
<div uib-dropdown ng-if="(types | fmPropertyCount:{type:'line'}) > 1" dropdown-append-to-body="true">
<button id="add-type-button" type="button" class="btn btn-default" uib-dropdown-toggle>Add to map <span class="caret"></span></button>
<ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="add-type-button" uib-dropdown-menu>
<li role="menuitem" ng-repeat="type in types | fpObjectFilter:{type:'line'}"><a href="#" ng-click="addToMap(type)">{{type.name}}</a></li>
<li role="menuitem" ng-repeat="type in types | fmObjectFilter:{type:'line'}"><a href="#" ng-click="addToMap(type)">{{type.name}}</a></li>
</ul>
</div>
<button ng-if="(types | fpPropertyCount:{type:'line'}) == 1" type="button" class="btn btn-default" ng-click="addToMap()">Add to map</button>
<button ng-if="(types | fmPropertyCount:{type:'line'}) == 1" type="button" class="btn btn-default" ng-click="addToMap()">Add to map</button>
</div>
</div>
</form>

Wyświetl plik

@ -1,6 +1,6 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapSearchRoute", function($rootScope, $templateCache, $compile, fpUtils, L, $timeout, $q) {
fm.app.factory("fmMapSearchRoute", function($rootScope, $templateCache, $compile, fmUtils, L, $timeout, $q) {
return function(map, searchUi) {
var lineStyle = {
color : '#0000ff',
@ -144,7 +144,7 @@
var routeLayer = null;
var dragMarker = null;
var markers = [ ];
var recalcRoute = fpUtils.minInterval(dragTimeout, false);
var recalcRoute = fmUtils.minInterval(dragTimeout, false);
function renderRoute(dragging) {
clearRoute(dragging);
@ -152,9 +152,9 @@
routeLayer = L.polyline(scope.routeObj.trackPoints.map(function(it) { return [ it.lat, it.lon ] }), lineStyle).addTo(map.map);
map.map.almostOver.addLayer(routeLayer);
dragMarker = fpUtils.temporaryDragMarker(map.map, routeLayer, map.dragMarkerColour, function(marker) {
dragMarker = fmUtils.temporaryDragMarker(map.map, routeLayer, map.dragMarkerColour, function(marker) {
var latlng = marker.getLatLng();
var idx = fpUtils.getIndexOnLine(map.map, scope.routeObj.trackPoints, scope.routeObj.routePoints, { lat: latlng.lat, lon: latlng.lng });
var idx = fmUtils.getIndexOnLine(map.map, scope.routeObj.trackPoints, scope.routeObj.routePoints, { lat: latlng.lat, lon: latlng.lng });
scope.destinations.splice(idx, 0, makeCoordDestination(latlng));
markers.splice(idx, 0, marker);
@ -164,7 +164,7 @@
marker.once("dragend", updateMarkerColours);
scope.route(true);
}.fpWrapApply(scope));
}.fmWrapApply(scope));
if(!dragging) {
map.map.flyToBounds(routeLayer.getBounds());
@ -173,7 +173,7 @@
scope.routeObj.routePoints.forEach(function(point, i) {
var marker = L.marker([ point.lat, point.lon ], {
icon: fpUtils.createMarkerIcon(map.dragMarkerColour),
icon: fmUtils.createMarkerIcon(map.dragMarkerColour),
draggable: true
}).addTo(map.map);
@ -197,7 +197,7 @@
scope.destinations[markers.indexOf(marker)] = makeCoordDestination(marker.getLatLng());
return scope.route(true);
}.fpWrapApply(scope));
}.fmWrapApply(scope));
});
}
@ -205,7 +205,7 @@
markers.forEach(function(marker, i) {
var colour = (i == 0 ? map.startMarkerColour : i == markers.length-1 ? map.endMarkerColour : map.dragMarkerColour);
marker.setIcon(fpUtils.createMarkerIcon(colour));
marker.setIcon(fmUtils.createMarkerIcon(colour));
});
}
@ -230,7 +230,7 @@
}
function makeCoordDestination(latlng) {
var disp = fpUtils.round(latlng.lat, 5) + "," + fpUtils.round(latlng.lng, 5);
var disp = fmUtils.round(latlng.lat, 5) + "," + fmUtils.round(latlng.lng, 5);
return {
query: disp,
suggestionQuery: disp,
@ -301,4 +301,4 @@
};
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,4 +1,4 @@
.fp-search {
.fm-search {
position: absolute;
top: 10px;
left: 60px;
@ -11,46 +11,46 @@
max-width: 30%;
}
.fp-search:hover,.fp-search.fp-hasFocus {
.fm-search:hover,.fm-search.fm-hasFocus {
opacity: 1;
}
.fp-search/*.fp-hasFocus*/ {
.fm-search/*.fm-hasFocus*/ {
width: 350px;
max-width: 40%;
}
.fp-search-search:not(:hover):not(.fp-hasResults):not(.fp-hasFocus) {
.fm-search-search:not(:hover):not(.fm-hasResults):not(.fm-hasFocus) {
background-color: rgba(255, 255, 255, 0);
border-color: rgba(255, 255, 255, 0);
box-shadow: none;
}
.fp-search .fp-search-results {
.fm-search .fm-search-results {
max-height: 65vh;
overflow: auto;
white-space: nowrap;
}
.fp-search .no-results {
.fm-search .no-results {
margin: 10px 0 0;
}
.fp-search .reset-button {
.fm-search .reset-button {
z-index: 5;
pointer-events: auto;
}
.fp-search-results .active a {
.fm-search-results .active a {
color: inherit;
}
.fp-search .form-group {
.fm-search .form-group {
margin-bottom: 7px;
}
@media print {
.fp-search {
.fm-search {
display: none;
}
}

Wyświetl plik

@ -1,4 +1,4 @@
<div class="fp-search fp-search-search panel panel-default" ng-class="{'fp-hasResults': !!searchResults}">
<div class="fm-search fm-search-search panel panel-default" ng-class="{'fm-hasResults': !!searchResults}">
<div class="panel-body">
<form ng-submit="search()">
<div class="form-group">
@ -15,7 +15,7 @@
</div>
</form>
<div class="fp-search-results" ng-show="searchResults">
<div class="fm-search-results" ng-show="searchResults">
<div uib-alert class="alert-danger no-results" ng-if="searchResults.length == 0">No results have been found.</div>
<ul class="list-group" ng-if="searchResults.length > 0">
<li ng-repeat="result in searchResults" class="list-group-item" ng-class="{active: activeResult === result}">
@ -24,7 +24,7 @@
</li>
</ul>
</div>
<div class="fp-search-buttons" ng-show="searchResults.length > 1">
<div class="fm-search-buttons" ng-show="searchResults.length > 1">
<button class="btn btn-default" ng-model="showAll" uib-btn-checkbox>Show all</button>
</div>
</div>

Wyświetl plik

@ -1,6 +1,6 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapSearch", function($rootScope, $templateCache, $compile, fpUtils, L, $timeout, $q, fpMapSearchRoute) {
fm.app.factory("fmMapSearch", function($rootScope, $templateCache, $compile, fmUtils, L, $timeout, $q, fmMapSearchRoute) {
return function(map) {
var iconSuffix = ".n.32.png";
@ -22,7 +22,7 @@
return routeUi.submit();
}
var lonlat = fpUtils.decodeLonLatUrl(scope.searchString);
var lonlat = fmUtils.decodeLonLatUrl(scope.searchString);
if(lonlat)
return map.map.flyTo([ lonlat.lat, lonlat.lon ], lonlat.zoom);
@ -76,7 +76,7 @@
routeUi.show();
if(scope.searchString.match(/ to /))
routeUi.setQueries(fpUtils.splitRouteQuery(scope.searchString));
routeUi.setQueries(fmUtils.splitRouteQuery(scope.searchString));
else if(scope.loadedSearchString == scope.searchString)
routeUi.setFrom(scope.searchString, scope.searchResults, scope.activeResult);
else
@ -115,7 +115,7 @@
clickMarker.clearLayers();
if(results.length > 0)
renderResult(fpUtils.round(latlng.lat, 5) + "," + fpUtils.round(latlng.lng, 5), results, results[0], true, clickMarker);
renderResult(fmUtils.round(latlng.lat, 5) + "," + fmUtils.round(latlng.lng, 5), results, results[0], true, clickMarker);
});
});
@ -229,7 +229,7 @@
result.layer = L.geoJson(result.geojson, {
pointToLayer: function(geoJsonPoint, latlng) {
return L.marker(latlng, {
icon: fpUtils.createMarkerIcon("ff0000")
icon: fmUtils.createMarkerIcon("ff0000")
});
}
})
@ -367,10 +367,10 @@
}
};
var routeUi = fpMapSearchRoute(map, searchUi);
var routeUi = fmMapSearchRoute(map, searchUi);
return searchUi;
};
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,4 +1,4 @@
.fp-toolbox {
.fm-toolbox {
position: absolute;
top: 10px;
right: 10px;
@ -6,16 +6,16 @@
transition: opacity .7s;
}
.fp-toolbox:hover {
.fm-toolbox:hover {
opacity: 1;
}
.fp-toolbox .mobile-menu-button {
.fm-toolbox .mobile-menu-button {
margin-left: auto;
}
@media print {
.fp-toolbox {
.fm-toolbox {
display: none;
}
}

Wyświetl plik

@ -1,7 +1,7 @@
<div class="fp-toolbox">
<div class="fm-toolbox">
<button class="btn btn-default visible-xs-block mobile-menu-button" ng-click="showXs = !showXs" uib-tooltip="{{showXs ? 'Hide menu' : 'Show menu'}}" tooltip-placement="left"><span class="glyphicon glyphicon-menu-hamburger"></span></button>
<nav class="navbar navbar-default" ng-class="{'hidden-xs': !showXs}">
<div class="container-fluid" id="fp-toolbox-content">
<div class="container-fluid" id="fm-toolbox-content">
<ul class="nav navbar-nav">
<li role="presentation" ng-if="!padId">
<a href="javascript:" ng-click="startPad()">Start collaborative map</a>
@ -42,7 +42,7 @@
<li ng-if="padId"><a href="javascript:" ng-click="exportGpx()">Export GPX</a></li>
<li ng-if="padId"><a href="javascript:" ng-click="showTable()">View as table</a></li>
<li ng-if="!readonly && padId"><a href="javascript:" ng-click="editPadSettings()">Settings</a></li>
<li><a href="javascript:" ng-click="showAbout()">About FacilPad</a></li>
<li><a href="javascript:" ng-click="showAbout()">About FacilMap</a></li>
</ul>
</li>
</ul>

Wyświetl plik

@ -1,6 +1,6 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapToolbox", function($compile, $templateCache, fpTable) {
fm.app.factory("fmMapToolbox", function($compile, $templateCache, fmTable) {
return function(map) {
var scope = map.socket.$new();
@ -32,7 +32,7 @@
scope.editObjectTypes = map.typesUi.editTypes.bind(map.typesUi);
scope.showTable = function() {
fpTable.showTable(map.socket.padId);
fmTable.showTable(map.socket.padId);
};
scope.importFile = function() {
@ -59,4 +59,4 @@
}
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -29,8 +29,8 @@
<tbody ui-sortable="sortableOptions" ng-model="field.options">
<tr ng-repeat="option in field.options">
<td><input type="text" ng-model="option.value" class="form-control"></td>
<td ng-if="field.controlColour"><input type="text" ng-model="option.colour" fp-colour-picker class="form-control"></td>
<td ng-if="field.controlWidth"><input type="text" ng-model="option.width" fp-spinner class="form-control"></td>
<td ng-if="field.controlColour"><input type="text" ng-model="option.colour" fm-colour-picker class="form-control"></td>
<td ng-if="field.controlWidth"><input type="text" ng-model="option.width" fm-spinner class="form-control"></td>
<td class="td-buttons"><button ng-click="deleteOption(option)" class="btn btn-default"><span class="glyphicon glyphicon-minus"></span></button></td>
<td class="td-buttons move"><a href="javascript:" class="btn btn-default sort-handle"><span class="glyphicon glyphicon-resize-vertical"></span></a></td>
</tr>

Wyświetl plik

@ -50,7 +50,7 @@
<option value="checkbox">Checkbox</option>
</select>
</td>
<td fp-type-field="field" fp-type-field-model="field.default" fp-type-field-ignore-default></td>
<td fm-type-field="field" fm-type-field-model="field.default" fm-type-field-ignore-default></td>
<td class="td-buttons"><button ng-click="deleteField(field)" class="btn btn-default">Delete</button></td>
<td class="move td-buttons"><a href="javascript:" class="btn btn-default sort-handle"><span class="glyphicon glyphicon-resize-vertical"></span></a></td>
</tr>

Wyświetl plik

@ -1,13 +1,13 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapTypes", function($uibModal, fpUtils) {
fm.app.factory("fmMapTypes", function($uibModal, fmUtils) {
return function(map) {
var ret = {
editTypes : function() {
$uibModal.open({
templateUrl: "map/types/edit-types.html",
scope: map.socket,
controller: "fpMapTypesEditCtrl",
controller: "fmMapTypesEditCtrl",
size: "lg",
resolve: {
map: function() { return map; }
@ -21,14 +21,14 @@
var dialog = $uibModal.open({
templateUrl: "map/types/edit-type.html",
scope: scope,
controller: "fpMapTypesEditTypeCtrl",
controller: "fmMapTypesEditTypeCtrl",
size: "lg",
resolve: {
map: function() { return map; }
}
});
var preserve = fpUtils.preserveObject(scope, type.id ? "types["+fpUtils.quoteJavaScript(type.id)+"]" : "type", "type", function() {
var preserve = fmUtils.preserveObject(scope, type.id ? "types["+fmUtils.quoteJavaScript(type.id)+"]" : "type", "type", function() {
dialog.dismiss();
});
@ -42,14 +42,14 @@
var dialog = $uibModal.open({
templateUrl: "map/types/edit-type-dropdown.html",
scope: scope,
controller: "fpMapTypesEditTypeDropdownCtrl",
controller: "fmMapTypesEditTypeDropdownCtrl",
size: "lg",
resolve: {
map: function() { return map; }
}
});
var preserve = fpUtils.preserveObject(scope, "field", "field", function() {
var preserve = fmUtils.preserveObject(scope, "field", "field", function() {
dialog.dismiss();
});
@ -68,7 +68,7 @@
};
});
fp.app.controller('fpMapTypesEditCtrl', function($scope, map) {
fm.app.controller('fmMapTypesEditCtrl', function($scope, map) {
$scope.create = function() {
$scope.edit({
fields : [ ]
@ -86,7 +86,7 @@
};
});
fp.app.controller('fpMapTypesEditTypeCtrl', function($scope, map) {
fm.app.controller('fmMapTypesEditTypeCtrl', function($scope, map) {
$scope.editDropdown = function(field) {
map.typesUi.editTypeDropdown($scope.type, field);
};
@ -112,7 +112,7 @@
};
});
fp.app.controller('fpMapTypesEditTypeDropdownCtrl', function($scope, map, fpUtils) {
fm.app.controller('fmMapTypesEditTypeDropdownCtrl', function($scope, map, fmUtils) {
$scope.canControl = function(what) {
return map.typesUi.canControl($scope.type, what, $scope.field);
};
@ -121,7 +121,7 @@
if($scope.field.options == null)
$scope.field.options = [ ];
$scope.field.options.push({ key: fpUtils.generateRandomPadId(), value: "" });
$scope.field.options.push({ key: fmUtils.generateRandomPadId(), value: "" });
};
$scope.deleteOption = function(option) {
@ -135,4 +135,4 @@
};
})
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,13 +1,13 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMapViews", function($uibModal) {
fm.app.factory("fmMapViews", function($uibModal) {
return function(map) {
var ret = {
saveView : function() {
$uibModal.open({
templateUrl: "map/views/save-view.html",
scope: map.socket,
controller: "fpMapViewsSaveCtrl",
controller: "fmMapViewsSaveCtrl",
size: "lg",
resolve: {
map: function() { return map; }
@ -18,7 +18,7 @@
$uibModal.open({
templateUrl: "map/views/manage-views.html",
scope: map.socket,
controller: "fpMapViewsManageCtrl",
controller: "fmMapViewsManageCtrl",
size: "lg",
resolve: {
map: function() { return map; }
@ -31,7 +31,7 @@
};
});
fp.app.controller("fpMapViewsSaveCtrl", function($scope, map) {
fm.app.controller("fmMapViewsSaveCtrl", function($scope, map) {
$scope.name = null;
$scope.save = function(makeDefault) {
@ -55,7 +55,7 @@
};
});
fp.app.controller("fpMapViewsManageCtrl", function($scope, map) {
fm.app.controller("fmMapViewsManageCtrl", function($scope, map) {
$scope.display = function(view) {
map.displayView(view);
};
@ -75,4 +75,4 @@
};
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,6 +1,6 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpMarked", function() {
fm.app.factory("fmMarked", function() {
marked.setOptions({
breaks: true,
sanitize: true
@ -21,4 +21,4 @@
};
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,7 +1,7 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
// From http://stackoverflow.com/a/11277751/242365
fp.app.factory("fpSocket", function($rootScope, fpUtils) {
fm.app.factory("fmSocket", function($rootScope) {
return function(padId) {
var scope = $rootScope.$new();
@ -12,11 +12,11 @@
scope.views = { };
scope.types = { };
var socket = io.connect(fp.SERVER, { 'force new connection': true });
var socket = io.connect(fm.SERVER, { 'force new connection': true });
scope.on = function(eventName, fn) {
if(fn)
fn = fn.fpWrapApply(scope);
fn = fn.fmWrapApply(scope);
return socket.on.apply(socket, [ eventName, fn ]);
};
@ -167,4 +167,4 @@
};
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -13,10 +13,10 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="marker in markers | fpType:type.id | orderBy : getSortField(type) : sortOrder[type.id]">
<tr ng-repeat="marker in markers | fmType:type.id | orderBy : getSortField(type) : sortOrder[type.id]">
<td>{{marker.name}}</td>
<td>{{marker.lat}},{{marker.lon}}</td>
<td ng-repeat="field in type.fields" fp-type-field-content="field" fp-type-field-model="marker.data[field.name]"></td>
<td ng-repeat="field in type.fields" fm-type-field-content="field" fm-type-field-model="marker.data[field.name]"></td>
</tr>
</tbody>
</table>
@ -30,11 +30,11 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="line in lines | fpType:type.id | orderBy : getSortField(type) : sortOrder[type.id]">
<tr ng-repeat="line in lines | fmType:type.id | orderBy : getSortField(type) : sortOrder[type.id]">
<td>{{line.name}}</td>
<td>{{round(line.distance, 2)}} km</td>
<td><span ng-show="line.time != null">{{formatTime(line.time)}} h ({{routingMode(line.mode)}})</span></td>
<td ng-repeat="field in type.fields" fp-type-field-content="field" fp-type-field-model="line.data[field.name]"></td>
<td ng-repeat="field in type.fields" fm-type-field-content="field" fm-type-field-model="line.data[field.name]"></td>
</tr>
</tbody>
</table>

Wyświetl plik

@ -1,6 +1,6 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.filter("fpType", function() {
fm.app.filter("fmType", function() {
return function(input, typeId) {
var res = [ ];
angular.forEach(input, function(it) {
@ -11,23 +11,23 @@
};
});
fp.app.factory("fpTable", function(fpSocket, $rootScope, $uibModal) {
fm.app.factory("fmTable", function(fmSocket, $rootScope, $uibModal) {
return {
showTable : function(padId) {
var socket = fpSocket(padId);
var socket = fmSocket(padId);
socket.updateBbox({ top: 90, left: -180, right: 180, bottom: -90, zoom: 0 });
$uibModal.open({
templateUrl: "table/table.html",
scope: socket,
controller: "fpTableCtrl",
controller: "fmTableCtrl",
size: "fs"
});
}
};
});
fp.app.controller("fpTableCtrl", function($scope, fpTypeFields) {
fm.app.controller("fmTableCtrl", function($scope, fmTypeFields) {
function _getField(type, fieldName) {
for(var i=0; i<type.fields.length; i++) {
if(type.fields[i].name == fieldName)
@ -50,7 +50,7 @@
if(f == null || f == "__name" || f == "__distance" || f == "__time")
return function(it) { return _normaliseNumbers(it[f ? f.replace(/^__/, "") : "name"]) };
else
return function(it) { return _normaliseNumbers($("<div/>").append(fpTypeFields.formatField(_getField(type, f), it.data[f])).text()); };
return function(it) { return _normaliseNumbers($("<div/>").append(fmTypeFields.formatField(_getField(type, f), it.data[f])).text()); };
};
$scope.getSortClass = function(type, fieldName) {
@ -77,4 +77,4 @@
$scope.sortOrder = { };
})
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,6 +1,6 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.directive("fpSpinner", function($parse) {
fm.app.directive("fmSpinner", function($parse) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
@ -19,7 +19,7 @@
}
});
fp.app.directive("fpColourPicker", function(fpUtils, $templateCache, $rootScope, $compile) {
fm.app.directive("fmColourPicker", function(fmUtils, $templateCache, $rootScope, $compile) {
var colourPicker = $($templateCache.get("ui/colour-picker.html")).appendTo("body").hide();
var scope = $rootScope.$new();
scope.colours = [ "ffffff", "ffccc9", "ffce93", "fffc9e", "ffffc7", "9aff99", "96fffb", "cdffff", "cbcefb", "cfcfcf", "fd6864",
@ -35,7 +35,7 @@
link: function(scope, element, attrs) {
scope.$watch(attrs.ngModel, function(v) {
var colour = (v && v.match(/^[0-9a-f]{6}$/i) ? v : 'ffffff');
element.css({ 'background-color': '#' + colour, 'color' : '#' + fpUtils.makeTextColour(colour)});
element.css({ 'background-color': '#' + colour, 'color' : '#' + fmUtils.makeTextColour(colour)});
});
var handler = function(e) {
@ -64,14 +64,14 @@
}
});
fp.app.directive("fpTitle", function() {
fm.app.directive("fmTitle", function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
if(!$(element).is("title"))
return;
scope.$watch(attrs.fpTitle, function(v) {
scope.$watch(attrs.fmTitle, function(v) {
// We have to call history.replaceState() in order for the new title to end up in the browser history
window.history && history.replaceState({ }, v);
document.title = v;
@ -80,4 +80,4 @@
};
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,15 +1,15 @@
(function(fp, $, ng, undefined) {
(function(fm, $, ng, undefined) {
fp.app.factory("fpUtils", function($parse, L, Clipboard) {
fm.app.factory("fmUtils", function($parse, L, Clipboard) {
var fpUtils = { };
var fmUtils = { };
var LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var LENGTH = 12;
var shortLinkCharArray = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@";
fpUtils.generateRandomPadId = function(length) {
fmUtils.generateRandomPadId = function(length) {
if(length == null)
length = LENGTH;
@ -20,8 +20,8 @@
return randomPadId;
};
fpUtils.createMarkerGraphic = function(colour, huge, randomTrash) {
var borderColour = fpUtils.makeTextColour(colour, 0.3);
fmUtils.createMarkerGraphic = function(colour, huge, randomTrash) {
var borderColour = fmUtils.makeTextColour(colour, 0.3);
var svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
'<svg xmlns="http://www.w3.org/2000/svg" width="' + (huge ? 10000 : 21) + '" height="' + (huge ? 10000 : 25) + '" version="1.1">' +
@ -35,16 +35,16 @@
return "data:image/svg+xml;base64,"+btoa(svg);
};
fpUtils.createMarkerIcon = function(colour, huge) {
fmUtils.createMarkerIcon = function(colour, huge) {
return L.icon({
iconUrl: fpUtils.createMarkerGraphic(colour, huge),
iconUrl: fmUtils.createMarkerGraphic(colour, huge),
iconSize: huge ? [10000, 10000] : [21, 25],
iconAnchor: huge ? [5010, 5025] : [10, 25],
popupAnchor: [0, -25]
});
};
fpUtils.makeTextColour = function(backgroundColour, threshold) {
fmUtils.makeTextColour = function(backgroundColour, threshold) {
if(threshold == null)
threshold = 0.5;
@ -55,27 +55,27 @@
return (Math.sqrt(0.241*r*r + 0.691*g*g + 0.068*b*b) <= threshold) ? "ffffff" : "000000";
};
fpUtils.overwriteObject = function(from, to) {
fmUtils.overwriteObject = function(from, to) {
for(var i in to)
delete to[i];
for(var i in from)
to[i] = from[i];
};
fpUtils.quoteJavaScript = function(str) {
fmUtils.quoteJavaScript = function(str) {
return "'" + (""+str).replace(/['\\]/g, '\\\1').replace(/\n/g, "\\n") + "'";
};
fpUtils.quoteHtml = function(str) {
fmUtils.quoteHtml = function(str) {
return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
};
fpUtils.round = function(number, digits) {
fmUtils.round = function(number, digits) {
var fac = Math.pow(10, digits);
return Math.round(number*fac)/fac;
};
fpUtils.formatTime = function(seconds) {
fmUtils.formatTime = function(seconds) {
var hours = Math.floor(seconds/3600);
var minutes = Math.floor((seconds%3600)/60);
if(minutes < 10)
@ -83,7 +83,7 @@
return hours + ":" + minutes;
};
fpUtils.routingMode = function(mode) {
fmUtils.routingMode = function(mode) {
switch(mode) {
case "car":
return "by car";
@ -96,7 +96,7 @@
}
};
fpUtils.preserveObject = function(scope, sourceExpr, targetExpr, onDelete) {
fmUtils.preserveObject = function(scope, sourceExpr, targetExpr, onDelete) {
var obj,bkp;
function _update(firstTime) {
@ -128,7 +128,7 @@
if(bkp == null)
return;
fpUtils.overwriteObject(bkp, obj);
fmUtils.overwriteObject(bkp, obj);
unwatch();
},
leave : function() {
@ -138,7 +138,7 @@
}
};
fpUtils.leafletToFpBbox = function(bbox, zoom) {
fmUtils.leafletToFmBbox = function(bbox, zoom) {
var ret = {
top: bbox.getNorth(),
left: Math.max(-180, bbox.getWest()),
@ -152,11 +152,11 @@
return ret;
};
fpUtils.fpToLeafletBbox = function(bbox) {
fmUtils.fmToLeafletBbox = function(bbox) {
return L.latLngBounds(L.latLng(bbox.bottom, bbox.left), L.latLng(bbox.top, bbox.right));
};
fpUtils.getClosestIndexOnLine = function(map, trackPoints, point, startI) {
fmUtils.getClosestIndexOnLine = function(map, trackPoints, point, startI) {
var dist = Infinity;
var idx = null;
@ -177,16 +177,16 @@
return idx;
};
fpUtils.getIndexOnLine = function(map, trackPoints, routePoints, point) {
fmUtils.getIndexOnLine = function(map, trackPoints, routePoints, point) {
if(routePoints.length == 0)
return 0;
var idxs = [ ];
for(var i=0; i<routePoints.length; i++) {
idxs.push(fpUtils.getClosestIndexOnLine(map, trackPoints, routePoints[i], Math.floor(idxs[i-1])));
idxs.push(fmUtils.getClosestIndexOnLine(map, trackPoints, routePoints[i], Math.floor(idxs[i-1])));
}
var pointIdx = fpUtils.getClosestIndexOnLine(map, trackPoints, point);
var pointIdx = fmUtils.getClosestIndexOnLine(map, trackPoints, point);
if(pointIdx == 0)
return 0;
@ -198,7 +198,7 @@
return idxs.length;
};
fpUtils.copyToClipboard = function(text) {
fmUtils.copyToClipboard = function(text) {
var el = $("<button></button>").css("display", "none").appendTo("body");
var c = new Clipboard(el[0], {
text: function() {
@ -215,7 +215,7 @@
* @param cancel If true, a new function call will delay the next call of the function by <interval>.
* @returns {Function} Pass a function to this function that will be called
*/
fpUtils.minInterval = function(interval, cancel) {
fmUtils.minInterval = function(interval, cancel) {
var timeout = null;
var runningPromise = null;
var nextFunc = null;
@ -247,7 +247,7 @@
return ret;
};
fpUtils.temporaryDragMarker = function(map, line, colour, callback) {
fmUtils.temporaryDragMarker = function(map, line, colour, callback) {
// This marker is shown when we hover the line. It enables us to create new markers.
// It is a huge one (a normal marker with 5000 px or so transparency around it, so that we can be
// sure that the mouse is over it and dragging it will work smoothly.
@ -264,17 +264,17 @@
temporaryHoverMarker.remove();
}
line.on("fp-almostover", _over).on("fp-almostmove", _move).on("fp-almostout", _out);
line.on("fm-almostover", _over).on("fm-almostmove", _move).on("fm-almostout", _out);
function makeTemporaryHoverMarker() {
temporaryHoverMarker = L.marker([0,0], {
icon: fpUtils.createMarkerIcon(colour, true),
icon: fmUtils.createMarkerIcon(colour, true),
draggable: true
}).once("dragstart", function() {
temporaryHoverMarker.once("dragend", function() {
// We have to replace the huge icon with the regular one at the end of the dragging, otherwise
// the dragging gets interrupted
this.setIcon(fpUtils.createMarkerIcon(colour));
this.setIcon(fmUtils.createMarkerIcon(colour));
}, temporaryHoverMarker);
callback(temporaryHoverMarker);
@ -286,12 +286,12 @@
makeTemporaryHoverMarker();
return function() {
line.off("fp-almostover", _over).off("fp-almostmove", _move).off("fp-almostout", _out);
line.off("fm-almostover", _over).off("fm-almostmove", _move).off("fm-almostout", _out);
temporaryHoverMarker.remove();
};
};
fpUtils.splitRouteQuery = function(query) {
fmUtils.splitRouteQuery = function(query) {
var queries = [ ];
var spl = query.split(/\s+to\s+/);
@ -313,12 +313,12 @@
* @param query {String}
* @return {Object} An object with the properties lonlat and zoom or null
*/
fpUtils.decodeLonLatUrl = function(query) {
fmUtils.decodeLonLatUrl = function(query) {
var query = query.replace(/^\s+/, "").replace(/\s+$/, "");
var query_match,query_match2;
if(query_match = query.match(/^http:\/\/(www\.)?osm\.org\/go\/([-A-Za-z0-9_@]+)/))
{ // Coordinates, shortlink
return fpUtils.decodeShortLink(query_match[2]);
return fmUtils.decodeShortLink(query_match[2]);
}
function decodeQueryString(str) {
@ -357,7 +357,7 @@
* @param encoded {String}
* @return {Object} (lonlat: OpenLayers.LonLat, zoom: Number)
*/
fpUtils.decodeShortLink = function(encoded) {
fmUtils.decodeShortLink = function(encoded) {
var lon,lat,zoom;
var m = encoded.match(/^([A-Za-z0-9_@]+)/);
@ -404,7 +404,7 @@
};
};
fpUtils.leafletHash = function(map, layers) {
fmUtils.leafletHash = function(map, layers) {
var hashControl = new L.Hash(map);
hashControl.parseHash = function(hash) {
@ -447,10 +447,10 @@
return hashControl;
};
return fpUtils;
return fmUtils;
});
fp.app.filter('fpObjectFilter', function($filter){
fm.app.filter('fmObjectFilter', function($filter){
return function(input, query) {
if(!query) return input;
@ -465,29 +465,29 @@
};
});
fp.app.filter('fpPropertyCount', function($filter) {
fm.app.filter('fmPropertyCount', function($filter) {
return function(input, query) {
return Object.keys($filter('fpObjectFilter')(input, query)).length;
return Object.keys($filter('fmObjectFilter')(input, query)).length;
};
});
fp.app.filter('fpRenderOsmTag', function($sce, linkifyStr, fpUtils) {
fm.app.filter('fmRenderOsmTag', function($sce, linkifyStr, fmUtils) {
return function(value, key) {
if(key.match(/^wikipedia(:|$)/)) {
return $sce.trustAsHtml(value.split(";").map(function(it) {
var m = it.match(/^(\s*)((([-a-z]+):)?(.*))(\s*)$/);
var url = "https://" + (m[4] || "en") + ".wikipedia.org/wiki/" + m[5];
return m[1] + '<a href="' + fpUtils.quoteHtml(url) + '" target="_blank">' + fpUtils.quoteHtml(m[2]) + '</a>' + m[6];
return m[1] + '<a href="' + fmUtils.quoteHtml(url) + '" target="_blank">' + fmUtils.quoteHtml(m[2]) + '</a>' + m[6];
}).join(";"));
} else if(key.match(/^wikidata(:|$)/)) {
return $sce.trustAsHtml(value.split(";").map(function(it) {
var m = it.match(/^(\s*)(.*?)(\s*)$/);
return m[1] + '<a href="https://www.wikidata.org/wiki/' + fpUtils.quoteHtml(m[2]) + '" target="_blank">' + fpUtils.quoteHtml(m[2]) + '</a>' + m[3];
return m[1] + '<a href="https://www.wikidata.org/wiki/' + fmUtils.quoteHtml(m[2]) + '" target="_blank">' + fmUtils.quoteHtml(m[2]) + '</a>' + m[3];
}).join(";"));
} else if(key.match(/^wiki:symbol(:$)/)) {
return $sce.trustAsHtml(value.split(";").map(function(it) {
var m = it.match(/^(\s*)(.*?)(\s*)$/);
return m[1] + '<a href="https://wiki.openstreetmap.org/wiki/Image:' + fpUtils.quoteHtml(m[2]) + '" target="_blank">' + fpUtils.quoteHtml(m[2]) + '</a>' + m[3];
return m[1] + '<a href="https://wiki.openstreetmap.org/wiki/Image:' + fmUtils.quoteHtml(m[2]) + '" target="_blank">' + fmUtils.quoteHtml(m[2]) + '</a>' + m[3];
})).join(";");
} else {
return $sce.trustAsHtml(linkifyStr(value));
@ -495,7 +495,7 @@
};
});
fp.app.filter('fpNumberArray', function() {
fm.app.filter('fmNumberArray', function() {
return function(value, key) {
var ret = [ ];
for(var i=0; i<value; i++)
@ -504,22 +504,22 @@
};
});
fp.app.filter('fpRound', function(fpUtils) {
fm.app.filter('fmRound', function(fmUtils) {
return function(value, key) {
return fpUtils.round(value, key);
return fmUtils.round(value, key);
};
});
fp.app.filter('fpFormatTime', function(fpUtils) {
fm.app.filter('fmFormatTime', function(fmUtils) {
return function(value, key) {
return fpUtils.formatTime(value);
return fmUtils.formatTime(value);
};
});
fp.app.filter('fpRoutingMode', function(fpUtils) {
fm.app.filter('fmRoutingMode', function(fmUtils) {
return function(value) {
return fpUtils.routingMode(value);
return fmUtils.routingMode(value);
};
});
})(FacilPad, jQuery, angular);
})(FacilMap, jQuery, angular);

Wyświetl plik

@ -1,7 +1,7 @@
/* bootstrap popups have a z-index of 1050 (1060, 1070... for overlaying popups) */
/* OpenLayers Controls have z-index: 1008 (inside the map viewport) */
.fp-map-disabled-cover {
.fm-map-disabled-cover {
z-index: 10001;
}
@ -13,19 +13,19 @@
z-index: 1500;
}
#map .fp-popup {
#map .fm-popup {
z-index: 1007;
}
.fp-toolbox {
.fm-toolbox {
z-index: 1020;
}
.fp-map-spinner,.fp-attribution-icon {
.fm-map-spinner,.fm-attribution-icon {
z-index: 20000;
}
.fp-search {
.fm-search {
z-index: 1010;
}

Wyświetl plik

@ -68,7 +68,7 @@ gulp.task("app", function() {
gulp.src(files, { base: process.cwd() + "/" }),
gulpIf("**/*.html", combine(
img64(),
templateCache({ module: "facilpad", base: process.cwd() + "/app/" })
templateCache({ module: "facilmap", base: process.cwd() + "/app/" })
)),
gulpIf("**/*.js", combine(
newer("build/app.js"),

Wyświetl plik

@ -2,7 +2,7 @@
<html ng-controller="PadCtrl">
<head>
<meta charset="utf-8">
<title fp-title="padName ? padName + ' – FacilPad' : 'FacilPad'">FacilPad</title>
<title fm-title="padName ? padName + ' – FacilMap' : 'FacilMap'">FacilMap</title>
<meta name="robots" content="index,nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="shortcut icon" href="assets/img/favicon.png">
@ -20,15 +20,15 @@
</style>
</head>
<body>
<noscript><p><strong>FacilPad requires JavaScript to work.</strong></p></noscript>
<noscript><p><strong>FacilMap requires JavaScript to work.</strong></p></noscript>
<div id="loading" ng-if="false">Loading...</div>
<div id="map" fp-map fp-pad-id="{{padId}}"></div>
<facilmap id="map" fm-map-id="{{padId}}"></facilmap>
<script>
var interval = setInterval(function() {
if(window.angular != null && window.io != null) {
clearInterval(interval);
angular.bootstrap(document, [ "facilpad" ]);
angular.bootstrap(document, [ "facilmap" ]);
}
}, 100);
</script>

Wyświetl plik

@ -1,5 +1,5 @@
{
"name": "facilpad",
"name": "facilmap2",
"description": "A real-time collaboration map",
"author": "Candid Dauth <cdauth@cdauth.eu>",
"version": "0.0.1",

Wyświetl plik

@ -63,7 +63,7 @@ function _makeNotNullForeignKey(type, field, error) {
var Pad = conn.define("Pad", {
id : { type: Sequelize.STRING, allowNull: false, primaryKey: true, validate: { is: /^.+$/ } },
name: { type: Sequelize.TEXT, allowNull: true, get: function() { return this.getDataValue("name") || "New FacilPad"; } },
name: { type: Sequelize.TEXT, allowNull: true, get: function() { return this.getDataValue("name") || "New FacilMap"; } },
writeId: { type: Sequelize.STRING, allowNull: false, validate: { is: /^.+$/ } }
});

Wyświetl plik

@ -59,7 +59,7 @@ var viewSchema = mongoose.Schema({
var padSchema = mongoose.Schema({
_id : String,
defaultView : { type: ObjectId, ref: "View" },
name: { type: String, default: "New FacilPad" },
name: { type: String, default: "New FacilMap" },
writeId : String
});

Wyświetl plik

@ -51,7 +51,7 @@ function exportGpx(padId, useTracks) {
var views = '', markers = '', lines = '', types = '';
var viewsP = utils.streamEachPromise(database.getViews(padId), function(view) {
views += '<fp:view name="' + _e(view.name) + '" baselayer="' + _e(view.baseLayer) + '" layers="' + _e(JSON.stringify(view.layers)) + '" bbox="' + _e([ view.left, view.top, view.right, view.bottom].join(',')) + '" />\n';
views += '<fm:view name="' + _e(view.name) + '" baselayer="' + _e(view.baseLayer) + '" layers="' + _e(JSON.stringify(view.layers)) + '" bbox="' + _e([ view.left, view.top, view.right, view.bottom].join(',')) + '" />\n';
});
var typesObj = { };
@ -62,7 +62,7 @@ function exportGpx(padId, useTracks) {
var typesMarkersLinesP = typesObjP.then(function() {
for(var i in typesObj) {
var type = typesObj[i];
types += '<fp:type name="' + _e(type.name) + '" type="' + _e(type.type) + '" fields="' + _e(JSON.stringify(type.fields)) + '" />\n';
types += '<fm:type name="' + _e(type.name) + '" type="' + _e(type.type) + '" fields="' + _e(JSON.stringify(type.fields)) + '" />\n';
}
return Promise.all([
@ -71,7 +71,7 @@ function exportGpx(padId, useTracks) {
'\t<name>' + _e(marker.name) + '</name>\n' +
'\t<desc>' + _e(_dataToText(typesObj[marker.typeId].fields, marker.data)) + '</desc>\n' +
'\t<extensions>\n' +
'\t\t<fp:colour>' + _e(marker.colour) + '</fp:colour>\n' +
'\t\t<fm:colour>' + _e(marker.colour) + '</fm:colour>\n' +
'\t</extensions>\n' +
'</wpt>\n';
}),
@ -82,10 +82,10 @@ function exportGpx(padId, useTracks) {
'\t<name>' + _e(line.name) + '</name>\n' +
'\t<desc>' + _e(_dataToText(typesObj[line.typeId].fields, line.data)) + '</desc>\n' +
'\t<extensions>\n' +
'\t\t<fp:colour>' + _e(line.colour) + '</fp:colour>\n' +
'\t\t<fp:width>' + _e(line.width) + '</fp:width>\n' +
'\t\t<fp:mode>' + _e(line.mode) + '</fp:mode>\n' +
(t && line.mode != 'track' ? '\t\t<fp:routePoints>' + _e(JSON.stringify(line.routePoints)) + '</fp:routePoints>\n' : '') +
'\t\t<fm:colour>' + _e(line.colour) + '</fm:colour>\n' +
'\t\t<fm:width>' + _e(line.width) + '</fm:width>\n' +
'\t\t<fm:mode>' + _e(line.mode) + '</fm:mode>\n' +
(t && line.mode != 'track' ? '\t\t<fm:routePoints>' + _e(JSON.stringify(line.routePoints)) + '</fm:routePoints>\n' : '') +
'\t</extensions>\n';
if(t) {
@ -107,7 +107,7 @@ function exportGpx(padId, useTracks) {
return Promise.all([ padDataP, viewsP, typesMarkersLinesP ]).then(function(res) {
return '<?xml version="1.0" encoding="UTF-8"?>\n' +
'<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="FacilPad" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" xmlns:fp="https://pad.facilmap.org/">\n' +
'<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="FacilMap" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" xmlns:fm="https://pad.facilmap.org/">\n' +
'\t<metadata>\n' +
'\t\t<name>' + _e(res[0].name) + '</name>\n' +
'\t\t<time>' + _e(utils.isoDate()) + '</time>\n' +