Changeset e02cc4


Ignore:
Timestamp:
05/20/15 13:14:55 (2 years ago)
Author:
pierre-alain <pierre-alain@…>
Branches:
master
Children:
2e506c
Parents:
f08393
git-author:
pierre-alain <pierre-alain@…> (05/20/15 13:14:55)
git-committer:
pierre-alain <pierre-alain@…> (05/20/15 13:14:55)
Message:

adding plugin support, and code cleaning

Location:
OWR/Includes/Themes/Original
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • OWR/Includes/Themes/Original/Theme.php

    r706f9a re02cc4  
    11<?php 
    2  
     2/** 
     3 * Themes class 
     4 * This class is used to manage theme 
     5 * 
     6 * PHP 5 
     7 * 
     8 * OWR - OpenWebReader 
     9 * 
     10 * Copyright (c) 2009, Pierre-Alain Mignot 
     11 * 
     12 * Home page: http://openwebreader.org 
     13 * 
     14 * E-Mail: contact@openwebreader.org 
     15 * 
     16 * All Rights Reserved 
     17 * 
     18 * This program is free software; you can redistribute it and/or modify 
     19 * it under the terms of the GNU General Public License as published by 
     20 * the Free Software Foundation; either version 2 of the License, or 
     21 * (at your option) any later version. 
     22 * 
     23 * This program is distributed in the hope that it will be useful, 
     24 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     26 * GNU General Public License for more details. 
     27 * 
     28 * You should have received a copy of the GNU General Public License 
     29 * along with this program; if not, write to the Free Software 
     30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
     31 * 
     32 * @author Pierre-Alain Mignot <contact@openwebreader.org> 
     33 * @copyright Copyright (c) 2009, Pierre-Alain Mignot 
     34 * @license http://www.gnu.org/copyleft/gpl.html 
     35 * @package OWR 
     36 */ 
    337namespace OWR\Includes\Themes\Original; 
    4 use OWR\Theme as pTheme, OWR\User, OWR\Config, OWR\Dates; 
     38use OWR\Theme as pTheme, OWR\User, OWR\Config, OWR\Dates, OWR\Plugins; 
    539 
    640/** 
    741 * Default theme 
    842 * 
    9  * @uses View the page renderer 
    10  * @uses User the current user 
    11  * @uses Config the config instance 
     43 * @uses OWR\View the page renderer 
     44 * @uses OWR\User the current user 
     45 * @uses OWR\Config the config instance 
     46 * @uses OWR\Plugins the plugins object 
    1247 * @package OWR 
    1348 */ 
     
    81116        $streams = $datas['streams']; 
    82117        unset($datas['streams']); 
    83          
     118 
    84119        foreach($streams as $stream) 
    85120        { 
     
    92127    } 
    93128 
     129    /** 
     130     * Generates upload iframe template 
     131     * 
     132     * @param array $datas datas to generate template 
     133     * @param array $noCacheDatas not cached datas to generate template 
     134     * @access public 
     135     * @return string generated content of upload template 
     136     */ 
    94137    public function upload(array $datas, array $noCacheDatas) 
    95138    { 
     
    115158        $noCacheDatas['pagetitle'] = 'OpenWebReader - ' . $this->_view->_('User creation'); 
    116159 
    117         $datas['themes'] = array(); 
    118         $themes = new \DirectoryIterator(dirname(__DIR__)); 
    119         foreach($themes as $theme) 
    120         { 
    121             if(!$themes->isDot() && $theme->isDir()) 
    122                 $datas['themes'][(string) $theme] = $this->_name === (string) $theme; 
    123         } 
    124  
    125         if(!empty($datas['themes'])) 
    126             ksort($datas['themes']); 
    127          
     160        $datas['themes'] = parent::getList(); 
     161        $datas['plugins'] = Plugins::getList(); 
     162 
    128163        $this->_view->addBlock('head', 'head', $this->_view->get('head', $datas, null, $noCacheDatas)); 
    129164        $this->_view->addBlock('user', 'contents', $this->_view->get(__FUNCTION__, $datas, null, $noCacheDatas)); 
     
    175210                                                            'gid' => 0, 
    176211                                                            'groups' => $datas['groups'])); 
    177          
     212 
    178213        $noCacheDatas['unread_0'] = isset($datas['unreads'][0]) ? $datas['unreads'][0] : 0; 
    179214        $noCacheDatas['bold_0'] = $noCacheDatas['unread_0'] > 0 ? ' class="bold"' : ''; 
     
    271306        return $block; 
    272307    } 
    273      
     308 
     309 
     310    /** 
     311     * Generates stream_details template 
     312     * 
     313     * @param array $datas datas to generate template 
     314     * @param array $noCacheDatas not cached datas to generate template 
     315     * @access public 
     316     * @return string generated content of stream_details template 
     317     */ 
    274318    public function stream_details(array $datas, array $noCacheDatas) 
    275319    { 
     
    299343    } 
    300344 
     345    /** 
     346     * Generates stream template 
     347     * 
     348     * @param array $datas datas to generate template 
     349     * @param array $noCacheDatas not cached datas to generate template 
     350     * @access public 
     351     * @return string generated content of stream template 
     352     */ 
    301353    public function stream(array $datas, array $noCacheDatas) 
    302354    { 
     
    306358    } 
    307359 
     360    /** 
     361     * Generates streams template 
     362     * 
     363     * @param array $datas datas to generate template 
     364     * @param array $noCacheDatas not cached datas to generate template 
     365     * @access public 
     366     * @return string generated content of streams template 
     367     */ 
    308368    public function streams(array $datas, array $noCacheDatas) 
    309369    { 
  • OWR/Includes/Themes/Original/js/owr.js

    r2b0b08 re02cc4  
    1 //MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net>, MIT Style License. 
     1/*MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net>, MIT Style License.*/ 
    22var MooTools={version:"1.2.2",build:"f0491d62fbb7e906789aa3733d6a67d43e5af7c9"};var Native=function(k){k=k||{};var a=k.name;var i=k.legacy;var b=k.protect; 
    33var c=k.implement;var h=k.generics;var f=k.initialize;var g=k.afterImplement||function(){};var d=f||i;h=h!==false;d.constructor=Native;d.$family={name:"native"}; 
     
    350350return this;}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(a){this.parent(a);this.headers.extend({Accept:"application/json","X-Request":"JSON"}); 
    351351},success:function(a){this.response.json=JSON.decode(a,this.options.secure);this.onSuccess(this.response.json,a);}}); 
    352 //MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2009 Aaron Newton <http://clientcide.com/>, Valerio Proietti <http://mad4milk.net> & the MooTools team <http://mootools.net/developers>, MIT Style License. 
     352/*MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2009 Aaron Newton <http://clientcide.com/>, Valerio Proietti <http://mad4milk.net> & the MooTools team <http://mootools.net/developers>, MIT Style License.*/ 
    353353MooTools.More={version:"1.2.2.2"};(function(){var a={language:"en-US",languages:{"en-US":{}},cascades:["en-US"]};var b;MooTools.lang=new Events();$extend(MooTools.lang,{setLanguage:function(c){if(!a.languages[c]){return this; 
    354354}a.language=c;this.load();this.fireEvent("langChange",c);return this;},load:function(){var c=this.cascade(this.getCurrentLanguage());b={};$each(c,function(e,d){b[d]=this.lambda(e); 
     
    903903                this.messages['Getting category'] = "Récupération de la catégorie"; 
    904904            break; 
    905             case 'en_US': // don't need here, messages are by default in english 
     905            case 'en_US': /* don't need here, messages are by default in english */ 
    906906            break; 
    907907            default: 
     
    10151015        var sizeParent = p.getParent().getSize(); 
    10161016        var size = p.getSize(); 
    1017         // need to resize dynamicly the div 
     1017        /* need to resize dynamicly the div*/ 
    10181018        imgObj.addEvent('load', function() { 
    10191019            obj.set('title', url); 
    1020             obj.set('target', '_blank'); // burk 
     1020            obj.set('target', '_blank'); /* burk */ 
    10211021            obj.onclick = function() { this.set('href', url); }; 
    10221022            p.getParent().setStyle('height', sizeParent.y + (p.getSize().y - size.y)); 
     
    10441044                    var id = el.get('id').split('_'); 
    10451045                    var element = $('new__'+id[1]+'_'+id[2]+'_'+id[3]); 
    1046                     if(!element) {return false;} // hu ? 
     1046                    if(!element) {return false;} /* hu ? */ 
    10471047                    if(!element.get('html').trim()) { 
    10481048                        if($('new_abstract_'+id[1])) { $('new_abstract_'+id[1]).addClass('hidden'); } 
     
    11071107                        tpl.empty(); 
    11081108                        tpl.set('html', response.contents); 
     1109                        /* evaluating js from response, with pseudo security to exec only owr js */ 
     1110                        tpl.getElements('script[data-owr=plugins]').each(function(e) { 
     1111                           $exec(e.text); 
     1112                        }); 
    11091113                    } 
    11101114                    if(response.unreads) { 
     
    11231127                        tpl.empty(); 
    11241128                        tpl.set('html', response); 
     1129                        /* evaluating js from response, with pseudo security to exec only owr js */ 
     1130                        tpl.getElements('script[data-owr=plugins]').each(function(e) { 
     1131                           $exec(e.text); 
     1132                        }); 
    11251133                    } 
    11261134                } 
    11271135                if(response.unreads) { 
    11281136                    this.getUnread(response.unreads); 
     1137 
    11291138                } 
    11301139            } 
     
    11731182                if(!ok) { 
    11741183                    var element = new Element('option', {'value':contents.id}); 
    1175                     element.appendText(v); // DO NOT USE element.set('html', v) FOR SECURITY REASON 
     1184                    element.appendText(v); /* DO NOT USE element.set('html', v) FOR SECURITY REASON */ 
    11761185                    element.inject(item); 
    11771186                } 
     
    16051614            if(!element) { 
    16061615                var e = $('stream_'+id); 
    1607                 if(!e) { return; } // hu ? 
     1616                if(!e) { return; } /* hu ? */ 
    16081617                e.adopt(new Element('ul', {'id': 'streamContainer_'+id, 'class': 'stream_more'})); 
    16091618            } 
     
    16441653        if(isLoading) { 
    16451654            if(!this.isLoading) { 
    1646                 $('logo').set('src', './images/images.php?f=owr_loading.gif'); 
     1655                $('logo').set('src', './display.php?f=owr_loading.gif'); 
    16471656            } 
    16481657            ++this.isLoading; 
     
    16521661            } 
    16531662            if(!this.isLoading) { 
    1654                 $('logo').set('src', './images/images.php?f=owr_50_50.png'); 
     1663                $('logo').set('src', './display.php?f=owr_50_50.png'); 
    16551664            } 
    16561665            if($chk(ind)) { 
     
    17801789            this.loading(false, n); 
    17811790            this.parseResponse(json); 
    1782             if(this.currentId === 0 && id === 0) { // unread news page, asked for mark all news as (un)read 
     1791            if(this.currentId === 0 && id === 0) { /* unread news page, asked for mark all news as (un)read */ 
    17831792                $('body_container').empty(); 
    17841793                this.pageOffset = 0; 
     
    21312140        $('logs').adopt(li); 
    21322141        if(this.nbLogsLine>3) { 
    2133             // TODO : without Fx.Scroll (useless here, often launched) 
     2142            /* TODO : without Fx.Scroll (useless here, often launched) */ 
    21342143            var s = new Fx.Scroll($('logs_container'), { 
    21352144                duration: 1 
     
    23162325                $('new_details_'+id).toggle(); 
    23172326                el.status = 1; 
    2318                 addthis.button('#addthis_'+id, {'ui_cobrand': 'OWR', 'data_use_cookies':false, 'data_use_flash':false}); 
    23192327            }.bindWithEvent(this, [n, obj, id])); 
    23202328            r.get({'do': 'getnewdetails', 'id': id}); 
  • OWR/Includes/Themes/Original/tpl/blocks/post_details.html

    r7c60cc re02cc4  
    1 <div class="apis"> 
    2     <a id="addthis_<?php echo $id;?>" href="javascript:;" addthis:url="<?php echo $url;?>" addthis:title="<?php echo $title;?>"><img src="http://s7.addthis.com/static/btn/sm-bookmark-en.gif" width="83" height="16" alt="Bookmark" style="border:0"/></a> 
    3 </div> 
    41<?php echo $this->_utilities->makeList((array)$details, 'new_details');?> 
  • OWR/Includes/Themes/Original/tpl/blocks/user.html

    rde92cf re02cc4  
    4848?> 
    4949        </select> 
     50        <label for="config_plugins"><?php echo $this->_utilities->_('Plugins');?>&nbsp;:</label> 
     51        <select name="config[plugins]" id="config_plugins" multiple="multiple"> 
     52<?php 
     53        foreach($plugins as $plugin => $selected) 
     54        { 
     55            echo '<option value="' . $plugin . '"' . ($selected ? ' selected="selected"' : '') . '>' . $plugin . '</option>'; 
     56        } 
     57?> 
     58        </select> 
    5059        <label for="config_blockimg"><?php echo $this->_utilities->_('Block images with javascript');?> (*)&nbsp;:</label> 
    5160        <input type="checkbox" name="config[blockimg]" id="config_blockimg"<?php if(!empty($config['blockimg'])) { echo ' checked="checked"';}?>/> 
  • OWR/Includes/Themes/Original/tpl/index.html

    rf06576 re02cc4  
    11<!DOCTYPE html> 
    2 <html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo $htmllang;?>" xml:lang="<?php echo $xmllang;?>" xmlns:addthis="http://www.addthis.com/help/api-spec"> 
     2<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo $htmllang;?>" xml:lang="<?php echo $xmllang;?>"> 
    33    <head> 
    44<?php   $this->renderBlocks('head'); ?> 
Note: See TracChangeset for help on using the changeset viewer.