Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 espaco 1
<!-- BEGIN PAGE HEADER-->
2
<h3 class="page-title">
3
        File Upload <small>angularjs file upload</small>
4
</h3>
5
<div class="page-bar">
6
        <ul class="page-breadcrumb">
7
                <li>
8
                        <i class="fa fa-home"></i>
9
                        <a href="#/dashboard.html">Home</a>
10
                        <i class="fa fa-angle-right"></i>
11
                </li>
12
                <li>
13
                        <a href="#/file_upload.html">File Upload</a>
14
                </li>
15
        </ul>
16
        <div class="page-toolbar">
17
                <div class="btn-group pull-right">
18
                        <button type="button" class="btn btn-fit-height grey-salt dropdown-toggle" data-toggle="dropdown" dropdown-menu-hover data-delay="1000" data-close-others="true">
19
                        Actions <i class="fa fa-angle-down"></i>
20
                        </button>
21
                        <ul class="dropdown-menu pull-right" role="menu">
22
                                <li>
23
                                        <a href="#">
24
                                        <i class="icon-user"></i> New User </a>
25
                                </li>
26
                                <li>
27
                                        <a href="#">
28
                                        <i class="icon-present"></i> New Event <span class="badge badge-success">4</span>
29
                                        </a>
30
                                </li>
31
                                <li>
32
                                        <a href="#">
33
                                        <i class="icon-basket"></i> New order </a>
34
                                </li>
35
                                <li class="divider">
36
                                </li>
37
                                <li>
38
                                        <a href="#">
39
                                        <i class="icon-flag"></i> Pending Orders <span class="badge badge-danger">4</span>
40
                                        </a>
41
                                </li>
42
                                <li>
43
                                        <a href="#">
44
                                        <i class="icon-users"></i> Pending Users <span class="badge badge-warning">12</span>
45
                                        </a>
46
                                </li>
47
                        </ul>
48
                </div>
49
        </div>
50
</div>
51
<!-- END PAGE HEADER-->
52
 
53
<!-- BEGIN MAIN CONTENT -->
54
<div class="note note-success note-bordered">
55
        <h3>Angular File Upload</h3>
56
        <p>
57
                Angular File Upload is a module for the AngularJS framework. Supports drag-n-drop upload, upload progress, validation filters and a file upload queue. It supports native HTML5 uploads, but degrades to a legacy iframe upload method for older browsers. Works with any server side platform which supports standard HTML form uploads.
58
        </p>
59
        <p><span class="label label-danger">File upload is disabled in the demo only!</span></p>
60
        <p>
61
                For more info please check the <a href="https://github.com/nervgh/angular-file-upload">official github page</a>
62
        </p>
63
</div>
64
 
65
<div class="row" ng-controller="FileUploadCtrl" nv-file-drop="" uploader="uploader" filters="queueLimit, customFilter">
66
        <div class="col-md-4">
67
                <!-- BEGIN: ACCORDION DEMO -->
68
                <div class="portlet light">
69
                        <div class="portlet-title">
70
                                <div class="caption font-green-sharp">
71
                                        <i class="icon-settings font-green-sharp"></i>
72
                                        <span class="caption-subject bold uppercase">Select files</span>
73
                                        <span class="caption-helper hide"></span>
74
                                </div>
75
                                <div class="actions">
76
                                                                <a class="btn btn-circle btn-icon-only btn-default" href="#">
77
                                                                <i class="icon-cloud-upload"></i>
78
                                                                </a>
79
                                                                <a class="btn btn-circle btn-icon-only btn-default" href="#">
80
                                                                <i class="icon-wrench"></i>
81
                                                                </a>
82
                                                        </div>
83
                        </div>
84
                        <div class="portlet-body">
85
                                <div ng-show="uploader.isHTML5">
86
                                        <!-- 3. nv-file-over uploader="link" over-class="className" -->
87
                                        <div class="file-drop-zone margin-bottom-20" nv-file-over="" uploader="uploader" over-class="file-drop-zone-over">
88
                                                Base drop zone
89
                                        </div>
90
                                        <!-- Example: nv-file-drop="" uploader="{Object}" options="{Object}" filters="{String}" -->
91
                                        <div nv-file-drop="" uploader="uploader" options="{ url: '/foo' }">
92
                                                <div nv-file-over="" uploader="uploader" over-class="file-drop-zone-over" class="file-drop-zone margin-bottom-20">
93
                                                        Another drop zone with its own settings
94
                                                </div>
95
                                        </div>
96
                                </div>
97
                                <!-- Example: nv-file-select="" uploader="{Object}" options="{Object}" filters="{String}" -->
98
                                Multiple
99
                                <input type="file" nv-file-select="" uploader="uploader" multiple  /><br/>
100
                                Single
101
                                <input type="file" nv-file-select="" uploader="uploader" />
102
                        </div>
103
                </div>         
104
                <!-- END: ACCORDION DEMO -->
105
        </div>
106
        <div class="col-md-8">
107
                <!-- BEGIN: ACCORDION DEMO -->
108
                <div class="portlet light">
109
                        <div class="portlet-title">
110
                                <div class="caption font-green-sharp">
111
                                        <i class="icon-settings font-green-sharp"></i>
112
                                        <span class="caption-subject bold uppercase">Upload queue</span>
113
                                        <span class="caption-helper">Queue length: {{ uploader.queue.length }}</span>
114
                                </div>
115
                                <div class="actions">
116
                                                                <div class="btn-group">
117
                                                                        <a class="btn btn-circle btn-default btn-sm" href="#" data-toggle="dropdown">
118
                                                                        <i class="fa fa-cogs"></i> Settings <i class="fa fa-angle-down"></i>
119
                                                                        </a>
120
                                                                        <ul class="dropdown-menu pull-right">
121
                                                                                <li>
122
                                                                                        <a href="#">
123
                                                                                        <i class="fa fa-pencil"></i> Edit </a>
124
                                                                                </li>
125
                                                                                <li>
126
                                                                                        <a href="#">
127
                                                                                        <i class="fa fa-trash-o"></i> Delete </a>
128
                                                                                </li>
129
                                                                                <li>
130
                                                                                        <a href="#">
131
                                                                                        <i class="fa fa-ban"></i> Ban </a>
132
                                                                                </li>
133
                                                                                <li class="divider">
134
                                                                                </li>
135
                                                                                <li>
136
                                                                                        <a href="#">
137
                                                                                        <i class="i"></i> Make admin </a>
138
                                                                                </li>
139
                                                                        </ul>
140
                                                                </div>
141
                                                                <a class="btn btn-circle btn-icon-only btn-default fullscreen" href="#" data-original-title="" title="">
142
                                                                </a>
143
                                                        </div>
144
                        </div>
145
                        <div class="portlet-body">
146
                                <div class="table-scrollable table-scrollable-borderless">
147
                                        <table class="table table-hover table-light">
148
                                                <thead>
149
                                                        <tr class="uppercase">
150
                                                                <th width="50%">Name</th>
151
                                                                <th ng-show="uploader.isHTML5">Size</th>
152
                                                                <th ng-show="uploader.isHTML5">Progress</th>
153
                                                                <th>Status</th>
154
                                                                <th>Actions</th>
155
                                                        </tr>
156
                                                </thead>
157
                                                <tbody>
158
                                                        <tr ng-repeat="item in uploader.queue">
159
                                                                <td><strong>{{ item.file.name }}</strong></td>
160
                                                                <td ng-show="uploader.isHTML5" nowrap>{{ item.file.size/1024/1024|number:2 }} MB</td>
161
                                                                <td ng-show="uploader.isHTML5">
162
                                                                        <div class="progress progress-sm" style="margin-bottom: 0;">
163
                                                                                <div class="progress-bar progress-bar-info" role="progressbar" ng-style="{ 'width': item.progress + '%' }"></div>
164
                                                                        </div>
165
                                                                </td>
166
                                                                <td class="text-center">
167
                                                                        <span ng-show="item.isSuccess" class="text-success"><i class="glyphicon glyphicon-ok"></i></span>
168
                                                                        <span ng-show="item.isCancel" class="text-info"><i class="glyphicon glyphicon-ban-circle"></i></span>
169
                                                                        <span ng-show="item.isError" class="text-danger"><i class="glyphicon glyphicon-remove"></i></span>
170
                                                                </td>
171
                                                                <td nowrap>
172
                                                                        <button type="button" class="btn btn-success btn-xs" ng-click="item.upload()" ng-disabled="item.isReady || item.isUploading || item.isSuccess">
173
                                                                        <span class="glyphicon glyphicon-upload"></span> Upload
174
                                                                        </button>
175
                                                                        <button type="button" class="btn btn-warning btn-xs" ng-click="item.cancel()" ng-disabled="!item.isUploading">
176
                                                                        <span class="glyphicon glyphicon-ban-circle"></span> Cancel
177
                                                                        </button>
178
                                                                        <button type="button" class="btn btn-danger btn-xs" ng-click="item.remove()">
179
                                                                        <span class="glyphicon glyphicon-trash"></span> Remove
180
                                                                        </button>
181
                                                                </td>
182
                                                        </tr>
183
                                                </tbody>
184
                                        </table>
185
                                </div>
186
 
187
                                <div>
188
                                        <p>Queue progress:</p>
189
                                        <div class="progress progress-sm" style="">
190
                                                <div class="progress-bar progress-bar-info" role="progressbar" ng-style="{ 'width': uploader.progress + '%' }"></div>
191
                                        </div>
192
                                </div>
193
                                <button type="button" class="btn btn-success btn-s" ng-click="uploader.uploadAll()" ng-disabled="!uploader.getNotUploadedItems().length">
194
                                <span class="glyphicon glyphicon-upload"></span> Upload all
195
                                </button>
196
                                <button type="button" class="btn btn-warning btn-s" ng-click="uploader.cancelAll()" ng-disabled="!uploader.isUploading">
197
                                <span class="glyphicon glyphicon-ban-circle"></span> Cancel all
198
                                </button>
199
                                <button type="button" class="btn btn-danger btn-s" ng-click="uploader.clearQueue()" ng-disabled="!uploader.queue.length">
200
                                <span class="glyphicon glyphicon-trash"></span> Remove all
201
                                </button>
202
                        </div>
203
                </div>         
204
                <!-- END: ACCORDION DEMO -->
205
        </div>
206
</div>
207
<!-- END MAIN CONTENT -->
208
 
209
<!-- BEGIN MAIN JS-->
210
<script>
211
        function FileUploadCtrl($scope, FileUploader) {
212
 
213
            var uploader = $scope.uploader = new FileUploader({
214
                url: '../../../assets/global/plugins/angularjs/plugins/angular-file-upload/upload.php'
215
            });
216
 
217
            // FILTERS
218
            uploader.filters.push({
219
                name: 'customFilter',
220
                fn: function(item /*{File|FileLikeObject}*/ , options) {
221
                    return this.queue.length < 10;
222
                }
223
            });
224
 
225
            // CALLBACKS
226
 
227
            uploader.onWhenAddingFileFailed = function(item /*{File|FileLikeObject}*/ , filter, options) {
228
                console.info('onWhenAddingFileFailed', item, filter, options);
229
            };
230
            uploader.onAfterAddingFile = function(fileItem) {
231
                console.info('onAfterAddingFile', fileItem);
232
            };
233
            uploader.onAfterAddingAll = function(addedFileItems) {
234
                console.info('onAfterAddingAll', addedFileItems);
235
            };
236
            uploader.onBeforeUploadItem = function(item) {
237
                console.info('onBeforeUploadItem', item);
238
            };
239
            uploader.onProgressItem = function(fileItem, progress) {
240
                console.info('onProgressItem', fileItem, progress);
241
            };
242
            uploader.onProgressAll = function(progress) {
243
                console.info('onProgressAll', progress);
244
            };
245
            uploader.onSuccessItem = function(fileItem, response, status, headers) {
246
                console.info('onSuccessItem', fileItem, response, status, headers);
247
            };
248
            uploader.onErrorItem = function(fileItem, response, status, headers) {
249
                console.info('onErrorItem', fileItem, response, status, headers);
250
            };
251
            uploader.onCancelItem = function(fileItem, response, status, headers) {
252
                console.info('onCancelItem', fileItem, response, status, headers);
253
            };
254
            uploader.onCompleteItem = function(fileItem, response, status, headers) {
255
                console.info('onCompleteItem', fileItem, response, status, headers);
256
            };
257
            uploader.onCompleteAll = function() {
258
                console.info('onCompleteAll');
259
            };
260
 
261
            console.info('uploader', uploader);
262
        };
263
</script>
264
<!-- BEGIN MAIN JS -->