[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the UI view for the widgets installed on a blog. 4 * 5 * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}. 6 * See also {@link http://sourceforge.net/projects/evocms/}. 7 * 8 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}. 9 * 10 * @license http://b2evolution.net/about/license.html GNU General Public License (GPL) 11 * 12 * @package admin 13 * 14 * @version $Id: _widget_list.view.php,v 1.4 2007/09/29 08:18:21 yabs Exp $ 15 */ 16 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 17 18 global $Blog; 19 20 global $container_Widget_array; 21 22 global $container_list; 23 24 25 // Load widgets for current collection: 26 $WidgetCache = & get_Cache( 'WidgetCache' ); 27 $container_Widget_array = & $WidgetCache->get_by_coll_ID( $Blog->ID ); 28 29 /** 30 * @param string Title of the container. This gets passed to T_()! 31 * @param string Suffix of legend 32 */ 33 function display_container( $container, $legend_suffix = '' ) 34 { 35 global $Blog; 36 global $edited_ComponentWidget; 37 38 $Table = & new Table(); 39 40 $Table->title = T_($container).$legend_suffix; 41 42 $Table->global_icon( T_('Add a widget...'), 'new', 43 regenerate_url( '', 'action=new&container='.rawurlencode($container) ), /* TRANS: note this is NOT a NEW widget */ T_('Add widget').' »', 3, 4 ); 44 45 $Table->cols = array( 46 array( 'th' => T_('Widget') ), 47 array( 'th' => T_('Type') ), 48 array( 49 'th' => T_('Move'), 50 'th_class' => 'shrinkwrap', 51 'td_class' => 'shrinkwrap' ), 52 array( 53 'th' => T_('Actions'), 54 'th_class' => 'shrinkwrap', 55 'td_class' => 'shrinkwrap' ), 56 ); 57 58 $Table->display_init(); 59 60 $Table->display_list_start(); 61 62 // TITLE / COLUMN HEADERS: 63 $Table->display_head(); 64 65 // BODY START: 66 $Table->display_body_start(); 67 68 /** 69 * @var WidgetCache 70 */ 71 $WidgetCache = & get_Cache( 'WidgetCache' ); 72 $Widget_array = & $WidgetCache->get_by_coll_container( $Blog->ID, $container ); 73 74 if( empty($Widget_array) ) 75 { // TODO: cleanup 76 $Table->display_line_start( true ); 77 $Table->display_col_start(); 78 echo T_('There is no widget in this container yet.'); 79 $Table->display_col_end(); 80 $Table->display_line_end(); 81 } 82 else 83 { 84 $widget_count = 0; 85 foreach( $Widget_array as $ComponentWidget ) 86 { 87 $widget_count++; 88 89 if( isset($edited_ComponentWidget) && $edited_ComponentWidget->ID == $ComponentWidget->ID ) 90 { 91 $fadeout = true; 92 } 93 else 94 { 95 $fadeout = false; 96 } 97 98 $Table->display_line_start( false, $fadeout ); 99 100 $Table->display_col_start(); 101 echo '<a href="'.regenerate_url( 'blog', 'action=edit&wi_ID='.$ComponentWidget->ID).'">'.$ComponentWidget->get_name().'</a>'; 102 $Table->display_col_end(); 103 104 // Note: this is totally useless, but we need more cols for the screen to feel "right": 105 $Table->display_col_start(); 106 echo $ComponentWidget->type; 107 $Table->display_col_end(); 108 109 // Move 110 $Table->display_col_start(); 111 //echo $ComponentWidget->order.' '; 112 if( $widget_count > 1 ) 113 { 114 echo action_icon( T_('Move up!'), 'move_up', regenerate_url( 'blog', 'action=move_up&wi_ID='.$ComponentWidget->ID ) ); 115 } 116 else 117 { 118 echo get_icon( 'nomove', 'imgtag', array( 'class'=>'action_icon' ) ); 119 } 120 if( $widget_count < count($Widget_array)) 121 { 122 echo action_icon( T_('Move down!'), 'move_down', regenerate_url( 'blog', 'action=move_down&wi_ID='.$ComponentWidget->ID ) ); 123 } 124 else 125 { 126 echo get_icon( 'nomove', 'imgtag', array( 'class'=>'action_icon' ) ); 127 } 128 $Table->display_col_end(); 129 130 // Actions 131 $Table->display_col_start(); 132 echo action_icon( T_('Edit widget settings!'), 'edit', regenerate_url( 'blog', 'action=edit&wi_ID='.$ComponentWidget->ID ) ); 133 echo action_icon( T_('Remove this widget!'), 'delete', regenerate_url( 'blog', 'action=delete&wi_ID='.$ComponentWidget->ID ) ); 134 $Table->display_col_end(); 135 136 $Table->display_line_end(); 137 } 138 } 139 140 // BODY END: 141 $Table->display_body_end(); 142 143 $Table->display_list_end(); 144 } 145 146 // Dislplay containers for current skin: 147 foreach( $container_list as $container ) 148 { 149 display_container( $container ); 150 } 151 152 // Display containers not in current skin: 153 foreach( $container_Widget_array as $container=>$dummy ) 154 { 155 if( !in_array( $container, $container_list ) ) 156 { 157 display_container( $container, ' '.T_('[NOT INCLUDED IN SELECTED SKIN!]') ); 158 } 159 } 160 161 global $rsc_url; 162 163 echo '<img src="'.$rsc_url.'/img/blank.gif" width="1" height="1" /><!-- for IE -->'; 164 165 // Fadeout javascript 166 echo '<script type="text/javascript" src="'.$rsc_url.'js/fadeout.js"></script>'; 167 echo '<script type="text/javascript">addEvent( window, "load", Fat.fade_all, false);</script>'; 168 169 /* 170 * $Log: _widget_list.view.php,v $ 171 * Revision 1.4 2007/09/29 08:18:21 yabs 172 * UI - added edit to actions 173 * 174 * Revision 1.3 2007/09/08 20:23:04 fplanque 175 * action icons / wording 176 * 177 * Revision 1.2 2007/09/03 19:36:06 fplanque 178 * chicago admin skin 179 * 180 * Revision 1.1 2007/06/25 11:02:01 fplanque 181 * MODULES (refactored MVC) 182 * 183 * Revision 1.9 2007/06/18 21:25:48 fplanque 184 * one class per core widget 185 * 186 * Revision 1.8 2007/06/11 22:01:54 blueyed 187 * doc fixes 188 * 189 * Revision 1.7 2007/04/26 00:11:05 fplanque 190 * (c) 2007 191 * 192 * Revision 1.6 2007/03/26 17:12:41 fplanque 193 * allow moving of widgets 194 * 195 * Revision 1.5 2007/01/11 20:44:19 fplanque 196 * skin containers proof of concept 197 * (no params handling yet though) 198 * 199 * Revision 1.4 2007/01/11 02:57:25 fplanque 200 * implemented removing widgets from containers 201 * 202 * Revision 1.3 2007/01/11 02:25:06 fplanque 203 * refactoring of Table displays 204 * body / line / col / fadeout 205 * 206 * Revision 1.2 2007/01/08 23:45:48 fplanque 207 * A little less rough widget manager... 208 * (can handle multiple instances of same widget and remembers order) 209 * 210 * Revision 1.1 2007/01/08 21:55:42 fplanque 211 * very rough widget handling 212 */ 213 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |