30
30
* http://www.regular-expressions.info/javascriptexample.html
31
31
* @param $fileFilterErrorMsg : Message to display when regular expression is false
32
32
* @param $destSelector : jquery selector to insert the filename when user click on 'OK'
33
- *
33
+ *
34
34
**/
35
35
36
36
// assign unique identifier to this element
44
44
}
45
45
$ fp_uuid = Configure::read ('filePickerId ' );
46
46
47
-
47
+
48
48
if ( ! isset ($ script ) ) $ script = $ this ->webroot . 'admin/filePicker ' ;
49
49
if ( ! isset ($ width ) ) $ width = 400 ;
50
50
if ( ! isset ($ height ) ) $ height = 400 ;
51
51
if ( ! isset ($ fileFilter ) ) $ fileFilter = '' ;
52
52
if ( ! isset ($ fileFilterErrorMsg ) ) $ fileFilterErrorMsg = 'Incorrect file type ' ;
53
53
if ( ! isset ($ destSelector ) ) $ destSelector = 'body>XX ' ; // default selector return 0 elements
54
54
if ( ! isset ($ msg ) ) $ msg = '' ;
55
-
55
+
56
56
// Find root:
57
57
/*if( strpos( strtolower(PHP_OS), 'win') !== false )
58
58
{
63
63
$root = '/';
64
64
}*/
65
65
$ root = '' ;
66
-
66
+
67
67
?>
68
68
69
69
<!-- FILE PICKER -->
70
- <link rel="stylesheet" type="text/css" href="<?php echo $ this ->webroot ?> css/jqueryFileTree.css" media="screen" />
70
+ <link rel="stylesheet" type="text/css" href="<?php echo $ this ->webroot ?> css/jqueryFileTree.css" media="screen" />
71
71
<style>
72
72
.fp-container {
73
- }
74
-
73
+ }
74
+
75
75
/* The fp-XXX-pannel is the div that gets lighted */
76
76
#fp-<?php echo $ fp_uuid?> -panel {
77
- display:none;
77
+ display:none;
78
78
position:fixed;
79
- top:100px;
80
- left:50%;
81
- margin-left:-200px;
82
- width:<?php echo $ width?> px;
83
- background:#FFFFFF;
84
- padding:10px 15px 10px 15px;
85
- border:2px solid #CCCCCC;
79
+ top:100px;
80
+ left:50%;
81
+ margin-left:-200px;
82
+ width:<?php echo $ width?> px;
83
+ background:#FFFFFF;
84
+ padding:10px 15px 10px 15px;
85
+ border:2px solid #CCCCCC;
86
86
z-index:1001;
87
87
}
88
-
89
- /* The fp-XXX-pannel is the div that covers the rest of the page */
90
- #fp-<?php echo $ fp_uuid?> -background {
91
- display:none;
92
- background:#000000;
93
- opacity:0.5;
94
- filter:alpha(opacity=90);
95
- position:absolute;
96
- top:0px;
97
- left:0px;
98
- min-width:100%;
99
- min-height:100%;
100
- z-index:1000;
101
- }
102
88
89
+ /* The fp-XXX-pannel is the div that covers the rest of the page */
90
+ #fp-<?php echo $ fp_uuid?> -background {
91
+ display:none;
92
+ background:#000000;
93
+ opacity:0.5;
94
+ filter:alpha(opacity=90);
95
+ position:absolute;
96
+ top:0px;
97
+ left:0px;
98
+ min-width:100%;
99
+ min-height:100%;
100
+ z-index:1000;
101
+ }
102
+
103
103
.fp-fileTree {
104
104
width: <?php echo $ width?> px;
105
105
height: 300px;
112
112
padding: 5px;
113
113
text-align: left;
114
114
}
115
-
115
+
116
116
.fp-inputFile {
117
117
position: relative;
118
118
width: <?php echo $ width +5 ?> px;
119
119
}
120
-
120
+
121
121
.fp-inputButton {
122
122
position: relative;
123
123
float: left;
124
124
display: block;
125
125
width: 100px;
126
126
margin: 3px 40px;
127
127
}
128
-
128
+
129
129
.fp-open {
130
- }
130
+ }
131
131
</style>
132
132
133
133
<?php if ($ fp_uuid == 1 ) {?>
@@ -148,9 +148,9 @@ $(document).ready( function() {
148
148
149
149
$('#fp-<?php echo $ fp_uuid?> -fileTree').fileTree(
150
150
{
151
- root: '',
152
- script: '<?php echo $ script?> '
153
- },
151
+ root: '',
152
+ script: '<?php echo $ script?> '
153
+ },
154
154
function(file) {
155
155
$("#fp-<?php echo $ fp_uuid?> -inputFile").val('<?php echo $ root?> ' + file);
156
156
},
@@ -169,7 +169,7 @@ $(document).ready( function() {
169
169
// if destSelector is valid set its value to file
170
170
if( $("<?php echo $ destSelector?> ").length !== 0 )
171
171
{
172
- $("<?php echo $ destSelector?> ").val(file);
172
+ $("<?php echo $ destSelector?> ").val(file);
173
173
$("#fp-<?php echo $ fp_uuid?> -panel, #fp-<?php echo $ fp_uuid?> -background").fadeOut(300);
174
174
}
175
175
}
@@ -179,15 +179,15 @@ $(document).ready( function() {
179
179
}
180
180
return false; // important to return false to prevent a form that include
181
181
// this element to be submitted when the user just want to
182
- // select a file.
182
+ // select a file.
183
183
});
184
184
185
185
//$("#fp-<?php echo $ fp_uuid?> -panel").draggable();
186
186
});
187
187
</script>
188
188
<input type="submit" id="fp-<?php echo $ fp_uuid?> -open" class="fp-open" value="Choose"></input>
189
189
<div id="fp-<?php echo $ fp_uuid?> -container" class="fp-container">
190
-
190
+
191
191
<div id="fp-<?php echo $ fp_uuid?> -background"></div>
192
192
<div id="fp-<?php echo $ fp_uuid?> -panel">
193
193
<b><?php echo $ msg ; ?> </b>
0 commit comments