diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-12 22:41:25 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-12 22:41:25 +0000 |
commit | da90ff55725a9118ce6111ab2b6371650bf78ade (patch) | |
tree | 937da734d50c8147ca8f2cc52791dabf430464c6 /mod/thewire/views/default/forms | |
parent | cc6b7d1d223241e397e0d41354924e74606eeffc (diff) | |
download | elgg-da90ff55725a9118ce6111ab2b6371650bf78ade.tar.gz elgg-da90ff55725a9118ce6111ab2b6371650bf78ade.tar.bz2 |
a mostly completed port of JHU/APL wire plugin to 1.8
git-svn-id: http://code.elgg.org/elgg/trunk@8183 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/thewire/views/default/forms')
-rw-r--r-- | mod/thewire/views/default/forms/thewire/add.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/mod/thewire/views/default/forms/thewire/add.php b/mod/thewire/views/default/forms/thewire/add.php new file mode 100644 index 000000000..e34a8c0e5 --- /dev/null +++ b/mod/thewire/views/default/forms/thewire/add.php @@ -0,0 +1,64 @@ +<?php +/** + * Wire add form body + * + * @uses $vars['post'] + */ + +$post = elgg_get_array_value('post', $vars); + +$text = elgg_echo('post'); +if ($post) { + $text = elgg_echo('thewire:reply'); +} + +if ($post) { + echo elgg_view('input/hidden', array( + 'internalname' => 'parent_guid', + 'value' => $post->guid, + )); +} +?> +<textarea id="thewire-textarea" name="body" class="mtm"></textarea> +<div id="thewire-characters-remaining"> + <span>140</span> <?php echo elgg_echo('thewire:charleft'); ?> +</div> +<?php + +echo elgg_view('input/submit', array( + 'value' => $text, + 'internalid' => 'thewire-submit-button', +)); + +?> +<script type="text/javascript"> + +$(document).ready(function() { + $("#thewire-textarea").bind('keydown', function() { + textCounter(this, $("#thewire-characters-remaining span"), 140); + }); + $("#thewire-textarea").bind('keyup', function() { + textCounter(this, $("#thewire-characters-remaining span"), 140); + }); +}); + +function textCounter(textarea, status, limit) { + + var remaining_chars = limit - textarea.value.length; + status.html(remaining_chars); + + if (remaining_chars < 0) { + status.parent().css("color", "#D40D12"); + $("#thewire-submit-button").attr('disabled', 'disabled'); + $("#thewire-submit-button").css('background', '#999999'); + $("#thewire-submit-button").css('border-color', '#999999'); + $("#thewire-submit-button").css('cursor', 'default'); + } else { + status.parent().css("color", ""); + $("#thewire-submit-button").removeAttr('disabled', 'disabled'); + $("#thewire-submit-button").css('background', '#4690d6'); + $("#thewire-submit-button").css('border-color', '#4690d6'); + $("#thewire-submit-button").css('cursor', 'pointer'); + } +} +</script> |