Пример #1
0
def header(cell, header, ts):
  """
   Format a column header.

   If the cell in question is the column header for the current sort criterion,
   it gets special formatting. All possible sort criteria become links.

   @param cell
     The cell to format.
   @param header
     An array of column headers in the format described in theme_table().
   @param ts
     The current table sort context as returned from hook_init().
   @return
     A properly formatted cell, ready for _theme_table_cell().
  """
  # Special formatting for the currently sorted column header.
  if php.is_array(cell) and php.isset(cell['field']):
    title = t('sort by @s', {'@s': cell['data']})
    if cell['data'] == ts['name']:
      ts['sort'] = ('desc' if (ts['sort'] == 'asc') else 'asc')
      if php.isset(cell['class']):
        cell['class'] += ' active'
      else:
        cell['class'] = 'active'
      image = lib_theme.theme('tablesort_indicator', ts['sort'])
    else:
      # If the user clicks a different header, we want to sort ascending
      # initially.
      ts['sort'] = 'asc'
      image = ''
    if not php.empty(ts['query_string']):
      ts['query_string'] = '&' + ts['query_string']
    cell['data'] = l(
      cell['data'] + image, php.GET['q'], {
        'attributes':
          {
            'title': title,
            'query':
              'sort=' + ts['sort'] + '&order=' + rawurlencode(cell['data']) +
              ts['query_string'],
            'html': TRUE
          }
      }
    )
    php.unset(cell['field'], cell['sort'])
  return cell
Пример #2
0
print "THIS FILE IS NOT FUNCTIONAL"
print "TO SEE A RUNNING INSTANCE OF DRUPY"
print "PLEASE RUN DRUPY.PY AS A CGI OR CLI"
print
php.flush()
exit(1)

#
# We need to catch all exceptions and send them to the
# default exception handler
#
drupal_bootstrap(lib_bootstrap.DRUPAL_BOOTSTRAP_FULL)
return_ = lib_menu.execute_active_handler()
# Menu status constants are integers; page content is a string.
if (is_int(return_)):
    if (return_ == lib_menu.MENU_NOT_FOUND):
        lib_bootstrap.drupal_not_found()
    elif (return_ == lib_menu.MENU_ACCESS_DENIED):
        lib_common.drupal_access_denied()
    elif (return_ == lib_menu.MENU_SITE_OFFLINE):
        lib_common.drupal_site_offline()
else:
    # Print any value (including an empty string) except NULL or undefined:
    print lib_theme.theme('page', return_)
lib_common.drupal_page_footer()

#
# Flush the output
#
php.flush()
Пример #3
0
print
php.flush()
exit(1)


#
# We need to catch all exceptions and send them to the
# default exception handler
#
drupal_bootstrap(lib_bootstrap.DRUPAL_BOOTSTRAP_FULL);
return_ = lib_menu.execute_active_handler();
# Menu status constants are integers; page content is a string.
if (is_int(return_)):
  if (return_ == lib_menu.MENU_NOT_FOUND):
      lib_bootstrap.drupal_not_found();
  elif (return_ == lib_menu.MENU_ACCESS_DENIED):
    lib_common.drupal_access_denied();
  elif (return_ == lib_menu.MENU_SITE_OFFLINE):
    lib_common.drupal_site_offline();
else:
  # Print any value (including an empty string) except NULL or undefined:
  print lib_theme.theme('page', return_);
lib_common.drupal_page_footer();

#
# Flush the output
#
php.flush()