openrat-cms

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

commit 148fe7d2d156956ac04ef3fd75f03258a0664215
parent 0129956b1e87700a4770ea9de07107d4c875dfc2
Author: Jan Dankert <devnull@localhost>
Date:   Sat, 25 Nov 2017 03:05:41 +0100

Weiter die Template-Includes durch Klassen ersetzt.

Diffstat:
themes/default/include/elements.ini.php | 4++--
themes/default/include/html/button/Button.class.php | 8+++++---
themes/default/include/html/button/button-begin.inc.php | 33---------------------------------
themes/default/include/html/checkbox/checkbox-begin.inc.php | 15---------------
themes/default/include/html/column/column-begin.inc.php | 33---------------------------------
themes/default/include/html/column/column-end.inc.php | 2--
themes/default/include/html/date/Date.class.php | 18++++++++++++++++++
themes/default/include/html/date/component-date.php | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
themes/default/include/html/date/date-begin.inc.php | 74--------------------------------------------------------------------------
themes/default/include/html/date/date.inc.php | 6++++++
themes/default/include/html/dummy/Dummy.class.php | 9+++++++++
themes/default/include/html/dummy/dummy-begin.inc.php | 0
themes/default/include/html/editor/Editor.class.php | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
themes/default/include/html/editor/editor-begin.inc.php | 99-------------------------------------------------------------------------------
themes/default/include/html/editor/editor.min.css | 2++
themes/default/include/html/editor/editor.min.js | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
themes/default/include/html/form/Form.class.php | 1+
themes/default/include/html/window/Window.class.php | 9+++++++++
themes/default/include/html/window/window-begin.inc.php | 0
19 files changed, 269 insertions(+), 261 deletions(-)

diff --git a/themes/default/include/elements.ini.php b/themes/default/include/elements.ini.php @@ -7,7 +7,7 @@ output = button = checkbox = default:false,readonly:false,name:* column = width,style,class,colspan,rowspan,header:false,title,url,action,id,name -date = date +date = dummy = focus = field:* form = action,subaction,id,name:,target:_self,method:post,enctype:application/x-www-form-urlencoded,type:,cancel:false,label,visible:false,async:false,autosave:false @@ -17,7 +17,7 @@ frameset-page=menu group = title,icon,open:true,class,show:true hidden = name:*,default header = name:,views,back:false -editor = name:*,type:*,mode +editor = else = if = equals,value,not,empty,present,contains,greaterthan,lessthan,true,false image = diff --git a/themes/default/include/html/button/Button.class.php b/themes/default/include/html/button/Button.class.php @@ -3,10 +3,12 @@ class ButtonComponent extends Component { - public $type; - + public $type = 'submit'; + public $class = 'ok'; public $src; - + public $text = 'button_ok'; + public $value = 'ok'; + private $tmp_src; protected function begin() diff --git a/themes/default/include/html/button/button-begin.inc.php b/themes/default/include/html/button/button-begin.inc.php @@ -1,32 +0,0 @@ -<div class="invisible"> -<?php - #IF-ATTR-VALUE type:ok# - if ($this->isEditable() && !$this->isEditMode() && !readonly() ) - { - $attr_type = ''; // Knopf nicht anzeigen - ?><a class="action" href="<?php echo Html::url($actionName,$subactionName,0,array('mode'=>'edit')) ?>"><span title="<?php echo lang('MODE_EDIT_DESC') ?>"><?php echo langHtml('MODE_EDIT') ?></span></a><?php - } else - { - $attr_type = 'submit'; - } - #END-IF - - #IF-ATTR src# - $attr_type = 'image'; - $attr_tmp_src = $image_dir.'icon_'.$attr_src.IMG_ICON_EXT; - #ELSE - $attr_tmp_src = ''; - #END-IF - if ( !empty($attr_type)) { -?> -<input type="<?php echo $attr_type ?>"<?php if(isset($attr_src)) { ?> src="<?php $attr_tmp_src ?>"<?php } ?> name="<?php echo $attr_value ?>" class="%class%" title="<?php echo lang($attr_text.'_DESC') ?>" value="&nbsp;&nbsp;&nbsp;&nbsp;<?php echo langHtml($attr_text) ?>&nbsp;&nbsp;&nbsp;&nbsp;" /><?php unset($attr_src); ?> -<?php } - #IF-ATTR-VALUE type:ok# - if ($this->isEditable() && $this->isEditMode() ) - { - // 2. Knopf "Cancel" - ?><a class="action" href="<?php echo Html::url($actionName,$subactionName,0,array('mode'=>'')) ?>"><span title="<?php echo lang('CANCEL_DESC') ?>"><?php echo langHtml('CANCEL') ?></span></a><?php - } - #END-IF -?> -</div>- \ No newline at end of file diff --git a/themes/default/include/html/checkbox/checkbox-begin.inc.php b/themes/default/include/html/checkbox/checkbox-begin.inc.php @@ -1,14 +0,0 @@ -<?php - if ($this->isEditable() && !$this->isEditMode()) $attr_readonly=true; - - if ( isset($$attr_name) ) - $checked = $$attr_name; - else - $checked = $attr_default; -?><input class="checkbox" type="checkbox" id="<?php echo REQUEST_ID ?>_<?php echo $attr_name ?>" name="<?php echo $attr_name ?>" <?php if ($attr_readonly) echo ' disabled="disabled"' ?> value="1" <?php if( $checked ) echo 'checked="checked"' ?> /><?php - -if ( $attr_readonly && $checked ) -{ -?><input type="hidden" name="<?php echo $attr_name ?>" value="1" /><?php -} -?><?php unset($attr_name); unset($attr_readonly); unset($attr_default); ?>- \ No newline at end of file diff --git a/themes/default/include/html/column/column-begin.inc.php b/themes/default/include/html/column/column-begin.inc.php @@ -1,32 +0,0 @@ -<?php $column_idx++; ?><td -#IF-ATTR width# - width="%width%" -#ELSE# -<?php if (!empty($column_widths)) { ?> - width="<?php echo $column_widths[($column_idx-1)%count($column_widths)] ?>" -<?php } ?> -#END-IF# -#IF-ATTR style# - style="%style%" -#END-IF# -#IF-ATTR class# - class="%class%" -#ELSE# -<?php if (!empty($column_classes)) { ?> - class="<?php echo $column_classes[($column_idx-1)%count($column_classes)] ?>" -<?php } ?> -#END-IF# -#IF-ATTR colspan# - colspan="%colspan%" -#END-IF# -#IF-ATTR rowspan# - rowspan="%rowspan%" -#END-IF# -#IF-ATTR title# - title="%title%" -#END-IF# - -#IF-ATTR id# - onclick="javascript:openNewAction('<?php echo $attr_name ?>','<?php echo $attr_action ?>','<?php echo $attr_id ?>'); " -#END-IF# ->- \ No newline at end of file diff --git a/themes/default/include/html/column/column-end.inc.php b/themes/default/include/html/column/column-end.inc.php @@ -1 +0,0 @@ -</td>- \ No newline at end of file diff --git a/themes/default/include/html/date/Date.class.php b/themes/default/include/html/date/Date.class.php @@ -0,0 +1,17 @@ +<?php + +class DateComponent extends Component +{ + public $date; + + protected function begin() + { + $date = $this->date; + + include_once( OR_THEMES_DIR.'default/include/html/date/date.inc.php'); + echo '<?php component_date('.$this->value($this->date).') ?>'; + } +} + + +?>+ \ No newline at end of file diff --git a/themes/default/include/html/date/component-date.php b/themes/default/include/html/date/component-date.php @@ -0,0 +1,72 @@ +<?php +function component_date( $time ) +{ + if ( $time==0) + echo lang('GLOBAL_UNKNOWN'); + else + { + // Benutzereinstellung 'Zeitzonen-Offset' auswerten. + if ( isset($_COOKIE['or_timezone_offset']) ) + { + $time -= (int)date('Z'); + $time += ((int)$_COOKIE['or_timezone_offset']*60); + } + + echo '<span title="'; + $dl = date(lang('DATE_FORMAT_LONG'),$time); + $dl = str_replace('{weekday}',lang('DATE_WEEKDAY'.strval(date('w',$time))),$dl); + $dl = str_replace('{month}' ,lang('DATE_MONTH' .strval(date('n',$time))),$dl); +// $dl = str_replace(' ','&nbsp;',$dl); + echo $dl; + unset($dl); + + + $sekunden = time()-$time; + $minuten = intval($sekunden/60); + $stunden = intval($minuten /60); + $tage = intval($stunden /24); + $monate = intval($tage /30); + $jahre = intval($monate /12); + + echo ' ('; + + + if ( $sekunden == 1 ) + echo $sekunden.' '.lang('GLOBAL_SECOND'); + elseif ( $sekunden < 60 ) + echo $sekunden.' '.lang('GLOBAL_SECONDS'); + + elseif ( $minuten == 1 ) + echo $minuten.' '.lang('GLOBAL_MINUTE'); + elseif ( $minuten < 60 ) + echo $minuten.' '.lang('GLOBAL_MINUTES'); + + elseif ( $stunden == 1 ) + echo $stunden.' '.lang('GLOBAL_HOUR'); + elseif ( $stunden < 60 ) + echo $stunden.' '.lang('GLOBAL_HOURS'); + + elseif ( $tage == 1 ) + echo $tage.' '.lang('GLOBAL_DAY'); + elseif ( $tage < 60 ) + echo $tage.' '.lang('GLOBAL_DAYS'); + + elseif ( $monate == 1 ) + echo $monate.' '.lang('GLOBAL_MONTH'); + elseif ( $monate < 12 ) + echo $monate.' '.lang('GLOBAL_MONTHS'); + + elseif ( $jahre == 1 ) + echo $jahre.' '.lang('GLOBAL_YEAR'); + else + echo $jahre.' '.lang('GLOBAL_YEARS'); + + echo ')'; + + + echo '">'; + echo date(lang('DATE_FORMAT'),$time); + echo '</span>'; + } +} +?>+ \ No newline at end of file diff --git a/themes/default/include/html/date/date-begin.inc.php b/themes/default/include/html/date/date-begin.inc.php @@ -1,73 +0,0 @@ -<?php - global $conf; - $time = $attr_date; - - if ( $time==0) - echo lang('GLOBAL_UNKNOWN'); - else - { - // Benutzereinstellung 'Zeitzonen-Offset' auswerten. - if ( isset($_COOKIE['or_timezone_offset']) ) - { - $time -= (int)date('Z'); - $time += ((int)$_COOKIE['or_timezone_offset']*60); - } - - echo '<span title="'; - $dl = date(lang('DATE_FORMAT_LONG'),$time); - $dl = str_replace('{weekday}',lang('DATE_WEEKDAY'.strval(date('w',$time))),$dl); - $dl = str_replace('{month}' ,lang('DATE_MONTH' .strval(date('n',$time))),$dl); -// $dl = str_replace(' ','&nbsp;',$dl); - echo $dl; - unset($dl); - - - $sekunden = time()-$time; - $minuten = intval($sekunden/60); - $stunden = intval($minuten /60); - $tage = intval($stunden /24); - $monate = intval($tage /30); - $jahre = intval($monate /12); - - echo ' ('; - - - if ( $sekunden == 1 ) - echo $sekunden.' '.lang('GLOBAL_SECOND'); - elseif ( $sekunden < 60 ) - echo $sekunden.' '.lang('GLOBAL_SECONDS'); - - elseif ( $minuten == 1 ) - echo $minuten.' '.lang('GLOBAL_MINUTE'); - elseif ( $minuten < 60 ) - echo $minuten.' '.lang('GLOBAL_MINUTES'); - - elseif ( $stunden == 1 ) - echo $stunden.' '.lang('GLOBAL_HOUR'); - elseif ( $stunden < 60 ) - echo $stunden.' '.lang('GLOBAL_HOURS'); - - elseif ( $tage == 1 ) - echo $tage.' '.lang('GLOBAL_DAY'); - elseif ( $tage < 60 ) - echo $tage.' '.lang('GLOBAL_DAYS'); - - elseif ( $monate == 1 ) - echo $monate.' '.lang('GLOBAL_MONTH'); - elseif ( $monate < 12 ) - echo $monate.' '.lang('GLOBAL_MONTHS'); - - elseif ( $jahre == 1 ) - echo $jahre.' '.lang('GLOBAL_YEAR'); - else - echo $jahre.' '.lang('GLOBAL_YEARS'); - - echo ')'; - - - echo '">'; - echo date(lang('DATE_FORMAT'),$time); - echo '</span>'; - } - -?>- \ No newline at end of file diff --git a/themes/default/include/html/date/date.inc.php b/themes/default/include/html/date/date.inc.php @@ -0,0 +1,5 @@ +<?php + +readfile(OR_THEMES_DIR.'default/include/html/date/component-date.php'); + +?>+ \ No newline at end of file diff --git a/themes/default/include/html/dummy/Dummy.class.php b/themes/default/include/html/dummy/Dummy.class.php @@ -0,0 +1,8 @@ +<?php + +class DummyComponent extends Component +{ +} + + +?>+ \ No newline at end of file diff --git a/themes/default/include/html/dummy/dummy-begin.inc.php b/themes/default/include/html/dummy/dummy-begin.inc.php diff --git a/themes/default/include/html/editor/Editor.class.php b/themes/default/include/html/editor/Editor.class.php @@ -0,0 +1,55 @@ +<?php + +class EditorComponent extends Component +{ + public $type; + public $name; + + protected function begin() + { + switch( $this->type ) + { + case 'fckeditor': + case 'html': + echo '<textarea name="'.$this->htmlvalue($this->name).'" class="editor__html-editor" id="pageelement_edit_editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; + + break; + + case 'wiki': + echo '<textarea name="'.$this->htmlvalue($this->name).'" class="editor__wiki-editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; + break; + + case 'text': + case 'raw': + echo '<textarea name="'.$this->htmlvalue($this->name).'" class="editor__text-editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; + break; + + case 'ace': + case 'code': + echo '<textarea name="'.$this->htmlvalue($this->name).'" data-mode="'.$attr_mode.'" class="editor__code-editor"><?php echo ${'.$this->value($this->name).'} ?></textarea>'; + break; + + + case 'dom': + case 'tree': + echo <<<HTML + <?php + $attr_tmp_doc = new DocumentElement(); + $attr_tmp_text = $$attr_name; + 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('application/html-dom'); + ?> +HTML; + break; + + default: + throw new LogicException("Unknown editor type: ".$this->type); + } + } +} + + +?>+ \ No newline at end of file diff --git a/themes/default/include/html/editor/editor-begin.inc.php b/themes/default/include/html/editor/editor-begin.inc.php @@ -1,98 +0,0 @@ -<?php - - - function checkbox( $name,$value=false,$writable=true,$params=Array() ) - { - $src = '<input type="checkbox" id="'.REQUEST_ID.'_'.$name.'" name="'.$name.'"'; - - foreach( $params as $name=>$val ) - $src .= " $name=\"$val\""; - - if ( !$writable ) - $src .= ' disabled="disabled"'; - - if ( $value ) - $src .= ' value="1" checked="checked"'; - - $src .= ' />'; - - return $src; - } - - - function selectBox( $name,$values,$default='',$params=Array() ) - { - if ( ! is_array($values) ) - $values = array($values); - - $src = '<select size="1" name="'.$name.'"'; - foreach( $params as $name=>$value ) - $src .= " $name=\"$value\""; - $src .= '>'; - - foreach( $values as $key=>$value ) - { - $src .= '<option value="'.$key.'"'; - if ($key == $default) - $src .= ' selected="selected"'; - $src .= '>'.$value.'</option>'; - } - $src .= '</select>'; - - return $src; - } - - - function add_control($type,$image) - { - global $image_dir; - echo '<td><noscript>'.checkbox($type).'</noscript><label for="'.REQUEST_ID.'_'.$type.'"><a href="javascript:'.$type.'();" title="'.langHtml('PAGE_EDITOR_ADD_'.$type).'"><img src="'.$image_dir.'/editor/'.$image.'" border"0" /></a></label>'; - } - - - ?><?php - -switch( $attr_type ) -{ - case 'fckeditor': - case 'html': - echo '<textarea name="'.$attr_name.'" class="editor__html-editor" id="pageelement_edit_editor">'.$$attr_name.'</textarea>'; - - break; - - case 'wiki': - $conf_tags = $conf['editor']['text-markup']; - - ?><textarea name="<?php echo $attr_name ?>" class="editor__wiki-editor"><?php echo $$attr_name ?></textarea><?php - break; - - case 'text': - case 'raw': - if ( $this->isEditMode() ) - echo '<textarea name="'.$attr_name.'" class="editor__text-editor">'.$$attr_name.'</textarea>'; - else - echo nl2br($$attr_name); - break; - - case 'ace': - case 'code': - echo '<textarea name="'.$attr_name.'" data-mode="'.$attr_mode.'" class="editor__code-editor">'.$$attr_name.'</textarea>'; - break; - - - case 'dom': - case 'tree': - - $attr_tmp_doc = new DocumentElement(); - $attr_tmp_text = $$attr_name; - 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('application/html-dom'); - break; - - default: - echo "Unknown editor type: ".$attr_type; -} -?>- \ No newline at end of file diff --git a/themes/default/include/html/editor/editor.min.css b/themes/default/include/html/editor/editor.min.css @@ -0,0 +1 @@ +.editor__text-editor {width:100%;height:300px;}textarea.editor__code-editor {display:none;}div.editor__code-editor {position:absolute;height:500px;width:100%;font-size:14px;z-index:256;}textarea.editor__text-editor,textarea.editor__wiki-editor,textarea.editor__html-editor {width:100%;}a.editorlink:active,a.editorlink:hover {font-weight:normal;text-decoration:none;}a.editorlink:link,a.editorlink:visited {font-weight:normal;text-decoration:none;}+ \ No newline at end of file diff --git a/themes/default/include/html/editor/editor.min.js b/themes/default/include/html/editor/editor.min.js @@ -0,0 +1,87 @@ +$(document).on('orViewLoaded',function(event, data) { + + if ( $(event.target).find('textarea#pageelement_edit_editor').size() > 0 ) + { + var instance = CKEDITOR.instances['pageelement_edit_editor']; + if(instance) + { + CKEDITOR.remove(instance); + } + 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'} + ]}; + $(event.target).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'} + ] + }; + + + $(event.target).find('textarea').orAutoheight(); + + + + + + // ACE-Editor anzeigen + $(event.target).find("textarea.editor__code-editor").each( function() { + var textareaEl = $(this); + var aceEl = $("<div class=\"editor__code-editor\" />").insertAfter(textareaEl); + var editor = ace.edit( aceEl.get(0) ); + var mode = textareaEl.data('mode'); + + editor.renderer.setShowGutter(true); + editor.setTheme("ace/theme/github"); + +// editor.setReadOnly(true); + editor.getSession().setTabSize(4); + editor.getSession().setUseWrapMode(true); + editor.setHighlightActiveLine(true); + editor.getSession().setValue( textareaEl.val() ); + editor.getSession().setMode("ace/mode/" + mode); + editor.getSession().on('change', function(e) { + textareaEl.val(editor.getSession().getValue()); + } ); + + // copy back to textarea on form submit... + textareaEl.closest('form').submit(function() { + textareaEl.val( editor.getSession().getValue() ); + }) + } ); + + +});+ \ No newline at end of file diff --git a/themes/default/include/html/form/Form.class.php b/themes/default/include/html/form/Form.class.php @@ -15,6 +15,7 @@ class FormComponent extends Component public $enctype = 'application/x-www-form-urlencoded'; public $async = false; public $autosave = false; + public $type = ''; private $submitFunction = 'formSubmit( $(this) ); return false;'; diff --git a/themes/default/include/html/window/Window.class.php b/themes/default/include/html/window/Window.class.php @@ -0,0 +1,8 @@ +<?php + +class WindowComponent extends Component +{ +} + + +?>+ \ No newline at end of file diff --git a/themes/default/include/html/window/window-begin.inc.php b/themes/default/include/html/window/window-begin.inc.php