mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Made thumbnail resizing work with IE
SVN revision: 2039
This commit is contained in:
parent
4d056313b3
commit
f54fe5f329
@ -10,21 +10,22 @@
|
|||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
var dummy = 0;
|
var dummy = 0;
|
||||||
|
var httpReq;
|
||||||
|
var elName;
|
||||||
|
var thumbName;
|
||||||
|
|
||||||
function im(name, thumb, image, cmd)
|
function im(name, thumb, image, cmd)
|
||||||
{
|
{
|
||||||
var xmlHttp;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
|
httpReq = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
try {
|
try {
|
||||||
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
|
httpReq = new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
try {
|
try {
|
||||||
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
|
httpReq = new ActiveXObject("Microsoft.XMLHTTP");
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
alert("Your browser does not support AJAX!");
|
alert("Your browser does not support AJAX!");
|
||||||
@ -33,28 +34,39 @@ function im(name, thumb, image, cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlHttp.onreadystatechange = function()
|
elName = name;
|
||||||
{
|
thumbName = thumb;
|
||||||
if(xmlHttp.readyState == 4) {
|
httpReq.onreadystatechange = onReady;
|
||||||
if (xmlHttp.responseText != "" &&
|
httpReq.open("GET","?cmd=im&req="+cmd+"&img="+image, true);
|
||||||
xmlHttp.responseText.search(/Fonts/) == -1)
|
httpReq.send(null);
|
||||||
alert(xmlHttp.responseText);
|
|
||||||
o = document.getElementsByName(name);
|
|
||||||
if (o[0])
|
|
||||||
o[0].src = thumb+'?'+dummy;
|
|
||||||
if (o[1])
|
|
||||||
o[1].src = thumb+'?'+dummy;
|
|
||||||
for (i=0 ; i<8 ; i++) {
|
|
||||||
o = document.getElementsByName(name+'_'+i);
|
|
||||||
if (o[0])
|
|
||||||
o[0].src = thumb+'-'+i+'.png'+'?'+dummy;
|
|
||||||
if (o[1])
|
|
||||||
o[1].src = thumb+'-'+i+'.png'+'?'+dummy;
|
|
||||||
}
|
|
||||||
dummy++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xmlHttp.open("GET","?cmd=im&req="+cmd+"&img="+image, true);
|
|
||||||
xmlHttp.send(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onReady()
|
||||||
|
{
|
||||||
|
if (httpReq.readyState == 4) {
|
||||||
|
if (httpReq.responseText != "" &&
|
||||||
|
httpReq.responseText.search(/Fonts/) == -1)
|
||||||
|
alert(httpReq.responseText);
|
||||||
|
o = document.getElementsByName(elName);
|
||||||
|
if (o[0])
|
||||||
|
o[0].src = thumbName+'?'+dummy;
|
||||||
|
if (o[1])
|
||||||
|
o[1].src = thumbName+'?'+dummy;
|
||||||
|
for (i=0 ; i<8 ; i++) {
|
||||||
|
o = document.getElementsByName(elName+'_'+i);
|
||||||
|
if (o[0])
|
||||||
|
o[0].src = thumbName+'-'+i+'.png'+'?'+dummy;
|
||||||
|
if (o[1])
|
||||||
|
o[1].src = thumbName+'-'+i+'.png'+'?'+dummy;
|
||||||
|
}
|
||||||
|
dummy++;
|
||||||
|
}
|
||||||
|
delete httpReq;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteAtt(idx)
|
||||||
|
{
|
||||||
|
document.form1.jcmd.value='delete';
|
||||||
|
document.form1.smcmd.value='delatt'+idx;
|
||||||
|
document.form1.submit();
|
||||||
|
}
|
||||||
46
src/elogd.c
46
src/elogd.c
@ -8026,15 +8026,16 @@ void send_file_direct(char *file_name)
|
|||||||
rsprintf("Accept-Ranges: bytes\r\n");
|
rsprintf("Accept-Ranges: bytes\r\n");
|
||||||
|
|
||||||
/* set expiration time to one day if no thumbnail */
|
/* set expiration time to one day if no thumbnail */
|
||||||
time(&now);
|
if (isparam("thumb")) {
|
||||||
if (isparam("thumb"))
|
rsprintf("Pragma: no-cache\r\n");
|
||||||
now -= (int) (3600 * 24);
|
rsprintf("Expires: Fri, 01 Jan 1983 00:00:00 GMT\r\n");
|
||||||
else
|
} else {
|
||||||
|
time(&now);
|
||||||
now += (int) (3600 * 24);
|
now += (int) (3600 * 24);
|
||||||
gmt = gmtime(&now);
|
gmt = gmtime(&now);
|
||||||
strcpy(format, "%A, %d-%b-%y %H:%M:%S GMT");
|
strcpy(format, "%A, %d-%b-%y %H:%M:%S GMT");
|
||||||
strftime(str, sizeof(str), format, gmt);
|
rsprintf("Expires: %s\r\n", str);
|
||||||
rsprintf("Expires: %s\r\n", str);
|
}
|
||||||
|
|
||||||
if (use_keepalive) {
|
if (use_keepalive) {
|
||||||
rsprintf("Connection: Keep-Alive\r\n");
|
rsprintf("Connection: Keep-Alive\r\n");
|
||||||
@ -8888,11 +8889,11 @@ void attrib_from_param(int n_attr, char attrib[MAX_N_ATTR][NAME_LENGTH])
|
|||||||
|
|
||||||
void ricon(char *name, char *comment, char *onclick)
|
void ricon(char *name, char *comment, char *onclick)
|
||||||
{
|
{
|
||||||
rsprintf("<img align=\"middle\" name=\"%s\" src=\"icons/elc_%s.png\" alt=\"%s\" title=\"%s\" border=\"0\"",
|
rsprintf("<img align=\"middle\" name=\"%s\" src=\"icons/elc_%s.png\" alt=\"%s\" title=\"%s\" border=\"0\"\n",
|
||||||
name, name, comment, comment);
|
name, name, comment, comment);
|
||||||
rsprintf(" onclick=\"%s\"", onclick);
|
rsprintf(" onclick=\"%s\"", onclick);
|
||||||
rsprintf(" onmousedown=\"document.images.%s.src='icons/eld_%s.png'\"", name, name);
|
rsprintf(" onmousedown=\"document.images.%s.src='icons/eld_%s.png'\"\n", name, name);
|
||||||
rsprintf(" onmouseup=\"document.images.%s.src='icons/elc_%s.png'\"", name, name);
|
rsprintf(" onmouseup=\"document.images.%s.src='icons/elc_%s.png'\"\n", name, name);
|
||||||
rsprintf(" onmouseover=\"this.style.cursor='pointer';\" />\n");
|
rsprintf(" onmouseover=\"this.style.cursor='pointer';\" />\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11072,17 +11073,15 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
ricon("original", loc("Original size"), str);
|
ricon("original", loc("Original size"), str);
|
||||||
sprintf(str, "im('att'+'%d','%s','%s','larger');", index, thumb_name, att[index]);
|
sprintf(str, "im('att'+'%d','%s','%s','larger');", index, thumb_name, att[index]);
|
||||||
ricon("larger", loc("Make larger"), str);
|
ricon("larger", loc("Make larger"), str);
|
||||||
rsprintf(" ");
|
rsprintf(" \n");
|
||||||
sprintf(str, "im('att'+'%d','%s','%s','rotleft');", index, thumb_name, att[index]);
|
sprintf(str, "im('att'+'%d','%s','%s','rotleft');", index, thumb_name, att[index]);
|
||||||
ricon("rotleft", loc("Rotate left"), str);
|
ricon("rotleft", loc("Rotate left"), str);
|
||||||
sprintf(str, "im('att'+'%d','%s','%s','rotright');", index, thumb_name, att[index]);
|
sprintf(str, "im('att'+'%d','%s','%s','rotright');", index, thumb_name, att[index]);
|
||||||
ricon("rotright", loc("Rotate right"), str);
|
ricon("rotright", loc("Rotate right"), str);
|
||||||
rsprintf(" ");
|
rsprintf(" \n");
|
||||||
sprintf(str, "document.form1.jcmd.value='delete';");
|
sprintf(str, "deleteAtt('%d')", index);
|
||||||
sprintf(str+strlen(str), "document.form1.smcmd.value='delatt%d';", index);
|
ricon("delatt", loc("Delete attachment"), str);
|
||||||
sprintf(str+strlen(str), "document.form1.submit();");
|
rsprintf(" \n");
|
||||||
ricon("delete", loc("Delete attachment"), str);
|
|
||||||
rsprintf(" ");
|
|
||||||
|
|
||||||
/* ImageMagick available, so get image size */
|
/* ImageMagick available, so get image size */
|
||||||
rsprintf("<b>%s</b> \n", att[index] + 14);
|
rsprintf("<b>%s</b> \n", att[index] + 14);
|
||||||
@ -11118,7 +11117,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
else
|
else
|
||||||
strlcpy(file_enc, thumb_name + 14, sizeof(file_enc));
|
strlcpy(file_enc, thumb_name + 14, sizeof(file_enc));
|
||||||
url_encode(file_enc, sizeof(file_enc)); /* for file names with special characters like "+" */
|
url_encode(file_enc, sizeof(file_enc)); /* for file names with special characters like "+" */
|
||||||
sprintf(ref, "%s/%s", str, file_enc);
|
sprintf(ref, "%s/%s?thumb=1", str, file_enc);
|
||||||
|
|
||||||
rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\" name=\"att%d\">\n",
|
rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\" name=\"att%d\">\n",
|
||||||
ref, att[index] + 14, att[index] + 14, index);
|
ref, att[index] + 14, att[index] + 14, index);
|
||||||
@ -11133,7 +11132,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
else
|
else
|
||||||
strlcpy(file_enc, thumb_name + 14, sizeof(file_enc));
|
strlcpy(file_enc, thumb_name + 14, sizeof(file_enc));
|
||||||
url_encode(file_enc, sizeof(file_enc)); /* for file names with special characters like "+" */
|
url_encode(file_enc, sizeof(file_enc)); /* for file names with special characters like "+" */
|
||||||
sprintf(ref, "%s/%s", str, file_enc);
|
sprintf(ref, "%s/%s?thumb=1", str, file_enc);
|
||||||
|
|
||||||
rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\" name=\"att%d_%d\">\n",
|
rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\" name=\"att%d_%d\">\n",
|
||||||
ref, att[index] + 14, att[index] + 14, index, i);
|
ref, att[index] + 14, att[index] + 14, index, i);
|
||||||
@ -22396,7 +22395,7 @@ void call_image_magick(LOGBOOK *lbs)
|
|||||||
cmd[i] = '\"';
|
cmd[i] = '\"';
|
||||||
#endif
|
#endif
|
||||||
my_shell(cmd, str, sizeof(str));
|
my_shell(cmd, str, sizeof(str));
|
||||||
show_http_header(NULL, FALSE, NULL);
|
show_http_header(NULL, TRUE, NULL);
|
||||||
rsputs(str);
|
rsputs(str);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -25352,7 +25351,10 @@ void interprete(char *lbook, char *path)
|
|||||||
|
|
||||||
if (isparam("thumb")) {
|
if (isparam("thumb")) {
|
||||||
get_thumb_name(file_name, thumb_name, sizeof(thumb_name), 0);
|
get_thumb_name(file_name, thumb_name, sizeof(thumb_name), 0);
|
||||||
send_file_direct(thumb_name);
|
if (thumb_name[0])
|
||||||
|
send_file_direct(thumb_name);
|
||||||
|
else
|
||||||
|
send_file_direct(file_name);
|
||||||
} else
|
} else
|
||||||
send_file_direct(file_name);
|
send_file_direct(file_name);
|
||||||
return;
|
return;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 679 B After Width: | Height: | Size: 679 B |
|
Before Width: | Height: | Size: 732 B After Width: | Height: | Size: 732 B |
Loading…
x
Reference in New Issue
Block a user