e819c92f9529e7e58dc46fc56ab2c148d6c40c83
[portal/sdk.git] /
1 /*app.
2 controller('notebookFrameController', ['$scope', '$location','$window','$http', function ($scope,$location,$window,$http) {
3         
4         $scope.invokeSaveNotebook() = function() { 
5                 
6                 
7                 //      $http.post('rNotebookFE/authCr', $scope.postData).success(function(data, status) {
8                         $http({method:'POST', url:'rNotebookFE/authCr', data: $scope.notebookvalue, params:{'qparams' : $scope.additionalqueryParams}}).success(function(data, status) {
9                             console.log('Data Sent', data);
10                             console.log('Status ', status);
11                             
12                         
13                                  
14                             // iframe.name = "my_iframe";
15                             
16                           //  $scope.ifr = "<div><iframe src='http://www.w3schools.com'/></div>"
17                           
18                           //  var url = "https://rcloud.research.att.com";
19                         //    document.getElementById('itestfr').src = data;
20                             window.open ('notebook.htm#/notebook-frame','_self',false);
21                         //   $scope.iframevisibility = true; 
22                         //    document.getElementById('itestfr').src = data;
23                            
24                                 
25                                 })
26                         
27                         
28                 }
29
30 }]);*/
31 app.controller('notebookFrameController', function ($scope,$location,$window,$http,$routeParams) {
32         
33         //alert($location.search(1, $scope.additionalqueryParams));
34         //var nid = $routeParams.nid;
35         //var qprms = $routeParams.qprms;
36         //var value = $routeParams.value;
37         //console.log('check id ');
38         var nid = $window.location.search.substr($window.location.search.indexOf("=")+1);
39         //console.log('nid',nid);
40         //console.log('qprms',qprms);
41         //$scope.notebookvalue = '833c0a69ec1433fbb2f8752af733cf0e'; 
42         $scope.additionalqueryParams={};
43         if ($window.location.search.substr($window.location.search.indexOf("=")+1)) {
44                 $scope.queryParams = $window.location.search;
45                 //console.log('$window.location.search',$window.location.search.substring(0, $window.location.search.length-1));
46                 //if ($window.location.search.indexOf("&")!=-1) {
47                 if($window.location.search.substring(0, $window.location.search.length-1).indexOf("&")!=-1) {
48                         $scope.notebookparam = $window.location.search.substring($window.location.search.indexOf("?")+1,$window.location.search.indexOf("&"));
49                         $scope.additionalqueryParams = JSON.parse('{"' + decodeURI($scope.queryParams.substr($scope.queryParams.indexOf("&")+1).replace(/&/g, "\",\"").replace(/=/g,"\":\"")) + '"}');
50                         //console.log('Additional parameters present');
51                 }
52                 else {
53                         $scope.notebookparam1 = $window.location.search.substr($window.location.search.indexOf("?")+1);
54                         $scope.notebookparam = $scope.notebookparam1.substring(0, $scope.notebookparam1.length - 1);
55                         //console.log('Additional parameters absent');
56                 }
57                 //console.log('add parameters',$scope.additionalqueryParams);
58         //      $scope.notebookid = $scope.notebookparam.substring(0,$scope.notebookparam.indexOf("="));
59                 $scope.notebookvalue = $scope.notebookparam.substr($scope.notebookparam.indexOf("=")+1);
60         //      $scope.notebookvalue = $scope.notebookvalue1.substring(0, $scope.notebookvalue1.length - 1); 
61                 //console.log('New VALL',$scope.notebookvalue);
62                 //$scope.postData = $window.location.search.substr($window.location.search.indexOf("=")+1);
63                 //console.log('Notebook value present ',$scope.notebookvalue);
64         }
65         else {
66                 $scope.notebookvalue = '833c0a69ec1433fbb2f8752af733cf0e';
67                 //console.log('Notebook value absent ',$scope.notebookvalue);
68         }
69         
70         
71         
72         $http({method:'POST', url:'rNotebookFE/authCr', data: $scope.notebookvalue, params:{'qparams' : $scope.additionalqueryParams}}).success(function(data, status) {
73         //console.log('Data received', data);
74         //console.log('Status ', status);
75         document.getElementById('itestframe').src = data;
76    
77         })
78         
79         
80         
81 });