/
templatesummary_view.php
205 lines (182 loc) · 10.7 KB
/
templatesummary_view.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php
Yii::app()->clientScript->registerScript('editorfiletype',"editorfiletype ='".$sEditorFileType."';",CClientScript::POS_HEAD); // Is this deprecated (2013-09-25) ?
?>
<?php if (is_template_editable($templatename)==true): ?>
<div class="row template-sum">
<div class="col-lg-12">
<?php App()->getClientScript()->registerPackage('jquery-ace'); ?>
<h4><?php echo sprintf(gT("Editing file '%s'"),$editfile); ?></h4>
<?php if (!is_writable($templates[$templatename])):?>
<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php eT("You can't save changes because the template directory is not writable."); ?>
</div>
<?php endif; ?>
</div>
</div>
<div class="row template-sum">
<div class="col-lg-2" id='templateleft'>
<div style="padding-left:1em;">
<?php eT("Standard files:"); ?><br>
<?php
$aSelectOptions=array(
gT("Screen part files")=>makeoptionswithindex($files,'pstpl'),
gT("JavaScript files")=>makeoptionswithindex($jsfiles,'js'),
gT("CSS files")=>makeoptionswithindex($cssfiles,'css'));
$editindex='';
foreach($aSelectOptions as $optgroup=>$options)
{
if (array_search($editfile,$options)!==false)
{
$editindex=array_search($editfile,$options);
break;
}
}
echo CHtml::form(array('admin/templates/sa/view'), 'post', array('id'=>'general', 'class'=>'form-inline'));
echo CHtml::listBox('editfile',$editindex,$aSelectOptions,
array('class'=>'form-control','size'=>'20','onchange'=>"javascript: this.form.submit();"));
echo CHtml::hiddenField('screenname', $screenname, array('class'=>'screenname'));
echo CHtml::hiddenField('templatename', $templatename, array('class'=>'templatename')); ?>
</form>
</div>
</div>
<div class="col-lg-8 templateeditor">
<?php echo CHtml::form(array('admin/templates/sa/templatesavechanges'), 'post', array('id'=>'editTemplate', 'name'=>'editTemplate')); ?>
<?php echo CHtml::hiddenField('templatename', $templatename, array('class'=>'templatename'));
echo CHtml::hiddenField('screenname', $screenname, array('class'=>'screenname'));
echo CHtml::hiddenField('editfile', $editindex);
echo CHtml::hiddenField('editfilename', $editfile);
echo CHtml::hiddenField('action', 'templatesavechanges');
echo CHtml::textArea('changes', isset($editfile)?filetext($templatename,$editfile,$templates):'',array('rows'=>'20',
'cols'=>'40',
'data-filetype'=>$sEditorFileType,
'class'=>'ace '.$sTemplateEditorMode,
'style'=>'width:100%'
));
?>
<p class='text-center'>
<br/>
<?php if (Permission::model()->hasGlobalPermission('templates','update')):?>
<?php if (is_writable($templates[$templatename])):?>
<input type='submit' class='btn btn-default' value='<?php eT("Save changes"); ?>'
<?php if (!is_template_editable($templatename)):?>
disabled='disabled' alt='<?php eT("Changes cannot be saved to a standard template."); ?>'
<?php endif; ?>
/>
<?php endif; ?>
<?php endif; ?>
</p>
</form>
</div>
<div class="col-lg-2" style="overflow-x: hidden">
<div>
<?php eT("Other files:"); ?>
<br/>
<?php // TODO printf(gT("(path for css: %s)"), $filespath) ?>
<?php echo CHtml::form(array('admin/templates/sa/templatefiledelete'), 'post'); ?>
<select size='11' class="form-control" name='otherfile' id='otherfile'>
<?php echo makeoptions($otherfiles, "name", "name", ""); ?>
</select><br>
<?php
if (Permission::model()->hasGlobalPermission('templates','delete'))
{ ?>
<input type='submit' class='btn btn-default' value='<?php eT("Delete"); ?>' onclick="javascript:return confirm('<?php eT("Are you sure you want to delete this file?","js"); ?>')"/>
<?php
}
echo CHtml::hiddenField('templatename', $templatename, array('class'=>'templatename'));
echo CHtml::hiddenField('screenname', $screenname, array('class'=>'screenname')); ?>
<input type='hidden' name='editfile' value='<?php echo $editfile; ?>' />
<input type='hidden' name='action' value='templatefiledelete' />
</form>
</div>
<div style='margin-top:1em;'>
<?php
if (Permission::model()->hasGlobalPermission('templates','update'))
{ ?>
<?php echo CHtml::form(array('admin/templates/sa/uploadfile'), 'post', array('id'=>'importtemplatefile', 'name'=>'importtemplatefile', 'enctype'=>'multipart/form-data')); ?>
<?php eT("Upload a file:"); ?>
<br>
<input name='upload_file' id="upload_file" type="file" required="required"/>
<input type='submit' value='<?php eT("Upload"); ?>' class='btn btn-default'
<?php if (!is_template_editable($templatename)) : ?>
disabled='disabled'
<?php endif; ?>
/>
<input type='hidden' name='editfile' value='<?php echo $editfile; ?>' />
<?php echo CHtml::hiddenField('templatename', $templatename, array('class'=>'templatename'));
echo CHtml::hiddenField('screenname', $screenname, array('class'=>'screenname')); ?>
<input type='hidden' name='action' value='templateuploadfile' />
</form>
<?php
}
?>
</div>
<div class="">
<a href="#" data-toggle="modal" data-target="#fileHelp" />
<?php eT('Tip: How to embed a picture in your template?'); ?>
</a>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="fileHelp" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><?php eT('Tip: How to display a picture in your template?'); ?></h4>
</div>
<div class="modal-body">
<?php eT('To use a picture in a .pstpl file:');?><br/>
<code><img src="{TEMPLATEURL}/files/yourpicture.png" /></code><br/><br/>
<?php eT("To use a picture in a .css file: ");?><br/>
<code>background-image: url('../files/yourpicture.png');</code><br/><br/>
<?php eT("To place the logo anywhere in a .pstpl file: ");?><br/>
<code>{SITELOGO}</code><br/>
<?php eT("This will generate a responsive image containing the logo file.");?><br/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php eT("Close");?></button>
</div>
</div>
</div>
</div>
</div>
</div>
<?php else:?>
<?php echo CHtml::form(array('admin/templates/sa/view'), 'post', array('id'=>'general', 'style'=>'display:none;', 'class'=>'form-inline')); ?>
<?php
echo CHtml::hiddenField('screenname', $screenname, array('class'=>'screenname'));
echo CHtml::hiddenField('templatename', $templatename, array('class'=>'templatename')); ?>
</form>
<?php endif;?>
<div class="row template-sum" style="margin-bottom: 100px;">
<div class="col-lg-12">
<h4>
<?php eT("Preview:"); ?>
</h4>
<div class="jumbotron message-box">
<input type='button' value='<?php eT("Mobile"); ?>' id='iphone' class="btn btn-default"/>
<input type='button' value='640x480' id='x640' class="btn btn-default" />
<input type='button' value='800x600' id='x800' class="btn btn-default" />
<input type='button' value='1024x768' id='x1024' class="btn btn-default" />
<input type='button' value='<?php eT("Full"); ?>' id='full' class="btn btn-default" />
<br><br><br><br>
<div style='width:90%; margin:0 auto;'>
<?php if(isset($filenotwritten) && $filenotwritten==true)
{ ?>
<p>
<span class ='errortitle'><?php echo sprintf(gT("Please change the directory permissions of the folder %s in order to preview templates."), $tempdir); ?></span>
</p>
</div>
<?php }
else
{ ?>
<p>
<iframe id='previewiframe' src='<?php echo $this->createUrl('admin/templates/sa/tmp/',array('id'=>$time)); ?>' height='768' name='previewiframe' style='width:95%;background-color: white;'>Embedded Frame</iframe>
</p>
</div>
<?php
} ?>
</div>
</div>
</div>