[Bps-public-commit] r8927 - in SVKUI: . trunk/lib/SVKUI/Model trunk/share/web/templates

clsung at bestpractical.com clsung at bestpractical.com
Wed Sep 5 05:08:40 EDT 2007


Author: clsung
Date: Wed Sep  5 05:08:26 2007
New Revision: 8927

Modified:
   SVKUI/   (props changed)
   SVKUI/trunk/lib/SVKUI.pm
   SVKUI/trunk/lib/SVKUI/Model/Project.pm
   SVKUI/trunk/share/web/templates/projects

Log:
 r8995 at going04:  clsung | 2007-09-05 16:59:15 +0800
 - '/project' cause me to think that my load_by_cols in Project.pm is fake -______-
 r8996 at going04:  clsung | 2007-09-05 17:08:18 +0800
 - move SVKUI->setup_auth($user, $pass) to 
   $self->setup_auth()
 - setup_auth() when load_by_cols(), # I remember load() also calls it
 - maybe we need to save/cache svnauth for it ? but if it's a remote
   server, it will be kind of dangerous?
 - svn_auth in SVKUI should be ok now :)


Modified: SVKUI/trunk/lib/SVKUI.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI.pm	(original)
+++ SVKUI/trunk/lib/SVKUI.pm	Wed Sep  5 05:08:26 2007
@@ -91,16 +91,6 @@
     return SVK::Path->real_new( { depot => $depot, path => $path})->refresh_revision;
 }
 
-our $current_user;
-our $current_pass;
-
-sub setup_auth {
-    my ($class, $authuser, $authpass) = @_;
-    $current_user = $authuser;
-    $current_pass = $authpass;
-    warn "Setting user to ".$current_user;
-}
-
 sub _svkcmd {
     my $class = shift;
     my $cmd = shift || 'help';
@@ -108,9 +98,9 @@
 
     local *SVK::Config::_simple_prompt = sub {
 	my ($cred, $realm, $default_username, $may_save, $pool) = @_;
-	warn "Has user set to ".$current_user;
-	$cred->username($current_user);
-	$cred->password($current_pass);
+	warn "Has user set to ".$SVKUI::Model::Project::current_user;
+	$cred->username($SVKUI::Model::Project::current_user);
+	$cred->password($SVKUI::Model::Project::current_pass);
 	$cred->may_save(0);
 	return $SVN::_Core::SVN_NO_ERROR;
     };

Modified: SVKUI/trunk/lib/SVKUI/Model/Project.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI/Model/Project.pm	(original)
+++ SVKUI/trunk/lib/SVKUI/Model/Project.pm	Wed Sep  5 05:08:26 2007
@@ -1,6 +1,5 @@
 use strict;
 use warnings;
-
 package SVKUI::Model::Project;
 use Jifty::DBI::Schema;
 use Data::Dumper;
@@ -77,6 +76,15 @@
 #    return $SVN::_Core::SVN_NO_ERROR;
 #}
 
+our $current_user;
+our $current_pass;
+sub setup_auth {
+    my $self = shift;
+    $current_user = $self->authuser;
+    $current_pass = $self->authpass;
+    warn "Setting user to ".$current_user;
+}
+
 sub update_revision {
     my $self = shift;
     my $rev = shift;
@@ -95,7 +103,6 @@
     my $self = shift;
     my $path = shift;
     return 1 unless defined($self->url);
-    SVKUI->setup_auth($self->authuser, $self->authpass) if defined($self->authpass);
     #local *SVK::Config::_simple_prompt = sub {
 #	my ($cred, $realm, $default_username, $may_save, $pool) = @_;
 #	my $current_user = $self->authuser;
@@ -157,6 +164,18 @@
     return 0;
 }
 
+sub load_by_cols {
+    my $self = shift;
+    my %args = ( @_ );
+    my ($id, $msg) = $self->SUPER::load_by_cols(%args);
+    
+    if ( $self->id && defined($self->authpass)) {
+	$self->setup_auth();
+    }
+
+    return ($id, $msg);
+}
+
 sub create {
     my $self = shift;
     my $args = { @_ };

Modified: SVKUI/trunk/share/web/templates/projects
==============================================================================
--- SVKUI/trunk/share/web/templates/projects	(original)
+++ SVKUI/trunk/share/web/templates/projects	Wed Sep  5 05:08:26 2007
@@ -3,7 +3,7 @@
 <ul>
 % while (my $project = $projects->next) {
 % my $del = Jifty->web->new_action(class => 'DeleteProject', record => $project, moniker => 'delete-project-'.$project->id);
-<li><%Jifty->web->link( label=> $project->name, url => '/ia2/project/'.$project->name)%> 
+<li><%Jifty->web->link( label=> $project->name, url => '/ia2/'.$project->name)%> 
 <%$del->form_field('id')%>
 <% $del->button( label    => 'Delete project',
 			    class    => 'delete',



More information about the Bps-public-commit mailing list