/[koha-facebook]/koha-facebook.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /koha-facebook.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2 by dpavlin, Fri Jun 26 18:45:33 2009 UTC revision 3 by dpavlin, Fri Jun 26 21:14:01 2009 UTC
# Line 20  require 'config.pl'; Line 20  require 'config.pl';
20    
21  # UI elements  # UI elements
22    
23    my $facebook = WWW::Facebook::API->new(
24            api_key  => $api_key,
25            secret   => $secret,
26            app_path => $app_path,
27            parse    => 1,
28    );
29    
30    warn dump($facebook);
31    
32  sub dashboard {  sub dashboard {
33          print qq|          print qq|
34                  <fb:dashboard>                  <fb:dashboard>
35                  <fb:action href=/$app_path/>Search</fb:action>                  <fb:action href=/$app_path/>Search</fb:action>
                 <fb:action href=/$app_path/info>info</fb:action>  
36                  </fb:dashboard>                  </fb:dashboard>
37          |;          |;
38          '';          '';
# Line 44  sub form { Line 52  sub form {
52          '';          '';
53  }  }
54    
55    # dispatcher
 my $facebook = WWW::Facebook::API->new(  
         api_key  => $api_key,  
         secret   => $secret,  
         app_path => $app_path,  
         parse    => 1,  
 );  
56    
57  our %action_map = (  our %action_map = (
58          ''   => \&index_page,          ''   => \&index_page,
# Line 83  sub main { Line 85  sub main {
85    
86      my ( $action, $param ) = ( $q->path_info =~ m!^/(\w+)/?(.*)! );      my ( $action, $param ) = ( $q->path_info =~ m!^/(\w+)/?(.*)! );
87    
     if ( my $s = $action_map{$action} ) {  
88          print dashboard;          print dashboard;
89    
90        if ( my $s = $action_map{$action} ) {
91          print qq|<div style='padding-left: 2em'>|;          print qq|<div style='padding-left: 2em'>|;
92          $s->( $q, $params );          $s->( $q, $params );
93          print qq|</div>|;          print qq|</div>|;
94      }      }
95      else {      else {
96          div_error("Action unknown");          print "Action <tt>$action</tt> unknown";
97            warn "unknown action $action";
98      }      }
99    
100      # Clear session_key (for if running under FastCGI).      # Clear session_key (for if running under FastCGI).
# Line 100  sub main { Line 104  sub main {
104  sub index_page {  sub index_page {
105          my ( $q, $params ) = @_;          my ( $q, $params ) = @_;
106    
107    warn dump($params);
108    
109          form($q);          form($q);
110    
111  =for later  =for later
# Line 114  sub index_page { Line 120  sub index_page {
120      }      }
121      print "$name ", ( $params ? "have" : "have't" ),      print "$name ", ( $params ? "have" : "have't" ),
122          " added this application. Some <a href='info'>info</a>.";          " added this application. Some <a href='info'>info</a>.";
123    =cut
124    
125      if ( !$params ) {      if ( !$params ) {
126          print "<a href='", $facebook->get_add_url,          print "<a href='", $facebook->get_add_url,
127              "'>Add this application</a>.";              "'>Add this application</a>.";
128      }      }
129    
 =cut  
130    
131    
132  }  }

Legend:
Removed from v.2  
changed lines
  Added in v.3

  ViewVC Help
Powered by ViewVC 1.1.26