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

clsung at bestpractical.com clsung at bestpractical.com
Thu Aug 30 23:24:06 EDT 2007


Author: clsung
Date: Thu Aug 30 23:24:05 2007
New Revision: 8851

Added:
   SVKUI/trunk/share/web/static/js/app.js
Modified:
   SVKUI/   (props changed)
   SVKUI/trunk/etc/config.yml
   SVKUI/trunk/lib/SVKUI/Action/CreateNewProject.pm
   SVKUI/trunk/lib/SVKUI/Model/Project.pm
   SVKUI/trunk/share/web/templates/addproject

Log:
 r8820 at going04:  clsung | 2007-08-28 16:23:41 +0800
 - before release, use Fork instead Prefork
   - I need to restart SVKUI frequently
 r8821 at going04:  clsung | 2007-08-28 16:59:22 +0800
 - no authpass_confirm in Model::Project
 r8885 at going04:  clsung | 2007-08-31 11:22:38 +0800
 - finally I got javascript works on (onChange)
   - there should be a better way? Can action->form_field(xxxx, onchange=>...) ?
 r8886 at going04:  clsung | 2007-08-31 11:23:38 +0800
 - now no need to canonicalize authuser (use js)
 r8887 at going04:  clsung | 2007-08-31 11:23:51 +0800
 - remove # Dumper()


Modified: SVKUI/trunk/etc/config.yml
==============================================================================
--- SVKUI/trunk/etc/config.yml	(original)
+++ SVKUI/trunk/etc/config.yml	Thu Aug 30 23:24:05 2007
@@ -70,4 +70,4 @@
     ServeStaticFiles: 1
     StaticRoot: share/web/static
     TemplateRoot: share/web/templates
-    ServerClass: Jifty::Server::Prefork
+    ServerClass: Jifty::Server::Fork

Modified: SVKUI/trunk/lib/SVKUI/Action/CreateNewProject.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI/Action/CreateNewProject.pm	(original)
+++ SVKUI/trunk/lib/SVKUI/Action/CreateNewProject.pm	Thu Aug 30 23:24:05 2007
@@ -40,7 +40,6 @@
 param
     authuser => type is 'text',
     label is _('Username'),
-    ajax canonicalizes,
     hints is 'Username for the site, if required';
 
 param
@@ -69,7 +68,6 @@
 	type => $self->argument_value('type'),
 	authuser => $self->argument_value('authuser'),
 	authpass => $self->argument_value('authpass'),
-	authpass_confirm => $self->argument_value('authpass_confirm'),
 	description => $self->argument_value('description')
     );
     
@@ -109,17 +107,5 @@
     return $value;
 }
 
-sub canonicalize_authuser {
-    my ($self, $value) = @_;
-    if ($value ne '') {
-	# warn "Adding two field for auth";
-	# not working
-	#$self->form_field('authpass');
-	#$self->form_field('authpass_confirm');
-    }
-
-    return $value;
-}
-
 1;
 

Modified: SVKUI/trunk/lib/SVKUI/Model/Project.pm
==============================================================================
--- SVKUI/trunk/lib/SVKUI/Model/Project.pm	(original)
+++ SVKUI/trunk/lib/SVKUI/Model/Project.pm	Thu Aug 30 23:24:05 2007
@@ -112,8 +112,6 @@
 	    SVKUI::Event::Notification->new($message)->publish;
 	}
 
-#	warn Dumper(%param);
-
 	goto $old_log;
     };
     if (SVKUI->_svkcmd('sync', $self->repospath)) {

Added: SVKUI/trunk/share/web/static/js/app.js
==============================================================================
--- (empty file)
+++ SVKUI/trunk/share/web/static/js/app.js	Thu Aug 30 23:24:05 2007
@@ -0,0 +1,18 @@
+function hide_field(field) {
+    if ($(field)) 
+	Element.hide(field);
+}
+
+function show_field (field){
+    if ($(field))
+	new Effect.Appear(field, {duration: 0.5});
+}
+
+function ifHasAuthUser(Id)
+{
+    var text = document.getElementById(Id).value;
+    if (text)
+	show_field('authpassid');
+    else
+	hide_field('authpassid');
+}

Modified: SVKUI/trunk/share/web/templates/addproject
==============================================================================
--- SVKUI/trunk/share/web/templates/addproject	(original)
+++ SVKUI/trunk/share/web/templates/addproject	Thu Aug 30 23:24:05 2007
@@ -9,12 +9,23 @@
 <% $action->form_field('name', default_value => $name) %>
 <% $action->form_field('url', default_value => $url) %>
 <% $action->form_field('type', default_value => $type) %>
-<% $action->form_field('authuser') %>
+<% my $authuseraction = $action->form_field('authuser') %>
+<div class="authpassfield" id="authpassid">
 <% $action->form_field('authpass') %>
 <% $action->form_field('authpass_confirm') %>
+</div>
 <% $action->form_field('description', default_value => $desc) %>
 <% Jifty->web->form->submit( label => 'Submit' ) %>
 <% Jifty->web->form->end() %>
+<script>
+hide_field('authpassid');
+browserName = navigator.appName;
+if (browserName == "Microsoft Internet Explorer"||browserName == "Opera") {
+    document.getElementById("<% $authuseraction->element_id() %>").attachEvent("onChange",ifHasAuthUser("<% $authuseraction->element_id() %>"));
+} else {
+    document.getElementById("<% $authuseraction->element_id() %>").addEventListener("change",function OnChange() { ifHasAuthUser("<% $authuseraction->element_id() %>");}, false );
+}
+</script>
 </&>
 
 <%ARGS>



More information about the Bps-public-commit mailing list