[Affelio-cvs 770] CVS update: affelio

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 11月 20日 (日) 21:19:52 JST


Index: affelio/admin.cgi
diff -u affelio/admin.cgi:1.30 affelio/admin.cgi:1.31
--- affelio/admin.cgi:1.30	Tue Nov  1 13:46:54 2005
+++ affelio/admin.cgi	Sun Nov 20 21:19:52 2005
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: admin.cgi,v 1.30 2005/11/01 04:46:54 slash5234 Exp $
+# $Id: admin.cgi,v 1.31 2005/11/20 12:19:52 slash5234 Exp $
 
 use strict;
 
@@ -125,16 +125,16 @@
 my $admin_mode = $wi->PTN_mode($q->url_param("mode"));
 
 #####################################################################
-#Affelio Configuration
+#AffelioConfig
 #####################################################################
 if($admin_mode eq "config_affelio"){
 
-    use Affelio::App::Admin::Configuration;
+    use Affelio::App::Admin::ConfigAffelio;
 
     my $sub_mode = $wi->PTN_mode($q->url_param("action"));
     if($sub_mode eq "submit" ){
 	try{
-	    Affelio::App::Admin::Configuration::configure($af, $q);
+	    Affelio::App::Admin::ConfigAffelio::configure($af, $q);
 	}catch Error with{
 	    my $e = shift;    $err_msg .= $e->stacktrace;
 	};
@@ -142,7 +142,27 @@
 
     $TMPL_FILE = "$af->{site__fs_root}/templates/" .
 	         "$af->{site__template}/owner_side/admin_affelio_config.tmpl";
-    Affelio::App::Admin::Configuration::show($af,\%output_data);
+    Affelio::App::Admin::ConfigAffelio::show($af,\%output_data);
+
+#####################################################################
+#Config Apps
+#####################################################################
+}elsif($admin_mode eq "config_apps"){
+
+    use Affelio::App::Admin::ConfigApps;
+
+    my $sub_mode = $wi->PTN_mode($q->url_param("action"));
+    if($sub_mode eq "install_app" ){
+	try{
+	    $ret_msg=Affelio::App::Admin::ConfigApps::install_app($af, $q);
+	}catch Error with{
+	    my $e = shift;    $err_msg .= $e->stacktrace;
+	};
+    }
+
+    $TMPL_FILE = "$af->{site__fs_root}/templates/" .
+	         "$af->{site__template}/owner_side/admin_apps_config.tmpl";
+    Affelio::App::Admin::ConfigApps::show($af,\%output_data);
 
 #####################################################################
 #Access Log
Index: affelio/upgrade-10-11.cgi
diff -u /dev/null affelio/upgrade-10-11.cgi:1.1
--- /dev/null	Sun Nov 20 21:19:52 2005
+++ affelio/upgrade-10-11.cgi	Sun Nov 20 21:19:52 2005
@@ -0,0 +1,103 @@
+#!/usr/bin/perl 
+
+use strict;
+
+use CGI qw(-unique_headers);
+use Cwd;
+use DBI;
+use lib("./extlib");
+use HTML::Template;
+use Error qw(:try);
+use lib("./lib");
+use Affelio;
+use Affelio::misc::Debug qw(debug_print);
+
+############################################################################
+#Main
+############################################################################
+my $g_username="";
+my $g_password="";
+my $g_nickname="";
+my $g_email="";
+my $q = new CGI;
+my $g_fsroot = cwd();
+my $g_webroot = $q->self_url();
+
+#########################################################################
+#1st screen
+#########################################################################
+if($q->url_param("mode") ne "go"){
+    print "Content-type: text/html; charset=UTF-8\n";
+    print "Pragma: no-cache", "\n\n"; 
+    print '<HTML><B>Upgrade Affelio from 1.0 to 1.1</B><P><FORM ACTION="upgrade-10-11.cgi?mode=go" method=POST><INPUT TYPE="submit" VALUE="Go"></FORM></HTML>';
+    exit(1);
+
+#########################################################################
+#Do upgrade
+#########################################################################
+}else{
+    print "Content-type: text/html; charset=UTF-8\n";
+    print "Pragma: no-cache", "\n\n"; 
+
+    ################################
+    #Start Affelio
+    ################################
+    my $af;
+    try{
+	$af = new Affelio(ConfigDir => "./config/");
+    }catch Error with{
+	my $e = shift;
+	print("Affelio load error.\n" . $e->stacktrace);
+	exit(1);
+    };
+
+    ################################
+    #Create application table
+    ################################
+    {
+	my $query = 'SELECT * from AFuser_CORE_apps';
+        my $sth;
+	eval{
+	    $sth = $af->getDB->prepare($query);
+	    $sth->execute;
+	};
+	if($@){
+	    print "We confirmed that the app table does not exist.<BR>";
+	    print "So, We will make it<BR>";
+	    my $query = <<EOT;
+CREATE TABLE AFuser_CORE_apps(appid INTEGER PRIMARY KEY AUTOINCREMENT, 
+			      install_name TEXT, 
+			      install_title TEXT,
+			      app_URI TEXT,
+			      app_name TEXT,
+			      app_version TEXT,
+			      app_desc TEXT,
+			      app_author TEXT,
+			      guest_index TEXT,
+			      owner_index TEXT,
+			      action_types TEXT,
+			      action_types_desc TEXT)
+EOT
+            my $sth;
+	    eval{
+		$sth = $af->getDB->prepare($query);
+		$sth->execute;
+	    };
+	    if($@){
+		print 'Error occured in creating the table<BR><BR>' .  $@;
+		exit(1);
+	    }
+
+	}else{
+	    #Application table already exists.
+	    #So, do nothing.
+	    print 'We confirmed that the app table already exists.<BR>';
+	    print 'So, We will do nothing.<BR>';
+	}
+    }#block
+
+    print 'OK. Successfuly done.<P><B>Delete this CGI immediately!!</B>';
+    exit(1);
+}
+
+


Affelio-cvs メーリングリストの案内
Back to archive index