Moved existing version of sample application to jenkins repo
diff --git a/mCordPortal/src/app/data/pc_cats.json b/mCordPortal/src/app/data/pc_cats.json
new file mode 100644
index 0000000..299fc13
--- /dev/null
+++ b/mCordPortal/src/app/data/pc_cats.json
@@ -0,0 +1,135 @@
+{
+ "_comment_": "Parental Control Categories - data file",
+
+ "level_order": [
+ "NONE", "G", "PG", "PG_13", "R", "ALL"
+ ],
+
+ "category_order": [
+ "Safe", "Search", "Shopping", "Sports", "Privacy", "Dating", "Games",
+ "Social", "Illegal", "Weapons", "Drugs", "Gambling", "Cyberbully",
+ "Pornography", "Adult", "Anonymizers", "Suicide", "Malware"
+ ],
+
+ "descriptions": {
+ "Safe": [
+ "."
+ ],
+ "Search": [
+ "Sites which provide the ability to perform searches for specific ",
+ "topics or websites across the entire Internet, and which display ",
+ "results in a multi-page format that allows material to be sorted ",
+ "based on content, topic, or file type."
+ ],
+ "Shopping": [
+ "."
+ ],
+ "Sports": [
+ "Sites which analyze, promote, or providing information about ",
+ "competitive sports and its fans whether official or unofficial."
+ ],
+ "Privacy": [
+ "Sites which provide hosted online advertising intended to attract ",
+ "web traffic, deliver marketing messages or capture email addresses."
+ ],
+ "Dating": [
+ "Sites which promote or provide the opportunity for establishing ",
+ "romantic relationship."
+ ],
+ "Games": [
+ "Sites which related to the development, promotion, review, and ",
+ "enjoyment of online, PC, and console videogaming."
+ ],
+ "Social": [
+ "Sites which facilitate online socializing and the development or ",
+ "maintenance of personal and professional relationships across ",
+ "geographical and organizational boundaries."
+ ],
+ "Illegal": [
+ "Sites which promote or provide the means to practice illegal or ",
+ "unauthorized acts using computer-programming skills. And sites ",
+ "which offer custom academic writing services for free or for ",
+ "purchase. These sites are geared toward students who do not want ",
+ "to write their own papers, but will download or buy previously ",
+ "written or custom written papers."
+ ],
+ "Weapons": [
+ "Sites which sell, manufacture, or describe the manufacture of weapons."
+ ],
+ "Drugs": [
+ "Sites which promote, offer, sell, supply, encourage or otherwise ",
+ "advocate the recreational or illegal use, cultivation, manufacture, ",
+ "or distribution of drugs, pharmaceuticals, intoxicating plants or ",
+ "chemicals and their related paraphernalia. And sites which glamorize, ",
+ "glorify, tout or otherwise encourage the consumption of alcohol. And ",
+ "sites which sell, glamorize, enable or encourage the use of tobacco ",
+ "and tobacco-related products."
+ ],
+ "Gambling": [
+ "."
+ ],
+ "Cyberbully": [
+ "Sites or pages where people post targeted, deliberate and slanderous ",
+ "or offensive content about other people with the INTENT to torment, ",
+ "threaten, humiliate or defame them. Content is often sexual, ",
+ "malicious or hostile in nature and is submitted via interactive ",
+ "digital technology. And sites which advocate hostility, aggression ",
+ "and the denigration of an individual or group on the basis of race, ",
+ "religion, gender, nationality, ethnic origin, or other involuntary ",
+ "characteristics. Sites that use purported scientific or commonly ",
+ "accredited methods to justify inequality, aggression, and hostility."
+ ],
+ "Pornography": [
+ "Sites which contain explicit material for the purpose of causing ",
+ "sexual excitement or arousing lascivious interest."
+ ],
+ "Adult": [
+ "Sites which contain sexually explicit information that is not ",
+ "medical or scientific nature and yet are also not pornographic. ",
+ "And sites which feature social or family nudism/naturism, nudist ",
+ "camps/resorts, or „nudist-only‟ travel."
+ ],
+ "Anonymizers": [
+ "Sites which provide anonymous access to websites through a PHP or ",
+ "CGI proxy, allowing users to gain access to websites blocked by ",
+ "corporate and school proxies as well as parental control filtering ",
+ "solutions."
+ ],
+ "Suicide": [
+ "Sites which advocate, normalize, or glamourize repetitive and ",
+ "deliberate ways to inflict non-fatal harm to oneself. And sites ",
+ "advocating or glorifying suicide as well as educating people on how ",
+ "to commit suicide."
+ ],
+ "Malware": [
+ "Sites where the domain was found to either contain malware or take ",
+ "advantage of other exploits to deliver adware, spyware or malware. ",
+ "And Sites that contain direct links to malware file downloads: ",
+ ".exe, .dll, .ocx, and others. These URLs are generally highly malicious."
+ ]
+ },
+
+ "_prohibited_comment_": [
+ "Note: Level NONE allows nothing (prohibits everything)",
+ " level ALL allows everything (prohibits nothing)",
+ " Levels G, PG, PG_13, R prohibitions listed below:"
+ ],
+
+ "prohibited": {
+ "G": [
+ "Games", "Social", "Illegal", "Weapons", "Drugs", "Gambling",
+ "Cyberbully", "Pornography", "Adult", "Anonymizers", "Suicide", "Malware"
+ ],
+ "PG": [
+ "Social", "Illegal", "Weapons", "Drugs", "Gambling",
+ "Cyberbully", "Pornography", "Adult", "Anonymizers", "Suicide", "Malware"
+ ],
+ "PG_13": [
+ "Illegal", "Weapons", "Drugs", "Gambling",
+ "Cyberbully", "Pornography", "Adult", "Anonymizers", "Suicide", "Malware"
+ ],
+ "R": [
+ "Pornography", "Adult", "Anonymizers", "Suicide", "Malware"
+ ]
+ }
+}
diff --git a/mCordPortal/src/app/fw/foot/foot.html b/mCordPortal/src/app/fw/foot/foot.html
new file mode 100644
index 0000000..334df39
--- /dev/null
+++ b/mCordPortal/src/app/fw/foot/foot.html
@@ -0,0 +1,8 @@
+<!--Foot partial html-->
+<div class="footer">
+ <div class="container">
+ <div class="col-xs-12 text-right">
+ © M-CORD Project. All rights reserved.
+ </div>
+ </div>
+</div>
diff --git a/mCordPortal/src/app/fw/foot/foot.js b/mCordPortal/src/app/fw/foot/foot.js
new file mode 100644
index 0000000..fdaabb8
--- /dev/null
+++ b/mCordPortal/src/app/fw/foot/foot.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+angular.module('cordFoot', [])
+ .directive('foot', function () {
+ return {
+ restrict: 'E',
+ templateUrl: 'app/fw/foot/foot.html'
+ };
+ });
diff --git a/mCordPortal/src/app/fw/icon/icon.js b/mCordPortal/src/app/fw/icon/icon.js
new file mode 100644
index 0000000..b0d48fa
--- /dev/null
+++ b/mCordPortal/src/app/fw/icon/icon.js
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function () {
+ 'use strict';
+
+ angular.module('cordGui')
+
+ .directive('icon', [function () {
+ return {
+ restrict: 'E',
+ compile: function (element, attrs) {
+ var html =
+ '<svg class="embedded-icon" width="' + attrs.size + '" ' +
+ 'height="' + attrs.size + '" viewBox="0 0 50 50">' +
+ '<g class="icon">' +
+ '<circle cx="25" cy="25" r="25"></circle>' +
+ '<use width="50" height="50" class="glyph '
+ + attrs.id + '" xlink:href="#' + attrs.id +
+ '"></use>' +
+ '</g>' +
+ '</svg>';
+ element.replaceWith(html);
+ }
+ };
+ }]);
+}());
diff --git a/mCordPortal/src/app/fw/mast/mast.html b/mCordPortal/src/app/fw/mast/mast.html
new file mode 100644
index 0000000..c568713
--- /dev/null
+++ b/mCordPortal/src/app/fw/mast/mast.html
@@ -0,0 +1,32 @@
+<!--Mast HTML-->
+<nav class="navbar navbar-default navbar-fixed-top">
+ <div class="container">
+ <div class="navbar-header">
+ <button ng-if="page.curr !== 'login'" type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="#/home">
+ <img src="/imgs/logo.png">
+ </a>
+ </div>
+ <div id="navbar" class="collapse navbar-collapse" close-on-route-change>
+ <ul ng-if="page.curr !== 'login'" class="nav navbar-nav pull-right">
+ <li ng-class="{active: page.curr === 'dashboard'}">
+ <a href="#/home">Home</a>
+ </li>
+ <li ng-class="{active: page.curr === 'user'}">
+ <a href="#/user">User</a>
+ </li>
+ <li ng-class="{active: page.curr === 'bundle'}">
+ <a href="#/bundle">Services</a>
+ </li>
+ <li ng-click="logout()">
+ <a href="#/contact">Logout</a>
+ </li>
+ </ul>
+ </div><!--/.nav-collapse -->
+ </div>
+</nav>
diff --git a/mCordPortal/src/app/fw/mast/mast.js b/mCordPortal/src/app/fw/mast/mast.js
new file mode 100644
index 0000000..eb08d79
--- /dev/null
+++ b/mCordPortal/src/app/fw/mast/mast.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function () {
+ 'use strict';
+
+ var urlSuffix = '/rs/logout';
+
+ angular.module('cordMast', [])
+ .controller('CordMastCtrl', function ($log, $scope, $location, User) {
+ $scope.logout = function () {
+ User.logout()
+ .then(function(){
+ $location.path('/login');
+ });
+ };
+ })
+ .directive('mast', function () {
+ return {
+ restrict: 'E',
+ templateUrl: 'app/fw/mast/mast.html',
+ controller: 'CordMastCtrl',
+ controllerAs: ''
+ };
+ })
+ .directive('closeOnRouteChange', function(){
+ return {
+ restrict: 'A',
+ link: function(scope, elem){
+ scope.$on('$routeChangeStart', function(next, current) {
+ elem.removeClass('in');
+ });
+ }
+ }
+ });
+}());
diff --git a/mCordPortal/src/app/fw/services/helpers.js b/mCordPortal/src/app/fw/services/helpers.js
new file mode 100644
index 0000000..6f6c4a6
--- /dev/null
+++ b/mCordPortal/src/app/fw/services/helpers.js
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function () {
+ "use strict";
+
+ angular.module('cordGui')
+ .service('Helpers', function(){
+ this.randomDate = function(start, end) {
+ return new Date(
+ start.getTime() + Math.random() * (end.getTime() - start.getTime())
+ );
+ }
+ });
+
+}());
\ No newline at end of file
diff --git a/mCordPortal/src/app/fw/services/rest.js b/mCordPortal/src/app/fw/services/rest.js
new file mode 100644
index 0000000..7d62a5e
--- /dev/null
+++ b/mCordPortal/src/app/fw/services/rest.js
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function () {
+ "use strict";
+
+ function randomEnabled(){
+ var levels = ["enabled", "disabled"];
+ return levels[Math.round(Math.random())];
+ };
+
+
+ angular.module('cordRest', [])
+ .factory('SetCSRFToken', function setCSRFToken($cookies) {
+ return {
+ request: function(request){
+ request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
+ request.headers['sessionId'] = $cookies.get('sessionid');
+ return request;
+ }
+ };
+ })
+ .service('User', function($http, $q, $cookies, cordConfig){
+ this.login = function(username, password){
+ var deferred = $q.defer();
+ var user;
+
+ // logging in the user
+ $http.post(cordConfig.url + '/api/utility/login/', {username: username, password: password})
+ .then(function(res){
+ $cookies.put('user', res.data.user);
+ $cookies.put('sessionid', res.data.xossessionid);
+ user = JSON.parse(res.data.user);
+ return $http.get(cordConfig.url + '/xos/tenantrootprivileges?user=' + user.id);
+ })
+ .then(function(subscribers){
+ // subscribers are an array because the way Django perform query
+ // but one user is related to only one subscriber
+
+ $cookies.put('subscriberId', subscribers.data[0].id);
+ deferred.resolve(user);
+ })
+ .catch(function(e){
+ deferred.reject(e);
+ throw new Error(e);
+ });
+
+ return deferred.promise;
+ };
+
+ this.isLoggedIn = function(){
+ var user = $cookies.get('user');
+ if( angular.isDefined(user)){
+ return true;
+ }
+ return false;
+ };
+
+ this.logout = function(){
+ var deferred = $q.defer();
+ var sessionId = $cookies.get('sessionid');
+ $http.post(cordConfig.url + '/xoslib/logout/', {xossessionid: sessionId})
+ .then(function(res){
+ $cookies.remove('user');
+ deferred.resolve();
+ })
+ .catch(function(e){
+ throw new Error(e);
+ });
+
+ return deferred.promise;
+ };
+ })
+ .service('Subscribers', function($resource, cordConfig){
+ return $resource(cordConfig.url + '/xoslib/rs/subscriber');
+ })
+ .service('SubscriberUsers', function($resource, $filter, cordConfig, Helpers){
+ return $resource(cordConfig.url + '/xoslib/rs/subscriber/:subscriberId/users/:id', {}, {
+ query: {
+ method: 'GET',
+ isArray: true,
+ cache: true,
+ interceptor: {
+ response: function(res){
+ // this is used to fake some data that are not XOS related,
+ // but can be provided by any external services
+
+ // add an icon to the user
+ res.data.map(function(user){
+ switch (user.id){
+ case 0:
+ user['icon_id'] = 'student1';
+ break
+ case 1:
+ user['icon_id'] = 'student2';
+ break
+ case 2:
+ user['icon_id'] = 'student3';
+ break
+ case 3:
+ user['icon_id'] = 'student4';
+ break
+ }
+
+ user.level = randomEnabled()
+
+ return user;
+ });
+
+ // add a random login date to the user
+ res.data.forEach(function(user){
+ if(!angular.isDefined(cordConfig.userActivity[user.id])){
+ var date = Helpers.randomDate(new Date(2015, 0, 1), new Date());
+ cordConfig.userActivity[user.id] = $filter('date')(date, 'mediumTime');
+ }
+ });
+ return res.data;
+ }
+ }
+ }
+ });
+ })
+ .service('SubscriberUsersUrlFilterLevel', function($q, $http, cordConfig){
+ this.updateUrlFilterLevel = function(subscriberId, userId, level){
+ var deferred = $q.defer();
+
+ $http.put(cordConfig.url + '/xoslib/rs/subscriber/' + subscriberId + '/users/' + userId + '/url_filter/' + level)
+ .then(function(res){
+ deferred.resolve(res);
+ })
+ .catch(function(e){
+ throw new Error(e);
+ });
+
+ return deferred.promise;
+ };
+ });
+}());
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/bundle/available.html b/mCordPortal/src/app/view/bundle/available.html
new file mode 100644
index 0000000..91e2268
--- /dev/null
+++ b/mCordPortal/src/app/view/bundle/available.html
@@ -0,0 +1,11 @@
+<div class="panel panel-primary animate" ng-hide="!show">
+ <div class="panel-heading">
+ <h3 class="panel-title">{{available.name}}</h3>
+ </div>
+ <div class="panel-body">
+ {{available.desc}}
+ </div>
+ <div class="panel-footer text-right">
+ <a class="btn btn-success btn-lg" ng-click="changeBundle(available.id)">Apply</a>
+ </div>
+</div>
diff --git a/mCordPortal/src/app/view/bundle/bundle.html b/mCordPortal/src/app/view/bundle/bundle.html
new file mode 100644
index 0000000..48e00c1
--- /dev/null
+++ b/mCordPortal/src/app/view/bundle/bundle.html
@@ -0,0 +1,39 @@
+<!-- Bundle page partial html -->
+<div id="bundle" class="container">
+ <div class="row">
+ <div class="col-sm-6">
+ <h4>You are subscribed to the</h4>
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <h3 class="panel-title">{{name}}</h3>
+ </div>
+ <div class="panel-body">
+ {{desc}}
+ </div>
+ </div>
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <h3 class="panel-title">Services</h3>
+ </div>
+ <table class="table">
+ <tr ng-repeat="func in funcs" class="animate-repeat">
+ <td class="avatar">
+ <img ng-src="{{'/imgs/' + func.id + '.png'}}">
+ </td>
+ <td class="name"><b>{{func.name}}</b></td>
+ <td class="desc">{{func.desc}}</td>
+ </tr>
+ </table>
+ </div>
+
+
+ </div>
+ <div class="col-sm-6">
+ <img class="img-responsive img-rounded" src="imgs/bundle.jpg">
+ <a ng-click="showBundles()" class="btn btn-primary-border btn-lg btn-block">
+ Available Bundles
+ </a>
+ <div id="bundles" bundle-available></div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/bundle/bundle.js b/mCordPortal/src/app/view/bundle/bundle.js
new file mode 100644
index 0000000..310118b
--- /dev/null
+++ b/mCordPortal/src/app/view/bundle/bundle.js
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function () {
+ 'use strict';
+
+ var urlSuffix = '/rs/bundle';
+
+ var basic = 'basic',
+ family = 'family';
+
+ angular.module('cordBundle', [])
+ .controller('CordBundleCtrl', function ($log, $scope, $resource, cordConfig) {
+ var BundleData, resource,
+ getData;
+ $scope.page.curr = 'bundle';
+ $scope.show = false;
+
+ // set the current bundle
+ $scope.name = cordConfig.bundles[cordConfig.activeBundle].name;
+ $scope.desc = cordConfig.bundles[cordConfig.activeBundle].desc;
+ $scope.funcs = cordConfig.bundles[cordConfig.activeBundle].functions;
+
+ // set the available bundle
+ if(cordConfig.activeBundle === 0) {
+ $scope.available = cordConfig.bundles[1];
+ }
+ else{
+ $scope.available = cordConfig.bundles[0];
+ }
+
+ // switching the bundles
+ $scope.changeBundle = function (id) {
+ if(cordConfig.activeBundle === 0){
+ cordConfig.activeBundle = 1;
+ $scope.available = cordConfig.bundles[0];
+ }
+ else{
+ cordConfig.activeBundle = 0;
+ $scope.available = cordConfig.bundles[1];
+ }
+ $scope.name = cordConfig.bundles[cordConfig.activeBundle].name;
+ $scope.desc = cordConfig.bundles[cordConfig.activeBundle].desc;
+ $scope.funcs = cordConfig.bundles[cordConfig.activeBundle].functions;
+ };
+
+ // hiding and showing bundles
+ $scope.showBundles = function () {
+ $scope.show = !$scope.show;
+ };
+
+ $log.debug('Cord Bundle Ctrl has been created.');
+ })
+ .directive('bundleAvailable', function () {
+ return {
+ templateUrl: 'app/view/bundle/available.html'
+ };
+ });
+}());
diff --git a/mCordPortal/src/app/view/home/home.html b/mCordPortal/src/app/view/home/home.html
new file mode 100644
index 0000000..f464ad2
--- /dev/null
+++ b/mCordPortal/src/app/view/home/home.html
@@ -0,0 +1,56 @@
+<!-- Home page partial html -->
+<div id="home" class="container">
+ <div class="row">
+ <div class="col-sm-6 hidden-xs">
+ <img class="img-responsive img-rounded" src="/imgs/stanford.jpg">
+ <p class="text-right small">© Wikipedia</p>
+ </div>
+ <div class="col-sm-6">
+ <div class="bundle-title">
+ <h2>Welcome!</h2>
+ <h5>You are subscribed to the</h5>
+ </div>
+
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <h3 class="panel-title">{{bundle_name}}</h3>
+ </div>
+ <div class="panel-body">
+ {{bundle_desc}}
+ </div>
+ </div>
+
+ <div class="panel panel-primary">
+ <div class="panel-heading">
+ <h3 class="panel-title">Users</h3>
+ </div>
+ <table class="table">
+ <thead>
+ <tr>
+ <th></th>
+ <th>Name</th>
+ <th>Last Login</th>
+ </tr>
+ </thead>
+ <tbody>
+
+ <!--<pre>{{users | json}}</pre>-->
+
+ <tr ng-repeat="user in users" class="animate-repeat" ng-show="users">
+ <td class="avatar">
+ <img class="img-responsive img-rounded" ng-src="{{'/imgs/' + user.icon_id + '.jpg'}}">
+ </td>
+ <td>{{user.name}}</td>
+ <td>{{shared.userActivity[user.id]}}</td>
+ </tr>
+ <tr ng-show="!users">
+ <td colspan="3">
+ <div class="loader"></div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/home/home.js b/mCordPortal/src/app/view/home/home.js
new file mode 100644
index 0000000..1e32c0f
--- /dev/null
+++ b/mCordPortal/src/app/view/home/home.js
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function () {
+ 'use strict';
+
+ angular.module('cordHome', [])
+ .controller('CordHomeCtrl', function ($log, $scope, $cookies, cordConfig, SubscriberUsers) {
+
+ $scope.page.curr = 'dashboard';
+
+ $scope.bundle_name = cordConfig.bundles[cordConfig.activeBundle].name;
+ $scope.bundle_desc = cordConfig.bundles[cordConfig.activeBundle].desc;
+
+ SubscriberUsers.query({subscriberId: $cookies.get('subscriberId')}).$promise
+ .then(function(res){
+ $scope.users = res;
+ })
+ .catch(function(){
+ $log.error('Problem with resource', SubscriberUsers);
+ });
+
+ $log.debug('Cord Home Ctrl has been created.');
+ });
+}());
diff --git a/mCordPortal/src/app/view/login/login.html b/mCordPortal/src/app/view/login/login.html
new file mode 100644
index 0000000..426a2e9
--- /dev/null
+++ b/mCordPortal/src/app/view/login/login.html
@@ -0,0 +1,26 @@
+<!-- Login page partial html -->
+<div class="container login">
+ <div class="login-wrapper">
+ <h3 class="text-center">Subscriber Portal</h3>
+ <form ng-submit="login()">
+ <div class="form-group">
+ <input class="form-control" ng-model="email" type="text" placeholder="email" required>
+ </div>
+ <div class="form-group">
+ <input class="form-control" ng-model="password" type="password" placeholder="password" required>
+ </div>
+ <div class="form-group">
+ <button class="btn btn-primary btn-block" type="submit">
+ Log In
+ <div class="loader small reverse inline" ng-show="loading === true"></div>
+ </button>
+ </div>
+ <div class="form-group" ng-show="error">
+ <div class="alert alert-danger">
+ Sorry, your login failed.
+ Please try again.
+ </div>
+ </div>
+ </form>
+ </div>
+</div>
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/login/login.js b/mCordPortal/src/app/view/login/login.js
new file mode 100644
index 0000000..4db7726
--- /dev/null
+++ b/mCordPortal/src/app/view/login/login.js
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function () {
+ 'use strict';
+
+ angular.module('cordLogin', [])
+ .controller('CordLoginCtrl', function ($log, $scope, $resource, $location, $window, User) {
+
+ $scope.page.curr = 'login';
+ $scope.loading = false;
+
+ $scope.login = function () {
+ if ($scope.email && $scope.password) {
+ //getResource($scope.email);
+ $scope.loading = true;
+ User.login($scope.email, $scope.password)
+ .then(function(user){
+ $location.url('/home');
+ })
+ .catch(function(e){
+ $scope.error = true;
+ })
+ .finally(function(){
+ $scope.loading = false;
+ });;
+
+ $scope.shared.login = $scope.email;
+ }
+ };
+
+ $log.debug('Cord Login Ctrl has been created.');
+ });
+}());
diff --git a/mCordPortal/src/app/view/user/ratingPanel.html b/mCordPortal/src/app/view/user/ratingPanel.html
new file mode 100644
index 0000000..04ee430
--- /dev/null
+++ b/mCordPortal/src/app/view/user/ratingPanel.html
@@ -0,0 +1,22 @@
+<!--Partial HTML for rating panel directive-->
+<div id="rating-panel">
+ <div ng-cloak class="ng-hide ng-cloak panel" ng-show="ratingsShown">
+ <table>
+ <tr>
+ <th class="title">Category</th>
+ <th ng-repeat="rating in level_order">{{rating}}</th>
+ </tr>
+ <tr ng-repeat="cat in category_order">
+ <td class="title">{{cat}}</td>
+ <td ng-repeat="r in level_order">
+ <div ng-if="prohibitedSites[r][cat]">
+ <icon size="15" id="xMark"></icon>
+ </div>
+ <div ng-if="!prohibitedSites[r][cat]">
+ <icon size="15" id="checkMark"></icon>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/user/user.html b/mCordPortal/src/app/view/user/user.html
new file mode 100644
index 0000000..c72b7d7
--- /dev/null
+++ b/mCordPortal/src/app/view/user/user.html
@@ -0,0 +1,41 @@
+<!-- Users page partial html -->
+<div class="container">
+ <div id="user" class="row">
+ <div class="col-xs-12">
+ <table class="table">
+ <thead>
+ <tr>
+ <th></th>
+ <th class="form-inline">
+ Name <input ng-model="q.name" type="text" class="form-control">
+ </th>
+ <th>Last Login</th>
+ <th ng-if="isFamily">
+ Video Optimization:
+ </th>
+ <th ng-if="isFamily"></th>
+ </tr>
+ </thead>
+ <tr ng-repeat="user in users | filter:q" class="animate-repeat" ng-show="users.length > 0">
+ <td class="avatar">
+ <img class="img-rounded" ng-src="{{'/imgs/' + user.icon_id + '.jpg'}}">
+ </td>
+ <td>{{user.name}}</td>
+ <td>{{shared.userActivity[user.id]}}</td>
+ <td ng-if="isFamily">
+ <select class="form-control" ng-model="user.level" ng-options="l for l in levels" ng-change="updateLevel(user)">
+ </select>
+ </td>
+ <td ng-if="isFamily" style="width: 46px">
+ <user-updated-tick user="user">Saved</user-updated-tick>
+ </td>
+ </tr>
+ <tr ng-show="!users">
+ <td colspan="4">
+ <div class="loader"></div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/user/user.js b/mCordPortal/src/app/view/user/user.js
new file mode 100644
index 0000000..78a3a61
--- /dev/null
+++ b/mCordPortal/src/app/view/user/user.js
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+(function () {
+ 'use strict';
+
+ angular.module('cordUser', [])
+ .controller('CordUserCtrl', function ($log, $scope, $resource, $timeout, $filter, $cookies, SubscriberUsers, cordConfig, SubscriberUsersUrlFilterLevel) {
+
+ $scope.page.curr = 'user';
+ $scope.isFamily = false;
+ $scope.newLevels = {};
+ $scope.showCheck = false;
+ $scope.ratingsShown = false;
+
+ SubscriberUsers.query({subscriberId: $cookies.get('subscriberId')}).$promise
+ .then(function(res){
+ $scope.isFamily = cordConfig.bundles[cordConfig.activeBundle].id === 'family';
+ // if bundle is family search for url_filter level
+ if ($scope.isFamily) {
+ angular.forEach(cordConfig.bundles[cordConfig.activeBundle].functions, function(fn){
+ if(fn.id === 'video'){
+ console.log(fn);
+ $scope.levels = fn.params.levels;
+ }
+ });
+ }
+ $scope.users = res;
+ })
+ .catch(function () {
+ $log.error('Problem with resource', SubscriberUsers);
+ });
+
+ $scope.updateLevel = function(user){
+ // TODO save this data and show a confirmation to the user
+ // NOTE subscriberId should be retrieved by login
+ SubscriberUsersUrlFilterLevel.updateUrlFilterLevel(1, user.id, user.level)
+ .then(function(){
+ user.updated = true;
+ })
+ .catch(function(e){
+ throw new Error(e);
+ });
+ };
+
+ $scope.showRatings = function () {
+ $scope.ratingsShown = !$scope.ratingsShown;
+ };
+
+ $log.debug('Cord User Ctrl has been created.');
+ })
+ .directive('userUpdatedTick', function($timeout){
+ return {
+ restric: 'E',
+ scope: {
+ user: '='
+ },
+ template: '<span class="icon-saved animate" ng-show="saved"></span>',
+ link: function(scope, elem){
+ scope.saved = false;
+ scope.$watch('user.updated', function(val){
+ if(val){
+ scope.saved = true;
+ $timeout(function(){
+ scope.saved = false;
+ }, 3000);
+ }
+ });
+ }
+ }
+ });
+}());