openrat-cms

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

commit 390ac99498f71d215692be389242a7d548a70a2a
parent 5a0c3b6580028a3bcd483be891a194c3dd2c8855
Author: Jan Dankert <devnull@localhost>
Date:   Thu, 15 Mar 2012 00:24:59 +0100

History-Tabs anzeigen, Vorbereitungen für WYMEditor und MarkItUp-Editor.

Diffstat:
themes/default/css/layout.css | 33++++++++++++++++++++++++++++-----
themes/default/include/html/editor.inc.php | 178+------------------------------------------------------------------------------
themes/default/js/openrat.js | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
themes/default/layout/index.php | 10+++++++++-
4 files changed, 121 insertions(+), 184 deletions(-)

diff --git a/themes/default/css/layout.css b/themes/default/css/layout.css @@ -33,10 +33,6 @@ blockquote:before, blockquote:after, q:before, q:after {content:"";} blockquote, q {quotes:"" "";} a img {border:none;} -body -{ - background-color:#E0E0D5; -} iframe @@ -186,8 +182,11 @@ div.window div.status } div.window div.content div.filler { - height:70%; + height:auto; + /* + height:30%; overflow:auto; + */ } /* @@ -1430,3 +1429,26 @@ div.window.fullscreen display: block; } + + +body > ul#history { + display:block; +} +ul#history > li { + + display:inline; + margin:5px; + padding:5px; + border:1px solid gray; + background-color: silver; + color:black; +} +ul#history > li.active { + + display:inline; + margin:5px; + padding:5px; + border:1px solid black; + background-color: white; + color:black; +}+ \ No newline at end of file diff --git a/themes/default/include/html/editor.inc.php b/themes/default/include/html/editor.inc.php @@ -56,188 +56,14 @@ switch( $attr_type ) { case 'fckeditor': case 'html': - echo '<textarea name="'.$attr_name.'" class="editor" id="pageelement_edit_editor">'.$$attr_name.'</textarea>'; - if ( $this->isEditMode() ) - { - include_once('./editor/editor/ckeditor.php'); - - $editor = new CKeditor() ; - - - //$editor->Value = $$attr_name; - //$editor->Height = '290'; - //$editor->Config['CustomConfigurationsPath'] = '../../'.Html::url('filemanager','config'); - //$editor->Config['CustomConfigurationsPath'] = '../openrat-fckconfig.js'; - //$editor->Create(); - - $url = FileUtils::slashify(dirname($_SERVER['SCRIPT_NAME'])); - - $base = defined('OR_BASE_URL')?slashify(OR_BASE_URL).'editor/editor/':'./editor/editor/'; - $editor->basePath = $base; - $editor->config['skin' ] = 'v2'; - $editor->config['language' ] = config('language','language_code'); - $editor->config['toolbar' ] = 'Openrat'; - $editor->config['toolbar_Openrat' ] = array( - array('Save','Preview','-'/*,'Templates'*/), - array('Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'), - array('Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'), - array('Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'), - '/', - array('Bold','Italic',/*'Underline',*/'Strike','-','Subscript','Superscript'), - array('NumberedList','BulletedList','-','Outdent','Indent','Blockquote'), - array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'), - array('Link','Unlink','Anchor'), - array('Image','Flash','Table','HorizontalRule','SpecialChar','PageBreak'), - '/', - array(/*'Styles',*/'Format','Font','FontSize'), - array('TextColor','BGColor'), - array('Source','-', 'ShowBlocks','Maximize') ); - - $editor->config['filebrowserUploadUrl' ] = str_replace('&amp;','&',Html::url('filebrowser','directupload','-',array(REQ_PARAM_TOKEN=>token(),'name'=>'upload'))); - $editor->config['filebrowserBrowseUrl' ] = str_replace('&amp;','&',Html::url('filebrowser','browse','-')); - - // Editor hier raus. - //$editor->editor($attr_name,$$attr_name); - } - else - { - echo ($$attr_name); - } + echo '<textarea name="'.$attr_name.'" class="editor htmleditor" id="pageelement_edit_editor">'.$$attr_name.'</textarea>'; break; case 'wiki': $conf_tags = $conf['editor']['text-markup']; - if ( $this->isEditMode() ) - { - ?> -<script name="Javascript" type="text/javascript" src="<?php echo $tpl_dir ?>../../js/editor.js"></script> -<script name="JavaScript" type="text/javascript"> -<!-- - -function strong() -{ - insert('<?php echo $attr_name ?>','<?php echo $conf_tags['strong-begin'] ?>','<?php echo $conf_tags['strong-end'] ?>'); -} - - -function emphatic() -{ - insert('<?php echo $attr_name ?>','<?php echo $conf_tags['emphatic-begin'] ?>','<?php echo $conf_tags['emphatic-end'] ?>'); -} - - -function link() -{ - objectid = document.forms[0].objectid.value; - if (objectid=="" ||objectid=="0"||objectid==null) - objectid = window.prompt("Id",""); - if (objectid=="" ||objectid=="0"||objectid==null) - return; - insert('<?php echo $attr_name ?>','"','"<?php echo $conf_tags['linkto'] ?>"'+objectid+'"'); -} - - -function image() -{ - objectid = document.forms[0].objectid.value; - if (objectid=="" ||objectid=="0"||objectid==null) - objectid = window.prompt("Id",""); - if (objectid=="" ||objectid=="0"||objectid==null) - return; - insert('<?php echo $attr_name ?>','','<?php echo $conf_tags['image-begin'] ?>"'+objectid+'"<?php echo $conf_tags['image-end'] ?>'); -} - - -function list() -{ - insert('<?php echo $attr_name ?>',"","\n"); - while( true ) - { - t = window.prompt('<?php echo langHtml('EDITOR_PROMPT_LIST_ENTRY') ?>',''); - if ( t != '' && t != null ) - insert('<?php echo $attr_name ?>',"<?php echo $conf_tags['list-unnumbered'] ?> "+t+"\n",""); - else - break; - } -} - - -function numlist() -{ - insert('<?php echo $attr_name ?>',"\n\n<?php echo $conf_tags['list-numbered'] ?> ","\n<?php echo $conf_tags['list-numbered'] ?> \n<?php echo $conf_tags['list-numbered'] ?> \n"); -} - - -function table() -{ - column=1; - while( true ) - { - if ( column==1 ) - text='<?php echo langHtml('EDITOR_PROMPT_TABLE_CELL_FIRST_COLUMN') ?>'; - else - text='<?php echo langHtml('EDITOR_PROMPT_TABLE_CELL') ?>'; - t = window.prompt(text,''); - if ( t != '' && t != null ) - { - insert('<?php echo $attr_name ?>',"<?php echo $conf_tags['table-cell-sep'] ?>"+t,""); - column++; - } - else - { - if (column==1) - { - break; - } - else - { - insert('text',"\n",""); - column=1; - } - } - } -} - -//--> -</script> - <fieldset><legend><?php echo langHtml('EDITOR') ?></legend></fieldset> - <table> - <tr> - <td><noscript><input type="text" name="addtext" size="30" /></noscript></td> - <td><?php add_control('strong' ,'bold.png' )?></td> - <td><?php add_control('emphatic','italic.png') ?></td> - <td>&nbsp;&nbsp;&nbsp;</td> - <td><?php add_control('table','table.png') ?></td> - <td>&nbsp;&nbsp;&nbsp;</td> - <td><?php add_control('list' ,'list.png') ; ?></td> - <td><?php add_control('numlist','numlist.png') ?></td> - <td>&nbsp;&nbsp;&nbsp;</td> - <td><?php add_control('image','image.png') ?></td> - <td><?php add_control('link' ,'link.png' ) ?></td> - <!-- <td><?php echo selectBox('objectid',$objects) ?></td> --> - <td><input name="objectid" size="6" title="<?php echo langHtml('LINK_TO') ?>"></td> - <td><noscript>&nbsp;&nbsp;<input type="submit" class="submit" name="addmarkup" value="<?php echo langHtml('ADD') ?>"/></noscript></td> - </tr> - </table> - <fieldset><legend><?php echo langHtml('CONTENT') ?></legend></fieldset> - - <textarea name="<?php echo $attr_name ?>" class="editor"><?php echo $$attr_name ?></textarea> - -<?php - } - else - { - // Anzeige des Inhaltes - $attr_tmp_text = $$attr_name; -// $attr_tmp_doc = new DocumentElement(); - if ( !is_array($attr_tmp_text)) - $attr_tmp_text = explode("\n",$attr_tmp_text); -// $attr_tmp_doc->parse($attr_tmp_text); -// echo $attr_tmp_doc->render('text/html'); - echo implode('',$attr_tmp_text); - } + ?><textarea name="<?php echo $attr_name ?>" class="editor wikieditor"><?php echo $$attr_name ?></textarea><?php break; case 'text': diff --git a/themes/default/js/openrat.js b/themes/default/js/openrat.js @@ -216,6 +216,8 @@ function loadView(jo, url ) } }); + /* + * if ( $(jo).find('textarea#pageelement_edit_editor').length > 0 ) { var instance = CKEDITOR.instances['pageelement_edit_editor']; @@ -225,6 +227,48 @@ function loadView(jo, url ) } CKEDITOR.replace( 'pageelement_edit_editor',{customConfig:'config-openrat.js'} ); } + */ + + // Wiki-Editor + var markitupSettings = { markupSet: [ + {name:'Bold', key:'B', openWith:'*', closeWith:'*' }, + {name:'Italic', key:'I', openWith:'_', closeWith:'_' }, + {name:'Stroke through', key:'S', openWith:'--', closeWith:'--' }, + {separator:'-----------------' }, + {name:'Bulleted List', openWith:'*', closeWith:'', multiline:true, openBlockWith:'\n', closeBlockWith:'\n'}, + {name:'Numeric List', openWith:'#', closeWith:'', multiline:true, openBlockWith:'\n', closeBlockWith:'\n'}, + {separator:'---------------' }, + {name:'Picture', key:'P', replaceWith:'{[![Source:!:http://]!]" alt="[![Alternative text]!]" }' }, + {name:'Link', key:'L', openWith:'""->"[![Link:!:http://]!]"', closeWith:'"', placeHolder:'Your text to link...' }, + {separator:'---------------' }, + {name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } }, + {name:'Preview', className:'preview', call:'preview'} + ]}; + $(jo).find('.wikieditor').markItUp(markitupSettings); + + // HTML-Editor + var wymSettings = {lang: 'de',basePath: OR_THEMES_EXT_DIR+'../editor/wymeditor/wymeditor/', + toolsItems: [ + {'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'}, + {'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'}, + {'name': 'Superscript', 'title': 'Superscript', 'css': 'wym_tools_superscript'}, + {'name': 'Subscript', 'title': 'Subscript', 'css': 'wym_tools_subscript'}, + {'name': 'InsertOrderedList', 'title': 'Ordered_List', 'css': 'wym_tools_ordered_list'}, + {'name': 'InsertUnorderedList', 'title': 'Unordered_List', 'css': 'wym_tools_unordered_list'}, + {'name': 'Indent', 'title': 'Indent', 'css': 'wym_tools_indent'}, + {'name': 'Outdent', 'title': 'Outdent', 'css': 'wym_tools_outdent'}, + {'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'}, + {'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'}, + {'name': 'CreateLink', 'title': 'Link', 'css': 'wym_tools_link'}, + {'name': 'Unlink', 'title': 'Unlink', 'css': 'wym_tools_unlink'}, + {'name': 'InsertImage', 'title': 'Image', 'css': 'wym_tools_image'}, + {'name': 'InsertTable', 'title': 'Table', 'css': 'wym_tools_table'}, + {'name': 'Paste', 'title': 'Paste_From_Word', 'css': 'wym_tools_paste'}, + {'name': 'ToggleHtml', 'title': 'HTML', 'css': 'wym_tools_html'}, + {'name': 'Preview', 'title': 'Preview', 'css': 'wym_tools_preview'} + ] + }; + $(jo).find('.htmleditor').wymeditor(wymSettings); }); } @@ -372,7 +416,7 @@ function loadBranch(li,type,id) // Neue Action starten. $('div#tree div.entry').removeClass('selected'); $(this).addClass('selected'); - setNewAction( line.action, line.id,line.extraId ); + openNewAction( $(this).text(), line.action, line.id, line.extraId ); }); // Drag and drop für die Baum-Inhalte. @@ -444,9 +488,45 @@ function startView( element,view ) * @param action Action * @param id Id */ +function openNewAction( name,action,id,extraId ) +{ + // Andere Tabs auf inaktiv setzen + $('ul#history li.active').removeClass('active'); + + // Tab schon vorhanden? + if ( $('ul#history li.'+action+'.id'+id).length > 0 ) + { + // Ja, Tab schon vorhanden + // Gewünschtes Tab aktiv setzen + $('ul#history li.'+action+'.id'+id).addClass('active'); + } + else + { + // Tab noch nicht vorhanden, also jetzt hier ergänzen. + $('ul#history').append('<li class="action active '+action+' id'+id+'">'+name+'</li>'); + $('ul#history li.active').click( function() + { + // Action-Tab wurde angeklickt + $('ul#history li.active').removeClass('active'); // Andere Tabs auf inaktiv setzen + $(this).addClass('active'); // Angeklicktes Tab auf aktiv setzen + + setNewAction(action,id,extraId); + } ); + } + + setNewAction( action,id,extraId ); + +} + + +/** + * Setzt neue Action und aktualisiert alle Fenster. + * + * @param action Action + * @param id Id + */ function setNewAction( action,id,extraId ) { - //alert( "Action: "+action+", Id: "+id); $('div#workbench div.refreshable').attr('data-action',action).attr('data-id',id).attr('data-extra',JSON.stringify(extraId)); // Alle refresh-fähigen Views mit dem neuen Objekt laden. diff --git a/themes/default/layout/index.php b/themes/default/layout/index.php @@ -24,12 +24,17 @@ } ?> <link rel="stylesheet" type="text/css" href="<?php echo OR_THEMES_EXT_DIR ?>default/css/layout.css" > <link id="userstyle" rel="stylesheet" type="text/css" href="<?php echo OR_THEMES_EXT_DIR ?>default/css/user/default.css" > + + <link rel="stylesheet" type="text/css" href="<?php echo OR_THEMES_EXT_DIR ?>../editor/markitup/markitup/skins/markitup/style.css" /> + <link rel="stylesheet" type="text/css" href="<?php echo OR_THEMES_EXT_DIR ?>../editor/markitup/markitup/sets/default/style.css" /> <script src="<?php echo OR_THEMES_EXT_DIR ?>default/js/jquery-1.6.2.min.js"></script> <script src="<?php echo OR_THEMES_EXT_DIR ?>default/js/jquery-ui/js/jquery-ui-1.8.16.custom.min.js"></script> <script src="<?php echo OR_THEMES_EXT_DIR ?>default/js/openrat.js"></script> + <script src="<?php echo OR_THEMES_EXT_DIR ?>../editor/wymeditor/wymeditor/jquery.wymeditor.min.js"></script> + <script src="<?php echo OR_THEMES_EXT_DIR ?>../editor/markitup/markitup/jquery.markitup.js"></script> + <!-- <script src="<?php echo OR_THEMES_EXT_DIR ?>../editor/editor/ckeditor.js"></script> <script src="<?php echo OR_THEMES_EXT_DIR ?>../editor/editor/adapters/jquery.js"></script> - <!-- <script src="/~dankert/cms-test/cms09/themes/default/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script> <script src="/~dankert/cms/themes/default/js/xxxxxxxxxxxjquery-plugin-orSearchBox.js"></script> <link rel="stylesheet" type="text/css" href="<?php echo OR_THEMES_EXT_DIR ?>default/js/jquery-ui/css/pepper-grinder/jquery-ui-1.8.9.custom.css" > @@ -88,6 +93,9 @@ var REQ_PARAM_TARGET = '<?php echo REQ_PARAM_TARGET ?>'; <div id="header"> </div> +<ul id="history"> +</ul> + <div id="workbench"> </div>