/[drupal]/contributions/modules/project_issue_file_review/pifr.admin.inc
ViewVC logotype

Contents of /contributions/modules/project_issue_file_review/pifr.admin.inc

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


Revision 1.10 - (show annotations) (download) (as text)
Fri Oct 9 23:14:42 2009 UTC (7 weeks, 1 day ago) by boombatower
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-7--1
Changes since 1.9: +10 -7 lines
File MIME type: text/x-php
#522858: Abstract review API and re-implement SimpleTest review.
1 <?php
2 // $Id: pifr.admin.inc,v 1.9 2009/08/07 21:04:11 boombatower Exp $
3 /**
4 * @file
5 * Automatically review patches attached to issues.
6 *
7 * Copyright 2008-2009 by Jimmy Berry ("boombatower", http://drupal.org/user/214218)
8 */
9
10 /**
11 * General dashboard form.
12 */
13 function pifr_admin_dashboard_form(&$form_state) {
14 $form = array();
15
16 // Server role.
17 $form['role'] = array(
18 '#type' => 'fieldset',
19 '#title' => t('Role'),
20 '#attributes' => array('class' => 'container-inline'),
21 '#weight' => -10,
22 );
23 $form['role']['client'] = array(
24 '#type' => 'item',
25 '#title' => t('Client'),
26 '#value' => theme('pifr_state', module_exists('pifr_client'), 'warning'),
27 );
28 $form['role']['server'] = array(
29 '#type' => 'item',
30 '#title' => t('Server'),
31 '#value' => theme('pifr_state', module_exists('pifr_server'), 'warning'),
32 );
33
34 // Server status.
35 $form['status'] = array(
36 '#type' => 'fieldset',
37 '#title' => t('Status'),
38 '#attributes' => array('class' => 'container-inline'),
39 '#weight' => -9,
40 );
41 $form['status']['state'] = array(
42 '#type' => 'item',
43 '#title' => t('State'),
44 '#value' => theme('pifr_state', PIFR_ACTIVE),
45 );
46 $form['status']['toggle_state'] = array(
47 '#type' => 'submit',
48 '#value' => t('Toggle state'),
49 '#submit' => array('pifr_admin_dashboard_form_toggle_submit'),
50 '#weight' => 1000,
51 );
52
53 $form['cron'] = array(
54 '#type' => 'fieldset',
55 '#title' => t('Cron'),
56 '#description' => t(''),
57 '#attributes' => array('class' => 'container-inline'),
58 '#weight' => -8,
59 );
60 $form['cron']['last'] = array(
61 '#type' => 'item',
62 '#title' => t('Last run'),
63 '#value' => t('!time ago', array('!time' => format_interval(time() - variable_get('cron_last', NULL)))),
64 );
65 $form['cron']['run'] = array(
66 '#type' => 'markup',
67 '#value' => l('(' . t('run cron') . ')', 'admin/reports/status/run-cron', array('query' => 'destination=admin/pifr')),
68 );
69
70 return $form;
71 }
72
73 /**
74 * Toggle active variable.
75 */
76 function pifr_admin_dashboard_form_toggle_submit($form, &$form_state) {
77 variable_set('pifr_active', !PIFR_ACTIVE);
78 }
79
80 /**
81 * Theme state value.
82 *
83 * @param boolean $enabled Enabled.
84 * @param string $severity Severity of state if disabled: warning or error.
85 * @return string HTML output.
86 */
87 function theme_pifr_state($enabled, $severity = 'error') { // TODO Decide.
88 // drupal_add_css(drupal_get_path('module', 'pifr') . '/pifr.css');
89 if ($enabled) {
90 return t('enabled') . '<br />';
91 // return '<div class="pifr-ok">' . t('enabled') . '</div>';
92 // return t('enabled !image', array('!image' => theme('image', 'misc/watchdog-ok.png')));
93 }
94 return t('disabled') . '<br />';
95 // return '<div class="pifr-' . $severity . '">' . t('disabled') . '</div>';
96 // return t('disabled !image', array('!image' => theme('image', 'misc/watchdog-' . $severity . '.png')));
97 }
98
99 /**
100 * General configuration form.
101 */
102 function pifr_admin_configuration_form(&$form_state) {
103 $form = array();
104
105 $form['general'] = array(
106 '#type' => 'fieldset',
107 '#title' => t('General'),
108 '#weight' => -10
109 );
110 $form['general']['pifr_debug'] = array(
111 '#type' => 'checkbox',
112 '#title' => t('Debug'),
113 '#description' => t('Control the output of detailed debug information to the watchdog log.' .
114 '<b>When used on client, only the BlockTestCase will be run. Ensure that this is disabled before finalizing a client.</b>'),
115 '#default_value' => PIFR_DEBUG,
116 );
117
118 return system_settings_form($form);
119 }

  ViewVC Help
Powered by ViewVC 1.1.2