tpl_4ef0a6fb_form__ptHLwoxWkRiy9cfnoKv2kg.php
6.16 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
function tpl_4ef0a6fb_form__ptHLwoxWkRiy9cfnoKv2kg($tpl, $ctx) {
$_thistpl = $tpl ;
$_translator = $tpl->getTranslator() ;
?>
<link rel="stylesheet" href="<?php echo phptal_escape($ctx->MAIN_SOURCE_URL) ?>/tmpl/css/admin.css" type="text/css"/>
<link rel="stylesheet" href="<?php echo phptal_escape($ctx->MAIN_SOURCE_URL) ?>/tmpl/css/default.css" type="text/css"/>
<link rel="stylesheet" type="text/css" href="<?php echo phptal_escape($ctx->MAIN_SOURCE_URL) ?>/ext/fc_cropresizer/fc-cropresizer.css"/>
<script src="<?php echo phptal_escape($ctx->MAIN_SOURCE_URL) ?>/tmpl/default/js/default.js"></script>
<script src="<?php echo phptal_escape($ctx->MAIN_SOURCE_URL) ?>/ext/ajax/JsHttpRequest.js"></script>
<script src="<?php echo phptal_escape($ctx->MAIN_SOURCE_URL) ?>/tmpl/default/js/upload.js"></script>
<script type="text/javascript" src="<?php echo phptal_escape($ctx->MAIN_SOURCE_URL) ?>/ext/fc_cropresizer/fc-cropresizer.js"></script>
<div style="padding:10px">
<div style="color:red;font-size:12px;text-align:center;" id="ua_error"></div>
<form id="form1" enctype="multipart/form-data" onsubmit="return false" method="post">
<input type="file" name="ua_file" id="ua_file" style="margin:0px;padding:0px;height:20px;"/>
<input type="hidden" name="path" value="<?php echo phptal_escape($ctx->path) ?>"/>
<input type="hidden" name="max_size" value="<?php echo phptal_escape($ctx->max_size) ?>"/>
<input type="hidden" name="max_width" value="<?php echo phptal_escape($ctx->max_width) ?>"/>
<input type="hidden" name="max_height" value="<?php echo phptal_escape($ctx->max_height) ?>"/>
<div style="text-align:left;color:#808080;font-size:10px;">
Нажав на кнопку "<b>Обзор</b>", выберите на своём компьютере изображение размером не более
<b><?php echo phptal_escape($ctx->max_size_str) ?></b> в формате <b>JPG</b>,<b>GIF</b> или <b>PNG</b> для загрузки его на сайт.
</div>
<br/>
<div style="color:#808080;font-size:10px;text-align:center;display:none" id="ua_status">
<b>Подождите, идёт загрузка изображения на сайт...</b>
<div><img src="/source/tmpl/default/img/ajax-loader.gif" style="margin:5px;"/></div>
</div>
<div style="text-align:right"><input type="button" id="ua_button" onclick="upload_ajax.send()" value="Загрузить" class="button_rp"/></div>
</form>
</div>
<div style="display:none;padding:30px;" id="crop_form">
<img src="?resize=2&width=300&height=300" id="photo1" style="
border:1px solid black;
"/>
<br/>
<form class="reg_profile" method="POST" action="/?p_name=ajax_upload_img&act=crop" target="_self" enctype="multipart/form-data">
<input type="hidden" name="act" value="crop"/>
<input type="hidden" name="image_width" id="image_width"/>
<input type="hidden" name="image_height" id="image_height"/>
<input type="hidden" name="image_top" id="image_top"/>
<input type="hidden" name="image_left" id="image_left"/>
<div style="float:left;">
<input type="button" value="Сохранить" onclick="upload_ajax.crop()"/>
</div>
<div style="text-align:right">
<input type="button" value="Удалить" onclick="upload_ajax.del()"/>
</div>
</form>
</div>
<script>/*<![CDATA[*/
// передаем из адресной строки в js скрипт
upload_ajax = {};
upload_ajax.crop_x = <?php echo strtr(phptal_tostring($ctx->crop_image_width) ,array(']]>'=>']]]]><![CDATA[>','</'=>'<\/')) ?>;
upload_ajax.crop_y = <?php echo strtr(phptal_tostring($ctx->crop_image_height) ,array(']]>'=>']]]]><![CDATA[>','</'=>'<\/')) ?>;
upload_ajax.path = '<?php echo strtr(phptal_tostring($ctx->path) ,array(']]>'=>']]]]><![CDATA[>','</'=>'<\/')) ?>';
upload_ajax.max_size = <?php echo strtr(phptal_tostring($ctx->max_size) ,array(']]>'=>']]]]><![CDATA[>','</'=>'<\/')) ?>;
upload_ajax.server = '/?p_name=admin_images';
// загрузка изображения на сервер
upload_ajax.send = function(){
r = new request( upload_ajax.server+'&act=ajax_upload' );
// возвращаем результат
r.onload = function(rst){
if ( !upload_ajax.crop_x && !upload_ajax.crop_y ){
opener.upload_img_class.set_file(rst.img_name)
opener.upload_img_class.show();
window.close();
return false;
}
upload_ajax.img_name = rst.img_name;
upload_ajax.img_id = rst.img_id;
o.$('crop_form').style.display='block'
o.$('photo1').src='/media/'+upload_ajax.path+'/'+rst.img_name+'?resize=2&width=800&height=600';
o.$('photo1').onload = function(){
cropresizer.getObject("photo1").init({
cropWidth : upload_ajax.crop_x ,
cropHeight : upload_ajax.crop_y,
onUpdate : function() {
this.stopSelection = false;
document.getElementById("image_width").value= this.iWidth;
document.getElementById("image_height").value= this.iHeight
document.getElementById("image_top").value= this.cropTop - this.iTop;
document.getElementById("image_left").value= this.cropLeft - this.iLeft
}
},1);
}
}
r.error = function(e){
o.$('ua_error').innerHTML =e;
}
r.form( o.$('form1') );
}
upload_ajax.crop = function(){
r = new request( upload_ajax.server+'&act=ajax_crop' );
r.onload = function(rst){
opener.upload_img_class.set_file(rst.img_src)
opener.upload_img_class.show();
window.close();
return false;
};
r.send(
{
'img_id': upload_ajax.img_id ,
'w' : document.getElementById("image_width").value,
'h' : document.getElementById("image_height").value,
't' : document.getElementById("image_top").value,
'l' : document.getElementById("image_left").value,
'crop_w':upload_ajax.crop_x,
'crop_h':upload_ajax.crop_y,
}
)
}
upload_ajax.del = function(){
r = new request( upload_ajax.server+'&act=ajax_delete' );
r.onload = function(rst){
window.close();
//alert('файл удалён')
//return false;
};
r.send( {'id': upload_ajax.img_id } )
}
/*]]>*/</script><?php
/* end */ ;
}
?><?php /*
*** DO NOT EDIT THIS FILE ***
Generated by PHPTAL from /home/shasha/www/pr25_autocatalog/source/modules/admin/tmpl/control_images/form.html (edit that file instead) */; ?>