openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 2180a4fd387e2665334b6ac49bc9ac1464d4d879
parent 93486db567947637e500b206d8f4d9b809b74cec
Author: dankert <devnull@localhost>
Date:   Sun, 23 Jan 2005 01:09:58 +0100

Erweiterte Funktionalitaeten fuer Textmarkierungen

Diffstat:
themes/default/pages/html/pageelement/edit/longtext.tpl.php | 87+++++++++++++++----------------------------------------------------------------
1 file changed, 16 insertions(+), 71 deletions(-)

diff --git a/themes/default/pages/html/pageelement/edit/longtext.tpl.php b/themes/default/pages/html/pageelement/edit/longtext.tpl.php @@ -1,80 +1,24 @@ <?php include( $tpl_dir.'header.tpl.php') ?> +<script name="Javascript" type="text/javascript" src="<?php echo $tpl_dir ?>../js/editor.js"></script> <script name="JavaScript" type="text/javascript"> <!-- -// Quelle: -// http://aktuell.de.selfhtml.org/tippstricks/javascript/bbcode/ -function insert(aTag, eTag) -{ - var input = document.forms[0].elements['text']; - input.focus(); - /* IE */ - if(typeof document.selection != 'undefined') { - /* Einfgen des Formatierungscodes */ - var range = document.selection.createRange(); - var insText = range.text; - range.text = aTag + insText + eTag; - /* Anpassen der Cursorposition */ - range = document.selection.createRange(); - if (insText.length == 0) { - range.move('character', -eTag.length); - } else { - range.moveStart('character', aTag.length + insText.length + eTag.length); - } - range.select(); - } - /* Gecko */ - else if(typeof input.selectionStart != 'undefined') - { - /* Einfgen des Formatierungscodes */ - var start = input.selectionStart; - var end = input.selectionEnd; - var insText = input.value.substring(start, end); - input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end); - /* Anpassen der Cursorposition */ - var pos; - if (insText.length == 0) { - pos = start + aTag.length; - } else { - pos = start + aTag.length + insText.length + eTag.length; - } - input.selectionStart = pos; - input.selectionEnd = pos; - } - /* fbrigen Browser */ - else - { - /* Abfrage der Einfgeposition */ - var pos; - var re = new RegExp('^[0-9]{0,3}$'); - while(!re.test(pos)) { - pos = prompt("Einfuegen an Position (0.." + input.value.length + "):", "0"); - } - if(pos > input.value.length) { - pos = input.value.length; - } - /* Einfen des Formatierungscodes */ - var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:"); - input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos); - } -} - function strong() { - insert('*','*'); + insert('text','*','*'); } function emphatic() { - insert('_','_'); + insert('text','_','_'); } function link() { - insert('"','"->"'+document.forms[0].objectid.value+'"'); + insert('text','"','"->"'+document.forms[0].objectid.value+'"'); } @@ -86,19 +30,19 @@ function image() function list() { - insert("\n\n- ","\n- \n- \n"); + insert('text',"\n\n- ","\n- \n- \n"); } function numlist() { - insert("\n\n# ","\n# \n# \n"); + insert('text',"\n\n# ","\n# \n# \n"); } function table() { - insert("\n|","| |\n| | |\n"); + insert('text',"\n|","| |\n| | |\n"); } @@ -130,17 +74,18 @@ function table() <td colspan="2" class="f1"> <table> <tr> - <td><a href="javascript:strong();"><img src="<?php echo $image_dir ?>/editor/bold.png" border"0" /></a></td> - <td><a href="javascript:emphatic();"><img src="<?php echo $image_dir ?>/editor/italic.png" border"0" /></a></td> + <noscript><input type="text" name="addtext" size="10" /></noscript> + <td><noscript><?php echo Html::Checkbox('strong') ?></noscript><a href="javascript:strong();" title="<?php echo lang('PAGE_EDITOR_ADD_STRONG') ?>"><img src="<?php echo $image_dir ?>/editor/bold.png" border"0" /></a></td> + <td><noscript><?php echo Html::Checkbox('emphatic') ?></noscript><a href="javascript:emphatic();" title="<?php echo lang('PAGE_EDITOR_ADD_EMPHATIC') ?>"><img src="<?php echo $image_dir ?>/editor/italic.png" border"0" /></a></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td> - <td><a href="javascript:table();"><img src="<?php echo $image_dir ?>/editor/table.png" border"0" /></a></td> + <td><noscript><?php echo Html::Checkbox('table') ?></noscript><a href="javascript:table();" title="<?php echo lang('PAGE_EDITOR_ADD_TABLE') ?>"><img src="<?php echo $image_dir ?>/editor/table.png" border"0" /></a></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td> - <td><a href="javascript:list();"><img src="<?php echo $image_dir ?>/editor/list.png" border"0" /></a></td> - <td><a href="javascript:numlist();"><img src="<?php echo $image_dir ?>/editor/numlist.png" border"0" /></a></td> + <td><noscript><?php echo Html::Checkbox('list') ?></noscript><a href="javascript:list();" title="<?php echo lang('PAGE_EDITOR_ADD_LIST') ?>"><img src="<?php echo $image_dir ?>/editor/list.png" border"0" /></a></td> + <td><noscript><?php echo Html::Checkbox('numlist') ?></noscript><a href="javascript:numlist();" title="<?php echo lang('PAGE_EDITOR_ADD_NUMLIST') ?>"><img src="<?php echo $image_dir ?>/editor/numlist.png" border"0" /></a></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;</td> - <td><a href="javascript:image();"><img src="<?php echo $image_dir ?>/editor/image.png" border"0" /></a></td> - <td><a href="javascript:link();"><img src="<?php echo $image_dir ?>/editor/link.png" border"0" /></a></td> - <td><?php echo Html::selectBox('objectid',$objects) ?></td> + <td><noscript><?php echo Html::Checkbox('image') ?></noscript><a href="javascript:image();" title="<?php echo lang('PAGE_EDITOR_ADD_IMAGE') ?>"><img src="<?php echo $image_dir ?>/editor/image.png" border"0" /></a></td> + <td><noscript><?php echo Html::Checkbox('link') ?></noscript><a href="javascript:link();" title="<?php echo lang('PAGE_EDITOR_ADD_LINK') ?>"><img src="<?php echo $image_dir ?>/editor/link.png" border"0" /></a></td> + <td><?php echo Html::selectBox('objectid',$objects) ?><noscript>&nbsp;&nbsp;&nbsp;<input type="submit" class="submit" name="addmarkup" value="<?php echo lang('GLOBAL_ADD') ?>"/></noscript></td> </tr> </table> </td>