[vhffs-dev] [1965] moved STATUS_STRINGS and TYPES_STRINGS tables to Constants, updated vhffs-intl/extra_strings.pl

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1965
Author:   gradator
Date:     2012-01-28 17:25:07 +0100 (Sat, 28 Jan 2012)
Log Message:
-----------
moved STATUS_STRINGS and TYPES_STRINGS tables to Constants, updated vhffs-intl/extra_strings.pl

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Constants.pm
    trunk/vhffs-api/src/Vhffs/Functions.pm
    trunk/vhffs-intl/extra_strings.pl

Modified: trunk/vhffs-api/src/Vhffs/Constants.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Constants.pm	2012-01-28 15:30:46 UTC (rev 1964)
+++ trunk/vhffs-api/src/Vhffs/Constants.pm	2012-01-28 16:25:07 UTC (rev 1965)
@@ -84,6 +84,40 @@
 	TAG_VISIBILITY_ADMINS		=> 40,
 };
 
+use constant {
+	STATUS_STRINGS => {
+		Vhffs::Constants::WAITING_FOR_VALIDATION => 'Waiting for validation',
+		Vhffs::Constants::VALIDATION_REFUSED => 'Validation refused',
+		Vhffs::Constants::WAITING_FOR_CREATION => 'Waiting for creation',
+		Vhffs::Constants::CREATING_ERROR => 'Creation error',
+		Vhffs::Constants::CREATED => 'Created',
+		Vhffs::Constants::ACTIVATED => 'Activated',
+		Vhffs::Constants::SUSPEND_PENDING => 'Waiting for suspension',
+		Vhffs::Constants::SUSPENDED => 'Suspended',
+		Vhffs::Constants::WAITING_FOR_MODIFICATION => 'Waiting for modification',
+		Vhffs::Constants::MODIFICATION_ERROR => 'Modification error',
+		Vhffs::Constants::MODIFICATION_APPLIED => 'Modification applied',
+		Vhffs::Constants::TO_DELETE => 'Will be deleted',
+	},
+	TYPES_STRINGS => {
+		Vhffs::Constants::TYPE_USER => 'User',
+		Vhffs::Constants::TYPE_GROUP => 'Group',
+		Vhffs::Constants::TYPE_WEB => 'Webarea',
+		Vhffs::Constants::TYPE_REPOSITORY => 'Download Repository',
+		Vhffs::Constants::TYPE_MYSQL => 'MySQL DB',
+		Vhffs::Constants::TYPE_PGSQL => 'PgSQL DB',
+		Vhffs::Constants::TYPE_CVS => 'CVS Repository',
+		Vhffs::Constants::TYPE_SVN => 'SVN Repository',
+		Vhffs::Constants::TYPE_GIT => 'GIT Repository',
+		Vhffs::Constants::TYPE_MERCURIAL => 'Mercurial Repository',
+		Vhffs::Constants::TYPE_BAZAAR => 'Bazaar Repository',
+		Vhffs::Constants::TYPE_DNS => 'Domain Name',
+		Vhffs::Constants::TYPE_MAIL => 'Mail Domain',
+		Vhffs::Constants::TYPE_ML => 'Mailing List',
+		Vhffs::Constants::TYPE_CRON => 'Cron job',
+	},
+};
+
 1;
 
 __END__

Modified: trunk/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Functions.pm	2012-01-28 15:30:46 UTC (rev 1964)
+++ trunk/vhffs-api/src/Vhffs/Functions.pm	2012-01-28 16:25:07 UTC (rev 1965)
@@ -53,41 +53,6 @@
 my $password;
 srand(time ^ $$);
 
-# TODO: move those tables to Constants
-
-my @STATUS_STRINGS;
-$STATUS_STRINGS[Vhffs::Constants::WAITING_FOR_VALIDATION] = 'Waiting for validation';
-$STATUS_STRINGS[Vhffs::Constants::VALIDATION_REFUSED] = 'Validation refused';
-$STATUS_STRINGS[Vhffs::Constants::WAITING_FOR_CREATION] = 'Waiting for creation';
-$STATUS_STRINGS[Vhffs::Constants::CREATING_ERROR] = 'Creation error';
-$STATUS_STRINGS[Vhffs::Constants::CREATED] = 'Created';
-$STATUS_STRINGS[Vhffs::Constants::ACTIVATED] = 'Activated';
-$STATUS_STRINGS[Vhffs::Constants::SUSPEND_PENDING] = 'Waiting for suspension';
-$STATUS_STRINGS[Vhffs::Constants::SUSPENDED] = 'Suspended';
-$STATUS_STRINGS[Vhffs::Constants::WAITING_FOR_MODIFICATION] = 'Waiting for modification';
-$STATUS_STRINGS[Vhffs::Constants::MODIFICATION_ERROR] = 'Modification error';
-$STATUS_STRINGS[Vhffs::Constants::MODIFICATION_APPLIED] = 'Modification applied';
-$STATUS_STRINGS[Vhffs::Constants::TO_DELETE] = 'Will be deleted';
-
-
-my @TYPES_STRINGS;
-$TYPES_STRINGS[Vhffs::Constants::TYPE_USER] = 'User';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_GROUP] = 'Group';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_WEB] = 'Webarea';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_REPOSITORY] = 'Download Repository';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_MYSQL] = 'MySQL DB';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_PGSQL] = 'PgSQL DB';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_CVS] = 'CVS Repository';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_SVN] = 'SVN Repository';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_GIT] = 'GIT Repository';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_MERCURIAL] = 'Mercurial Repository';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_BAZAAR] = 'Bazaar Repository';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_DNS] = 'Domain Name';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_MAIL] = 'Mail Domain';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_ML] = 'Mailing List';
-$TYPES_STRINGS[Vhffs::Constants::TYPE_CRON] = 'Cron job';
-
-
 # Return 1 if string is either 'yes', 'on', '1', 'y', else return 0
 sub strtobool
 {
@@ -422,13 +387,13 @@
 }
 
 sub status_string_from_status_id($) {
-    my $status = shift;
-    return gettext($STATUS_STRINGS[$status] or 'Unknown');
+	my $status = shift;
+	return gettext( Vhffs::Constants::STATUS_STRINGS->{$status} or 'Unknown'); 
 }
 
 sub type_string_from_type_id($) {
-    my $type = shift;
-    return gettext($TYPES_STRINGS[$type] or 'Unknown');
+	my $type = shift;
+	return gettext( Vhffs::Constants::TYPES_STRINGS->{$type} or 'Unknown');
 }
 
 =pod

Modified: trunk/vhffs-intl/extra_strings.pl
===================================================================
--- trunk/vhffs-intl/extra_strings.pl	2012-01-28 15:30:46 UTC (rev 1964)
+++ trunk/vhffs-intl/extra_strings.pl	2012-01-28 16:25:07 UTC (rev 1965)
@@ -7,15 +7,6 @@
 
 die('Don\'t execute me, vi me');
 
-# Help topics
-gettext_noop('help_user_preferences');
-gettext_noop('help_user_help');
-gettext_noop('help_user_bug');
-gettext_noop('help_user_logout');
-gettext_noop('help_user_projects');
-gettext_noop('help_user_project');
-gettext_noop('help_user_admin');
-
 # Object status
 gettext_noop('Waiting for validation');
 gettext_noop('Validation refused');
@@ -23,14 +14,13 @@
 gettext_noop('Creation error');
 gettext_noop('Created');
 gettext_noop('Activated');
+gettext_noop('Waiting for suspension');
 gettext_noop('Suspended');
-gettext_noop('Suspended before deletion');
 gettext_noop('Waiting for modification');
 gettext_noop('Modification error');
 gettext_noop('Modification applied');
 gettext_noop('Will be deleted');
 
-
 # Object types
 gettext_noop('User');
 gettext_noop('Group');
@@ -40,12 +30,15 @@
 gettext_noop('PgSQL DB');
 gettext_noop('CVS Repository');
 gettext_noop('SVN Repository');
+gettext_noop('GIT Repository');
+gettext_noop('Mercurial Repository');
+gettext_noop('Bazaar Repository');
 gettext_noop('Domain Name');
 gettext_noop('Mail Domain');
 gettext_noop('Mailing List');
+gettext_noop('Cron job');
 
 # Tags' visibility
-
 gettext_noop('Public');
 gettext_noop('Moderators');
 gettext_noop('Administrators');


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/