rsence-pre 2.2.0.34 → 2.2.0.35
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/conf/default_conf.yaml +1 -1
- data/js/controls/uploader/themes/default/uploader.css +3 -3
- data/js/controls/uploader/uploader.coffee +111 -0
- data/js/foundation/view/view.js +68 -6
- metadata +5 -5
- data/js/controls/uploader/uploader.js +0 -162
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.0.
|
1
|
+
2.2.0.35.pre
|
data/conf/default_conf.yaml
CHANGED
@@ -80,13 +80,13 @@
|
|
80
80
|
background-position: 0px -96px;
|
81
81
|
}
|
82
82
|
.disabled > .uploader > .button_control > .button_edge_right {
|
83
|
-
background-position: -
|
83
|
+
background-position: -42px -144px;
|
84
84
|
}
|
85
85
|
.enabled > .uploader:hover > .button_control > .button_edge_right {
|
86
|
-
background-position: -
|
86
|
+
background-position: -42px -48px;
|
87
87
|
}
|
88
88
|
.enabled > .uploader:active > .button_control > .button_edge_right {
|
89
|
-
background-position: -
|
89
|
+
background-position: -42px -96px;
|
90
90
|
}
|
91
91
|
.disabled > .uploader > .button_control > .button_center {
|
92
92
|
background-position: 0px -168px;
|
@@ -0,0 +1,111 @@
|
|
1
|
+
## RSence
|
2
|
+
# Copyright 2008-2011 Riassence Inc.
|
3
|
+
# http://riassence.com/
|
4
|
+
#
|
5
|
+
# You should have received a copy of the GNU General Public License along
|
6
|
+
# with this software package. If not, contact licensing@riassence.com
|
7
|
+
##
|
8
|
+
|
9
|
+
# The default locale settings, may be overridden on the server.
|
10
|
+
HLocale.components.HUploader =
|
11
|
+
strings:
|
12
|
+
ok: 'OK'
|
13
|
+
stateLabels:
|
14
|
+
# Upload success states:
|
15
|
+
'0': "Select file...",
|
16
|
+
'1': "Uploading...",
|
17
|
+
'2': "Processing data...",
|
18
|
+
'3': "Upload Complete",
|
19
|
+
'4': "Preparing upload",
|
20
|
+
# Upload failure states:
|
21
|
+
'-1': "Error: Invalid request",
|
22
|
+
'-2': "Error: Invalid upload key",
|
23
|
+
'-3': "Error: Invalid data format",
|
24
|
+
'-4': "Error: File too big",
|
25
|
+
'-6': "Error: Post-processing failed"
|
26
|
+
|
27
|
+
HUploader = HControl.extend
|
28
|
+
componentName: 'uploader'
|
29
|
+
uploadState: false
|
30
|
+
uploadKey: false
|
31
|
+
markupElemNames: [
|
32
|
+
'form',
|
33
|
+
'file',
|
34
|
+
'iframe',
|
35
|
+
'upload_progress',
|
36
|
+
'progress_label',
|
37
|
+
'progress_indicator',
|
38
|
+
'button',
|
39
|
+
'button_label',
|
40
|
+
'value',
|
41
|
+
'ack_button'
|
42
|
+
]
|
43
|
+
|
44
|
+
defaultEvents:
|
45
|
+
click: true
|
46
|
+
|
47
|
+
setUploadKey: (_uploadKey, _label)->
|
48
|
+
@setStyleOfPart( 'upload_progress', 'visibility', 'hidden' )
|
49
|
+
@setStyleOfPart( 'progress_indicator', 'visibility', 'hidden' )
|
50
|
+
@setStyleOfPart( 'ack_button', 'visibility', 'hidden' )
|
51
|
+
@setMarkupOfPart( 'button_label', _label )
|
52
|
+
@setStyleOfPart( 'button', 'visibility', 'inherit' )
|
53
|
+
@setStyleOfPart( 'form', 'visibility', 'inherit' )
|
54
|
+
@setAttrOfPart( 'form', 'action', '/U/'+_uploadKey, true )
|
55
|
+
@setAttrOfPart( 'file', 'value', '', true )
|
56
|
+
@uploadKey = _uploadKey
|
57
|
+
|
58
|
+
setProgressState: (_state, _label)->
|
59
|
+
@setStyleOfPart( 'upload_progress', 'visibility', 'inherit' )
|
60
|
+
if _state == 3
|
61
|
+
@setStyleOfPart( 'progress_indicator', 'visibility', 'hidden' )
|
62
|
+
@setStyleOfPart( 'ack_button', 'visibility', 'inherit' )
|
63
|
+
else
|
64
|
+
@setStyleOfPart( 'progress_indicator', 'visibility', 'inherit' )
|
65
|
+
@setStyleOfPart( 'ack_button', 'visibility', 'hidden' )
|
66
|
+
@setMarkupOfPart( 'progress_label', _label )
|
67
|
+
@setStyleOfPart( 'button', 'visibility', 'hidden' )
|
68
|
+
@setStyleOfPart( 'form', 'visibility', 'hidden' )
|
69
|
+
if _state == 1
|
70
|
+
@elemOfPart( 'form' ).submit()
|
71
|
+
|
72
|
+
setErrorState: (_label)->
|
73
|
+
@setStyleOfPart( 'progress_indicator', 'visibility', 'hidden' )
|
74
|
+
@setStyleOfPart( 'ack_button', 'visibility', 'inherit' )
|
75
|
+
@setMarkupOfPart( 'progress_label', '<span style="color:red;">'+_label+'</span>' )
|
76
|
+
@setStyleOfPart( 'button', 'visibility', 'hidden' )
|
77
|
+
@setStyleOfPart( 'form', 'visibility', 'hidden' )
|
78
|
+
|
79
|
+
setUploadState: (_state, _uploadKey)->
|
80
|
+
console.log('state:',_state,', uploadKey:',_uploadKey)
|
81
|
+
if _state != @uploadState
|
82
|
+
@uploadState = _state
|
83
|
+
_stateKey = _state.toString()
|
84
|
+
_stateLabels = HLocale.components.HUploader.strings.stateLabels
|
85
|
+
if _stateLabels[_stateKey]?
|
86
|
+
_label = _stateLabels[_stateKey]
|
87
|
+
ELEM.get(@markupElemIds.value).value = @valueObj.id
|
88
|
+
if _state == 0
|
89
|
+
@setUploadKey( _uploadKey, _label )
|
90
|
+
else if _state >= 1 and _state <= 4
|
91
|
+
@setProgressState( _state, _label )
|
92
|
+
else if _state < 0
|
93
|
+
@setErrorState( _label )
|
94
|
+
|
95
|
+
refreshValue: ->
|
96
|
+
return unless typeof @value == 'string'
|
97
|
+
return if @value.indexOf(':::') == -1
|
98
|
+
_stateAndKey = @value.split(':::')
|
99
|
+
return unless _stateAndKey.length == 2
|
100
|
+
@setUploadState(
|
101
|
+
parseInt( _stateAndKey[0], 10),
|
102
|
+
_stateAndKey[1]
|
103
|
+
)
|
104
|
+
upload: ->
|
105
|
+
@setValue( '1:::'+@uploadKey )
|
106
|
+
|
107
|
+
getNewUploadKey: ->
|
108
|
+
@setValue( '4:::'+@uploadKey )
|
109
|
+
|
110
|
+
click: ->
|
111
|
+
@getNewUploadKey() if @uploadState == 3 or @uploadState < 0
|
data/js/foundation/view/view.js
CHANGED
@@ -1126,7 +1126,7 @@ HView = HClass.extend({
|
|
1126
1126
|
* +self+
|
1127
1127
|
*
|
1128
1128
|
**/
|
1129
|
-
setStyleOfPart: function(_partName, _name, _value,
|
1129
|
+
setStyleOfPart: function(_partName, _name, _value, _force) {
|
1130
1130
|
if (!this['markupElemIds']){
|
1131
1131
|
console.log('Warning, setStyleOfPart: no markupElemIds');
|
1132
1132
|
}
|
@@ -1134,7 +1134,7 @@ HView = HClass.extend({
|
|
1134
1134
|
console.log('Warning, setStyleOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
|
1135
1135
|
}
|
1136
1136
|
else {
|
1137
|
-
ELEM.setStyle(this.markupElemIds[_partName], _name, _value,
|
1137
|
+
ELEM.setStyle(this.markupElemIds[_partName], _name, _value, _force);
|
1138
1138
|
}
|
1139
1139
|
return this;
|
1140
1140
|
},
|
@@ -1151,12 +1151,12 @@ HView = HClass.extend({
|
|
1151
1151
|
* The style of a specified markup element.
|
1152
1152
|
*
|
1153
1153
|
**/
|
1154
|
-
styleOfPart: function(_partName, _name) {
|
1154
|
+
styleOfPart: function(_partName, _name, _force) {
|
1155
1155
|
if (this.markupElemIds[_partName]===undefined) {
|
1156
1156
|
console.log('Warning, styleOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
|
1157
1157
|
return '';
|
1158
1158
|
}
|
1159
|
-
return ELEM.getStyle(this.markupElemIds[_partName], _name);
|
1159
|
+
return ELEM.getStyle(this.markupElemIds[_partName], _name, _force);
|
1160
1160
|
},
|
1161
1161
|
|
1162
1162
|
/** = Description
|
@@ -1189,7 +1189,7 @@ HView = HClass.extend({
|
|
1189
1189
|
* +_partName+:: The identifier of the markup element.
|
1190
1190
|
*
|
1191
1191
|
* = Returns
|
1192
|
-
* The
|
1192
|
+
* The markup of a specified markup element.
|
1193
1193
|
*
|
1194
1194
|
**/
|
1195
1195
|
markupOfPart: function(_partName) {
|
@@ -1199,6 +1199,66 @@ HView = HClass.extend({
|
|
1199
1199
|
}
|
1200
1200
|
return ELEM.getHTML(this.markupElemIds[_partName]);
|
1201
1201
|
},
|
1202
|
+
|
1203
|
+
/** = Description
|
1204
|
+
* Sets a element attribute of a specified markup element that has been bound to this
|
1205
|
+
* view.
|
1206
|
+
*
|
1207
|
+
* = Parameters
|
1208
|
+
* +_partName+:: The identifier of the markup element.
|
1209
|
+
* +_value+:: Value for markup element.
|
1210
|
+
*
|
1211
|
+
* = Returns
|
1212
|
+
* +self+
|
1213
|
+
*
|
1214
|
+
**/
|
1215
|
+
setAttrOfPart: function( _partName, _value, _force ) {
|
1216
|
+
if (this.markupElemIds[_partName]===undefined) {
|
1217
|
+
console.log('Warning, setAttrOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
|
1218
|
+
}
|
1219
|
+
else {
|
1220
|
+
ELEM.setAttr( this.markupElemIds[_partName], _value, _force );
|
1221
|
+
}
|
1222
|
+
return this;
|
1223
|
+
},
|
1224
|
+
|
1225
|
+
/** = Description
|
1226
|
+
* Returns a element attribute of a specified markup element that has been bound to this
|
1227
|
+
* view.
|
1228
|
+
*
|
1229
|
+
* = Parameters
|
1230
|
+
* +_partName+:: The identifier of the markup element.
|
1231
|
+
*
|
1232
|
+
* = Returns
|
1233
|
+
* The attribute of a specified markup element.
|
1234
|
+
*
|
1235
|
+
**/
|
1236
|
+
attrOfPart: function(_partName, _force) {
|
1237
|
+
if (this.markupElemIds[_partName]===undefined) {
|
1238
|
+
console.log('Warning, attrOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
|
1239
|
+
return '';
|
1240
|
+
}
|
1241
|
+
return ELEM.getAttr(this.markupElemIds[_partName], _force);
|
1242
|
+
},
|
1243
|
+
|
1244
|
+
/** = Description
|
1245
|
+
* Returns a element itself of a specified markup element that has been bound to this
|
1246
|
+
* view.
|
1247
|
+
*
|
1248
|
+
* = Parameters
|
1249
|
+
* +_partName+:: The identifier of the markup element.
|
1250
|
+
*
|
1251
|
+
* = Returns
|
1252
|
+
* The element of a specified markup element.
|
1253
|
+
*
|
1254
|
+
**/
|
1255
|
+
elemOfPart: function(_partName) {
|
1256
|
+
if (this.markupElemIds[_partName]===undefined) {
|
1257
|
+
console.log('Warning, elemOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
|
1258
|
+
return '';
|
1259
|
+
}
|
1260
|
+
return ELEM.get( this.markupElemIds[_partName] );
|
1261
|
+
},
|
1202
1262
|
|
1203
1263
|
/** = Description
|
1204
1264
|
* Hides the component's main DOM element (and its children).
|
@@ -1889,6 +1949,7 @@ HView = HClass.extend({
|
|
1889
1949
|
}
|
1890
1950
|
var
|
1891
1951
|
_searchTarget = HLocale.components[_componentClassName],
|
1952
|
+
i = 0,
|
1892
1953
|
_key;
|
1893
1954
|
if( _searchTarget === undefined && (typeof _componentClassName === 'string') ){
|
1894
1955
|
_searchTarget = HLocale.components;
|
@@ -1909,7 +1970,8 @@ HView = HClass.extend({
|
|
1909
1970
|
if( _searchTarget[ _attrPath[0] ] === undefined ){
|
1910
1971
|
return _default;
|
1911
1972
|
}
|
1912
|
-
for(
|
1973
|
+
for( ; i < _attrPath.length; i++ ){
|
1974
|
+
_key = _attrPath[i];
|
1913
1975
|
if( typeof _searchTarget[_key] === 'object' ){
|
1914
1976
|
_searchTarget = _searchTarget[_key];
|
1915
1977
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsence-pre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.0.
|
4
|
+
version: 2.2.0.35
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2012-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rsence-deps
|
17
|
-
requirement: &
|
17
|
+
requirement: &70211810491080 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - =
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '966'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70211810491080
|
26
26
|
description: ! 'RSence is a different and unique development model and software frameworks
|
27
27
|
designed first-hand for real-time web applications. RSence consists of separate,
|
28
28
|
but tigtly integrated data- and user interface frameworks.
|
@@ -243,7 +243,7 @@ files:
|
|
243
243
|
- js/controls/uploader/themes/default/upload_progress.gif
|
244
244
|
- js/controls/uploader/themes/default/uploader.css
|
245
245
|
- js/controls/uploader/themes/default/uploader.html
|
246
|
-
- js/controls/uploader/uploader.
|
246
|
+
- js/controls/uploader/uploader.coffee
|
247
247
|
- js/controls/validatorview/themes/default/validator-ie6.gif
|
248
248
|
- js/controls/validatorview/themes/default/validator.png
|
249
249
|
- js/controls/validatorview/themes/default/validatorview.css
|
@@ -1,162 +0,0 @@
|
|
1
|
-
/* RSence
|
2
|
-
* Copyright 2008 Riassence Inc.
|
3
|
-
* http://riassence.com/
|
4
|
-
*
|
5
|
-
* You should have received a copy of the GNU General Public License along
|
6
|
-
* with this software package. If not, contact licensing@riassence.com
|
7
|
-
*/
|
8
|
-
|
9
|
-
/** = Description
|
10
|
-
* HUploader class
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
**/
|
15
|
-
|
16
|
-
HLocale.components.HUploader = {
|
17
|
-
strings: {
|
18
|
-
stateLabels: {
|
19
|
-
|
20
|
-
// -- Upload success states: ++
|
21
|
-
'0': "Select file...",
|
22
|
-
'1': "Uploading...",
|
23
|
-
'2': "Processing data...",
|
24
|
-
'3': "Upload Complete",
|
25
|
-
'4': "Preparing upload",
|
26
|
-
|
27
|
-
// -- Upload failure states: ++
|
28
|
-
'-1': "Error: Invalid request",
|
29
|
-
'-2': "Error: Invalid upload key",
|
30
|
-
'-3': "Error: Invalid data format",
|
31
|
-
'-4': "Error: File too big",
|
32
|
-
'-6': "Error: Post-processing failed"
|
33
|
-
}
|
34
|
-
}
|
35
|
-
};
|
36
|
-
|
37
|
-
var//RSence.Controls
|
38
|
-
HUploader = HControl.extend({
|
39
|
-
componentName: 'uploader',
|
40
|
-
uploadState: false,
|
41
|
-
uploadKey: false,
|
42
|
-
markupElemNames: [
|
43
|
-
'form',
|
44
|
-
'file',
|
45
|
-
'iframe',
|
46
|
-
'upload_progress',
|
47
|
-
'progress_label',
|
48
|
-
'progress_indicator',
|
49
|
-
'button',
|
50
|
-
'button_label',
|
51
|
-
'value',
|
52
|
-
'ack_button'
|
53
|
-
],
|
54
|
-
|
55
|
-
/** = Description
|
56
|
-
* setUploadState function
|
57
|
-
*
|
58
|
-
* = Parameters
|
59
|
-
* +_state+::
|
60
|
-
* +_uploadKey+::
|
61
|
-
*
|
62
|
-
**/
|
63
|
-
setUploadState: function(_state,_uploadKey){
|
64
|
-
if(_state!==this.uploadState){
|
65
|
-
this.uploadState = _state;
|
66
|
-
var
|
67
|
-
_stateKey = _state.toString(),
|
68
|
-
_stateLabels = HLocale.components.HUploader.strings.stateLabels,
|
69
|
-
_label;
|
70
|
-
//console.log('stateKey:',_stateKey);
|
71
|
-
if(_stateLabels[_stateKey]!==undefined){
|
72
|
-
ELEM.get(this.markupElemIds.value).value=this.valueObj.id;
|
73
|
-
_label = _stateLabels[_stateKey];
|
74
|
-
//console.log('stateLabel:',_label);
|
75
|
-
if(_state===0){
|
76
|
-
ELEM.setStyle(this.markupElemIds.upload_progress,'visibility','hidden');
|
77
|
-
ELEM.setStyle(this.markupElemIds.progress_indicator,'visibility','hidden');
|
78
|
-
ELEM.setStyle(this.markupElemIds.ack_button,'visibility','hidden');
|
79
|
-
ELEM.setHTML(this.markupElemIds.button_label,_label);
|
80
|
-
ELEM.setStyle(this.markupElemIds.button,'visibility','inherit');
|
81
|
-
ELEM.setStyle(this.markupElemIds.form,'visibility','inherit');
|
82
|
-
ELEM.setAttr(this.markupElemIds.form,'action','/U/'+_uploadKey,true);
|
83
|
-
//console.log('uploadKey:',ELEM.getAttr(this.markupElemIds.form,'action',true));
|
84
|
-
ELEM.get(this.markupElemIds.file).value='';
|
85
|
-
this.uploadKey = _uploadKey;
|
86
|
-
}
|
87
|
-
else if(_state===1||_state===2||_state===3||_state===4){
|
88
|
-
ELEM.setStyle(this.markupElemIds.upload_progress,'visibility','inherit');
|
89
|
-
if(_state===1||_state===2||_state===4){
|
90
|
-
ELEM.setStyle(this.markupElemIds.progress_indicator,'visibility','inherit');
|
91
|
-
ELEM.setStyle(this.markupElemIds.ack_button,'visibility','hidden');
|
92
|
-
}
|
93
|
-
else {
|
94
|
-
ELEM.setStyle(this.markupElemIds.progress_indicator,'visibility','hidden');
|
95
|
-
ELEM.setStyle(this.markupElemIds.ack_button,'visibility','inherit');
|
96
|
-
}
|
97
|
-
ELEM.setHTML(this.markupElemIds.progress_label,_label);
|
98
|
-
ELEM.setStyle(this.markupElemIds.button,'visibility','hidden');
|
99
|
-
ELEM.setStyle(this.markupElemIds.form,'visibility','hidden');
|
100
|
-
if(_state===1){
|
101
|
-
ELEM.get(this.markupElemIds.form).submit();
|
102
|
-
}
|
103
|
-
}
|
104
|
-
else if(_state < 0){
|
105
|
-
ELEM.setStyle(this.markupElemIds.progress_indicator,'visibility','hidden');
|
106
|
-
ELEM.setStyle(this.markupElemIds.ack_button,'visibility','inherit');
|
107
|
-
ELEM.setHTML(this.markupElemIds.progress_label,'<span style="color:red;">'+_label+'</span>');
|
108
|
-
ELEM.setStyle(this.markupElemIds.button,'visibility','hidden');
|
109
|
-
ELEM.setStyle(this.markupElemIds.form,'visibility','hidden');
|
110
|
-
}
|
111
|
-
}
|
112
|
-
}
|
113
|
-
},
|
114
|
-
|
115
|
-
/** = Description
|
116
|
-
* refreshValue function
|
117
|
-
*
|
118
|
-
*
|
119
|
-
**/
|
120
|
-
refreshValue: function(){
|
121
|
-
if(typeof this.value !== 'string'){return;}
|
122
|
-
if(this.value.indexOf(':::')<1){return;}
|
123
|
-
var _stateAndKey = this.value.split(':::');
|
124
|
-
if(_stateAndKey.length!==2){
|
125
|
-
return;
|
126
|
-
}
|
127
|
-
var _state = parseInt(_stateAndKey[0],10),
|
128
|
-
_uploadKey = _stateAndKey[1];
|
129
|
-
this.setUploadState(_state,_uploadKey);
|
130
|
-
},
|
131
|
-
|
132
|
-
/** = Description
|
133
|
-
* upload function
|
134
|
-
*
|
135
|
-
*
|
136
|
-
**/
|
137
|
-
upload: function(){
|
138
|
-
this.setValue('1:::'+this.uploadKey);
|
139
|
-
},
|
140
|
-
|
141
|
-
/** = Description
|
142
|
-
*getNewUploadKey function
|
143
|
-
*
|
144
|
-
*
|
145
|
-
**/
|
146
|
-
getNewUploadKey: function(){
|
147
|
-
this.setValue('4:::'+this.uploadKey);
|
148
|
-
},
|
149
|
-
|
150
|
-
/** = Description
|
151
|
-
* click function
|
152
|
-
*
|
153
|
-
*
|
154
|
-
**/
|
155
|
-
click: function(){
|
156
|
-
//console.log('click');
|
157
|
-
if((this.uploadState===3)||(this.uploadState<0)){
|
158
|
-
//console.log('clicked, state=',this.uploadState);
|
159
|
-
this.getNewUploadKey();
|
160
|
-
}
|
161
|
-
}
|
162
|
-
});
|