public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
commit  5ff950061372f6d3c32f24674eed223a0bdff9f0
tree    c306865e8d5d7b7a05696d2d643155592c1e4db5
parent  1d4e393fe0cae8142711a915f87157611a76f101
cmsmadesimple-2-0 / admin / eventhandlers.php
100644 195 lines (173 sloc) 5.745 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php
#CMS - CMS Made Simple
#(c)2004-2008 by Ted Kulp (ted@cmsmadesimple.org)
#This project's homepage is: http://cmsmadesimple.sf.net
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#$Id: listtags.php 2772 2006-05-17 02:25:27Z wishy $
 
$CMS_ADMIN_PAGE=1;
$CMS_LOAD_ALL_PLUGINS=1;
 
require_once("../include.php");
 
// function eventhandler_usertag_dropdown( $name, $selitem, $usertags )
// {
// $text = '<select name="'.$name.'">';
// foreach( $usertags as $key => $value )
// {
// $text .= '<option value="'.$value.'"';
// if( $selitem == $value )
//   {
//    $text .= ' selected="selected"';
//   }
// $text .= '>'.$key;
// $text .= '</option>';
// }
// $text .= '</select>';
// return $text;
// }
 
$userid = get_userid();
$access = check_permission($userid, "Modify Events");
 
check_login();
 
// here we'll handle setting $action based on _POST['action']
$action = "";
$module = "";
$event = "";
$modulefilter = '';
if( isset( $_GET['action'] ) && $_GET['action'] != '' )
  {
    $action = $_GET['action'];
  }
if( isset( $_GET['module'] ) && $_GET['module'] != '' )
  {
    $module = $_GET['module'];
  }
if( isset( $_GET['event'] ) && $_GET['event'] != '' )
  {
    $event = $_GET['event'];
  }
if( isset( $_GET['modulefilter'] ) && $_GET['modulefilter'] != '' )
  {
    $modulefilter = $_GET['modulefilter'];
  }
 
// display the page
include_once("header.php");
 
$editImg = $themeObject->display_image('icons/system/edit.gif', lang('edit'),'','','systemicon');
$infoImg = $themeObject->display_image('icons/system/info.gif', lang('help'),'','','systemicon');
 
echo '<div class="pagecontainer">';
echo '<div class="pageoverflow">';
echo $themeObject->show_header('eventhandlers');
 
switch( $action )
{
  case 'showeventhelp':
  {
    if ($module == 'Core')
      $text = CmsEvents::GetEventHelp($event);
    else
      $text = $gCms->modules[$module]['object']->GetEventHelp( $event );
    echo "<h3>$event</h3>";
    if( $text == "" )
    {
      echo "No text returned";
    }
    else
    {
      echo $text;
    }
    break;
  }
 
  default:
  {
    $events = CmsEventOperations::list_events();
 
    echo '<br /><p><form action="eventhandlers.php" method="get">'.lang('filterbymodule').': <select name="modulefilter">' . "\n";
    echo '<option value="">'.lang('showall').'</option>';
    $modlist = array();
    if( is_array($events) )
    {
      foreach( $events as $oneevent )
      {
        if (!in_array($oneevent['module_name'], $modlist))
          $modlist[] = $oneevent['module_name'];
      }
    }
    if (count($modlist) > 0)
    {
      foreach($modlist as $onemod)
      {
        echo '<option value="'.$onemod.'"';
        if ($onemod == $modulefilter)
          echo ' selected="selected"';
        echo '>'.$onemod.'</option>';
      }
    }
    echo "</select> <input type=\"submit\" value=\"".lang('submit')."\" /></form></p>\n\n";
 
    echo "<table cellspacing=\"0\" class=\"pagetable\">\n";
    echo "<thead>\n";
    echo " <tr>\n";
    echo " <th>".lang('originator')."</th>\n";
    echo " <th>".lang('event')."</th>\n";
    echo " <th width='50%'>".lang('description')."</th>\n";
    echo " <th class=\"pageicon\">&nbsp;</th>\n";
    echo " <th class=\"pageicon\">&nbsp;</th>\n";
    echo " </tr>\n";
    echo "</thead>\n";
    echo "<tbody>\n";
 
    if( is_array($events) )
    {
      $curclass = 'row1';
      foreach( $events as $oneevent )
      {
        if ($modulefilter == '' || $modulefilter == $oneevent['module_name'])
        {
          echo "<tr class=\"".$curclass."\" onmouseover=\"this.className='".$curclass.'hover'."';\" onmouseout=\"this.className='".$curclass."';\">\n";
 
          $desctext = '';
          if ($oneevent['module_name'] == 'Core') {
            $desctext = CmsEventOperations::get_event_description($oneevent['event_name']);
            echo " <td>".lang('core')."</td>\n";
          }
          else if (isset($gCms->modules[$oneevent['module_name']])) {
            $objinstance =& $gCms->modules[$oneevent['module_name']]['object'];
            $desctext = $objinstance->get_event_description($oneevent['event_name']);
            echo " <td>".$objinstance->get_friendly_name()."</td>\n";
          }
          echo " <td>";
if ($access)
{
          echo "<a href=\"editevent.php?action=edit&amp;module=".$oneevent['module_name']."&amp;event=".$oneevent['event_name']."\">";
}
          echo $oneevent['event_name'];
if ($access)
{
          echo "</a>";
}
          echo "</td>\n";
          echo " <td>".$desctext."</td>\n";
          echo " <td class=\"icons_wide\"><a href=\"eventhandlers.php?action=showeventhelp&amp;module=".$oneevent['module_name']."&amp;event=".$oneevent['event_name']."\">".$infoImg."</a></td>\n";
if ($access)
{
          echo " <td class=\"icons_wide\"><a href=\"editevent.php?action=edit&amp;module=".$oneevent['module_name']."&amp;event=".$oneevent['event_name']."\">".$editImg."</a></td>\n";
}
          echo " </tr>\n";
          ($curclass=="row1"?$curclass="row2":$curclass="row1");
        }
      }
    }
 
    echo "</tbody>\n";
    echo "</table>\n";
  } // default action
 
} // switch
 
 
echo "<p class=\"pageback\"><a class=\"pageback\" href=\"".$themeObject->back_url()."\">&#171; ".lang('back')."</a></p>\n";
 
echo "</div>\n";
echo "</div>\n";
 
include_once("footer.php");
 
?>