-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
187 lines (182 loc) · 7.14 KB
/
index.php
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
/**
* Default vars input box
* @param $name
* @param null $label
*/
function inputVars($name, $label = null, $debug = '')
{
if($label == null) { $label = ucfirst(str_replace('_', ' ', $name)); }
echo sprintf('<label for="%1$s">%2$s:</label><input data-debug="%3$s" type="text" name="vars[%1$s]" id="%1$s" />',
$name, $label, $debug);
}
/**
* Simple dropdown with options for vars
* @param $name
* @param $options
* @param null $label
*/
function inputVarsSelect($name, $options, $label = null)
{
if($label == null) { $label = ucfirst(str_replace('_', ' ', $name)); }
echo sprintf('<label for="%1$s">%2$s:</label><select name="vars[%1$s]" id="%1$s">',
$name, $label);
foreach($options as $key => $value)
{
echo '<option value="'.$key.'">'.$value.'</option>';
}
echo '</select>';
}
/**
* Simple checkbox for vars
* @param $name
* @param $label
*/
function inputVarsCheckbox($name, $label)
{
if($label == null) { $label = ucfirst(str_replace('_', ' ', $name)); }
echo sprintf('<label class="checkbox" for="%1$s"><input type="checkbox" name="vars[%1$s]" id="%1$s" /> %2$s</label>',
$name, $label);
}
?><!doctype html>
<html>
<head>
<title>Symphony Extension Developer</title>
<link rel="stylesheet" type="text/css" href="css/screen.css" />
<script type="text/javascript" src="lib/ajaxform.js"></script>
<script type="text/javascript" src="js/global.js"></script>
</head>
<body>
<article id="main">
<div class="inner">
<h1>Symphony Extension Developer</h1>
<h3>Create them extensions with ease!</h3>
<!-- <a href="#" id="testdata">debug: fill with test data</a>-->
<?php
$errors = array();
if(!is_writable('export')) { $errors[] = 'The folder <code>export</code> is not writable.'; }
if(!is_writable('tmp')) { $errors[] = 'The folder <code>tmp</code> is not writable.'; }
if(!class_exists('ZipArchive')) { $errors[] = 'PHPs\' <code>ZipArchive</code> module not found. Zip cannot be created.
You can still create your extensions, but after running the script, you have to manually download the content of the <code>export</code>-folder.'; }
if(!empty($errors))
{
echo '<div class="error"><h4>Oh oh...</h4><p>Before proceeding, please fix the following issues.</p><ul>';
foreach($errors as $error) {
echo '<li>'.$error.'</li>';
}
echo '</ul></div>';
}
?>
<form method="post" action="compile.php">
<fieldset>
<legend>General Information</legend>
<?php
inputVars('name', null, 'Test');
inputVars('description', null, 'This is a test description');
inputVars('version', null, '1.0');
inputVars('github_url', 'GitHub URL', 'https://github.com/kanduvisla/extension_developer');
?>
</fieldset>
<fieldset>
<legend>Author Information</legend>
<?php
inputVars('author_name', null, 'John Doe');
inputVars('author_website', null, 'http://www.johndoe.org');
inputVars('author_email', null, '[email protected]');
inputVars('github_name', null, 'john_doe');
inputVars('symphony_name', null, 'john_doe');
?>
</fieldset>
<fieldset>
<legend>Type</legend>
<label for="type">Type:</label>
<select name="vars[type]" id="type">
<option>Select a type...</option>
<option value="Event">Event - for extensions primarily providing frontend events</option>
<option value="Field">Field - for new field types</option>
<option value="Interface">Interface - if you modify Symphony's UI</option>
<option value="Membership">Membership - for user roles, Symphony users or frontend profiles</option>
<option value="Multilingual">Multilingual - allowing multilingual content</option>
<option value="Multimedia">Multimedia - images, video, uploads or media management</option>
<option value="Text Formatter">Text Formatter - text formatting and WYSIWYG editors</option>
<option value="Third Party Integration">Third Party Integration - such as MailChimp, Basecamp, Google Analytics etc</option>
<option value="Translation">Translation - backend UI translation ("language packs")</option>
<option value="Workflow">Workflow - if the extension provides new or modifies existing Symphony workflows</option>
<option value="Other">Other - everything else</option>
<option value="Own">Specify your own type...</option>
</select>
<div class="own-type">
<?php
inputVars('own_type', null, 'Space Time Continuum Reaper');
?>
</div>
</fieldset>
<fieldset class="type field">
<legend>Extra options for Field</legend>
<?php
inputVars('field_name', null, 'Test Field');
inputVarsSelect('field_default_show_column', array('yes'=>'Yes', 'no'=>'No'), 'Show Column by default');
inputVarsSelect('field_default_required', array('yes'=>'Yes', 'no'=>'No'), 'Required by default');
inputVarsSelect('field_default_location', array('main'=>'Main content', 'sidebar'=>'Sidebar'), 'Default location');
?>
<label for="field_field_sql">Database fields for field:<br /><em>Use simple format: [fieldname],[fieldtype]</em></label>
<textarea name="field_field_sql" id="field_field_sql">related_field,int(11)
send_notifications,bool</textarea>
<label for="field_data_sql">Database fields for data:<br /><em>Use simple format: [fieldname],[fieldtype]</em></label>
<textarea name="field_data_sql" id="field_data_sql">handle,tinytext
value,mediumtext
amount,int(11)
checked,bool</textarea>
<p class="info"><em>If you want to use more complex SQL-statements, or need to create more than one table, edit the PHP-files manualy after creation.</em></p>
<?php
inputVarsCheckbox('field_parse_xsl', 'Use XSL to create the HTML in publish pages (Trust me, this will change the way you write extensions!).');
?>
</fieldset>
<fieldset>
<legend>Delegates</legend>
<?php
// Pull them delegates from the Symphony site:
@include 'delegates.php';
foreach($delegatesArr as $contextName => $delegates)
{
if(!empty($delegates))
{
echo '<h4>'.$contextName.'</h4>';
foreach($delegates as $delegate)
{
echo sprintf('
<label class="delegate">
<input type="checkbox" name="delegate[%1$s]" value="%2$s" />
%1$s<br />
<span>%2$s</span>
</label>
', $delegate['name'], $delegate['page']);
}
}
}
?>
</fieldset>
<fieldset>
<legend>Content Pages</legend>
<?php
inputVarsCheckbox('include_content', 'Include a content page.');
?>
</fieldset>
<fieldset>
<legend>Other Options</legend>
<?php
inputVarsCheckbox('include_assets', 'Include JavaScript and CSS on each page in the admin.');
inputVarsCheckbox('include_preferences', 'Include example preferences.');
inputVarsCheckbox('reference_driver', 'Create references to the driver-class.');
?>
</fieldset>
<input type="submit" name="download" value="Download the candy!" />
<!-- <input type="submit" name="update" value="Update the candy!" />-->
</form>
</div>
</article>
<aside id="live">
<iframe src="about:blank" name="live" />
</aside>
</body>
</html>