mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-22 19:56:29 +01:00
Service-config save_template_desc
This commit is contained in:
parent
de85786bc0
commit
89e28f308f
8 changed files with 110 additions and 36 deletions
|
@ -164,7 +164,7 @@ sub handler {
|
|||
owner => "$owner",
|
||||
int01 => $q->escapeHTML($xmlref->{userID}),
|
||||
};
|
||||
my $rows = $dbt->update_record($dbh,$update,$record);
|
||||
my $rows = $dbt->update_record($dbh,$update,$record_e);
|
||||
|
||||
}elsif($xmlref->{todo} eq "update_LVuser" && $record->{c_id}){
|
||||
|
||||
|
|
|
@ -494,14 +494,20 @@ sub radiobox(){
|
|||
#$but->radiobox2("$key","$ctrel->{$key}","$a","$b","$c")
|
||||
sub radiobox2(){
|
||||
my $self = shift;
|
||||
my ($key,$val,$a_name,$b_name,$c_name) = @_;
|
||||
my $a_checked;
|
||||
my $b_checked;
|
||||
my $c_checked;
|
||||
my $key = shift;
|
||||
my $val = shift;
|
||||
my $a_name = shift || "";
|
||||
my $b_name = shift || "";
|
||||
my $c_name = shift || "";
|
||||
my $a_checked = "";
|
||||
my $b_checked = "";
|
||||
my $c_checked = "";
|
||||
$a_checked = "checked" if(!$val);
|
||||
$b_checked = "checked" if($val==1);
|
||||
$c_checked = "checked" if($val==2);
|
||||
my $checkb = "$a_name <input type='radio' name='$key' value='0' $a_checked> $b_name <input type='radio' name='$key' value='1' $b_checked>";
|
||||
my $checkb = "";
|
||||
$checkb .= " $a_name <input type='radio' name='$key' value='0' $a_checked>" if($a_name);
|
||||
$checkb .= " $b_name <input type='radio' name='$key' value='1' $b_checked>" if($b_name);
|
||||
$checkb .= " $c_name <input type='radio' name='$key' value='2' $c_checked>" if($c_name);
|
||||
return $checkb;
|
||||
}
|
||||
|
|
|
@ -841,9 +841,13 @@ sub update_one(){
|
|||
if($update->{table} eq "relation" && $update->{rel_id}){
|
||||
$where = "where rel_id = $update->{rel_id}";
|
||||
}
|
||||
if($update->{table} eq "template" && $update->{tpl_id}){
|
||||
$where = "where tpl_id = $update->{tpl_id}";
|
||||
}
|
||||
|
||||
|
||||
my $one = $one_in;
|
||||
if($update->{table} =~ /^users|relation|node/){
|
||||
if($update->{table} =~ /^users|relation|node|template/){
|
||||
$one .= ",change='now()'";
|
||||
}else{
|
||||
$one .= ",mtime='now()'";
|
||||
|
|
|
@ -147,7 +147,7 @@ sub handler {
|
|||
};
|
||||
$dbt->update_one($dbh,$update_users,"cookie='$coo'") if($users_dms->{u_id});
|
||||
|
||||
print redirect("$varenv{wwwhost}$path");
|
||||
print redirect("$varenv{wwwhost}");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ sub handler {
|
|||
}elsif($R::rel_edit eq "new_relation" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pl->new_relation($R::main_id,$users_dms->{u_id});
|
||||
}elsif($R::rel_edit eq "save_ctuser" && $R::main_id && $R::main_id >= 200000){
|
||||
$return = "failure::under development, $node_meta->{tpl_name}";
|
||||
#$return = $pl->save_service_desc($users_dms);
|
||||
#$return = "failure::under development, $node_meta->{tpl_name}";
|
||||
$return = $pl->save_service_desc($R::c_id,$users_dms);
|
||||
}elsif($R::rel_edit && $R::main_id && $R::main_id >= 200000){
|
||||
$return = $pm->maininit($users_dms);
|
||||
}
|
||||
|
|
|
@ -458,24 +458,51 @@ sub set_usertarif {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
#save service-config
|
||||
sub save_service_desc {
|
||||
my $self = shift;
|
||||
my $c_id = shift;
|
||||
my $users_dms = shift;
|
||||
my @keywords = $q->param;
|
||||
my $dbh = "";
|
||||
my $c_tplid = {c_id => $c_id};
|
||||
my $update_ctuser = {
|
||||
table => "contentuser",
|
||||
template_id => "199",
|
||||
mtime => "now()",
|
||||
owner => "$users_dms->{u_id}",
|
||||
};
|
||||
|
||||
my @tpl_desc = ();
|
||||
my $update_template = {
|
||||
table => "template",
|
||||
tpl_id => "$c_id",
|
||||
owner => "$users_dms->{u_id}",
|
||||
};
|
||||
|
||||
open(FILE,">>$varenv{logdir}/save_service_desc.log") if($debug);
|
||||
print FILE "\n*Prelib--> $now_dt | ctpl_id $c_id | owner: $users_dms->{u_id}\n" if($debug);
|
||||
|
||||
my $tpl_order_desc = "c_id=ID=4=0=0,mtime=Zeitstempel=6=0=0,owner=von=3=0=0,barcode=Rad=3=0=0,txt01=Aufgaben=area5-8=0=0";
|
||||
foreach(@keywords){
|
||||
my @val = $q->param($_);
|
||||
my $valxx = $q->escapeHTML("@val");
|
||||
|
||||
if($_ =~ /txt\d/){
|
||||
print $_ . ":" . $valxx . "<br>\n";
|
||||
#@tpl_desc = $q->param($_);
|
||||
$valxx =~ s/\s/=/g;
|
||||
print FILE $_ . ":" . $valxx . "<br>\n";
|
||||
#txt01:int01=Reifen-Bremse-Lampe=checkbox=10=2
|
||||
if($_ =~ /txt\d+/ && $valxx =~ /int\d+=\w+/){
|
||||
$update_ctuser->{$_} = "$valxx";
|
||||
$tpl_order_desc .= ",$valxx";
|
||||
}
|
||||
}
|
||||
#my $tpl_obj = join('=',@tpl_desc);
|
||||
#print $tpl_obj . "<br> \n";
|
||||
print FILE "update contentuser c_id:$c_id\n" . Dumper($update_ctuser) . "\n";
|
||||
print FILE "update template tpl_id:$c_id\n" . $tpl_order_desc . "\n";
|
||||
|
||||
my $rows = 0;
|
||||
$rows = $dbt->update_record($dbh,$update_ctuser,$c_tplid);
|
||||
$rows = $dbt->update_one($dbh,$update_template,"tpl_order='$tpl_order_desc'");
|
||||
|
||||
close(FILE) if($debug);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -726,6 +726,8 @@ sub save_transact(){
|
|||
my $cttpos = { c_id => 0 };
|
||||
$cttpos = $dbt->collect_post($dbh_operator,$posref);
|
||||
|
||||
#for now used only for LNdW
|
||||
if($operator_conf->{database}->{dbname} eq "sharee_kn"){
|
||||
#check if user has still coupon used
|
||||
if(!$cttpos->{c_id}){
|
||||
if($ctt->{c_id} > 0){
|
||||
|
@ -738,6 +740,7 @@ sub save_transact(){
|
|||
}else{
|
||||
$ret = "failure::conflict_txt16#top";
|
||||
}
|
||||
}
|
||||
|
||||
if($pos_id){
|
||||
$ret = "success::txt16";
|
||||
|
|
|
@ -187,7 +187,7 @@ sub tpl(){
|
|||
print $but->singlesubmit7("rel_edit","$relate_key","$ib{$relate_key}","margin:0 5px;");
|
||||
print $but->singlesubmit7("rel_edit","$move_key","$ib{$move_key}","margin:0 5px;");
|
||||
print $but->singlesubmit7("rel_edit","$copy_key","$ib{$copy_key}","margin:0 5px;");
|
||||
print $but->singlesubmit7("$edit","remove_chk4rel","$ib{remove_chk4rel}","margin:0 5px;");
|
||||
print $but->singlesubmit7("$edit","remove_chk4rel","$ib{remove_chk4rel}","margin:0 5px;") if($node_meta->{tpl_id} != 199);
|
||||
|
||||
#print $q->div({-style=>'position:fixed;bottom:2%;right:1%;z-index:10;font-size:13px;'}," (c_id: $ctrel->{c_id} | rel_id: $ctrel->{rel_id} | tpl_id: $ctrel->{template_id} / $edit_template)"),"\n" if($users_dms->{u_id} eq $varenv{superu_id});
|
||||
print "</td>\n";
|
||||
|
@ -271,21 +271,35 @@ EOF
|
|||
my @_service_valxx = ("","1","2","3","4");
|
||||
|
||||
foreach (@tpl_order){
|
||||
$j++;
|
||||
if($tpl->{tpl_id} == 199){
|
||||
if($j==1){
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'content1_cms',-colspan=>3},$q->b("under development, $tpl->{tpl_name}")),"\n";
|
||||
}
|
||||
my ($key,$tplkey,$des,$size,$service_interval,$service_type) = split /=/,$_;
|
||||
$des = " ($key:$tplkey)" if($users_dms->{u_id} eq $varenv{superu_id});
|
||||
if($key =~ /txt\d/ && $tplkey =~ /int\d/){
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'content1_cms'},"Wartung $des",$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"$key", -default=>"")),"\n";
|
||||
print $q->td({-class=>'content1_cms'},"Intervall",$q->textfield(-class=>'etxt', -style=>"width:2em;",-name=>"$key", -default=>""),"Tage"),"\n";
|
||||
print $q->td({-class=>'content1_cms'},$but->radiobox2("$key","$ctrel->{$key}","aus","weich","hart")),"\n";
|
||||
|
||||
#service-config
|
||||
if($tpl->{tpl_id} == 199){
|
||||
my ($key,$tplkey,$des,$size,$service_interval,$service_type) = split /=/,$_;
|
||||
$ctrel->{$key} = $q->unescapeHTML("$ctrel->{$key}");
|
||||
$ctrel->{$key} = $lb->newline($ctrel->{$key},"",1);
|
||||
|
||||
if($key =~ /ct_name/){
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'content1_cms',-colspan=>3},$q->b("$ctrel->{ct_name}")),"\n";
|
||||
}
|
||||
elsif($key =~ /txt\d/ && $tplkey =~ /int\d/){
|
||||
$j++;
|
||||
my $desc_num = "$des $j";
|
||||
$desc_num .= " ($key:$tplkey)" if($users_dms->{u_id} eq $varenv{superu_id});
|
||||
my $desc_key = "";
|
||||
my $desc_name = "";
|
||||
my $desc_size = "";
|
||||
my $desc_intervall = "";
|
||||
my $desc_type = "";
|
||||
($desc_key,$desc_name,$desc_size,$desc_intervall,$desc_type) = split(/=/,$ctrel->{$key});
|
||||
print $q->Tr();
|
||||
print $q->hidden(-name=>"$key",-override=>1,-value=>"$tplkey"),"\n";
|
||||
print $q->td({-class=>'content1_cms'},"$desc_num",$q->textfield(-class=>'etxt', -style=>"width:15em;",-name=>"$key", -default=>"$desc_name")),"\n";
|
||||
print $q->hidden(-name=>"$key",-override=>1,-value=>"checkbox"),"\n";
|
||||
print $q->td({-class=>'content1_cms'},"Intervall",$q->textfield(-class=>'etxt', -style=>"width:2em;",-name=>"$key", -default=>"$desc_intervall"),"Tage"),"\n";
|
||||
print $q->td({-class=>'content1_cms'},$but->radiobox2("$key","$desc_type","","weich","hart")),"\n";
|
||||
}
|
||||
|
||||
}else{
|
||||
my ($key,$des,$size,$postdes) = split /=/,$_;
|
||||
my $seldes = $des;
|
||||
|
|
|
@ -277,7 +277,7 @@ EOF
|
|||
$e_mtime = $searchref->{end_date_time};
|
||||
}
|
||||
|
||||
print $q->td({-nowrap=>1,-class=>"search_line"},$q->textfield(-id=>'datepicker1',-class=>'etxt',-name=>"s_start_$key",-default=>"$s_mtime",-size=>"$size",-maxlength=>20),"-",$q->textfield(-id=>'datepicker2',-class=>'etxt',-name=>"s_end_$key",-default=>"$e_mtime",-size=>"$size", -maxlength=>20)),"\n" if($key =~ /time/);
|
||||
print $q->td({-nowrap=>1,-class=>"search_line"},$q->textfield(-id=>'datepicker1',-class=>'etxt',-name=>"s_start_$key",-default=>"$s_mtime",-size=>"11",-maxlength=>10),"-",$q->textfield(-id=>'datepicker2',-class=>'etxt',-name=>"s_end_$key",-default=>"$e_mtime",-size=>"11", -maxlength=>10)),"\n" if($key =~ /time/);
|
||||
}#end Search-fields
|
||||
}
|
||||
|
||||
|
@ -307,9 +307,18 @@ EOF
|
|||
#$sort_down = "<b>$sort_down</b>" if($users_dms->{sort_updown} eq "down");
|
||||
#print $q->th($q->a({-class=>"sortnav",-href=>"?sort_updown=up\&offset=$offset\&limit=$limit",-title=>'Aufsteigend sortieren'},"$sort_up"),"|",$q->a({-class=>"sortnav",-href=>"?sort_updown=down\&offset=$offset\&limit=$limit",-title=>'Absteigend sortieren'},"$sort_down")),"\n";
|
||||
|
||||
my $j = 0;
|
||||
foreach (@tpl_order){
|
||||
my ($key,$val,$size,$interval) = split /=/,$_;
|
||||
|
||||
my $divstyle = "";
|
||||
if($node_meta->{tpl_id} == 199 && $val =~ /int\d+/){
|
||||
$j++;
|
||||
my $val_head = $val;
|
||||
$val = "Wartung $j";
|
||||
$val .= " ($val_head)" if($users_dms->{u_id} eq $varenv{superu_id});
|
||||
$divstyle = "width:100px;white-space:nowrap;";
|
||||
}
|
||||
if($size =~ /checkbox/){
|
||||
$size = 2;
|
||||
$divstyle = "width:20px;white-space:nowrap;overflow:hidden;";
|
||||
|
@ -351,7 +360,6 @@ EOF
|
|||
}
|
||||
my $k=0;
|
||||
foreach (@tpl_order){
|
||||
$k++;
|
||||
my ($key,$val,$size) = split /=/,$_;
|
||||
$size = 15 if($size =~ /area/);
|
||||
$size = 2 if($size =~ /checkbox/);
|
||||
|
@ -375,11 +383,14 @@ EOF
|
|||
$u_name = $ct_users->{$ctu_id}->{txt01};
|
||||
}
|
||||
}
|
||||
|
||||
#$u_name = $ct_users->{$ct4rel->{$id}->{$key}}->{txt01} || $ct4rel->{$id}->{$key};
|
||||
print $q->td({-class=>"$tdclass",-style=>"$tdstyle $set_style"},"$u_name"),"\n";
|
||||
}elsif($key eq "ct_name" && $node_meta->{ct_table} eq "contentuser"){
|
||||
print $q->td({-class=>"$tdclass",-style=>"$tdstyle $set_style"},$q->a({-class=>"linknav3",-href=>"?node2edit=editpart\&c_id=$ct4rel->{$id}->{c_id}",-title=>"edit"},"$ct4rel->{$id}->{$key}")),"\n";
|
||||
|
||||
}elsif($key eq "ct_name" && $node_meta->{ct_table} eq "contentuser" && $node_meta->{tpl_id} == 199){
|
||||
my $spec_style = "";
|
||||
$spec_style = "min-width:140px;";
|
||||
print $q->td({-class=>"$tdclass",-style=>"$tdstyle $spec_style"},$q->a({-class=>"linknav3",-href=>"?node2edit=editpart\&c_id=$ct4rel->{$id}->{c_id}",-title=>"edit"},"$ct4rel->{$id}->{$key}")),"\n";
|
||||
|
||||
}elsif($key eq "barcode" && $node_meta->{ct_table} eq "contentadrpos"){
|
||||
print $q->td({-class=>"$tdclass",-style=>"$tdstyle $set_style"},$q->a({-class=>"linknav3",-href=>"$varenv{wwwhost}/DMS/Waren/?detail_search=1\&s_barcode=$ct4rel->{$id}->{barcode}",-title=>"zum Rad "},"$ct4rel->{$id}->{barcode}")),"\n";
|
||||
|
||||
|
@ -401,6 +412,15 @@ EOF
|
|||
print $q->td({-class=>"$tdclass",-style=>"$tdstyle $set_style",-nowrap=>1},"$dbt->{copri_conf}->{permission}->{$ct4rel->{$id}->{$key}}"),"\n";
|
||||
}elsif($key =~ /int09/ && $node_meta->{ct_table} eq "users"){
|
||||
print $q->td({-class=>"$tdclass",-style=>"$tdstyle $set_style",-nowrap=>1},"$dbt->{copri_conf}->{access}->{$ct4rel->{$id}->{$key}}"),"\n";
|
||||
}elsif($key =~ /txt\d+/ && $node_meta->{tpl_id} == 199){
|
||||
my $tpl_desc = $ct4rel->{$id}->{$key};
|
||||
$tpl_desc =~ s/^int\d+=//;
|
||||
$tpl_desc =~ s/=checkbox=(\d+)/\<br \/\>$1 Tage Intervall/;
|
||||
$tpl_desc =~ s/=1/\<br \/\>Typ weich/;
|
||||
$tpl_desc =~ s/=2/\<br \/\>Typ hart/;
|
||||
my $spec_style = "";
|
||||
$spec_style = "min-width:140px;" if($tpl_desc);
|
||||
print $q->td({-class=>"$tdclass",-style=>"$tdstyle $spec_style"},"$tpl_desc"),"\n";
|
||||
}else{
|
||||
print $q->td({-class=>"$tdclass",-style=>"$tdstyle $set_style"},"$ct4rel->{$id}->{$key}"),"\n";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue