summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--templates/edit_textarea.tpl20
1 files changed, 18 insertions, 2 deletions
diff --git a/templates/edit_textarea.tpl b/templates/edit_textarea.tpl
index 3389153..bbfa3ea 100644
--- a/templates/edit_textarea.tpl
+++ b/templates/edit_textarea.tpl
@@ -10,13 +10,30 @@
{if $gBitSystem->isFeatureActive('package_quicktags')}
{include file="bitpackage:quicktags/quicktags_full.tpl"}
{/if}
+{/strip}
<div class="row rt-edit">
{formlabel label=$textarea_label for=$textarea_id}
{forminput}
{formfeedback error=$textarea_error}
- <textarea {$textarea_class} {$textarea_attributes} {spellchecker width=$cols height=$rows} id="{$textarea_id|default:$smarty.const.LIBERTY_TEXT_AREA}" name="{$textarea_name|default:edit}" {$textarea_style}>{$textarea_data|escape:html}</textarea>
+ {if !$textarea_id}{assign var=textarea_id value=$smarty.const.LIBERTY_TEXT_AREA}{/if}
+ <textarea {$textarea_class} {$textarea_attributes} {if $textarea_maxchars}onkeydown="BitBase.charCounter('{$textarea_id}','{$textarea_id}Counter','{$textarea_maxchars}');" onkeyup="BitBase.charCounter('{$textarea_id}','{$textarea_id}Counter','{$textarea_maxchars}');"{/if} {spellchecker width=$cols height=$rows} id="{$textarea_id}" name="{$textarea_name|default:edit}" {$textarea_style}>{$textarea_data|escape:html}</textarea>
{if $textarea_required}{required}{/if}
+
+ {if $textarea_maxchars}
+ <script type="text/javascript">//<![CDATA[
+ if( typeof( BitBase ) == 'undefined' ){ldelim}
+ BitBase = {ldelim}{rdelim};
+ {rdelim};
+ BitBase.charCounter = function( textareaId, counterId, maxChars ) {ldelim}
+ document.getElementById( counterId ).value = maxChars - document.getElementById( textareaId ).value.length;
+ {rdelim}
+ //]]></script>
+ {assign var=charCount value=$textarea_data|count_characters:true}
+ <div class="formhelp">{tr}Maximum character count:{/tr}{$textarea_maxchars}<br />
+ {tr}Characters remaining:{/tr} <input readonly="readonly" type="text" id="{$textarea_id}Counter" size="5" value="{$textarea_maxchars-$charCount}" /></div>
+ {/if}
+
{formhelp note=$textarea_help}
{if $gBitSystem->isPackageActive('fckeditor') &&
($gBitSystem->isFeatureActive("fckeditor_ask") ||
@@ -25,4 +42,3 @@
{/if}
{/forminput}
</div>
-{/strip}