1{title help='Content Templates' url='tiki-admin_content_templates.php'}{tr}Content templates{/tr}{/title} 2 3 4{tabset} 5 {tab name="{tr}Templates{/tr}"} 6 <h2>{tr}Templates{/tr}</h2> 7 {if $channels or ($find ne '')} 8 {include file='find.tpl'} 9 {/if} 10 <table class="table table-striped table-hover"> 11 <tr> 12 <th>{tr}Id{/tr}</th> 13 <th> 14 <a href="tiki-admin_content_templates.php?offset={$offset}&sort_mode={if $sort_mode eq 'name_desc'}name_asc{else}name_desc{/if}">{tr}Name{/tr}</a> 15 </th> 16 <th> 17 <a href="tiki-admin_content_templates.php?offset={$offset}&sort_mode={if $sort_mode eq 'created_desc'}created_asc{else}created_desc{/if}">{tr}Last modified{/tr}</a> 18 </th> 19 <th>{tr}Sections{/tr}</th> 20 <th>{tr}Categories{/tr}</th> 21 {if $prefs.lock_content_templates eq 'y'} 22 <th></th> 23 {/if} 24 <th></th> 25 </tr> 26 {cycle values="odd,even" print=false advance=false} 27 {section name=user loop=$channels} 28 <tr> 29 <td class="text">{$channels[user].templateId}</td> 30 <td class="text"> 31 {if $channels[user].edit} 32 <a href="tiki-admin_content_templates.php?offset={$offset}&sort_mode={$sort_mode}&templateId={$channels[user].templateId}&cookietab=2"> 33 {$channels[user].name|escape} 34 </a> 35 {else} 36 {$channels[user].name|escape} 37 {/if} 38 </td> 39 <td class="date">{$channels[user].created|tiki_short_datetime}</td> 40 <td class="text"> 41 {if count($channels[user].sections) == 0}{tr}Visible in no sections{/tr}{/if} 42 {section name=ix loop=$channels[user].sections} 43 {$channels[user].sections[ix]} 44 {if $channels[user].edit} 45 <a class="tips" title=":{tr}Delete{/tr}" class="link" href="tiki-admin_content_templates.php?removesection={$channels[user].sections[ix]}&rtemplateId={$channels[user].templateId}" onclick="confirmSimple(event, '{tr}Remove section?{/tr}', '{ticket mode=get}')"> 46 {icon name='remove' alt="{tr}Remove section{/tr}"} 47 </a> 48 {/if} 49 {/section} 50 </td> 51 <td class="text"> 52 {if count($channels[user].categories) == 0}{tr}Uncategorized{/tr}{/if} 53 {foreach $channels[user].categories as $categId => $catName} 54 <a title="{tr}Browse{/tr}" class="link" href="{$categId|sefurl:'category'}" > 55 {tr}{$catName}{/tr} 56 </a> 57 {/foreach} 58 </td> 59 {if $prefs.lock_content_templates eq 'y'} 60 <td class="action"> 61 {lock type='template' object=$channels[user].templateId} 62 </td> 63 {/if} 64 <td class="action"> 65 {if $channels[user].edit or $channels[user].remove} 66 {actions} 67 {strip} 68 {if $channels[user].edit} 69 <action> 70 <a href="tiki-admin_content_templates.php?offset={$offset}&sort_mode={$sort_mode}&templateId={$channels[user].templateId}&cookietab=2"> 71 {icon name='edit' _menu_text='y' _menu_icon='y' alt="{tr}Edit{/tr}"} 72 </a> 73 </action> 74 {/if} 75 {if $channels[user].remove} 76 <action> 77 <a href="tiki-admin_content_templates.php?offset={$offset}&sort_mode={$sort_mode}&remove={$channels[user].templateId}" onclick="confirmSimple(event, '{tr}Remove template?{/tr}', '{ticket mode=get}')"> 78 {icon name='remove' _menu_text='y' _menu_icon='y' alt="{tr}Remove{/tr}"} 79 </a> 80 </action> 81 {/if} 82 {/strip} 83 {/actions} 84 {/if} 85 </td> 86 </tr> 87 {sectionelse} 88 {norecords _colspan=6} 89 {/section} 90 </table> 91 {pagination_links cant=$cant_pages step=$prefs.maxRecords offset=$offset}{/pagination_links} 92 93 {/tab} 94 {if $canEdit} 95 {if $templateId} 96 {$tabtitle="{tr}Edit template:{/tr} {$info.name|escape}"} 97 {else} 98 {$tabtitle="{tr}Create template{/tr}"} 99 {/if} 100 {tab name=$tabtitle} 101 102 {remarksbox type="tip" title="{tr}Tip{/tr}"}{tr}Use the Administration page of each enabled feature to allow the use of content templates.{/tr}{/remarksbox} 103 104 {if $preview eq 'y'} 105 <h2>{tr}Preview{/tr}</h2> 106 <div class="wikitext">{$parsed}</div> 107 {/if} 108 109 <h2>{$tabtitle}</h2> 110 {if $templateId > 0 and $tiki_p_admin_content_templates eq 'y'} 111 {button href="tiki-admin_content_templates.php" cookietab="2" _icon_name="create" _text="{tr}Create{/tr}"} 112 {/if} 113 <form action="tiki-admin_content_templates.php" method="post" class="form-horizontal" role="form"> 114 {ticket} 115 <input type="hidden" name="templateId" value="{$templateId|escape}"> 116 <div class="form-group row"> 117 <label class="col-sm-3 col-form-label" for="name">{tr}Name{/tr} *</label> 118 <div class="col-sm-9"> 119 <input type="text" maxlength="255" class="form-control" id="name" name="name" value="{$info.name|escape}"> 120 {if $emptyname} 121 <span class="attention alert-warning">{tr}Name field is mandatory{/tr}</span> 122 {/if} 123 </div> 124 </div> 125 <div class="form-group row"> 126 <label class="col-sm-3 col-form-label" for="section_css">{tr}Sections{/tr}</label> 127 <div class="col-sm-9"> 128 {$toolbar_section='admin'} 129 {if $prefs.feature_cms_templates eq 'y'} 130 <div class="col-sm-3 form-check"> 131 <label for="section_cms"> 132 <input class="form-check-input" type="checkbox" name="section_cms" id="section_cms" {if $info.section_cms eq 'y'}checked="checked"{/if}> 133 {if $info.section_cms eq 'y'}{$toolbar_section='cms'}{/if} 134 {tr}Articles{/tr} 135 </label> 136 </div> 137 {/if} 138 {if $prefs.feature_wiki_templates eq 'y'} 139 <div class="col-sm-3 form-check"> 140 <label for="section_wiki"> 141 <input class="form-check-input" type="checkbox" name="section_wiki" id="section_wiki" {if $info.section_wiki eq 'y'}checked="checked"{/if}> 142 {if $info.section_wiki eq 'y'}{$toolbar_section='wiki page'}{/if} 143 {tr}Wiki{/tr} 144 </label> 145 </div> 146 {/if} 147 {if $prefs.feature_file_galleries_templates eq 'y'} 148 <div class="col-sm-3 form-check"> 149 <label for="section_file_galleries"> 150 <input class="form-check-input" type="checkbox" name="section_file_galleries" id="section_file_galleries" {if $info.section_file_galleries eq 'y'}checked="checked"{/if}> 151 {if $info.section_file_galleries eq 'y'}{$toolbar_section='admin'}{/if} 152 {tr}File Galleries{/tr} 153 </label> 154 </div> 155 {/if} 156 {if $prefs.feature_newsletters eq 'y'} 157 <div class="col-sm-3 form-check"> 158 <label for="section_newsletters"> 159 <input class="form-check-input" type="checkbox" name="section_newsletters" id="section_newsletters" {if $info.section_newsletters eq 'y'}checked="checked"{/if}> 160 {if $info.section_newsletters eq 'y'}{$toolbar_section='newsletters'}{/if} 161 {tr}Newsletters{/tr} 162 </label> 163 </div> 164 {/if} 165 {if $prefs.feature_events eq 'y'} 166 <div class="col-sm-3 form-check"> 167 <label for="section_events"> 168 <input class="form-check-input" type="checkbox" name="section_events" id="section_events" {if $info.section_events eq 'y'}checked="checked"{/if}> 169 {if $info.section_events eq 'y'}{$toolbar_section='calendar'}{/if} 170 {tr}Events{/tr} 171 </label> 172 </div> 173 {/if} 174 {if $prefs.feature_html_pages eq 'y'} 175 <div class="col-sm-3 form-check"> 176 <label for="section_html"> 177 <input class="form-check-input" type="checkbox" name="section_html" id="section_html" {if $info.section_html eq 'y'}checked="checked"{/if}> 178 {if $info.section_html eq 'y'}{$toolbar_section='wiki page'}{/if} 179 {tr}HTML Pages{/tr} 180 </label> 181 </div> 182 {/if} 183 {if ($prefs.feature_cms_templates ne 'y') and ($prefs.feature_wiki_templates ne 'y') and ($prefs.feature_file_galleries_templates ne 'y') and ($prefs.feature_newsletters ne 'y') and ($prefs.feature_events ne 'y') and ($prefs.feature_html_pages ne 'y')} 184 {tr}No features are configured to use templates.{/tr} 185 {/if} 186 </div> 187 </div> 188 <div class="form-group row"> 189 <label class="col-sm-3 col-form-label" for="type-selector">{tr}Template Type{/tr}</label> 190 <div class="col-sm-9"> 191 <select name="template_type" id="type-selector" class="form-control"> 192 <option value="static"{if $info.template_type eq 'static'} selected="selected"{/if}>{tr}Text area{/tr}</option> 193 <option value="page"{if $info.template_type eq 'page'} selected="selected"{/if}>{tr}Wiki Page{/tr}</option> 194 </select> 195 </div> 196 </div> 197 <div class="form-group row"> 198 <label class="col-sm-3 col-form-label" for="is_html">{tr}HTML{/tr}</label> 199 <div class="col-sm-9"> 200 <input type="checkbox" name="section_wiki_html" id="is_html" class="form=control" {if $info.section_wiki_html eq 'y'}checked="checked"{/if}> 201 </div> 202 </div> 203 {if $prefs.lock_content_templates eq 'y'} 204 <div class="form-group row"> 205 <label class="col-sm-3 col-form-label">{tr}Lock{/tr}</label> 206 <div class="col-sm-9"> 207 {lock type='template' object=$templateId} 208 </div> 209 </div> 210 {/if} 211 <div class="form-group row type-cond for-page"> 212 <label class="col-sm-3 col-form-label" for="page_name">{tr}Page Name{/tr}</label> 213 <div class="col-sm-9"> 214 <input class="form-control" type="text" name="page_name" id="page_name" value="{$info.page_name}" placeholder="{tr}Find{/tr}..."> 215 {autocomplete element='input[name=page_name]' type='pagename'} 216 </div> 217 </div> 218 219 {include file='categorize.tpl'} 220 221 <div class="form-group type-cond for-static"> 222 <label class="col-sm-12" for="editwiki">{tr}Template{/tr}</label> 223 <div class="col-sm-12"> 224 {if $prefs.feature_wysiwyg eq 'y' and $info.section_wiki_html eq 'y'} 225 {$use_wysiwyg='y'} 226 <input type="hidden" name="allowhtml" value="on"> 227 {if $prefs.wysiwyg_htmltowiki eq 'y'}{$is_html = 'y'}{else}{$is_html = 'n'}{/if} 228 {else} 229 {$use_wysiwyg='n'} 230 {$is_html = 'n'} 231 {/if} 232 {textarea id="editwiki" name="content" switcheditor="y" _class="form-control" _wysiwyg=$use_wysiwyg _is_html=$is_html section=$toolbar_section}{$info.content}{/textarea} 233 </div> 234 </div> 235 <div class="form-group text-center"> 236 <input type="submit" name="preview" class="btn btn-primary" value="{tr}Preview{/tr}" onclick="needToConfirm=false;"> 237 <input type="submit" name="save" class="btn btn-secondary" value="{tr}Save{/tr}"> 238 </div> 239 240 {jq} 241 $('#type-selector').change( function( e ) { 242 $('.type-cond').hide(); 243 var val = $('#type-selector').val(); 244 $('.for-' + val).show(); 245 } ).trigger('change'); 246 needToConfirm = false; 247 {/jq} 248 </form> 249 {/tab} 250 {/if} 251{/tabset} 252