Project

General

Profile

mod_dirlisting_patch.txt

molyland, 2011-11-16 11:12

 
1
### Eclipse Workspace Patch 1.0
2
#P lighttpd
3
Index: src/mod_dirlisting.c
4
===================================================================
5
--- src/mod_dirlisting.c	(revisione 2805)
6
+++ src/mod_dirlisting.c	(copia locale)
7
@@ -63,6 +63,7 @@
8
 	excludes_buffer *excludes;
9
 
10
 	buffer *external_css;
11
+	buffer *external_js;
12
 	buffer *encoding;
13
 	buffer *set_footer;
14
 } plugin_config;
15
@@ -178,6 +179,7 @@
16
 
17
 			excludes_buffer_free(s->excludes);
18
 			buffer_free(s->external_css);
19
+			buffer_free(s->external_js);
20
 			buffer_free(s->encoding);
21
 			buffer_free(s->set_footer);
22
 
23
@@ -241,6 +243,7 @@
24
 #define CONFIG_ACTIVATE         "dir-listing.activate"
25
 #define CONFIG_HIDE_DOTFILES    "dir-listing.hide-dotfiles"
26
 #define CONFIG_EXTERNAL_CSS     "dir-listing.external-css"
27
+#define CONFIG_EXTERNAL_JS      "dir-listing.external-js"
28
 #define CONFIG_ENCODING         "dir-listing.encoding"
29
 #define CONFIG_SHOW_README      "dir-listing.show-readme"
30
 #define CONFIG_HIDE_README_FILE "dir-listing.hide-readme-file"
31
@@ -262,16 +265,17 @@
32
 		{ CONFIG_ACTIVATE,         NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
33
 		{ CONFIG_HIDE_DOTFILES,    NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 2 */
34
 		{ CONFIG_EXTERNAL_CSS,     NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },  /* 3 */
35
-		{ CONFIG_ENCODING,         NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },  /* 4 */
36
-		{ CONFIG_SHOW_README,      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 5 */
37
-		{ CONFIG_HIDE_README_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 6 */
38
-		{ CONFIG_SHOW_HEADER,      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 7 */
39
-		{ CONFIG_HIDE_HEADER_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
40
-		{ CONFIG_DIR_LISTING,      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
41
-		{ CONFIG_SET_FOOTER,       NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },  /* 10 */
42
-		{ CONFIG_ENCODE_README,    NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 11 */
43
-		{ CONFIG_ENCODE_HEADER,    NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
44
-		{ CONFIG_AUTO_LAYOUT,      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
45
+		{ CONFIG_EXTERNAL_JS,      NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },  /* 4 */
46
+		{ CONFIG_ENCODING,         NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },  /* 5 */
47
+		{ CONFIG_SHOW_README,      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 6 */
48
+		{ CONFIG_HIDE_README_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 7 */
49
+		{ CONFIG_SHOW_HEADER,      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 8 */
50
+		{ CONFIG_HIDE_HEADER_FILE, NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 9 */
51
+		{ CONFIG_DIR_LISTING,      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 10 */
52
+		{ CONFIG_SET_FOOTER,       NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION },  /* 11 */
53
+		{ CONFIG_ENCODE_README,    NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 12 */
54
+		{ CONFIG_ENCODE_HEADER,    NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 13 */
55
+		{ CONFIG_AUTO_LAYOUT,      NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 14 */
56
 
57
 		{ NULL,                          NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
58
 	};
59
@@ -288,6 +292,7 @@
60
 		s->excludes = excludes_buffer_init();
61
 		s->dir_listing = 0;
62
 		s->external_css = buffer_init();
63
+		s->external_js = buffer_init();
64
 		s->hide_dot_files = 0;
65
 		s->show_readme = 0;
66
 		s->hide_readme_file = 0;
67
@@ -304,16 +309,17 @@
68
 		cv[1].destination = &(s->dir_listing);
69
 		cv[2].destination = &(s->hide_dot_files);
70
 		cv[3].destination = s->external_css;
71
-		cv[4].destination = s->encoding;
72
-		cv[5].destination = &(s->show_readme);
73
-		cv[6].destination = &(s->hide_readme_file);
74
-		cv[7].destination = &(s->show_header);
75
-		cv[8].destination = &(s->hide_header_file);
76
-		cv[9].destination = &(s->dir_listing); /* old name */
77
-		cv[10].destination = s->set_footer;
78
-		cv[11].destination = &(s->encode_readme);
79
-		cv[12].destination = &(s->encode_header);
80
-		cv[13].destination = &(s->auto_layout);
81
+		cv[4].destination = s->external_js;
82
+		cv[5].destination = s->encoding;
83
+		cv[6].destination = &(s->show_readme);
84
+		cv[7].destination = &(s->hide_readme_file);
85
+		cv[8].destination = &(s->show_header);
86
+		cv[9].destination = &(s->hide_header_file);
87
+		cv[10].destination = &(s->dir_listing); /* old name */
88
+		cv[11].destination = s->set_footer;
89
+		cv[12].destination = &(s->encode_readme);
90
+		cv[13].destination = &(s->encode_header);
91
+		cv[14].destination = &(s->auto_layout);
92
 
93
 		p->config_storage[i] = s;
94
 		ca = ((data_config *)srv->config_context->data[i])->value;
95
@@ -336,6 +342,7 @@
96
 
97
 	PATCH(dir_listing);
98
 	PATCH(external_css);
99
+	PATCH(external_js);
100
 	PATCH(hide_dot_files);
101
 	PATCH(encoding);
102
 	PATCH(show_readme);
103
@@ -367,6 +374,8 @@
104
 				PATCH(hide_dot_files);
105
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXTERNAL_CSS))) {
106
 				PATCH(external_css);
107
+			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_EXTERNAL_JS))) {
108
+				PATCH(external_js);
109
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_ENCODING))) {
110
 				PATCH(encoding);
111
 			} else if (buffer_is_equal_string(du->key, CONST_STR_LEN(CONFIG_SHOW_README))) {
112
@@ -491,6 +500,12 @@
113
 		buffer_append_string_encoded(out, CONST_BUF_LEN(con->uri.path), ENCODING_MINIMAL_XML);
114
 		buffer_append_string_len(out, CONST_STR_LEN("</title>\n"));
115
 
116
+		if (p->conf.external_js->used > 1) {
117
+			buffer_append_string_len(out, CONST_STR_LEN("<script type=\"text/javascript\" src=\""));
118
+			buffer_append_string_buffer(out, p->conf.external_js);
119
+			buffer_append_string_len(out, CONST_STR_LEN("\" ></script>\n"));
120
+		}
121
+
122
 		if (p->conf.external_css->used > 1) {
123
 			buffer_append_string_len(out, CONST_STR_LEN("<link rel=\"stylesheet\" type=\"text/css\" href=\""));
124
 			buffer_append_string_buffer(out, p->conf.external_css);