b2evolution PHP Cross Reference Blogging Systems

Source: /skins_adm/chicago/_adminUI.class.php - 485 lines - 17215 bytes - Summary - Text - Print

Description: This file implements the Admin UI class. Alternate admin skins should derive from this class. This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}. See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file implements the Admin UI class.
   4   * Alternate admin skins should derive from this class.
   5   *
   6   * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.
   7   * See also {@link http://sourceforge.net/projects/evocms/}.
   8   *
   9   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}.
  10   * Parts of this file are copyright (c)2005 by Daniel HAHLER - {@link http://thequod.de/contact}.
  11   *
  12   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
  13   *
  14   * {@internal Open Source relicensing agreement:
  15   * Daniel HAHLER grants Francois PLANQUE the right to license
  16   * Daniel HAHLER's contributions to this file and the b2evolution project
  17   * under any OSI approved OSS license (http://www.opensource.org/licenses/).
  18   * }}
  19   *
  20   * @package admin-skin
  21   * @subpackage evo
  22   *
  23   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  24   * @author blueyed: Daniel HAHLER
  25   *
  26   * @version $Id: _adminUI.class.php 6136 2014-03-08 07:59:48Z manuel $
  27   */
  28  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  29  
  30  /**
  31   * Includes
  32   */
  33  require_once dirname(__FILE__).'/../_adminUI_general.class.php';
  34  
  35  
  36  /**
  37   * We define a special template for the main menu.
  38   *
  39   * @package admin-skin
  40   * @subpackage evo
  41   */
  42  class AdminUI extends AdminUI_general
  43  {
  44      /**
  45       * This function should init the templates - like adding Javascript through the {@link add_headline()} method.
  46       */
  47  	function init_templates()
  48      {
  49          global $Hit;
  50  
  51          // This is included before controller specifc require_css() calls:
  52          require_css( 'basic_styles.css', 'rsc_url' ); // the REAL basic styles
  53          require_css( 'basic.css', 'rsc_url' ); // Basic styles
  54          require_css( 'results.css', 'rsc_url' ); // Results/tables styles
  55          require_css( 'item_base.css', 'rsc_url' ); // Default styles for the post CONTENT
  56          require_css( 'fileman.css', 'rsc_url' ); // Filemanager styles
  57          require_css( 'admin.global.css', 'rsc_url' ); // Basic admin styles
  58          require_css( 'skins_adm/chicago/rsc/css/chicago.css', true );
  59  
  60          if ( $Hit->is_IE() )
  61          {
  62              require_css( 'admin_global_ie.css', 'rsc_url' );
  63          }
  64          // CSS for IE9
  65          add_headline( '<!--[if IE 9 ]>' );
  66          require_css( 'ie9.css', 'rsc_url' );
  67          add_headline( '<![endif]-->' );
  68  
  69          require_js( '#jquery#', 'rsc_url' );
  70          require_js( 'jquery/jquery.raty.min.js', 'rsc_url' );
  71      }
  72  
  73  
  74      /**
  75       * GLOBAL HEADER - APP TITLE, LOGOUT, ETC.
  76       *
  77       * @return string
  78       */
  79  	function get_page_head()
  80      {
  81          global $UserSettings, $current_User;
  82  
  83          $r = '';
  84          if( $UserSettings->get( 'show_breadcrumbs', $current_User->ID ) ) {
  85              $r = $this->breadcrumbpath_get_html();
  86          }
  87  
  88          if( $UserSettings->get( 'show_menu', $current_User->ID) )
  89          {
  90              $r .= '
  91              <div id="header">'
  92                  // Display MAIN menu:
  93                  .$this->get_html_menu().'
  94              </div>
  95              ';
  96          }
  97  
  98          return $r;
  99      }
 100  
 101  
 102      /**
 103       *
 104       *
 105       * @return string
 106       */
 107  	function get_body_top()
 108      {
 109          global $Messages;
 110  
 111          $r = '<div class="wrapper">';
 112  
 113          $r .= $this->get_page_head();
 114  
 115          $r .= $this->get_bloglist_buttons();
 116  
 117          $r .= '<div id="panelbody" class="panelbody">'
 118              ."\n\n";
 119  
 120          // Display info & error messages
 121          $r .= $Messages->display( NULL, NULL, false, 'action_messages' );
 122  
 123          return $r;
 124      }
 125  
 126  
 127      /**
 128       * Get the end of the HTML <body>. Close open divs, etc...
 129       *
 130       * @return string
 131       */
 132  	function get_body_bottom()
 133      {
 134          return "\n</div>\n</div>\n";
 135      }
 136  
 137  
 138      /**
 139       * Get the footer text
 140       */
 141  	function get_footer_contents()
 142      {
 143          global $app_footer_text, $copyright_text;
 144          global $adminskins_url;
 145  
 146          global $Hit;
 147  
 148          $r = '<div class="footer">';
 149  
 150          if( $Hit->is_winIE() )
 151          {
 152           $r .= '<!--[if lt IE 7]>
 153  <div style="text-align:center; color:#f00; font-weight:bold;">'.
 154              T_('WARNING: Internet Explorer 6 may not able to display this admin skin properly. We strongly recommend you upgrade to IE 7 or Firefox.').'</div>
 155  <![endif]-->';
 156          }
 157  
 158          $r .= '<a href="http://b2evolution.net/" class="footer_logo"><img src="'.$adminskins_url.'chicago/rsc/img/b2evolution-footer-logo-blue-bg.gif" alt="Powered by b2evolution" width="142" height="43" longdesc="http://b2evolution.net/" /></a>';
 159  
 160          $r .= '<div class="copyright">';
 161  
 162          $r .= $app_footer_text.' &ndash; '.$copyright_text."</div></div>\n\n";
 163  
 164          return $r;
 165      }
 166  
 167  
 168      /**
 169       * Get a template by name and depth.
 170       *
 171       * Templates can handle multiple depth levels
 172       *
 173       * This is a method (and not a member array) to allow dynamic generation and T_()
 174       *
 175       * @param string Name of the template ('main', 'sub')
 176       * @param integer Nesting level (start at 0)
 177       * @return array Associative array which defines layout and optionally properties.
 178       */
 179  	function get_template( $name, $depth = 0 )
 180      {
 181          global $rsc_url;
 182  
 183          $pb_begin1 = '<div class="pblock">';
 184          $pb_begin2 = '<div class="pan_left"><div class="pan_right"><div class="pan_top"><div class="pan_tl"><div class="pan"><div class="panelblock">';
 185          $pb_end = '</div></div></div></div></div></div>
 186                                  <div class="pan_bot"><div class="pan_bl"><div class="pan_br"></div></div></div></div>';
 187  
 188          switch( $name )
 189          {
 190              case 'sub':
 191                  // a payload block with embedded submenu
 192                  return array(
 193                          'before' => $pb_begin1.'$top_block$'
 194                              .'<span style="float:right">$global_icons$</span>'
 195                              .'<table class="tabs" cellspacing="0"><tr>'
 196                              .'<td class="first"></td>',
 197  
 198                          'after' => '<td class="last"></td>'
 199                              ."</tr></table>\n"
 200                              .$pb_begin2,
 201  
 202                          'empty' => $pb_begin1.$pb_begin2,
 203  
 204                          'beforeEach' => '<td class="option">',
 205                          'afterEach'  => '</td>',
 206                          'beforeEachSel' => '<td class="current">',
 207                          'afterEachSel' => '</td>',
 208  
 209                          'end' => $pb_end, // used to end payload block that opened submenu
 210                      );
 211  
 212  
 213              case 'block':
 214                  // an additional payload block, anywhere after the one with the submenu. Used by disp_payload_begin()/disp_payload_end()
 215                  return array(
 216                          'begin' => $pb_begin1.$pb_begin2,
 217                          'end' => $pb_end,
 218                      );
 219  
 220  
 221              case 'Results':
 222                  // Results list:
 223                  return array(
 224                      'page_url' => '', // All generated links will refer to the current page
 225                      'before' => '<div class="results">',
 226                      'content_start' => '<div id="$prefix$ajax_content">',
 227                      'header_start' => '<div class="results_nav">',
 228                          'header_text' => '<strong>'.T_('Pages').'</strong>: $prev$ $first$ $list_prev$ $list$ $list_next$ $last$ $next$',
 229                          'header_text_single' => '',
 230                      'header_end' => '</div>',
 231                      'head_title' => '<div class="fieldset_title"><div class="fieldset_title_right"><div class="fieldset_title_bg">
 232                                                              <span style="float:right">$global_icons$</span>$title$
 233                                                          </div></div></div>'."\n",
 234                      'filters_start' => '<div class="filters">',
 235                      'filters_end' => '</div>',
 236                      'list_start' => '<div class="table_scroll">'."\n"
 237                                     .'<table class="grouped" cellspacing="0">'."\n",
 238                          'head_start' => '<thead>'."\n",
 239                              'line_start_head' => '<tr class="clickable_headers">',  // TODO: fusionner avec colhead_start_first; mettre a jour admin_UI_general; utiliser colspan="$headspan$"
 240                              'colhead_start' => '<th $class_attrib$ $title_attrib$>',
 241                              'colhead_start_first' => '<th class="firstcol $class$" $title_attrib$>',
 242                              'colhead_start_last' => '<th class="lastcol $class$" $title_attrib$>',
 243                              'colhead_end' => "</th>\n",
 244                              'sort_asc_off' => get_icon( 'sort_asc_off' ),
 245                              'sort_asc_on' => get_icon( 'sort_asc_on' ),
 246                              'sort_desc_off' => get_icon( 'sort_desc_off' ),
 247                              'sort_desc_on' => get_icon( 'sort_desc_on' ),
 248                              'basic_sort_off' => '',
 249                              'basic_sort_asc' => get_icon( 'ascending' ),
 250                              'basic_sort_desc' => get_icon( 'descending' ),
 251                          'head_end' => "</thead>\n\n",
 252                          'tfoot_start' => "<tfoot>\n",
 253                          'tfoot_end' => "</tfoot>\n\n",
 254                          'body_start' => "<tbody>\n",
 255                              'line_start' => '<tr class="even">'."\n",
 256                              'line_start_odd' => '<tr class="odd">'."\n",
 257                              'line_start_last' => '<tr class="even lastline">'."\n",
 258                              'line_start_odd_last' => '<tr class="odd lastline">'."\n",
 259                                  'col_start' => '<td $class_attrib$>',
 260                                  'col_start_first' => '<td class="firstcol $class$">',
 261                                  'col_start_last' => '<td class="lastcol $class$">',
 262                                  'col_end' => "</td>\n",
 263                              'line_end' => "</tr>\n\n",
 264                              'grp_line_start' => '<tr class="group">'."\n",
 265                              'grp_line_start_odd' => '<tr class="odd">'."\n",
 266                              'grp_line_start_last' => '<tr class="lastline">'."\n",
 267                              'grp_line_start_odd_last' => '<tr class="odd lastline">'."\n",
 268                                          'grp_col_start' => '<td $class_attrib$ $colspan_attrib$>',
 269                                          'grp_col_start_first' => '<td class="firstcol $class$" $colspan_attrib$>',
 270                                          'grp_col_start_last' => '<td class="lastcol $class$" $colspan_attrib$>',
 271                                  'grp_col_end' => "</td>\n",
 272                              'grp_line_end' => "</tr>\n\n",
 273                          'body_end' => "</tbody>\n\n",
 274                          'total_line_start' => '<tr class="total">'."\n",
 275                              'total_col_start' => '<td $class_attrib$>',
 276                              'total_col_start_first' => '<td class="firstcol $class$">',
 277                              'total_col_start_last' => '<td class="lastcol $class$">',
 278                              'total_col_end' => "</td>\n",
 279                          'total_line_end' => "</tr>\n\n",
 280                      'list_end' => "</table></div>\n\n",
 281                      'footer_start' => '<div class="results_nav nav_footer">',
 282                      'footer_text' => '<strong>'.T_('Pages').'</strong>: $prev$ $first$ $list_prev$ $list$ $list_next$ $last$ $next$<br />$page_size$'
 283                                        /* T_('Page $scroll_list$ out of $total_pages$   $prev$ | $next$<br />'. */
 284                                        /* '<strong>$total_pages$ Pages</strong> : $prev$ $list$ $next$' */
 285                                        /* .' <br />$first$  $list_prev$  $list$  $list_next$  $last$ :: $prev$ | $next$') */,
 286                      'footer_text_single' => '$page_size$',
 287                      'footer_text_no_limit' => '', // Text if theres no LIMIT and therefor only one page anyway
 288                          'prev_text' => T_('Previous'),
 289                          'next_text' => T_('Next'),
 290                          'no_prev_text' => '',
 291                          'no_next_text' => '',
 292                          'list_prev_text' => T_('...'),
 293                          'list_next_text' => T_('...'),
 294                          'list_span' => 11,
 295                          'scroll_list_range' => 5,
 296                      'footer_end' => "</div>\n\n",
 297                      'no_results_start' => '<table class="grouped" cellspacing="0">'."\n",
 298                      'no_results_end'   => '<tr class="lastline"><td class="firstcol lastcol">$no_results$</td></tr>'
 299                                                  .'</table>'."\n\n",
 300                  'content_end' => '</div>',
 301                  'after' => '</div><div class="clear"></div>',
 302                  'sort_type' => 'basic'
 303                  );
 304  
 305  
 306              case 'compact_form':
 307                  // Compact Form settings:
 308                  return array(
 309                      'layout' => 'chicago',        // Temporary dirty hack
 310                      'formstart' => '<div class="fieldset_title"><div class="fieldset_title_right">',
 311  
 312                      'title_fmt' => '<div class="fieldset_title_bg" $title_attribs$><span style="float:right">$global_icons$</span>$title$</div></div></div><fieldset>'."\n",
 313                      'no_title_fmt' => '<div class="fieldset_title_bg" $title_attribs$><span style="float:right">$global_icons$</span>&nbsp;</div></div></div><fieldset>'."\n",
 314                      'fieldset_begin' => '<div class="fieldset_wrapper $class$" id="$id$"><h2 $title_attribs$>$fieldset_title$</h2>',
 315                      'fieldset_end' => '</div>',
 316                      'fieldstart' => '<fieldset $ID$>'."\n",
 317                      'labelstart' => '<div class="label">',
 318                      'labelend' => "</div>\n",
 319                      'labelempty' => '<div class="label"></div>', // so that IE6 aligns DIV.input correcctly
 320                      'inputstart' => '<div class="input">',
 321                      'infostart' => '<div class="info">',
 322                      'inputend' => "</div>\n",
 323                      'fieldend' => "</fieldset>\n\n",
 324                      'buttonsstart' => '<fieldset><div class="input">',
 325                      'buttonsend' => "</div></fieldset>\n\n",
 326                      'customstart' => '<div class="custom_content">',
 327                      'customend' => "</div>\n",
 328                      'formend' => '</fieldset>'."\n",
 329                  );
 330  
 331  
 332              case 'Form':
 333                  // Default Form settings:
 334                  return array(
 335                      'layout' => 'chicago',        // Temporary dirty hack
 336                      'formstart' => '',
 337                      'title_fmt' => '<span style="float:right">$global_icons$</span><h2>$title$</h2>'."\n",
 338                      'no_title_fmt' => '<span style="float:right">$global_icons$</span>'."\n",
 339                      'fieldset_begin' => '<div class="fieldset_wrapper $class$" id="fieldset_wrapper_$id$"><div class="fieldset_title"><div class="fieldset_title_right">
 340                          <div class="fieldset_title_bg" $title_attribs$>$fieldset_title$</div></div></div>
 341                          <fieldset $fieldset_attribs$>'."\n", // $fieldset_attribs will contain ID
 342                      'fieldset_end' => '</fieldset></div>'."\n",
 343                      'fieldstart' => '<fieldset $ID$>'."\n",
 344                      'labelstart' => '<div class="label">',
 345                      'labelend' => "</div>\n",
 346                      'labelempty' => '<div class="label"></div>', // so that IE6 aligns DIV.input correcctly
 347                      'inputstart' => '<div class="input">',
 348                      'infostart' => '<div class="info">',
 349                      'inputend' => "</div>\n",
 350                      'fieldend' => "</fieldset>\n\n",
 351                      'buttonsstart' => '<fieldset><div class="input">',
 352                      'buttonsend' => "</div></fieldset>\n\n",
 353                      'customstart' => '<div class="custom_content">',
 354                      'customend' => "</div>\n",
 355                      'formend' => '',
 356                  );
 357  
 358  
 359              case 'file_browser':
 360                  return array(
 361                          'block_start' => '<div class="block_item_wrap"><div class="fieldset_title"><div class="fieldset_title_right"><div class="fieldset_title_bg">
 362                                                                          <span style="float:right">$global_icons$</span>$title$
 363                                                                      </div></div></div>',
 364                          'block_end' => '</div>',
 365                      );
 366  
 367              case 'block_item':
 368                  return array(
 369                          'block_start' => '<div class="block_item_wrap"><div class="fieldset_title"><div class="fieldset_title_right"><div class="fieldset_title_bg">
 370                                                                          <span style="float:right">$global_icons$</span>$title$
 371                                                                      </div></div></div>
 372                                                                      <div class="block_item" id="styled_content_block">',
 373                          'block_end' => '</div></div>',
 374                      );
 375  
 376              case 'dash_item':
 377                  return array(
 378                          'block_start' => '<div class="block_item_wrap"><div class="fieldset_title"><div class="fieldset_title_right"><div class="fieldset_title_bg">
 379                                                                          <span style="float:right">$global_icons$</span>$title$
 380                                                                      </div></div></div>
 381                                                                      <div class="dash_item">',
 382                          'block_end' => '</div></div>',
 383                      );
 384  
 385              case 'side_item':
 386                  return array(
 387                          'block_start' => '<div class="browse_side_item_wrap"><div class="fieldset_title"><div class="fieldset_title_right"><div class="fieldset_title_bg">
 388                                                                          <span style="float:right">$global_icons$</span>$title$
 389                                                                      </div></div></div>
 390                                                                      <div class="browse_side_item">',
 391                          'block_end' => '</div></div>',
 392                      );
 393  
 394              default:
 395                  // Delegate to parent class:
 396                  return parent::get_template( $name, $depth );
 397          }
 398      }
 399  
 400      /**
 401       * Get colors for page elements that can't be controlled by CSS (charts)
 402       */
 403  	function get_color( $what )
 404      {
 405          switch( $what )
 406          {
 407              case 'payload_background':
 408                  return 'f1f6f8';
 409                  break;
 410          }
 411          debug_die( 'unknown color' );
 412      }
 413  
 414  
 415      /**
 416       * Display skin specific options
 417       */
 418  	function display_skin_settings( $Form, $user_ID )
 419      {
 420          global $UserSettings, $current_User;
 421          $Form->begin_fieldset( T_( 'Admin skin settings' ), array( 'id' => 'admin_skin_settings' ) );
 422          parent::display_skin_settings( $Form, $user_ID );
 423  
 424          $user_admin_skin = $UserSettings->get( 'admin_skin', $user_ID );
 425          if( $UserSettings->get( 'admin_skin', $current_User->ID ) == $user_admin_skin )
 426          {
 427              $Form->checklist( array(
 428                          array( 'show_evobar', 1, T_('Show evobar'), $UserSettings->get( 'show_evobar', $user_ID ) ),
 429                          array( 'show_breadcrumbs', 1, T_('Show breadcrumbs path'), $UserSettings->get( 'show_breadcrumbs', $user_ID ) ),
 430                          array( 'show_menu', 1, T_('Show Menu'), $UserSettings->get( 'show_menu', $user_ID ) ) ),
 431                      'chicago_settings', T_('Chicago skin settings') );
 432          }
 433          else
 434          {
 435              $Form->info( '', sprintf( T_( 'Admin skin settings for this user cannot be edited because this user is using a different admin skin (%s)' ), $user_admin_skin ) );
 436          }
 437  
 438          $Form->end_fieldset();
 439  
 440          // JavaScript code to dynamically change display settings. show_evobar or show_menu always have to be checked
 441          ?>
 442          <script type="text/javascript">
 443          jQuery( '[name = show_evobar], [name = show_menu]' ).click( function()
 444          {
 445              if( ! ( jQuery( '[name = show_evobar]' ).attr( 'checked' ) || jQuery( '[name = show_menu]' ).attr( 'checked' ) ) )
 446              {
 447                  jQuery( '[name = show_evobar]' ).attr( 'checked', true );
 448              }
 449          } );
 450          </script>
 451          <?php
 452      }
 453  
 454  
 455      /**
 456       * Set skin specific options
 457       */
 458  	function set_skin_settings( $user_ID )
 459      {
 460          global $UserSettings;
 461          $show_menu = param( 'show_menu', 'boolean' );
 462          // evobar or menu must be visible. If menu is not visible, show_evobar must be set to true.
 463          $show_evobar = ( $show_menu ? param( 'show_evobar', 'boolean' ) : true );
 464  
 465          $UserSettings->set( 'show_evobar', $show_evobar, $user_ID );
 466          $UserSettings->set( 'show_breadcrumbs', param( 'show_breadcrumbs', 'boolean' ), $user_ID );
 467          $UserSettings->set( 'show_menu', $show_menu, $user_ID );
 468          // It will be saved by the user.ctrl
 469          // $UserSettings->dbupdate();
 470      }
 471  
 472  
 473      /**
 474       * Get show evobar setting
 475       * @return boolean
 476       */
 477  	function get_show_evobar()
 478      {
 479          global $UserSettings, $current_User;
 480          return $UserSettings->get( 'show_evobar', $current_User->ID );
 481      }
 482  }
 483  
 484  
 485  ?>

title

Description

title

Description

title

Description

title

title

Body