/[drupal]/contributions/modules/services/services_admin_browse.inc
ViewVC logotype

Diff of /contributions/modules/services/services_admin_browse.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.5.2.45.2.2, Sat Sep 5 13:57:58 2009 UTC revision 1.5.2.45.2.3, Wed Nov 4 21:43:25 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: services_admin_browse.inc,v 1.5.2.45.2.1 2009/06/13 20:00:14 marcingy Exp $  // $Id: services_admin_browse.inc,v 1.5.2.45.2.2 2009/09/05 13:57:58 marcingy Exp $
3  /**  /**
4   * @author Services Dev Team   * @author Services Dev Team
5   * @file   * @file
# Line 20  function services_admin_browse_index() { Line 20  function services_admin_browse_index() {
20      $output .= '<ul>';      $output .= '<ul>';
21      foreach ($servers as $module) {      foreach ($servers as $module) {
22        $info = module_invoke($module, 'server_info');        $info = module_invoke($module, 'server_info');
23        $name = $info['#name'];        services_strip_hashes($info);
24        $path = 'services/'. $info['#path'];  
25          $name = $info['name'];
26          $path = 'services/'. $info['path'];
27        $output .= '<li class="leaf">'. l($name .' - /'. $path, $path) .'</li>';        $output .= '<li class="leaf">'. l($name .' - /'. $path, $path) .'</li>';
28      }      }
29      $output .= '</ul>';      $output .= '</ul>';
# Line 36  function services_admin_browse_index() { Line 38  function services_admin_browse_index() {
38    // group namespaces    // group namespaces
39    $services = array();    $services = array();
40    foreach ($methods as $method) {    foreach ($methods as $method) {
41      $namespace = drupal_substr($method['#method'], 0, strrpos($method['#method'], '.'));      $namespace = drupal_substr($method['method'], 0, strrpos($method['method'], '.'));
42      $services[$namespace][] = $method;      $services[$namespace][] = $method;
43    }    }
44    
# Line 45  function services_admin_browse_index() { Line 47  function services_admin_browse_index() {
47        $output .= '<h3>'. $namespace .'</h3>';        $output .= '<h3>'. $namespace .'</h3>';
48        $output .= '<ul>';        $output .= '<ul>';
49        foreach ($methods as $method) {        foreach ($methods as $method) {
50          $output .= '<li class="leaf">'. l($method['#method'], 'admin/build/services/browse/'. $method['#method']) .'</li>';          $output .= '<li class="leaf">'. l($method['method'], 'admin/build/services/browse/'. $method['method']) .'</li>';
51        }        }
52        $output .= '</ul>';        $output .= '</ul>';
53      }      }
# Line 62  function services_admin_browse_method($m Line 64  function services_admin_browse_method($m
64    
65    $output = '';    $output = '';
66    
67    $output .= '<h3>'. $method['#method'] .'</h3>';    $output .= '<h3>'. $method['method'] .'</h3>';
68    $output .= '<p>'. $method['#help'] .'</p>';    $output .= '<p>'. $method['help'] .'</p>';
69    
70    // List arguments.    // List arguments.
71    $output .= '<h3>'. t('Arguments') .' ('. count($method['#args']) .')</h3>';    $output .= '<h3>'. t('Arguments') .' ('. count($method['args']) .')</h3>';
72    $output .= '<dl id="service-browser-arguments">';    $output .= '<dl id="service-browser-arguments">';
73    $count = 0;    $count = 0;
74    foreach ($method['#args'] as $arg) {    foreach ($method['args'] as $arg) {
75      $count++;      $count++;
76      $output .= '<dt><em class="type">'. $arg['#type'] .'</em><strong class="name">'.      $output .= '<dt><em class="type">'. $arg['type'] .'</em><strong class="name">'.
77        $arg['#name'] .'</strong> ('. (($arg['#optional']) ? t('optional') : t('required')) .')</dt>';        $arg['name'] .'</strong> ('. (($arg['optional']) ? t('optional') : t('required')) .')</dt>';
78      $output .= '<dd>'. $arg['#description'] .'</dd>';      $output .= '<dd>'. $arg['description'] .'</dd>';
79    }    }
80    
81    $output .= '</dl>';    $output .= '</dl>';
# Line 100  function services_admin_browse_test() { Line 102  function services_admin_browse_test() {
102    $form['arg'] = array('#tree' => TRUE);    $form['arg'] = array('#tree' => TRUE);
103    $form['format'] = array('#tree' => TRUE);    $form['format'] = array('#tree' => TRUE);
104    
105    foreach ($method['#args'] as $key => $arg) {    foreach ($method['args'] as $key => $arg) {
106      $form['name'][$key]         = array(      $form['name'][$key]         = array(
107        '#value' => $arg['#name']        '#value' => $arg['name']
108      );      );
109      $form['optional'][$key]     = array(      $form['optional'][$key]     = array(
110        '#value' => ($arg['#optional']) ? t('optional') : t('required')        '#value' => ($arg['optional']) ? t('optional') : t('required')
111      );      );
112    
113      if (isset($arg['#size']) && $arg['#size'] == 'big') {      if (isset($arg['size']) && $arg['size'] == 'big') {
114        $form['arg'][$key] = array(        $form['arg'][$key] = array(
115          '#type'           => 'textarea'          '#type'           => 'textarea'
116        );        );
# Line 120  function services_admin_browse_test() { Line 122  function services_admin_browse_test() {
122      }      }
123    
124      $format_opt = array();      $format_opt = array();
125      switch ($arg['#type']) {      switch ($arg['type']) {
126        case 'array':        case 'array':
127          $format_opt['cdel'] = t('Comma delimited');          $format_opt['cdel'] = t('Comma delimited');
128        case 'struct':        case 'struct':
# Line 159  function services_admin_browse_test_subm Line 161  function services_admin_browse_test_subm
161    $args = services_admin_browse_test_unserialize_args($form_state['values']['arg'], $form_state['values']['format']);    $args = services_admin_browse_test_unserialize_args($form_state['values']['arg'], $form_state['values']['format']);
162    // Allow the authorization module to handle submitted values.    // Allow the authorization module to handle submitted values.
163    services_auth_invoke('alter_browse_form_submit', $method, $args);    services_auth_invoke('alter_browse_form_submit', $method, $args);
164    $result = services_method_call($method['#method'], $args, TRUE);    $result = services_method_call($method['method'], $args, TRUE);
165    $_services_admin_browse_test_submit_result = '<pre>'. htmlspecialchars(print_r($result, TRUE)) .'</pre>';    $_services_admin_browse_test_submit_result = '<pre>'. htmlspecialchars(print_r($result, TRUE)) .'</pre>';
166  }  }
167    
# Line 167  function services_admin_browse_test_unse Line 169  function services_admin_browse_test_unse
169    $method = services_method_get(arg(4));    $method = services_method_get(arg(4));
170    $noskip = FALSE;    $noskip = FALSE;
171    // Convert args    // Convert args
172    for ($c = count($method['#args']) - 1; $c >= 0; $c--) {    for ($c = count($method['args']) - 1; $c >= 0; $c--) {
173      $arg = $method['#args'][$c];      $arg = $method['args'][$c];
174      $value = $values[$c];      $value = $values[$c];
175    
176      // Remove empty values from end of array      // Remove empty values from end of array
# Line 192  function services_admin_browse_test_unse Line 194  function services_admin_browse_test_unse
194            $return[$c] = NULL;            $return[$c] = NULL;
195          }          }
196          else {          else {
197            $return[$c] = json_decode($value, $arg['#type'] === 'array');            $return[$c] = json_decode($value, $arg['type'] === 'array');
198          }          }
199          break;          break;
200        case 'sphp':        case 'sphp':
# Line 254  function services_admin_settings() { Line 256  function services_admin_settings() {
256      $auth_options = array('' => t('-- Select a authorization module'));      $auth_options = array('' => t('-- Select a authorization module'));
257      foreach ($auth_modules as $module) {      foreach ($auth_modules as $module) {
258        $info = services_auth_info(NULL, $module);        $info = services_auth_info(NULL, $module);
259        $auth_options[$info['#description']][$module] = $info['#title'];        services_strip_hashes($info);
260    
261          $auth_options[$info['description']][$module] = $info['title'];
262      }      }
263    
264      $form['security'] = array(      $form['security'] = array(

Legend:
Removed from v.1.5.2.45.2.2  
changed lines
  Added in v.1.5.2.45.2.3

  ViewVC Help
Powered by ViewVC 1.1.2