Changeset 8378


Ignore:
Timestamp:
Dec 29, 2010, 10:00:25 PM (10 years ago)
Author:
rvelices
Message:

css sprites fix ie7 display
picture.tpl more compact + removed unnecessary escape modifiers + use footer_script
template combine_css small things

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/template.class.php

    r8305 r8378  
    9393    $this->smarty->register_function('get_combined_scripts', array(&$this, 'func_get_combined_scripts') );
    9494    $this->smarty->register_function('combine_css', array(&$this, 'func_combine_css') );
    95     $this->smarty->register_function('get_combined_css', array(&$this, 'func_get_combined_css') );
     95    $this->smarty->register_compiler_function('get_combined_css', array(&$this, 'func_get_combined_css') );
    9696    $this->smarty->register_block('footer_script', array(&$this, 'block_footer_script') );
    9797    $this->smarty->register_function('known_script', array(&$this, 'func_known_script') );
     
    443443          implode( "\n", $content ),
    444444          $this->output );
     445                        $this->css_by_priority = array();
    445446    }
    446447
     
    607608        $content[]= '<script type="text/javascript">';
    608609        $content[]= '(function() {
    609   var after = document.getElementsByTagName(\'script\')[document.getElementsByTagName(\'script\').length-1];
    610   var s;';
     610var after = document.getElementsByTagName(\'script\')[document.getElementsByTagName(\'script\').length-1];
     611var s;';
    611612        foreach ($scripts[1] as $id => $script)
    612613        {
    613614          $content[]=
    614             's=document.createElement(\'script\'); s.type = \'text/javascript\'; s.async = true; s.src = \''
     615            's=document.createElement(\'script\'); s.type=\'text/javascript\'; s.async=true; s.src=\''
    615616            . self::make_script_src($script)
    616617            .'\';';
     
    662663  function func_get_combined_css($params, &$smarty)
    663664  {
    664     return self::COMBINED_CSS_TAG;
     665    return 'echo '.var_export(self::COMBINED_CSS_TAG,true);
    665666  }
    666667
     
    736737
    737738    $regex = array();
    738     $tags = array('if', 'foreach', 'section');
     739    $tags = array('if','foreach','section','footer_script');
    739740    foreach($tags as $tag)
    740741    {
     
    742743      array_push($regex, "#^[ \t]+($ldq/$tag$rdq)\s*$#m");
    743744    }
    744     $tags = array('include', 'else', 'html_head');
     745    $tags = array('include','else','combine_script','html_head');
    745746    foreach($tags as $tag)
    746747    {
     
    11921193    }
    11931194
    1194     $output = '';
    1195     $output .= "/* ".count($this->files)."\n".join("\n", $this->files)."*/\n";
     1195    $output = "/* ".join("\n", $this->files)."*/\n";
    11961196    foreach ($this->files as $input_file)
    11971197    {
     
    12271227    require_once(PHPWG_ROOT_PATH.'include/cssmin.class.php');
    12281228    $css = CssMin::minify($css, array('emulate-css3-variables'=>false));
     1229                $css = trigger_event('combined_css_postfilter', $css);
    12291230    return $css;
    12301231  }
     
    12431244          $relative = dirname($file) . "/$match[1]";
    12441245          $search[] = $match[0];
    1245           $replace[] = "url('" . get_absolute_root_url(false) . $relative . "')";
     1246          $replace[] = 'url('.embellish_url(get_absolute_root_url(false)).$relative.')';
    12461247        }
    12471248      }
  • trunk/themes/default/fix-ie7.css

    r8306 r8378  
    2020}
    2121
     22.pwg-icon {
     23        display: block;
     24}
  • trunk/themes/default/template/picture.tpl

    r8299 r8378  
    1 {* Example of resizeable *}
    2 {*
     1{* Example of resizeable
    32{include file='include/autosize.inc.tpl'}
    43*}
     
    65{if isset($errors)}
    76<div class="errors">
    8   <ul>
    9     {foreach from=$errors item=error}
    10     <li>{$error}</li>
    11     {/foreach}
    12   </ul>
    13 </div>
    14 {/if}
    15 
     7        <ul>
     8                {foreach from=$errors item=error}
     9                <li>{$error}</li>
     10                {/foreach}
     11        </ul>
     12</div>
     13{/if}
    1614{if isset($infos)}
    1715<div class="infos">
    18   <ul>
    19     {foreach from=$infos item=info}
    20     <li>{$info}</li>
    21     {/foreach}
    22   </ul>
     16        <ul>
     17                {foreach from=$infos item=info}
     18                <li>{$info}</li>
     19                {/foreach}
     20        </ul>
    2321</div>
    2422{/if}
     
    2725
    2826<div id="imageHeaderBar">
    29   <div class="browsePath">
    30     {$SECTION_TITLE}
    31     {$LEVEL_SEPARATOR}{$current.TITLE}
    32   </div>
    33   <div class="imageNumber">{$PHOTO}</div>
    34   {if $SHOW_PICTURE_NAME_ON_TITLE }
    35   <h2>{$current.TITLE}</h2>
    36   {/if}
     27        <div class="browsePath">
     28                {$SECTION_TITLE} {$LEVEL_SEPARATOR}{$current.TITLE}
     29        </div>
     30        <div class="imageNumber">{$PHOTO}</div>
     31        {if $SHOW_PICTURE_NAME_ON_TITLE}
     32        <h2>{$current.TITLE}</h2>
     33        {/if}
    3734</div>
    3835
    3936<div id="imageToolBar">
    40         <div class="actionButtons">
     37<div class="actionButtons">
    4138{if isset($U_SLIDESHOW_START)}
    42                 <a href="{$U_SLIDESHOW_START}" title="{'slideshow'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
    43                         <span class="pwg-icon pwg-icon-slideshow">&nbsp;</span><span class="pwg-button-text">{'slideshow'|@translate}</span>
    44                 </a>
     39        <a href="{$U_SLIDESHOW_START}" title="{'slideshow'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
     40                <span class="pwg-icon pwg-icon-slideshow">&nbsp;</span><span class="pwg-button-text">{'slideshow'|@translate}</span>
     41        </a>
    4542{/if}
    4643{if isset($U_METADATA)}
    47                 <a href="{$U_METADATA}" title="{'Show file metadata'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
    48                         <span class="pwg-icon pwg-icon-camera-info">&nbsp;</span><span class="pwg-button-text">{'Show file metadata'|@translate}</span>
    49                 </a>
     44        <a href="{$U_METADATA}" title="{'Show file metadata'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
     45                <span class="pwg-icon pwg-icon-camera-info">&nbsp;</span><span class="pwg-button-text">{'Show file metadata'|@translate}</span>
     46        </a>
    5047{/if}
    5148{if isset($current.U_DOWNLOAD)}
    52                 <a href="{$current.U_DOWNLOAD}" title="{'download this file'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
    53                         <span class="pwg-icon pwg-icon-save">&nbsp;</span><span class="pwg-button-text">{'download'|@translate}</span>
    54                 </a>
     49        <a href="{$current.U_DOWNLOAD}" title="{'download this file'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
     50                <span class="pwg-icon pwg-icon-save">&nbsp;</span><span class="pwg-button-text">{'download'|@translate}</span>
     51        </a>
    5552{/if}
    5653{if isset($PLUGIN_PICTURE_ACTIONS)}{$PLUGIN_PICTURE_ACTIONS}{/if}
    5754{if isset($favorite)}
    58                 <a href="{$favorite.U_FAVORITE}" title="{if $favorite.IS_FAVORITE}{'delete this image from your favorites'|@translate}{else}{'add this image to your favorites'|@translate}{/if}" class="pwg-state-default pwg-button" rel="nofollow">
    59                         <span class="pwg-icon pwg-icon-favorite-{if $favorite.IS_FAVORITE}del{else}add{/if}">&nbsp;</span><span class="pwg-button-text">{'Favorites'|@translate}</span>
    60                 </a>
     55        <a href="{$favorite.U_FAVORITE}" title="{if $favorite.IS_FAVORITE}{'delete this image from your favorites'|@translate}{else}{'add this image to your favorites'|@translate}{/if}" class="pwg-state-default pwg-button" rel="nofollow">
     56                <span class="pwg-icon pwg-icon-favorite-{if $favorite.IS_FAVORITE}del{else}add{/if}">&nbsp;</span><span class="pwg-button-text">{'Favorites'|@translate}</span>
     57        </a>
    6158{/if}
    6259{if isset($U_SET_AS_REPRESENTATIVE)}
    63                 <a href="{$U_SET_AS_REPRESENTATIVE}" title="{'set as album representative'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
    64                         <span class="pwg-icon pwg-icon-representative">&nbsp;</span><span class="pwg-button-text">{'representative'|@translate}</span>
    65                 </a>
     60        <a href="{$U_SET_AS_REPRESENTATIVE}" title="{'set as album representative'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
     61                <span class="pwg-icon pwg-icon-representative">&nbsp;</span><span class="pwg-button-text">{'representative'|@translate}</span>
     62        </a>
    6663{/if}
    6764{if isset($U_ADMIN)}
    68                 <a href="{$U_ADMIN}" title="{'Modify information'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
    69                         <span class="pwg-icon pwg-icon-edit">&nbsp;</span><span class="pwg-button-text">{'edit'|@translate}</span>
    70                 </a>
     65        <a href="{$U_ADMIN}" title="{'Modify information'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
     66                <span class="pwg-icon pwg-icon-edit">&nbsp;</span><span class="pwg-button-text">{'edit'|@translate}</span>
     67        </a>
    7168{/if}
    7269{if isset($U_CADDIE)}{*caddie management BEGIN*}
     
    7774aElement.disabled=true;
    7875var y = new PwgWS(rootUrl);
    79 
    8076y.callService(
    8177        "pwg.caddie.add", {image_id: id} ,
     
    8783}{/literal}
    8884{/footer_script}
    89                 <a href="{$U_CADDIE}" onclick="addToCadie(this, '{$ROOT_URL|@escape:'javascript'}', {$current.id}); return false;" title="{'add to caddie'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
    90                         <span class="pwg-icon pwg-icon-caddie-add">&nbsp;</span><span class="pwg-button-text">{'caddie'|@translate}</span>
    91                 </a>
     85        <a href="{$U_CADDIE}" onclick="addToCadie(this, '{$ROOT_URL}', {$current.id}); return false;" title="{'add to caddie'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
     86                <span class="pwg-icon pwg-icon-caddie-add">&nbsp;</span><span class="pwg-button-text">{'caddie'|@translate}</span>
     87        </a>
    9288{/if}{*caddie management END*}
    93         </div>   
     89</div>
    9490
    9591        {include file='picture_nav_buttons.tpl'|@get_extent:'picture_nav_buttons'}
     
    10399{/if}
    104100
    105 {if isset($U_SLIDESHOW_STOP) }
     101{if isset($U_SLIDESHOW_STOP)}
    106102<p>
    107   [ <a href="{$U_SLIDESHOW_STOP}">{'stop the slideshow'|@translate}</a> ]
     103        [ <a href="{$U_SLIDESHOW_STOP}">{'stop the slideshow'|@translate}</a> ]
    108104</p>
    109105{/if}
     
    112108
    113109{if $DISPLAY_NAV_THUMB}
    114 {if isset($previous) }
     110{if isset($previous)}
    115111<a class="navThumb" id="linkPrev" href="{$previous.U_IMG}" title="{'Previous'|@translate} : {$previous.TITLE}" rel="prev">
    116   <img src="{$previous.THUMB_SRC}" alt="{$previous.TITLE}">
     112        <img src="{$previous.THUMB_SRC}" alt="{$previous.TITLE}">
    117113</a>
    118114{/if}
    119 {if isset($next) }
     115{if isset($next)}
    120116<a class="navThumb" id="linkNext" href="{$next.U_IMG}" title="{'Next'|@translate} : {$next.TITLE}" rel="next">
    121   <img src="{$next.THUMB_SRC}" alt="{$next.TITLE}">
     117        <img src="{$next.THUMB_SRC}" alt="{$next.TITLE}">
    122118</a>
    123119{/if}
     
    125121
    126122<table id="standard" class="infoTable" summary="{'Some info about this picture'|@translate}">
    127   {if $display_info.author}
    128   <tr id="Author">
    129     <td class="label">{'Author'|@translate}</td>
    130     <td class="value">{if isset($INFO_AUTHOR)}{$INFO_AUTHOR}{else}{'N/A'|@translate}{/if}</td>
    131   </tr>
    132   {/if}
    133   {if $display_info.created_on}
    134   <tr id="datecreate">
    135     <td class="label">{'Created on'|@translate}</td>
    136     <td class="value">{if isset($INFO_CREATION_DATE)}{$INFO_CREATION_DATE}{else}{'N/A'|@translate}{/if}</td>
    137   </tr>
    138   {/if}
    139   {if $display_info.posted_on}
    140   <tr id="datepost">
    141     <td class="label">{'Posted on'|@translate}</td>
    142     <td class="value">{$INFO_POSTED_DATE}</td>
    143   </tr>
    144   {/if}
    145   {if $display_info.dimensions}
    146   <tr id="Dimensions">
    147     <td class="label">{'Dimensions'|@translate}</td>
    148     <td class="value">{if isset($INFO_DIMENSIONS)}{$INFO_DIMENSIONS}{else}{'N/A'|@translate}{/if}</td>
    149   </tr>
    150   {/if}
    151   {if $display_info.file}
    152   <tr id="File">
    153     <td class="label">{'File'|@translate}</td>
    154     <td class="value">{$INFO_FILE}</td>
    155   </tr>
    156   {/if}
    157   {if $display_info.filesize}
    158   <tr id="Filesize">
    159     <td class="label">{'Filesize'|@translate}</td>
    160     <td class="value">{if isset($INFO_FILESIZE)}{$INFO_FILESIZE}{else}{'N/A'|@translate}{/if}</td>
    161   </tr>
    162   {/if}
    163   {if $display_info.tags}
    164   <tr id="Tags">
    165     <td class="label">{'Tags'|@translate}</td>
    166     <td class="value">
    167       {if isset($related_tags)}
    168         {foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first}, {/if}
    169         <a href="{$tag.URL}">{$tag.name}</a>{/foreach}
    170       {/if}
    171     </td>
    172   </tr>
    173   {/if}
    174   {if $display_info.categories}
    175   <tr id="Categories">
    176     <td class="label">{'Albums'|@translate}</td>
    177     <td class="value">
    178       {if isset($related_categories)}
    179       <ul>
    180         {foreach from=$related_categories item=cat}
    181         <li>{$cat}</li>
    182         {/foreach}
    183       </ul>
    184       {/if}
    185     </td>
    186   </tr>
    187   {/if}
    188   {if $display_info.visits}
    189   <tr id="Visits">
    190     <td class="label">{'Visits'|@translate}</td>
    191     <td class="value">{$INFO_VISITS}</td>
    192   </tr>
    193   {/if}
    194 
    195 {if $display_info.average_rate and isset($rate_summary) }
     123        {if $display_info.author}
     124        <tr id="Author">
     125                <td class="label">{'Author'|@translate}</td>
     126                <td class="value">{if isset($INFO_AUTHOR)}{$INFO_AUTHOR}{else}{'N/A'|@translate}{/if}</td>
     127        </tr>
     128        {/if}
     129        {if $display_info.created_on}
     130        <tr id="datecreate">
     131                <td class="label">{'Created on'|@translate}</td>
     132                <td class="value">{if isset($INFO_CREATION_DATE)}{$INFO_CREATION_DATE}{else}{'N/A'|@translate}{/if}</td>
     133        </tr>
     134        {/if}
     135        {if $display_info.posted_on}
     136        <tr id="datepost">
     137                <td class="label">{'Posted on'|@translate}</td>
     138                <td class="value">{$INFO_POSTED_DATE}</td>
     139        </tr>
     140        {/if}
     141        {if $display_info.dimensions}
     142        <tr id="Dimensions">
     143                <td class="label">{'Dimensions'|@translate}</td>
     144                <td class="value">{if isset($INFO_DIMENSIONS)}{$INFO_DIMENSIONS}{else}{'N/A'|@translate}{/if}</td>
     145        </tr>
     146        {/if}
     147        {if $display_info.file}
     148        <tr id="File">
     149                <td class="label">{'File'|@translate}</td>
     150                <td class="value">{$INFO_FILE}</td>
     151        </tr>
     152        {/if}
     153        {if $display_info.filesize}
     154        <tr id="Filesize">
     155                <td class="label">{'Filesize'|@translate}</td>
     156                <td class="value">{if isset($INFO_FILESIZE)}{$INFO_FILESIZE}{else}{'N/A'|@translate}{/if}</td>
     157        </tr>
     158        {/if}
     159        {if $display_info.tags}
     160        <tr id="Tags">
     161                <td class="label">{'Tags'|@translate}</td>
     162                <td class="value">
     163                        {if isset($related_tags)}
     164                                {foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first}, {/if}<a href="{$tag.URL}">{$tag.name}</a>{/foreach}
     165                        {/if}
     166                </td>
     167        </tr>
     168        {/if}
     169        {if $display_info.categories}
     170        <tr id="Categories">
     171                <td class="label">{'Albums'|@translate}</td>
     172                <td class="value">
     173                        {if isset($related_categories)}
     174                        <ul>
     175                                {foreach from=$related_categories item=cat}
     176                                <li>{$cat}</li>
     177                                {/foreach}
     178                        </ul>
     179                        {/if}
     180                </td>
     181        </tr>
     182        {/if}
     183        {if $display_info.visits}
     184        <tr id="Visits">
     185                <td class="label">{'Visits'|@translate}</td>
     186                <td class="value">{$INFO_VISITS}</td>
     187        </tr>
     188        {/if}
     189
     190{if $display_info.average_rate and isset($rate_summary)}
    196191        <tr id="Average">
    197192                <td class="label">{'Average rate'|@translate}</td>
    198193                <td class="value" id="ratingSummary">
    199194                {if $rate_summary.count}
    200                         {assign var='rate_text' value='%.2f (rated %d times)'|@translate }
    201                         {$pwg->sprintf($rate_text, $rate_summary.average, $rate_summary.count) }
     195                        {assign var='rate_text' value='%.2f (rated %d times)'|@translate}
     196                        {$pwg->sprintf($rate_text, $rate_summary.average, $rate_summary.count)}
    202197                {else}
    203198                        {'no rate'|@translate}
     
    206201        </tr>
    207202{/if}
    208  
     203
    209204{if isset($rating)}
    210205        <tr id="rating">
     
    214209                <td class="value">
    215210                        <form action="{$rating.F_ACTION}" method="post" id="rateForm" style="margin:0;">
    216                         <div>&nbsp;
     211                        <div>
    217212                        {foreach from=$rating.marks item=mark name=rate_loop}
    218                         {if !$smarty.foreach.rate_loop.first} | {/if}
    219213                        {if isset($rating.USER_RATE) && $mark==$rating.USER_RATE}
    220                           <input type="button" name="rate" value="{$mark}" class="rateButtonSelected" title="{$mark}">
     214                                <input type="button" name="rate" value="{$mark}" class="rateButtonSelected" title="{$mark}">
    221215                        {else}
    222                           <input type="submit" name="rate" value="{$mark}" class="rateButton" title="{$mark}">
     216                                <input type="submit" name="rate" value="{$mark}" class="rateButton" title="{$mark}">
    223217                        {/if}
    224218                        {/foreach}
    225219                        {combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
    226220                        {combine_script id='rating' load='async' require='core.scripts' path='themes/default/js/rating.js'}
    227                         <script type="text/javascript">
    228                                 var _pwgRatingAutoQueue = _pwgRatingAutoQueue || [];
    229                                 _pwgRatingAutoQueue.push(  {ldelim}rootUrl: '{$ROOT_URL|@escape:"javascript"}', image_id: {$current.id},
     221                        {footer_script}
     222                                var _pwgRatingAutoQueue = _pwgRatingAutoQueue||[];
     223                                _pwgRatingAutoQueue.push( {ldelim}rootUrl: '{$ROOT_URL}', image_id: {$current.id},
    230224                                        updateRateText: "{'Update your rating'|@translate|@escape:'javascript'}", updateRateElement: document.getElementById("updateRate"),
    231                                         ratingSummaryText: "{'%.2f (rated %d times)'|@translate|@escape:'javascript'}", ratingSummaryElement: document.getElementById("ratingSummary") {rdelim} );
    232                         </script>
     225                                        ratingSummaryText: "{'%.2f (rated %d times)'|@translate|@escape:'javascript'}", ratingSummaryElement: document.getElementById("ratingSummary"){rdelim} );
     226                        {/footer_script}
    233227                        </div>
    234228                        </form>
     
    237231{/if}
    238232
    239 {if $display_info.privacy_level and isset($available_permission_levels) }
     233{if $display_info.privacy_level and isset($available_permission_levels)}
    240234        <tr id="Privacy">
    241235                <td class="label">{'Who can see this photo?'|@translate}</td>
    242                 <td class="value"> 
     236                <td class="value">
    243237{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
    244238{footer_script}
     
    257251}{/literal}
    258252{/footer_script}
    259         <select onchange="setPrivacyLevel(this, '{$ROOT_URL|@escape:'javascript'}', {$current.id}, this.options[selectedIndex].value)">
     253        <select onchange="setPrivacyLevel(this, '{$ROOT_URL}', {$current.id}, this.options[selectedIndex].value)">
    260254                {foreach from=$available_permission_levels item=label key=level}
    261255                <option label="{$label}" value="{$level}"{if $level == $current.level} selected="selected"{/if}>{$label}</option>
     
    270264<table id="Metadata" class="infoTable2" summary="{'Some more (technical) info about this picture'|@translate}">
    271265{foreach from=$metadata item=meta}
    272   <tr>
    273     <th colspan="2">{$meta.TITLE}</th>
    274   </tr>
    275   {foreach from=$meta.lines item=value key=label}
    276   <tr>
    277     <td class="label">{$label}</td>
    278     <td class="value">{$value}</td>
    279   </tr>
    280   {/foreach}
     266        <tr>
     267                <th colspan="2">{$meta.TITLE}</th>
     268        </tr>
     269        {foreach from=$meta.lines item=value key=label}
     270        <tr>
     271                <td class="label">{$label}</td>
     272                <td class="value">{$value}</td>
     273        </tr>
     274        {/foreach}
    281275{/foreach}
    282276</table>
    283277{/if}
    284278
    285 
    286279<hr class="separation">
    287280
    288281{if isset($COMMENT_COUNT)}
    289282<div id="comments">
    290   {if $COMMENT_COUNT > 0}
     283        {if $COMMENT_COUNT > 0}
    291284                <h3>{$pwg->l10n_dec('%d comment', '%d comments',$COMMENT_COUNT)}</h3>
    292   {/if}
    293   {if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
     285        {/if}
     286        {if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
    294287
    295288        {if isset($comments)}
     
    298291
    299292        {if isset($comment_add)}
    300         <form  method="post" action="{$comment_add.F_ACTION}" class="filter" id="addComment">
     293        <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="addComment">
    301294        <fieldset>
    302295                <legend>{'Add a comment'|@translate}</legend>
     
    311304        {/if}
    312305</div>
    313 {/if} {*comments*}
     306{/if}{*comments*}
    314307
    315308{if !empty($PLUGIN_PICTURE_AFTER)}{$PLUGIN_PICTURE_AFTER}{/if}
Note: See TracChangeset for help on using the changeset viewer.