raster pushed a commit to branch master. http://git.enlightenment.org/website/www.git/commit/?id=7de8d9f02dba2b57540df8a91af015490c19ca65
commit 7de8d9f02dba2b57540df8a91af015490c19ca65 Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com> Date: Mon Feb 15 11:15:16 2016 +0900 dokuwiki plugins - add news plugin --- public_html/lib/plugins/anewssystem/INFO | 8 + public_html/lib/plugins/anewssystem/README | 28 + public_html/lib/plugins/anewssystem/VERSION | 1 + public_html/lib/plugins/anewssystem/action.php | 241 ++++ public_html/lib/plugins/anewssystem/backlink.js | 42 + .../lib/plugins/anewssystem/conf/default.php | 23 + .../lib/plugins/anewssystem/conf/metadata.php | 21 + .../lib/plugins/anewssystem/dropdowncontent.js | 137 +++ .../lib/plugins/anewssystem/images/bullet.png | Bin 0 -> 206 bytes .../lib/plugins/anewssystem/images/delete.gif | Bin 0 -> 925 bytes .../lib/plugins/anewssystem/images/delete_hov.gif | Bin 0 -> 925 bytes public_html/lib/plugins/anewssystem/images/dot.gif | Bin 0 -> 832 bytes .../lib/plugins/anewssystem/images/dot2.gif | Bin 0 -> 832 bytes .../lib/plugins/anewssystem/images/edit.gif | Bin 0 -> 926 bytes .../lib/plugins/anewssystem/images/edit_hov.gif | Bin 0 -> 926 bytes .../lib/plugins/anewssystem/images/toc-arrows.png | Bin 0 -> 225 bytes .../lib/plugins/anewssystem/images/toc-bullet.png | Bin 0 -> 121 bytes .../plugins/anewssystem/images/toolbar/bold.png | Bin 0 -> 251 bytes .../plugins/anewssystem/images/toolbar/code.png | Bin 0 -> 658 bytes .../plugins/anewssystem/images/toolbar/enlarge.png | Bin 0 -> 379 bytes .../lib/plugins/anewssystem/images/toolbar/h1.png | Bin 0 -> 290 bytes .../lib/plugins/anewssystem/images/toolbar/h2.png | Bin 0 -> 328 bytes .../lib/plugins/anewssystem/images/toolbar/h3.png | Bin 0 -> 322 bytes .../lib/plugins/anewssystem/images/toolbar/h4.png | Bin 0 -> 310 bytes .../lib/plugins/anewssystem/images/toolbar/h5.png | Bin 0 -> 325 bytes .../lib/plugins/anewssystem/images/toolbar/hr.png | Bin 0 -> 254 bytes .../plugins/anewssystem/images/toolbar/italic.png | Bin 0 -> 241 bytes .../plugins/anewssystem/images/toolbar/link.png | Bin 0 -> 405 bytes .../anewssystem/images/toolbar/linkextern.png | Bin 0 -> 904 bytes .../plugins/anewssystem/images/toolbar/mono.png | Bin 0 -> 296 bytes .../lib/plugins/anewssystem/images/toolbar/ol.png | Bin 0 -> 304 bytes .../plugins/anewssystem/images/toolbar/reduce.png | Bin 0 -> 356 bytes .../plugins/anewssystem/images/toolbar/strike.png | Bin 0 -> 318 bytes .../anewssystem/images/toolbar/subscript.png | Bin 0 -> 359 bytes .../anewssystem/images/toolbar/superscript.png | Bin 0 -> 357 bytes .../lib/plugins/anewssystem/images/toolbar/ul.png | Bin 0 -> 291 bytes .../anewssystem/images/toolbar/underline.png | Bin 0 -> 317 bytes .../lib/plugins/anewssystem/lang/de/lang.php | 33 + .../lib/plugins/anewssystem/lang/de/settings.php | 21 + .../lib/plugins/anewssystem/lang/en/lang.php | 33 + .../lib/plugins/anewssystem/lang/en/settings.php | 21 + .../lib/plugins/anewssystem/lang/it/lang.php | 35 + .../lib/plugins/anewssystem/lang/it/settings.php | 17 + .../lib/plugins/anewssystem/plugin.info.txt | 9 + public_html/lib/plugins/anewssystem/style.css | 353 ++++++ public_html/lib/plugins/anewssystem/syntax.php | 1187 ++++++++++++++++++++ .../lib/plugins/anewssystem/tpl/newstemplate.txt | 10 + .../plugins/anewssystem/tpl/newstemplate_de.txt | 10 + .../plugins/anewssystem/tpl/newstemplate_en.txt | 10 + .../plugins/anewssystem/tpl/newstemplate_it.txt | 10 + 50 files changed, 2250 insertions(+) diff --git a/public_html/lib/plugins/anewssystem/INFO b/public_html/lib/plugins/anewssystem/INFO new file mode 100644 index 0000000..56ee566 --- /dev/null +++ b/public_html/lib/plugins/anewssystem/INFO @@ -0,0 +1,8 @@ +# PLUGIN INFO - DO NOT EDIT! + +author Taggic +email tag...@t-online.de +date 2015-02-11 +name anewssystem +desc provides an easy to handle, page based news system +url http://www.dokuwiki.org/plugin:anewssystem diff --git a/public_html/lib/plugins/anewssystem/README b/public_html/lib/plugins/anewssystem/README new file mode 100644 index 0000000..2efd0b0 --- /dev/null +++ b/public_html/lib/plugins/anewssystem/README @@ -0,0 +1,28 @@ +/** +* anewssystem Plugin: +* +* @license GPL 2 (http://www.gnu.org/licenses/gpl.html) +* @author Taggic <tag...@t-online.de> +*/ + +Intro +------ + +Syntax +------- + + +Installation +------------ + Just download and extract it as folder �anewssystem� into your �\lib\plugins� + directory or put the link into the Plugin Manager for automated installation: + https://github.com/Taggic/anewssystem/zipball/master + + +Configuration +-------------- + + +Examples/Usage +-------------- +for example please refer to: http://www.fristercons.de/fcon/doku.php?id=news:descr&#examples_usage \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/VERSION b/public_html/lib/plugins/anewssystem/VERSION new file mode 100644 index 0000000..2776660 --- /dev/null +++ b/public_html/lib/plugins/anewssystem/VERSION @@ -0,0 +1 @@ +2015-02-11 \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/action.php b/public_html/lib/plugins/anewssystem/action.php new file mode 100644 index 0000000..14a8537 --- /dev/null +++ b/public_html/lib/plugins/anewssystem/action.php @@ -0,0 +1,241 @@ +<?php +/****************************************************************************** +** +** action script related to anewssystem +** Action to display the archive page +*/ +/****************************************************************************** +** must run within Dokuwiki +**/ +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../').'/'); +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +require_once(DOKU_PLUGIN.'action.php'); + + +/******************************************************************************/ +class action_plugin_anewssystem extends DokuWiki_Action_Plugin { + + var $parameter = ""; + + /** + * return some info + */ + function getInfo(){ + return array( + 'author' => 'Taggic', + 'email' => 'tag...@t-online.de', + 'date' => '2013-02-19', + 'name' => 'News archive page (action plugin component)', + 'desc' => 'to show the News aechive alone on a page.', + 'url' => 'http://www.dokuwiki.org/plugin:anewssystem', + ); + } +/****************************************************************************** +** Register its handlers with the dokuwiki's event controller +*/ + function register(&$controller) { + $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, '_handle_act', array()); + $controller->register_hook('TPL_ACT_UNKNOWN', 'BEFORE', $this, 'output', array()); + } + +/****************************************************************************** +** Handle the action +*/ + function _handle_act(&$event, $param) { + if($event->data !== 'shownewsarchive') { return; } + $event->preventDefault(); // https://www.dokuwiki.org/devel:events#event_object + return true; + } +/****************************************************************************** +** Generate output +*/ + function output(&$event, $param) { + if($event->data !== 'shownewsarchive') { return; } + global $ID; + + $target = $this->getConf('news_datafile'); + $targetpage = htmlspecialchars(trim($target)); + $prefix = 'anss'; + $del = 'anss_del'; + $cut_prefx = 'news_input_'; + $allnewsdata1 = $this->getConf('news_output'); + $allnewsdata = wl( (isset($allnewsdata1) ? $allnewsdata1 : 'news:newsdata') ); + $i = strripos($allnewsdata, ":"); + $news_root = substr($allnewsdata, 0, $i); + + // necessary for the back link of a show one article per page (SOAPP) + if(stripos($_GET['archive'],'archive')!== false) $ans_conf['param'] = $_GET['archive']; + $_GET['archive']=""; + + // 1. read template (plugins/anewssystem/template.php) + $template = file_get_contents(DOKU_PLUGIN.'anewssystem/tpl/newstemplate.txt'); + /*------- add news action part -----------------------------------------*/ + $post_prefix = $_POST["xs-".$prefix]; + $delete_record = $_POST["anss_del_record"]; + $delete_anchor = $_POST["anss_del_anchor"]; + + // date ... consider all news of a defined month of a year (mm.yyyy, empty per default) + // qty ... limits the number of news headlines starting with most recent (either integer or all, default:all) + // tag ... consider all news where news article owns the given tag string (empty per default) tag delimiter is "|" + // style ... css style string as used in HTML (except quotation marks) for the outer element div + // class ... css style for usecase toc, page or box + // ho ... headlinesonly will list the news headlines without timestamp and author (on/off, default: off) + + // check if page ID was called with tag filter +// $tmp .= ','.$_GET['tag']; // this will overrule the page syntax setting + if(strlen($tmp)<2) { + // strip parameter to get set of add parameter + $tmp = substr($ans_conf['param'],strlen('allnews')); + } + $split_array = explode(',',$tmp); // one or multiple tag filters: $prefs[1] ... [n] + $archive_options = array(); + + // split parameter into array with key and data + foreach ($split_array as $item) { + list($key, $value) = split("=",trim($item),2); + $archive_options = $archive_options + array($key => $value); + } + + if(($archive_options['qty']=='') || ($archive_options['qty']<1)) $archive_options['qty'] = 'all'; + if(array_key_exists('class',$archive_options) === false) $archive_options['class'] = 'page'; + if(array_key_exists('ho',$archive_options) === false) $archive_options['ho'] = 'off'; + $page = wl( (isset($targetpage) ? $targetpage : 'news:newsdata') ); + + // load raw news file (e.g. news:newsdata.txt) + $av = 0; + $oldrecord = rawWiki($targetpage); + + // split the news articles + $newsitems = explode("======",$oldrecord); + $info = array(); + + // get the headline level from config + $yh_level = $this->getConf('yh_level'); + $mh_level = $this->getConf('mh_level'); + $h_level = $this->getConf('h_level'); + + // 1. read news file (e.g. news:newsdata.txt) + foreach($newsitems as $article) { + // split news block into line items + $article_array = explode("\n * ",$article); + unset($article_array[0]); + + // 2. create output + // split line items into key and data + $aFlag = false; // flag: start date value exists and start is not in future + + foreach ($article_array as $item) { + list($key, $value) = split(":",trim($item),2); + $tag_flag = false; + if($key=='anchor') { + $anchor = trim($value); + } + elseif(($key=='start') && strtotime(trim($value)) < time()) { + $value = date($this->getConf('d_format'), strtotime($value)); + $news_date = '<span class="news_date_a"> ('. $value; + // get month and year to compare with $archive_options['date'] + if(isset($archive_options['date']) && ($archive_options['date'] !== date('m.Y',strtotime($value)))) break; + $aFlag = true; + } + // head has to be before the link in the template ! + elseif($key=='head'){ + $news_head = trim($value); + } + elseif($key=='subtitle'){ + $news_subtitle = '<br /><span class="news_subtitle">'.trim($value).'</span>'.NL; + } + elseif($key=='link'){ + $news_head = '<a href="'.$value.'" id="'.$value.'" name="'.$value.'">'. trim($news_head) .'</a>'.NL; + } + elseif($key=='author'){ + $news_date .= ', '. $value; + } + elseif(($key=='tags') && (isset($archive_options['tag']) !== false)) { +// echo $value.'<br />'; + $tags = explode(',',$value); + foreach($tags as $tag) { + if(($tag!==false) && (stripos($archive_options['tag'],trim($tag))!==false)){ + $tag_flag = true; + break; + } + } + } + } + + $news_date .= ')</span>'.NL; + + if((isset($archive_options['tag']) === false) || (strlen($archive_options['tag']) <2)) $tag_flag = true; + + if (($aFlag === true) && ($tag_flag === true)) { + //stop adding older news articles if quantity is reached +// echo intval($archive_options['qty']).' >= '.$qty.'<br>'; + $qty++; + if(($qty > intval($archive_options['qty'])) && ($archive_options['qty']!=='all')) break; + + // list all news stories as headline linked to the story itself + $elt = explode(",",$news_date); + $elt[0] = trim(strip_tags(str_replace('(','',$elt[0]))); + $elt[0] = date('F,Y',strtotime($elt[0])); + list($new_month,$new_year) = explode(',',$elt[0]); + + // idea is that all stories are created one after the other + // and the order within newsdata is according the start date + // manipulation of Start/Perishing date possible but not expected + // !!! There is no sort algorithm for year and month implemented !!! + // to do such would lead into re-development of the plugin + if(($old_year !== $new_year) && (($archive_options['class']==='page') || ($archive_options['ho']==='off'))) { + if(trim($old_year) !== '') $close_ytag = "</li></ul>".NL; + $output .= $close_ytag.'<ul><li class="level1"><div class="li">'.$new_year.'</div><ul class="n_box">'; + $old_year = $new_year; + } + + if(($old_month !== $new_month) && (($archive_options['class']==='page') || ($archive_options['ho']==='off'))) { + if(trim($old_month) !== '') $close_mtag = "</li></ul>".NL; + $output .= $close_mtag.'<ul><li class="level2"><div class="li">'.$new_month.'</div>'; + $old_month = $new_month; + } + + if($archive_options['ho']==='on') $news_date=''; + else $news_date .= '<br />'; + + if(($archive_options['tag']!==false) && ($archive_options['tag']!=='off') && ($archive_options['class']=='page')) $output .= '<div class="archive_item">'.trim($news_date).$news_head.$news_subtitle.'</div>'.NL; + else $output .= '<ul><li class="level3"><div class="li">'.trim($news_date).$news_head.'</div></li></ul>'.NL; + + $close_ytag = ""; + $close_mtag = ""; + $anchor = ""; + $news_date = ""; + $news_head = ""; + $news_subtitle = ""; + $tags = ""; + } + } + $blink_id = "news_items"; + $img_ID = "img_archive__toc"; + + $archive_lnkTitle = $this->getConf('lnk_newsarchive'); + if($archive_lnkTitle=='') $archive_lnkTitle = "News Archive"; + + $backlink = '<a href="javascript:history.back(-1)">'.$this->getLang('lnk_back').'</a>'; + $backlink .= '<span class="anss_sep"> | </span> + <a href="'.DOKU_URL.'doku.php?id='.$this->getConf('news_output').'">'.$this->getLang('allnews').' »</a>'; + $output = '<script type="text/javascript" src="backlink.js"></script>'.NL. + '<SCRIPT TYPE="text/javascript"> + <!-- + var gb = new backlink(); + gb.write(); + //--> + </SCRIPT> + <div class="backlinkDiv" style="font-size:.85em;">'.$backlink.'</div><br />'.NL. + '<div class="archive_section" id="news_archive_head" style="'.$archive_options['style'].'"> + <div id="news_items"> + '.$output.' + </div> + </div>'.NL. + '<div class="backlinkDiv" style="font-size:.85em;">'.$backlink.'</div><br />'.NL; + + echo $output; + $event->preventDefault(); + } +/******************************************************************************/ +} \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/backlink.js b/public_html/lib/plugins/anewssystem/backlink.js new file mode 100644 index 0000000..6391a2e --- /dev/null +++ b/public_html/lib/plugins/anewssystem/backlink.js @@ -0,0 +1,42 @@ +// Copyright 2001 Idocs.com +// Distribute this script freely, but keep this notice in place + +// backlink object initializer +function backlink() { + this.text = 'Go Back'; + this.type = 'link'; + this.write = backlink_write; + this.form = true; +} + + +// write method +function backlink_write() { + if (! window.history) return; + if (window.history.length == 0)return; + + this.type = this.type.toLowerCase(); + if (this.type == 'button') { + if (this.form) + document.write('<FORM>'); + document.write('<INPUT TYPE=BUTTON onClick="history.back(-1)" VALUE="', this.text, '"'); + if (this.otheratts) document.write(' ', this.otheratts); + document.write('>'); + if (this.form)document.write('<\/FORM>'); + } else { + document.write('<A HREF="javascript:history.back(-1)"'); + if (this.otheratts) + document.write(' ', this.otheratts); + document.write('>'); + if (this.type == 'image' || this.type == 'img') { + document.write('<IMG SRC="', this.src, '" ALT="', this.text, '"'); + if (this.width) document.write(' WIDTH=', this.width); + if (this.height) document.write(' HEIGHT=', this.height); + if (this.otherimgatts) document.write(' ', this.otherimgatts); + document.write(' BORDER=0>'); + } + else + document.write(this.text); + document.write('<\/A>'); + } +} diff --git a/public_html/lib/plugins/anewssystem/conf/default.php b/public_html/lib/plugins/anewssystem/conf/default.php new file mode 100644 index 0000000..dbd14a1 --- /dev/null +++ b/public_html/lib/plugins/anewssystem/conf/default.php @@ -0,0 +1,23 @@ +<?php +/** + * Options for the anewssystem plugin + */ + +$conf['d_format'] = 'd. M Y'; +$conf['news_datafile'] = 'news:newsdata'; +$conf['news_output'] = 'news:allnewsdata'; +$conf['prev_length'] = '500'; +$conf['newsflash_link'] = 1; +$conf['hide_anchorID'] = 1; +$conf['soapp'] = 0; // soapp = show one article per page (instead of all news) +$conf['yh_level'] = 2; // headline level for year clusetr of All News articles +$conf['mh_level'] = 3; // headline level for month clusetr of All News articles +$conf['h_level'] = 4; // headline level for All News articles itself +$conf['lnk_newsarchive'] = 'News Archive »'; // text for archive link +$conf['act_delim'] = '&'; // newer templates / dw-version seem to use questionmark instead of ampersand at action links +$conf['convert'] = 'http://fadeout.de/thumbshot-pro/?scale=3&url=%s&effect=2'; //the online service, which converts the linked page into a preview picture +// http://www.thumbshots.de/cgi-bin/show.cgi?url=%s +// http://images.websnapr.com/?size=s&nocache=81&url=%s +// http://www.artviper.net/screenshots/screener.php?sdx=1024&sdy=768&w=120&h=80&q=100&url=%s +// http://image.thumber.de/?size=XXL&url=%s +// http://fadeout.de/thumbshot-pro/?scale=3&url=%s&effect=2 \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/conf/metadata.php b/public_html/lib/plugins/anewssystem/conf/metadata.php new file mode 100644 index 0000000..ab1daef --- /dev/null +++ b/public_html/lib/plugins/anewssystem/conf/metadata.php @@ -0,0 +1,21 @@ +<?php +/** + * Metadata for configuration manager plugin + * Additions for the anewssystem plugin + * + * @author tag...@t-online.de + */ + +$meta['d_format'] = array('string'); +$meta['news_datafile'] = array('string'); +$meta['news_output'] = array('string'); +$meta['prev_length'] = array('string'); +$meta['newsflash_link'] = array('onoff'); +$meta['hide_anchorID'] = array('onoff'); +$meta['soapp'] = array('onoff'); // soapp = show one article per page (instead of all news) +$meta['yh_level'] = array('string'); // headline level for year clusetr of All News articles +$meta['mh_level'] = array('string'); // headline level for month clusetr of All News articles +$meta['h_level'] = array('string'); // headline level for All News articles +$meta['lnk_newsarchive']= array('string'); // text for archive link +$meta['act_delim'] = array('string'); // newer templates / dw-version seem to use questionmark instead of ampersand at action links +$meta['convert'] = array('string'); \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/dropdowncontent.js b/public_html/lib/plugins/anewssystem/dropdowncontent.js new file mode 100644 index 0000000..bf1d59a --- /dev/null +++ b/public_html/lib/plugins/anewssystem/dropdowncontent.js @@ -0,0 +1,137 @@ +//Drop Down/ Overlapping Content: http://www.dynamicdrive.com +//**Updated: Dec 19th, 07': Added ability to dynamically populate a Drop Down content using an external file (Ajax feature) +//**Updated: Feb 29th, 08': + //1) Added ability to reveal drop down content via "click" of anchor link (instead of default "mouseover") + //2) Added ability to disable drop down content from auto hiding when mouse rolls out of it + //3) Added hidediv(id) public function to directly hide drop down div dynamically + +//**Updated: Sept 11th, 08': Fixed bug whereby drop down content isn't revealed onClick of anchor in Safari/ Google Chrome +//**Updated: April 9th, 10': Minor change + +var dropdowncontent={ + disableanchorlink: true, //when user clicks on anchor link, should link itself be disabled (always true if "revealbehavior" above set to "click") + hidedivmouseout: [true, 200], //Set hiding behavior within Drop Down DIV itself: [hide_div_onmouseover?, miliseconds_before_hiding] + ajaxloadingmsg: "Loading content. Please wait...", //HTML to show while ajax page is being feched, if applicable + ajaxbustcache: true, //Bust cache when fetching Ajax pages? + + getposOffset:function(what, offsettype){ + return (what.offsetParent)? what[offsettype]+this.getposOffset(what.offsetParent, offsettype) : what[offsettype] + }, + + isContained:function(m, e){ + var e=window.event || e + var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement) + while (c && c!=m)try {c=c.parentNode} catch(e){c=m} + if (c==m) + return true + else + return false + }, + + show:function(anchorobj, subobj, e){ + if (!this.isContained(anchorobj, e) || (e && e.type=="click")){ + var e=window.event || e + if (e.type=="click" && subobj.style.visibility=="visible"){ + subobj.style.visibility="hidden" + return + } + var horizontaloffset=(subobj.dropposition[0]=="left")? -(subobj.offsetWidth-anchorobj.offsetWidth) : 0 //calculate user added horizontal offset + var verticaloffset=(subobj.dropposition[1]=="top")? -subobj.offsetHeight : anchorobj.offsetHeight //calculate user added vertical offset + subobj.style.left=this.getposOffset(anchorobj, "offsetLeft") + horizontaloffset + "px" + subobj.style.top=this.getposOffset(anchorobj, "offsetTop")+verticaloffset+"px" + subobj.style.clip=(subobj.dropposition[1]=="top")? "rect(auto auto auto 0)" : "rect(0 auto 0 0)" //hide drop down box initially via clipping + subobj.style.visibility="visible" + subobj.startTime=new Date().getTime() + subobj.contentheight=parseInt(subobj.offsetHeight) + if (typeof window["hidetimer_"+subobj.id]!="undefined") //clear timer that hides drop down box? + clearTimeout(window["hidetimer_"+subobj.id]) + this.slideengine(subobj, (subobj.dropposition[1]=="top")? "up" : "down") + } + }, + + curveincrement:function(percent){ + return (1-Math.cos(percent*Math.PI)) / 2 //return cos curve based value from a percentage input + }, + + slideengine:function(obj, direction){ + var elapsed=new Date().getTime()-obj.startTime //get time animation has run + if (elapsed<obj.glidetime){ //if time run is less than specified length + var distancepercent=(direction=="down")? this.curveincrement(elapsed/obj.glidetime) : 1-this.curveincrement(elapsed/obj.glidetime) + var currentclip=(distancepercent*obj.contentheight)+"px" + obj.style.clip=(direction=="down")? "rect(0 auto "+currentclip+" 0)" : "rect("+currentclip+" auto auto 0)" + window["glidetimer_"+obj.id]=setTimeout(function(){dropdowncontent.slideengine(obj, direction)}, 10) + } + else{ //if animation finished + obj.style.clip="rect(0 auto auto 0)" + } + }, + + hide:function(activeobj, subobj, e){ + if (!dropdowncontent.isContained(activeobj, e)){ + window["hidetimer_"+subobj.id]=setTimeout(function(){ + subobj.style.visibility="hidden" + subobj.style.left=subobj.style.top=0 + clearTimeout(window["glidetimer_"+subobj.id]) + }, dropdowncontent.hidedivmouseout[1]) + } + }, + + hidediv:function(subobjid){ + document.getElementById(subobjid).style.visibility="hidden" + }, + + ajaxconnect:function(pageurl, divId){ + var page_request = false + var bustcacheparameter="" + if (window.XMLHttpRequest) // if Mozilla, IE7, Safari etc + page_request = new XMLHttpRequest() + else if (window.ActiveXObject){ // if IE6 or below + try { + page_request = new ActiveXObject("Msxml2.XMLHTTP") + } + catch (e){ + try{ + page_request = new ActiveXObject("Microsoft.XMLHTTP") + } + catch (e){} + } + } + else + return false + document.getElementById(divId).innerHTML=this.ajaxloadingmsg //Display "fetching page message" + page_request.onreadystatechange=function(){dropdowncontent.loadpage(page_request, divId)} + if (this.ajaxbustcache) //if bust caching of external page + bustcacheparameter=(pageurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime() + page_request.open('GET', pageurl+bustcacheparameter, true) + page_request.send(null) + }, + + loadpage:function(page_request, divId){ + if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){ + document.getElementById(divId).innerHTML=page_request.responseText + } + }, + + init:function(anchorid, pos, glidetime, revealbehavior){ + var anchorobj=document.getElementById(anchorid) + if (anchorobj) + var subobj=document.getElementById(anchorobj.getAttribute("rel")) + if (!anchorobj || !subobj) + return + var subobjsource=anchorobj.getAttribute("rev") + if (subobjsource!=null && subobjsource!="") + this.ajaxconnect(subobjsource, anchorobj.getAttribute("rel")) + subobj.dropposition=pos.split("-") + subobj.glidetime=glidetime || 1000 + subobj.style.left=subobj.style.top=0 + if (typeof revealbehavior=="undefined" || revealbehavior=="mouseover"){ + anchorobj.onmouseover=function(e){dropdowncontent.show(this, subobj, e)} + anchorobj.onmouseout=function(e){dropdowncontent.hide(subobj, subobj, e)} + if (this.disableanchorlink) anchorobj.onclick=function(){return false} + } + else + anchorobj.onclick=function(e){dropdowncontent.show(this, subobj, e); return false} + if (this.hidedivmouseout[0]==true) //hide drop down DIV when mouse rolls out of it? + subobj.onmouseout=function(e){dropdowncontent.hide(this, subobj, e)} + } +} \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/images/bullet.png b/public_html/lib/plugins/anewssystem/images/bullet.png new file mode 100644 index 0000000..117e03c Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/bullet.png differ diff --git a/public_html/lib/plugins/anewssystem/images/delete.gif b/public_html/lib/plugins/anewssystem/images/delete.gif new file mode 100644 index 0000000..72e93ba Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/delete.gif differ diff --git a/public_html/lib/plugins/anewssystem/images/delete_hov.gif b/public_html/lib/plugins/anewssystem/images/delete_hov.gif new file mode 100644 index 0000000..273705c Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/delete_hov.gif differ diff --git a/public_html/lib/plugins/anewssystem/images/dot.gif b/public_html/lib/plugins/anewssystem/images/dot.gif new file mode 100644 index 0000000..9cd97c2 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/dot.gif differ diff --git a/public_html/lib/plugins/anewssystem/images/dot2.gif b/public_html/lib/plugins/anewssystem/images/dot2.gif new file mode 100644 index 0000000..313e9db Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/dot2.gif differ diff --git a/public_html/lib/plugins/anewssystem/images/edit.gif b/public_html/lib/plugins/anewssystem/images/edit.gif new file mode 100644 index 0000000..27bf217 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/edit.gif differ diff --git a/public_html/lib/plugins/anewssystem/images/edit_hov.gif b/public_html/lib/plugins/anewssystem/images/edit_hov.gif new file mode 100644 index 0000000..09af1bc Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/edit_hov.gif differ diff --git a/public_html/lib/plugins/anewssystem/images/toc-arrows.png b/public_html/lib/plugins/anewssystem/images/toc-arrows.png new file mode 100644 index 0000000..4a353e4 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toc-arrows.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toc-bullet.png b/public_html/lib/plugins/anewssystem/images/toc-bullet.png new file mode 100644 index 0000000..fc771b9 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toc-bullet.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/bold.png b/public_html/lib/plugins/anewssystem/images/toolbar/bold.png new file mode 100644 index 0000000..51ddb88 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/bold.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/code.png b/public_html/lib/plugins/anewssystem/images/toolbar/code.png new file mode 100644 index 0000000..019bae2 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/code.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/enlarge.png b/public_html/lib/plugins/anewssystem/images/toolbar/enlarge.png new file mode 100644 index 0000000..39cd084 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/enlarge.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/h1.png b/public_html/lib/plugins/anewssystem/images/toolbar/h1.png new file mode 100644 index 0000000..85bd06e Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/h1.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/h2.png b/public_html/lib/plugins/anewssystem/images/toolbar/h2.png new file mode 100644 index 0000000..be2c600 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/h2.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/h3.png b/public_html/lib/plugins/anewssystem/images/toolbar/h3.png new file mode 100644 index 0000000..350da88 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/h3.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/h4.png b/public_html/lib/plugins/anewssystem/images/toolbar/h4.png new file mode 100644 index 0000000..bc1b703 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/h4.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/h5.png b/public_html/lib/plugins/anewssystem/images/toolbar/h5.png new file mode 100644 index 0000000..b6c263d Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/h5.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/hr.png b/public_html/lib/plugins/anewssystem/images/toolbar/hr.png new file mode 100644 index 0000000..de3a8a5 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/hr.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/italic.png b/public_html/lib/plugins/anewssystem/images/toolbar/italic.png new file mode 100644 index 0000000..d69e660 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/italic.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/link.png b/public_html/lib/plugins/anewssystem/images/toolbar/link.png new file mode 100644 index 0000000..01105b0 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/link.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/linkextern.png b/public_html/lib/plugins/anewssystem/images/toolbar/linkextern.png new file mode 100644 index 0000000..acc0c6f Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/linkextern.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/mono.png b/public_html/lib/plugins/anewssystem/images/toolbar/mono.png new file mode 100644 index 0000000..b91ad2e Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/mono.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/ol.png b/public_html/lib/plugins/anewssystem/images/toolbar/ol.png new file mode 100644 index 0000000..186f1fa Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/ol.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/reduce.png b/public_html/lib/plugins/anewssystem/images/toolbar/reduce.png new file mode 100644 index 0000000..0600a1d Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/reduce.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/strike.png b/public_html/lib/plugins/anewssystem/images/toolbar/strike.png new file mode 100644 index 0000000..e532d1f Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/strike.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/subscript.png b/public_html/lib/plugins/anewssystem/images/toolbar/subscript.png new file mode 100644 index 0000000..0cb85ae Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/subscript.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/superscript.png b/public_html/lib/plugins/anewssystem/images/toolbar/superscript.png new file mode 100644 index 0000000..71bbfed Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/superscript.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/ul.png b/public_html/lib/plugins/anewssystem/images/toolbar/ul.png new file mode 100644 index 0000000..0088207 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/ul.png differ diff --git a/public_html/lib/plugins/anewssystem/images/toolbar/underline.png b/public_html/lib/plugins/anewssystem/images/toolbar/underline.png new file mode 100644 index 0000000..fa27151 Binary files /dev/null and b/public_html/lib/plugins/anewssystem/images/toolbar/underline.png differ diff --git a/public_html/lib/plugins/anewssystem/lang/de/lang.php b/public_html/lib/plugins/anewssystem/lang/de/lang.php new file mode 100644 index 0000000..0d3709c --- /dev/null +++ b/public_html/lib/plugins/anewssystem/lang/de/lang.php @@ -0,0 +1,33 @@ +<?php +/** + * Deutsche Übersetzungen für anewssystem + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Taggic <tag...@t-online.de> + */ +/******************************************************************************/ +// anewssystem controls +$lang['anss_input_btn_save'] = 'Veröffentlichen'; +$lang['anss_input_btn_save_descr'] = 'Neuen Artikel hinzufügen'; + +/******************************************************************************/ +// anewssystem text +$lang['news_added'] = 'Ihr Artikel wurde erfolgreich gespeichert.'; +$lang['no_permission'] = 'Schreibzugriff verweigert. Sie haben keine Berechtigung, News-Artikel zu schreiben.'; + +/******************************************************************************/ +// template related text +$lang['anchordescr'] = 'Eindeutige ID, um den Artikel zu referenzieren'; +$lang['headdescr'] = 'Geben Sie eine aussagekräftige Überschrift an'; +$lang['linkdescr'] = 'Verknüpfung der Seite, worauf sich der News-Artikel bezieht'; +$lang['startdescr'] = 'Erscheinungstag des Artikels in der Neuigkeiten-Liste'; +$lang['stopdescr'] = 'Ab diesem Tag wird der Artikel nicht mehr in der Liste erscheinen'; +$lang['msgdescr'] = 'Schreiben Sie eine Zusammenfassung'; +$lang['authordescr'] = 'Autoren-Info, wird dargestellt neben dem Datum'; +$lang['tagdescr'] = 'Schlagworte optional, mehrere mit | auflisten'; +$lang['del_title'] = 'Diesen Artikel löschen'; +$lang['newsflash_title'] = 'NEWS flash'; +$lang['anss_edit_imgttl']= 'Editieren'; +$lang['lnk_back'] = '« zurück'; +$lang['allnews'] = 'alle News-Artikel'; +$lang['noNews'] = 'Keine aktuellen News-Artikel vorhanden'; diff --git a/public_html/lib/plugins/anewssystem/lang/de/settings.php b/public_html/lib/plugins/anewssystem/lang/de/settings.php new file mode 100644 index 0000000..01278f3 --- /dev/null +++ b/public_html/lib/plugins/anewssystem/lang/de/settings.php @@ -0,0 +1,21 @@ +<?php +/** + * English language file for anewssystem plugin + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author tag...@t-online.de + */ + +// for the configuration manager +$lang['d_format'] = 'Definition für das Datumsformat (e.g. Y-m-d)'; +$lang['news_datafile'] = 'Pfad zum Namensraum für die Datei newsdata'; +$lang['prev_length'] = 'Anzahl der in der Vorschau pro Artikel angezeigten Wörter im NewsFlash'; +$lang['newsflash_link'] = 'stelle Link zum Newsflash zur Verfügung'; +$lang['hide_anchorID'] = 'verstecke Anchor-ID'; +$lang['soapp'] = 'zeige nur einen Artikel pro Seite'; // soapp = show one article per page (instead of all news) +$lang['yh_level'] = 'Überschriftsebene für die Gruppierung aller News-Artikel pro Jahr'; +$lang['mh_level'] = 'Überschriftsebene für die Gruppierung aller News-Artikel pro Monat'; +$lang['h_level'] = 'Überschriftsebene für die News-Artikel selber'; +$lang['lnk_newsarchive']= 'Text für den Archiv-Link'; +$meta['act_delim'] = 'einige Templates / DW-Versionen benötigen ein "?" statt des "&" für Action-Links'; +$lang['convert'] = 'Link zu einem "thumbshots online service"'; \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/lang/en/lang.php b/public_html/lib/plugins/anewssystem/lang/en/lang.php new file mode 100644 index 0000000..cc40ff1 --- /dev/null +++ b/public_html/lib/plugins/anewssystem/lang/en/lang.php @@ -0,0 +1,33 @@ +<?php +/** + * English language file for anewssystem + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Taggic <tag...@t-online.de> + */ +/******************************************************************************/ +// anewssystem controls +$lang['anss_input_btn_save'] = 'Publish'; +$lang['anss_input_btn_save_descr'] = 'add the news article'; + +/******************************************************************************/ +// anewssystem text +$lang['news_added'] = 'Your article was stored successfully.'; +$lang['no_permission'] = 'Write access denied. You are not allowed to write news.'; + +/******************************************************************************/ +// template related text +$lang['anchordescr'] = 'unique id to reference the article'; +$lang['headdescr'] = 'give it an expressive headline'; +$lang['linkdescr'] = 'link the page where the news relate to'; +$lang['startdescr'] = 'first appearance of the article in the list'; +$lang['stopdescr'] = 'on this day the article will disappear'; +$lang['msgdescr'] = 'write a news summary'; +$lang['authordescr'] = 'author info, will be visible beside date info'; +$lang['tagdescr'] = 'as option for the syntax line, separate by pipe or blank if multiple'; +$lang['del_title'] = 'Delete this News record'; +$lang['newsflash_title'] = 'NEWS flash'; +$lang['anss_edit_imgttl']= 'Edit'; +$lang['lnk_back'] = '« back'; +$lang['allnews'] = 'all News'; +$lang['noNews'] = 'No current news'; diff --git a/public_html/lib/plugins/anewssystem/lang/en/settings.php b/public_html/lib/plugins/anewssystem/lang/en/settings.php new file mode 100644 index 0000000..1459bc3 --- /dev/null +++ b/public_html/lib/plugins/anewssystem/lang/en/settings.php @@ -0,0 +1,21 @@ +<?php +/** + * English language file for anewssystem plugin + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author tag...@t-online.de + */ + +// for the configuration manager +$lang['d_format'] = 'Define the date format (e.g. Y-m-d)'; +$lang['news_datafile'] = 'Set the path to the namespace:newsdata file'; +$lang['prev_length'] = 'Define the quantity of previewed words per news post in NewsFlash'; +$lang['newsflash_link'] = 'provide News flash link'; +$lang['hide_anchorID'] = 'hide Anchor ID'; +$lang['soapp'] = 'show only one article per page'; // soapp = show one article per page (instead of all news) +$lang['yh_level'] = 'headline level for year cluster of All News articles'; +$lang['mh_level'] = 'headline level for month cluster of All News articles'; +$lang['h_level'] = 'headline level for All News articles itself'; +$lang['lnk_newsarchive']= 'text for archive link'; +$meta['act_delim'] = 'some templates / dw-version use questionmark instead of ampersand at action links'; +$lang['convert'] = 'Link a thumbshots online service'; \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/lang/it/lang.php b/public_html/lib/plugins/anewssystem/lang/it/lang.php new file mode 100644 index 0000000..9a08dce --- /dev/null +++ b/public_html/lib/plugins/anewssystem/lang/it/lang.php @@ -0,0 +1,35 @@ +<?php +/** + * Italian language file for anewssystem + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Diego Pierotto <ita.translati...@tiscali.it> + */ +/******************************************************************************/ +// anewssystem controls +$lang['anss_input_btn_save'] = 'Pubblica'; +$lang['anss_input_btn_save_descr'] = 'Aggiungi nuova notizia'; + +/******************************************************************************/ +// anewssystem text +$lang['news_added'] = 'L\'articolo è stato salvato correttamente.'; +$lang['no_permission'] = 'Accesso negato. Non hai i permessi per scrivere le notizie.'; + +/******************************************************************************/ +// template related text +$lang['anchordescr'] = 'ID univoco per i riferimenti dell\'articolo'; +$lang['headdescr'] = 'Fornisci un titolo esplicativo'; +$lang['linkdescr'] = 'Collega la pagina alla quale la notizia si riferisce'; +$lang['startdescr'] = 'Prima apparizione dell\'articolo nella lista'; +$lang['stopdescr'] = 'Giorno in cui l\'articolo non sarà più visibile'; +$lang['msgdescr'] = 'Scrivi un sommario notizie'; +$lang['authordescr'] = 'Info autore, sarà visibile di fianco alla data'; +$lang['tagdescr'] = 'Opzione della riga di sintassi, separata da "pipe" o spazio se molteplici'; +$lang['del_title'] = 'Elimina questa notizia'; +$lang['newsflash_title'] = 'NOVITA\''; +$lang['anss_edit_imgttl']= 'Modifica'; +$lang['lnk_back'] = 'Indietro'; +$lang['allnews'] = 'Tutte le news'; +$lang['noNews'] = 'Nessuna news corso.'; +$lang['wordcount'] = ' (Parole: " + output + " di " + max + " )'; +$lang['wordcount2'] = ' (Parole: 0 di '; \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/lang/it/settings.php b/public_html/lib/plugins/anewssystem/lang/it/settings.php new file mode 100644 index 0000000..3d0d05f --- /dev/null +++ b/public_html/lib/plugins/anewssystem/lang/it/settings.php @@ -0,0 +1,17 @@ +<?php +/** + * Italian language file for anewssystem plugin + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Diego Pierotto <ita.translati...@tiscali.it> + */ + +// for the configuration manager +$lang['d_format'] = 'Definisci il formato data (es. Y-m-d)'; +$lang['news_datafile'] = 'Imposta il percorso del file namespace:newsdata'; +$lang['prev_length'] = 'Definisci la quantità di parole disponibili per la notizia'; +$lang['newsflash_link'] = 'Crea collegamento NOVITA\''; +$lang['hide_anchorID'] = 'Nascondi ID collegamento'; +$lang['h_level'] = 'Livello di titolo '; +$lang['soapp'] = 'Visualizzare solo un elemento, invece di tutti (-> tutte le news)'; +$lang['convert'] = 'Collegare un servizio on-line Thumbshots'; \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/plugin.info.txt b/public_html/lib/plugins/anewssystem/plugin.info.txt new file mode 100644 index 0000000..2543bad --- /dev/null +++ b/public_html/lib/plugins/anewssystem/plugin.info.txt @@ -0,0 +1,9 @@ +# PLUGIN INFO - DO NOT EDIT! + +base anewssystem +author Taggic +email tag...@t-online.de +date 2015-02-11 +name anewssystem +desc provides an easy to handle, page based news system +url http://www.dokuwiki.org/plugin:anewssystem diff --git a/public_html/lib/plugins/anewssystem/style.css b/public_html/lib/plugins/anewssystem/style.css new file mode 100644 index 0000000..4d5376a --- /dev/null +++ b/public_html/lib/plugins/anewssystem/style.css @@ -0,0 +1,353 @@ + +li.newslist { + padding-bottom: 1ex; + font-size: 0.85em; + color: #828282; +} + +.news_preview { + font-size: 0.95em; + line-height: 115%; + color: #828282; + margin: 0; + padding: 0; +} + +.newsdate { + font-size: 90%; + color: #9E9E9E; +} + +/* --- news input style --- */ + .news_form_div { + border: 1px dotted #828282; + background: #EEEDFF; + width: 600px; + padding: 8px 6px 0 8px; + border-radius: 4px; + box-shadow: 2px 2px 4px #6B6B6B; + } + + .news_input_form {} + + .anss_input_btn_save { + width: 523px; + margin-bottom: 6px; + text-align: center; + } + + .news_input_head { + margin-left: 45px; + } + + .news_input_subtitle { + margin-left: 45px; + } + + .news_input_link { + margin-left: 23px; + } + + .news_input_start { + margin-left: 3px; + } + + .news_input_stop { + margin-left: 10px; + } + + .news_input_textarea { + width: 100%; + } + + .news_input_author { + margin-left: 60px; + } + + .news_input_tags { + margin-left: 75px; + } + + .nws_charcount { + font-style: italic; + font-size: 0.75em; + color: #828282; + } + + .news_input_anchor { + margin-left: 63px; + } + + .news_edittoolbar{ + height: 22px; + } + .newsedit_button{ + margin: 2px; + + } + .newsedit_button:hover { + border: 1px solid #3EC0F0; + margin-top: 1px; + margin-left: 1px; + margin-right: 1px; + border-radius: 2px; + box-shadow: 1px 1px 1px #38ADD8; + } + +/* --- news preview style --- */ + .news_box { + border: 1px solid #D3D3D3; + background: #EEEDFF; + margin: -48px -2% 3px 16px; + padding: 0; + position: static; + border-radius: 4px; + box-shadow: 2px 2px 4px #6B6B6B; + } + + .news_header { + background-color: #AF2A2A; + color: #FFFFFF; + text-decoration: underline; + font-style: italic; + font-weight: bold; + height: 24px; + border-radius: 4px 4px 0 0; + margin: 0; + padding-left: 1em; + } + + .news_header_link { + margin-bottom: 6px; + margin-left: 9px; + font-weight: bold; + font-style: italic; + text-align: left; + text-decoration: underline !important; + color: #FFFFFF !important; + } + + .prev_newsitem { + border-bottom: 1px dotted #D3D3D3; + padding-bottom: 6px; + margin-bottom: 6px; + margin-left: 9px; + } + + .news_link { + font-size: 9pt; + color: #5244D9 !important; + font-weight: normal; + font-style: italic; + line-height: 1.6em !important; + } + + .news_preview { + font-size: 8pt !important; + font-weight: normal; + font-style: italic; + line-height: 1.4em !important; + color: #404040; + margin: 0; + margin-bottom: 4px; + padding: 0; + } + + .news_date { + font-size: 70%; + font-style: italic; + color: #828282 !important; + float: right; + margin-left: 1em; + } + + .news_date_a { + font-size: 70%; + font-style: italic !important; + color: #828282 !important; + } + + .news_subcontent { + position: absolute; + visibility: hidden; + width: 308px; + height: 254px; + padding: 8px; + border-radius: 4px; + background-color: #ffffff; + border: 1px solid black; + } + + .news_subcontent_pic { + width: 300px; + height: 246px; + margin-left: auto; + margin-right: auto; + } + + + /*-------------------------------------------------------*/ + .allnews_list li { + list-style-type: none; + margin-left: -20px; + } + + .allnews_head { + font-size: 13pt; + text-decoration: underline !important; + color: #686868 !important; + } + + .allnews_date{ + font-size: 80%; + font-style: italic; + color: #828282 !important; + } + + .allnews_list hr { + margin-left: -35px; + } + + .allnews_link { + font-size: 11pt; + color: #5244D9 !important; + font-weight: bold; + font-style: italic; + } + + .all_news_article{ + font-size: 10pt !important; + font-weight: normal; + font-style: normal; + color: #686868; + margin-bottom: 10px; + } + .anss_del_img { + border: 0; + background-color: transparent; + background-image:url(images/delete.gif); + margin-top: -10px ; + margin-right: -6px ; + margin-left: 10px ; + float: right; + } + + .anss_del_img:hover { + border: 0; + background-color: transparent; + background-image:url(images/delete_hov.gif) !important; + margin-top: -10px ; + margin-right: -6px ; + margin-left: 10px ; + float: right; + } + .anss_edit_img { + border: 0; + background-color: transparent; + background-image:url(images/edit.gif); + margin-top: -10px ; + margin-right: -6px ; + margin-left: 20px ; + float: right; + background-color: transparent; + } + + .anss_edit_img:hover { + border: 0; + background-color: transparent; + background-image:url(images/edit_hov.gif) !important; + margin-top: -10px ; + margin-right: -6px ; + margin-left: 20px ; + float: right; + } + + .anss_sep { + color: #D8D8D8 !important; + } + .newsclouddiv { margin: 0.5em 1em 0.5em 1em; line-height: 145%; } + .newsclouddiv a { padding: 0; margin: 0 0.5em; } + + .newsclouddiv1 { + border: 1px solid #999999; + margin: 0.5em 1em 0.5em 1em; + padding: 0.5em; + line-height: 145%; + border-radius: 4px; + box-shadow: 2px 2px 4px #6B6B6B; + } + .newsclouddiv1 a { padding: 0; margin: 0; } + + .newscloud1 { font-size: 10px; color: #D3E0F5; } + .newscloud2 { font-size: 12px; color: #AEC4E5; } + .newscloud3 { font-size: 14px; color: #88A9DB; } + .newscloud4 { font-size: 16px; color: #4A7AC2; } + .newscloud5 { font-size: 18px; color: #003F9E; } + +/*____________ NEWS Archive style-class = toc ________________________________*/ + #archive__toc { + background-color: transparent; + float: right; + margin: 0 0 1.4em 1.4em; + width: 20em; + border-left: 1px solid #C3C3C3; + color: inherit; + } + + #archive__toc_hr { clor: black; margin: 0; } + + #archive__toc h3.toggle { + font-size: 0.875em; + letter-spacing: 0.1em; + margin-bottom: 0; + padding: 0.5em 1em; + font-weight: bold; + } + + #archive__toc .toggle strong { + float: right; + margin: 0 .2em; + background: url("images/toc-arrows.png") repeat scroll 0 0 transparent; + height: 5px; + margin: 0.4em 0 0; + width: 8px; + } + + #archive__toc div, #archive__box div { padding: 0em 1.5em; } + #archive__box div { padding-top: 0em; padding-bottom: 0.5em; } + + #archive__toc ul, #archive__box ul { + padding: 0; + margin: 0; + font-size: .95em; + } + + #archive__toc ul li, ul.n_box li { + padding-bottom: .75em; + margin: 0; + list-style-image: url("images/toc-bullet.png"); + } + + .archive_box .level3 { + padding-bottom: 0!important; + } + + #archive__toc ul li div.li, #archive__box ul li div.li { padding: .15em 0; } + #archive__toc ul ul, #archive__box ul ul { padding-left: 1em; } + + .news_subtitle { + font-size: 80%; + font-style: italic; + color: #828282; + } + + .archive_item { + margin-top: 0; + margin-bottom: 5px; + } + + div.backlinkDiv { + background: #EEEDFF; + border-radius: 4px; + padding: 0.25em 0 0.25em 1em; + } \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/syntax.php b/public_html/lib/plugins/anewssystem/syntax.php new file mode 100644 index 0000000..689125a --- /dev/null +++ b/public_html/lib/plugins/anewssystem/syntax.php @@ -0,0 +1,1187 @@ +<?php + +/** + * Plugin anewssystem: provides an easy to handle, page based news system + * + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @author Taggic <tag...@t-online.de> + */ + +if (!defined('DOKU_LF')) define('DOKU_LF', "\n"); +if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t"); +if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +if(!defined('DOKU_DATA')) define('DOKU_DATA',DOKU_INC.'data/pages/'); +require_once(DOKU_PLUGIN.'syntax.php'); +require_once(DOKU_INC.'inc/parser/xhtml.php'); +require_once(DOKU_INC.'inc/auth.php'); + +/** + * All DokuWiki plugins to extend the parser/rendering mechanism + * need to inherit from this class + */ +class syntax_plugin_anewssystem extends DokuWiki_Syntax_Plugin { + +/******************************************************************************/ +/* return some info +*/ + function getInfo(){ + return confToHash(dirname(__FILE__).'/plugin.info.txt'); + } + + function getType(){ return 'substition';} + function getPType(){ return 'block';} + function getSort(){ return 167;} + +/******************************************************************************/ +/* Connect pattern to lexer +*/ + function connectTo($mode){ + $this->Lexer->addSpecialPattern('\{\{anss>[^}]*\}\}',$mode,'plugin_anewssystem'); + } + +/******************************************************************************/ +/* handle the match +*/ + function handle($match, $state, $pos, &$handler) { + global $ID, $conf; + $match = substr($match,strlen('{{anss>'),-2); //strip markup from start and end + + //handle params + $data = array(); + /******************************************************************************/ + /* parameter 1 can be one of the following: xs-author, flash + /******************************************************************************/ + + $params = $match; // if you will have more parameters and choose ',' to delim them + + //Default Value + $ans_conf = array(); + $ans_conf['newsroot'] = 'news'; + $ans_conf['newspage'] = 'newsdata'; + $ans_conf['newstemplate'] = DOKU_PLUGIN.'anewssystem/tpl/newstemplate_'.$conf['lang'].'.txt'; + $ans_conf['param'] = $params; + + if (!$params) { + msg('Syntax of anewssystem detected but unknown parameter was attached.', -1); + } + else { return $ans_conf;} + } +/******************************************************************************/ +/* render output +* @author Taggic <tag...@t-online.de> +*/ + function render($mode, &$renderer, $ans_conf) { + global $ID, $conf; + $xhtml_renderer = new Doku_Renderer_xhtml(); + $records = file(DOKU_PLUGIN.'anewssystem/tpl/newstemplate_'.$conf['lang'].'.txt'); + unset($records[0]); + $target = $this->getConf('news_datafile'); + $targetpage = htmlspecialchars(trim($target)); + $prefix = 'anss'; + $del = 'anss_del'; + $cut_prefx = 'news_input_'; + $allnewsdata1 = $this->getConf('news_output'); + $allnewsdata = wl( (isset($allnewsdata1) ? $allnewsdata1 : 'news:newsdata') ); + $i = strripos($allnewsdata, ":"); + $news_root = substr($allnewsdata, 0, $i); + // check if user has write permission on that ID + $current_usr = pageinfo(); + // necessary for the back link of a show one article per page (SOAPP) + if(stripos($_GET['archive'],'archive')!== false) $ans_conf['param'] = $_GET['archive']; + $_GET['archive']=""; + + // 1. read template (plugins/anewssystem/template.php) + $template = file_get_contents(DOKU_PLUGIN.'anewssystem/tpl/newstemplate.txt'); + /*------- add news action part -----------------------------------------*/ + $post_prefix = $_POST["xs-".$prefix]; + $delete_record = $_POST["anss_del_record"]; + $delete_anchor = $_POST["anss_del_anchor"]; +// msg($delete_record." = |".$delete_anchor.'|',0); + + if(!isset($delete_anchor)) $delete_anchor = $delete_record; // if anchor field was deleted on input + + + if( (strlen($post_prefix)>2) && (auth_quickaclcheck($targetpage) >= AUTH_EDIT) ) { + // this will be called to store the news article to the others + $id_count = 1; + foreach( $_POST as $postkey => $postvalue ) { + if( strpos($postkey, "news_input_") === 0 ) { + $key = substr($postkey, strlen($cut_prefx)); + $key = trim($key); + if( strpos(trim($postvalue), "\n") !== false ) { + // this is a multilined value, so we need to prepend a linebreak + // to achieve a multilined value for the template plugin + $postvalue = "\n" . $postvalue; + $postvalue = str_replace(chr(13),"",$postvalue); + } +// if( strpos(trim($postvalue), "\n\n") !== false ) $postvalue = str_replace('\n\n','\n',$postvalue); + if(strpos('anchor',$key)>0) { + $postvalue ='<a href="'.$postvalue.'">'.$postvalue.'</a>'; + } + $newrecord .= " * " . $key . ": " . $postvalue . "\n"; + } + } + + $newrecord = '====== '.$_POST['news_input_head'].' ======'.chr(10).chr(10).$newrecord.chr(10); + $oldrecord = rawWiki($targetpage); + + saveWikiText($targetpage, $newrecord.$oldrecord, "New entry", true); + $_POST["xs-".$prefix] = ''; + msg($this->getLang('news_added'),1); + } + elseif( (strlen($post_prefix)>2) && (auth_quickaclcheck($targetpage) < AUTH_EDIT) ) { + msg($this->getLang('no_permission'),-1); + } + /*------- delete a news record -----------------------------------------*/ + elseif( (strlen($delete_record)>2) && (auth_quickaclcheck($targetpage) >= AUTH_EDIT) ) { + $raw_records = rawWiki($targetpage); + $news_record = explode("====== ",$raw_records); + foreach($news_record as $record) { + + if((stripos($record, $delete_record)!==false) && (stripos($record, $delete_anchor)!==false)) { + // inform user +// msg("Delete: $record = ".$delete_record,0); +// msg("Anchor: $record = ".$delete_anchor,0); + msg('News Article deleted.',1); + } + else { if(strlen($record)>1) $news_records.= "====== ".$record;} + } + // write file + saveWikiText($targetpage, $news_records, "New entry", true); + } + /*------- show user form -----------------------------------------------*/ + // this will provide the user form to add further news + // 2. create input form based on template + if ($ans_conf['param']==='author') { + + $output .= '<span><script type="text/javascript"> + function count_chars(obj, max) { + var data = obj.value; + var extract = data.split(" "); + var bextract = data.split("\n"); + var cextract = extract.length + bextract.length -1; + if(cextract>max) output = \'<span style="color:red;">\' + cextract + \'</span>\'; + else output = cextract; + document.getElementById("nws_charcount").innerHTML = "'.$this->getLang('wordcount').'" + } + + function resizeBoxId(obj,size) { + var arows = document.getElementById(obj).rows; + document.getElementById(obj).rows = arows + size; + } + </script></span>'; + + $output .= '<div class="news_form_div"> + <form class="news_input_form" id="'.$prefix.'" + method="POST" + >'.NL; + + $output .= '<input type="hidden" name="xs-'.$prefix.'" value="check" />'.NL; + + foreach ($records as $record) { + $fields = explode('|',$record); + if (trim($fields[1]) == "textarea") { + $output .= '<p>'.trim($fields[4]); + $output .= '<label class="nws_charcount" + id="nws_charcount" + name="nws_charcount">'.$this->getLang('wordcount2').$this->getConf('prev_length').' )</label><br />'; + + $output .= $this->news_edit_toolbar('news_input_'.trim($fields[0])); + + $imgBASE = DOKU_BASE."lib/plugins/anewssystem/images/toolbar/"; + $output .= '<textarea class="news_input_textarea"'. + ' id="news_input_'.trim($fields[0]).'"'. + ' name="news_input_'.trim($fields[0]).'"'. + ' title="'.trim($this->getLang(trim($fields[5]))).'" '.trim($fields[2]).'"'. + ' onkeyup="count_chars(this,'.$this->getConf('prev_length').')" >'. + '</textarea> + <span class="reply_close_link"> + <a href="javascript:resizeBoxId(\'news_input_'.trim($fields[0]).'\', -20)"><img src="'.$imgBASE.'reduce.png" title="reduce textarea" style="float:right;" /></a> + <a href="javascript:resizeBoxId(\'news_input_'.trim($fields[0]).'\', +20)"><img src="'.$imgBASE.'enlarge.png" title="enlarge textarea" style="float:right;" /></a> + </span></p>'.NL; + } + else if (trim($fields[0]) == "anchor") { + + $default_anker = date("YmdHis"); + if($this->getConf('soapp')>0) $link_anker = $this->getConf('act_delim').'anchor='.$default_anker; // to show only one article only on a page + else $link_anker = '#'.$default_anker; // to show all news at one page but scroll to the anchor position + $default_anker = '#'.$default_anker; + + if((stripos($fields[1],'hidden') === false) && ($this->getConf('hide_anchorID')< 1)) { + $output .= '<p>'.trim($fields[4]).' + <input class="news_input_'.trim($fields[0]). + '" id="news_input_'.trim($fields[0]). + '" name="news_input_'.trim($fields[0]). + '" type="'.trim($fields[1]). + '" '.trim($fields[2]). + 'value="'.$default_anker.'" title="'.trim($this->getLang(trim($fields[5]))). + '" /></p>'.NL; + } + else { + $output .= '<input class="news_input_'.trim($fields[0]). + '" id="news_input_'.trim($fields[0]). + '" name="news_input_'.trim($fields[0]). + '" type="hidden'. + '" '.trim($fields[2]). + 'value="'.$default_anker.'" title="'.trim($this->getLang(trim($fields[5]))). + '" />'.NL; + } + } + else if (trim($fields[1]) == "date") { + $default_value = date("Y-m-d", strtotime($fields[3])); + $output .= '<p>'.trim($fields[4]).' + <input class="news_input_'.trim($fields[0]). + '" id="news_input_'.trim($fields[0]). + '" name="news_input_'.trim($fields[0]). + '" type="'.trim($fields[1]). + '" '.trim($fields[2]). + 'value="'.$default_value.'" title="'.trim($this->getLang(trim($fields[5]))). + '" /></p>'.NL; + } + else if (trim($fields[0]) == "author") { + global $ID; + global $conf; + $current_usr = pageinfo(); //to get current user as author + // real name: $current_usr['userinfo']['name'] + // login: $current_usr['client'] + if($conf['showuseras'] == 'loginname') { + $default_value = $current_usr['client']; + } + elseif($conf['showuseras'] == 'username') { + // real name + $default_value = $current_usr['userinfo']['name']; + } + elseif($conf['showuseras'] == 'email') { + // ofuscated mail address according mailguard settings + $default_value = $current_usr['userinfo']['name']; + } + elseif($conf['showuseras'] == 'email_link') { + $default_value = $current_usr['userinfo']['name']; + } + else $default_value = ""; + + $output .= '<p>'.trim($fields[4]).' + <input class="news_input_'.trim($fields[0]). + '" id="news_input_'.trim($fields[0]). + '" name="news_input_'.trim($fields[0]). + '" type="'.trim($fields[1]). + '" '.trim($fields[2]). + ' value="'.$default_value.'" title="'.trim($this->getLang(trim($fields[5]))). + '" /></p>'.NL; + } + else if (trim($fields[1]) == "link") { + $default_value = wl($allnewsdata1).$link_anker; + $output .= '<p>'.trim($fields[4]).' + <input class="news_input_'.trim($fields[0]). + '" id="news_input_'.trim($fields[0]). + '" name="news_input_'.trim($fields[0]). + '" type="'.trim($fields[1]). + '" '.trim($fields[2]). + 'value="'.$default_value.'" title="'.trim($this->getLang(trim($fields[5]))). + '" /></p>'.NL; + } + else { + $output .= '<p>'.trim($fields[4]).' + <input class="news_input_'.trim($fields[0]). + '" id="news_input_'.trim($fields[0]). + '" name="news_input_'.trim($fields[0]). + '" type="'.trim($fields[1]). + '" '.trim($fields[2]). + 'value="'.trim($fields[3]).'" title="'.trim($this->getLang(trim($fields[5]))). + '" /></p>'.NL; + } + $id_count = $id_count + 1; + } + + $output .= '<input class="anss_input_btn_save" + type="submit" + name="submit" + value="'.$this->getLang('anss_input_btn_save').'" + title="'.$this->getLang('anss_input_btn_save_descr').'" />'.NL; + $output .= '</form></div>'; + // 3. check if path/file exist on save click + // 4. add the new post before the existing (e.g. news:newsdata.txt) + $renderer->doc .= $output; + } + + /*------- show perview -------------------------------------------------*/ + elseif (strpos($ans_conf['param'], 'flash')!== false) { + $info = array(); + $tmp = substr($ans_conf['param'],strlen('flash')); //strip parameter to get set of add parameter + $prefs = explode(',',$tmp); + // $prefs[0] = preview length + // $prefs[1] = box width + // $prefs[2] = float option + // $prefs[3] = max items + // $prefs[4] = tags separated by pipe + if(!isset($prefs[4])) $tag_flag = true; + + if($prefs[0]<10) $prefs[0] = $this->getConf('prev_length'); + $preview_length = $prefs[0]; + + if(! isset($prefs[1])) { + $prefs[1]=''; + $item_width = '';} + else { + $a=0.5; + $item_width = 'style="margin-right: 10px !important;"'; + $prefs[2] = "float: ".$prefs[2].";"; + $prefs[1] = 'style="width: '.$prefs[1].'; '.$prefs[2].'"';} + + if($prefs[3]==0) $prefs[3]=5; + + $newsitems = array(); + // this will be called to display a preview + $output = '<div class="news_box" '.$prefs[1].'>'; + if($this->getConf('newsflash_link') == false) { + $output .= '<div class="news_header">'.$this->getLang('newsflash_title').'</div>'.NL; + } + else { + $output .= '<div class="news_header"><a class="news_header_link" href="'. $allnewsdata .'">'.$this->getLang('newsflash_title').'</a></div>'.NL; + } + $output .= '<div class="news_list" '.$item_width.'">'.NL; + + // 1. read news file (e.g. news:newsdata.txt) + $oldrecord = rawWiki($targetpage); +// $entries = explode("\n----\n\n",$oldrecord); + $entries = explode("======",$oldrecord); + foreach($entries as $entry) { + // split news block into line items + $temp_array = explode("\n * ",$entry); + unset($temp_array[0]); + + // 2. create preview output + // split line items into key and data + $aFlag = false; + $bFlag = false; + foreach ($temp_array as $item) { + list($key, $value) = split(":",trim($item),2); + $tag_flag = false; + + if($key=='anchor') { + $anchor = trim($value); + } + elseif(($key=='start') && strtotime(trim($value)) < time()) { + $aFlag = true; + $value = date($this->getConf('d_format'), strtotime($value)); + $news_date = '<span class="news_date"> ('. $value ; + } + elseif(($key=='stop') && strtotime(trim($value)) > time()) { + $bFlag = true; + } + elseif($key=='text'){ + if($bFlag !== true) break; + // replace media links + $linkx = array(); + $pattern = '/\{\{.*?\}\}/i'; + $linkx = $this->replace_links($pattern, $value, 'medi'); + + // replace hyperlinks + $links = array(); + $pattern = '/\[\[.*?\]\]/i'; + $links = $this->replace_links($pattern, $value, 'url'); + + // shrink the output according settings + //$prvw_string = substr( preg_replace ('/\<.*?\>/', ' ', $value ) , 0, $preview_length ); + $check = explode(' ', $value); + $i=0; + $prvw_string =''; + foreach($check as $a) { + $prvw_string .= $a.' '; + $i++; + if($i>$preview_length) {break;} + } + if(count($check)-1>$preview_length) $prvw_string .= ' ...'; + + // replace placeholder + $links = $this->replace_placeholder($links, $prvw_string, 'url'); + $linkx = $this->replace_placeholder($linkx, $prvw_string, 'medi'); + + $prvw_string = p_render('xhtml',p_get_instructions($prvw_string),$info); + $preview_string = '<span class="news_preview">' . $prvw_string .'</span>'. NL; + } + // head has to be before the link in the template ! + elseif($key=='head'){ + $news_head = $value; + // add edit button to section edit the article if edit + // permission is given to that current user for this ID + if($current_usr["perm"]>1) { + // detect start and stop of section + $news_rawcontent = rawWiki($targetpage); + $start= stripos($news_rawcontent,$value)-5; + $tmp = explode("====== ",$news_rawcontent); + foreach($tmp as $temps) { + if(stripos($temps,$value)!==false) { + $stop = strlen($temps)+$start+6; + break; + } + } + // assemble the pieces for the button and form. + $url = wl($this->getConf('news_datafile'),'',true); + + $ank = '<div><form class="btn_secedit" + method="post" + action="'.$url.'"> + <input type="hidden" name="do" value="edit" /> + <input type="hidden" name="summary" value="['.$value.'] " /> + <input type="hidden" name="target" value="section" /> + <input type="hidden" name="range" value="'.$start.'-'.$stop.'" /> + <input class="anss_edit_img" type="image" src="'.DOKU_BASE.'lib/plugins/anewssystem/images/dot2.gif" alt="'.$this->getLang('anss_edit_imgttl').'" title="'.$this->getLang('anss_edit_imgttl').'" value="Edit" /> + </form> + <span style="width:3em;"> </span>'; + // add a delete button and $POST + $ank .= '<form class="anss_delete" + method="post" > + <input type="hidden" name="anss_del_anchor" value="'.$anchor.'"/> + <input type="hidden" name="anss_del_record" value="'.$news_head.'"/> + <input class="anss_del_img" type="image" src="'.DOKU_BASE.'lib/plugins/anewssystem/images/dot.gif" alt="Del" title="'.$this->getLang('del_title').'" /> + </form> + </div>'; + } + else $ank=''; + } + elseif($key=='link'){ + $prev_id++; + $news_head = '<a class="news_link" href="'.$value.'" id="news_link'.$prev_id.'" rel="subcontent'.$prev_id.'">'. $news_head .'</a>'.NL; + // generate an overlap div with Thumbshot picture if link is provided by conf + if($this->getConf('convert')) { + if(is_string($response)) { + msg($response,-1); + } + else { + list($link,$image) = $response; + $anID = explode("id=",$value); + if($anID[1]) $theLink = DOKU_URL.'doku.php?id='.$anID[1]; + else $theLink = $value; + $theLink = sprintf($this->getConf('convert'), $theLink); + $news_head .= ' + <DIV id="subcontent'.$prev_id.'" class="news_subcontent"> + <a class="news_link" href="'.$value.'" target="_blank"> + <img class="news_subcontent_pic" alt="News" src="'.$theLink.'" a=""> + </a><br /> + </DIV>'.NL; // anchorid, pos, glidetime, revealbehavior + $news_head .= '<script type="text/javascript">'. + ' dropdowncontent.init("news_link'.$prev_id.'", "left", 500, "mouseover")'. + '</script>'.NL; + } + } + } + elseif($key=='author'){ + $news_date .= ', '. $value; + } + elseif(($key=='tags') && (isset($prefs[4]) !== false)) { + $tags = explode(',',$value); + foreach($tags as $tag) { + if(($tag!==false) && (stripos($prefs[4],trim($tag))!==false)){ + $tag_flag = true; + break; + } + } + } + } + if(isset($prefs[4]) == false) $tag_flag = true; + $news_date .= ')</span><br />'.NL; + if(($aFlag === true) && ($bFlag === true) && ($tag_flag === true)) { + $output .= '<div class="prev_newsitem">'.$news_head.$news_date.$preview_string.$ank.'</div>'.NL; + $item_counter = $item_counter + 1; + // stop if max number of items is reached + if (isset($prefs[3]) && ($item_counter == $prefs[3])) { + break; } + } + } + if($item_counter==0) + { + $output .= '<div class="prev_newsitem">'.$this->getLang('noNews').'</div>'.NL; + } + $output .= '</div></div>'.NL.NL; + $output = '<script type="text/javascript" src="'.DOKU_URL.'lib/plugins/anewssystem/dropdowncontent.js"></script>'.$output; + $renderer->doc .= $output; + } + /* --- Display a cloud of News Tags --------------------------------*/ + elseif (strpos($ans_conf['param'], 'cloud')!== false) { + $tmp = substr($ans_conf['param'],strlen('cloud')); //strip parameter to get set of add parameter + $oldrecord = rawWiki($targetpage); + $entries = explode("======",$oldrecord); + // loop through configured all news page + foreach($entries as $entry) { + // split news block into line items + $temp_array = explode("\n * ",$entry); + unset($temp_array[0]); + $aFlag = false; + $bFlag = false; + $tag_flag = false; + + // if perishing date is not exceeded then collect the tags + foreach ($temp_array as $item) { + list($key, $value) = split(":",trim($item),2); + if(($key=='start') && strtotime(trim($value)) < time()) { + $aFlag = true; + $value = date($this->getConf('d_format'), strtotime($value)); + $news_date = '<span class="news_date"> ('. $value ; + } + elseif(($key=='stop') && strtotime(trim($value)) > time()) { + $bFlag = true; + } + if($key=='tags') { + if(($aFlag !== true) || ($bFlag !== true)) break; + $aFlag = false; + $bFlag = false; + $tags = explode(',',$value); + if(count($tags) >0 ) { + foreach($tags as $tag) { + $tags_result[$tag]++; + } + break; + } + } + } + } + + // evaluate the styling parameters + $tokens = preg_split('/\s+/', $tmp,-1, PREG_SPLIT_NO_EMPTY); + $div_class = 'newsclouddiv'; + foreach ($tokens as $token) { + + if (preg_match('/^\d*\.?\d+(%|px|em|ex|pt|cm|mm|pi|in)$/', $token)) { + $styles .= ' width: '.$token.';'; + continue; + } + if (preg_match('/^( + (\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}))| #color value + (rgb\(([0-9]{1,3}%?,){2}[0-9]{1,3}%?\)) #rgb triplet + )$/x', $token)) { + $styles .= ' background-color: '.$token.';'; + continue; + } + if((stripos($token,'tleft') !== false) || + (stripos($token,'tright') !== false) || + (stripos($token,'tcenter') !== false) || + (stripos($token,'tjustify') !== false) || + (stripos($token,'tinherit') !== false)) { + $styles .= ' text-align: '.substr(trim($token),1).';'; + //style the tabs properly + if(stripos($token,'tright')!== false) { + $tab_right = ""; + $tab_left = DOKU_TAB; + } + else { + $tab_right = ""; + $tab_left = DOKU_TAB; + } + continue; + } + if((stripos($token,'fleft') !== false) || + (stripos($token,'fright') !== false) || + (stripos($token,'fnone') !== false) || + (stripos($token,'finherit') !== false)) { + $styles .= ' float: '.substr(trim($token),1).';'; + continue; + } + if((stripos($token,'uppercase') !== false) || + (stripos($token,'capitalize') !== false) || + (stripos($token,'lowercase') !== false)) { + $styles .= ' text-transform: '.$token.';'; + continue; + } + if(stripos($token,'newsclouddiv') !== false) { + $div_class = $token; + continue; + } + } + // output the tags as links + $output = '<div class="'.$div_class.'" style="'.$styles.'">'.NL; + // loop through the tags array and evaluate the size per tag + $min = 1000; + $max = 1; + + if(count($tags_result)<1) $output.='<span>no tags found</span>'; + else { + foreach($tags_result as $tag => $val) { + $min = min($val,$min); + $max = max($val,$max); + } + $delta = ($max-$min)/16; + foreach($tags_result as $tag => $val) { + if ($val < $min+round($delta)) $class = 'newscloud1'; + elseif ($val < $min+round(2*$delta)) $class = 'newscloud2'; + elseif ($val < $min+round(4*$delta)) $class = 'newscloud3'; + elseif ($val < $min+round(8*$delta)) $class = 'newscloud4'; + else $class = 'newscloud5'; + $output .= $tab_left.'<a href="'.DOKU_URL.'doku.php?id='.$this->getConf('news_output').$this->getConf('act_delim').'tag='.trim($tag).'" class="' . $class .'"title="'.$val.'">'.$tag.'</a>'.$tab_right.NL; + } + } + $output .= '</div>'.NL; + $renderer->doc .= $output; + } + /* --- Show all news -------------------------------------------------*/ + elseif ((strpos($ans_conf['param'], 'allnews')!== false)) { + // check if page ID was called with tag filter + $tmp = ','.$_GET['tag']; // this will overrule the page syntax setting + if(strlen($tmp)<2) { + // strip parameter to get set of add parameter + // there exist either 'tag' or 'anchor', never both at the same time + $tmp = substr($ans_conf['param'],strlen('allnews')); + } + $prefs = explode(',',$tmp); // one or multiple tag filters: $prefs[1] ... [n] + // $prefs[0] = preview length + // $prefs[1] = not used but comme must be existing to delim further params + // $prefs[2] = not used but comme must be existing to delim further params + // $prefs[3] = max items + // $prefs[4] = tags separated by pipe + if($prefs[0]<10) $prefs[0] = $this->getConf('prev_length'); + $preview_length = $prefs[0]; + + $prefs['anchor'] = $_GET['anchor']; // this will overrule the page syntax setting to + // show just the one article instead all of them + + // necessary for the back link of a show one article per page (SOAPP) +// if($_GET['archive']=='archive') $ans_conf['param'] = 'archive'; + + $newsitems = array(); + // this will be called to display all news articles + $page = wl( (isset($targetpage) ? $targetpage : 'news:newsdata') ); + $output = '<div class="allnews_box">'.NL; + // 1. read news file (e.g. news:newsdata.txt) + $oldrecord = rawWiki($targetpage); + $entries = explode("======",$oldrecord); + $info = array(); + $yh_level = $this->getConf('yh_level'); + $mh_level = $this->getConf('mh_level'); + $h_level = $this->getConf('h_level'); + + foreach($entries as $entry) { + // split news block into line items + $temp_array = explode("\n * ",$entry); + unset($temp_array[0]); + + // 2. create output + // split line items into key and data + $aFlag = false; + $bFlag = false; + + foreach ($temp_array as $item) { + list($key, $value) = split(":",trim($item),2); + $tag_flag = false; + if($key=='anchor') { + $anchor = trim($value); + } + elseif(($key=='start') && strtotime(trim($value)) < time()) { + $aFlag = true; + $value = date($this->getConf('d_format'), strtotime($value)); +/* if (strpos($ans_conf['param'], 'archive')!== false) { + $news_date = '<span class="news_date_a"> ('. $value; + } + else */$news_date = '<span class="news_date"> ('. $value ; + } + elseif(($key=='stop') && strtotime(trim($value)) > time()) { + $bFlag = true; + } + elseif($key=='text'){ + // replace media links + $linkx = array(); + $pattern = '/\{\{.*?\}\}/i'; + $linkx = $this->replace_links($pattern, $value, 'medi'); + + // replace hyperlinks + $links = array(); + $pattern = '/\[\[.*?\]\]/i'; + $links = $this->replace_links($pattern, $value, 'url'); + + if(isset($prefs['anchor'])!==true) { + // shrink the output according settings + //$prvw_string = substr( preg_replace ('/\<.*?\>/', ' ', $value ) , 0, $preview_length ); + $check = explode(' ', $value); + $i=0; + $prvw_string =''; + foreach($check as $a) { + $prvw_string .= $a.' '; + $i++; + if($i>$preview_length) {break;} + } + if(count($check)-1>$preview_length) $prvw_string .= ' ...'; + } + else { + $prvw_string = $value; + } + // replace placeholder + $links = $this->replace_placeholder($links, $prvw_string, 'url'); + $linkx = $this->replace_placeholder($linkx, $prvw_string, 'medi'); + + $prvw_string = p_render('xhtml',p_get_instructions($prvw_string),$info); + $preview_string = '<span class="news_preview">' . $prvw_string .'</span>'. NL; + } + // head has to be before the link in the template ! + elseif($key=='head'){ + $news_head = trim($value); + // add edit button to section edit the article if edit + // permission is given to that current user for this ID + if($current_usr["perm"]>1) { + // detect start and stop of section + $news_rawcontent = rawWiki($targetpage); + $start= stripos($news_rawcontent,$value)-5; + $tmp = explode("====== ",$news_rawcontent); + foreach($tmp as $temps) { + if(stripos($temps,$value)!==false) { + $stop = strlen($temps)+$start+6; + break; + } + } + // assemble the pieces for the button and form. + $url = wl($this->getConf('news_datafile'),'',true); + $ank = '<div><form class="btn_secedit" + method="post" + action="'.$url.'"> + <input type="hidden" name="do" value="edit" /> + <input type="hidden" name="summary" value="['.$value.'] " /> + <input type="hidden" name="target" value="section" /> + <input type="hidden" name="range" value="'.$start.'-'.$stop.'" /> + <input class="anss_edit_img" type="image" src="'.DOKU_BASE.'lib/plugins/anewssystem/images/dot2.gif" alt="'.$this->getLang('anss_edit_imgttl').'" title="'.$this->getLang('anss_edit_imgttl').'" value="Edit" /> + </form> + <span style="width:3em;"> </span>'; + // add a delete button and $POST + $ank .= '<form class="anss_delete" + method="post" > + <input type="hidden" name="anss_del_anchor" value="'.$anchor.'"/> + <input type="hidden" name="anss_del_record" value="'.$news_head.'"/> + <input class="anss_del_img" type="image" src="'.DOKU_BASE.'lib/plugins/anewssystem/images/dot.gif" alt="Del" title="'.$this->getLang('del_title').'" /> + </form> + </div>'; + } + else $ank=''; + } + elseif($key=='subtitle'){ + $news_subtitle = '<br /><span class="news_subtitle">'.trim($value).'</span>'.NL; + } + elseif($key=='link'){ + $news_head = '<a href="'.$value.'" id="'.$value.'" name="'.$value.'">'. $news_head .'</a>'.NL; + } + + elseif($key=='author'){ + $news_date .= ', '. $value; + } + elseif(($key=='tags') && (isset($prefs[1]) !== false)) { + $tags = explode(',',$value); + foreach($tags as $tag) { + if(($tag!==false) && (stripos($prefs[1],trim($tag))!==false)){ + $tag_flag = true; + break; + } + } + } + } + + $news_date .= ')</span>'.NL; + + // prevent output of date and author of ho parameter is given as off + if ((strpos($ans_conf['param'], 'ho=off')!== false)) { $news_date =''; } + + if((isset($prefs[1]) === false) || (strlen($prefs[1]) <2)) $tag_flag = true; + + if(($aFlag === true) && ($bFlag === true) && ($tag_flag === true)) { + $output .= '<div>'.NL.'<h'.$h_level.'>'.$news_head.$news_date.$news_subtitle.'</h'.$h_level.'>'.NL.$preview_string.NL.$ank.NL.'</div>'.NL; + $item_counter++; + } + elseif(isset($prefs['anchor'])===true) { + // show the single article independently if it is current or outdated + $output .= '<div>'.NL.'<h'.$h_level.'>'.$news_head.$news_date.$news_subtitle.'</h'.$h_level.'>'.NL.$preview_string.NL.$ank.NL.'</div>'.NL; + } + $news_subtitle=''; + // --- just ouput only the linked article on the page ---------- + $archive_lnkTitle = $this->getConf('lnk_newsarchive'); + if($archive_lnkTitle=='') $archive_lnkTitle = "News Archive"; + if((strlen($anchor)>2) && (isset($prefs['anchor'])!==false)) { + if(stripos($anchor,$prefs['anchor']) !== false) { + $backlink = '<a href="javascript:history.back(-1)">'.$this->getLang('lnk_back').'</a>'; + $backlink .= '<span class="anss_sep"> | </span> + <a href="'.DOKU_URL.'doku.php?id='.$this->getConf('news_output').'">'.$this->getLang('allnews').'</a>'; + $output = '<script type="text/javascript" src="backlink.js"></script> + <script type="text/javascript"> + <!-- + var gb = new backlink(); + gb.write(); + //--> + </SCRIPT> + <div style="font-size:.85em;">'.$backlink.NL. + '<span class="anss_sep"> | </span><a class"wikilink" href="'.wl($ID).$this->getConf('act_delim').'archive=archive">'.$archive_lnkTitle.'</a></div><br />'.NL. + '<div class="archive_section" id="news_archive_head" style="'.$archive_options['style'].'">'. + $output. + '<div style="font-size:.85em;">'.$backlink.NL. + '<span class="anss_sep"> | </span><a class"wikilink" href="'.wl($ID).$this->getConf('act_delim').'archive=archive">'.$archive_lnkTitle.'</a></div><br />'.NL; + break; // due to the single linked article is loaded into $output + } + } + if(isset($prefs['anchor']) === true) { + $output = ''; // to strip away all other articles + } + } + + if($item_counter==0) + { + $output .= '<span>'.$this->getLang('noNews').'</span>'.NL; + } + $output .= '</div><div style="clear: both;"></div>'.NL.NL; + $renderer->doc .= $output; + } +/* --- Show archive ----------------------------------------------------------*/ + elseif ((strpos($ans_conf['param'], 'archive')!== false)) { + // date ... consider all news of a defined month of a year (mm.yyyy, empty per default) + // qty ... limits the number of news headlines starting with most recent (either integer or all, default:all) + // tag ... consider all news where news article owns the given tag string (empty per default) tag delimiter is "|" + // style ... css style string as used in HTML (except quotation marks) for the outer element div + // class ... css style for usecase toc, page or box + // ho ... headlinesonly will list the news headlines without timestamp and author (on/off, default: off) + + // check if page ID was called with tag filter +// $tmp .= ','.$_GET['tag']; // this will overrule the page syntax setting + if(strlen($tmp)<2) { + // strip parameter to get set of add parameter + $tmp = substr($ans_conf['param'],strlen('allnews')); + } + $split_array = explode(',',$tmp); // one or multiple tag filters: $prefs[1] ... [n] + $archive_options = array(); + + // split parameter into array with key and data + foreach ($split_array as $item) { + list($key, $value) = split("=",trim($item),2); + $archive_options = $archive_options + array($key => $value); + } +// echo $archive_options['tag'].'<br />'; + if(($archive_options['qty']=='') || ($archive_options['qty']<1)) $archive_options['qty'] = 'all'; + if(array_key_exists('class',$archive_options) === false) $archive_options['class'] = 'page'; + if(array_key_exists('ho',$archive_options) === false) $archive_options['ho'] = 'off'; + $page = wl( (isset($targetpage) ? $targetpage : 'news:newsdata') ); + + // load raw news file (e.g. news:newsdata.txt) + $oldrecord = rawWiki($targetpage); + + // split the news articles + $newsitems = explode("======",$oldrecord); + $info = array(); + + // get the headline level from config + $yh_level = $this->getConf('yh_level'); + $mh_level = $this->getConf('mh_level'); + $h_level = $this->getConf('h_level'); + + // 1. read news file (e.g. news:newsdata.txt) + foreach($newsitems as $article) { + // split news block into line items + $article_array = explode("\n * ",$article); + unset($article_array[0]); + + // 2. create output + // split line items into key and data + $aFlag = false; // flag: start date value exists and start is not in future + + foreach ($article_array as $item) { + list($key, $value) = split(":",trim($item),2); + $tag_flag = false; + if($key=='anchor') { + $anchor = trim($value); + } + elseif(($key=='start') && strtotime(trim($value)) < time()) { + $value = date($this->getConf('d_format'), strtotime($value)); + $news_date = '<span class="news_date_a"> ('. $value; + // get month and year to compare with $archive_options['date'] + if(isset($archive_options['date']) && ($archive_options['date'] !== date('m.Y',strtotime($value)))) break; + $aFlag = true; + } + // head has to be before the link in the template ! + elseif($key=='head'){ + $news_head = trim($value); + } + elseif($key=='subtitle'){ + $news_subtitle = '<br /><span class="news_subtitle">'.trim($value).'</span>'.NL; + } + elseif($key=='link'){ + $news_head = '<a href="'.$value.'" id="'.$value.'" name="'.$value.'">'. trim($news_head) .'</a>'.NL; + } + elseif($key=='author'){ + $news_date .= ', '. $value; + } + elseif(($key=='tags') && (isset($archive_options['tag']) !== false)) { + $tags = explode(',',$value); + foreach($tags as $tag) { + if(($tag!==false) && (stripos($archive_options['tag'],trim($tag))!==false)){ + $tag_flag = true; + break; + } + } + } + } + + $news_date .= ')</span>'.NL; + + if((isset($archive_options['tag']) === false) || (strlen($archive_options['tag']) <2)) $tag_flag = true; + + if (($aFlag === true) && ($tag_flag === true)) { + //stop adding older news articles if quantity is reached + $qty++; + if(($qty > intval($archive_options['qty'])) && ($archive_options['qty']!=='all')) break; + + // list all news stories as headline linked to the story itself + $elt = explode(",",$news_date); + $elt[0] = trim(strip_tags(str_replace('(','',$elt[0]))); + $elt[0] = date('F,Y',strtotime($elt[0])); + list($new_month,$new_year) = explode(',',$elt[0]); + + // idea is that all stories are created one after the other + // and the order within newsdata is according the start date + // manipulation of Start/Perishing date possible but not expected + // !!! There is no sort algorithm for year and month implemented !!! + // to do such would lead into re-development of the plugin + if(($old_year !== $new_year) && (($archive_options['class']==='page') || ($archive_options['ho']==='off'))) { + if(trim($old_year) !== '') $close_ytag = "</li></ul>".NL; + $output .= $close_ytag.'<ul><li class="level1"><div class="li">'.$new_year.'</div><ul class="n_box">'; + $old_year = $new_year; + } + + if(($old_month !== $new_month) && (($archive_options['class']==='page') || ($archive_options['ho']==='off'))) { + if(trim($old_month) !== '') $close_mtag = "</li></ul>".NL; + $output .= $close_mtag.'<ul><li class="level2"><div class="li">'.$new_month.'</div>'; + $old_month = $new_month; + } + + if($archive_options['ho']==='on') $news_date=''; + else $news_date .= '<br />'; + + if(($archive_options['tag']!==false) && ($archive_options['tag']!=='off') && ($archive_options['class']=='page')) $output .= '<div class="archive_item">'.trim($news_date).$news_head.$news_subtitle.'</div>'.NL; + else $output .= '<ul><li class="level3"><div class="li">'.trim($news_date).$news_head.'</div></li></ul>'.NL; + + $close_ytag = ""; + $close_mtag = ""; + $anchor = ""; + $news_date = ""; + $news_head = ""; + $news_subtitle = ""; + $tags = ""; + } + } + $blink_id = "news_items"; + $img_ID = "img_archive__toc"; + + if($archive_options['class']=='toc') { + $output = '<script type="text/javascript"> + function archive__toc_open(toggle_id, img_ID) + { if (document.getElementById(toggle_id).style.display == "none") + { document.getElementById(toggle_id).style.display = "block"; + document.getElementById(img_ID).style.backgroundPosition = "0px 0px"; + } + else + { document.getElementById(toggle_id).style.display = "none"; + document.getElementById(img_ID).style.backgroundPosition = "0px -5px"; + } + } + </script> + <div class="archive_box" id="archive__toc" style="'.$archive_options['style'].'"> + <h3 class="toggle open" style="cursor: pointer;" onClick="archive__toc_open(\''.$blink_id.'\',\''.$img_ID.'\')"> + <strong id="img_archive__toc"></strong> + NEWS + </h3> + <div id="news_items"> + <div style="text-align:left;"> + <ul class="n_box">'.$output.'</ul> + </div + <hr /> + <div style="text-align:right;font-size:.85em; border-top: 1px dotted #828282;"> + <a href="'.$news_root.':allnewsdata'.$this->getConf('act_delim').'do=shownewsarchive">» News Archive</a> + </div> + </div> + </div>'.NL.NL; + } + elseif($archive_options['class']=='box') { + $output = '<div class="archive_box" id="archive__box" style="'.$archive_options['style'].'"> + <div id="news_items"> + <ul class="n_box">'.$output.'</ul> + </div> + </div>'.NL; + } + $renderer->doc .= $output; + } + +// --- faulty syntax ---------------------------------------------------------- + else { + $renderer->doc .= msg('Syntax of anewssystem plugin detected but unknown parameter ['.$ans_conf['param'].'] was provided.', -1); + } + } +//--------------------------------------------------------------------------------------- + // flatten the hierarchical arry to store path + file at first "column" + function array_flat($array) { + $out=array(); + foreach($array as $k=>$v){ + if(is_array($array[$k])) { $out=array_merge($out,$this->array_flat($array[$k])); } + else { $out[]=$v; } + } + return $out; + } +//--------------------------------------------------------------------------------------- + function replace_links($pattern, &$value, $r_string) { + // check for links and replace them by placeholder + preg_match_all($pattern, $value, $links); + $in=0; + foreach($links[0] as $link) { + $in++; + $value = str_replace($link,$r_string.$in,$value); + } + return $links; + + } +//--------------------------------------------------------------------------------------- + function replace_placeholder($links, &$prvw_string, $r_string) { + $in=0; + foreach($links[0] as $link) { + $in++; + $prvw_string = str_replace($r_string.$in,$link,$prvw_string); + } + return $links; + } + +/******************************************************************************/ +/* return html-code for news edit toolbar */ + function news_edit_toolbar($type) { + $imgBASE = DOKU_BASE."lib/plugins/anewssystem/images/toolbar/"; + $news_edit_tb .= '<script type="text/javascript"> + function doHLine(tag1,obj) + { textarea = document.getElementById(obj); + if (document.selection) + { // Code for IE + textarea.focus(); + var sel = document.selection.createRange(); + sel.text = "\n" + tag1 + "\n" + "\n" + sel.text; + } + else + { // Code for Mozilla Firefox + var len = textarea.value.length; + var start = textarea.selectionStart; + var end = textarea.selectionEnd; + + var scrollTop = textarea.scrollTop; + var scrollLeft = textarea.scrollLeft; + + var sel = textarea.value.substring(start, end); + var rep = tag1 + sel; + textarea.value = textarea.value.substring(0,start) + rep + textarea.value.substring(end,len); + + textarea.scrollTop = scrollTop; + textarea.scrollLeft = scrollLeft; + } + }'. + + 'function doAddTags(tag1,tag2,obj) + { textarea = document.getElementById(obj); + // Code for IE + if (document.selection) + { textarea.focus(); + var sel = document.selection.createRange(); + if (sel.text == "") sel.text = " "; + sel.text = tag1 + sel.text + tag2; + } + else + { // Code for Mozilla Firefox + var len = textarea.value.length; + var start = textarea.selectionStart; + var end = textarea.selectionEnd; + + var scrollTop = textarea.scrollTop; + var scrollLeft = textarea.scrollLeft; + + var sel = textarea.value.substring(start, end); + if (start == end) { sel = " "; } + var rep = tag1 + sel + tag2; + textarea.value = textarea.value.substring(0,start) + rep + textarea.value.substring(end,len); + + textarea.scrollTop = scrollTop; + textarea.scrollLeft = scrollLeft; + } + }'. + + 'function doTT(obj) + { textarea = document.getElementById(obj); + // Code for IE + if (document.selection) + { textarea.focus(); + var sel = document.selection.createRange(); + if (sel.text == "") sel.text = " "; + sel.text = "\'\'" + sel.text + "\'\'"; + } + else + { // Code for Mozilla Firefox + var len = textarea.value.length; + var start = textarea.selectionStart; + var end = textarea.selectionEnd; + + var scrollTop = textarea.scrollTop; + var scrollLeft = textarea.scrollLeft; + + var sel = textarea.value.substring(start, end); + if (start == end) { sel = " "; } + var rep = "\'\'" + sel + "\'\'"; + textarea.value = textarea.value.substring(0,start) + rep + textarea.value.substring(end,len); + + textarea.scrollTop = scrollTop; + textarea.scrollLeft = scrollLeft; + } + }'. + + 'function doList(tag1,obj) + { + textarea = document.getElementById(obj); + + if (document.selection) + { // Code for IE + textarea.focus(); + var sel = document.selection.createRange(); + var list = sel.text.split("\n"); + + for(i=0;i<list.length;i++) + { list[i] = tag1 + list[i]; } + sel.text = "\n" + list.join("\n") + "\n"; + } + else + { // Code for Firefox + var len = textarea.value.length; + var start = textarea.selectionStart; + var end = textarea.selectionEnd; + var i; + + var scrollTop = textarea.scrollTop; + var scrollLeft = textarea.scrollLeft; + + var sel = textarea.value.substring(start, end); + var list = sel.split("\n"); + + for(i=0;i<list.length;i++) + { list[i] = tag1 + list[i]; } + + var rep = "\n" + list.join("\n") + "\n"; + textarea.value = textarea.value.substring(0,start) + rep + textarea.value.substring(end,len); + + textarea.scrollTop = scrollTop; + textarea.scrollLeft = scrollLeft; + } + } + </script>'; + $news_edit_tb .= '<div class="news_edittoolbar">'.NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."bold.png\" name=\"btnBold\" title=\"Bold [b]\" accesskey=\"b\" onClick=\"doAddTags('**','**','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."italic.png\" name=\"btnItalic\" title=\"Italic [i]\" accesskey=\"i\" onClick=\"doAddTags('//','//','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."underline.png\" name=\"btnUnderline\" title=\"Underline [u]\" accesskey=\"u\" onClick=\"doAddTags('__','__','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."mono.png\" name=\"btnMono\" title=\"mono-spaced font [m]\" accesskey=\"m\" onClick=\"doTT('$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."strike.png\" name=\"btnStrike\" title=\"Strike through [d]\" accesskey=\"d\" onClick=\"doAddTags('<del>','</del>','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."subscript.png\" name=\"btnSubscript\" title=\"Subscript\" onClick=\"doAddTags('<sub>','</sub>','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."superscript.png\" name=\"btnSuperscript\" title=\"Superscript\" onClick=\"doAddTags('<sup>','</sup>','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."linkextern.png\" name=\"btnLink_extern\" title=\"external Link [l]\" accesskey=\"l\" onClick=\"doAddTags('[[',']]','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."hr.png\" name=\"btnLine\" title=\"Horizontal ruler [r]\" accesskey=\"r\" onClick=\"doHLine('----','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."ol.png\" name=\"btn_o_List\" title=\"Ordered List [-]\" accesskey=\"-\" onClick=\"doList(' - ','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."ul.png\" name=\"btn_u_List\" title=\"Unordered List [*]\" accesskey=\"*\" onClick=\"doList(' * ','$type')\">".NL; +// $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."h1.png\" name=\"btn_u_List\" title=\"Headline Level 1 (Page Title) [1]\" accesskey=\"1\" onClick=\"doAddTags('======','======','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."h2.png\" name=\"btn_u_List\" title=\"Headline Level 2 [2]\" accesskey=\"2\" onClick=\"doAddTags('=====','=====','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."h3.png\" name=\"btn_u_List\" title=\"Headline Level 3 [3]\" accesskey=\"3\" onClick=\"doAddTags('====','====','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."h4.png\" name=\"btn_u_List\" title=\"Headline Level 4 [4]\" accesskey=\"4\" onClick=\"doAddTags('===','===','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."h5.png\" name=\"btn_u_List\" title=\"Headline Level 5 [5]\" accesskey=\"5\" onClick=\"doAddTags('==','==','$type')\">".NL; + $news_edit_tb .= "<img class=\"newsedit_button\" src=\"".$imgBASE."code.png\" name=\"btnCode\" title=\"Code block [c]\" accesskey=\"c\" onClick=\"doAddTags('<code>','</code>','$type')\">".NL; + $news_edit_tb .= "<br></div>".NL; + return $news_edit_tb; + } +} +?> \ No newline at end of file diff --git a/public_html/lib/plugins/anewssystem/tpl/newstemplate.txt b/public_html/lib/plugins/anewssystem/tpl/newstemplate.txt new file mode 100644 index 0000000..a8b97df --- /dev/null +++ b/public_html/lib/plugins/anewssystem/tpl/newstemplate.txt @@ -0,0 +1,10 @@ +//field |type |length |value |description | add info (<-do not delete this line) +anchor |label |size="14" | |Anchor |anchordescr +head |text |size="64" | |Headline |headdescr +subtitle |text |size="64" | |Sub-Title |subtitledescr +link |link |size="64" | |Linked page |linkdescr +start |date |size="10" |now |Publishing date |startdescr +stop |date |size="10" |4 month|Perishing date |stopdescr +text |textarea|cols="63" rows="7" | |Your news article:|msgdescr +author |label |size="14" | |Author |authordescr +tags |text |size="14" | |Tag  |tagdescr diff --git a/public_html/lib/plugins/anewssystem/tpl/newstemplate_de.txt b/public_html/lib/plugins/anewssystem/tpl/newstemplate_de.txt new file mode 100644 index 0000000..304dc7b --- /dev/null +++ b/public_html/lib/plugins/anewssystem/tpl/newstemplate_de.txt @@ -0,0 +1,10 @@ +//field |type |length |value |description | add info (<-do not delete this line) +anchor |label |size="14" | |Anker |anchordescr +head |text |size="64" | |Überschrift |headdescr +subtitle |text |size="64" | |Untertitel |subtitledescr +link |link |size="64" | |Referenz-Link |linkdescr +start |date |size="10" |now |veröffentlicht am |startdescr +stop |date |size="10" |4 month|abgelaufen am |stopdescr +text |textarea|cols="63" rows="7" | |Deine Neuigkeit: |msgdescr +author |label |size="14" | |Author |authordescr +tags |text |size="14" | |Tag  |tagdescr diff --git a/public_html/lib/plugins/anewssystem/tpl/newstemplate_en.txt b/public_html/lib/plugins/anewssystem/tpl/newstemplate_en.txt new file mode 100644 index 0000000..a8b97df --- /dev/null +++ b/public_html/lib/plugins/anewssystem/tpl/newstemplate_en.txt @@ -0,0 +1,10 @@ +//field |type |length |value |description | add info (<-do not delete this line) +anchor |label |size="14" | |Anchor |anchordescr +head |text |size="64" | |Headline |headdescr +subtitle |text |size="64" | |Sub-Title |subtitledescr +link |link |size="64" | |Linked page |linkdescr +start |date |size="10" |now |Publishing date |startdescr +stop |date |size="10" |4 month|Perishing date |stopdescr +text |textarea|cols="63" rows="7" | |Your news article:|msgdescr +author |label |size="14" | |Author |authordescr +tags |text |size="14" | |Tag  |tagdescr diff --git a/public_html/lib/plugins/anewssystem/tpl/newstemplate_it.txt b/public_html/lib/plugins/anewssystem/tpl/newstemplate_it.txt new file mode 100644 index 0000000..a8b97df --- /dev/null +++ b/public_html/lib/plugins/anewssystem/tpl/newstemplate_it.txt @@ -0,0 +1,10 @@ +//field |type |length |value |description | add info (<-do not delete this line) +anchor |label |size="14" | |Anchor |anchordescr +head |text |size="64" | |Headline |headdescr +subtitle |text |size="64" | |Sub-Title |subtitledescr +link |link |size="64" | |Linked page |linkdescr +start |date |size="10" |now |Publishing date |startdescr +stop |date |size="10" |4 month|Perishing date |stopdescr +text |textarea|cols="63" rows="7" | |Your news article:|msgdescr +author |label |size="14" | |Author |authordescr +tags |text |size="14" | |Tag  |tagdescr --