Changeset 12048 for extensions
- Timestamp:
- Sep 4, 2011, 6:08:09 PM (13 years ago)
- Location:
- extensions/stripped_black_bloc
- Files:
-
- 16 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/stripped_black_bloc/admin/admin.inc.php
r11823 r12048 15 15 { 16 16 $config_send['color_main']=(isset($_POST['f_color_main']) and !empty($_POST['f_color_main'])) ? $_POST['f_color_main'] : 'E6554F'; 17 $config_send['thumbnail']=(isset($_POST['f_thumbnail'])) ? $_POST['f_thumbnail'] : 'piwigo';18 17 $config_send['column_width']=(isset($_POST['f_column_width'])) ? $_POST['f_column_width'] : 170; 19 18 if ( isset($_POST['f_column_width']) and isset($_POST['f_thumbnail_width'])) … … 32 31 $config_send['thumbnail_width']=150; 33 32 } 34 33 $config_send['every_x']=(isset($_POST['f_every_x'])) ? $_POST['f_every_x'] : 20; 34 $config_send['starting_to']=(isset($_POST['f_starting_to'])) ? $_POST['f_starting_to'] : 1; 35 $config_send['thumbnail']=(isset($_POST['f_thumbnail'])) ? $_POST['f_thumbnail'] : 'piwigo'; 35 36 conf_update_param('stripped_black_bloc', pwg_db_real_escape_string(serialize($config_send))); 36 37 -
extensions/stripped_black_bloc/admin/admin.tpl
r11823 r12048 10 10 <label for="color_main"><span class="property">{'color main'|@translate}</span> </label> 11 11 <input type="text" id="color_main" name="f_color_main" size="6" maxlength="6" value="{$options.color_main}" style="text-align:center;"> 12 12 </li> 13 13 <li> 14 14 <li> 15 15 <label for="column_width"><span class="property">{'Width of columns'|@translate}</span> </label> 16 16 <input type="text" id="column_width" name="f_column_width" size="4" maxlength="4" value="{$options.column_width}" style="text-align:center;"> 17 px</li> 17 px 18 </li> 18 19 <li> 19 20 <label for="column_width"><span class="property">{'Width of thumbnails'|@translate}</span> </label> 20 21 <input type="text" id="column_width" name="f_thumbnail_width" size="4" maxlength="4" value="{$options.thumbnail_width}" style="text-align:center;"> 21 px {'it need to be inferior than the width of columns'|@translate}</li> 22 px {'it need to be inferior than the width of columns'|@translate} 23 </li> 24 <li> 25 <label for="every_x"><span class="property">{'Create a big thumbnail every'|@translate}</span> </label> 26 <input type="text" id="every_x" name="f_every_x" size="5" maxlength="5" value="{$options.every_x}" style="text-align:center;"> 27 {'Thumbnails'|@translate} {'(set 0 to disable)'|@translate} 28 </li> 29 <li> 30 <label for="starting_to"><span class="property">{'... starting to the position number'|@translate}</span> </label> 31 <input type="text" id="starting_to" name="f_starting_to" size="2" maxlength="2" value="{$options.starting_to}" style="text-align:center;"> 32 {'(set 0 to disable)'|@translate} 33 </li> 22 34 <li> 23 35 <label for="thumbnail">{'The thumbnails can be generated by the theme'|@translate}</label> -
extensions/stripped_black_bloc/admin/maintain.inc.php
r11923 r12048 8 8 { 9 9 $config = array( 10 'color_main' => 'E6554F', 11 'column_width' => 170, 12 'thumbnail_width' => 150, 13 'thumbnail' => 'piwigo' //generated - auto - piwigo 10 'color_main' => 'E6554F', 11 'column_width' => 170, 12 'thumbnail_width' => 150, 13 'every_x' => 20, 14 'starting_to' => 1, 15 'thumbnail' => 'piwigo' //generated - auto - piwigo 14 16 ); 15 17 -
extensions/stripped_black_bloc/admin/upgrade.inc.php
r11923 r12048 7 7 if (!isset($conf['stripped_black_bloc'])) 8 8 { 9 $config = array( 10 'color_main' => 'E6554F', 11 'column_width' => 170, 12 'thumbnail_width' => 150, 13 'thumbnail' => 'piwigo' //generated - auto - piwigo 9 $config = array( 10 'color_main' => 'E6554F', 11 'column_width' => 170, 12 'thumbnail_width' => 150, 13 'every_x' => 20, 14 'starting_to' => 1, 15 'thumbnail' => 'piwigo' //generated - auto - piwigo 14 16 ); 15 17 $query = " … … 19 21 20 22 pwg_query($query); 21 23 load_conf_from_db(); 22 24 } 23 elseif (count(unserialize( $conf['stripped_black_bloc'] ))!=4) { 24 $config = array( 25 'color_main' => 'E6554F', 26 'column_width' => 170, 27 'thumbnail_width' => 150, 28 'thumbnail' => 'piwigo' //generated - auto - piwigo 25 elseif (count(unserialize( $conf['stripped_black_bloc'] ))!=6) 26 { 27 $config = array( 28 'color_main' => 'E6554F', 29 'column_width' => 170, 30 'thumbnail_width' => 150, 31 'every_x' => 20, 32 'starting_to' => 1, 33 'thumbnail' => 'piwigo' //generated - auto - piwigo 29 34 ); 30 35 31 36 32 33 37 conf_update_param('stripped_black_bloc', pwg_db_real_escape_string(serialize($config))); 38 load_conf_from_db(); 34 39 } 35 40 ?> -
extensions/stripped_black_bloc/local_head.tpl
r11871 r12048 11 11 .bloc a { 12 12 max-width:{/literal}{if $stripped_black_bloc.thumbnail_width}{$stripped_black_bloc.thumbnail_width}{/if}{literal}px; 13 } 14 .bloc_big { 15 max-width: {/literal}{if $stripped_black_bloc.thumbnail_width}{$stripped_black_bloc.thumbnail_width+$stripped_black_bloc.column_width}{/if}{literal}px; 16 } 17 .bloc_big a { 18 max-width:{/literal}{if $stripped_black_bloc.thumbnail_width}{$stripped_black_bloc.thumbnail_width+$stripped_black_bloc.column_width}{/if}{literal}px; 13 19 } 14 20 .content_block, .bloc_stuff, .two_columns { … … 73 79 $('#subcontent').masonry({ 74 80 columnWidth: {/literal} {if $stripped_black_bloc.column_width}{$stripped_black_bloc.column_width}{/if}{literal}, 75 itemSelector: '.bloc, . content_block, .bloc_stuff',81 itemSelector: '.bloc, .bloc_big, .content_block, .bloc_stuff', 76 82 isAnimated: true 77 83 }); -
extensions/stripped_black_bloc/template/thumbnails.tpl
r11709 r12048 1 1 {if !empty($thumbnails)} 2 2 {foreach from=$thumbnails item=thumbnail} 3 <div class=" bloc">3 <div class="{$thumbnail.TN_CLASS}"> 4 4 <a href="{$thumbnail.URL}" style="background: url({$thumbnail.TN_SRC}) no-repeat scroll center center transparent; height: {$thumbnail.TN_HEIGHT}px; width: {$thumbnail.TN_WIDTH}px; opacity: 0.75;" > 5 5 {if isset($thumbnail.NAME)}{$thumbnail.NAME}{else}{$thumbnail.TN_TITLE}{/if} -
extensions/stripped_black_bloc/theme.css
r11871 r12048 73 73 width:auto; 74 74 } 75 .bloc {75 .bloc, .bloc_big { 76 76 display: block; 77 77 margin-top: 3px; … … 86 86 z-index:999; 87 87 } 88 .bloc * {88 .bloc *, .bloc_big * { 89 89 position: relative; 90 90 } 91 .bloc .title {91 .bloc .title, .bloc_big .title { 92 92 left: 6px; 93 93 max-width: 138px; … … 102 102 padding: 7px 10px 8px; 103 103 } 104 .bloc a {104 .bloc a, .bloc_big a { 105 105 display: block; 106 106 overflow: hidden; -
extensions/stripped_black_bloc/themeconf.inc.php
r11843 r12048 10 10 11 11 12 12 13 13 $themeconf = array( 14 14 'parent' => 'stripped', … … 31 31 function set_config_values_stripped_black_bloc() 32 32 { 33 34 35 33 global $conf, $template; 34 $config = unserialize( $conf['stripped_black_bloc'] ); 35 $template->assign( 'stripped_black_bloc', $config ); 36 36 } 37 37 38 38 /// EVENT 39 add_event_handler('loc_end_index_category_thumbnails', 'MY'); 40 add_event_handler('loc_end_index_thumbnails', 'MY'); 41 function MY($tpl_thumbnails_var) 39 40 /************************************ thumbnails and category_thumbnails ************************************/ 41 add_event_handler('loc_end_index_category_thumbnails', 'stripped_black_bloc'); 42 add_event_handler('loc_end_index_thumbnails', 'stripped_black_bloc'); 43 function stripped_black_bloc($tpl_thumbnails_var) 42 44 { 43 global $template, $conf; 44 $config = unserialize( $conf['stripped_black_bloc'] ); 45 $new_tplvar=array(); 46 foreach ($tpl_thumbnails_var as $tplvar) 47 { 48 list($width, $height, $type, $attr) = getimagesize( $tplvar['TN_SRC'] ); 49 $tplvar['TN_WIDTH']=$width; 50 $tplvar['TN_HEIGHT']=$height; 51 if (isset($config['thumbnail'])) 52 { 53 switch ($config['thumbnail']) 54 { 55 case 'generated': 56 if (isset($tplvar['FILE_WIDTH'])) 57 { 58 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['FILE_PATH']."&w=".$config['thumbnail_width']; 59 } 60 else 61 { 62 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['TN_SRC']."&w=".$config['thumbnail_width']; 63 } 64 $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($config['thumbnail_width']/$tplvar['TN_WIDTH'])); 65 $tplvar['TN_WIDTH']=$config['thumbnail_width']; 66 break; 67 case 'auto': 68 if($tplvar['TN_WIDTH']<=$config['thumbnail_width']) 69 { 70 if (isset($tplvar['FILE_WIDTH'])) 71 { 72 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['FILE_PATH']."&w=".$config['thumbnail_width']; 73 } 74 else 75 { 76 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['TN_SRC']."&w=".$config['thumbnail_width']; 77 } 78 $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($config['thumbnail_width']/$tplvar['TN_WIDTH'])); 79 $tplvar['TN_WIDTH']=$config['thumbnail_width']; 80 } 81 break; 82 case 'piwigo':break; 83 } 84 } 85 $new_tplvar[]=$tplvar; 86 } 87 return $new_tplvar; 45 global $template, $conf; 46 $config = unserialize( $conf['stripped_black_bloc'] ); 47 $new_tplvar=array(); 48 $i=1; 49 foreach ($tpl_thumbnails_var as $tplvar) 50 { 51 list($width, $height, $type, $attr) = getimagesize( $tplvar['TN_SRC'] ); 52 $tplvar['TN_WIDTH']=$width; 53 $tplvar['TN_HEIGHT']=$height; 54 if (!isset($tplvar['CAPTION_NB_IMAGES'])) 55 { 56 $conf_thumbnail_width=($i==$config['starting_to']) ? $config['column_width']+$config['thumbnail_width'] : $config['thumbnail_width']; 57 $tplvar['TN_CLASS']=($i==$config['starting_to']) ? "bloc_big" : "bloc"; 58 } 59 else 60 { 61 $conf_thumbnail_width=$config['thumbnail_width']; 62 } 63 if (isset($config['thumbnail'])) 64 { 65 switch ($config['thumbnail']) 66 { 67 case 'generated': 68 if (isset($tplvar['FILE_WIDTH'])) 69 { 70 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/phpthumb/phpThumb.php?src=../../../../".$tplvar['FILE_PATH']."&w=".$conf_thumbnail_width; 71 } 72 else 73 { 74 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/phpthumb/phpThumb.php?src=../../../../".$tplvar['TN_SRC']."&w=".$conf_thumbnail_width; 75 } 76 $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($conf_thumbnail_width/$tplvar['TN_WIDTH'])); 77 $tplvar['TN_WIDTH']=$conf_thumbnail_width; 78 break; 79 case 'auto': 80 if($tplvar['TN_WIDTH']<=$conf_thumbnail_width) 81 { 82 if (isset($tplvar['FILE_WIDTH'])) 83 { 84 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/phpthumb/phpThumb.php?src=../../../../".$tplvar['FILE_PATH']."&w=".$conf_thumbnail_width; 85 } 86 else 87 { 88 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/phpthumb/phpThumb.php?src=../../../../".$tplvar['TN_SRC']."&w=".$conf_thumbnail_width; 89 } 90 $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($conf_thumbnail_width/$tplvar['TN_WIDTH'])); 91 $tplvar['TN_WIDTH']=$conf_thumbnail_width; 92 } 93 break; 94 case 'piwigo':break; 95 } 96 } 97 $new_tplvar[]=$tplvar; 98 if ($i==$config['every_x']) 99 { 100 $i=1; 101 } 102 else { 103 $i++; 104 } 105 } 106 return $new_tplvar; 88 107 } 89 add_event_handler('init', ' MY_init');90 function MY_init()108 add_event_handler('init', 'stripped_black_bloc_init'); 109 function stripped_black_bloc_init() 91 110 { 92 111 remove_event_handler('loc_begin_index', 'modify_nb_thumbnail_page'); 93 112 } 94 113 … … 109 128 $content = preg_replace($search, $replacement, $content); 110 129 $search = '#\{if \!empty\(\$CONTENT_DESCRIPTION\) \}#'; 111 $replacement = ' 130 $replacement = ' <div id="subcontent"> 112 131 113 132 {if !empty($CONTENT_DESCRIPTION) }'; 114 133 $content = preg_replace($search, $replacement, $content); 115 134 $search = '#\{if \!empty\(\$navbar\) \}[\s]*\{include file=\'navigation_bar\.tpl\'\|@get_extent:\'navbar\'\}[\s]*\{/if\}#'; … … 119 138 $search = '#<\!-- subContent -->#'; 120 139 $replacement = '<!-- subContent --> 121 122 123 140 {if !empty($navbar) } 141 {include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\'} 142 {/if}'; 124 143 return preg_replace($search, $replacement, $content); 125 144 }
Note: See TracChangeset
for help on using the changeset viewer.