8
8
}
9
9
} ) ;
10
10
} ,
11
- sequenceProgress : function ( percent ) {
12
- this . uploader . settings . sequenceProgress ( percent ) ;
11
+ sequenceProgress : function ( percent , message ) {
12
+ this . uploader . settings . sequenceProgress ( percent , message ) ;
13
13
return this ;
14
14
} ,
15
- contentProgress : function ( percent ) {
16
- this . uploader . settings . contentProgress ( percent ) ;
15
+ contentProgress : function ( percent , message ) {
16
+ this . uploader . settings . contentProgress ( percent , message ) ;
17
17
return this ;
18
18
} ,
19
19
complete : function ( success , message ) {
23
23
starting : function ( ) {
24
24
this . uploader . settings . starting ( ) ;
25
25
return this ;
26
+ } ,
27
+ option : function ( options ) {
28
+ if ( options )
29
+ $ . extend ( $ ( this ) . uploader . settings , options ) ;
26
30
}
27
31
} ;
28
32
41
45
42
46
$ . fn . uploader . settings = {
43
47
'complete' : function ( success , message ) { } ,
44
- 'sequenceProgress' : function ( percent ) { } ,
45
- 'contentProgress' : function ( percent ) { } ,
48
+ 'sequenceProgress' : function ( percent , message ) { } ,
49
+ 'contentProgress' : function ( percent , message ) { } ,
46
50
'starting' : function ( ) { } ,
47
51
'url' : 'http://localhost/Test/Upload' ,
48
52
'maxSize' : 30720 ,
49
53
'uploadInividually' : true ,
50
- 'callbackCompleted' : 'uploadComplete ' ,
51
- 'callbackSequenceProgress' : 'uploadSequenceProgress ' ,
52
- 'callbackContentProgress' : 'uploadContentProgress ' ,
53
- 'callbackStarting' : 'uploadStarting ' ,
54
+ 'callbackCompleted' : 'uploader_uploadComplete ' ,
55
+ 'callbackSequenceProgress' : 'uploader_uploadSequenceProgress ' ,
56
+ 'callbackContentProgress' : 'uploader_uploadContentProgress ' ,
57
+ 'callbackStarting' : 'uploader_uploadStarting ' ,
54
58
'customData' : null ,
55
59
'buttonText' : 'Select Files' ,
56
- 'uploadChunked' : false ,
60
+ 'uploadChunked' : false ,
57
61
'chunkSize' : 0 //default of 200 KB
58
62
} ;
59
63
} ) ( jQuery ) ;
60
64
61
65
62
- //default callbacks for this silverlight control
63
- function uploadSequenceProgress ( percent ) {
64
- $ ( '#SilverlightControl' ) . uploader ( 'sequenceProgress' , percent ) ;
65
- }
66
- function uploadContentProgress ( percent ) {
67
- $ ( '#SilverlightControl' ) . uploader ( 'contentProgress' , percent ) ;
68
- }
69
- function uploadComplete ( success , message ) {
70
- $ ( '#SilverlightControl' ) . uploader ( 'complete' , success , message ) ;
71
- }
72
- function uploadStarting ( ) {
73
- $ ( '#SilverlightControl' ) . uploader ( 'starting' ) ;
74
- }
75
-
76
- function uploaderOnLoad ( ) {
77
- var settings = $ ( '#SilverlightControl' ) . uploader . settings ;
78
- var raw = document . getElementById ( "SilverlightControl" ) ;
79
- raw . content . page . Setup ( settings . url , settings . maxSize , settings . uploadInividually , settings . callbackSequenceProgress , settings . callbackContentProgress , settings . callbackCompleted , settings . callbackStarting , serializeCustomData ( settings . customData ) , settings . buttonText , settings . uploadChunked , settings . chunkSize ) ;
80
- }
81
-
82
- function serializeCustomData ( data ) {
83
- var s = '' ;
84
- var ix = 0 ;
85
- for ( property in data ) {
86
- if ( ix > 0 )
87
- s += ';' ;
88
- s += property + ':' + data [ property ] . toString ( ) ;
89
- ix ++ ;
90
- }
91
- return s ;
92
- }
93
-
94
- function onSilverlightError ( sender , args ) {
95
-
66
+ function uploader_onSilverlightError ( sender , args ) {
96
67
var appSource = "" ;
97
68
if ( sender != null && sender != 0 ) {
98
69
appSource = sender . getHost ( ) . Source ;
99
70
}
100
71
var errorType = args . ErrorType ;
101
72
var iErrorCode = args . ErrorCode ;
102
73
103
- var errMsg = "Unhandled Error in Silverlight 2 Application " + appSource + "\n" ;
74
+ var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n" ;
104
75
105
76
errMsg += "Code: " + iErrorCode + " \n" ;
106
77
errMsg += "Category: " + errorType + " \n" ;
@@ -121,3 +92,36 @@ function onSilverlightError(sender, args) {
121
92
122
93
throw new Error ( errMsg ) ;
123
94
}
95
+
96
+ //default callbacks for this silverlight control
97
+ function uploader_uploadSequenceProgress ( percent , message ) {
98
+ $ ( '#uploaderControl' ) . uploader ( 'sequenceProgress' , percent , message ) ;
99
+ }
100
+
101
+ function uploader_uploadContentProgress ( percent , message ) {
102
+ $ ( '#uploaderControl' ) . uploader ( 'contentProgress' , percent , message ) ;
103
+ }
104
+ function uploader_uploadComplete ( success , message ) {
105
+ $ ( '#uploaderControl' ) . uploader ( 'complete' , success , message ) ;
106
+ }
107
+ function uploader_uploadStarting ( ) {
108
+ $ ( '#uploaderControl' ) . uploader ( 'starting' ) ;
109
+ }
110
+
111
+ function uploader_initSilverlight ( ) {
112
+ var settings = $ ( '#uploaderControl' ) . uploader . settings ;
113
+ var raw = document . getElementById ( "uploaderControl" ) ;
114
+ raw . content . page . Setup ( settings . url , settings . maxSize , settings . uploadInividually , settings . callbackSequenceProgress , settings . callbackContentProgress , settings . callbackCompleted , settings . callbackStarting , uploader_serializeCustomData ( settings . customData ) , settings . buttonText , settings . uploadChunked , settings . chunkSize ) ;
115
+ }
116
+
117
+ function uploader_serializeCustomData ( data ) {
118
+ var s = '' ;
119
+ var ix = 0 ;
120
+ for ( property in data ) {
121
+ if ( ix > 0 )
122
+ s += ';' ;
123
+ s += property + ':' + data [ property ] . toString ( ) ;
124
+ ix ++ ;
125
+ }
126
+ return s ;
127
+ }
0 commit comments