Make the logo admin page more friendly.

This commit is contained in:
Alexandre Rosenfeld
2011-02-21 20:54:55 +00:00
parent 7284b14e4b
commit 95b6b6c8e0
3 changed files with 24 additions and 17 deletions

View File

@@ -52,11 +52,15 @@
function showLogo($imagen){ function showLogo($imagen){
$ext = substr($imagen, strrpos($imagen, '.') + 1); // extension $info = @getimagesize($imagen);
$fp = fopen($imagen, "rb");
header('content-type: image/'.$ext); if ($info && $fp) {
readfile($imagen); header("Content-type: {$info['mime']}");
fpassthru($fp);
exit; exit;
} else {
throw new Exception("Image format not valid");
}
} }
function cpyMoreLogos($dir,$newDir){ function cpyMoreLogos($dir,$newDir){

View File

@@ -69,12 +69,7 @@
label:G_STRINGS.ID_APPLY_LOGO, label:G_STRINGS.ID_APPLY_LOGO,
action:function(){ action:function(){
ajax_function('replacementLogo','replacementLogo','NAMELOGO='+encodeURIComponent(nameLogo),'GET') ; ajax_function('replacementLogo','replacementLogo','NAMELOGO='+encodeURIComponent(nameLogo),'GET') ;
//parent.window.location.href = 'main_init'; parent.parent.window.location = 'main?s=LOGO';
if(_BROWSER.name == 'msie' )
parent.parent.window.location.href = 'main?s=LOGO';
else
parent.window.location.href = 'main_init';
history.go(0);
}}); }});
} }
@@ -89,7 +84,7 @@
label:G_STRINGS.ID_REMOVE_LOGO, label:G_STRINGS.ID_REMOVE_LOGO,
action:function(){ action:function(){
ajax_function('logo_Delete','','NAMELOGO='+nameLogo,'GET') ; ajax_function('logo_Delete','','NAMELOGO='+nameLogo,'GET') ;
history.go(0); window.location = 'uplogo';
} }
}); });
return false; return false;
@@ -102,7 +97,6 @@
*/ */
var restoreLogo = function (optfiledb, usrUid){ var restoreLogo = function (optfiledb, usrUid){
ajax_function('replacementLogo','restoreLogo','OPTFILEDB='+optfiledb+'&USRUID='+usrUid,'GET') ; ajax_function('replacementLogo','restoreLogo','OPTFILEDB='+optfiledb+'&USRUID='+usrUid,'GET') ;
//parent.window.location.href = 'setup'; window.location = 'uplogo';
parent.window.location.href = 'main_init';
} }
</script> </script>

View File

@@ -101,6 +101,7 @@ try {
</a></td></tr>"; </a></td></tr>";
$template->assign ('SET_LOGO_PM' ,$restoreLogo); $template->assign ('SET_LOGO_PM' ,$restoreLogo);
}*/ }*/
if (sizeof($_POST)>0) { if (sizeof($_POST)>0) {
//G::SendTemporalMessage('ID_CHANGES_SAVED', 'info', 'labels'); //G::SendTemporalMessage('ID_CHANGES_SAVED', 'info', 'labels');
$formf = $_FILES['form']; $formf = $_FILES['form'];
@@ -111,9 +112,17 @@ try {
$aMessage1 = array(); $aMessage1 = array();
$fileName = trim(str_replace(' ','_', $namefile)); $fileName = trim(str_replace(' ','_', $namefile));
G::uploadFile( $tpnfile, $dir . '/', 'tmp'.$fileName ); G::uploadFile( $tpnfile, $dir . '/', 'tmp'.$fileName );
$error = false;
try {
G::resizeImage($dir . '/tmp' . $fileName, 200, 80, $dir . '/' .$fileName); G::resizeImage($dir . '/tmp' . $fileName, 200, 80, $dir . '/' .$fileName);
} catch (Exception $e) {
$error = $e->getMessage();
}
unlink ($dir . '/tmp' . $fileName); unlink ($dir . '/tmp' . $fileName);
if ($error === false)
header('location: uplogo.php'); header('location: uplogo.php');
else
G::SendTemporalMessage($error, 'error', 'string');
} }
$content = $template->getOutputContent(); $content = $template->getOutputContent();
print $content; print $content;