Subversion Repositories cms

Rev

Rev 14 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pisoni 1
%# =============================================  Start of Embedded Components ===========================
2
%#
3
%#  -----------------------------------------------------------------------------------------------------
4
%#  - _label component return a TD with the traduction of a field, call a component that have some fields defined
5
<%def _label>
6
<td colspan="1" class="InputLabel"><% $m->comp('.thead.columnSettings', curfield => $field, cursetting => 'traduction') %></td>
7
<%args>
8
  $field
9
</%args>
10
</%def>
11
%#  -----------------------------------------------------------------------------------------------------
12
%#  - _input component return input object, if is a check return a hidden with some information on the name attribute
13
<%def _input>
14
<%perl>
15
# ==========================================================================================================
16
# This object creates a hidden input field to send the information of the check input field clicked
17
# In the hidden field, the name gives the information of the switch (On-Off) and the behaviour(Match-Assign)
18
# The value of the hidden is always the value4check (that initialize the value of the check)
19
# property name of the input field is: FL.fieldname[:ID.id][:TY.typefield[:AC.actionfield]][:TB.tablename]
20
# =========================================================================================================
21
  if($param{'type'} eq 'checkbox'){
22
    my $fieldname;
23
    if($param{'behaviour'} eq 'match'){
24
      $fieldname = "FL.$param{'dbfield'}:ID.$param{'id'}:TY._CHECK_MATCH";
25
    }elsif($param{'behaviour'} eq 'assign'){
26
      $fieldname = "FL.$param{'dbfield'}:ID.$param{'id'}:TY._CHECK";
27
    }else{
28
      writeMsg("undef function for behaviour:$param{'behaviour'}", 'class.html');
29
    }
30
    my $check = '';
31
    if($param{'value'} =~ /$param{'value4check'}/){
32
      $check = 'CHECKED';
33
      $fieldname .= ':AC.OFF';
34
    }else{
35
      $check = '';
36
      $fieldname .= ':AC.ON';
37
    }
38
    my $onclick = "checksubmit(this, '$fieldname')";
39
</%perl>
40
     <input type="checkbox" id="CKECK_<% $param{'id'} %>" class="" onClick="<% $onclick %>" <% $check %> ><% $param{'label'} %>
41
     <input type="hidden" id="<% $fieldname %>" value="<% $param{'value4check'} %>"  >
42
%  }else{
43
%    writeMsg("undef function for type:$param{'type'}", 'class.html');
44
%  }
45
<%args>
46
  %param
47
</%args>
48
</%def>
49
%# =============================================  End of Embedded Components ===========================
50
%#
51
%#
52
%#
53
%# =============================================  Start of HTML page ===================================
54
<script language="JavaScript">
55
function checksubmit(cb, idname)
56
{
57
  var re = /ID\.<% $hashChecks{'fm'}{'id'} %>/;
58
<% $hashChecks{'fm'}{'id'} %>  if(re.test(idname)){
59
<% $hashChecks{'fm'}{'id'} %>    var objclass = document.getElementById("CKECK_<% $hashChecks{'class'}{'id'} %>");
60
<% $hashChecks{'fm'}{'id'} %>    if(!objclass.checked){
61
<% $hashChecks{'fm'}{'id'} %>      alert("<% $hashDescription{'alertfm'} %>");
62
<% $hashChecks{'fm'}{'id'} %>      cb.checked = false;
63
<% $hashChecks{'fm'}{'id'} %>      return;
64
<% $hashChecks{'fm'}{'id'} %>    }
65
<% $hashChecks{'fm'}{'id'} %>  }
66
<% $hashChecks{'fm'}{'id'} %>  re = /_CHECK/;
67
<% $hashChecks{'fm'}{'id'} %>  if(re.test(idname)){
68
<% $hashChecks{'fm'}{'id'} %>    cb.disabled=true;
69
<% $hashChecks{'fm'}{'id'} %>  }
70
<% $hashChecks{'fm'}{'id'} %>  var obj = document.getElementById(idname);
71
<% $hashChecks{'fm'}{'id'} %>  obj.name = idname;
72
<% $hashChecks{'fm'}{'id'} %>  form1.submit();
73
<% $hashChecks{'fm'}{'id'} %>}
74
<% $hashChecks{'fm'}{'id'} %></script>
75
<% $hashChecks{'fm'}{'id'} %><form name="form1" action="class.html?wh=<% $classid %>" method="post">
76
<% $hashChecks{'fm'}{'id'} %><table cellspacing="0" cellpadding="2" border="0" width="100%">
77
<% $hashChecks{'fm'}{'id'} %> <thead class="tablepeople">
78
<% $hashChecks{'fm'}{'id'} %>	<td colspan="2"><% $hashDescription{'tableTitle'} %></td>
79
<% $hashChecks{'fm'}{'id'} %> </thead>
80
<% $hashChecks{'fm'}{'id'} %> <tbody>
81
<% $hashChecks{'fm'}{'id'} %>  <tr>
82
<% $hashChecks{'fm'}{'id'} %>   <td colspan="*">&nbsp;</td>
83
<% $hashChecks{'fm'}{'id'} %>  </tr>
84
<% $hashChecks{'fm'}{'id'} %>  <tr>
85
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="*"><% $hashDescription{'class'} %></td>
86
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="1"><% $m->comp('_input', param => $hashChecks{'class'}) %></td>
87
<% $hashChecks{'fm'}{'id'} %>  </tr>
88
<% $hashChecks{'fm'}{'id'} %>  <tr>
89
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="*"><% $hashDescription{'share'} %></td>
90
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="1"><% $m->comp('_input', param => $hashChecks{'share'}) %></td>
91
<% $hashChecks{'fm'}{'id'} %>  </tr>
92
<% $hashChecks{'fm'}{'id'} %>% if($permision =~ /[[class_permision_YI]]/){
93
<% $hashChecks{'fm'}{'id'} %>% if($teacherpermision =~ /[[usr_permision_WW]]/){    ### added 030203
94
<% $hashChecks{'fm'}{'id'} %>  <tr>
95
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="*"><% $hashDescription{'web'} %></td>
96
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="1"><% $m->comp('_input', param => $hashChecks{'web'}) %></td>
97
<% $hashChecks{'fm'}{'id'} %>  </tr>
98
<% $hashChecks{'fm'}{'id'} %>  <tr>
99
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="*"><% $hashDescription{'fm'} %></td>
100
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="1"><% $m->comp('_input', param => $hashChecks{'fm'}) %></td>
101
<% $hashChecks{'fm'}{'id'} %>  </tr>
102
<% $hashChecks{'fm'}{'id'} %>% }   ### added 030203
103
<% $hashChecks{'fm'}{'id'} %>% }
104
<% $hashChecks{'fm'}{'id'} %>  <tr>
105
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="*"><% $hashDescription{'simulimp'} %></td>
106
<% $hashChecks{'fm'}{'id'} %>%  if($status eq '[[class_status_active]]'){		### added 030206
107
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="10%" >
108
<% $hashChecks{'fm'}{'id'} %>%    if($simulvalue eq ''){ $simulvalue= '[[FM_controlclass_simulNessuna_IT]]';}
109
<% $hashChecks{'fm'}{'id'} %>		<% $simulvalue %>
110
<% $hashChecks{'fm'}{'id'} %>  </td>
111
<% $hashChecks{'fm'}{'id'} %>%  }else{
112
<% $hashChecks{'fm'}{'id'} %>	<td class=tablepeople width="10%">
113
<% $hashChecks{'fm'}{'id'} %>%    my $fieldname = "FL.$simulfield:TY._SELECT";
114
<% $hashChecks{'fm'}{'id'} %>     <select id="<% $fieldname %>" class="InputText" <% $simulvalue %> onChange="checksubmit(this, '<% $fieldname %>')">
115
<% $hashChecks{'fm'}{'id'} %>        <option <%($simulvalue eq '') ? 'SELECTED':'' %> value="" >[[FM_controlclass_simulNessuna_IT]]
116
<% $hashChecks{'fm'}{'id'} %>%     foreach my $curitem (@$classroom_ref){
117
<% $hashChecks{'fm'}{'id'} %>        <option <%($simulvalue eq $curitem->[0]) ? 'SELECTED':'' %> value="<% $curitem->[0] %>" ><% $curitem->[0] %>
118
<% $hashChecks{'fm'}{'id'} %>%     }
119
<% $hashChecks{'fm'}{'id'} %>  </td>
120
<% $hashChecks{'fm'}{'id'} %>%  }
121
<% $hashChecks{'fm'}{'id'} %>  </tr>
122
<% $hashChecks{'fm'}{'id'} %> </tbody>
123
<% $hashChecks{'fm'}{'id'} %></table>
124
<% $hashChecks{'fm'}{'id'} %></form>
125
<% $hashChecks{'fm'}{'id'} %>%# =============================================  End of HTML page ===================================
126
<% $hashChecks{'fm'}{'id'} %><%method title>
127
<% $hashChecks{'fm'}{'id'} %>  [[FM_controlclass_windowTitle_IT]]
128
<% $hashChecks{'fm'}{'id'} %></%method>
129
<% $hashChecks{'fm'}{'id'} %><%args>
130
<% $hashChecks{'fm'}{'id'} %>  $wh
131
<% $hashChecks{'fm'}{'id'} %></%args>
132
<% $hashChecks{'fm'}{'id'} %><%init>
133
<% $hashChecks{'fm'}{'id'} %>  my $classid = $wh;
134
<% $hashChecks{'fm'}{'id'} %>  my ($curfunc,$dbgerror,$dbginfo,$message)  = ('class', ' 1:', ' 30:', '');
135
 
136
<% $hashChecks{'fm'}{'id'} %>  my $simulfield = '[[TB_class_SqlAs_classroompersistent]]';
137
<% $hashChecks{'fm'}{'id'} %>#use Data::Dumper;
138
<% $hashChecks{'fm'}{'id'} %>#$m->out(Dumper(%ARGS)); #$m->out("\n"); #$m->out(%ENV); #$m->out("\n");
139
 
140
 
141
<% $hashChecks{'fm'}{'id'} %># ============================================== Process Request POST ====================== 
142
<% $hashChecks{'fm'}{'id'} %>  my $ret;
143
<% $hashChecks{'fm'}{'id'} %>  if($ENV{'REQUEST_METHOD'} eq 'POST'){
144
 
145
 
146
<% $hashChecks{'fm'}{'id'} %>#   put all the info of the check in a hash ==============
147
<% $hashChecks{'fm'}{'id'} %>    my $keyfield = processPOST('update', \%ARGS);
148
<% $hashChecks{'fm'}{'id'} %>#$m->out("keyfield:$keyfield:");
149
<% $hashChecks{'fm'}{'id'} %>    my $keyvalue = $ARGS{$keyfield};
150
<% $hashChecks{'fm'}{'id'} %>    my @arrField = split /:/, $keyfield;
151
<% $hashChecks{'fm'}{'id'} %>    my %hashField;
152
<% $hashChecks{'fm'}{'id'} %>    my ($tmp1, $tmp2);
153
<% $hashChecks{'fm'}{'id'} %>    foreach my $curitem (@arrField) { 
154
<% $hashChecks{'fm'}{'id'} %>      ($tmp1, $tmp2) = split /\./, $curitem;
155
<% $hashChecks{'fm'}{'id'} %>      $hashField{$tmp1} = $tmp2;
156
<% $hashChecks{'fm'}{'id'} %>    } 
157
 
158
<% $hashChecks{'fm'}{'id'} %>#   Process the check regarding its ID ==============
159
<% $hashChecks{'fm'}{'id'} %>    if($hashField{'TY'} =~ /_CHECK_MATCH/ ){   ### we have to modify a part of the field of the record
160
 
161
<% $hashChecks{'fm'}{'id'} %>      if($hashField{'ID'} eq 'share'){   #-------------------------------------------------------------
162
<% $hashChecks{'fm'}{'id'} %>        my $cms_action = ($hashField{'AC'} =~ /ON/) ? 'enableshare':'disableshare';
163
<% $hashChecks{'fm'}{'id'} %>        writeMsg("$hashField{'ID'} = $hashField{'AC'}", $dbginfo . $curfunc);
164
<% $hashChecks{'fm'}{'id'} %>        modifyFieldData('class', $hashField{'FL'}, 'where id=?', $classid, $hashField{'AC'}, $keyvalue);
165
<% $hashChecks{'fm'}{'id'} %>        checkExec($curfunc, "su1 cms_command $cms_action $classid");
166
 
167
<% $hashChecks{'fm'}{'id'} %>      }elsif($hashField{'ID'} eq 'web'){  #-------------------------------------------------------------
168
<% $hashChecks{'fm'}{'id'} %>        my $listusr = ($hashField{'AC'} =~ /ON/) ? getStudentOfClass($classid, '4web'):'';
169
<% $hashChecks{'fm'}{'id'} %>        writeMsg("$hashField{'ID'} = $hashField{'AC'}", $dbginfo . $curfunc);
170
<% $hashChecks{'fm'}{'id'} %>        modifyFieldData('class', $hashField{'FL'}, 'where id=?', $classid, $hashField{'AC'}, $keyvalue);
171
<% $hashChecks{'fm'}{'id'} %>#        if($listusr){
172
<% $hashChecks{'fm'}{'id'} %>          $ret = updateField('keys', "id=nextval('keys_id'), value=?", 'where key=?', "Class_$classid", $listusr);
173
<% $hashChecks{'fm'}{'id'} %>          if($ret){
174
<% $hashChecks{'fm'}{'id'} %>            checkExec($curfunc, "su1 HUP_squid_redirect");
175
<% $hashChecks{'fm'}{'id'} %>          }
176
<% $hashChecks{'fm'}{'id'} %>#        }
177
 
178
<% $hashChecks{'fm'}{'id'} %>      }elsif($hashField{'ID'} eq 'fm'){   #-------------------------------------------------------------
179
<% $hashChecks{'fm'}{'id'} %>        writeMsg("$hashField{'ID'} = $hashField{'AC'}", $dbginfo . $curfunc);
180
<% $hashChecks{'fm'}{'id'} %>        my $dbh = getDbConnect(1,1);
181
<% $hashChecks{'fm'}{'id'} %>        my ($sitefm, $status, $keyfm);
182
<% $hashChecks{'fm'}{'id'} %>        if($hashField{'AC'} =~ /ON/){
183
<% $hashChecks{'fm'}{'id'} %>          $sitefm = getField('class', 'sitefm', 'where id=?', $classid);
184
<% $hashChecks{'fm'}{'id'} %>          $status = '[[class_status_active]]';
185
<% $hashChecks{'fm'}{'id'} %>        }else{
186
<% $hashChecks{'fm'}{'id'} %>          $sitefm = '';
187
<% $hashChecks{'fm'}{'id'} %>          $status = '[[class_status_suspend]]';
188
<% $hashChecks{'fm'}{'id'} %>          ### saveFM($classid);  #set sitefm field = FM_$classid KEYS field
189
<% $hashChecks{'fm'}{'id'} %>            $keyfm = getField('keys', 'value', 'where key=?', "FM_$classid");
190
<% $hashChecks{'fm'}{'id'} %>            if(!$keyfm){
191
<% $hashChecks{'fm'}{'id'} %>              writeMsg("FM_$classid field from keys return :$keyfm:", $dbginfo . $curfunc);
192
<% $hashChecks{'fm'}{'id'} %>            }
193
<% $hashChecks{'fm'}{'id'} %>        }
194
<% $hashChecks{'fm'}{'id'} %>        $dbh->begin_work or writeMsg("Error:$hashField{'ID'}, cant begin_work", $dbgerror . $curfunc);
195
<% $hashChecks{'fm'}{'id'} %>        eval{
196
<% $hashChecks{'fm'}{'id'} %>          if($hashField{'AC'} !~ /ON/){
197
<% $hashChecks{'fm'}{'id'} %>            _updateField($dbh, 'class', 'sitefm=?', 'where id=?', $classid, $keyfm) or die;
198
<% $hashChecks{'fm'}{'id'} %>          }
199
<% $hashChecks{'fm'}{'id'} %>          _updateField($dbh, 'keys', "id=nextval('keys_id'), value=?", 'where key=?', "FM_$classid", $sitefm) or die;
200
<% $hashChecks{'fm'}{'id'} %>          _modifyFieldData($dbh, 'class', $hashField{'FL'}, 'where id=?', $classid, $hashField{'AC'}, $keyvalue) or die;
201
 
202
<% $hashChecks{'fm'}{'id'} %>          # =================== add or delete 'FM' on ClassList keys tag, depending of $status
203
<% $hashChecks{'fm'}{'id'} %>          _modifyFieldData($dbh, 'keys','value','where key=?',"ClassList",'updateClassFlag',"$classid:$status:FM:_BLANK_:_BLANK_") or die;  ###030128   
204
<% $hashChecks{'fm'}{'id'} %>        };
205
<% $hashChecks{'fm'}{'id'} %>        if($@){
206
<% $hashChecks{'fm'}{'id'} %>          $dbh->rollback or writeMsg("cant rollback".$dbh->errstr, $dbgerror . $curfunc);
207
<% $hashChecks{'fm'}{'id'} %>          writeMsg("rollback because error in eval; ".$@.$dbh->errstr, $dbginfo . $curfunc);
208
<% $hashChecks{'fm'}{'id'} %>        }else{
209
<% $hashChecks{'fm'}{'id'} %>          if(! $dbh->commit){
210
<% $hashChecks{'fm'}{'id'} %>            writeMsg("error commit".$@.$dbh->errstr, $dbgerror . $curfunc);
211
<% $hashChecks{'fm'}{'id'} %>          }else{
212
<% $hashChecks{'fm'}{'id'} %>            checkExec($curfunc, "su1 HUP_squid_redirect");
213
<% $hashChecks{'fm'}{'id'} %>          }
214
<% $hashChecks{'fm'}{'id'} %>        }
215
 
216
 
217
<% $hashChecks{'fm'}{'id'} %>      }else{
218
<% $hashChecks{'fm'}{'id'} %>        writeMsg("Error:rich case default on $hashField{'ID'}", $dbgerror . $curfunc);
219
<% $hashChecks{'fm'}{'id'} %>      }
220
 
221
 
222
<% $hashChecks{'fm'}{'id'} %>    }elsif($hashField{'TY'} =~ /_CHECK/){
223
<% $hashChecks{'fm'}{'id'} %>#     we have to assign the field of the record
224
<% $hashChecks{'fm'}{'id'} %>      if($hashField{'ID'} eq 'class'){   #------------------------------------------------------------- 
225
<% $hashChecks{'fm'}{'id'} %>        my $remoteIp= '';
226
<% $hashChecks{'fm'}{'id'} %>        my $cmd_action;
227
<% $hashChecks{'fm'}{'id'} %>        my $rooms = '';
228
<% $hashChecks{'fm'}{'id'} %>        writeMsg("$hashField{'ID'} = $hashField{'AC'}", $dbginfo . $curfunc);
229
<% $hashChecks{'fm'}{'id'} %>        my $dbh = getDbConnect(1,1);
230
<% $hashChecks{'fm'}{'id'} %>        my $listusr4share = _getStudentOfClass($dbh, $classid, '4share');
231
<% $hashChecks{'fm'}{'id'} %>        my $classpermision = _getField($dbh, 'class', 'permision', 'where id=?', $classid);
232
 
233
<% $hashChecks{'fm'}{'id'} %>        if ($hashField{'AC'} =~ /ON/){
234
<% $hashChecks{'fm'}{'id'} %>          if(%ENV->{'HTTP_X_FORWARDED_FOR'}){
235
<% $hashChecks{'fm'}{'id'} %>            $remoteIp= %ENV->{'HTTP_X_FORWARDED_FOR'};
236
<% $hashChecks{'fm'}{'id'} %>          }else{
237
<% $hashChecks{'fm'}{'id'} %>            $remoteIp= %ENV->{'REMOTE_ADDR'};
238
<% $hashChecks{'fm'}{'id'} %>          }
239
<% $hashChecks{'fm'}{'id'} %>          $cmd_action = 'enableclass';
240
 
18 gdo 241
<% $hashChecks{'fm'}{'id'} %>       		my $curaula  = _getField($dbh, 'classlayout', 'id', 'where pcip=?', $remoteIp);					###030128
242
<% $hashChecks{'fm'}{'id'} %>          my $classpersis = _getField($dbh, 'class', 'classroompersistent', 'where id=?', $classid); ###030128
243
<% $hashChecks{'fm'}{'id'} %>				  $rooms = "-room $curaula";
244
<% $hashChecks{'fm'}{'id'} %>					$rooms .= ($classpersis) ? ' -room ' . $classpersis : '';
245
 
14 pisoni 246
<% $hashChecks{'fm'}{'id'} %>          if($classpermision =~ m/[[class_permision_YI]]/ ){
247
<% $hashChecks{'fm'}{'id'} %>            my $listusr4web = '';
248
<% $hashChecks{'fm'}{'id'} %>            if($classpermision =~ m/[[usr_permision_WW]]/){
249
<% $hashChecks{'fm'}{'id'} %>              $listusr4web = _getStudentOfClass($dbh, $classid, '4web');
250
<% $hashChecks{'fm'}{'id'} %>            }
251
<% $hashChecks{'fm'}{'id'} %>            my $teacherid = _getUsrConnectInfo($dbh, 'usrid');
252
<% $hashChecks{'fm'}{'id'} %>            my $sitefm   = _getField($dbh, 'class', 'sitefm', 'where id=?', $classid);
253
<% $hashChecks{'fm'}{'id'} %>            my $siteok   = _getField($dbh, 'class', 'siteok', 'where id=?', $classid);
254
<% $hashChecks{'fm'}{'id'} %>            my $sitebad  = _getField($dbh, 'class', 'sitebad', 'where id=?', $classid);
255
<% $hashChecks{'fm'}{'id'} %>            $keyvalue = '[[class_status_active]]';
256
 
257
<% $hashChecks{'fm'}{'id'} %>#           ###--- insertIntoKeys($classid, $teacherid);   #new KEYS records: ClassList,Class,OkAuth,NoAuth,FM ---
258
<% $hashChecks{'fm'}{'id'} %>            $dbh->begin_work or writeMsg("Error:$hashField{'ID'}, cant begin_work", $dbgerror . $curfunc);
259
<% $hashChecks{'fm'}{'id'} %>            eval{
260
<% $hashChecks{'fm'}{'id'} %>              _modifyFieldData($dbh, 'keys', 'value', 'where key=?', 'ClassList', 'insertClass', "$classid:$teacherid:_BLANK_:$curaula:$classpersis");	###030128
261
<% $hashChecks{'fm'}{'id'} %>              _insertRecord($dbh, 'keys', "(id,key,value) values (nextval('keys_id'), 'Class_$classid',  '$listusr4web')");
262
<% $hashChecks{'fm'}{'id'} %>              _insertRecord($dbh, 'keys', "(id,key,value) values (nextval('keys_id'), 'FM_$classid',     '$sitefm')");
263
<% $hashChecks{'fm'}{'id'} %>              _insertRecord($dbh, 'keys', "(id,key,value) values (nextval('keys_id'), 'OkAuth_$classid', '$siteok')");
264
<% $hashChecks{'fm'}{'id'} %>              _insertRecord($dbh, 'keys', "(id,key,value) values (nextval('keys_id'), 'NoAuth_$classid', '$sitebad')");
265
<% $hashChecks{'fm'}{'id'} %>              _updateField($dbh, 'class', "status='$keyvalue', ipteacher=?", 'where id=?', $classid, $remoteIp);
266
<% $hashChecks{'fm'}{'id'} %>            };
267
<% $hashChecks{'fm'}{'id'} %>          }else{
268
<% $hashChecks{'fm'}{'id'} %>#           ------ Only Allow login and Shares resouces -------
269
<% $hashChecks{'fm'}{'id'} %>            $dbh->begin_work or writeMsg("Error:$hashField{'ID'}, cant begin_work", $dbgerror . $curfunc);
270
<% $hashChecks{'fm'}{'id'} %>            _updateField($dbh, 'class', "status='$keyvalue', ipteacher=?", 'where id=?', $classid, $remoteIp);
271
<% $hashChecks{'fm'}{'id'} %>          }
272
 
273
 
274
<% $hashChecks{'fm'}{'id'} %>        }else{
275
<% $hashChecks{'fm'}{'id'} %>          my $keyfm = getField('keys', 'value', 'where key=?', "FM_$classid");
276
<% $hashChecks{'fm'}{'id'} %>			 if($keyfm eq undef){ $keyfm = ' '; }
277
<% $hashChecks{'fm'}{'id'} %>          $cmd_action = 'disableclass';
278
<% $hashChecks{'fm'}{'id'} %>          $keyvalue = '[[class_status_suspend]]';
279
 
280
<% $hashChecks{'fm'}{'id'} %>          $dbh->begin_work or writeMsg("Error:$hashField{'ID'}, cant begin_work", $dbgerror . $curfunc);
281
<% $hashChecks{'fm'}{'id'} %>          if($classpermision =~ m/[[class_permision_YI]]/ ){
282
<% $hashChecks{'fm'}{'id'} %>            eval{
283
<% $hashChecks{'fm'}{'id'} %>              _modifyFieldData($dbh, 'keys', 'value', 'where key=?', 'ClassList', 'deleteClass', $classid);
284
<% $hashChecks{'fm'}{'id'} %>              _deleteRecord($dbh, 'keys', 'where key=?', "Class_$classid");
285
<% $hashChecks{'fm'}{'id'} %>              _deleteRecord($dbh, 'keys', 'where key=?', "FM_$classid");
286
<% $hashChecks{'fm'}{'id'} %>              _deleteRecord($dbh, 'keys', 'where key=?', "OkAuth_$classid");
287
<% $hashChecks{'fm'}{'id'} %>              _deleteRecord($dbh, 'keys', 'where key=?', "NoAuth_$classid");
288
<% $hashChecks{'fm'}{'id'} %>              _updateField($dbh, 'class', 'sitefm=?', 'where id=?', $classid, $keyfm);
289
<% $hashChecks{'fm'}{'id'} %>              _updateField($dbh, 'class', "status='$keyvalue', ipteacher=?", 'where id=?', $classid, $remoteIp);
290
<% $hashChecks{'fm'}{'id'} %>            };
291
 
292
<% $hashChecks{'fm'}{'id'} %>          }else{
293
<% $hashChecks{'fm'}{'id'} %>#           ------ Only Allow login and Shares resouces -------
294
<% $hashChecks{'fm'}{'id'} %>            _updateField($dbh, 'class', "status='$keyvalue', ipteacher=?", 'where id=?', $classid, $remoteIp);
295
<% $hashChecks{'fm'}{'id'} %>          }
296
 
297
<% $hashChecks{'fm'}{'id'} %>        }
298
 
299
 
300
 
301
 
302
 
303
<% $hashChecks{'fm'}{'id'} %>        if($@){
304
<% $hashChecks{'fm'}{'id'} %>          $dbh->rollback or writeMsg("cant rollback".$dbh->errstr, $dbgerror . $curfunc);
305
<% $hashChecks{'fm'}{'id'} %>          writeMsg("rollback because error in eval; ".$@.$dbh->errstr, $dbginfo . $curfunc);
306
<% $hashChecks{'fm'}{'id'} %>        }else{
307
<% $hashChecks{'fm'}{'id'} %>          if(! $dbh->commit){
308
<% $hashChecks{'fm'}{'id'} %>            writeMsg("error commit".$@.$dbh->errstr, $dbgerror . $curfunc);
309
<% $hashChecks{'fm'}{'id'} %>          }else{
310
<% $hashChecks{'fm'}{'id'} %>	          checkExec($curfunc, "su1 cms_command $cmd_action $classid $rooms $listusr4share");  ### SambaControlClasss
311
<% $hashChecks{'fm'}{'id'} %>            checkExec($curfunc, "su1 HUP_squid_redirect");
312
<% $hashChecks{'fm'}{'id'} %>          }
313
<% $hashChecks{'fm'}{'id'} %>        }
314
 
315
<% $hashChecks{'fm'}{'id'} %>      }else{
316
<% $hashChecks{'fm'}{'id'} %>        writeMsg("error richt default on keyfield :$keyfield:", $dbgerror . $curfunc);
317
<% $hashChecks{'fm'}{'id'} %>      }
318
 
319
<% $hashChecks{'fm'}{'id'} %>    }elsif($hashField{'TY'} =~ /_SELECT/){
320
<% $hashChecks{'fm'}{'id'} %>#     ===== write the new value for the permanet classroom
321
<% $hashChecks{'fm'}{'id'} %>#      updateField('class', "$simulfield=?", 'where id=?', $classid, $keyvalue);
322
 
323
 
324
<% $hashChecks{'fm'}{'id'} %>###########################################################################################################
325
<% $hashChecks{'fm'}{'id'} %>######### Modif for doing an update on table keys, when the teacher changes the permanent classroom #######
326
<% $hashChecks{'fm'}{'id'} %>## this only can be made if the class is disable, so there is no need to modify keys, so there is a lot of code that can be cancel!!!
327
 
328
<% $hashChecks{'fm'}{'id'} %>			my $dbh = getDbConnect(1,1);
329
<% $hashChecks{'fm'}{'id'} %>			my $teacherid = _getUsrConnectInfo($dbh, 'usrid');
330
<% $hashChecks{'fm'}{'id'} %>			my $remoteIp;
331
<% $hashChecks{'fm'}{'id'} %>			if(%ENV->{'HTTP_X_FORWARDED_FOR'}){
332
<% $hashChecks{'fm'}{'id'} %> 				$remoteIp= %ENV->{'HTTP_X_FORWARDED_FOR'};
333
<% $hashChecks{'fm'}{'id'} %>			}else{
334
<% $hashChecks{'fm'}{'id'} %>				$remoteIp= %ENV->{'REMOTE_ADDR'};
335
<% $hashChecks{'fm'}{'id'} %>			}
336
<% $hashChecks{'fm'}{'id'} %>   		my $curaula  = _getField($dbh, 'classlayout', 'id', 'where pcip=?', $remoteIp);					###030203
337
 
338
<% $hashChecks{'fm'}{'id'} %>			my $classpersis;
339
<% $hashChecks{'fm'}{'id'} %>			$dbh->begin_work or writeMsg("Error:$hashField{'TY'}, cant begin_work", $dbgerror . $curfunc);
340
<% $hashChecks{'fm'}{'id'} %>			if(!$keyvalue){ 
341
<% $hashChecks{'fm'}{'id'} %>				### change the permanent class to no one, so no more free logins for students ###
342
<% $hashChecks{'fm'}{'id'} %>				$classpersis = '_BLANK_';
343
<% $hashChecks{'fm'}{'id'} %>			}else{
344
<% $hashChecks{'fm'}{'id'} %>				### change the permanent class to another one ###
345
<% $hashChecks{'fm'}{'id'} %>				$classpersis = $keyvalue;
346
<% $hashChecks{'fm'}{'id'} %> 			}
347
 
348
<% $hashChecks{'fm'}{'id'} %>			eval{
349
<% $hashChecks{'fm'}{'id'} %>				_updateField($dbh, 'class', "$simulfield=?", 'where id=?', $classid, $keyvalue);
350
<% $hashChecks{'fm'}{'id'} %>#				_modifyFieldData($dbh, 'keys','value','where key=?',"ClassList",'updateClassAula',"$classid:_BLANK_:_BLANK_:$curaula:$classpersis") or die;  
351
 
352
<% $hashChecks{'fm'}{'id'} %>			};
353
 
354
 
355
 
356
<% $hashChecks{'fm'}{'id'} %>			if($@){
357
<% $hashChecks{'fm'}{'id'} %>				$dbh->rollback or writeMsg("cant rollback".$dbh->errstr, $dbgerror . $curfunc);
358
<% $hashChecks{'fm'}{'id'} %>				writeMsg("rollback because error in eval; ".$@.$dbh->errstr, $dbginfo . $curfunc);
359
<% $hashChecks{'fm'}{'id'} %>			}else{
360
<% $hashChecks{'fm'}{'id'} %>				if(! $dbh->commit){
361
<% $hashChecks{'fm'}{'id'} %>					writeMsg("error commit".$@.$dbh->errstr, $dbgerror . $curfunc);
362
<% $hashChecks{'fm'}{'id'} %>				}else{
363
<% $hashChecks{'fm'}{'id'} %>					checkExec($curfunc, "su1 HUP_squid_redirect");
364
<% $hashChecks{'fm'}{'id'} %>				}
365
<% $hashChecks{'fm'}{'id'} %>			}
366
 
367
<% $hashChecks{'fm'}{'id'} %>######### End of  permanent classroom ############################################################
368
 
369
 
370
<% $hashChecks{'fm'}{'id'} %>    }else{
371
<% $hashChecks{'fm'}{'id'} %>      writeMsg("error richt default on keyfield :$keyfield:", $dbgerror . $curfunc);
372
<% $hashChecks{'fm'}{'id'} %>    }
373
 
374
<% $hashChecks{'fm'}{'id'} %>  } #=== End Process POST ===
375
 
376
 
377
<% $hashChecks{'fm'}{'id'} %># ============================================== Process Request GET ====================== 
378
<% $hashChecks{'fm'}{'id'} %>  my $dbh = getDbConnect(1,1);
379
 
380
<% $hashChecks{'fm'}{'id'} %># =========== Get Class Status - active suspend ===================
381
<% $hashChecks{'fm'}{'id'} %>  my $strSQL    = 'select status, permision from class where id=?';
382
<% $hashChecks{'fm'}{'id'} %>  my $sth = $dbh->prepare($strSQL);
383
<% $hashChecks{'fm'}{'id'} %>  $sth->execute($classid);
384
<% $hashChecks{'fm'}{'id'} %>  my ($status, $permision)  = $sth->fetchrow_array;
385
 
386
<% $hashChecks{'fm'}{'id'} %>  my $teacherpermision = _getUsrConnectInfo($dbh, 'permision');   ### added 030203
387
 
388
 
389
<% $hashChecks{'fm'}{'id'} %>  $strSQL = "select distinct id from classlayout";
390
<% $hashChecks{'fm'}{'id'} %>  my $classroom_ref = $dbh->selectall_arrayref($strSQL);
391
 
392
<% $hashChecks{'fm'}{'id'} %>  $strSQL = "select $simulfield from class where id=?";
393
<% $hashChecks{'fm'}{'id'} %>  $sth = $dbh->prepare($strSQL);
394
<% $hashChecks{'fm'}{'id'} %>  $sth->execute($classid);
395
<% $hashChecks{'fm'}{'id'} %>  my ($simulvalue)  = $sth->fetchrow_array;
396
 
397
<% $hashChecks{'fm'}{'id'} %>  my $curvalue   = '';
398
<% $hashChecks{'fm'}{'id'} %>  my $curlabel = '[[class_status_active_IT]]';
399
<% $hashChecks{'fm'}{'id'} %>  my $onclick    = '';
400
<% $hashChecks{'fm'}{'id'} %>  my $check      = '';
401
<% $hashChecks{'fm'}{'id'} %>  my $nameaction = '';
402
 
403
<% $hashChecks{'fm'}{'id'} %>  my %hashDescription = (
404
<% $hashChecks{'fm'}{'id'} %>       tableTitle => "[[FM_controlclass_tableTitle_IT]] $classid",
405
<% $hashChecks{'fm'}{'id'} %>       alertfm    => '[[FM_controlclass_alertfm_IT]]',
406
<% $hashChecks{'fm'}{'id'} %>       class      => '[[FM_controlclass_status_IT]]',
407
<% $hashChecks{'fm'}{'id'} %>       share      => '[[FM_controlclass_share_IT]]',
408
<% $hashChecks{'fm'}{'id'} %>       web        => '[[FM_controlclass_web_IT]]',
409
<% $hashChecks{'fm'}{'id'} %>       fm         => '[[FM_controlclass_fm_IT]]',
410
<% $hashChecks{'fm'}{'id'} %>       simulimp   => '[[FM_controlclass_simulimp_IT]]',
411
<% $hashChecks{'fm'}{'id'} %>     );
412
 
413
 
414
<% $hashChecks{'fm'}{'id'} %>  my %hashChecks = (
415
<% $hashChecks{'fm'}{'id'} %>       class =>{
416
<% $hashChecks{'fm'}{'id'} %>                id          => 'class',
417
<% $hashChecks{'fm'}{'id'} %>                dbfield     => 'status',
418
<% $hashChecks{'fm'}{'id'} %>                value       => "$status",
419
<% $hashChecks{'fm'}{'id'} %>                value4check => '[[class_status_active]]',
420
<% $hashChecks{'fm'}{'id'} %>                label       => "$curlabel",
421
<% $hashChecks{'fm'}{'id'} %>                type        => 'checkbox',
422
<% $hashChecks{'fm'}{'id'} %>                behaviour   => 'assign',
423
<% $hashChecks{'fm'}{'id'} %>       },
424
<% $hashChecks{'fm'}{'id'} %>       share =>{
425
<% $hashChecks{'fm'}{'id'} %>                id          => 'share',
426
<% $hashChecks{'fm'}{'id'} %>                dbfield     => 'permision',
427
<% $hashChecks{'fm'}{'id'} %>                value       => "$permision",
428
<% $hashChecks{'fm'}{'id'} %>                value4check => '[[usr_permision_SH]]',
429
<% $hashChecks{'fm'}{'id'} %>                label       => "$curlabel",
430
<% $hashChecks{'fm'}{'id'} %>                type        => 'checkbox',
431
<% $hashChecks{'fm'}{'id'} %>                behaviour   => 'match',
432
<% $hashChecks{'fm'}{'id'} %>       },
433
<% $hashChecks{'fm'}{'id'} %>       web =>{
434
<% $hashChecks{'fm'}{'id'} %>                id          => 'web',
435
<% $hashChecks{'fm'}{'id'} %>                dbfield     => 'permision',
436
<% $hashChecks{'fm'}{'id'} %>                value       => "$permision",
437
<% $hashChecks{'fm'}{'id'} %>                value4check => '[[usr_permision_WW]]',
438
<% $hashChecks{'fm'}{'id'} %>                label       => "$curlabel",
439
<% $hashChecks{'fm'}{'id'} %>                type        => 'checkbox',
440
<% $hashChecks{'fm'}{'id'} %>                behaviour   => 'match',
441
<% $hashChecks{'fm'}{'id'} %>       },
442
<% $hashChecks{'fm'}{'id'} %>       fm =>{
443
<% $hashChecks{'fm'}{'id'} %>                id          => 'fm',
444
<% $hashChecks{'fm'}{'id'} %>                dbfield     => 'permision',
445
<% $hashChecks{'fm'}{'id'} %>                value       => "$permision",
446
<% $hashChecks{'fm'}{'id'} %>                value4check => 'fm',
447
<% $hashChecks{'fm'}{'id'} %>                label       => "$curlabel",
448
<% $hashChecks{'fm'}{'id'} %>                type        => 'checkbox',
449
<% $hashChecks{'fm'}{'id'} %>                behaviour   => 'match',
450
<% $hashChecks{'fm'}{'id'} %>       },
451
<% $hashChecks{'fm'}{'id'} %>     );
452
 
453
<% $hashChecks{'fm'}{'id'} %></%init>