1 package breadcrumbs
::Controller
::Help
;
5 use breadcrumbs
::Controller
::BcController
;
6 use base
'breadcrumbs::Controller::BcController';
12 breadcrumbs::Controller::Help - Catalyst Controller
28 my ( $self, $c ) = @_;
30 $c->stash->{template
} = "map_of_documentation.tt";
33 sub who_we_are
: Local
{
34 my ( $self, $c ) = @_;
35 $c->stash->{template
} = "who_we_are.tt";
38 sub record_this_answer
{
39 my ($current_question, $current_answer, $list_of_faqs) = @_;
40 my $quest = $$current_question;
41 my $answ = $$current_answer;
42 my @faq = ($quest, $answ);
43 push(@
{$list_of_faqs}, \
@faq);
45 $$current_question = "";
46 $$current_answer = "";
48 # print "<!-- REGISTRO LA DOMANDA \n";
49 # print Dumper($list_of_faqs);
55 my ( $self, $c ) = @_;
57 my $config = $c->config();
58 $c->stash->{config
} = $config;
59 my $faq_file = $config->{home
} . "/root/src/breadcrumbs-faq";
61 open (INFILE
, "<$faq_file") or die "Non trovo il file delle domande $faq_file!\n";
63 # if ($ENV{"TEST_DB"}){
65 # #open (INFILE, "<root/src/breadcrumbs-faq") or die "Non trovo il file delle domande in debug!\n";
66 # open (INFILE, "<$faq_file") or die "Non trovo il file delle domande in debug!\n";
68 # open (INFILE, "</var/www/bc/web-site/breadcrumbs/root/src/breadcrumbs-faq") or die "Non trovo il file delle domande!\n";
72 #ok, now I read this file
73 my $READING_SECTION = 0;
74 my $READING_QUESTION = 1;
75 my $READING_ANSWER = 2;
76 my $INITIAL_STATE = 3;
78 my $state = $INITIAL_STATE;
89 # print "<!-- NUOVA RIGA $_ -->\n";
90 # print "<!-- per ora la mia hash vale \n";
91 # print Dumper(\%faqs);
92 # print "\n ed il vettore vale : \n";
93 # print Dumper(\@current_faqs);
98 if ($state == $READING_ANSWER){
99 #Ok, I was reading an answer, I should push it
100 record_this_answer
(\
$current_question, \
$current_answer, \
@current_faqs);
102 #I should finish the section...
103 my @temp = @current_faqs;
104 #$faqs{$current_section} = \@temp;
105 my @temp_vec = ($current_section, \
@temp);
106 push (@faqs, \
@temp_vec);
108 #print "<!-- registro la sezione $current_section \n";
114 $state = $READING_SECTION;
117 if ($state == $READING_ANSWER){
118 #Ok, I was reading an answer, I should push it
119 record_this_answer
(\
$current_question, \
$current_answer, \
@current_faqs);
121 $state = $READING_QUESTION;
124 $state = $READING_ANSWER;
128 #ok, I don't have a control section
129 if ($state == $READING_SECTION){
131 $current_section = $_;
132 } elsif ($state == $READING_QUESTION){
134 $current_question .= "<p>";
137 $current_question .= $_;
138 } elsif ($state == $READING_ANSWER){
139 $current_answer .= $_;
141 $current_answer .= "<p>";
148 if ($state == $READING_ANSWER){
149 #OK, I should register the answer and the section
150 record_this_answer
(\
$current_question, \
$current_answer, \
@current_faqs);
152 my @temp = @current_faqs;
153 my @temp_vec = ($current_section, \
@temp);
154 push (@faqs, \
@temp_vec);
159 $c->stash->{faqs
} = \
@faqs;
160 $c->stash->{template
} = "faq.tt";
164 my ( $self, $c ) = @_;
165 $c->stash->{template
} = "release.tt";
169 my ( $self, $c ) = @_;
170 $c->stash->{template
} = "licence_and_conditions.tt";
173 sub fake_users
: Local
{
174 my ( $self, $c ) = @_;
175 $c->stash->{template
} = "fake_users.tt";
178 sub breadcrumb_and_gpg
: Local
{
179 my ( $self, $c ) = @_;
180 $c->stash->{template
} = "breadcrumb_and_gpg.tt";
185 my ( $self, $c) = @_;
189 breadcrumbs
::util
::MenuUtils
->add_menu_entry('licence', 'Licenza', \
@menu, $c);
190 breadcrumbs
::util
::MenuUtils
->add_menu_entry('breadcrumb_and_gpg', 'Sicurezza', \
@menu, $c);
191 breadcrumbs
::util
::MenuUtils
->add_menu_entry('faq', 'FAQ', \
@menu, $c);
192 breadcrumbs
::util
::MenuUtils
->add_menu_entry('/bcd-doc', 'Manuale', \
@menu, $c);
193 breadcrumbs
::util
::MenuUtils
->add_menu_entry('/simplehelp', 'Schede', \
@menu, $c);
194 breadcrumbs
::util
::MenuUtils
->add_menu_entry('/help/who_we_are', 'Chi siamo', \
@menu, $c);
195 breadcrumbs
::util
::MenuUtils
->add_menu_entry('/starthere', 'Inizia da qui', \
@menu, $c);
197 $c->stash->{"menu_items"} = \
@menu;
204 my ( $self, $c) = @_;
206 my $trails = $c->stash->{"trails"};
207 my $url = $c->uri_for('/help');
208 my @item = ('Aiuto', "$url");
209 push(@
{$trails}, \
@item);
211 return 1; #You can continue
217 Pasqualino Ferrentino,,,
221 This library is free software, you can redistribute it and/or modify
222 it under the same terms as Perl itself.