Jeremy D commited on 2011-12-31 14:54:12
Showing 8 changed files, with 120 additions and 58 deletions.
... | ... |
@@ -12,10 +12,10 @@ if (!defined('PacManGen')) { exit('[' . basename(__FILE__) . '] Direct access re |
12 | 12 |
*/ |
13 | 13 |
function info_section() |
14 | 14 |
{ |
15 |
- global $text, $use_php; |
|
15 |
+ global $text, $pmg; |
|
16 | 16 |
|
17 | 17 |
echo ' |
18 |
- <fieldset id="basic_info"> |
|
18 |
+ <fieldset id="basic_info" class="edits"> |
|
19 | 19 |
<legend> |
20 | 20 |
', $text['basic_info_header'], ' |
21 | 21 |
<a href="#" id="collapse_basic">[', $text['button_collapse'], ']</a> |
... | ... |
@@ -43,7 +43,7 @@ function info_section() |
43 | 43 |
|
44 | 44 |
</dl> |
45 | 45 |
</fieldset> |
46 |
- <fieldset id="details_info"> |
|
46 |
+ <fieldset id="details_info" class="edits"> |
|
47 | 47 |
<legend> |
48 | 48 |
', $text['details_header'], ' |
49 | 49 |
<a href="#" id="collapse_details">[', $text['button_collapse'], ']</a> |
... | ... |
@@ -64,7 +64,7 @@ function info_section() |
64 | 64 |
</form> |
65 | 65 |
<input type="button" id="add_action" value="', $text['button_add_action'], '" /> |
66 | 66 |
<input type="button" id="show_preview" value="', $text['button_preview'], '" /> |
67 |
- <input type="button" id="download_file" value="', $text['button_download'], '" onclick="download_file_', ($use_php ? 'generate' : 'data'), '()" /> |
|
67 |
+ <input type="button" id="download_file" value="', $text['button_download'], '" onclick="download_action_', ($pmg['use_php'] ? 'generate' : 'data'), '()" /> |
|
68 | 68 |
<br /> |
69 | 69 |
<fieldset id="preview_container" style="display: none;" class="edits" > |
70 | 70 |
<legend>', $text['preview_header'], '</legend> |
... | ... |
@@ -12,10 +12,10 @@ if (!defined('PacManGen')) { exit('[' . basename(__FILE__) . '] Direct access re |
12 | 12 |
*/ |
13 | 13 |
function mod_section() |
14 | 14 |
{ |
15 |
- global $text, $use_php; |
|
15 |
+ global $text, $pmg; |
|
16 | 16 |
|
17 | 17 |
echo ' |
18 |
- <fieldset id="basic_info"> |
|
18 |
+ <fieldset id="basic_info" class="edits"> |
|
19 | 19 |
<legend> |
20 | 20 |
', $text['basic_info_header'], ' |
21 | 21 |
<a href="#" id="collapse_basic">[', $text['button_collapse'], ']</a> |
... | ... |
@@ -33,7 +33,7 @@ function mod_section() |
33 | 33 |
|
34 | 34 |
</dl> |
35 | 35 |
</fieldset> |
36 |
- <fieldset id="details_info"> |
|
36 |
+ <fieldset id="details_info" class="edits"> |
|
37 | 37 |
<legend> |
38 | 38 |
', $text['details_header'], ' |
39 | 39 |
<a href="#" id="collapse_details">[', $text['button_collapse'], ']</a> |
... | ... |
@@ -56,7 +56,7 @@ function mod_section() |
56 | 56 |
<form id="file_container"></form> |
57 | 57 |
<input type="button" id="add_file" value="', $text['button_add_file'], '" /> |
58 | 58 |
<input type="button" id="show_preview" value="', $text['button_preview'], '" /> |
59 |
- <input type="button" id="download_file" value="', $text['button_download'], '" onclick="download_file_', ($use_php ? 'generate' : 'data'), '()" /> |
|
59 |
+ <input type="button" id="download_file" value="', $text['button_download'], '" onclick="download_file_', ($pmg['use_php'] ? 'generate' : 'data'), '()" /> |
|
60 | 60 |
<br /> |
61 | 61 |
<fieldset id="preview_container" style="display: none;" class="edits" > |
62 | 62 |
<legend>', $text['preview_header'], '</legend> |
... | ... |
@@ -93,17 +93,12 @@ input, textarea |
93 | 93 |
font-family: 'Paytone One', Verdana, Arial; |
94 | 94 |
} |
95 | 95 |
|
96 |
-#container{ |
|
96 |
+#container |
|
97 |
+{ |
|
97 | 98 |
width: 90%; |
98 | 99 |
max-width: 1227px; |
99 | 100 |
margin: 0 auto; |
100 | 101 |
} |
101 |
-#wrap |
|
102 |
-{ |
|
103 |
- width: 100%; |
|
104 |
- background: #fff; |
|
105 |
- min-height: 41em; |
|
106 |
-} |
|
107 | 102 |
#content |
108 | 103 |
{ |
109 | 104 |
float: left; |
... | ... |
@@ -140,6 +134,14 @@ input, textarea |
140 | 134 |
text-decoration: none; |
141 | 135 |
} |
142 | 136 |
|
137 |
+/*** The Specific CSS starts here, the rest is the headers, footers and general ***/ |
|
138 |
+#pacmangen |
|
139 |
+{ |
|
140 |
+ width: 100%; |
|
141 |
+ background: #fff; |
|
142 |
+ min-height: 41em; |
|
143 |
+} |
|
144 |
+ |
|
143 | 145 |
dl.info dt |
144 | 146 |
{ |
145 | 147 |
clear: both; |
... | ... |
@@ -221,6 +220,15 @@ fieldset.edits |
221 | 220 |
padding: 5px 10px; |
222 | 221 |
margin: 0 10px; |
223 | 222 |
background: #eee; |
223 |
+ border: 1px solid #000; |
|
224 |
+} |
|
225 |
+ |
|
226 |
+fieldset.edits fieldset |
|
227 |
+{ |
|
228 |
+ padding: 5px 10px; |
|
229 |
+ background: #eee; |
|
230 |
+ border: 1px solid #000; |
|
231 |
+ border-top: 1px dotted #000; |
|
224 | 232 |
} |
225 | 233 |
|
226 | 234 |
fieldset.edits legend |
... | ... |
@@ -1 +1,2 @@ |
1 |
+/* https://github.com/carlo/jquery-base64 */ |
|
1 | 2 |
"use strict";jQuery.base64=(function($){var _PADCHAR="=",_ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_VERSION="1.0";function _getbyte64(s,i){var idx=_ALPHA.indexOf(s.charAt(i));if(idx===-1){throw"Cannot decode base64"}return idx}function _decode(s){var pads=0,i,b10,imax=s.length,x=[];s=String(s);if(imax===0){return s}if(imax%4!==0){throw"Cannot decode base64"}if(s.charAt(imax-1)===_PADCHAR){pads=1;if(s.charAt(imax-2)===_PADCHAR){pads=2}imax-=4}for(i=0;i<imax;i+=4){b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6)|_getbyte64(s,i+3);x.push(String.fromCharCode(b10>>16,(b10>>8)&255,b10&255))}switch(pads){case 1:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6);x.push(String.fromCharCode(b10>>16,(b10>>8)&255));break;case 2:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12);x.push(String.fromCharCode(b10>>16));break}return x.join("")}function _getbyte(s,i){var x=s.charCodeAt(i);if(x>255){throw"INVALID_CHARACTER_ERR: DOM Exception 5"}return x}function _encode(s){if(arguments.length!==1){throw"SyntaxError: exactly one argument required"}s=String(s);var i,b10,x=[],imax=s.length-s.length%3;if(s.length===0){return s}for(i=0;i<imax;i+=3){b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8)|_getbyte(s,i+2);x.push(_ALPHA.charAt(b10>>18));x.push(_ALPHA.charAt((b10>>12)&63));x.push(_ALPHA.charAt((b10>>6)&63));x.push(_ALPHA.charAt(b10&63))}switch(s.length-imax){case 1:b10=_getbyte(s,i)<<16;x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_PADCHAR+_PADCHAR);break;case 2:b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8);x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_ALPHA.charAt((b10>>6)&63)+_PADCHAR);break}return x.join("")}return{decode:_decode,encode:_encode,VERSION:_VERSION}}(jQuery)); |
2 | 3 |
\ No newline at end of file |
... | ... |
@@ -387,8 +387,8 @@ function download_action_generate() |
387 | 387 |
{ |
388 | 388 |
show_instruct_preview(); |
389 | 389 |
|
390 |
- $.generateaction({ |
|
391 |
- actionname : 'install.xml', |
|
390 |
+ $.generateFile({ |
|
391 |
+ filename : 'package-info.xml', |
|
392 | 392 |
content : $('#preview').text(), |
393 | 393 |
script : $('#downloadername').val() + '?download' |
394 | 394 |
}); |
... | ... |
@@ -10,11 +9,11 @@ define('PacManGen', true); |
10 | 9 |
require_once(dirname(__FILE__) . '/settings.php'); |
11 | 10 |
|
12 | 11 |
// Only invoke the download when it is enabled and we are going to try to do it. |
13 |
-if (!$use_php || !isset($_GET['download'])) |
|
12 |
+if (empty($pmg['use_php']) || !isset($_GET['download'])) |
|
14 | 13 |
exit ('Invalid Download content'); |
15 | 14 |
|
16 | 15 |
// Give them a download. |
17 | 16 |
header('Cache-Control: '); |
18 | 17 |
header('Content-type: text/plain'); |
19 |
-header ('Content-Disposition: attachment; filename="install.xml"'); |
|
18 |
+header ('Content-Disposition: attachment; filename="' . (isset($_POST['filename']) && $_POST['filename'] == 'package-info.xml' ? 'package-info.xml' : 'install.xml') . '"'); |
|
20 | 19 |
exit($_POST['content']); |
21 | 20 |
\ No newline at end of file |
... | ... |
@@ -9,29 +9,81 @@ define('PacManGen', true); |
9 | 9 |
|
10 | 10 |
// Default our action. |
11 | 11 |
if (!isset($_GET['action']) || !in_array($_GET['action'], array('mod', 'info'))) |
12 |
- $action = 'index'; |
|
12 |
+ $pmg_action = 'index'; |
|
13 | 13 |
else |
14 |
- $action = $_GET['action']; |
|
14 |
+ $pmg_action = $_GET['action']; |
|
15 | 15 |
|
16 | 16 |
// Load up some files. |
17 | 17 |
require_once(dirname(__FILE__) . '/settings.php'); |
18 |
-require_once(dirname(__FILE__) . '/_' . $action . 'maker.php'); |
|
19 |
-require_once(dirname(__FILE__) . '/language/' . $language . '.php'); |
|
18 |
+require_once(dirname(__FILE__) . '/_' . $pmg_action . 'maker.php'); |
|
19 |
+require_once(dirname(__FILE__) . '/language/' . $pmg['language'] . '.php'); |
|
20 |
+ |
|
21 |
+if (!empty($pmg['theme_integration_file']) && isset($pmg['theme_integration_file']) && file_exists($pmg['theme_integration_file'])) |
|
22 |
+ require_once($pmg['theme_integration_file']); |
|
23 |
+ |
|
24 |
+$headers['css'][] = array('name' => $pmg['style'] . '-css', 'href' => $pmg['assets'] . '/' . $pmg['style'] . '.css', 'media' => 'all'); |
|
25 |
+ |
|
26 |
+// We don't need these on the index. |
|
27 |
+if ($pmg_action != 'index') |
|
28 |
+{ |
|
29 |
+ $headers['js'][] = array('name' => 'jquery', 'src' => $pmg['assets'] . '/jquery.min.js'); |
|
30 |
+ $headers['js'][] = array('name' => 'generatefile', 'src' => $pmg['assets'] . '/' . ($pmg['use_php'] ? 'jquery.generateFile.js' : 'jquery.base64.js')); |
|
31 |
+ $headers['js'][] = array('name' => 'script', 'src' => $pmg['assets'] . '/script_' . $pmg_action . '.js'); |
|
32 |
+} |
|
33 |
+ |
|
34 |
+if (!empty($pmg['theme_integration']) && function_exists('pacman_header')) |
|
35 |
+ pacman_header($headers); |
|
36 |
+else |
|
37 |
+ default_pacman_header($headers); |
|
38 |
+ |
|
39 |
+ echo ' |
|
40 |
+ <div id="pacmangen" class="action_', $pmg_action, '">'; |
|
41 |
+ |
|
42 |
+// If we are using the PHP downloader, we need this. |
|
43 |
+if (!empty($pmg['use_php'])) |
|
44 |
+ echo ' |
|
45 |
+ <input type="hidden" id="downloadername" value="', $pmg['downloadname'], '" />'; |
|
46 |
+ |
|
47 |
+// Call up the right section. |
|
48 |
+$function = $pmg_action . '_section'; |
|
49 |
+$function(); |
|
50 |
+ |
|
51 |
+echo ' |
|
52 |
+ </div>'; |
|
53 |
+ |
|
54 |
+// Bring in the correct templates. |
|
55 |
+$function = $pmg_action . '_templates'; |
|
56 |
+$function(); |
|
57 |
+ |
|
58 |
+if (!empty($pmg['theme_integration']) && function_exists('pacman_footer')) |
|
59 |
+ pacman_footer(); |
|
60 |
+else |
|
61 |
+ default_pacman_footer(); |
|
62 |
+ |
|
63 |
+function default_pacman_header($headers) |
|
64 |
+{ |
|
65 |
+ global $pmg, $locale, $charset, $text; |
|
20 | 66 |
|
21 | 67 |
echo ' |
22 | 68 |
<!DOCTYPE html><!-- HTML 5 --> |
23 | 69 |
<html dir="ltr" lang="', $locale, '"> |
24 | 70 |
<head> |
25 | 71 |
<meta http-equiv="Content-Type" content="text/html;charset=', $charset, '"> |
26 |
- <title>', $page_title, '</title> |
|
27 |
- <link rel="stylesheet" id="', $style, '-css" href="', $assets, '/', $style, '.css" type="text/css" media="all">'; |
|
72 |
+ <title>', $pmg['page_title'], '</title>'; |
|
28 | 73 |
|
29 |
-// We don't need these on the index. |
|
30 |
-if ($action != 'index') |
|
74 |
+ if (!empty($headers['css'])) |
|
75 |
+ foreach ($headers['css'] as $css) |
|
31 | 76 |
echo ' |
32 |
- <script type="text/javascript" src="', $assets, '/jquery.min.js"></script> |
|
33 |
- <script type="text/javascript" src="', $assets, '/', $use_php ? 'jquery.generateFile.js' : 'jquery.base64.js', '"></script> |
|
34 |
- <script type="text/javascript" src="', $assets, '/script_', $action, '.js"></script>'; |
|
77 |
+ <link rel="stylesheet" id="', $css['name'], '" href="', $css['href'], '" type="text/css" media="', !empty($css['media']) ? $css['media'] : 'all', '">'; |
|
78 |
+ |
|
79 |
+ if (!empty($headers['js'])) |
|
80 |
+ foreach ($headers['js'] as $js) |
|
81 |
+ echo ' |
|
82 |
+ <script type="text/javascript" src="', $js['src'], '"></script>'; |
|
83 |
+ |
|
84 |
+ if (!empty($headers['others'])) |
|
85 |
+ echo explode(' |
|
86 |
+ ', $headers['others']); |
|
35 | 87 |
|
36 | 88 |
echo ' |
37 | 89 |
<meta name="viewport" content="width=device-width,initial-scale=1"> |
... | ... |
@@ -43,29 +95,21 @@ echo ' |
43 | 95 |
<div id="head"> |
44 | 96 |
<div id="logo">'; |
45 | 97 |
|
46 |
-if (!empty($logo)) |
|
98 |
+ if (!empty($pmg['logo'])) |
|
47 | 99 |
echo ' |
48 |
- <a href="', $logo_url, '"><img src="', $logo, '" alt="', $page_title, '" class="alignleft"></a>'; |
|
100 |
+ <a href="', $pmg['logo_url'], '"><img src="', $pmg['logo'], '" alt="', $pmg['page_title'], '" class="alignleft"></a>'; |
|
49 | 101 |
|
50 | 102 |
echo ' |
51 |
- <h1><a href="', $scriptname, '">', $text['script_name'], '</a></h1></div> |
|
103 |
+ <h1><a href="', $pmg['scriptname'], '">', $text['script_name'], '</a></h1></div> |
|
52 | 104 |
</div> |
53 | 105 |
<div class="clear"></div> |
54 | 106 |
</div> |
55 |
- <div id="container"> |
|
56 |
- <div id="wrap" class="action_', $action, '">'; |
|
107 |
+ <div id="container">'; |
|
108 |
+} |
|
57 | 109 |
|
58 |
-// If we are using the PHP downloader, we need this. |
|
59 |
-if ($use_php) |
|
110 |
+function default_pacman_footer() |
|
111 |
+{ |
|
60 | 112 |
echo ' |
61 |
- <input type="hidden" id="downloadername" value="', $downloadname, '" />'; |
|
62 |
- |
|
63 |
-// Call up the right section. |
|
64 |
-$function = $action . '_section'; |
|
65 |
-$function(); |
|
66 |
- |
|
67 |
-echo ' |
|
68 |
- </div> |
|
69 | 113 |
</div> |
70 | 114 |
</div> |
71 | 115 |
<div id="footer"> |
... | ... |
@@ -75,10 +119,8 @@ echo ' |
75 | 119 |
</div> |
76 | 120 |
</div>'; |
77 | 121 |
|
78 |
-// Bring in the correct templates. |
|
79 |
-$function = $action . '_templates'; |
|
80 |
-$function(); |
|
81 |
- |
|
82 | 122 |
echo ' |
83 | 123 |
</body> |
84 | 124 |
</html>'; |
125 |
+ |
|
126 |
+} |
|
85 | 127 |
\ No newline at end of file |
... | ... |
@@ -8,25 +8,32 @@ |
8 | 8 |
if (!defined('PacManGen')) { exit('[' . basename(__FILE__) . '] Direct access restricted');} |
9 | 9 |
|
10 | 10 |
// Assets URL location. |
11 |
-$assets = '/PacManGen/assets'; |
|
11 |
+$pmg['assets'] = 'http://sleepycode.com/PacManGen/assets'; |
|
12 | 12 |
|
13 | 13 |
// The name of this script (can also be the url). |
14 |
-$scriptname = 'index.php'; |
|
14 |
+$pmg['scriptname'] = 'index.php'; |
|
15 | 15 |
|
16 | 16 |
// The name of this script (can also be the url). |
17 |
-$downloadname = 'downloader.php'; |
|
17 |
+$pmg['downloadname'] = 'downloader.php'; |
|
18 | 18 |
|
19 | 19 |
// Style to use. |
20 |
-$style = 'default'; |
|
20 |
+$pmg['style'] = 'default'; |
|
21 |
+ |
|
22 |
+// Integration with another site. |
|
23 |
+$pmg['theme_integration'] = true; |
|
24 |
+ |
|
25 |
+// If we are integrating, what file to include. Needs to have pacman_header and pacmanfooter |
|
26 |
+$pmg['theme_integration_file'] = '__integrate.php'; |
|
21 | 27 |
|
22 | 28 |
// How to handle downloads.. |
23 |
-$use_php = true; |
|
29 |
+$pmg['use_php'] = true; |
|
24 | 30 |
|
25 |
-$page_title = 'SleePyCode Package Manager Generator'; |
|
31 |
+// The page title. |
|
32 |
+$pmg['page_title'] = 'SleePyCode Package Manager Generator'; |
|
26 | 33 |
|
27 | 34 |
// Commenting out logo will remove it. |
28 |
-$logo = $assets . '/logo.png'; |
|
29 |
-$logo_url = 'http://sleepycode.com'; |
|
35 |
+$pmg['logo'] = $pmg['assets'] . '/logo.png'; |
|
36 |
+$pmg['logo_url'] = 'http://sleepycode.com'; |
|
30 | 37 |
|
31 | 38 |
// Language we selected. |
32 |
-$language = 'english'; |
|
33 | 39 |
\ No newline at end of file |
40 |
+$pmg['language'] = 'english'; |
|
34 | 41 |
\ No newline at end of file |
35 | 42 |