Index: platform/tdiary/doc/ja/account_ad.txt
===================================================================
--- platform/tdiary/doc/ja/account_ad.txt (revision 5024)
+++ platform/tdiary/doc/ja/account_ad.txt (revision 5026)
@@ -6,4 +6,6 @@
 
 ! 更新履歴
+!! 20080120
+* openid.rb をベースにリファクタリング
 
 !! 20070109
Index: platform/tdiary/plugin/ja/account_ad.rb
===================================================================
--- platform/tdiary/plugin/ja/account_ad.rb (revision 3326)
+++  (revision )
@@ -1,20 +1,0 @@
-# ja/account_ad.rb $Revision: 1.2 $
-#
-# Japanese resources for account_ad.rb
-#
-# Copyright (c) 2005 Hiroshi SHIBATA <h-sbt@nifty.com>
-# Distributed under the GPL
-#
-
-if @mode == 'conf' || @mode == 'saveconf'
-   add_conf_proc( 'account_ad', 'Account Auto-Discovery' ) do
-      saveconf_account_ad
-      account_ad_init
-      <<-HTML
-      <h3 class="subtitle">Account Name</h3>
-      <p><input name="account.name" value="#{h(@conf['account.name'])}" size="8" /></p>
-      <h3 class="subtitle">Account Service</h3>
-      <p><input name="account.service" value="#{h(@conf['account.service'])}" size="40" /></p>
-      HTML
-   end
-end
Index: platform/tdiary/plugin/account_ad.rb
===================================================================
--- platform/tdiary/plugin/account_ad.rb (revision 3326)
+++ platform/tdiary/plugin/account_ad.rb (revision 5026)
@@ -1,22 +1,27 @@
 # account_ad.rb $Revision: 1.3 $
 #
-# Copyright (c) 2005 SHIBATA  Hiroshi <h-sbt@nifty.com>
+# Copyright (c) 2008 SHIBATA  Hiroshi <h-sbt@nifty.com>
 # Distributed under the GPL
 #
 
-add_header_proc do
-   account_ad_init
-
-   account_name = @conf['account.name']
-   account_service = @conf['account.service']
-
-   if @mode == "day"
-      permalink=@conf.base_url+anchor(@date.strftime('%Y%m%d'))
-   else
-      permalink=@conf.base_url
-   end
-
-	if account_name.length > 0 then
-   	<<-HTML
+if /^(latest|day|conf|saveconf)$/ =~ @mode then
+	
+	@account_ad_list = {
+		# Service => ServiceHomepage
+		'Hatena' => 'https://www.hatena.ne.jp/',
+	}
+	
+	if @conf['account.service'] and @conf['account.name'] then
+		if @mode == "day"
+			permalink=@conf.base_url+anchor(@date.strftime('%Y%m%d'))
+		else
+			permalink=@conf.base_url
+		end
+		
+		account_service = @account_ad_list[@conf['account.service']]
+		account_name = @conf['account.name']
+		
+		add_header_proc do	
+			result = <<-HTML
 			<!--
 			<rdf:RDF
@@ -34,19 +39,29 @@
 			</rdf:RDF>
 			-->
-   	HTML
-	else
-		''
+   	   HTML
+			result.gsub( /^\t\t/, '' )
+		end
 	end
 end
 
-def account_ad_init
-   @conf['account.name'] ||= ""
-   @conf['account.service'] ||= "http://www.hatena.ne.jp/"
-end
+add_conf_proc( 'account_ad', 'Account Auto-Discovery' ) do
 
-if @mode == 'saveconf'
-   def saveconf_account_ad
+	if @mode == 'saveconf' then
       @conf['account.name'] = @cgi.params['account.name'][0]
       @conf['account.service'] = @cgi.params['account.service'][0]
-   end
+	end
+
+	options = ''
+	@account_ad_list.each_key do |key|
+		options << %Q|<option value="#{h key}"#{" selected" if @conf['account.service'] == key}>#{h key}</option>\n|
+	end
+		
+	<<-HTML
+   <h3 class="subtitle">Account Service</h3>
+	<p><select name="account.service">
+		#{options}
+	</select></p>
+   <h3 class="subtitle">Account Name</h3>
+   <p><input name="account.name" value="#{h @conf['account.name']}" /></p>
+   HTML
 end
Index: platform/tdiary/plugin/en/account_ad.rb
===================================================================
--- platform/tdiary/plugin/en/account_ad.rb (revision 3326)
+++  (revision )
@@ -1,20 +1,0 @@
-# en/account_ad.rb $Revision: 1.2 $
-#
-# English resources for account_ad.rb
-#
-# Copyright (c) 2005 SHIBATA Hiroshi <h-sbt@nifty.com>
-# Distributed under the GPL
-#
-
-if @mode == 'conf' || @mode == 'saveconf'
-   add_conf_proc( 'account_ad', 'Account Auto-Discovery' ) do
-      saveconf_account_ad
-      account_ad_init
-      <<-HTML
-      <h3 class="subtitle">Account Name</h3>
-      <p><input name="account.name" value="#{h(@conf['account.name'])}" size="8" /></p>
-      <h3 class="subtitle">Account Service</h3>
-      <p><input name="account.service" value="#{h(@conf['account.service'])}" size="40" /></p>
-      HTML
-   end
-end
