|
Revision 5292, 1.0 kB
(checked in by hsbt, 5 years ago)
|
|
platform/tdiary/plugin/opensearch_ad.rb: refactoring, based openid.rb
|
| Line | |
|---|
| 1 | # opensearch_ad.rb $Revision: 1.1 $ |
|---|
| 2 | # |
|---|
| 3 | # Copyright (c) 2008 SHIBATA Hiroshi <h-sbt@nifty.com> |
|---|
| 4 | # Distributed under the GPL |
|---|
| 5 | # |
|---|
| 6 | |
|---|
| 7 | if /^(latest|day)$/ =~ @mode then |
|---|
| 8 | if @conf['opensearch.xml'] and @conf['opensearch.title'] then |
|---|
| 9 | opensearch_xml = @conf['opensearch.xml'] |
|---|
| 10 | opensearch_title = @conf['opensearch.title'] |
|---|
| 11 | |
|---|
| 12 | add_header_proc do |
|---|
| 13 | result = <<-HTML |
|---|
| 14 | <link type="application/opensearchdescription+xml" rel="search" title="#{h(opensearch_title)}" href="#{h(opensearch_xml)}"> |
|---|
| 15 | HTML |
|---|
| 16 | result.gsub( /^\t\t/, '' ) |
|---|
| 17 | end |
|---|
| 18 | end |
|---|
| 19 | end |
|---|
| 20 | |
|---|
| 21 | add_conf_proc( 'opensearch_ad', 'OpenSearch Auto-Discovery' ) do |
|---|
| 22 | if @mode == 'saveconf' |
|---|
| 23 | @conf['opensearch.xml'] = @cgi.params['opensearch.xml'][0] |
|---|
| 24 | @conf['opensearch.title'] = @cgi.params['opensearch.title'][0] |
|---|
| 25 | end |
|---|
| 26 | |
|---|
| 27 | <<-HTML |
|---|
| 28 | <h3 class="subtitle">Tilte for OpenSearch</h3> |
|---|
| 29 | <p><input name="opensearch.title" value="#{h(@conf['opensearch.title'])}" size="80" /></p> |
|---|
| 30 | <h3 class="subtitle">URI for OpenSearch description XML</h3> |
|---|
| 31 | <p><input name="opensearch.xml" value="#{h(@conf['opensearch.xml'])}" size="80" /></p> |
|---|
| 32 | HTML |
|---|
| 33 | end |
|---|