Tadashi Okoshi
slash****@users*****
2005年 12月 26日 (月) 19:15:39 JST
Index: affelio/lib/Affelio/Managing/ApplicationManager.pm
diff -u affelio/lib/Affelio/Managing/ApplicationManager.pm:1.13 affelio/lib/Affelio/Managing/ApplicationManager.pm:1.14
--- affelio/lib/Affelio/Managing/ApplicationManager.pm:1.13 Wed Nov 23 13:00:20 2005
+++ affelio/lib/Affelio/Managing/ApplicationManager.pm Mon Dec 26 19:15:39 2005
@@ -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.13 2005/11/23 04:00:20 slash5234 Exp $
+# $Id: ApplicationManager.pm,v 1.14 2005/12/26 10:15:39 slash5234 Exp $
package Affelio::Managing::ApplicationManager;
{
@@ -53,6 +53,71 @@
}
######################################################################
+ #rename_title
+ ######################################################################
+ sub rename_title{
+ my $self = shift;
+ my $af = $self->{af};
+ my $appid = shift;
+ my $title = shift;
+
+ #############################
+ #DB access
+ #############################
+ my $query = "update AFuser_CORE_apps set install_title = '$title' WHERE appid = $appid";
+
+ my $sth;
+ eval{
+ $sth = $af->getDB->prepare($query);
+ $sth->execute();
+ };
+ if($@){
+ throw Affelio::exception::DBException($af->getDB->errstr);
+ }
+ debug_print("ApplicationManager::rename_title: DB access done.");
+
+ #############################
+ #loadl_application
+ #############################
+ $af->getAM->load_applications();
+
+ debug_print("ApplicationManager::rename_title: end.");
+
+ }
+
+
+ ######################################################################
+ #uninstall_app
+ ######################################################################
+ sub uninstall_app{
+ my $self = shift;
+ my $af = $self->{af};
+ my $appid = shift;
+
+ #############################
+ #DB access
+ #############################
+ my $query = "delete from AFuser_CORE_apps where appid = $appid";
+ my $sth;
+ eval{
+ $sth = $af->getDB->prepare($query);
+ $sth->execute();
+ };
+ if($@){
+ throw Affelio::exception::DBException($af->getDB->errstr);
+ }
+ debug_print("ApplicationManager::uninstall_app: DB access done.");
+
+ #############################
+ #loadl_application
+ #############################
+ $af->getAM->load_applications();
+
+ debug_print("ApplicationManager::uninstall_app: end.");
+ }
+
+
+ ######################################################################
#install_app
######################################################################
sub install_app{
@@ -179,6 +244,8 @@
debug_print("ApplicationManager::load_apps: start.");
+ $self->{apps} = ();
+
##############################
#Access apps DB
##############################
@@ -553,103 +620,6 @@
#debug_print("AppManager::update_permission end.");
}
- ######################################################################
- #xxx
- ######################################################################
- sub xxx{
- my $self = shift;
- my $af = $self->{af};
-
- my $app_dir;
- opendir(DIR, "$af->{top_dir}/apps");
- 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')
- ){
-
- ##################################
- #For each found application...
- ##################################
- debug_print("Affelio::load_apps: [$app_dir]");
-
- ##################################
- #Open a config file
- ##################################
- my $cfg = new Config::IniFiles( -file => "$af->{top_dir}/apps/$app_dir/AF_app.cfg" );
- if(!$cfg){ next; }
-
- my %this_app=();
- my $err_flag=0;
- ##################################
- #Read application-specific parameters
- ##################################
- my @read_parameter_list=
- ("app_name", "app_version", "app_author",
- "guest_index", "owner_index",
- "action_types", "action_types_desc");
-
- foreach my $param (@read_parameter_list){
- my $data = $cfg->val('application', $param);
- if ($data){
- debug_print("Affelio::load_apps: \t$param = $data");
- $this_app{$param} = $data;
- }else{
- debug_print("Affelio::load_apps: \t$param not found.");
- $err_flag=1;
- }
- }
-
- my @this_app_action_types =();
- @this_app_action_types =split(',\s', $this_app{action_types});
- unshift(@this_app_action_types, "DF_access");
- unshift(@this_app_action_types, "DF_visibility");
-
- my @this_app_action_types_desc =();
- @this_app_action_types_desc =split(',', $this_app{action_types_desc});
- unshift(@this_app_action_types_desc, '<AF_M text="DF_access">');
- unshift(@this_app_action_types_desc, '<AF_M text="DF_visibility">');
-
- ##################################
- #Read installation-specific parameters
- ##################################
- my @inst_parameter_list= ("title");
-
- foreach my $param (@inst_parameter_list){
- my $data = $cfg->val('this_installation', $param);
- if ($data){
- debug_print("Affelio::load_apps: \t$param = $data");
- $this_app{"install_" . $param} = $data;
- }else{
- debug_print("Affelio::load_apps: \t$param not found.");
- $err_flag=1;
- }
- }
-
- ##################################
- #Store into Affelio's hash
- ##################################
- if(!$err_flag){
- $self->{apps}->{$app_dir}
- = {'app_name' => $this_app{'app_name'},
- 'app_version' => $this_app{'app_version'},
- 'app_author' => $this_app{'app_author'},
- 'guest_index' => $this_app{'guest_index'},
- 'owner_index' => $this_app{'owner_index'},
- #
- 'action_types' => \@this_app_action_types,
- 'action_types_desc' => \@this_app_action_types_desc,
- #
- 'install_name' => $app_dir,
- 'install_title' => $this_app{'install_title'}
- };
- }
-
- }#if
- }#while
- }
}
1;