Moved existing version of sample application to jenkins repo
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);
+ }
+ });
+ }
+ }
+ });
+}());