skinEngine now has all the control. All the css pointing to new images under /images and every other skin deleted.

Also implemented a way to only send new css if something changed under skin folder and the css are being streamed without comments
This commit is contained in:
Hugo Loza
2011-03-04 19:57:28 +00:00
parent e4d75f073c
commit 604fd4af58
6 changed files with 1024 additions and 274 deletions

View File

@@ -990,35 +990,8 @@ class G
function streamCSSBigFile( $filename )
{
header('Content-Type: text/css');
//if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor.
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
if ( file_exists($filename) )
$mtime = filemtime($filename);
else
$mtime = date('U');
$gmt_mtime = gmdate("D, d M Y H:i:s", $mtime ) . " GMT";
header('Pragma: cache');
header('ETag: "' . md5 ($mtime . $filename ) . '"' );
header("Last-Modified: " . $gmt_mtime );
header('Cache-Control: public');
//header("Expires: " . gmdate("D, d M Y H:i:s", time () + 30*60*60*24 ) . " GMT"); //1 month
header("Expires: " . gmdate("D, d M Y H:i:s", time () + 60*60*24 ) . " GMT"); //1 day - tempor
if( isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ) {
if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $gmt_mtime) {
header('HTTP/1.1 304 Not Modified');
exit();
}
}
if ( isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
if ( str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == md5( $mtime . $filename)) {
header("HTTP/1.1 304 Not Modified");
exit();
}
}
//First get Skin info
$filenameParts=explode("-",$filename);
$skinName=$filenameParts[0];
$skinVariant="skin";
@@ -1034,14 +1007,47 @@ class G
}
$output = "/* css autogenerated by gulliver framework for $filename skin based on $configurationFile**/\n";
//Read Configuration File
$xmlConfiguration = file_get_contents ( $configurationFile );
$xmlConfigurationObj=G::xmlParser($xmlConfiguration);
$baseSkinDirectory=dirname($configurationFile);
$directorySize=G::getDirectorySize($baseSkinDirectory);
$mtime=$directorySize['maxmtime'];
//if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor.
//$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
$gmt_mtime = gmdate("D, d M Y H:i:s", $mtime ) . " GMT";
header('Pragma: cache');
header('ETag: "' . md5 ($mtime . $filename ) . '"' );
header("Last-Modified: " . $gmt_mtime );
header('Cache-Control: public');
header("Expires: " . gmdate("D, d M Y H:i:s", time () + 30*60*60*24 ) . " GMT"); //1 month
//header("Expires: " . gmdate("D, d M Y H:i:s", time () + 60*60*24 ) . " GMT"); //1 day - tempor
if( isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ) {
if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $gmt_mtime) {
header('HTTP/1.1 304 Not Modified');
exit();
}
}
if ( isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
if ( str_replace('"', '', stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) == md5( $mtime . $filename)) {
header("HTTP/1.1 304 Not Modified");
exit();
}
}
$outputHeader = "/* Autogenerated CSS file by gulliver framework \n";
$outputHeader .=" Skin: $filename\n";
$outputHeader .=" Configuration: $configurationFile\n";
$mtimeNow = date('U');
$gmt_mtimeNow = gmdate("D, d M Y H:i:s", $mtimeNow ) . " GMT";
$outputHeader .=" Date: $gmt_mtimeNow*/\n";
$output ="";
//Base files
switch(strtolower($skinVariant)){
case "extjs":
@@ -1058,10 +1064,10 @@ class G
*/
//adding the extend css for extjs-pmos
//TODO: move this files to pmos-xthem..
$cssThemeExtensions = glob(PATH_TPL . "*/css/extjs-extend/{$extJsSkin}.css");
foreach($cssThemeExtensions as $cssThemeExtensionFile)
//$cssThemeExtensions = glob(PATH_TPL . "*/css/extjs-extend/{$extJsSkin}.css");
//foreach($cssThemeExtensions as $cssThemeExtensionFile)
//$helper->addFile($cssThemeExtensionFile);
$output .= file_get_contents ( $cssThemeExtensionFile );
//$output .= file_get_contents ( $cssThemeExtensionFile );
// $classicCSSPath=PATH_SKIN_ENGINE."base". PATH_SEP."css". PATH_SEP;
// $output .= file_get_contents ( $classicCSSPath . 'sprite.css' );
//$output .= file_get_contents ( $classicCSSPath . 'sprite_ie.css' );
@@ -1106,6 +1112,18 @@ class G
$output .= file_get_contents ( $baseSkinDirectory . PATH_SEP.'css'.PATH_SEP.$cssFileInfo['__ATTRIBUTES__']['file'] );
}
}
//Remove comments..
$regex = array(
"`^([\t\s]+)`ism"=>'',
"`^\/\*(.+?)\*\/`ism"=>"",
"`([\n\A;]+)\/\*(.+?)\*\/`ism"=>"$1",
"`([\n\A;\s]+)//(.+?)[\n\r]`ism"=>"$1\n",
"`(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+`ism"=>"\n"
);
$output = preg_replace(array_keys($regex),$regex,$output);
$output = $outputHeader.$output;
return $output;
}
@@ -4348,6 +4366,50 @@ function script_time()
}
}
}
function getDirectorySize($path,$maxmtime=0)
{
$totalsize = 0;
$totalcount = 0;
$dircount = 0;
if ($handle = opendir ($path))
{
while (false !== ($file = readdir($handle)))
{
$nextpath = $path . '/' . $file;
if ($file != '.' && $file != '..' && !is_link ($nextpath) && $file != '.svn')
{
if (is_dir ($nextpath))
{
$dircount++;
$result = G::getDirectorySize($nextpath,$maxmtime);
$totalsize += $result['size'];
$totalcount += $result['count'];
$dircount += $result['dircount'];
$maxmtime=$result['maxmtime']>$maxmtime?$result['maxmtime']:$maxmtime;
}
elseif (is_file ($nextpath))
{
$totalsize += filesize ($nextpath);
$totalcount++;
$mtime = filemtime($nextpath);
if($mtime>$maxmtime) $maxmtime=$mtime;
}
}
}
}
closedir ($handle);
$total['size'] = $totalsize;
$total['count'] = $totalcount;
$total['dircount'] = $dircount;
$total['maxmtime'] = $maxmtime;
return $total;
}
};
/**
@@ -4425,6 +4487,7 @@ function eprintln($s="", $c=null){
print "$s\n";
}
}
function __($msgID , $lang = SYS_LANG, $data = null)

View File

@@ -63,4 +63,4 @@
enabledBrowsers="ALL" disabledBrowsers=""></cssFile>
</extjs>
</cssFiles>
</skinConfiguration>
</skinConfiguration>

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,3 @@
/*
* Blue is the new Green
*/
/*Edicion de botones copiar de default.css (Final)*/
input:-moz-focus-inner{border:0;}
@@ -11,6 +7,7 @@ button:-moz-focus-inner{border:0;}
/*
Sprite modificado de http://ajaxbestiary.com/Labs/SilkSprite/
*/
.ss_sprite{
background-image:url( /images/icons_silk/sprites.png) !important;
background-repeat:no-repeat;
@@ -29,7 +26,7 @@ Sprite modificado de http://ajaxbestiary.com/Labs/SilkSprite/
}
.pm_toolbar td{padding:0;margin:0}
.panel_headerBar___processmaker{background:url("/skins/ext/images/gray/toolbar/bg.gif") #F0F0F0 !important}
.panel_headerBar___processmaker{background:url("/images/ext/gray/toolbar/bg.gif") #F0F0F0 !important}
.button_menu_ext{padding-left:20px !important;height:18px !important;}
.button_large_ext{padding-left:20px !important;height:32px !important;}

View File

@@ -24,7 +24,7 @@ img {
}
.Footer .image
{
/*background-image: url(/skins/green/images/bf.jpg);
/*background-image: url(/images/classic/bf.jpg);
background-repeat: repeat-x;
height:10px;*/
@@ -56,7 +56,7 @@ img {
.temporalMessageERROR
{
-moz-border-radius:6px; /* Rounded edges in Firefox */
background-image: url(/skins/green/images/error.gif);
background-image: url(/images/classic/error.gif);
color :#ffffff;
border-style:solid;
border-width:1px;
@@ -71,7 +71,7 @@ img {
.temporalMessageWARNING
{
-moz-border-radius:6px; /* Rounded edges in Firefox */
background-image: url(/skins/green/images/warning.png);
background-image: url(/images/classic/warning.png);
color :#555555;
border-style:solid;
border-width:1px;
@@ -86,7 +86,7 @@ img {
.temporalMessageINFO
{
-moz-border-radius:6px; /* Rounded edges in Firefox */
background-image: url(/skins/green/images/message.png);
background-image: url(/images/classic/message.png);
color :#000000;
border-style:solid;
border-width:1px;
@@ -330,7 +330,7 @@ TD.mainMenuBG {
}
TD.mainMenu {
background-image: url(/skins/green/images/bm.jpg);
background-image: url(/images/classic/bm.jpg);
background-repeat: repeat-x;
height: 25px;
left: 46px;
@@ -355,7 +355,7 @@ A.mainMenu:hover {
}
TD.SelectedMenu{
background-image: url(/skins/green/images/bsms.jpg);
background-image: url(/images/classic/bsms.jpg);
background-repeat: repeat-x;
top: 72px;
height: 26px;
@@ -384,7 +384,7 @@ A.SelectedMenu {
TD.subMenu {
background-image: url('/skins/green/images/bsm.jpg');
background-image: url('/images/classic/bsm.jpg');
background-repeat: repeat-x;
height: 25px;
}
@@ -463,14 +463,14 @@ A.selectedSubMenu:hover {
{
left:0px;
top:0px;
background-image:url(/skins/green/images/ftl.png);
background-image:url(/images/classic/ftl.png);
background-color:transparent;
}
.boxTop div.c, .boxTopBlue div.c
{
top:0px;
right:0px;
background-image:url(/skins/green/images/ftr.png);
background-image:url(/images/classic/ftr.png);
background-color:transparent;
}
.boxTop div.b, .boxTopBlue div.b
@@ -485,12 +485,12 @@ A.selectedSubMenu:hover {
/* Box Top Model Blue BEGIN */
.boxTopBlue div.c
{
background-image:url(/skins/green/images/ftr.blue.gif);
background-image:url(/images/classic/ftr.blue.gif);
background-color:transparent;
}
.boxTopBlue div.a
{
background-image:url(/skins/green/images/ftl.blue.gif);
background-image:url(/images/classic/ftl.blue.gif);
background-color:transparent;
}
.boxTopBlue div.b
@@ -520,14 +520,14 @@ A.selectedSubMenu:hover {
{
left:0px;
top:0px;
background-image:url(/skins/green/images/fbl.png);
background-image:url(/images/classic/fbl.png);
background-color:transparent;
}
.boxBottom div.c, .boxBottomBlue div.c
{
top:0px;
right:0px;
background-image:url(/skins/green/images/fbr.png);
background-image:url(/images/classic/fbr.png);
background-color:transparent;
}
.boxBottom div.b, .boxBottomBlue div.b
@@ -535,18 +535,18 @@ A.selectedSubMenu:hover {
width:100%;
height:16px;
border-bottom:1px solid #DADADA;
background: transparent url(/skins/green/images/fbc.png) repeat-x;
background: transparent url(/images/classic/fbc.png) repeat-x;
}
/* Box Bottom Model END */
/* Box Bottom Model Blue BEGIN */
.boxBottomBlue div.c
{
background-image:url(/skins/green/images/fbr.blue.png);
background-image:url(/images/classic/fbr.blue.png);
background-color:transparent;
}
.boxBottomBlue div.a
{
background-image:url(/skins/green/images/fbl.blue.png);
background-image:url(/images/classic/fbl.blue.png);
background-color:transparent;
}
.boxBottomBlue div.b
@@ -554,7 +554,7 @@ A.selectedSubMenu:hover {
width:100%;
height:16px;
border-bottom:1px solid #DADADA;
background: transparent url(/skins/green/images/fbc.blue.png) repeat-x;
background: transparent url(/images/classic/fbc.blue.png) repeat-x;
}
.boxContentBlue
{
@@ -596,21 +596,21 @@ a.linkInBlue:hover
{
left:0px;
top:0px;
background-image:url(/skins/green/images/ftlL.png);
background-image:url(/images/classic/ftlL.png);
background-color:transparent;
}
.boxTopPanel div.c
{
top:0px;
right:0px;
background-image:url(/skins/green/images/ftrL.png);
background-image:url(/images/classic/ftrL.png);
background-color:transparent;
}
.boxTopPanel div.b
{
width:100%;
height:16px;
background: transparent url(/skins/green/images/ftc.png) repeat-x;
background: transparent url(/images/classic/ftc.png) repeat-x;
}
/* BoxPanel Bottom Model END */
@@ -651,7 +651,7 @@ form.formDefault .content
form.formDefault input.FormField
{
border: 1px solid #CCC;
background: #FFFFFF url(/skins/green/images/input_back.gif) repeat-x;
background: #FFFFFF url(/images/classic/input_back.gif) repeat-x;
color:#333333;
font:normal 11px Arial,Helvetica,sans-serif;
}
@@ -682,7 +682,7 @@ form.formDefault .FormFieldContent
form.formDefault textarea.FormTextArea
{
border: 1px solid #CCC;
background: #FFFFFF url(/skins/green/images/input_back.gif) repeat-x;
background: #FFFFFF url(/images/classic/input_back.gif) repeat-x;
color:#333333;
font:normal 11px Arial,Helvetica,sans-serif;
overflow:auto;
@@ -690,7 +690,7 @@ form.formDefault textarea.FormTextArea
form.formDefault textarea.FormTextPM
{
border: 1px solid #CCC;
background: #FFFFFF url(/skins/green/images/input_back.gif) repeat-x;
background: #FFFFFF url(/images/classic/input_back.gif) repeat-x;
color:#333;
font:normal 12 Courier New, monospace ;
overflow:auto;
@@ -1227,7 +1227,7 @@ div.treeParent .content .treeNode a.selected
}
div.treeParent div.treeParent .boxTop div.a
{
background-image:url(/skins/green/images/ftl.blue.gif);
background-image:url(/images/classic/ftl.blue.gif);
}
div.treeParent div.treeParent .boxTop div.b
{
@@ -1236,19 +1236,19 @@ div.treeParent div.treeParent .boxTop div.b
}
div.treeParent div.treeParent .boxTop div.c
{
background-image:url(/skins/green/images/ftr.blue.gif);
background-image:url(/images/classic/ftr.blue.gif);
}
div.treeParent div.treeParent .boxBottom div.a
{
background-image:url(/skins/green/images/fbl.blue.png);
background-image:url(/images/classic/fbl.blue.png);
}
div.treeParent div.treeParent .boxBottom div.b
{
background-image:url(/skins/green/images/fbc.blue.png);
background-image:url(/images/classic/fbc.blue.png);
}
div.treeParent div.treeParent .boxBottom div.c
{
background-image:url(/skins/green/images/fbr.blue.png);
background-image:url(/images/classic/fbr.blue.png);
}*/

File diff suppressed because it is too large Load Diff