/trunk/html/FR_admin/FM_student/.sql.columnCondition |
---|
1,0 → 0,0 |
% return('[[TB_usr_SqlAs_id]]'); |
% return('[[TB_t_strade_SqlAs_id]]'); |
/trunk/html/FR_admin/FM_student/.thead.columnSettings |
---|
1,89 → 1,165 |
<%perl> |
if($curfield eq '[[TB_usr_SqlAs_id]]') { |
$rettraduction = '[[TB_usr_SqlAs_id_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_id]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_id_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_name]]') { |
$rettraduction = '[[TB_usr_SqlAs_name_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_cod_servizio]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_cod_servizio_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '35'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_cognome]]') { |
$rettraduction = '[[TB_usr_SqlAs_cognome_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_denominazione]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_denominazione_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '35'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_tel]]') { |
$rettraduction = '[[TB_usr_SqlAs_tel_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_tipo]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_tipo_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '20'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_tel2]]') { |
$rettraduction = '[[TB_usr_SqlAs_tel2_IT]]'; |
$retmaxlen = '20'; |
if($curfield eq '[[TB_t_strade_SqlAs_lunghezza]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_lunghezza_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_creation]]') { |
$rettraduction = '[[TB_usr_SqlAs_creation_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_nstrada]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_nstrada_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_profile]]') { |
$rettraduction = '[[TB_usr_SqlAs_profile_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_progressiva_i]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_progressiva_i_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '20'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_password]]') { |
$rettraduction = '[[TB_usr_SqlAs_password_IT]]'; |
$retmaxlen = '8'; |
} |
if($curfield eq '[[TB_usr_SqlAs_zip]]') { |
$rettraduction = '[[TB_usr_SqlAs_zip_IT]]'; |
$retmaxlen = '5'; |
if($curfield eq '[[TB_t_strade_SqlAs_localita_i]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_localita_i_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_status]]') { |
$rettraduction = '[[TB_usr_SqlAs_status_IT]]'; |
$retmaxlen = '10'; |
if($curfield eq '[[TB_t_strade_SqlAs_progressiva_f]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_progressiva_f_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_street]]') { |
$rettraduction = '[[TB_usr_SqlAs_street_IT]]'; |
$retmaxlen = '35'; |
if($curfield eq '[[TB_t_strade_SqlAs_localita_f]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_localita_f_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_streetnumber]]') { |
$rettraduction = '[[TB_usr_SqlAs_streetnumber_IT]]'; |
$retmaxlen = '15'; |
if($curfield eq '[[TB_t_strade_SqlAs_pendenza_max]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_pendenza_max_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_locality]]') { |
$rettraduction = '[[TB_usr_SqlAs_locality_IT]]'; |
$retmaxlen = '15'; |
if($curfield eq '[[TB_t_strade_SqlAs_larghezza_min]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_larghezza_min_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_province]]') { |
$rettraduction = '[[TB_usr_SqlAs_province_IT]]'; |
$retmaxlen = '15'; |
if($curfield eq '[[TB_t_strade_SqlAs_raggio_curv_min]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_raggio_curv_min_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_obs]]') { |
$rettraduction = '[[TB_usr_SqlAs_obs_IT]]'; |
$retmaxlen = '50'; |
if($curfield eq '[[TB_t_strade_SqlAs_pendenza_media]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_pendenza_media_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[FM_student_USRCLASS]]') { |
$rettraduction = '[[FM_student_USRCLASS_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_larghezza_media]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_larghezza_media_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[FM_student_TEACHERCLASS]]') { |
$rettraduction = '[[FM_student_TEACHERCLASS_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_raggio_curv_medio]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_raggio_curv_medio_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_t_strade_SqlAs_coordinata_x]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_coordinata_x_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_t_strade_SqlAs_coordinata_y]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_coordinata_y_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_t_strade_SqlAs_data_1_acquisizione]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_data_1_acquisizione_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_t_strade_SqlAs_agg_strada]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_agg_strada_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_stradexsettore_SqlAs_id_settore]]') { |
$rettraduction = '[[TB_stradexsettore_SqlAs_id_settore_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_stradexsettore_SqlAs_km_da]]') { |
$rettraduction = '[[TB_stradexsettore_SqlAs_km_da_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_stradexsettore_SqlAs_km_a]]') { |
$rettraduction = '[[TB_stradexsettore_SqlAs_km_a_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_usr_SqlAs_permision]]') { |
$rettraduction = '[[TB_usr_SqlAs_permision_IT]]'; |
$retmaxlen = '10'; |
109,11 → 185,11 |
if($curfield eq '[[usr_profile_student]]') { |
$rettraduction = '[[usr_profile_student_IT]]'; |
} |
if($curfield eq '[[FM_student_TIT2_info]]') { |
$rettraduction = '[[FM_student_TIT2_info_IT]]'; |
if($curfield eq '[[FM_strada_TIT2_info]]') { |
$rettraduction = '[[FM_strada_TIT2_info_IT]]'; |
} |
if($curfield eq '[[FM_student_TIT2_address]]') { |
$rettraduction = '[[FM_student_TIT2_address_IT]]'; |
if($curfield eq '[[FM_strada_TIT2_settore]]') { |
$rettraduction = '[[FM_strada_TIT2_settore_IT]]'; |
} |
if($cursetting eq 'traduction') { |
return($rettraduction); |
/trunk/html/FR_admin/FM_student/infostrade.html |
---|
0,0 → 1,290 |
<%def _label> |
<td colspan="1" class="InputLabel"><% $m->comp('.thead.columnSettings', curfield => $field, cursetting => 'traduction') %></td> |
<%args> |
$field |
</%args> |
</%def> |
%# ============================================= End of Embedded Components =========================== |
<body> |
<script language="JavaScript"> |
function refresh() |
{ |
self.opener.refresh(); |
self.close(); |
} |
function showObj(sl) |
{ |
var curselection = sl.value; |
if(! curselection){ |
return; |
} |
var profile = document.getElementById('[[TB_usr_SqlAs_profile]]').value; |
if(profile != '[[usr_profile_student]]' ){ |
alert("[[MS_fm_student_alert01_IT]] "+profile+" [[MS_fm_student_alert02_IT]]"); |
} |
} |
function delCurRow(curtd){ |
var currow = curtd.parentNode |
//alert("currow:"+currow.parentNode); |
currow.parentNode.removeNode(true); |
} |
function addSettori() |
{ |
var objwin = window.open("settore.html", "add_teachers_window", "toolbar=no, location=no , directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=[[FM_stradexsettore_windows_width]], height=[[FM_stradexsettore_windows_height]]"); |
objwin.focus(); |
} |
// update the teachers table |
function updateTable(aTeachers) |
{ |
// Reference to the opener window teacher table |
var tableBody = document.getElementById('tableBody'); |
var existedRow = tableBody.rows.length; |
for( i = 0 ; i < aTeachers.length ; i++) |
{ |
// Create a new TR (row) of the table |
var tr = document.createElement('tr'); |
// Create the new TD's (Cells) of the table |
var tdHidden = document.createElement('td'); |
var tdId = tdHidden.cloneNode(); |
var tdName = tdHidden.cloneNode(); |
var tdSurname = tdHidden.cloneNode(); |
var tdButton = tdHidden.cloneNode(); |
tdHidden.className = "tablepeople"; |
tdId.className = "tablepeople"; |
tdName.className = "tablepeople"; |
tdSurname.className = "tablepeople"; |
tdButton.className = "tablepeople"; |
var tdHiddenText = document.createElement("<input type=hidden name=ROW"+ (existedRow + i) +">"); |
tdHiddenText.value = aTeachers[i].id.toString()+"|"+aTeachers[i].name+"|"+aTeachers[i].surname+"|0"; |
var tdIdText = document.createTextNode(aTeachers[i].id.toString()); |
var tdNameText = document.createTextNode(aTeachers[i].name); |
var tdSurnameText = document.createTextNode(aTeachers[i].surname); |
var tdButtonText = document.createElement("<input type=button onClick=delCurRow(this)>"); |
tdButtonText.value = "del"; |
tdHidden.appendChild(tdHiddenText); |
tdId.appendChild(tdIdText); |
tdName.appendChild(tdNameText); |
tdSurname.appendChild(tdSurnameText); |
tdButton.appendChild(tdButtonText); |
// add the Cells to the Row |
tr.appendChild(tdHidden); |
tr.appendChild(tdId); |
tr.appendChild(tdName); |
tr.appendChild(tdSurname); |
tr.appendChild(tdButton); |
// add the Row to the Table |
tableBody.appendChild(tr); |
} |
} |
</script> |
<form name="form1" action="save.html" method="post"> |
<table cellspacing="2" cellpadding="2" border="0" align="center" width="100%"> |
<tr> |
% my $titinfo = $m->comp($compLang, curfield => '[[FM_strada_TIT2_info]]', cursetting => 'traduction'); |
<td colspan="4" class="h01"><% $titinfo %>:</td> |
</tr> |
<tr> |
% $curfield = 'form_action'; |
% if($isUpdate){$curvalue = 'value="update"'} else{$curvalue = 'value="insert"'} |
<td colspan="3"><input type="hidden" name="<% $curfield %>" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = '[[TB_t_strade_SqlAs_id]]'; |
% $curmaxlen = $m->comp($compLang, curfield => $curfield, cursetting => 'maxlength'); |
<td colspan="1" class="InputLabel" ><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"' .' READONLY class="InputTextREAD" '} else{$curvalue = 'class="LOGIN"'} |
<td colspan="3">:<input type="text" name="<% $curfield %>" minlength="4" maxlength="<%$curmaxlen%>" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = '[[TB_t_strade_SqlAs_cod_servizio]]'; |
% $curmaxlen = $m->comp($compLang, curfield => $curfield, cursetting => 'maxlength'); |
<td colspan="1" class="InputLabel"><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input type="text" name="<% $curfield %>" class="InputText" <% $curvalue %> ></td> |
% $curfield = '[[TB_t_strade_SqlAs_denominazione]]'; |
% $curmaxlen = $m->comp($compLang, curfield => $curfield, cursetting => 'maxlength'); |
<td colspan="1" class="InputLabel"><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input type="text" name="<% $curfield %>" class="InputText" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = '[[TB_t_strade_SqlAs_tipo]]'; |
<td colspan="1" class="InputLabel"><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input class="DATE" Descrizione="[[FD_fmstudent_creation_IT]]" type="text" id="<% $curfield %>" name="<% $curfield %>" <% $curvalue %> ></td> |
%# <td colspan="3">:<input type="text" name="<% $curfield %>" class="InputText" <% $curvalue %> ></td> |
% $curfield = '[[TB_t_strade_SqlAs_lunghezza]]'; |
% $curmaxlen = $m->comp($compLang, curfield => $curfield, cursetting => 'maxlength'); |
<td colspan="1" class="InputLabel"><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input type="text" name="<% $curfield %>" class="InputText" <% $curvalue %> ></td> |
</tr> |
%# ******************************** INIZIO PROVA MARCO |
<tr> |
% $curfield = 'progressiva_i'; |
<td colspan="1" class="InputLabel">Progressiva Iniziale</td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
%#COMMENTO <td colspan="3" class="InputTextREAD"> <% $curRow->{$curfield} %> </td> |
<td colspan="3">:<input class="InputText" type="text" id="<% $curfield %>" name="<% $curfield %>" <% $curvalue %> ></td> |
% $curfield = 'progressiva_f'; |
<td colspan="1" class="InputLabel">Progressiva Finale</td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
%#COMMENTO <td colspan="3" class="InputTextREAD"> <% $curRow->{$curfield} %> </td> |
<td colspan="3">:<input type="text" name="<% $curfield %>" class="InputText" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = 'localita_i'; |
<td colspan="1" class="InputLabel">Localita' di inizio </td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input class="InputText" type="text" id="<% $curfield %>" name="<% $curfield %>" <% $curvalue %> ></td> |
% $curfield = 'localita_f'; |
<td colspan="1" class="InputLabel">Localita' di fine</td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input type="text" name="<% $curfield %>" class="InputText" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = 'pendenza_media'; |
<td colspan="1" class="InputLabel">Pendenza Media</td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input class="InputText" type="text" id="<% $curfield %>" name="<% $curfield %>" <% $curvalue %> ></td> |
% $curfield = 'pendenza_max'; |
<td colspan="1" class="InputLabel">Pendenza Massima</td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input type="text" name="<% $curfield %>" class="InputText" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = 'larghezza_min'; |
<td colspan="1" class="InputLabel">Largezza minima</td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input class="InputText" type="text" id="<% $curfield %>" name="<% $curfield %>" <% $curvalue %> ></td> |
% $curfield = 'larghezza_media'; |
<td colspan="1" class="InputLabel">Largezza Media</td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input type="text" name="<% $curfield %>" class="InputText" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = 'raggio_curv_min'; |
<td colspan="1" class="InputLabel">Raggio di curvatura minimo</td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input class="InputText" type="text" id="<% $curfield %>" name="<% $curfield %>" <% $curvalue %> ></td> |
% $curfield = 'raggio_curv_medio'; |
<td colspan="1" class="InputLabel">Raggio di curvatura medio</td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'.' maxlength="'.$curmaxlen.'"'} else{$curvalue = ''. ' maxlength="'.$curmaxlen.'"'} |
<td colspan="3">:<input type="text" name="<% $curfield %>" class="InputText" <% $curvalue %> ></td> |
</tr> |
%# *************************************** FINE PROVA MARCO |
<tr> |
<td colspan="8" ><hr></td> |
</tr> |
<tr> |
</tr> |
</table> |
<hr> |
<table cellspacing="1" cellpadding="2" border="0"> |
<tr> |
% my $titteachers = $m->comp($compLang, curfield => '[[FM_strada_TIT2_settore]]', cursetting => 'traduction'); |
<td colspan="4" class="h01"><% $titteachers %>:</td> |
<td align="center"> <input type="button" value="Inserisci Settore" class="boxlook" onClick="javascript:addSettori()"> </td> |
</tr> |
</table> |
<table border=0 cellspacing="1"> |
<thead class="tablepeopleFORM"> |
<td width="00%"></td> |
<td width="20%" align="center">[[TH_f2strada_col1_IT]]</td> |
<td width="40%" align="center">[[TH_f2strada_col2_IT]]</td> |
<td width="40%" align="center">[[TH_f2strada_col3_IT]]</td> |
</thead> |
<tbody id="tableBody"> |
% if($isUpdate){ |
% my $curSQL = "select id_settore,km_da,km_a from t_stradexsettore where id_strada=? order by km_da"; |
% my $sth = $dbh->prepare($curSQL); |
% my $isfromdb = 1; |
% $sth->execute($condition); |
% while(@curSettore = $sth->fetchrow_array){ |
<tr> |
<td class="tablepeople"> |
<input name="<% $nameROW %><% $i %>" type="hidden" value="<% $curSettore[0].'|'.$curSettore[1].'|'.$curSettore[2].'|'.$isfromdb %>" > |
</td> |
<td class="tablepeople"><% $curSettore[0] %> </td> |
<td class="tablepeople"><% $curSettore[1] %> </td> |
<td class="tablepeople"><% $curSettore[2] %> </td> |
<td class="tablepeople"><input value="del" type="button" onclick="delCurRow(this)"> </td> |
</tr> |
% $i++; |
% } |
% } |
</tbody> |
</table> |
<table cellspacing="1" cellpadding="2" border="0" align="center"> |
<tr> |
<td colspan="8" align="center"> |
<input type="submit" value="[[BT_save_modify_IT]]" onClick="BT_print.disabled=true; this.disabled=true; form1.submit()" class="boxlook" name="BT_salva" id="BT_salva"> |
</td> |
<td colspan="8" align="center"> |
<input type="button" value="[[BT_cancel_IT]]" class="boxlook" onClick="javascript:window.close()"> |
</td> |
</tr> |
</table> |
</form> |
<%method title> |
[[FM_strada_windowTitle_IT]] |
</%method> |
<%args> |
$wh => '_BLANK_' |
</%args> |
<%init> |
use DBI; |
my $isSuperuser = ''; |
my $condition = $wh; |
my $isUpdate = ''; |
if ($wh ne '_BLANK_'){ ### if it has a value then is an Update |
$isUpdate = '1'; ### TRUE |
} |
my $curRow; |
my $curvalue = ''; |
my $curfield = ''; |
my $curmaxlen = ''; |
my $curlabel = ''; |
my $check = ''; |
my $compLang = '.thead.columnSettings'; |
my ($tablename,$colCondition,$columnAs,$curSQL); |
my $dbh = getDbConnect(1,1); |
my $nameROW = 'ROW'; ### starting name of the Teacher id Rows |
my @curSettore; |
my $i = 0; |
#$m->out( Dumper($class_ref)); |
if ($isUpdate){ |
$tablename = $m->comp('.table.name'); |
$colCondition = $m->comp('.sql.columnCondition'); |
$columnAs = $m->comp('.sql.columnAs'); |
$curSQL = "select $columnAs from $tablename" ." where $colCondition=?"; |
my $sth = $dbh->prepare($curSQL); |
$sth->execute($condition); |
$curRow = $sth->fetchrow_hashref; |
} |
</%init> |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
Added: svn:keywords |
+Author Date Id Revision |
\ No newline at end of property |
/trunk/html/FR_admin/FM_student/save.html |
---|
0,0 → 1,211 |
<%perl> |
# ================================== End of Subrutines ==================================== |
#$m->out( Dumper (%ARGS)); |
#return; |
# ================================== Common Variables Initialization |
my ($curfunc,$dbgerror,$dbginfo,$message) = ('67', ' 1:', ' 40:', 'fmstudent Ok'); |
$tablename = $m->comp('.table.name'); |
$colCondition = $m->comp('.sql.columnCondition'); |
# ============================================= Proccess form fields |
foreach my $curkey (keys %ARGS){ |
if($curkey eq 'form_action'){ |
next; ### skiping hidden field |
} |
if($curkey =~ /^BT./){ |
next; ### skiping BUTTONS |
} |
if($curkey eq $colCondition){ |
$condition = $ARGS{$curkey}; |
next; |
} |
if($curkey eq 'isPrint'){ |
$isPrint = $ARGS{$curkey}; |
# skipped to be created after if it is BLANK |
next; |
} |
if($curkey eq '[[TB_usr_SqlAs_creation]]'){ |
# skipped to be created after if it is BLANK |
$creation = $ARGS{$curkey}; |
next; |
} |
if($curkey =~ /ROW./){ |
push(@idsettore, $ARGS{$curkey}); |
next; |
} |
if($isUpdate){ |
if($isFirstime){ |
$setvalues = "$curkey='" . $ARGS{$curkey} ."'"; |
$isFirstime = ''; |
next; |
} |
$setvalues = $setvalues . ", $curkey='" . $ARGS{$curkey} ."'"; |
}else{ |
if($curkey eq 'password'){ |
# skipped to be created after if it is BLANK |
$password = $ARGS{$curkey}; |
next; |
} |
if($isFirstime){ |
$setfields .= "$curkey"; |
$setvalues .= "'" . $ARGS{$curkey} . "'"; |
$isFirstime = ''; |
next; |
} |
$setfields .= ", $curkey"; |
$setvalues .= ", '" . $ARGS{$curkey} . "'"; |
} |
} |
if($isUpdate){ |
# ===================================================================== Begin Transaction |
$dbh->begin_work or writeMsg("cant begin transac".$dbh->errstr, $dbgerror . $curfunc); |
my $where = " where $colCondition=?"; |
eval{ |
# ================================================= Update t_Strade Data |
my $curSQL = "update $tablename set $setvalues $where"; |
my $sth = $dbh->prepare($curSQL); |
my $ret = $sth->execute($condition); |
if ($ret eq "0E0"){ |
$message = "error ret:$ret:, on $curSQL ($condition); errstr:" . $dbh->errstr; |
$ret = 0; |
} |
# ================================================= Update t_stradexsettore Data |
my $prevsettore; |
foreach my $cursettore (@idsettore){ |
my @data = split( /\|/, $cursettore); |
if($data[3]){ ### [0] idsettore; [1] km_da; [2] km_a; [3] isfromdb |
$prevsettore = $data[0]; |
next; |
} |
### we have a new record to allungare la strada |
if($prevsettore eq $data[0]){ # update the last record |
$curSQL = "update t_stradexsettore set km_a = $data[2] where id_strada=$condition and id_settore=$data[0]"; |
}else{ |
$curSQL = "insert into t_stradexsettore values ($condition, $data[0], $data[1], $data[2])"; |
my $sizeTronco = 200; |
my $firstSettoreStrada = 0; |
my $curid = $condition; |
my $cursett = $data[0]; |
my $curini = $data[1]; |
my $curend = $data[2]; |
my $prevDescA = getLastTronco($dbh, $curid); |
my $prevSizeTronco = getLastSize($dbh, $curid); |
if($prevSizeTronco + ($curend - $curini) < $sizeTronco ){ |
#ERRORE |
} |
my $prevLastTronco =; |
my $lasttronco = createTronchiStradaForSettore($dbh, $sizeTronco, $firstSettoreStrada, $curid, $cursett, $curini, $curend, $prevDescA, $prevLastTronco) |
} |
$sth = $dbh->prepare($curSQL); |
$ret = $sth->execute(); |
} |
}; |
if($@){ |
$dbh->rollback or writeMsg("cant rollback".$dbh->errstr, $dbgerror . $curfunc); |
writeMsg("error commit".$@.$dbh->errstr, $dbginfo . $curfunc); |
$wasError .= 'error commit'; |
goto ENDSAVE; |
} |
# ==================================================================== Commit DB Data |
$dbh->commit or writeMsg("$dbh->errstr", $dbgerror . $curfunc); |
}else{ |
my $curSQL = "insert into $tablename ($colCondition, $setfields) values ($condition,$setvalues)"; |
my $sth = $dbh->prepare($curSQL); |
my $ret = $sth->execute(); |
if ($ret eq "0E0"){ |
$message = "error ret:$ret:, on $curSQL ($condition); errstr:" . $dbh->errstr; |
$ret = 0; |
} |
$dbh->commit or writeMsg("$dbh->errstr", $dbgerror . $curfunc); |
} |
ENDSAVE: |
if (! $wasError){ |
if ( $isPrint ){ |
$m->comp('print_user', Usrid => $usrid); |
}else{ |
$m->comp('../../pageclose.html', frameName => 'main'); |
} |
}else{ |
$m->comp('../../pageerror.html', message => $wasError); |
} |
</%perl> |
<%once> |
# my $dbh; |
my $wasError; |
</%once> |
<%init> |
#$m->out( Dumper (%ARGS)); |
#return; |
my $form_action = $ARGS{'form_action'}; |
my $isUpdate = ''; |
my $setfields; |
my $setvalues; |
my $isFirstime = '1'; |
my $isPrint = 0; |
if ($form_action eq 'update'){ ### if it has a value then is an Update |
$isUpdate = '1'; ### TRUE |
} |
$wasError = ''; |
my $dbh = getDbConnect(1,1); |
my @idsettore; |
my $sth; |
my $ret; |
my $tablename; |
my $condition; |
my $colCondition; |
my @cmd_executed = []; |
my $usrid; |
my $password; |
my $creation; |
my $profile; |
my $where; |
my $curSQL; |
my @usrclass; |
my @permision; |
my $ref_prevClassId; |
my $classesChanged; |
</%init> |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
Added: svn:keywords |
+Author Date Id Revision |
\ No newline at end of property |
/trunk/html/FR_admin/FM_student/.sql.condition |
---|
1,0 → 0,0 |
%return('[[TB_usr_id]]=?'); |
%return('[[TB_t_strade_id]]=?'); |
/trunk/html/FR_admin/FM_student/.table.name |
---|
1,0 → 0,0 |
% return('[[TB_NAME_usr]]'); |
% return('[[TB_NAME_strade]]'); |
/trunk/html/FR_admin/FM_student/autohandler |
---|
7,7 → 7,7 |
%#<& .footer &> |
%# |
<%method title> |
Form Student |
Form Strade |
</%method> |
%# |
<%init> |
/trunk/html/FR_admin/FM_student/.javaScript.function |
---|
0,0 → 1,82 |
<script language="JavaScript"> |
// Teacher object constructor |
function Teacher(i, n, s) |
{ |
this.id = i; |
this.name = n; |
this.surname = s; |
} |
// Array of IDs |
aIds = new Array(); |
// Array of teachers |
aTeachers = new Array(); |
// update the teachers array acording to the checkbox status |
function updateTeacher(cb, id, name, surname) |
{ |
SelectRow(cb); |
if (cb.checked) |
addItem(id,name,surname); |
else |
delItem(id); |
} |
// Adds a teacher to de array of teachers (aTeachers) |
function addItem(newId, newName, newSurname) |
{ |
var i=0; |
for (i = 0 ; i < aIds.length ; i++) |
{ |
if (aIds[i]==newId) |
i=aIds.length+1; |
} |
if (i == aIds.length) |
{ |
aIds[i]=newId; |
newTeacher = new Teacher(newId, newName, newSurname); |
aTeachers[i] = newTeacher; |
} |
} |
// Deletes a teacher from thea array of teachers |
function delItem(oldId) |
{ |
var i=0, pos; |
pos = aIds.length; |
for (i = 0 ; i < aIds.length ; i++) |
{ |
if (aIds[i]==oldId) |
{ |
pos = i; |
i = aIds.length+1; |
} |
} |
if (pos < aIds.length) |
{ |
for (i = pos; i < aIds.length - 1; i++) |
{ |
aIds[i] = aIds[i+1]; |
aTeachers[i] = aTeachers[i+1]; |
} |
aIds.length--; |
aTeachers.length--; |
} |
} |
function addTeachers() |
{ |
self.opener.updateTable(aTeachers); |
self.close(); |
} |
function addSettore() |
{ |
var idsettore = document.getElementById('[[TB_stradexsettore_SqlAs_id_settore]]').value; |
var settorekmda = document.getElementById('[[TB_stradexsettore_SqlAs_km_da]]').value; |
var settorekma = document.getElementById('[[TB_stradexsettore_SqlAs_km_a]]').value; |
//alert("valor:"+settorekmda); |
addItem(idsettore,settorekmda,settorekma); |
addTeachers(); |
} |
function orderWindow(wh, co) |
{ |
window.location.href="<% $r->uri %>?wh="+wh+";co="+co |
} |
</script> |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
Added: svn:keywords |
+Author Date Id Revision |
\ No newline at end of property |
/trunk/html/FR_admin/FM_student/settore.html |
---|
0,0 → 1,51 |
% $m->comp('.javaScript.function'); |
<BODY> |
<form method="post"> |
<table cellspacing="2" cellpadding="2" border="0" align="center" width="80%"> |
<tr> |
% my $titinfo = '[[FM_settore_TIT_IT]]'; |
<td colspan="4" class="h01"><% $titinfo %>:</td> |
</tr> |
<tr> |
% $curfield = '[[TB_stradexsettore_SqlAs_id_settore]]'; |
<td colspan="1" class="InputLabel"><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = 'value="' . '"' .' READONLY class="InputTextREAD" '} else{$curvalue = 'class="InputText"'} |
<td colspan="2">:<input type="text" id="<% $curfield %>" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = '[[TB_stradexsettore_SqlAs_km_da]]'; |
<td colspan="1" class="InputLabel"><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = 'value="' . '"' .' READONLY class="InputTextREAD" '} else{$curvalue = 'class="InputText"'} |
<td colspan="2">:<input type="text" id="<% $curfield %>" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = '[[TB_stradexsettore_SqlAs_km_a]]'; |
<td colspan="1" class="InputLabel"><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = 'value="' . '"' .' READONLY class="InputTextREAD" '} else{$curvalue = 'class="InputText"'} |
<td colspan="2">:<input type="text" id="<% $curfield %>" <% $curvalue %> ></td> |
</tr> |
<tr> |
<td colspan="8" ><hr></td> |
</tr> |
<tr> |
<td colspan="1" align="center"> |
<input type="button" value="[[BT_cancel_IT]]" class="boxlook" onClick="javascript:window.close()"> </td> |
<td colspan="1" align="center"> |
<input type="submit" value="Salva" class="boxlook" onClick="addSettore()"></td> |
</tr> |
</table> |
</form> |
</BODY> |
<%init> |
my $curfield = ''; |
my $curvalue = ''; |
my $curlabel = ''; |
my $curmaxlen; |
my $isUpdate = ''; ### FALSE |
my $compLang = '.thead.columnSettings'; |
</%init> |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
Added: svn:keywords |
+Author Date Id Revision |
\ No newline at end of property |
/trunk/html/FR_admin/FM_student/.sql.columnAs |
---|
1,0 → 0,0 |
%return('id,profile,name,cognome,password,status,creation,tel,tel2,street,streetnumber,zip,locality,province,obs,permision'); |
%return('id_strade,cod_servizio,nstrada,denominazione,tipo,progressiva_i,localita_i,progressiva_f,localita_f,lunghezza,pendenza_max,larghezza_min,raggio_curv_min,pendenza_media,larghezza_media,raggio_curv_medio,coordinata_x,coordinata_y,data_1_acquisizione,agg_strada'); |
/trunk/html/FR_admin/F2_class/.sql.columnCondition |
---|
1,0 → 0,0 |
% return('[[TB_class_SqlAs_id]]'); |
% return('[[TB_strada_SqlAs_id]]'); |
/trunk/html/FR_admin/F2_class/.thead.columnSettings |
---|
1,53 → 1,63 |
<%perl> |
if($curfield eq '[[TB_class_SqlAs_id]]') { |
$rettraduction = '[[TB_class_SqlAs_id_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_id]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_id_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '9'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_class_SqlAs_descshort]]') { |
$rettraduction = '[[TB_class_SqlAs_descshort_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_id_settore]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_id_settore_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '30'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_class_SqlAs_permision]]') { |
$rettraduction = '[[TB_class_SqlAs_permision_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_km_da]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_km_da_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_class_SqlAs_desclong]]') { |
$rettraduction = '[[TB_class_SqlAs_desclong_IT]]'; |
if($curfield eq '[[TB_t_strade_SqlAs_km_a]]') { |
$rettraduction = '[[TB_t_strade_SqlAs_km_a_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
$retmaxlen = '12'; |
} |
if($curfield eq '[[TB_class_SqlAs_siteok]]') { |
$rettraduction = '[[TB_class_SqlAs_siteok_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
if($curfield eq '[[TB_usr_SqlAs_permision]]') { |
$rettraduction = '[[TB_usr_SqlAs_permision_IT]]'; |
$retmaxlen = '10'; |
} |
if($curfield eq '[[TB_class_SqlAs_sitebad]]') { |
$rettraduction = '[[TB_class_SqlAs_sitebad_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
if($curfield eq '[[BT_ok]]') { |
$rettraduction = '[[BT_ok_IT]]'; |
} |
if($curfield eq '[[TB_class_SqlAs_sitefm]]') { |
$rettraduction = '[[TB_class_SqlAs_sitefm_IT]]'; |
$retalign = 'center'; |
$retwidth = '20%'; |
if($curfield eq '[[BT_cancel]]') { |
$rettraduction = '[[BT_cancel_IT]]'; |
} |
if($curfield eq '[[BT_delete_class]]') { |
$rettraduction = '[[BT_delete_class_IT]]'; |
if($curfield eq '[[BT_delete_usr]]') { |
$rettraduction = '[[BT_delete_usr_IT]]'; |
} |
if($curfield eq '[[F2_class_TIT2_teachers]]') { |
$rettraduction = '[[F2_class_TIT2_teachers_IT]]'; |
if($curfield eq '[[usr_profile_gestion]]') { |
$rettraduction = '[[usr_profile_gestion_IT]]'; |
} |
if($curfield eq '[[F2_class_TIT2_students]]') { |
$rettraduction = '[[F2_class_TIT2_students_IT]]'; |
if($curfield eq '[[usr_profile_teacher]]') { |
$rettraduction = '[[usr_profile_teacher_IT]]'; |
} |
if($curfield eq '[[F2_class_TIT2_info]]') { |
$rettraduction = '[[F2_class_TIT2_info_IT]]'; |
if($curfield eq '[[usr_profile_admin]]') { |
$rettraduction = '[[usr_profile_admin_IT]]'; |
} |
if($curfield eq '[[usr_profile_student]]') { |
$rettraduction = '[[usr_profile_student_IT]]'; |
} |
if($curfield eq '[[FM_strada_TIT2_info]]') { |
$rettraduction = '[[FM_strada_TIT2_info_IT]]'; |
} |
if($curfield eq '[[FM_strada_TIT2_address]]') { |
$rettraduction = '[[FM_strada_TIT2_address_IT]]'; |
} |
if($cursetting eq 'traduction') { |
return($rettraduction); |
} |
/trunk/html/FR_admin/F2_class/save.html |
---|
0,0 → 1,434 |
<%perl> |
sub F2insertUsrClassData($$$$){ |
my ($dbh, $tablename, $key, $ref_usrclass) = @_; |
my ($curfunc,$dbgerror,$dbginfo,$message) = ('70', ' 1:', ' 40:', ''); |
my $ret = 'true'; |
writeMsg("en insUsrData $key", (($ret)? $dbginfo:$dbgerror) . $curfunc); |
my $setfields = '(classid, usrid, data, profile, permision)'; |
foreach my $curkey (@$ref_usrclass){ |
# ===================================================================== Get class permisions |
# my @row = $dbh->selectrow_array("select permision from class where id='$curkey'"); |
my $setvalues = "('$key', '$curkey', now(), '[[usr_profile_teacher]]', '[[usr_permision_SHWW]]')"; |
my $curSQL = "insert into $tablename $setfields values $setvalues "; |
#$m->out( $curSQL); |
my $sth = $dbh->prepare($curSQL); |
$ret = $sth->execute(); |
if (! $ret){ |
$message = "in F2insertUsrClassData" . $dbh->errstr; |
} |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
} |
return($ret); |
} |
sub F2insertClassIntoKeys($$$){ |
my ($dbh, $tablename, $classid) = @_; |
my ($curfunc,$dbgerror,$dbginfo,$message) = ('71', ' 1:', ' 40:', ''); |
my $ret; |
my $setfields = '(id, key, value)'; |
my $setvalues = "(nextval('keys_id'), 'Class_" . $classid . "', '')"; |
my $curSQL = "insert into $tablename $setfields values $setvalues "; |
my $sth = $dbh->prepare($curSQL); |
$ret = $sth->execute(); |
if (! $ret){ |
$message = "in F2insertClassIntoKeys" . $dbh->errstr; |
} |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
return($ret); |
} |
sub F2insertClassData($$$$$$){ |
my ($dbh, $tablename, $colCondition, $condition, $setfields, $setvalues) = @_; |
my ($curfunc,$dbgerror,$dbginfo,$message) = ('72', ' 1:', ' 40:', ''); |
my $ret; |
my $curSQL; |
my $sth; |
my $maxtries = 20000; |
do{ |
if (! $maxtries--){die "to many tries to insert a record\n"} |
# =========================== Autogenerate a usrid key |
if(! $condition){ |
$condition = $m->comp('../../genid.pl', char => 'ccnnn' ); |
} |
$curSQL = "insert into $tablename ($colCondition, $setfields) values ('$condition', $setvalues) "; |
$sth = $dbh->prepare($curSQL); |
$ret = $sth->execute(); |
if (! $ret){ |
$message = "in F2insertClassData" . $dbh->errstr; |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
} |
}while(!$ret); |
return($condition); |
} |
sub F2enableClassForTeachers($$$){ |
my ($condition, $ref_prevTeacherId, $ref_teacherid) = @_; |
my ($curfunc,$dbgerror,$dbginfo,$message) = ('73', ' 1:', ' 40:', ''); |
my $ret; |
# Delete all the teachers from this class |
if(@$ref_prevTeacherId){ |
my @delteacher; |
foreach my $curteacher (@$ref_prevTeacherId){ |
push @delteacher, @$curteacher; |
} |
$ret=checkExec($curfunc, "su1 cms_command deleteclass $condition @delteacher"); |
# $ret = $m->comp('../../run', pg=>'deleteclass', ar=>"$condition @delteacher"); |
if (! $ret){ |
$message = "cant run deleteclass; $condition @delteacher"; |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
return($ret); |
} |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
} |
my $arid = ""; |
if (@$ref_teacherid){ |
$arid .= "-teacher @$ref_teacherid"; |
}else{ |
## no teacher for the class, so nothing more to do here |
return('TRUE'); |
} |
$ret=checkExec($curfunc, "su1 cms_command updateclass $condition $arid"); |
# $ret = $m->comp('../../run', pg=>'updateclass', ar=>"$condition $arid"); |
if (! $ret){ |
$message = "cant run updateclass; $condition "; |
} |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
return($ret); |
} |
sub F2runcreateclass($$){ |
my ($classid, $ref_teacherid) = @_; |
my ($curfunc,$dbgerror,$dbginfo,$message) = ('74', ' 1:', ' 40:', ''); |
# newuser <id> <password> [<type>] |
my $arid = ""; |
if (@$ref_teacherid){ |
$arid .= "-teacher @$ref_teacherid"; |
} |
# CREATING CLASS updateclass <classid> [-teacher <id> <id> <id> ...] [-student <id> <id> <id> ...] |
# my $ret = $m->comp('../../../run', pg=>'createclass', ar=>"$classid $arid"); |
my $ret=checkExec($curfunc, "su1 cms_command updateclass $classid $arid"); |
if(! $ret){ |
$message = "can t run createclass $classid $arid"; |
} |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
return($ret); |
} |
sub F2refreshRedirect(){ |
my ($curfunc,$dbgerror,$dbginfo,$message) = ('75', ' 1:', ' 40:', ''); |
# my $ret = $m->comp('../../../run', pg=>'refreshredirect', ar=>''); |
my $ret=checkExec($curfunc, "su1 HUP_squid_redirect"); |
if (! $ret){ |
$message = "can t run refreshredirect"; |
} |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
return($ret); |
} |
# ======== set values coming from the form related with all the classes of this student |
sub F2updateUsrClassData($$$$$){ |
my ($dbh, $tablename, $colCondition, $condition, $ref_usrclass) = @_; |
my ($curfunc,$dbgerror,$dbginfo,$message) = ('77', ' 1:', ' 40:', ''); |
my $where = " where classid = '$condition' and profile = '[[usr_profile_teacher]]'"; |
my $curSQL = "delete from $tablename $where"; |
my $sth = $dbh->prepare($curSQL); |
my $ret = $sth->execute(); |
if (! $ret){ |
$message = "inUsrClassData;cant delete $dbh->errstr"; |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
return($ret); |
} |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
my $setfields = '(classid, usrid, data, profile, permision)'; |
foreach my $curkey (@$ref_usrclass){ |
my $setvalues = "('$condition', '$curkey', now(), '[[usr_profile_teacher]]', '[[usr_permision_SHWW]]')"; |
$curSQL = "insert into $tablename $setfields values $setvalues"; |
$sth = $dbh->prepare($curSQL); |
$ret = $sth->execute(); |
if (! $ret){ |
$message = "inUsrClassData inserting; $dbh->errstr"; |
} |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
} |
return($ret); |
} |
# ==================== set values coming from the form |
sub F2updateClassData($$$$$){ |
my ($dbh, $tablename, $colCondition, $condition, $setvalues) = @_; |
my ($curfunc,$dbgerror,$dbginfo,$message) = ('78', ' 1:', ' 40:', ''); |
my $where = " where $colCondition = '$condition'"; |
my $curSQL = "update $tablename set $setvalues $where"; |
my $sth = $dbh->prepare($curSQL); |
#$m->out( $curSQL); |
my $ret = $sth->execute(); |
if (! $ret){ |
$message = "updateUsrData; $dbh->errstr"; |
} |
writeMsg($message, (($ret)? $dbginfo:$dbgerror) . $curfunc); |
return($ret); |
} |
sub F2getPreviusTeacherOfClass($$){ |
my ($dbh, $condition) = @_; |
my $where = "where classid = '$condition' and profile = '[[usr_profile_teacher]]'"; |
my $curSQL = "select usrid from usrclass $where"; |
my $ref_prevTeacherId = $dbh->selectall_arrayref($curSQL); |
return($ref_prevTeacherId); |
} |
# ================================== End of Subrutines ==================================== |
# ================================== Common Variables Initialization |
my ($curfunc,$dbgerror,$dbginfo,$message) = ('79', ' 1:', ' 40:', 'f2class Ok'); |
$tablename = $m->comp('.table.name'); |
$colCondition = $m->comp('.sql.columnCondition'); |
$profile = %ARGS->{'profile'}; |
$ref_prevTeacherId = ''; # in an insert it is false |
$teacherChanged = 'TRUE'; |
# ============================================= Proccess form fields |
foreach my $curkey (keys %ARGS){ |
if($curkey eq 'form_action'){ |
next; ### skiping hidden field |
} |
if($curkey eq $colCondition){ |
$condition = %ARGS->{$curkey}; |
#$classid=$condition; |
next; |
} |
if($curkey =~ /ROW./){ |
push(@teacherid, %ARGS->{$curkey}); |
next; |
} |
if($isUpdate){ |
if($isFirstime){ |
$setvalues = "$curkey='" . %ARGS->{$curkey} ."'"; |
$isFirstime = ''; |
next; |
} |
$setvalues = $setvalues . ", $curkey='" . %ARGS->{$curkey} ."'"; |
}else{ |
if($isFirstime){ |
$setfields .= "$curkey"; |
$setvalues .= "'" . %ARGS->{$curkey} . "'"; |
$isFirstime = ''; |
next; |
} |
$setfields .= ", $curkey"; |
$setvalues .= ", '" . %ARGS->{$curkey} . "'"; |
} |
} |
if($isUpdate){ |
# ================================================== Get usrClass previus state |
$ref_prevTeacherId = F2getPreviusTeacherOfClass($dbh, $condition); |
if(sameContent(\@teacherid, $ref_prevTeacherId)){ |
# There is no need to update usrclasss table |
$teacherChanged = ''; |
} |
# ===================================================================== Begin Transaction |
$dbh->begin_work or writeMsg("cant bigin trans".$dbh->errstr, $dbgerror . $curfunc); |
eval{ |
# ================================================= Update Usr Data |
F2updateClassData($dbh, $tablename, $colCondition, $condition, $setvalues); |
if($teacherChanged){ |
# ================================================ Update usrClass Data |
$tablename = "usrclass"; |
$colCondition = "classid"; |
F2updateUsrClassData($dbh, $tablename, $colCondition, $condition, \@teacherid); |
} |
}; |
if($@){ |
$dbh->rollback or writeMsg("cant rollback eval".$dbh->errstr, $dbgerror . $curfunc); |
$wasError .= 'cant update db'.$@; |
goto ENDSAVE; |
} |
#$dbh->commit or $m->comp('../../msg', t=>'10', m=> "$dbh->errstr"); |
#goto ENDSAVE; |
if($teacherChanged){ |
# Delete and re-enable all the teachers for the current class |
if(! F2enableClassForTeachers($condition, $ref_prevTeacherId, \@teacherid) ){ |
$dbh->rollback or writeMsg($dbh->errstr, $dbgerror . $curfunc); |
$wasError .= 'cant F2enableClassForTeachers'; |
goto ENDSAVE; |
} |
} |
# ==================================================================== Commit DB Data |
$dbh->commit or writeMsg("cant commit".$dbh->errstr, $dbgerror . $curfunc); |
writeMsg($message, $dbginfo . $curfunc); |
# What happend if a the class is already active???? - so the student starts late the classes |
}else{ |
# ############################################### Is an Insert ##################################### |
if($condition){ |
# ====================================== Test if the class can be created |
$ret=checkExec($curfunc, "su1 cms_command testclass $condition"); |
if(! $ret ){ |
$wasError .= "classe $condition gia esistente"; |
goto ENDSAVE; |
} |
} |
$setfields = "creation, $setfields"; |
$setvalues = "now(), $setvalues"; |
my $tablename2 = "usrclass"; |
# ===================================================================== Begin Transaction |
$dbh->begin_work or writeMsg("$dbh->errstr", $dbgerror . $curfunc); |
eval{ |
# ============================================================== Insert Class Data |
$classid = F2insertClassData($dbh, $tablename, $colCondition, $condition, $setfields, $setvalues); |
# ============================================================== Insert usrClass Data |
F2insertUsrClassData($dbh, $tablename2, $classid, \@teacherid); |
# ============================================================== Insert Class into Keys |
# $tablename = "keys"; |
# F2insertClassIntoKeys($dbh, $tablename, $classid); |
}; |
if($@){ |
$dbh->rollback or writeMsg("cant rollback".$dbh->errstr, $dbgerror . $curfunc); |
$wasError .= 'cant insert into db: '.$@ . $dbh->errstr; |
goto ENDSAVE; |
} |
# ==================================================================== Insert Configuration of Class |
if(! F2runcreateclass($classid, \@teacherid) ){ |
$dbh->rollback or writeMsg("$dbh->errstr", $dbgerror . $curfunc); |
$wasError .= 'cant F2runcreateclass'; |
goto ENDSAVE; |
} |
# ==================================================================== Commit DB Data |
if(! $dbh->commit){ |
$dbh->rollback or writeMsg("cant commit".$dbh->errstr, $dbgerror . $curfunc); |
writeMsg("Cant commit ".$dbh->errstr, $dbgerror . $curfunc); |
$wasError .= 'cant commit'; |
goto ENDSAVE; |
} |
writeMsg($message, $dbginfo . $curfunc); |
# Delete and re-enable all the classes for the current user |
if(! F2refreshRedirect() ){ |
writeMsg("Cant refreshredirect", $dbgerror . $curfunc); |
$wasError .= 'cant refreshredirect'; |
} |
} |
ENDSAVE: |
</%perl> |
%# |
% if (! $wasError){ |
% $m->comp('../../pageclose'); |
% }else{ |
% $m->comp('../../pageerror', message => $wasError); |
% } |
%# |
<%once> |
# my $dbh; |
my $wasError; |
</%once> |
<%init> |
use DBI; |
use Data::Dumper; |
#$m->out( Dumper (%ARGS)); |
# my $id = %ARGS->{'id'}; |
my $form_action = %ARGS->{'form_action'}; |
my $isUpdate = ''; |
my $setfields; |
my $setvalues; |
my $isFirstime = '1'; |
if ($form_action eq 'update'){ ### if it has a value then is an Update |
$isUpdate = '1'; ### TRUE |
} |
$wasError = ''; |
my $dbh = $m->comp('../../dbconnect', autoCommit => '1'); |
my $sth; |
my $ret; |
my $tablename; |
my $condition; |
my $colCondition; |
my $classid; |
my $password; |
my $creation; |
my $profile; |
my $where; |
my $curSQL; |
my @teacherid; |
my @permision; |
my $ref_prevTeacherId; |
my $teacherChanged; |
</%init> |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
Added: svn:keywords |
+Author Date Id Revision |
\ No newline at end of property |
/trunk/html/FR_admin/F2_class/.sql.condition |
---|
1,0 → 0,0 |
%return('[[TB_class_id]]=?'); |
%return('[[TB_strada_id]]=?'); |
/trunk/html/FR_admin/F2_class/.table.name |
---|
1,0 → 0,0 |
% return('[[TB_NAME_class]]'); |
% return('[[TB_NAME_stradexsettore]]'); |
/trunk/html/FR_admin/F2_class/infosettore.html |
---|
0,0 → 1,279 |
%#<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
%#<% $m->comp('../../include/highlight') %> |
<script language="JavaScript"> |
function refresh() |
{ |
self.opener.refresh(); |
self.close(); |
} |
function delClass(bt, id, name) |
{ |
var msg = "[[MS_f2_class_alert01_IT]] " + name ; |
var tableBody = document.getElementById('tableBody'); |
if(tableBody.rows.length > 0){ |
msg = msg + "[[MS_f2_class_alert02_IT]]"; |
} |
msg = msg + "?"; |
// only with confirmation |
if(window.confirm(msg)){ |
bt.disabled=true; |
viewCmd('f2_class', id); |
} |
} |
function viewCmd(action, id) |
{ |
var objwin = window.open("../../run?pg="+action+";ar="+id+";out=1", "cmd_window", "toolbar=no, location=no , directories=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=330, height=120"); |
objwin.focus(); |
} |
function addTeachers() |
{ |
var objwin = window.open("../TB_teacher/index.html?wh=teacher", "add_teachers_window", "toolbar=no, location=no , directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=520, height=450"); |
objwin.focus(); |
} |
function delCurRow(curtd){ |
var currow = curtd.parentNode |
currow.parentNode.removeNode(true); |
} |
// update the teachers table |
function updateTable(aTeachers) |
{ |
// Reference to the opener window teacher table |
var tableBody = document.getElementById('tableBody'); |
var existedRow = tableBody.rows.length; |
for( i = 0 ; i < aTeachers.length ; i++) |
{ |
// Create a new TR (row) of the table |
var tr = document.createElement('tr'); |
// Create the new TD's (Cells) of the table |
var tdHidden = document.createElement('td'); |
var tdId = tdHidden.cloneNode(); |
var tdName = tdHidden.cloneNode(); |
var tdSurname = tdHidden.cloneNode(); |
var tdButton = tdHidden.cloneNode(); |
tdHidden.className = "tablepeople"; |
tdId.className = "tablepeople"; |
tdName.className = "tablepeople"; |
tdSurname.className = "tablepeople"; |
tdButton.className = "tablepeople"; |
var tdHiddenText = document.createElement("<input type=hidden name=ROW"+ (existedRow + i) +">"); |
tdHiddenText.value = aTeachers[i].id.toString(); |
var tdIdText = document.createTextNode(aTeachers[i].id.toString()); |
var tdNameText = document.createTextNode(aTeachers[i].name); |
var tdSurnameText = document.createTextNode(aTeachers[i].surname); |
var tdButtonText = document.createElement("<input type=button onClick=delCurRow(this)>"); |
tdButtonText.value = "del"; |
tdHidden.appendChild(tdHiddenText); |
tdId.appendChild(tdIdText); |
tdName.appendChild(tdNameText); |
tdSurname.appendChild(tdSurnameText); |
tdButton.appendChild(tdButtonText); |
// add the Cells to the Row |
tr.appendChild(tdHidden); |
tr.appendChild(tdId); |
tr.appendChild(tdName); |
tr.appendChild(tdSurname); |
tr.appendChild(tdButton); |
// add the Row to the Table |
tableBody.appendChild(tr); |
} |
} |
</script> |
<form name="form1" action="save.html" method="post"> |
<table cellspacing="0" cellpadding="2" border="0"> |
<tr> |
% my $titinfo = $m->comp($compLang, curfield => '[[F2_class_TIT2_info]]', cursetting => 'traduction'); |
<td colspan="4" class="h01"><% $titinfo %>:</td> |
</tr> |
<tr> |
% $curfield = 'form_action'; |
% if($isUpdate){$curvalue = 'value="update"'} else{$curvalue = 'value="insert"'} |
<td colspan="3"><input type="hidden" name="<% $curfield %>" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = 'id'; |
% $curmaxlen = $m->comp($compLang, curfield => $curfield, cursetting => 'maxlength'); |
<td colspan="1" class="InputLabel" ><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"' .' READONLY class="InputTextREAD" '} else{$curvalue = 'class="CLASS"'} |
<td colspan="3">:<input type="text" name="<% $curfield %>" maxlength="<%$curmaxlen%>" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = 'descshort'; |
% $curmaxlen = $m->comp($compLang, curfield => $curfield, cursetting => 'maxlength'); |
<td colspan="1" class="InputLabel" ><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = 'value="' . $curRow->{$curfield}.'"'} else{$curvalue = ''} |
<td colspan="3">:<input type="text" name="<% $curfield %>" class="InputText" maxlength="<%$curmaxlen%>" <% $curvalue %> ></td> |
</tr> |
<tr> |
% $curfield = '[[TB_class_SqlAs_permision]]'; |
<td colspan="1" class="InputLabel" ><% $m->comp($compLang, curfield => $curfield, cursetting => 'traduction') %></td> |
% if($isUpdate){$curvalue = $curRow->{$curfield}} else{$curvalue = $defaultPermision} |
<td colspan="3">:<select type="text" name="<% $curfield %>" class="InputText" <% $curvalue %> > |
<option <%($curvalue =~ m/[[class_permision_YI]]/) ? '':'SELECTED' %> value="[[class_permision_NO]]" >[[class_permision_NO_IT]] |
<option <%($curvalue =~ m/[[class_permision_YI]]/) ? 'SELECTED':'' %> value="[[class_permision_WW]]" >[[class_permision_WW_IT]] |
</td> |
</tr> |
<tr> |
</tr> |
</table> |
<hr> |
<table cellspacing="1" cellpadding="2" border="0"> |
<tr> |
% my $titteachers = $m->comp($compLang, curfield => '[[F2_class_TIT2_teachers]]', cursetting => 'traduction'); |
<td colspan="4" class="h01"><% $titteachers %>:</td> |
</tr> |
</table> |
<table border=0 cellspacing="1"> |
<thead class="tablepeopleFORM"> |
<td width="00%"></td> |
<td width="20%" align="center">[[TH_f2class_col1_IT]]</td> |
<td width="40%" align="center">[[TH_f2class_col2_IT]]</td> |
<td width="40%" align="center">[[TH_f2class_col3_IT]]</td> |
</thead> |
<tbody id="tableBody"> |
% if($isUpdate){ |
% while(@curTeacher = $sth->fetchrow_array){ |
<tr> |
<td class="tablepeople"> |
<input name="<% $nameROW %><% $i %>" type="hidden" value="<% $curTeacher[0] %>" > |
</td> |
<td class="tablepeople"><% $curTeacher[0] %> </td> |
<td class="tablepeople"><% $curTeacher[1] %> </td> |
<td class="tablepeople"><% $curTeacher[2] %> </td> |
<td class="tablepeople"><input value="del" type="button" onclick="delCurRow(this)"> </td> |
</tr> |
% $i++; |
% } |
% } |
</tbody> |
</table> |
<br> |
<table width="100%"> |
<tr> |
<td align="center"> |
<input type="button" value="Inserisci Docente" class="boxlook" onClick="javascript:addTeachers()"> |
</td> |
</tr> |
</table> |
%# ============== list of student of the class |
% if($isUpdate){ |
<hr> |
<table cellspacing="1" cellpadding="2" border="0"> |
<tr> |
% $titteachers = $m->comp($compLang, curfield => '[[F2_class_TIT2_students]]', cursetting => 'traduction'); |
<td colspan="4" class="h01"><% $titteachers %>:</td> |
</tr> |
</table> |
<table border="0" cellspacing="1"> |
<thead class="tablepeopleFORM"> |
<td width="00%" align="center"></td> |
<td width="20%" align="center">[[TH_f2class_col1_IT]]</td> |
<td width="40%" align="center">[[TH_f2class_col2_IT]]</td> |
<td width="40%" align="center">[[TH_f2class_col3_IT]]</td> |
</thead> |
<tbody id="tableStudent"> |
% $curSQL = "select usr.id, usr.name, usr.cognome from usrclass, usr where classid=? and usrid=usr.id and usrclass.profile='[[usr_profile_student]]'"; |
% $sth = $dbh->prepare($curSQL); |
% $sth->execute($condition); |
% while(@curStudent = $sth->fetchrow_array){ |
<tr> |
<td class="tablepeople"> |
%#<input name="<% $nameROW %><% $i %>" type="hidden" value="<% $curTeacher[0] %>" > |
</td> |
<td class="tablepeople"><% $curStudent[0] %> </td> |
<td class="tablepeople"><% $curStudent[1] %> </td> |
<td class="tablepeople"><% $curStudent[2] %> </td> |
<td class="tablepeople"> |
%#<input value="del" type="button" onclick="delCurRow(this)"> |
</td> |
</tr> |
% $i++; |
% } |
% } |
</tbody> |
</table> |
<hr> |
<table width="100%"> |
<tr> |
<td align="center"> |
<input type="submit" value="[[BT_save_modify_IT]]" id="saveButton" onClick="this.disabled=true; form1.submit()" class="boxlook"> |
% if($isUpdate){ |
% $curfield = 'id'; |
% my $desc = 'descshort'; |
% my $buttonlabel = $m->comp($compLang, curfield => '[[BT_delete_class]]', cursetting => 'traduction'); |
% $curvalue = $curRow->{$curfield}; |
<input type="button" class="boxlook" value="<% $buttonlabel %>" onClick="Javascript:delClass(this, '<% $curvalue %>','<% $curRow->{$desc} %>')"> |
% } |
<input type="button" value="[[BT_cancel_IT]]" class="boxlook" onClick="javascript:window.close()"> |
</td> |
</tr> |
</table> |
</form> |
<%method title> |
[[F2_class_windowTitle_IT]] |
</%method> |
<%args> |
$wh => '_BLANK_' |
</%args> |
<%init> |
use DBI; |
my $condition = $wh; |
my $isUpdate = ''; |
if ($condition ne '_BLANK_'){ ### if it has a value then is an Update |
$isUpdate = '1'; ### TRUE |
} |
my $defaultPermision = '[[class_permision_WW]]'; ### default dropdown selected value |
my $curvalue = ''; |
my $curfield = ''; |
my $curmaxlen = ''; |
my $compLang = '.thead.columnSettings'; |
my $curRow; |
my $nameROW = 'ROW'; ### starting name of the Teacher id Rows |
my @curTeacher; |
my @curStudent; |
my $i = 0; |
my $dbh; |
my $sth; |
my $curSQL; |
if ($isUpdate){ |
# ========================================================================= Process Update |
# $dbh = $m->comp('../../dbconnect'); |
$dbh = getDbConnect(1,1); |
# ====================================================== Get Class Information |
my $tablename = $m->comp('.table.name'); |
my $columnAs = $m->comp('.sql.columnAs'); |
my $colCondition = $m->comp('.sql.columnCondition'); |
$curSQL = "select $columnAs from $tablename" ." where $colCondition=?"; |
#$m->out($curSQL); |
$sth = $dbh->prepare($curSQL); |
$sth->execute($condition); |
$curRow = $sth->fetchrow_hashref; |
# ====================================================== Get Teachers of Class |
$tablename = 'usrclass, usr'; |
$columnAs = 'usr.id, usr.name, usr.cognome'; |
$colCondition = 'classid'; |
$curSQL = "select $columnAs from $tablename" ." where $colCondition=? and usrid=usr.id and usrclass.profile='[[usr_profile_teacher]]'"; |
#$m->out($curSQL); |
$sth = $dbh->prepare($curSQL); |
$sth->execute($condition); |
} |
#$m->out(Dumper($curRow)); |
</%init> |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |
Added: svn:keywords |
+Author Date Id Revision |
\ No newline at end of property |
/trunk/html/FR_admin/F2_class/.sql.columnAs |
---|
1,0 → 0,0 |
%return('id,descshort,desclong,siteok,sitebad,sitefm,permision'); |
%return('id_strade,id_settore,km_da,km_a'); |
/trunk/html/FR_admin/F2_class/.access.profile |
---|
1,0 → 0,0 |
% return('[[usr_profile_gestion]]'); |
% return('[[usr_profile_admin]]'); |
/trunk/html/include/styles.css |
---|
212,7 → 212,7 |
} |
INPUT.DATE |
{ |
BEHAVIOR: url(/cms/include/DATE.htc); |
BEHAVIOR: url(/htdocs/include/DATE.htc); |
BORDER-RIGHT: #000000 0px solid; |
BORDER-TOP: #000000 0px solid; |
FONT-FAMILY: Verdana; |
224,7 → 224,7 |
} |
INPUT.LOGIN |
{ |
BEHAVIOR: url(/cms/include/LOGIN.htc); |
BEHAVIOR: url(/htdocs/include/LOGIN.htc); |
BORDER-RIGHT: #000000 0px solid; |
BORDER-TOP: #000000 0px solid; |
FONT-FAMILY: Verdana; |
236,7 → 236,7 |
} |
INPUT.PASS |
{ |
BEHAVIOR: url(/cms/include/PASS.htc); |
BEHAVIOR: url(/htdocs/include/PASS.htc); |
BORDER-RIGHT: #000000 0px solid; |
BORDER-TOP: #000000 0px solid; |
FONT-FAMILY: Verdana; |
248,7 → 248,7 |
} |
INPUT.CLASS |
{ |
BEHAVIOR: url(/cms/include/CLASS.htc); |
BEHAVIOR: url(/htdocs/include/CLASS.htc); |
BORDER-RIGHT: #000000 0px solid; |
BORDER-TOP: #000000 0px solid; |
FONT-FAMILY: Verdana; |