File: hide-mail-field.rb

package info (click to toggle)
tdiary 5.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,092 kB
  • sloc: ruby: 23,031; javascript: 1,029; xml: 325; makefile: 26; sh: 2
file content (46 lines) | stat: -rw-r--r-- 956 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#
# hide-mail-field.rb: Hide E-mail field in TSUKKOMI form against spams.
#
# To enable this plugin effective, you have to add '@' or '.*' into E-mail
# address field in spamfilter plugin.
#
# Copyright (C) 2007 by TADA Tadahi <sho@spc.gr.jp>
# Distributed under GPL2 or any later version.
#
add_header_proc do
	if @mode == 'day'
		<<-STYLE
		<style type="text/css"><!--
			form.comment div.mail { display: none; }
		--></style>
		STYLE
	else
		''
	end
end

add_footer_proc do
	if @mode == 'day'
		<<-SCRIPT
		<script type="text/javascript"><!--
			document.getElementsByName("mail")[0].value = "";
		//--></script>
		SCRIPT
	else
		''
	end
end

add_conf_proc( 'hide-mail-field', @hide_mail_field_label_conf, 'security' ) do
	if @mode == 'saveconf'
		@conf['comment_description'] = @cgi.params['comment_description'][0]
	end
	hide_mail_field_conf_html
end

# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End: