home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
- # search for specific pavilion
- # parameters: info to look at
-
- # Philippe T., 07 /08 /96
-
- #----------------------------------------
- # Global Variables
- #----------------------------------------
-
-
- #======== TO BE MODIFIED
- $defaultlocation="/cp/htdocs/";
- $defaultcp="/usr/bin/cp";
-
- $dbf_file="/cp/htdocs/Scripts/votedbf.dbf";
- $ftheme_dic=$defaultlocation."Scripts/theme_dic.txt";
- $fregion_dic=$defaultlocation."Scripts/country_dic.txt";
- $datab_file=$defaultlocation."Scripts/fulldbf.dbf";
- $datab_new=$defaultlocation."Scripts/fulldbf.NEW.dbf";
- $log_file=$defaultlocation."Scripts/output_errors.log";
- $log_add_theme=$defaultlocation."Scripts/add_log_theme.log";
- $log_add_region=$defaultlocation."Scripts/add_log_region.log";
- $log_label=$defaultlocation."Scripts/labels.log";
- $catalog_file=$defaultlocation."Scripts/theme_catalog.dbf";
- $World=$defaultlocation."Pavilions/People/World/";
-
- #=========== Global Variables
- $pav_name="";
- $description="";
- $url="";
- $theme="";
- $country="";
- $label="";
- $where_theme="";
- $where_region="";
- $where_people="";
- $email="";
- $side="";
- $size="224";
- $postcard="";
- @database="";
- @theme_dic="";
- @region_dic="";
- @people_dic="";
- @catalog="";
-
- open (CAT, $catalog_file) ||die "could not open catalog file\n";
- $datab_file=$ARGV[0];
- @catalog=<CAT>;
- close(CAT);
-
- $toto=$ARGV[0];
- $toto=~tr/A-Z/a-z/;
- print "+++++++++++++++ARGUMENTS:$toto\n";
- &open_dictionnary();
- &go();
-
-
-
- sub go {
- local($temp);
- $temp="";
-
- open (DICT,$dbf_file) || die "Oups, could not open the labels : $dbf_file $!\n";
- while ($temp = <DICT>)
- {
- chop($temp);
- $tempo=$temp;
- $tempo=~tr/A-Z/a-z/;
- if($tempo=~/$toto/) { &list_to_name($temp); &print_info();}
- }
- close(DICT);
- }
-
-
-
-
-
-
- sub list_to_name {
- local($string)=@_;
- local($d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$d10,$d11,$d12)=split(/#/,$string,12);
- $pav_name=&ba_space($d1);
- $description=&ba_space($d2);
- $url=&ba_space($d4);
- $theme=&ba_space($d6);
- $country=&ba_space($d8);
- $email=&ba_space($d11);
- $label=&do_label($pav_name);
- $label="/Images/Labels/".$label.".jpg";
- $where_theme=$defaultlocation."Pavilions/".$theme_dic{$theme};
- $where_region=$defaultlocation.$region_dic{$country};
- $where_people=$defaultlocation.$people_dic{$country};
- }
-
-
- sub ba_space {
- local($string)=@_;
- while (($last=chop($string)) eq ' ' ) { }
- $string=$string.$last;
- while ($string=~/^ /) { $string=substr($string,1,length($string)); }
- $string;
- }
-
- sub do_label {
- local($string)=@_;
- $string=&ba_space($string);
- $string=~ s/"//g;
- $string=~ tr/A-Z/a-z/;
- $string=~ s/ /_/g;
- $string=~ s/'//g;
- $string=~ s/`//g;
- $string=~ s/~//g;
- $string=~ s/\&//g;
- $string=~ s/\+//g;
- $string=~ s/\,//g;
- $string=~ s/\(//g;
- $string=~ s/\)//g;
- $string=~ s/\.//g;
- $string=~ s/\:/_/g;
- $string=~ s/\*//g;
- $string=~ s/\//_/g;
- $string=~ s/\-/_/g;
- $string=~ s/__/_/g;
- $string;
- }
-
-
- sub print_info {
- print "Pav Name:$pav_name\n";
- print "Descripi:$description\n";
- print "URL :$url\n";
- print "THEME :$theme\n";
- print "Country :$country\n";
- print "Email :$email \n";
- print "++++++++Info generated++++++:\n";
- $side="1";
- &check_label($label);
- if ($country eq "United States") {
- $char=substr($pav_name,0,1);
- $char=~tr/a-z/A-Z/;
- if ($char =~ /[A-E]/) { $dir=$defaultlocation."UnitedStates/A_E/"; }
- if ($char =~ /[F-J]/) { $dir=$defaultlocation."UnitedStates/F_J/"; }
- if ($char =~ /[K-N]/) { $dir=$defaultlocation."UnitedStates/K_N/"; }
- if ($char =~ /[O-R]/) { $dir=$defaultlocation."UnitedStates/O_R/"; }
- if ($char =~ /[S-V]/) { $dir=$defaultlocation."UnitedStates/S_V/"; }
- if ($char =~ /[W-Z]/) { $dir=$defaultlocation."UnitedStates/W_Z/"; }
- $where_region=$dir;
- }
-
- print "Label :$label ACTUALL SIDE:$side\n";
- print "dir Them:$where_theme\n";
- print "dir regi:$where_region\n";
- if ($theme eq "people" ){
- print "dir peop:$where_people\n";}
- print "=======================================================\n";
- }
-
- sub check_label {
- local($nom)=@_;
- local($i)=0;
- local($sideLR)="1";
- $i=0;
- while ((!($catalog[$i]=~/$nom/)) && ($i<=$#catalog)) {$i++;}
- if ($catalog[$i]=~/$nom/)
- {
- #print "FOUND OK $catalog[$i]\n";
- local($d1,$d2,$d3,$d4,$d5,$d6,$d7)=split(/#/,$catalog[$i],7);
- #$sideLR=$d5;
- $side=$d6;
- }
- else
- {
- print "PROBLEM WITH LABEL NOT FOUND or MISS NAMED\n";
- }
- #$sideLR;
- $side;
- }
-
-
- sub open_dictionnary{
- local($temp);
- open (DICT,$ftheme_dic) || die "Oups, could not open the theme dictionnary: $fth
- eme_dic $!\n";
- $temp="";
- while ($temp = <DICT>)
- {
- chop($temp);
- local($name_datab,$location,$url_name)=split(/#/,$temp,3);
- #print "DIC: $name_datab,$location,$url_name\n";
- $theme_dic{$name_datab}=$location;
- }
- close (DICT);
- #print "Ok, I've got the info I need from the theme dictionnary!, now opening the regions....\n";
- open (DICT,$fregion_dic) || die "Oups, could not open the region dictionnary: $fregion_dic $!\n";
- $temp="";
- while ($temp = <DICT>)
- {
- chop($temp);
- local($t1,$t2,$t3,$t4,$t5,$t6,$t7)=split(/#/,$temp,7);
- #print "DIC REGION : $t1,$t2,$t5,$t6,$t7\n";
- $region_dic{$t1}=$t2;
- $people_dic{$t1}=$t5;
- }
- close(DICT);
- #print "Ok, I've got almost everything I need.....\n";
- #print "let's go......\n";
- }
-
-