Added Package Info stuff and License
Jeremy D

Jeremy D commited on 2011-12-30 13:27:28
Showing 5 changed files, with 680 additions and 30 deletions.

... ...
@@ -0,0 +1,429 @@
1
+$(document).ready(function(){
2
+	action_count = 1;
3
+	instruct_count =new Array();
4
+	instruct_count[action_count] = 1;
5
+
6
+	create_new_action();
7
+
8
+	$('#add_action').click(create_new_action);
9
+
10
+	$('#show_preview').click(show_instruct_preview);
11
+});
12
+
13
+/* Handles adding actions */
14
+function create_new_action()
15
+{
16
+	/* We have been through this before */
17
+	$('#action_container').append($('#action_template').html().replace(/#ACTIONINDEX#/g, action_count));
18
+
19
+	/* We need to bind the new create instruct button */
20
+	$('.add_instruct').click(create_new_instruct);
21
+
22
+	/* Now we pretend to click said element */
23
+	$('#action-' + action_count).find('.add_instruct').click();
24
+
25
+	/* Now add some actions to our buttons */
26
+	$('#action-' + action_count + ' .collapse_action').click(collapse_action);
27
+	$('#action-' + action_count + ' .expand_action').click(expand_action);
28
+	$('#action-' + action_count + ' .delete_action').click(delete_action);
29
+	$('#action-' + action_count + ' .restore_action').click(restore_action);
30
+
31
+	/* Move the index and add defaults */
32
+	action_count++;
33
+	instruct_count[action_count] = 1;
34
+
35
+	/* Update our counter */
36
+	update_counter();
37
+}
38
+
39
+/* Handles adding of instructions */
40
+function create_new_instruct()
41
+{
42
+	action_index = $(this).attr('data-action');
43
+
44
+	$('#action-' + action_index + '-instruct_container').append($('#instruct_template').html().replace(/#ACTIONINDEX#/g, action_index).replace(/#INSTRUCTINDEX#/g, instruct_count[action_index]));
45
+
46
+	$('#action-' + action_index + '-instruct_container .collapse_change').click(collapse_instruct);
47
+	$('#action-' + action_index + '-instruct_container .expand_change').click(expand_instruct);
48
+	$('#action-' + action_index + '-instruct_container .delete_change').click(delete_instruct);
49
+	$('#action-' + action_index + '-instruct_container .restore_change').click(restore_instruct);
50
+
51
+	$('#action-' + action_index + '-instruct_container .instruct_action').change(instruct_change);
52
+	$('#action-' + action_index + '-instruct-' + instruct_count[action_index] + '-action').change();
53
+
54
+	instruct_count[action_index]++;
55
+
56
+	update_counter();
57
+}
58
+
59
+/* Handles a change in the instruction */
60
+function instruct_change()
61
+{
62
+/*	action_index = $(selected).attr('data-action');
63
+	instruct_index = $(selected).attr('data-instruct');
64
+	this_act = $(selected).val();*/
65
+	action_index = $(this).attr('data-action');
66
+	instruct_index = $(this).attr('data-instruct');
67
+	this_act = $(this).val();
68
+
69
+	/* Then choose how to hide them */
70
+	if (this_act == 'modification')
71
+	{
72
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .destination').hide();
73
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .inline').hide();
74
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .code_block').hide();
75
+
76
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .reverse').show();
77
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .source').show();
78
+	}
79
+	else if ($.inArray(this_act, ["create-dir", "create-file", "remove-dir", "remove-file"]) > -1)
80
+	{
81
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .reverse').hide();
82
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .inline').hide();
83
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .code_block').hide();
84
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .source').hide();
85
+
86
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .destination').show();
87
+	}
88
+	else if ($.inArray(this_act, ["require-dir", "require-file", "move-dir", "move-file"]) > -1)
89
+	{
90
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .reverse').hide();
91
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .inline').hide();
92
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .code_block').hide();
93
+
94
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .source').show();
95
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .destination').show();
96
+	}
97
+	else if ($.inArray(this_act, ["code", "database", "readme"]) > -1)
98
+	{
99
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .reverse').hide();
100
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .destination').hide();
101
+
102
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .source').show();
103
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .inline').show();
104
+
105
+		/* Set our inline option */
106
+		instruct_inline($('#action-' + action_index + '-instruct-' + instruct_index + '-inline'));
107
+	}
108
+	else
109
+	{
110
+		/* We don't know what to do here! */
111
+		console.log("Unknown instruction action selected" [this_act, action_index, instruct_index], this);
112
+	}
113
+
114
+}
115
+
116
+/* Handles clicking the inline button */
117
+function instruct_inline(selected)
118
+{
119
+	action_index = $(selected).attr('data-action');
120
+	instruct_index = $(selected).attr('data-instruct');
121
+	is_inline = $(selected).is(':checked');
122
+
123
+	if (is_inline)
124
+	{
125
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .code_block').show();
126
+	}
127
+	else
128
+	{
129
+		$('#action-' + action_index + '-instruct-' + instruct_index + ' .code_block').hide();
130
+	}
131
+}
132
+
133
+/* Handles collapsing of the instruct */
134
+function collapse_instruct()
135
+{
136
+	action_index = $(this).attr('data-action');
137
+	instruct_index = $(this).attr('data-instruct');
138
+
139
+	/* Simply hide the instruct, and give a expand button */
140
+	$('#action-' + action_index + '-instruct-' + instruct_index + ' .edits').hide();
141
+	$('#action-' + action_index + '-instruct-' + instruct_index + ' .expand_change').show();
142
+	$(this).hide();
143
+}
144
+
145
+/* Handles expanding of the instruct */
146
+function expand_instruct()
147
+{
148
+	action_index = $(this).attr('data-action');
149
+	instruct_index = $(this).attr('data-instruct');
150
+
151
+	/* Simply show the instruct, and return to the original collapse button */
152
+	$('#action-' + action_index + '-instruct-' + instruct_index + ' .edits').show();
153
+	$('#action-' + action_index + '-instruct-' + instruct_index + ' .collapse_change').show();
154
+	$(this).hide();
155
+}
156
+
157
+/* Handles deleting a instruct */
158
+function delete_instruct()
159
+{
160
+	action_index = $(this).attr('data-action');
161
+	instruct_index = $(this).attr('data-instruct');
162
+
163
+	/* First we let the data know its deleted. */
164
+	$('#action-' + action_index + '-instruct-' + instruct_index + '-delete').val('1');
165
+
166
+	/* Then we hide this header, collapse the instruct and show the restore button */
167
+	$('#action-' + action_index + '-instruct-' + instruct_index + ' .edits').hide();
168
+	$('#action-' + action_index + '-instruct-' + instruct_index + ' .restore_change').show();
169
+	$(this).hide();
170
+
171
+	update_counter();
172
+}
173
+
174
+/* Handles restoring a instruct */
175
+function restore_instruct()
176
+{
177
+	action_index = $(this).attr('data-action');
178
+	instruct_index = $(this).attr('data-instruct');
179
+
180
+	/* First we let the data know its deleted. */
181
+	$('#action-' + action_index + '-instruct-' + instruct_index + '-delete').val('0');
182
+
183
+	/* Then we hide this header, collapse the instruct and show the restore button */
184
+	$('#action-' + action_index + '-instruct-' + instruct_index + ' .edits').show();
185
+	$('#action-' + action_index + '-instruct-' + instruct_index + ' .delete_change').show();
186
+	$(this).hide();
187
+
188
+	update_counter();
189
+}
190
+
191
+/* Handles collapsing of the action */
192
+function collapse_action()
193
+{
194
+	action_index = $(this).attr('data-action');
195
+
196
+	/* Simply hide the action, and give a expand button */
197
+	$('#action-' + action_index + '-instruct_container').hide();
198
+	$('#action-' + action_index + ' .expand_action').show();
199
+	$(this).hide();
200
+}
201
+
202
+/* Handles expanding of the action */
203
+function expand_action()
204
+{
205
+	action_index = $(this).attr('data-action');
206
+
207
+	/* Simply show the action, and return to the original collapse button */
208
+	$('#action-' + action_index + '-instruct_container').show();
209
+	$('#action-' + action_index + ' .collapse_action').show();
210
+	$(this).hide();
211
+}
212
+
213
+/* Handles deleting a action */
214
+function delete_action()
215
+{
216
+	action_index = $(this).attr('data-action');
217
+
218
+	/* First we let the data know its deleted. */
219
+	$('#action-' + action_index + '-delete').val('1');
220
+
221
+	/* Then we hide this header, collapse the instruct and show the restore button */
222
+	$('#action-' + action_index + '-instruct_container').hide();
223
+	$('#action-' + action_index + ' .restore_action').show();
224
+	$(this).hide();
225
+
226
+	update_counter();
227
+}
228
+
229
+/* Handles restoring a action */
230
+function restore_action()
231
+{
232
+	action_index = $(this).attr('data-action');
233
+
234
+	/* First we let the data know its deleted. */
235
+	$('#action-' + action_index + '-delete').val('0');
236
+
237
+	/* Then we hide this header, collapse the instruct and show the restore button */
238
+	$('#action-' + action_index + '-instruct-' + instruct_index + ' .instructs').show();
239
+	$('#action-' + action_index + ' .delete_action').show();
240
+	$(this).hide();
241
+
242
+	update_counter();
243
+}
244
+
245
+/* This is the nasty guy */
246
+function show_instruct_preview()
247
+{
248
+	$('#preview_container').show();
249
+
250
+	author = $('#basic_info_name').val().replace(/ /g,'_');
251
+	name = $('#basic_info_mod').val().replace(/ /g,'_');
252
+	version = $('#basic_info_version').val().replace(/ /g,'_');
253
+	type = $('#basic_info_type').val();
254
+
255
+	preview = '<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">' + "\n" + '\
256
+<!-- This package was generated by SleePys Package Maker at http://sleepycode.com -->' + "\n" + '\
257
+<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">' + "\n" + '\
258
+	<id>' + author + ':' + name + '</id>' + "\n" + '\
259
+	<name>' + name + '</name>' + "\n" + '\
260
+	<version>' + version + '</version>' + "\n" + '\
261
+	<type>' + type + '</type>' + "\n";
262
+
263
+	i = 1;
264
+	for (i = 1; i < action_count; i++)
265
+	{
266
+		/* Skip this instruct if we deleted it. */
267
+		if ($('#action-' + i + '-delete').val() == '1')
268
+		{
269
+			continue;
270
+		}
271
+
272
+		/* Get the action info */
273
+		action_type = $('#action-' + i + '-type').val();
274
+		action_smf_versions = $('#action-' + i + '-smf_versions').val();
275
+
276
+		/* We only want valid actions */
277
+		if ($.inArray(action_type, ["install", "upgrade", "uninstall"]) > -1)
278
+		{
279
+			preview += "\n" + '\
280
+	<' + action_type;
281
+		}
282
+		else
283
+		{
284
+			preview += "\n" + '\
285
+	<install';
286
+		}
287
+
288
+		/* Maybe we are limiting this to specific SMF versions. */
289
+		if (action_smf_versions != '')
290
+		{
291
+			preview += ' for="' + action_smf_versions + '"';
292
+		}
293
+		preview += '>';
294
+
295
+		/* Now onto the individual instructions we made! */
296
+		for (j = 1; j < instruct_count[i]; j++)
297
+		{
298
+			/* Skip this instruct if we deleted it. */
299
+			if ($('#action-' + i + '-instruct-' + j + '-delete').val() == '1')
300
+			{
301
+				continue;
302
+			}
303
+
304
+			/* Get our instruction info */
305
+			instruct_action		=	$('#action-' + i + '-instruct-' + j + '-action').val();
306
+			instruct_reverse	=	$('#action-' + i + '-instruct-' + j + '-reverse').is(':checked');
307
+			instruct_inline		=	$('#action-' + i + '-instruct-' + j + '-reverse').is(':checked');
308
+			instruct_source		=	$('#action-' + i + '-instruct-' + j + '-source').val();
309
+			instruct_destination=	$('#action-' + i + '-instruct-' + j + '-destination').val();
310
+			instruct_block		=	$('#action-' + i + '-instruct-' + j + '-block').val().replace('<' + '?php', '').replace('?' + '>', '');
311
+
312
+			/* Try to make it easier to handle these */
313
+			if ($.inArray(instruct_action, ["modification", "code", "database", "readme"]) > -1)
314
+			{
315
+				preview += "\n" + '\
316
+		<' + instruct_action;
317
+
318
+				/* Technically only modification should use reverse.
319
+					Code can just check $context['uninstall'] or use another file*/
320
+				if (instruct_reverse && instruct_action == 'modification')
321
+				{
322
+					preview += ' reverse="true"'; 
323
+				}
324
+
325
+				if (instruct_inline && $.inArray(instruct_action, ["code", "database", "readme"]) > -1)
326
+				{
327
+					preview += ' inline="true"';
328
+				}
329
+
330
+				if (instruct_inline && $.inArray(instruct_action, ["code", "database", "readme"]) > -1)
331
+				{
332
+					preview += '>' + instruct_block + "\n" + '\
333
+		</' + instruct_action + '>';
334
+				}
335
+				else
336
+				{
337
+					preview += " />\n";
338
+				}
339
+			}
340
+			else if ($.inArray(instruct_action, ["create-dir", "create-file", "remove-dir", "remove-file"]) > -1)
341
+			{
342
+				/* It may seem confusing to use destination here as name while the others use source.
343
+					Logic is just easier to follow from the GUI to think of destination as what happens to the SMF install,
344
+					While source is where it is in the modification. */
345
+				preview += "\n" + '\
346
+		<' + instruct_action + ' name="' + instruct_destination + '" />';
347
+			}
348
+			else if ($.inArray(instruct_action, ["require-dir", "require-file", "move-dir", "move-file"]) > -1)
349
+			{
350
+				/* We use source and destination correctly here, see note above for those actions. */
351
+				preview += "\n" + '\
352
+		<' + instruct_action + ' name="' + instruct_source + '" destination="' + instruct_destination + '" />';
353
+			}
354
+			else
355
+			{
356
+				/* We don't know what to do here! */
357
+				console.log("Unknown instruction action selected" [instruct_action, i, j], this);
358
+			}
359
+
360
+		}
361
+
362
+		/* Close up the action instruct */
363
+		if ($.inArray(action_type, ["install", "upgrade", "uninstall"]) > -1)
364
+		{
365
+			preview += "\n" + '\
366
+	</' + action_type + '>';
367
+		}
368
+		else
369
+		{
370
+			preview += "\n" + '\
371
+	</install>';
372
+		}
373
+
374
+	}
375
+
376
+	$('#preview').text(preview);
377
+}
378
+
379
+function download_action_generate()
380
+{
381
+	show_instruct_preview();
382
+
383
+	$.generateaction({
384
+		actionname	: "install.xml",
385
+		content		: $('#preview').text(),
386
+		script		: "downloader.php?download"
387
+	});
388
+}
389
+
390
+function download_action_data()
391
+{
392
+	show_instruct_preview();
393
+
394
+	data = $.base64.encode($('#preview').text());
395
+
396
+	/* No actionname can be specified by a data URI */
397
+	window.location = "data:application/octet-stream;charset=utf-8;base64," + data;
398
+}
399
+
400
+/* Updates our details counters */
401
+function update_counter()
402
+{
403
+	temp_action_count = 0;
404
+	temp_instruct_count = 0;
405
+
406
+	/* Because of deleted actions, we can't simply use length */
407
+	for (i = 1; i < action_count; i++)
408
+	{
409
+		/* Skip this instruct if we deleted it. */
410
+		if ($('#action-' + i + '-delete').val() == '1')
411
+			continue;
412
+
413
+		temp_action_count++;
414
+
415
+		for (j = 1; j < instruct_count[i]; j++)
416
+		{
417
+			/* Skip this instruct if we deleted it. */
418
+			if ($('#action-' + i + '-instruct-' + j + '-delete').val() == '1')
419
+			{
420
+				continue;
421
+			}
422
+
423
+			temp_instruct_count++;
424
+		}
425
+	}
426
+
427
+	$('#detail_actions').val(temp_action_count);
428
+	$('#detail_instructs').val(temp_instruct_count);
429
+}
0 430
\ No newline at end of file
... ...
@@ -22,15 +22,15 @@ function create_new_file()
22 22
 	/* Now we pretend to click said element */
23 23
 	$('#file-' + file_count).find('.add_edit').click();
24 24
 
25
+	$('#file-' + file_count + ' .collapse_file').click(collapse_file);
26
+	$('#file-' + file_count + ' .expand_file').click(expand_file);
27
+	$('#file-' + file_count + ' .delete_file').click(delete_file);
28
+	$('#file-' + file_count + ' .restore_file').click(restore_file);
29
+
25 30
 	/* Move the index and add defaults */
26 31
 	file_count++;
27 32
 	edit_count[file_count] = 1;
28 33
 
29
-	$('#file-' + file_index + ' .collapse_file').click(collapse_file);
30
-	$('#file-' + file_index + ' .expand_file').click(expand_file);
31
-	$('#file-' + file_index + ' .delete_file').click(delete_file);
32
-	$('#file-' + file_index + ' .restore_file').click(restore_file);
33
-
34 34
 	update_counter();
35 35
 }
36 36
 
... ...
@@ -298,7 +298,7 @@ function update_counter()
298 298
 	temp_edit_count = 0;
299 299
 	temp_line_count = 0;
300 300
 
301
-	/* Because of deleted files, we may have to skip this */
301
+	/* Because of deleted actions, we can't simply use length */
302 302
 	for (i = 1; i < file_count; i++)
303 303
 	{
304 304
 		/* Skip this edit if we deleted it. */
... ...
@@ -16,9 +16,9 @@ else
16 16
 
17 17
 echo '
18 18
 <!DOCTYPE html><!-- HTML 5 -->
19
-<html dir="ltr" lang="en-US">
19
+<html dir="ltr" lang="', $locale, '">
20 20
 <head>
21
-	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
21
+	<meta http-equiv="Content-Type" content="text/html;charset=', $charset, '">
22 22
 	<title>', $page_title, '</title>
23 23
 	<link rel="stylesheet" id="', $style, '-css" href="', $assets, '/', $style, '.css" type="text/css" media="all">';
24 24
 
... ...
@@ -72,7 +72,7 @@ echo '
72 72
 if ($action == 'mod')
73 73
 	mod_templates();
74 74
 elseif ($action == 'info')
75
-	info_section();
75
+	info_templates();
76 76
 
77 77
 echo '
78 78
 </body>
... ...
@@ -83,6 +83,8 @@ echo '
83 83
 */
84 84
 function mod_section()
85 85
 {
86
+	global $text;
87
+
86 88
 	echo '
87 89
 			<fieldset id="basic_info">
88 90
 				<legend>', $text['basic_info_header'], ' <span id="collapse_basic">^</span></legend>
... ...
@@ -131,6 +133,8 @@ function mod_section()
131 133
 */
132 134
 function mod_templates()
133 135
 {
136
+	global $text;
137
+
134 138
 	echo '
135 139
 <!-- This is the container for a new file -->
136 140
 <!-- Do not remove any id attribute.  This makes the magic work! -->
... ...
@@ -139,11 +143,11 @@ function mod_templates()
139 143
 				<input type="hidden" id="file-#FILEINDEX#-delete" value="0" />
140 144
 				<legend>
141 145
 					<span class="alignright">
142
-						<a href="#" class="delete_file" data-file="#FILEINDEX#">[', $text['file_header_delete'], ']</a>
143
-						<a href="#" class="restore_file" data-file="#FILEINDEX#" style="display: none;">[', $text['file_header_restore'], ']</a>
146
+						<a href="#" class="delete_file" data-file="#FILEINDEX#">[', $text['button_delete'], ']</a>
147
+						<a href="#" class="restore_file" data-file="#FILEINDEX#" style="display: none;">[', $text['button_restore'], ']</a>
144 148
 						&nbsp;&mdash;&nbsp;
145
-						<a href="#" class="collapse_file" data-file="#FILEINDEX#">[', $text['file_header_collapse'], ']</a>
146
-						<a href="#" class="expand_file" data-file="#FILEINDEX#" style="display: none;">[', $text['file_header_expand'], ']</a>
149
+						<a href="#" class="collapse_file" data-file="#FILEINDEX#">[', $text['button_collapse'], ']</a>
150
+						<a href="#" class="expand_file" data-file="#FILEINDEX#" style="display: none;">[', $text['button_expand'], ']</a>
147 151
 						</span>
148 152
 					', sprintf($text['file_header'], '#FILEINDEX#'), '
149 153
 				</legend>
... ...
@@ -180,11 +184,11 @@ function mod_templates()
180 184
 					<input type="hidden" id="file-#FILEINDEX#-edit-#EDITINDEX#-delete" value="0" />
181 185
 					<legend>
182 186
 						<span class="alignright">
183
-							<a href="#" class="delete_change" data-file="#FILEINDEX#" data-edit="#EDITINDEX#">[', $text['edit_header_delete'], ']</a>
184
-							<a href="#" class="restore_change" data-file="#FILEINDEX#" data-edit="#EDITINDEX#" style="display: none;">[', $text['edit_header_restore'], ']</a>
187
+							<a href="#" class="delete_change" data-file="#FILEINDEX#" data-edit="#EDITINDEX#">[', $text['button_delete'], ']</a>
188
+							<a href="#" class="restore_change" data-file="#FILEINDEX#" data-edit="#EDITINDEX#" style="display: none;">[', $text['button_restore'], ']</a>
185 189
 							&nbsp;&mdash;&nbsp;
186
-							<a href="#" class="collapse_change" data-file="#FILEINDEX#" data-edit="#EDITINDEX#">[', $text['edit_header_collapse'], ']</a>
187
-							<a href="#" class="expand_change" data-file="#FILEINDEX#" data-edit="#EDITINDEX#" style="display: none;">[', $text['edit_header_expand'], ']</a>
190
+							<a href="#" class="collapse_change" data-file="#FILEINDEX#" data-edit="#EDITINDEX#">[', $text['button_collapse'], ']</a>
191
+							<a href="#" class="expand_change" data-file="#FILEINDEX#" data-edit="#EDITINDEX#" style="display: none;">[', $text['button_expand'], ']</a>
188 192
 						</span>
189 193
 						', sprintf($text['edit_header'], '#FILEINDEX#', '#EDITINDEX#'), '
190 194
 					</legend>
... ...
@@ -219,17 +223,174 @@ function mod_templates()
219 223
 </div>';
220 224
 }
221 225
 
226
+/*
227
+ * The package-info section
228
+*/
229
+function info_section()
230
+{
231
+	global $text;
232
+
233
+	echo '
234
+			<fieldset id="basic_info">
235
+				<legend>', $text['basic_info_header'], ' <span id="collapse_basic">^</span></legend>
236
+				<dl class="info">
237
+					<dt>', $text['basic_your_name'], ':</dt>
238
+					<dd><input id="basic_info_name" /></dd>
239
+
240
+					<dt>', $text['basic_mod_name'], ':</dt>
241
+					<dd><input id="basic_info_mod" /></dd>
242
+
243
+					<dd>', $text['basic_mod_version'], ':</dt>
244
+					<dd><input id="basic_info_version" /></dd>
245
+
246
+					<dd>', $text['basic_mod_type'], ':</dt>
247
+					<dd><select name="basic_info_type">
248
+						<option value="modification">Modification</option>
249
+						<option value="avatar">Avatars</option>
250
+						<option value="smiley">Smileys</option>
251
+						<option value="language">Language</option>
252
+						<option value="other">Other</option>
253
+					</select>
254
+					</dd>
255
+
256
+				</dl>
257
+			</fieldset>
258
+			<fieldset id="details_info">
259
+				<legend>', $text['details_header'], ' <span id="collapse_basic">^</span></legend>
260
+				<dl class="info">
261
+					<dt>', $text['details_num_actions'], ':</dt>
262
+					<dd><input disabled="disabled" id="detail_actions" /></dd>
263
+
264
+					<dt>', $text['details_num_instructions'], ':&nbsp;&nbsp;</dt>
265
+					<dd><input disabled="disabled" id="detail_instructs" /></dd>
266
+				</dl>
267
+			</fieldset>
268
+
269
+			<br clear="all" />
270
+			<hr />
271
+			<form id="action_container">
272
+			</form>
273
+			<input type="button" id="add_action" value="', $text['button_add_action'], '" />
274
+			<input type="button" id="show_preview" value="', $text['button_preview'], '" />
275
+			<input type="button" id="download_file" value="', $text['button_download'], '" onclick="download_file_', ($use_php ? 'generate' : 'data'), '()" />
276
+			<br />
277
+			<fieldset id="preview_container" style="display: none;" class="edits" >
278
+				<legend>', $text['preview_header'], '</legend>
279
+				<textarea id="preview" cols="150" rows="25"></textarea>
280
+			</fieldset>
281
+				<br />';
282
+
283
+}
284
+
285
+/*
286
+ * This is the mod templates near the end of the page
287
+*/
288
+function info_templates()
289
+{
290
+	global $text;
291
+
292
+	echo '
293
+<!-- This is the container for a new action -->
294
+<!-- Do not remove any id attribute.  This makes the magic work! -->
295
+<div id="action_template" style="display: none;">
296
+			<fieldset id="action-#ACTIONINDEX#" class="edits">
297
+				<input type="hidden" id="action-#ACTIONINDEX#-delete" value="0" />
298
+				<legend>
299
+					<span class="alignright">
300
+						<a href="#" class="delete_action" data-action="#ACTIONINDEX#">[', $text['button_delete'], ']</a>
301
+						<a href="#" class="restore_action" data-action="#ACTIONINDEX#" style="display: none;">[', $text['button_restore'], ']</a>
302
+						&nbsp;&mdash;&nbsp;
303
+						<a href="#" class="collapse_action" data-action="#ACTIONINDEX#">[', $text['button_collapse'], ']</a>
304
+						<a href="#" class="expand_action" data-action="#ACTIONINDEX#" style="display: none;">[', $text['button_expand'], ']</a>
305
+						</span>
306
+					', sprintf($text['action_header'], '#ACTIONINDEX#'), '
307
+				</legend>
308
+
309
+				', $text['type_of_action'], ':
310
+				<select id="action-#ACTIONINDEX#-type">
311
+					<option value="install">', $text['type_of_action_install'], '</option>
312
+					<option value="uninstall">', $text['type_of_action_uninstall'], '</option>
313
+					<option value="upgrade">', $text['type_of_action_upgrade'], '</option>
314
+				</select>
315
+
316
+				<span class="pad">', $text['action_smf_versions'], ':
317
+					<input type="text" id="action-#ACTIONINDEX#-smf_versions" size="60" value="SMF 2.0 RC5, SMF 2.0-2.0.99" />
318
+				</span>
319
+
320
+				<div id="action-#ACTIONINDEX#-instruct_container">
321
+				<hr />
322
+				</div>
323
+				<input type="button" class="add_instruct" data-action="#ACTIONINDEX#" value="', $text['button_add_instruct'], '" />
324
+			</fieldset>
325
+			<hr />
326
+</div>
327
+
328
+<!-- This is the container for a new edit -->
329
+<!-- Do not remove any id attribute.  This makes the magic work! -->
330
+<div id="instruct_template" style="display: none;">
331
+				<fieldset id="action-#ACTIONINDEX#-instruct-#INSTRUCTINDEX#" class="edit">
332
+					<input type="hidden" id="action-#ACTIONINDEX#-instruct-#INSTRUCTINDEX#-delete" value="0" />
333
+					<legend>
334
+						<span class="alignright">
335
+							<a href="#" class="delete_change" data-action="#ACTIONINDEX#" data-instruct="#INSTRUCTINDEX#">[', $text['button_delete'], ']</a>
336
+							<a href="#" class="restore_change" data-action="#ACTIONINDEX#" data-instruct="#INSTRUCTINDEX#" style="display: none;">[', $text['button_restore'], ']</a>
337
+							&nbsp;&mdash;&nbsp;
338
+							<a href="#" class="collapse_change" data-action="#ACTIONINDEX#" data-instruct="#INSTRUCTINDEX#">[', $text['button_collapse'], ']</a>
339
+							<a href="#" class="expand_change" data-action="#ACTIONINDEX#" data-instruct="#INSTRUCTINDEX#" style="display: none;">[', $text['button_expand'], ']</a>
340
+						</span>
341
+						', sprintf($text['instruct_header'], '#ACTIONINDEX#', '#INSTRUCTINDEX#'), '
342
+					</legend>
343
+
344
+					<dl class="edits">
345
+						<dt>', $text['instruct_action'], ':</dt>
346
+						<dd><select class="instruct_action" id="action-#ACTIONINDEX#-instruct-#INSTRUCTINDEX#-action" data-action="#ACTIONINDEX#" data-instruct="#INSTRUCTINDEX#">
347
+							<option value="modification">', $text['instruct_action_modification'], '</option>
348
+							<option value="code">', $text['instruct_action_code'], '</option>
349
+							<option value="database">', $text['instruct_action_database'], '</option>
350
+							<option value="create-dir">', $text['instruct_action_create_dir'], '</option>
351
+							<option value="create-file">', $text['instruct_action_create_file'], '</option>
352
+							<option value="require-dir">', $text['instruct_action_require_dir'], '</option>
353
+							<option value="require-file">', $text['instruct_action_require_file'], '</option>
354
+							<option value="move-dir">', $text['instruct_action_move_dir'], '</option>
355
+							<option value="move-file">', $text['instruct_action_move_file'], '</option>
356
+							<option value="remove-dir">', $text['instruct_action_delete_dir'], '</option>
357
+							<option value="remove-file">', $text['instruct_action_delete_file'] , '</option>
358
+							<option value="readme">', $text['instruct_action_readme'], '</option>
359
+						<select></dd>
360
+
361
+						<dt class="reverse">', $text['action_reverse'], ':</dt>
362
+						<dd class="reverse"><input type="checkbox" id="action-#ACTIONINDEX#-instruct-#INSTRUCTINDEX#-reverse"></dd>
363
+
364
+						<dt class="source">', $text['action_source'], '</dt>
365
+						<dd class="source"><input id="action-#ACTIONINDEX#-instruct-#INSTRUCTINDEX#-source" type="text" /></dd>
366
+
367
+						<dt class="destination">', $text['action_destination'], '</dt>
368
+						<dd class="destination"><input id="action-#ACTIONINDEX#-instruct-#INSTRUCTINDEX#-destination" type="text" /></dd>
369
+
370
+						<dt class="inline">', $text['action_inline'], ':</dt>
371
+						<dd class="inline"><input type="checkbox" id="action-#ACTIONINDEX#-instruct-#INSTRUCTINDEX#-inline" onchange="instruct_inline(this)" data-action="#ACTIONINDEX#" data-instruct="#INSTRUCTINDEX#"></dd>
372
+
373
+						<dt class="code_block">', $text['action_code_block'], ':</dt>
374
+						<dd class="code_block"><textarea id="action-#ACTIONINDEX#-instruct-#INSTRUCTINDEX#-block" cols="75" rows="7"></textarea></dd>
375
+					</dl>
376
+				</fieldset>
377
+				<br />
378
+</div>';
379
+}
380
+
222 381
 /*
223 382
  * The index section
224 383
 */
225 384
 function index_section()
226 385
 {
386
+	global $text;
387
+
227 388
 	echo '
228 389
 		<br clear="all" />
229
-		<p id="welcome">Welcome to the SMF Package Maker.  Below are the simple three steps to packaging your modification.</p>
390
+		<p id="welcome">', $text['index_welcome'], '.</p>
230 391
 		<ol id="steps">
231
-			<li><a href="index.php?action=mod">Mod Maker</a></li>
232
-			<li><a href="index.php?action=info">Package-Info Maker</a></li>
233
-			<li>Compress as .zip or .tgz (.tar.gz)</li>
392
+			<li><a href="index.php?action=mod">', $text['index_mod'], '</a></li>
393
+			<li><a href="index.php?action=info">', $text['index_info'], '</a></li>
394
+			<li>', $text['index_compress'], '</li>
234 395
 		</ol>';
235 396
 }
236 397
\ No newline at end of file
... ...
@@ -2,6 +2,7 @@
2 2
 
3 3
 // The locale 
4 4
 $locale = 'en-US';
5
+$charset = 'UTF-8';
5 6
 
6 7
 // The name of this script.
7 8
 $text['script_name'] = 'SMF Package Generator';
... ...
@@ -12,20 +12,26 @@ $text['basic_info_header'] = 'Basic Modification Information';
12 12
 $text['basic_your_name'] = 'Your Name';
13 13
 $text['basic_mod_name'] = 'Modification Name';
14 14
 $text['basic_mod_version'] = 'Modification Version';
15
+$text['basic_mod_type'] = 'Modification Type';
16
+$text['details_header'] = 'Details';
15 17
 
18
+// Some basic buttons.
19
+$text['button_preview'] = 'Preview Changes';
20
+$text['button_download'] = 'Download File';
21
+$text['button_delete'] = 'Delete';
22
+$text['button_restore'] = 'Restore';
23
+$text['button_collapse'] = 'Collapse';
24
+$text['button_expand'] = 'Expand';
16 25
 
26
+// The Mod Maker Part
17 27
 	// Details section.
18
-$text['details_header'] = 'Details';
19 28
 	$text['details_num_files'] = 'Number of Files';
20 29
 	$text['details_num_edits'] = 'Number of Edits';
21 30
 	$text['details_num_lines'] = 'Number of lines';
22 31
 
23 32
 	// Buttons.
24
-$text['button_add_file'] = 'Add another File';
25
-$text['button_preview'] = 'Preview Changes';
26
-$text['button_download'] = 'Download File';
27 33
 	$text['button_add_edit'] = 'Add another Edit';
28
-
34
+	$text['button_add_file'] = 'Add another File';
29 35
 
30 36
 	// Preview.
31 37
 	$text['preview_header'] = 'Your .xml file';
... ...
@@ -33,10 +39,6 @@ $text['preview_header'] = 'Your .xml file';
33 39
 
34 40
 	// File sections. Note that %1$s here represents the file number.
35 41
 	$text['file_header'] = 'File #%1$s';
36
-$text['file_header_delete'] = 'Delete';
37
-$text['file_header_restore'] = 'Restore';
38
-$text['file_header_collapse'] = 'Collapse';
39
-$text['file_header_expand'] = 'Expand';
40 42
 
41 43
 	$text['file_to_edit'] = 'File to edit';
42 44
 
... ...
@@ -67,3 +69,51 @@ $text['edit_errors'] = 'Error Handling';
67 69
 	$text['edit_errors_fail'] = 'Fail (Default)';
68 70
 	$text['edit_errors_ignore'] = 'Create File with edits (ignore)';
69 71
 	$text['edit_errors_required'] = 'Require the search to fail';
72
+
73
+
74
+// The Package Info Section. Note that %1$s here represents the action number.
75
+	$text['details_num_actions'] = 'Number of Actions';
76
+	$text['details_num_instructions'] = 'Number of Instructions';
77
+
78
+	$text['button_add_action'] = 'Add Action';
79
+	$text['button_add_instruct'] = 'Add Instruction';
80
+
81
+	$text['action_header'] = 'Action %1$s';
82
+
83
+	// The Edit section
84
+	$text['type_of_action'] = 'Type of Action';
85
+	$text['type_of_action_install'] = 'Install';
86
+	$text['type_of_action_uninstall'] = 'Uninstall';
87
+	$text['type_of_action_upgrade'] = 'Upgrade';
88
+	$text['action_smf_versions'] = 'SMF Versions';
89
+
90
+
91
+	// Instruction stuff. Note that %1$s here represents action number, while %2$s represents instruction number.
92
+	$text['instruct_header'] = 'Action #%1$s &mdash; Instruction #%2$s';
93
+
94
+	$text['instruct_action'] = 'What to do';
95
+	$text['instruct_action_modification'] = 'Modification (.xml or .mod)';
96
+	$text['instruct_action_code'] = 'Execute code';
97
+	$text['instruct_action_database'] = 'Execute Database';
98
+	$text['instruct_action_create_dir'] = 'Create Directory';
99
+	$text['instruct_action_create_file'] = 'Create File';
100
+	$text['instruct_action_require_dir'] = 'Install files from Directory';
101
+	$text['instruct_action_require_file'] = 'Install file from File';
102
+	$text['instruct_action_move_dir'] = 'Move/Rename a Directory';
103
+	$text['instruct_action_move_file'] = 'Move/Rename a File';
104
+	$text['instruct_action_delete_dir'] = 'Remove a Directory';
105
+	$text['instruct_action_delete_file'] = 'Remove a File';
106
+	$text['instruct_action_readme'] = 'Readme Installer';
107
+
108
+	$text['action_inline'] = 'Inline Edit';
109
+	$text['action_reverse'] = 'Reverse Modification Edits';
110
+	$text['action_destination'] = 'Destination';
111
+	$text['action_source'] = 'File/Folder to Include';
112
+	$text['action_code_block'] = 'Inline Code';
113
+	
114
+
115
+// The Index section
116
+	$text['index_welcome'] = 'Welcome to the SMF Package Maker.  Below are the simple three steps to packaging your modification';
117
+	$text['index_mod'] = 'Mod Maker';
118
+	$text['index_info'] = 'Package-Info Maker';
119
+	$text['index_compress'] = 'Compress as .zip or .tgz (.tar.gz)';
70 120
\ No newline at end of file
... ...
@@ -0,0 +1,9 @@
1
+Copyright (c) 2011, JeremyD (SleePy [at] simplemachines [period] org)
2
+All rights reserved.
3
+
4
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7
+Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
8
+
9
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0 10
\ No newline at end of file
1 11