[Affelio-cvs 1139] CVS update: affelio/lib/Affelio/Managing

Back to archive index

Tadashi Okoshi slash****@users*****
2006年 3月 7日 (火) 23:39:11 JST


Index: affelio/lib/Affelio/Managing/AccessLogManager.pm
diff -u affelio/lib/Affelio/Managing/AccessLogManager.pm:1.12 affelio/lib/Affelio/Managing/AccessLogManager.pm:1.13
--- affelio/lib/Affelio/Managing/AccessLogManager.pm:1.12	Thu Feb 23 21:41:38 2006
+++ affelio/lib/Affelio/Managing/AccessLogManager.pm	Tue Mar  7 23:39:10 2006
@@ -14,7 +14,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: AccessLogManager.pm,v 1.12 2006/02/23 12:41:38 slash5234 Exp $
+# $Id: AccessLogManager.pm,v 1.13 2006/03/07 14:39:10 slash5234 Exp $
 
 package Affelio::Managing::AccessLogManager;
 {
Index: affelio/lib/Affelio/Managing/ApplicationManager.pm
diff -u affelio/lib/Affelio/Managing/ApplicationManager.pm:1.15 affelio/lib/Affelio/Managing/ApplicationManager.pm:1.16
--- affelio/lib/Affelio/Managing/ApplicationManager.pm:1.15	Thu Feb 23 21:41:38 2006
+++ affelio/lib/Affelio/Managing/ApplicationManager.pm	Tue Mar  7 23:39:10 2006
@@ -14,7 +14,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: ApplicationManager.pm,v 1.15 2006/02/23 12:41:38 slash5234 Exp $
+# $Id: ApplicationManager.pm,v 1.16 2006/03/07 14:39:10 slash5234 Exp $
 
 package Affelio::Managing::ApplicationManager;
 {
@@ -23,7 +23,7 @@
     use Error qw(:try);
     use DBI;
     use Jcode;
-    use lib("../../");
+    use lib("../../../lib/");
     use Affelio::misc::CGIError;
     use Affelio::misc::Encoding qw(db_encode db_decode);
     use Affelio::misc::Debug qw(debug_print);
@@ -137,6 +137,8 @@
 	my $self = shift;
 	my $af = $self->{af};
 	my $app_dir = shift;
+	my $app_dir_abs = shift;
+	my $app_region = shift;
 	my $install_name = shift;
 	my $install_title = shift;
 
@@ -146,9 +148,12 @@
 	#Read .cfg file
 	#############################
 	my $cfg = Config::Tiny->new();
-	$cfg = Config::Tiny->read("$af->{top_dir}/apps/$app_dir/AF_app.cfg");
+	my $cfg_path = "";
+	$cfg_path = "$app_dir_abs/AF_app.cfg";
+	$cfg = Config::Tiny->read($cfg_path);
+
 	if(!$cfg){
-	    throw Affelio::exception::("Could not open /apps/$app_dir/AF_app.cfg");
+	    throw Affelio::exception::InvalidInputException("Could not open $app_dir_abs/AF_app.cfg");
 	}
 	debug_print("ApplicationManager::install_app opened config file");
 
@@ -222,6 +227,8 @@
 	    debug_print("ApplicationManager::install_app to AFE2...");
 	    $af->{farm_con}->install_app(Username => $af->{site__username},
 					 AppDir => $app_dir,
+					 AppDirAbs => $app_dir_abs,
+					 AppRegion => $app_region,
 					 InstallName => $install_name);
 	}
 
@@ -664,6 +671,136 @@
 	#debug_print("AppManager::update_permission end.");
     }
 
+    ######################################################################
+    #get_unregistered_apps
+    ######################################################################
+    sub get_unregistered_apps{
+	my $self = shift;
+	my $af = $self->{af};
+	my $array_ref= shift;           #arg(1) array reference
+
+	my @app_topdirs=();
+	my $app_topdir="";
+	my $app_dir="";
+
+	###########################################
+	#Collect directories to explore
+	if ($af->{site__farm_mode} eq "AFE2"){
+	    #AFE2 mode
+	    @app_topdirs = $af->{farm_con}->get_app_topdirs();
+	}else{
+	    #Standalone
+	    push (@app_topdirs, "$af->{top_dir}/apps");
+	}
+	debug_print("AppManager::get_unreg_apps: [@app_topdirs]");
+
+	###########################################
+	#For each top directories...
+	foreach $app_topdir (@app_topdirs) {
+	    opendir(DIR, $app_topdir);
+
+	    while (defined($app_dir = readdir(DIR))) {
+		if( ($app_dir ne '.') 
+		    && ($app_dir ne '..') 
+		    && ($app_dir ne 'index.html') 
+		    && ($app_dir ne 'sampleapp') 
+		    && ($app_dir ne 'CVS')
+		    ){
+
+		    my $app_dir_abs
+			= "$app_topdir/$app_dir";
+
+		    ##################################
+		    #For each found application directory
+		    ##################################
+ 		    debug_print("AppManager::get_unreg_apps: [$app_dir]");
+
+		    if( (!defined($af->getAM->{apps}->{$app_dir}))
+			|| ($af->{site__farm_mode} eq "AFE2")
+			){
+			
+			#Read AF_app.cfg file of install-ready applications.
+			#In case of AFE2:  
+			#    All apps. in affelio/apps/ dir. is always ready for install.
+			#In case of Stand-alone and AFE:
+			#    Only apps which is not registered as "installed" are ready.
+			
+			##################################
+			#Open AF_app.cfg file
+			##################################
+			my $cfg = Config::Tiny->new();
+			$cfg = Config::Tiny->read("$app_dir_abs/AF_app.cfg");
+			if(!$cfg){ next; }
+
+			#app_dir: directory this application exists
+			#install_dir: destination directory
+			#   Standalone case: install_dir = app_dir
+			#   AFE2 case: install_dir = user-specified.
+			#app_name: Application name
+			#app_version: Application version
+			#disabled_flag: if "install_dir" can be changed
+			#               by user.
+			my $app_URI = $cfg->{application}->{app_URI};
+			my $app_name = $cfg->{application}->{app_name};
+			my $app_version = $cfg->{application}->{app_version};
+			my $app_desc = $cfg->{application}->{app_desc};
+			my $guest_index = $cfg->{application}->{guest_index};
+			my $owner_index = $cfg->{application}->{owner_index};
+			
+			if( (!$app_URI) || (!$app_name) || (!$app_version)
+			    || (!$guest_index) || (!$owner_index)){
+			    next;
+			}
+			
+			##################################
+			#Open AF_app.cfg file
+			##################################
+			my $operate_URL
+			    ="admin.cgi?mode=config_apps&action=install_app";
+			
+			##################################
+			#Flag : if install_dir can ben changed
+			##################################
+			my $disabled_flag;
+			my $install_dir;
+			if($af->{site__farm_mode} eq "AFE2"){
+			    $install_dir = "";
+			    $disabled_flag="";
+			}else{
+			    $install_dir = $app_dir;
+			    $disabled_flag=" readonly";
+			}
+
+			my $app_region;
+			$app_dir_abs =~ /([A-Za-z]*)Farm\/apps\/([A-Za-z]*)\//;
+			$app_region = "$1Farm/apps/$2";
+
+			##################################
+			#Push into output_ref
+			##################################
+			push(@$array_ref,
+			     {app_dir => $app_dir,
+			      app_dir_abs => $app_dir_abs,
+			      app_region => $app_region,
+			      app_name => $app_name,
+			      app_version => $app_version,
+			      install_dir => $install_dir,
+			      disabled_flag => $disabled_flag,
+			      opURL => $operate_URL
+			      } );
+
+			debug_print("AppManager::get_unreg_apps: [$app_dir] [$app_dir_abs] [$app_region]");
+			
+		    } #if
+		    
+		}
+	    } #while
+
+	    close(DIR);
+
+	}#foreach
+
+    }
 
 }
 1;
Index: affelio/lib/Affelio/Managing/GroupManager.pm
diff -u affelio/lib/Affelio/Managing/GroupManager.pm:1.9 affelio/lib/Affelio/Managing/GroupManager.pm:1.10
--- affelio/lib/Affelio/Managing/GroupManager.pm:1.9	Thu Feb 23 21:41:38 2006
+++ affelio/lib/Affelio/Managing/GroupManager.pm	Tue Mar  7 23:39:10 2006
@@ -14,7 +14,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: GroupManager.pm,v 1.9 2006/02/23 12:41:38 slash5234 Exp $
+# $Id: GroupManager.pm,v 1.10 2006/03/07 14:39:10 slash5234 Exp $
 
 package Affelio::Managing::GroupManager;
 {
Index: affelio/lib/Affelio/Managing/MessageManager.pm
diff -u affelio/lib/Affelio/Managing/MessageManager.pm:1.13 affelio/lib/Affelio/Managing/MessageManager.pm:1.14
--- affelio/lib/Affelio/Managing/MessageManager.pm:1.13	Thu Feb 23 21:41:38 2006
+++ affelio/lib/Affelio/Managing/MessageManager.pm	Tue Mar  7 23:39:10 2006
@@ -14,7 +14,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: MessageManager.pm,v 1.13 2006/02/23 12:41:38 slash5234 Exp $
+# $Id: MessageManager.pm,v 1.14 2006/03/07 14:39:10 slash5234 Exp $
 
 package Affelio::Managing::MessageManager;
 {
Index: affelio/lib/Affelio/Managing/MyNewsManager.pm
diff -u affelio/lib/Affelio/Managing/MyNewsManager.pm:1.6 affelio/lib/Affelio/Managing/MyNewsManager.pm:1.7
--- affelio/lib/Affelio/Managing/MyNewsManager.pm:1.6	Thu Feb 23 21:41:38 2006
+++ affelio/lib/Affelio/Managing/MyNewsManager.pm	Tue Mar  7 23:39:10 2006
@@ -14,7 +14,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: MyNewsManager.pm,v 1.6 2006/02/23 12:41:38 slash5234 Exp $
+# $Id: MyNewsManager.pm,v 1.7 2006/03/07 14:39:10 slash5234 Exp $
 
 package Affelio::Managing::MyNewsManager;
 {
Index: affelio/lib/Affelio/Managing/NewsAggregator.pm
diff -u affelio/lib/Affelio/Managing/NewsAggregator.pm:1.17 affelio/lib/Affelio/Managing/NewsAggregator.pm:1.18
--- affelio/lib/Affelio/Managing/NewsAggregator.pm:1.17	Thu Feb 23 21:41:38 2006
+++ affelio/lib/Affelio/Managing/NewsAggregator.pm	Tue Mar  7 23:39:10 2006
@@ -14,7 +14,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: NewsAggregator.pm,v 1.17 2006/02/23 12:41:38 slash5234 Exp $
+# $Id: NewsAggregator.pm,v 1.18 2006/03/07 14:39:10 slash5234 Exp $
 
 package Affelio::Managing::NewsAggregator;
 {
Index: affelio/lib/Affelio/Managing/PermissionManager.pm
diff -u affelio/lib/Affelio/Managing/PermissionManager.pm:1.6 affelio/lib/Affelio/Managing/PermissionManager.pm:1.7
--- affelio/lib/Affelio/Managing/PermissionManager.pm:1.6	Thu Feb 23 21:41:38 2006
+++ affelio/lib/Affelio/Managing/PermissionManager.pm	Tue Mar  7 23:39:10 2006
@@ -14,7 +14,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: PermissionManager.pm,v 1.6 2006/02/23 12:41:38 slash5234 Exp $
+# $Id: PermissionManager.pm,v 1.7 2006/03/07 14:39:10 slash5234 Exp $
 
 package Affelio::Managing::PermissionManager;
 {
Index: affelio/lib/Affelio/Managing/ProfileManager.pm
diff -u affelio/lib/Affelio/Managing/ProfileManager.pm:1.6 affelio/lib/Affelio/Managing/ProfileManager.pm:1.7
--- affelio/lib/Affelio/Managing/ProfileManager.pm:1.6	Thu Feb 23 21:41:38 2006
+++ affelio/lib/Affelio/Managing/ProfileManager.pm	Tue Mar  7 23:39:10 2006
@@ -14,7 +14,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: ProfileManager.pm,v 1.6 2006/02/23 12:41:38 slash5234 Exp $
+# $Id: ProfileManager.pm,v 1.7 2006/03/07 14:39:10 slash5234 Exp $
 
 package Affelio::Managing::ProfileManager;
 {
Index: affelio/lib/Affelio/Managing/SessionManager.pm
diff -u affelio/lib/Affelio/Managing/SessionManager.pm:1.5 affelio/lib/Affelio/Managing/SessionManager.pm:1.6
--- affelio/lib/Affelio/Managing/SessionManager.pm:1.5	Thu Feb 23 21:41:38 2006
+++ affelio/lib/Affelio/Managing/SessionManager.pm	Tue Mar  7 23:39:10 2006
@@ -14,7 +14,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: SessionManager.pm,v 1.5 2006/02/23 12:41:38 slash5234 Exp $
+# $Id: SessionManager.pm,v 1.6 2006/03/07 14:39:10 slash5234 Exp $
 
 package Affelio::Managing::SessionManager;
 {


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