Tadashi Okoshi
slash****@users*****
2005年 11月 20日 (日) 21:19:52 JST
Index: affelio/lib/Affelio/App/Admin/ConfigAffelio.pm
diff -u /dev/null affelio/lib/Affelio/App/Admin/ConfigAffelio.pm:1.1
--- /dev/null Sun Nov 20 21:19:52 2005
+++ affelio/lib/Affelio/App/Admin/ConfigAffelio.pm Sun Nov 20 21:19:52 2005
@@ -0,0 +1,141 @@
+# Copyright (C) 2005 FishGrove Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id: ConfigAffelio.pm,v 1.1 2005/11/20 12:19:52 slash5234 Exp $
+
+package Affelio::App::Admin::ConfigAffelio;
+{
+ use strict;
+
+ use lib("../../../../extlib/");
+ use lib("../../../");
+ use Affelio;
+ use Affelio::misc::CGIError;
+ use Affelio::misc::Debug qw(debug_print);
+ use Affelio::misc::Encoding qw(db_encode db_decode);
+ use Affelio::misc::Time qw(timestamp2string);
+ use Affelio::misc::WebInput;
+
+ use Exporter;
+ @Affelio::App::Admin::ConfigAffelio::ISA = "Exporter";
+ @Affelio::App::Admin::ConfigAffelio::EXPORT = qw (show configure);
+
+ #######################################################################
+ #configure
+ #######################################################################
+ sub configure{
+ my $af= shift;
+ my $cgi = shift;
+
+ debug_print("Config::conf: start.");
+ my $wi = new Affelio::misc::WebInput;
+
+ ##############################################
+ #Top page
+ ##############################################
+ my $toppage = $wi->PTN_word($cgi->param("toppage"));
+ $af->{userpref__toppage_app_installname} = $toppage;
+ debug_print("Config::conf: toppage=[$toppage]");
+
+ ##############################################
+ #Messaging
+ ##############################################
+ my $val = $wi->PTN_word($cgi->param("pref__mesging__emailflg"));
+ debug_print("Config::conf: mesging__emailflg=[$val]");
+ if($val eq "no"){
+ $af->{userpref__mesging__emailflg} = "no";
+ }else{
+ $af->{userpref__mesging__emailflg} = "yes";
+ }
+
+ ##############################################
+ #Preferred Hosting Service
+ ##############################################
+ $af->{userpref__preferred_hosting_service} =
+ $wi->PTN_URL($cgi->param("pref__hosting_service"));
+
+ $af->write_user_prefs();
+ debug_print("Config::conf: end.");
+ }
+
+
+
+ #######################################################################
+ #show
+ #######################################################################
+ sub show{
+ my $af= shift;
+ my $output_ref = shift;
+
+ debug_print("Config::show start.");
+
+ ##############################################
+ #Top Page
+ ##############################################
+ my @applications=();
+ my $install_name;
+ my $app;
+ my $core_flag="";
+ my $app_flag="";
+
+ $output_ref->{"applications"} = \@applications;
+ if($af->{userpref__toppage_app_installname} eq "Affelio"){
+ $core_flag="true";
+ }
+ ###############
+ #Core
+ ###############
+ push(@applications, {install_title => "Affelio Core",
+ install_name => "Affelio",
+ selected => $core_flag} );
+ ###############
+ #Apps
+ ###############
+ while (($install_name, $app) = each(%{$af->getAM->{apps}})){
+
+ if($af->{userpref__toppage_app_installname}
+ eq $app->{install_name}){
+ $app_flag="true";
+ }else{
+ $app_flag="";
+ }
+
+ push(@applications, {install_title => "(Application) " .
+ $app->{install_title},
+ install_name => $app->{install_name},
+ selected => $app_flag}
+ );
+ }
+
+ ##############################################
+ #Messaging
+ ##############################################
+ my $name = "pref__mesging_emailflg__"
+ . $af->{userpref__mesging__emailflg};
+ $output_ref->{$name} = "checked";
+
+ ##############################################
+ #Preferred Hosting Service
+ ##############################################
+ $output_ref->{"pref__hosting_service"} =
+ $af->{userpref__preferred_hosting_service};
+
+ debug_print("Config::show end.");
+ }
+
+
+}
+1;
Index: affelio/lib/Affelio/App/Admin/ConfigApps.pm
diff -u /dev/null affelio/lib/Affelio/App/Admin/ConfigApps.pm:1.1
--- /dev/null Sun Nov 20 21:19:52 2005
+++ affelio/lib/Affelio/App/Admin/ConfigApps.pm Sun Nov 20 21:19:52 2005
@@ -0,0 +1,147 @@
+# Copyright (C) 2005 FishGrove Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id: ConfigApps.pm,v 1.1 2005/11/20 12:19:52 slash5234 Exp $
+
+package Affelio::App::Admin::ConfigApps;
+{
+ use strict;
+
+ use lib("../../../../extlib/");
+ use lib("../../../");
+ use Affelio;
+ use Affelio::misc::CGIError;
+ use Affelio::misc::Debug qw(debug_print);
+ use Affelio::misc::WebInput;
+
+ use Exporter;
+ @Affelio::App::Admin::ConfigApps::ISA = "Exporter";
+ @Affelio::App::Admin::ConfigApps::EXPORT = qw (show install_app);
+
+ #######################################################################
+ #install_app
+ #######################################################################
+ sub install_app{
+ my $af= shift;
+ my $cgi = shift;
+
+ debug_print("ConfigApps::install_app: start.");
+ my $wi = new Affelio::misc::WebInput;
+ my $install_dir = $wi->PTN_word($cgi->param("install_dir"));
+ my $install_title = $cgi->param("install_title");
+ debug_print("ConfigApps::install_app: DIR=[$install_dir]");
+ debug_print("ConfigApps::install_app: TITLE=[$install_title]");
+
+ $af->getAM->install_app($install_dir, $install_title);
+ $af->getAM->load_applications();
+
+ return("$install_dir is installed.");
+ }
+
+
+
+ #######################################################################
+ #show
+ #######################################################################
+ sub show{
+ my $af= shift;
+ my $output_ref = shift;
+
+ debug_print("ConfigApps::show start.");
+
+ ##############################################
+ #Top Page
+ ##############################################
+ my @registered_apps=();
+ my @unregistered_apps=();
+ $output_ref->{"registered_apps"} = \@registered_apps;
+ $output_ref->{"unregistered_apps"} = \@unregistered_apps;
+
+ ##############################################
+ #Registered Applications
+ ##############################################
+ while (my ($tmp_name, $this_app_ref) = each( %{$af->getAM->{apps}} ) ){
+ push(@registered_apps,
+ {app_id => $this_app_ref->{app_id},
+ install_name => $this_app_ref->{install_name},
+ install_title => $this_app_ref->{install_title},
+ app_name => $this_app_ref->{app_name},
+ app_version => $this_app_ref->{app_version},
+ } );
+ }
+
+ ##############################################
+ #Unregistered Applications
+ ##############################################
+ 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 directory
+ ##################################
+ debug_print("ConfigApps::show: [$app_dir]");
+
+ if( !defined($af->getAM->{apps}->{$app_dir}) ){
+
+ ##################################
+ #Open AF_app.cfg file
+ ##################################
+ my $cfg = Config::Tiny->new();
+ $cfg = Config::Tiny->read("$af->{top_dir}/apps/$app_dir/AF_app.cfg");
+ if(!$cfg){ next; }
+
+ 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;
+ }
+
+ my $operate_URL
+ ="admin.cgi?mode=config_apps&action=install_app";
+
+ ##################################
+ #Push into output_ref
+ ##################################
+ push(@unregistered_apps,
+ {app_dir => "$app_dir",
+ app_name => $app_name,
+ app_version => $app_version,
+ opURL => $operate_URL
+ } );
+ } #if
+
+ }
+ } #while
+
+ debug_print("ConfigApps::show end.");
+ }
+
+
+}
+1;
Index: affelio/lib/Affelio/App/Admin/Configuration.pm
diff -u affelio/lib/Affelio/App/Admin/Configuration.pm:1.4 affelio/lib/Affelio/App/Admin/Configuration.pm:removed
--- affelio/lib/Affelio/App/Admin/Configuration.pm:1.4 Thu Oct 27 20:15:01 2005
+++ affelio/lib/Affelio/App/Admin/Configuration.pm Sun Nov 20 21:19:52 2005
@@ -1,141 +0,0 @@
-# Copyright (C) 2005 FishGrove Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# $Id: Configuration.pm,v 1.4 2005/10/27 11:15:01 slash5234 Exp $
-
-package Affelio::App::Admin::Configuration;
-{
- use strict;
-
- use lib("../../../../extlib/");
- use lib("../../../");
- use Affelio;
- use Affelio::misc::CGIError;
- use Affelio::misc::Debug qw(debug_print);
- use Affelio::misc::Encoding qw(db_encode db_decode);
- use Affelio::misc::Time qw(timestamp2string);
- use Affelio::misc::WebInput;
-
- use Exporter;
- @Affelio::App::Admin::Configuration::ISA = "Exporter";
- @Affelio::App::Admin::Configuration::EXPORT = qw (show configure);
-
- #######################################################################
- #configure
- #######################################################################
- sub configure{
- my $af= shift;
- my $cgi = shift;
-
- debug_print("Config::conf: start.");
- my $wi = new Affelio::misc::WebInput;
-
- ##############################################
- #Top page
- ##############################################
- my $toppage = $wi->PTN_word($cgi->param("toppage"));
- $af->{userpref__toppage_app_installname} = $toppage;
- debug_print("Config::conf: toppage=[$toppage]");
-
- ##############################################
- #Messaging
- ##############################################
- my $val = $wi->PTN_word($cgi->param("pref__mesging__emailflg"));
- debug_print("Config::conf: mesging__emailflg=[$val]");
- if($val eq "no"){
- $af->{userpref__mesging__emailflg} = "no";
- }else{
- $af->{userpref__mesging__emailflg} = "yes";
- }
-
- ##############################################
- #Preferred Hosting Service
- ##############################################
- $af->{userpref__preferred_hosting_service} =
- $wi->PTN_URL($cgi->param("pref__hosting_service"));
-
- $af->write_user_prefs();
- debug_print("Config::conf: end.");
- }
-
-
-
- #######################################################################
- #show
- #######################################################################
- sub show{
- my $af= shift;
- my $output_ref = shift;
-
- debug_print("Config::show start.");
-
- ##############################################
- #Top Page
- ##############################################
- my @applications=();
- my $install_name;
- my $app;
- my $core_flag="";
- my $app_flag="";
-
- $output_ref->{"applications"} = \@applications;
- if($af->{userpref__toppage_app_installname} eq "Affelio"){
- $core_flag="true";
- }
- ###############
- #Core
- ###############
- push(@applications, {install_title => "Affelio Core",
- install_name => "Affelio",
- selected => $core_flag} );
- ###############
- #Apps
- ###############
- while (($install_name, $app) = each(%{$af->getAM->{apps}})){
-
- if($af->{userpref__toppage_app_installname}
- eq $app->{install_name}){
- $app_flag="true";
- }else{
- $app_flag="";
- }
-
- push(@applications, {install_title => "(Application) " .
- $app->{install_title},
- install_name => $app->{install_name},
- selected => $app_flag}
- );
- }
-
- ##############################################
- #Messaging
- ##############################################
- my $name = "pref__mesging_emailflg__"
- . $af->{userpref__mesging__emailflg};
- $output_ref->{$name} = "checked";
-
- ##############################################
- #Preferred Hosting Service
- ##############################################
- $output_ref->{"pref__hosting_service"} =
- $af->{userpref__preferred_hosting_service};
-
- debug_print("Config::show end.");
- }
-
-
-}
-1;