BUG 9029 "Se genera un warning al cambiar de workspaces desde ..." SOLVED

- bad url request, trying to get a uxmodern skin login being in classic skin
- validation & the error is controlled now,
This commit is contained in:
Erik Amaru Ortiz
2012-04-27 10:45:55 -04:00
parent 128e71acda
commit 692cbe3f28
3 changed files with 175 additions and 6 deletions

View File

@@ -4956,7 +4956,41 @@ function getDirectorySize($path,$maxmtime=0)
}
require_once PATH_THIRDPARTY . 'smarty/libs/Smarty.class.php';
$fInfo = pathinfo($template);
$tplExists = true;
// file has absolute path
if (substr($template, 0, 1) != PATH_SEP) {
$template = PATH_TEMPLATE . $template;
}
// fix for template that have dot in its name but is not a valid extension
if (isset($fInfo['extension']) && ($fInfo['extension'] != 'tpl' || $fInfo['extension'] != 'html')) {
unset($fInfo['extension']);
}
if (!isset($fInfo['extension'])) {
if (file_exists($template . '.tpl')) {
$template .= '.tpl';
}
else if (file_exists($template . '.html')) {
$template .= '.html';
}
else {
$tplExists = false;
}
}
else {
if (!file_exists($template)) {
$tplExists = false;
}
}
if (!$tplExists) {
throw new Exception("Template: $template, doesn't exist!");
}
$smarty = new Smarty();
$smarty->compile_dir = G::sys_get_temp_dir();
$smarty->cache_dir = G::sys_get_temp_dir();
@@ -4969,7 +5003,7 @@ function getDirectorySize($path,$maxmtime=0)
$smarty->assign($key, $value);
}
$smarty->display("$template.tpl");
$smarty->display($template);
}
/**

View File

@@ -7,6 +7,8 @@
* @author Hugo Loza
*/
define('SE_LAYOUT_NOT_FOUND', 6);
class SkinEngine
{
@@ -149,11 +151,38 @@ class SkinEngine
{
$skinMethod = '_' . strtolower($this->skin);
if (!method_exists($this, $skinMethod)) {
$skinMethod = '_default';
try {
if (!method_exists($this, $skinMethod)) {
$skinMethod = '_default';
}
$this->$skinMethod();
}
catch (Exception $e) {
switch ($e->getCode()) {
case SE_LAYOUT_NOT_FOUND:
$data['exception_type'] = 'Skin Engine Exception';
$data['exception_title'] = 'Layout not Found';
$data['exception_message'] = 'You\'re trying to get a resource from a incorrent skin, please verify you url.';
$data['exception_list'] = array();
if (substr($this->mainSkin, 0, 2) != 'ux') {
$url = '../login/login';
}
else {
$url = '../main/login';
}
$link = '<a href="'.$url.'">Try Now</a>';
$data['exception_notes'][] = ' The System can try redirect to correct url. ' . $link;
G::renderTemplate(PATH_TPL . 'exception', $data);
break;
}
exit(0);
}
$this->$skinMethod();
}
/**
@@ -462,6 +491,14 @@ class SkinEngine
else {
$smarty->template_dir = $this->layoutFile['dirname'];
$tpl = 'layout-'.$this->layout.'.html';
//die($smarty->template_dir.PATH_SEP.$tpl);
if (!file_exists($smarty->template_dir . PATH_SEP . $tpl)) {
$e = new Exception("Layout $tpl does not exist!", SE_LAYOUT_NOT_FOUND);
$e->layoutFile = $smarty->template_dir . PATH_SEP . $tpl;
throw $e;
}
$smarty->assign('_content_file', $viewFile);
}

View File

@@ -0,0 +1,98 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="robots" content="noindex,nofollow" />
<title>Whoops, looks like something went wrong.</title>
<style>
{literal}
/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
html { background: #eee; padding: 10px }
body { font: 11px Verdana, Arial, sans-serif; color: #333 }
img { border: 0; }
.clear { clear:both; height:0; font-size:0; line-height:0; }
.clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
.clear_fix { display:inline-block; }
* html .clear_fix { height:1%; }
.clear_fix { display:block; }
#content { width:970px; margin:0 auto; }
.exceptionreset, .exceptionreset .block { margin: auto }
.exceptionreset abbr { border-bottom: 1px dotted #000; cursor: help; }
.exceptionreset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
.exceptionreset strong { font-weight:bold; }
.exceptionreset a { color:#6c6159; }
.exceptionreset a img { border:none; }
.exceptionreset a:hover { text-decoration:underline; }
.exceptionreset em { font-style:italic; }
.exceptionreset h1, .exceptionreset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
.exceptionreset h2 span { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; }
.exceptionreset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
.exceptionreset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
-webkit-border-bottom-right-radius: 16px;
-webkit-border-bottom-left-radius: 16px;
-moz-border-radius-bottomright: 16px;
-moz-border-radius-bottomleft: 16px;
border-bottom-right-radius: 16px;
border-bottom-left-radius: 16px;
border-bottom:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
}
.exceptionreset .block_exception { background-color:#ddd; color: #333; padding:20px;
-webkit-border-top-left-radius: 16px;
-webkit-border-top-right-radius: 16px;
-moz-border-radius-topleft: 16px;
-moz-border-radius-topright: 16px;
border-top-left-radius: 16px;
border-top-right-radius: 16px;
border-top:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
}
.exceptionreset li a { background:none; color:#006699; }
.exceptionreset li a:hover { background:none; font-weight:bold;color:#006699; text-decoration:underline; }
.exceptionreset ol { padding: 10px 0; }
.exceptionreset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: 1px solid #ccc;
}
.list_exception {
font-size: 12px;
}
{/literal}
</style>
</head>
<body>
<div id="content" class="exceptionreset">
{if isset($title)}
<h1>{$title}</h1>
{/if}
<div class="block_exception clear_fix"><h2>
<abbr title="RuntimeException">{$exception_type}</abbr>:
{$exception_title}
</div>
<div class="block">
<h2>{$exception_message}</h2>
<br/>
{if isset($exception_list)}
<ol class="traces list_exception">
{foreach from=$exception_list item=file}
<li>{$file}</li>
{/foreach}
</ol>
{/if}
{if isset($exception_list)}
<ol class="list_exception">
{foreach from=$exception_notes item=note}
<li>* {$note}</li>
{/foreach}
</ol>
{/if}
</div>
</div>
</body>
</html>