-
Notifications
You must be signed in to change notification settings - Fork 0
/
maximal.html
86 lines (80 loc) · 4.06 KB
/
maximal.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<html>
<head>
<title>Page that exerecises all of the files resource methods</title>
</head>
<body ng-app="MyApp">
<div ng-controller="MaximalCtrl as vm">
This is a sample app showing how simple it is to access Drive using ngDrive. <br>
It goes through a sequence of creating then updating some files, finally deleting and tidying up after itself.<br><br>
NB THIS WILL PERMANENTLY REMOVE ANY TRASHED FILES OF THE AUTHENTICATED USER, IF THE USER GRANTED SUFFICIENT PERMISSIONS
<br> <br>
As it stands, this app will prompt you for your authorization. You can view the source of this file to find the 3 lines
that, if uncommented, will allow you to permanently store a refresh token. This is how you would include ngDrive in your Continuous Integration
tests. See also <a href="http://stackoverflow.com/questions/19766912/how-do-i-authorise-an-app-web-or-installed-without-user-intervention-canonic" target="_blank">this question on StackOverflow</a>
which describes how to get a refresh token.
<br> <br>
<label>Please quickly enter your email address to test getPermissionIdsForEmail</label>
<input ng-model="vm.email" placeholder="foo@example.com"/>
<label style="margin-left:4em">Choose an image for resumable insert</label>
<input type="file" ng-model="vm.filebutton" onchange="angular.element(this).scope().vm.uploadImage(this)"/> {{vm.currentStepImage}}
<br> <br>
<table>
<tr valign="top">
<td>
<table>
<tr>
<th style="width:25em">Operation</th>
<th>Status</th>
<th>Data</th>
</tr>
<tr valign="top" ng-repeat="step in vm.steps">
<td>{{step.op}}</td>
<td>{{step.status}}</td>
<td>{{step.data}}</td>
</tr>
</table>
</td>
<td>
<!--<pre>{{vm.currentFile|json}}</pre>-->
</td>
</tr>
</tr>
</table>
<li ng-repeat="file in vm.filesArray">{{file.title}}</li>
</div>
<!-- Load the Google auth-only JS library which we use for OAuth as it deals with browsers, popups and iframes -->
<script src="https://apis.google.com/js/auth.js" type="text/javascript"></script>
<!-- Load angular -->
<script src="../bower_components/angular/angular.min.js"></script>
<!-- Load the OauthService. Must be done before app-->
<script src="../bower_components/ngDrive/build/module.js"></script>
<!--
<script src="../src/services/oauth_s.js"></script>
<script src="../src/services/http_s.js"></script>
<script src="../src/services/drive_s.js"></script>
-->
<!-- The app in its entirety -->
<!-- For unattended testing, you need to load a file that sets credentials. The file should look like ...
var refreshToken = '1/3g-7712FfVkKQWhVrK5jSpoR30zcRFq6';
var clientSecret = 'Y_vhMLVU6rhq';
... and should be loaded thus ...
<script src="appscripts/credentials.js"></script>
-->
<script>
// declare your angular app with ngm.ngDrive as a required module
var myApp = angular.module('MyApp', ['ngm.ngDrive']);
// configure the Oauth Service with your client ID and scopes. That's it, OAuth is now completely dealt with!!!
angular.module('ngm.ngDrive')
.provider('OauthService', ngDrive.Config)
.config(function (OauthServiceProvider) {
OauthServiceProvider.setScopes('https://www.googleapis.com/auth/drive.file');
OauthServiceProvider.setClientID('292329129968-nrf447v3m1jqknroi1naii0kfs92bvf1.apps.googleusercontent.com');
// uncomment the following two lines (and provide a credentials.js - see above) in order to test without prompting
// OauthServiceProvider.setTestingRefreshToken(refreshToken);
// OauthServiceProvider.setTestingClientSecret(clientSecret);
});
</script>
<!-- Load the other two js files. These will all be bundled and minified in the distro -->
<script src="appscripts/controllers/maximal_c.js"></script>
</body>
</html>