#!/usr/local/bin/perl ###################################################### #Virtual Employment Agency # ver 5.0 - se ###################################################### # Copyright (c) 2000 e-Business Solutions. All Rights Reserved # www.biz-on-line.com # sid@biz-on-line.com ###################################################### require 'jobs.cfg'; require 'jobs.pl'; use CGI; $query = new CGI; $this_path = &get_path_info; $script_ref = $ENV{"HTTP_REFERER"}; if ($script_ref =~ /\/$/) { chop ($script_ref)}; if ($query->cookie(-name=>'mainlogin') eq 'admin') {$user = 1} else {$user = 0}; $script_mode = $query->param('mod'); if ($query->param('komis_ref')) { $script_reference = $query->param('komis_ref'); } else { $script_reference = $script_ref; } if ($query->param('action') eq 'kom_insert') { &staff_insert; } elsif ($query->param('action') eq 'kom_edit') { &staff_edit; } else { # $this_path =~ s/\/staff$//; %tags = &get_bib_info_komis($staff_root.$this_path); %params = &get_params(%tags); $type = $tags{'Type'}; @inc_list = &verify_list("$staff_root$this_path",$life_time); @sections_list = &get_inc_link_sections("$staff_root$this_path",@inc_list); &get_html ($staff_root); } sub staff_list { local (@prod_list) = @_; @products_list=@prod_list if (@prod_list); if (@products_list) { # &full_search; print "
| ";
print "" if ($user);
print "$tags{'name'} "; print " $tags{'description'}"; if ($tags{'contacts'}) { print "Direct Line - ",$tags{'contacts'}; } # print ' '; if ($tags{'contacts'}) { print "e-mail - ",$tags{'user_email'},''; } print " |
| There are no Assignments in this folder |
|---|
| UNDER CONSTRUCTION - CHECK BACK SOON! |
|---|
";
print "
";
# if ($tags{'Type'} eq 'Group') {
# Реклама.ру
# } elsif ($tags{'Type'} eq 'Unit') {
# Реклама.ру
# }
print " |
END_TITLE
if ((!@sections_list) && ($user)) {
print '';
if ($tags{'Type'} eq 'Group') {
# In Group
print $query->startform("POST","$staff_url$this_path");
print $query->hidden('action','kom_insert');
print $query->submit('Add new');
print $query->endform;
print "or Click on the NAME | to EDIT or DELETE\n"; if (@inc_list) { # In Group (no Empty!) # print " ";
# print " | ";
print $query->startform("POST","$staff_url$this_path");
print $query->hidden('step','2');
print $query->hidden('Type','Group');
print $query->hidden('action','kom_edit');
} else {
# In Group (Empty)
print $query->startform("POST","$staff_url$this_path");
print $query->hidden('step','2');
print $query->hidden('Type','Group');
print $query->hidden('action','kom_edit');
print $query->submit('mod','del');
}
#print $query->submit('mod','edit');
print $query->endform;
print '';
} elsif ($tags{'Type'} eq 'Unit') {
# In Unit
print $query->startform("POST","$staff_url");
print $query->submit('Return');
print $query->endform;
print $query->startform("POST","$staff_url$this_path");
print $query->hidden('step','2');
print $query->submit('mod','edit');
print " ";
print $query->hidden('action','kom_edit');
print $query->submit('mod','del');
print $query->endform;
print '';
}
} elsif ($user) {
# ROOT
print '';
print $query->startform("POST","$staff_url$this_path");
print $query->hidden('step','2');
print $query->hidden('Type','Group');
print $query->hidden('action','kom_insert');
print $query->submit('Add New');
print $query->endform;
print ' | ';
}
print " | |
| "; if($i<10){ $lnk = '0'.$i; } else { $lnk = "$i"; } $tmp = $states{$lnk}; print "$tmp \ \ \ \n"; print " | \n","
"; # print "Select State
"; if ($temp_path) { $temp_path =~ s/\/+$//; @inc_temp_list = &verify_list("$staff_root$temp_path",$life_time); @temp_list = &get_inc_link_sections($temp_path,@inc_temp_list); } @temp_list = @sections_list unless (@temp_list); if (@temp_list) { print "\n"; print " \n"; foreach (@temp_list) { print "
\n","\n"," \n"; } print ""; print $_; print " \n","\n"; } return; } sub get_bib_info_komis { local($fullname) = @_; local(%tags,$key,$tmp,$level,$section,@params,$i); open(BIB, $fullname.'/BIB.TXT')||&err_handler("Can not open bib file $fullname : $!"); while ($tmp= ) { if ($tmp =~ /^%(.*)%/) { $key = $1; } else { chomp($tmp); $tmp =~ s/\r//g; if ($tmp) { if (($key eq 'description') || ($key eq 'must_skils') || ($key eq 'nice_skils') || ($key eq 'contacts') || ($key eq 'other_link')) { $tags{$key} .= $tmp."
\n"; } elsif (($key eq 'create time' ) || ($key eq 'rate')) { $tags{'Параметры'} .= $key."###".$tmp."\n"; $tags{$key} .= $tmp; } else { $tags{$key} .= $tmp; } } } }#wile close(BIB); return %tags; } sub get_inc_link_products_komis { local($this_path,$sortparam,$sort_type,@inc_list) = @_; local(%tags,%params,$tmp,$temp,@product_list,$sort_par); if ($sortparam eq 'date') {$sort_par = 'create time'} else {$sort_par = $sortparam} foreach $nextname (@inc_list) { %tags = &get_bib_info_komis($staff_root.$this_path.'/'.$nextname); %product_list = &get_inc_link_products(%tags); } return %product_list; } sub get_inc_link_products { # То же, что и get_inc_link_products_komis, только с готовым %tags local(%tags) = @_; %params = &get_params(%tags); $tmp = $tags{'Type'}; # $temp = $params{'job_type'}; $temp = $tags{'job_type'}; if (($tmp eq 'Unit') && ((!$sort_type) || ($sort_type eq $temp))) { # if ($tmp eq 'Unit'){ $product_sort_par{$nextname} = $params{$sort_par}; $product_dates{$nextname} = $params{'create time'}; $product_prices{$nextname} = $params{'rate'}; # OLD # # $product_types{$nextname} = $tags{'job_type'}; # NEW # $product_types{$nextname} = $job_type{$tags{'job_type'}}; $product_list{$nextname} = $tags{'name'}; } return %product_list; } # Скрипты _insert и _edit sub staff_edit { local ($action_name) = 'kom_edit'; local ($path_info) = $ENV{"PATH_INFO"}; if (($query->param('step') == 1) && ($query->param('name'))) { &print_headhtml(' '); $full_datadir_path = $staff_root.$ENV{"PATH_INFO"}; $prod_name = $query->param('name'); chdir($full_datadir_path) || die print_err("Can not open dir",$script_reference); while ($dir_current = <*>) { if (-d $dir_current) { open(BIBL,$dir_current.'/BIB.TXT') || die print_err("Can not open file",$script_reference); while () { chop; if ($_ eq '%name%') { last } } $_= ; chop; if (/^$prod_name/i) { %prod_list= (%prod_list,$dir_current,$_); } close(BIBL); } } } elsif ($query->param('step') == 2){ unless ($user) { print_err("You can not do it!
Press CANCEL!",$base_url); # &login; # LOGIN для Администратора } else { $full_datadir_path = $staff_root.$ENV{"PATH_INFO"}; chdir($full_datadir_path) || die print_err("Can't open dir $! ",$script_reference); ### TEST #&print_headhtml('Test page'); #print "User aproved"; # # $type = $tags{'Type'}; $type = $query->param('Type'); if ($query->param('mod') ne 'del') { ### TEST #print "Type $type
"; #print "Path $this_path
"; #print "Local $path_info
"; # # Если редактируем Название города, то одна форма: if ($type eq 'Group') { $staff_url .= $path_info; %bib = &get_bib_info ($staff_root.$this_path); &print_headhtml('Edit current Folder'); &print_addform($staff_url,$bib{'name'},'form','edit',$script_reference,'kom_insert'); # Если редактируем Job Position, то другая форма: } else { # %bib = &get_bib_info_komis ($staff_root.$this_path.'/'.$ENV{"PATH_INFO"}); %bib = &get_bib_info_komis ($staff_root.$this_path); chomp($bib{'description'}); &print_headhtml("Edit current Assignment "); print '
'; foreach $key_vol (keys %bib) { $bib{$key_vol} = &convert_bracket($bib{$key_vol},1) } &print_insertform($staff_url,$bib{'name'},$bib{'description'}, $bib{'Картинка'},$bib{'user_email'},$bib{'other_link'}, $bib{'rate'},$bib{'password'}, 'form',$script_mode,$script_reference,'kom_insert', $bib{'must_skils'},$bib{'nice_skils'},$bib{'contacts'},$bib{'job_type'},$bib{'create time'}); } # close(BIBL); } else { # Удаление директории -> if ($query->param('mod') eq 'del') close(BIBL); unlink("BIB.TXT") || die &print_err("Can't del file: $! ",$script_reference); unlink('ID'); chdir("..") || die &print_err("Can't up to dir",$script_reference); @deldirs = split(/\//,$ENV{"PATH_INFO"}); $deldir = pop(@deldirs); rmdir($deldir) || die &print_err("Can't del dir",$script_reference); @script_ref_arr = split(/\?/,$script_reference); $script_ref_arr[0] = substr($script_ref_arr[0],0,rindex($script_ref_arr[0],"/")); $script_reference = join ("?",@script_ref_arr); # $this_path = join("/",@deldirs); # &show_komis($this_path); print $query->redirect($script_reference); } } # unless ($user) } # IF param('step') == 1 or 2 } sub staff_insert { local ($action_name) = 'kom_insert'; local (@temp1); # Проверка Admin password if ($user) { # Данные уже введены? if ($query->param('reference') eq 'form') { $full_datadir_path = $staff_root.$ENV{"PATH_INFO"}; $full_datadir_path =~ s#\/\/#\/#; ### TEST #&print_headhtml('TesT'); #print $full_datadir_path; #exit; chdir($full_datadir_path) || die &print_err("Can't open directory $full_datadir_path: $! ", $script_reference); #================ if ($query->param('reference1') eq 'ins') { &dir_verify($bib_type,$bib_type_name) || die &print_err("Yon couldn't do this $bib_type,$bib_type_name!!!", $script_reference); # NEW Method opendir(CUR_DIR,$full_datadir_path); while ($nextname = readdir(CUR_DIR)) { if ((-d "$nextname")&&($nextname =~ /^\d/)) { $nextname =~ s/^0+//; @dirs=(@dirs,$nextname); } } close(CUR_DIR); # OLD Method # while (<*>) { # if (-d) { # s/^0+//; # @dirs=(@dirs,$_); # } # } @dirs = sort { $a<=>$b } @dirs; $dir_new = 1; foreach (@dirs) { if ($dir_new == $_) { $dir_new++; } else { last; } } for ($i=length($dir_new); $i < $staff_dir_num; $i++) { $dir_new = "0".$dir_new; } mkdir($dir_new,0777) || die &print_err("Cannot make dir $dir_new in:$! ", $script_reference); chdir($dir_new); open(BIBL,">./BIB.TXT") || die &print_err("Could not create file", $script_reference); # if ($query->param('Картинка') eq $image_def_string) {$query->delete('Картинка')}; &save_info_into_bib_file(1); ### TEST #&print_headhtml('TesT'); #print 'Param
'; #foreach $kew ($query->param){print '<'.$kew.'>';} #!! print "Объявление успешно добавлено !!!
"; $query->delete_all(); @temp1 = split(/\?/,$script_reference); $script_reference = $temp1[0].'/'.$dir_new; print $query->redirect($script_reference); } elsif ($query->param('reference1') eq 'edit') { # Обновление редактирования open(BIBL,">./BIB.TXT") || die &print_err("Could not create file", $script_reference); &save_info_into_bib_file(0); #!! print "Изменения сделанные в объявлении были приняты !!!"; $query->delete_all(); @temp1 = split(/\?/,$script_reference); $script_reference = $temp1[0]."?update=ok"; print $query->redirect($script_reference); } #================ # ADD NEW Name of CITY: # } elsif ($query->param('Type') eq 'Group') { # &print_headhtml('Administration. New Group.'); # &print_addform($staff_url,'','form','ins',$script_reference,$action_name); # Добавляем новое объявление в любую группу } else { &print_headhtml('Administration. New Assignment.'); &print_insertform($staff_url,'','',$image_def_string,'','','','', 'form','ins',$script_reference,$action_name); } } # end else if (password) } sub save_info_into_bib_file { local($crtime) = @_; local ($path_info) = $ENV{"PATH_INFO"}; if ($path_info =~ /\/$/) { chop ($path_info)}; unless ($type) {$type=$query->param('Type')}; $params{'create time'} = $query->param('create time') unless ($params{'create time'}); if ($type eq 'Unit') { print BIBL "%",$bib_type,"%\n"; # print BIBL $bib_type_tovname,"\n"; print BIBL $type,"\n"; # Обновлять ли параметр "время создания"? if ($crtime == 1) { print BIBL "%",$bib_time,"%\n"; print BIBL time,"\n"; } elsif ($crtime == 0) { print BIBL "%",$bib_time,"%\n"; print BIBL $params{'create time'},"\n"; # print BIBL $query->param('create time'),"\n"; $query->delete('Параметры') } } elsif ($type eq 'Group') { print BIBL "%",$bib_type,"%\n"; # print BIBL $bib_type_name,"\n"; print BIBL $type,"\n"; } else { print BIBL "Wrong DATA!!! \n"; print BIBL "%",$bib_type,"%\n"; print BIBL $bib_type_name,"\n"; } foreach $key ($query->param) { unless ($key =~ /^(repassword|reference|old_pass|komis_ref|action|Type|create time|state)/) { print BIBL "%",$key,"%\n"; print BIBL &convert_bracket($query->param($key),0),"\n"; } } close(BIBL); } sub dir_verify { local($bib_type,$bib_type_name) = @_; open(BIBL,"./BIB.TXT") || die &print_err("Could not open file", $script_reference); while () { chomp; $_ =~ s/%(.*)%/$1/g; if ($_ eq $bib_type) { last } } $_= ; chomp; close(BIBL); ($_ eq $bib_type_name) } sub convert_bracket { local($str,$direct) = @_; unless ($direct) { $str =~ s/\</g; $str =~ s/>/\>/g; } else { $str =~ s/\<//g; $str =~ s/\<//g; } return $str; } # Скрипт Print_html.pl sub print_headhtml { local($html_title) = @_; print $query->header; $html_title = 'Direct Marketing Resources - Focusing exclusively in the Direct Marketing industry - Account Management, Database Marketing, DB Research & Analysis, Creative, Sales and Internet / Interactive Marketing' unless $html_title; print $query->start_html(-title=>$html_title, -style=>{'src'=>$images_path.'/employ.css'}, -meta=>{'keywords'=>$title_keywords, 'Web-Developer'=>'Oleg Sidorenko', 'Reply-to'=>'sid@biz-on-line.com', 'WEB'=>'http://www.biz-on-line.com', 'description'=>"$title_description", 'Copyright'=>'e-Busines Solutions'}, -BGCOLOR=>'#FFFFFF', -topmargin=>0, -leftmargin=>0); # # # print " "; # print &get_dyn_recl('banner1'); # print "
";### /banner } sub print_addform { local($staff_url,$bib_name_def,$reference_def,$reference1_def,$reference2_def,$action_name) = @_; print "",$query->startform('POST',$staff_url),"\n"; print "Type NEW Name of CITY: "; } sub print_insertform { local($staff_url,$product_def,$description_def,$image_url_def, $contact_email_def,$other_contact_def,$rate_def,$password_def, $reference_def,$reference1_def,$reference2_def,$action_name, $must_skils_def,$nice_skils_def,$contacts_def,$job_type_def,$create_time_def) = @_; $description_def =~ s#
\n", $query->textfield('name',$bib_name_def,60,60),"\n"; print $query->hidden(-name=>'action', -default=>$action_name, -override=>1); print $query->hidden('reference',$reference_def),$query->hidden('reference1',$reference1_def), $query->hidden('komis_ref',$script_reference); $query->param('Type','Group'); print $query->hidden('Type'); print "
",$query->submit("",' Submit ')," \n"; print "",$query->reset('Erase')," "; print $query->endform; print $query->startform(-action=>''),"\n"; print "",$query->submit("",'Cancel')," \n"; print $query->endform; print ""; print "
If you want to add or edit Assignment
press CANCEL and SELECT CITY first.
##g; $contacts_def =~ s#
##g; $other_contact_def =~ s#
##g; $refno_def =~ s#
##g; $client_def =~ s#
##g; $city_def =~ s#
##g; $search_code_def =~ s#
##g; ### TEST $bib{'refno'}; ## print "Type ->> ",$type; ## print "
Time - >> ",$create_time_def; ## print "
Type param->> ", $query->param('Type'); ## print "
Action ->> ",$query->param('action'); print <
Manager
END_TITLE $staff_url .= $ENV{"PATH_INFO"}; print $query->startform('POST',$staff_url),"\n"; print " Full name: \n", $query->textfield('name',$product_def,60,60)," \n"; print "
\n"; print "Description:
\n", $query->textarea('description',$description_def,10,70),"\n"; # print "Ссылка на изображение товара:
\n",$query->textfield( # -name=>'Картинка', # -default=>$image_url_def, # -size=>52),"\n"; # print "
Job type: \n"; print "Contact information:
\n",,$query->textarea('contacts',$contacts_def,5,36),"\n"; print "E-mail for upload Resume:
\n",$query->textfield('user_email',$contact_email_def,36,36),"\n"; print "Password:
\n",$query->textfield('password',$password_def,36,36),"\n"; # print "Повторите пароль:
\n",$query->password_field('repassword',$password_def,52,20),"\n"; print $query->hidden(-name=>'action', -default=>$action_name, -override=>1); print $query->hidden('reference',$reference_def),$query->hidden('reference1',$reference1_def), $query->hidden('komis_ref',$reference2_def); $query->param('Type','Unit'); print $query->hidden('Type'); print $query->hidden('create time',$create_time_def); # print $query->hidden('old_pass',$password_def) if ($reference1_def eq 'edit'); print "
"; print " "; print <
",$query->submit("",' Submit ')," \n"; print "",$query->reset('Erase')," "; print $query->endform; print $query->startform(-action=>$reference2_def),"\n"; print "",$query->submit("",'Cancel')," \n"; print $query->endform; print "