Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Conflicts:
	src/controllers/leafletCtrl.js
  • Loading branch information
tomvantilburg committed Mar 11, 2014
2 parents b8ba891 + a9ab77f commit dec878d
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/cow
Submodule cow updated 36 files
+5 −1 README.md
+9,046 −0 lib/jquery-1.6.4/jquery-1.6.4.js
+2,694 −0 lib/jquery.signalR/jquery.signalR-2.0.2.js
+11 −34 server/node/cash.js
+22 −0 server/signalr/CowSignalR.sln
+51 −0 server/signalr/CowSignalR/CowHub.cs
+148 −0 server/signalr/CowSignalR/CowSignalR.csproj
+35 −0 server/signalr/CowSignalR/Properties/AssemblyInfo.cs
+23 −0 server/signalr/CowSignalR/Properties/PublishProfiles/cow.pubxml
+17 −0 server/signalr/CowSignalR/Properties/PublishProfiles/file.pubxml
+7,024 −0 server/signalr/CowSignalR/Scripts/jquery-1.6.4-vsdoc.js
+9,046 −0 server/signalr/CowSignalR/Scripts/jquery-1.6.4.js
+4 −0 server/signalr/CowSignalR/Scripts/jquery-1.6.4.min.js
+2,694 −0 server/signalr/CowSignalR/Scripts/jquery.signalR-2.0.2.js
+8 −0 server/signalr/CowSignalR/Scripts/jquery.signalR-2.0.2.min.js
+487 −0 server/signalr/CowSignalR/Scripts/json2.js
+1 −0 server/signalr/CowSignalR/Scripts/json2.min.js
+18 −0 server/signalr/CowSignalR/Startup.cs
+30 −0 server/signalr/CowSignalR/Web.Debug.config
+31 −0 server/signalr/CowSignalR/Web.Release.config
+23 −0 server/signalr/CowSignalR/Web.config
+49 −0 server/signalr/CowSignalR/cowhub.html
+16 −0 server/signalr/CowSignalR/packages.config
+1 −1 src/cow2.core.js
+2 −2 src/cow2.group.js
+1 −1 src/cow2.item.js
+1 −1 src/cow2.js
+26 −5 src/cow2.peer.js
+18 −2 src/cow2.project.js
+12 −3 src/cow2.record.js
+444 −0 src/cow2.signalR.js
+1 −4 src/cow2.syncstore.js
+5 −1 src/cow2.user.js
+7 −6 src/cow2.websocket.js
+2 −2 test/cow.testsuite.js
+8 −3 test/index.html
10 changes: 10 additions & 0 deletions src/controllers/beeldSideCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ icm.controller('BeeldSideCtrl', ['$scope', '$stateParams', 'Beelden', 'Core', 'U
if(!Core.project($stateParams.incidentID)) return false;

}
$scope.nieuwBericht = false;
$scope.$watch('data.users',function(users){
var updated = false;
_(users).each(function(d){
if(d.updated) updated = true;
})
$scope.nieuwBericht =updated;

}, true);
//functie om het huidige beeld op te halen
$scope.currentBeeld = _(Beelden.beelden).filter(function(d){
return d.beeld == $scope.beeldType;
Expand Down Expand Up @@ -49,6 +57,8 @@ icm.controller('BeeldSideCtrl', ['$scope', '$stateParams', 'Beelden', 'Core', 'U
$scope.getBerichten = function(user) {
$scope.discussie = user.name;
$scope.gesprek = true;
user.timestamp = new Date().getTime();
user.updated = false;
}
$scope.sendMessage = function() {
if($scope.chat == '') return false;
Expand Down
83 changes: 83 additions & 0 deletions src/controllers/incidentCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Please note that $modalInstance represents a modal window (instance) dependency.
// It is not the same as the $modal service used above.
icm.controller('IncidentCtrl' ,['$scope', 'Core', '$stateParams', '$location', function($scope, Core, $stateParams, $location) {

var project = null;
$scope.incident = {};
$scope.isNew = true;
$scope.projectTypes =
[
{ id: 0, name: "LIVE" },
{ id: 1, name: "Oefening" }
];
$scope.projectStatuses =
[
{ id: 0, name: "Actief" },
{ id: 1, name: "Gepland" },
{ id: 2, name: "Gesloten" }
];

/* Datepicker configuration */
$scope.dateOptions = {
'starting-day': 1
};
$scope.open = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.opened = true;
};

if ($stateParams.incidentID != undefined)
{
if(!Core.project()) return false;
//TODO: hier moet je of terug gestuurd worden naar incidenten of netjes met een promise oid alsnog alle gegevens zetten

project = Core.projects($stateParams.incidentID + '');
}

if (project === null)
{
$scope.id = null;
$scope.incident.date = new Date();
$scope.incident.name = '';
$scope.incident.status = $scope.projectStatuses[0];
$scope.isPlanned = false;
$scope.incident.type = $scope.projectTypes[1];
$scope.isNew = true;
} else {
$scope.id = project.id();
$scope.incident.name = project.data('name');
$scope.incident.date = project.data('date');
$scope.incident.status = project.data('status') === undefined ? $scope.projectStatuses[0] : $scope.projectStatuses[project.data('status').id];
$scope.incident.type = project.data('type') === undefined ? $scope.projectTypes[1] : $scope.projectTypes[project.data('type').id];
$scope.isPlanned = $scope.incident.status.id === 1;
$scope.isNew = false;
}

$scope.changeStatus = function() {
$scope.isPlanned = $scope.incident.status.id === 1;
console.log('change: ' + $scope.isPlanned);
};

$scope.ok = function () {
var coreProject;
if ($scope.id === null) {
coreProject = Core.projects({_id: Date.now()});
coreProject.itemStore.loaded.then(function () {
//TODO load all map layers
});
} else {
coreProject = Core.projects( $scope.id + '');
}

if ($scope.isPlanned) {
coreProject.data('date', $scope.incident.date.toISOString());
}

coreProject.data('name',$scope.incident.name)
.data('status',$scope.incident.status)
.data('type',$scope.incident.type)
.sync();
$location.path('/incidenten');
};
}]);
16 changes: 16 additions & 0 deletions src/controllers/incidentenCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ icm.controller('IncidentenCtrl' ,['$scope', 'Core', 'Utils', 'Beelden', 'Leaflet
b.updated = updated;

});


_($scope.data.users).each(function(u){
var updated =false;
var berichten = _($scope.data.itemlist).filter(function(d){
return (d.data('naar') == $scope.data.user && d.data('van') == u.name )
});
_(berichten).each(function(msg){
if(msg._updated > u.timestamp) {
updated = true;
}
u.updated = updated;
})
})


}

//Set the current project
Expand Down
1 change: 1 addition & 0 deletions src/controllers/leafletCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ icm.controller('LeafletController', [ '$scope','$http','$timeout','Core', 'Utils
/** Bind layer reload on storechanged **/
var itemstore = core.project().itemStore();
var peerstore = core.peerStore();

itemstore.off('datachange',populateFeatures);
itemstore.on('datachange',populateFeatures);
peerstore.off('datachange',populatePeers);
Expand Down
1 change: 1 addition & 0 deletions src/factories.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ icm.factory('Utils', ['$rootScope', function ($rootScope) {
var user = {};
user.online = _.contains(onlinePeers,d);
user.name = d;
user.timestamp = 0;
onlineUsers.push(user)
});
return onlineUsers;
Expand Down
13 changes: 10 additions & 3 deletions templates/incident.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ <h5 class="list-group-item-heading text-primary">Status</h5>
<h5 class="list-group-item-heading text-primary">Incidentdatum</h5>
<p class="input-group">
<input type="text" class="form-control" datepicker-popup="dd-MM-yyyy" ng-model="incident.date" is-open="opened" datepicker-options="dateOptions" show-button-bar="false" show-weeks="false" date-disabled="disabled(date, mode)" close-text="Sluiten" ng-disabled="!isPlanned" />
<span class="input-group-btn">
<button class="btn btn-default" ng-click="open($event)" ng-disabled="!isPlanned"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
<span class="input-group-btn">
<button class="btn btn-default" ng-click="open($event)" ng-disabled="!isPlanned"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
<p>
<timepicker ng-model="incident.date" ng-disabled="!isPlanned" hour-step="1" minute-step="1" show-meridian="false"></timepicker>
</p>
<p>
{{incident.date}}
</p>

<p>Kies hier de datum van het incident</p>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions templates/sidebar/beeld.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@


</div>
<div class="panel panel-info">
<div class="panel-heading">Berichten <span ng-click="isCollapsed = !isCollapsed" ng-class="{ 'glyphicon-chevron-up':!isCollapsed, 'glyphicon-chevron-down':isCollapsed}" class="pull-right glyphicon"></span><span class="clearfix"></span></div>
<div class="panel panel-info" ng-class="{'panel-danger':nieuwBericht,'active':nieuwBericht}">
<div class="panel-heading" ng-click="isCollapsed = !isCollapsed">Berichten <span ng-class="{ 'glyphicon-chevron-up':!isCollapsed, 'glyphicon-chevron-down':isCollapsed}" class="pull-right glyphicon"></span><span class="clearfix"></span></div>
<div class="list-group" collapse="isCollapsed">
<div ng-class="{'hidden':gesprek}" class="list-group-item" ng-click="getBerichten(user)" ng-repeat="user in data.users | orderBy:'online':true">
<div ng-class="{'hidden':gesprek,'list-group-item-danger': user.updated}" class="list-group-item" ng-click="getBerichten(user)" ng-repeat="user in data.users | orderBy:'online':true">
{{user.name}}
<span class="pull-right" >
<span class="glyphicon" ng-class="{'glyphicon-ok-sign': user.online, 'glyphicon-minus-sign': !user.online,'text-danger':!user.online, 'text-success':user.online}"></span>
<span class="glyphicon" ng-class="{'glyphicon-ok-sign': user.online, 'glyphicon-minus-sign': !user.online,'text-danger':!user.online, 'text-success':user.online}"></span><span class="glyphicon" ng-class="{'glyphicon-bell': user.updated}"></span>
</span>
</div>

Expand Down

0 comments on commit dec878d

Please sign in to comment.