summaryrefslogtreecommitdiff
path: root/templates/edit_format.tpl
diff options
context:
space:
mode:
authorNick Palmer <nick@sluggardy.net>2007-10-26 12:15:22 +0000
committerNick Palmer <nick@sluggardy.net>2007-10-26 12:15:22 +0000
commit7fe1bc76cb5d286dcfe6441212593b7eee7f6558 (patch)
tree58d93b97faf2049c43fdbe5c6556e232bc0b9926 /templates/edit_format.tpl
parent132c97e02f62b5acec6e09fd07468424c45d65e1 (diff)
downloadliberty-7fe1bc76cb5d286dcfe6441212593b7eee7f6558.tar.gz
liberty-7fe1bc76cb5d286dcfe6441212593b7eee7f6558.tar.bz2
liberty-7fe1bc76cb5d286dcfe6441212593b7eee7f6558.zip
Fixup edit_format so it works properly in all cases.
Diffstat (limited to 'templates/edit_format.tpl')
-rw-r--r--templates/edit_format.tpl79
1 files changed, 46 insertions, 33 deletions
diff --git a/templates/edit_format.tpl b/templates/edit_format.tpl
index 4e61c0e..f10cb4e 100644
--- a/templates/edit_format.tpl
+++ b/templates/edit_format.tpl
@@ -18,39 +18,52 @@
</div>
{/if}
-{capture name=capture_format assign=capture_format}
+{* We have to count these first because of the tikiwiki format options which may show even if it is the only format option. *}
+{assign var=numformat value=0}
+{foreach name=formatPlugins from=$gLibertySystem->mPlugins item=plugin key=guid}
+ {if $plugin.is_active eq 'y' and $plugin.edit_field and $plugin.plugin_type eq 'format'}
+ {assign var=numformat value=$numformat+1}
+ {if $plugin.plugin_guid == "tikiwiki"}
+ {assign var=format_options value=true}
+ {/if}
+ {/if}
+{/foreach}
+{if $numformat > 1 || $format_options}
<div class="row">
{formfeedback error=$errors.format}
{formlabel label="Content Format"}
{foreach name=formatPlugins from=$gLibertySystem->mPlugins item=plugin key=guid}
{if $plugin.is_active eq 'y' and $plugin.edit_field and $plugin.plugin_type eq 'format'}
{forminput}
- {counter start=1 name=numformat print=false assign=numformat}
- <label>
- <input type="radio" name="{$format_guid_variable|default:"format_guid"}" value="{$plugin.edit_field}"
- {if $gContent->mInfo.format_guid eq $plugin.plugin_guid
- } checked="checked"{
- elseif !$gContent->mInfo.format_guid and $plugin.plugin_guid eq $gBitSystem->getConfig('default_format')
- } checked="checked"{
- /if
- } onclick="
- {if $gBitSystem->isPackageActive('quicktags')}
- {foreach from=$gLibertySystem->mPlugins item=tag key=guid}
- {if $tag.is_active eq 'y' and $tag.edit_field and $tag.plugin_type eq 'format'}
- {if $tag.plugin_guid eq $plugin.plugin_guid}
- showById
- {else}
- hideById
+ {if $numformat > 1}
+ <label>
+ <input type="radio" name="{$format_guid_variable|default:"format_guid"}" value="{$plugin.edit_field}"
+ {if $gContent->mInfo.format_guid eq $plugin.plugin_guid
+ } checked="checked"{
+ elseif !$gContent->mInfo.format_guid and $plugin.plugin_guid eq $gBitSystem->getConfig('default_format', 'tikiwiki')
+ } checked="checked"{
+ /if
+ } onclick="
+ {if $gBitSystem->isPackageActive('quicktags')}
+ {foreach from=$gLibertySystem->mPlugins item=tag key=guid}
+ {if $tag.is_active eq 'y' and $tag.edit_field and $tag.plugin_type eq 'format'}
+ {if $tag.plugin_guid eq $plugin.plugin_guid}
+ showById
+ {else}
+ hideById
+ {/if}
+ ('qt{$textarea_id}{$tag.plugin_guid}');
{/if}
- ('qt{$textarea_id}{$tag.plugin_guid}');
- {/if}
- {/foreach}
- {/if}
- "
- /> {$plugin.edit_label}</label>
+ {/foreach}
+ {/if}
+ "
+ /> {$plugin.edit_label}
+ </label>
+ {/if}
{if $plugin.plugin_guid == "tikiwiki"}
- {assign var=format_options value=true}
- &nbsp;&nbsp;
+ {if $numformat > 1}
+ &nbsp;&nbsp;
+ {/if}
{if !$gBitSystem->isFeatureActive('content_force_allow_html')}
{if $gBitUser->hasPermission( 'p_liberty_enter_html' ) || $gBitSystem->isFeatureActive('content_allow_html')}
<label><input type="checkbox" name="preferences[content_enter_html]" value="y" id="html" {if $gContent->mPrefs.content_enter_html}checked="checked" {/if}/> {tr}Allow HTML{/tr}</label>
@@ -65,16 +78,16 @@
{/forminput}
{/if}
{/foreach}
- {forminput}
- {formhelp note="Choose what kind of syntax you want to submit your data in."}
- {/forminput}
+ {if $numformat > 1}
+ {forminput}
+ {formhelp note="Choose what kind of syntax you want to submit your data in."}
+ {/forminput}
+ {else}
+ <input type="hidden" name="{$format_guid_variable|default:"format_guid"}" value="{$gBitSystem->getConfig('default_format','tikiwiki')}" />
+ {/if}
</div>
-{/capture}
-
-{if $numformat > 1 or $format_options}
- {$capture_format}
{else}
- <input type="hidden" name="{$format_guid_variable|default:"format_guid"}" value="{$formatplugins[0].guid}" />
+ <input type="hidden" name="{$format_guid_variable|default:"format_guid"}" value="{$gBitSystem->getConfig('default_format','tikiwiki')}" />
{/if}
{/strip}