Dotclear

Changeset 2295


Ignore:
Timestamp:
06/05/10 18:59:11 (13 years ago)
Author:
Moe
Message:

Popularity Contest 1.4 :

  • added data in XML file :
    • display plugins URLs
    • display global results
  • added CSS rules, from the popcon website
  • make xml/ directory
  • switched to GPL v2
Location:
plugins/popularityContest
Files:
1 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • plugins/popularityContest/_admin.php

    r1569 r2295  
    22# ***** BEGIN LICENSE BLOCK ***** 
    33# 
    4 # This file is part of Popularity Contest. 
    5 # Copyright 2007,2009 Moe (http://gniark.net/) 
     4# This file is part of Popularity Contest, a plugin for Dotclear 2 
     5# Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 
    66# 
    7 # Popularity Contest is free software; you can redistribute it and/or modify 
    8 # it under the terms of the GNU General Public License as published by 
    9 # the Free Software Foundation; either version 3 of the License, or 
    10 # (at your option) any later version. 
     7# Popularity Contest is free software; you can redistribute it and/or 
     8# modify it under the terms of the GNU General Public License v2.0 
     9# as published by the Free Software Foundation. 
    1110# 
    1211# Popularity Contest is distributed in the hope that it will be useful, 
    1312# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1514# GNU General Public License for more details. 
    1615# 
    17 # You should have received a copy of the GNU General Public License 
    18 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16# You should have received a copy of the GNU General Public 
     17# License along with this program. If not, see 
     18# <http://www.gnu.org/licenses/>. 
    1919# 
    20 # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     20# Icon (icon.png) and images are from Silk Icons : 
     21# <http://www.famfamfam.com/lab/icons/silk/> 
    2122# 
    2223# ***** END LICENSE BLOCK ***** 
  • plugins/popularityContest/_define.php

    r1577 r2295  
    22# ***** BEGIN LICENSE BLOCK ***** 
    33# 
    4 # This file is part of Popularity Contest. 
    5 # Copyright 2007,2009 Moe (http://gniark.net/) 
     4# This file is part of Popularity Contest, a plugin for Dotclear 2 
     5# Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 
    66# 
    7 # Popularity Contest is free software; you can redistribute it and/or modify 
    8 # it under the terms of the GNU General Public License as published by 
    9 # the Free Software Foundation; either version 3 of the License, or 
    10 # (at your option) any later version. 
     7# Popularity Contest is free software; you can redistribute it and/or 
     8# modify it under the terms of the GNU General Public License v2.0 
     9# as published by the Free Software Foundation. 
    1110# 
    1211# Popularity Contest is distributed in the hope that it will be useful, 
    1312# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1514# GNU General Public License for more details. 
    1615# 
    17 # You should have received a copy of the GNU General Public License 
    18 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16# You should have received a copy of the GNU General Public 
     17# License along with this program. If not, see 
     18# <http://www.gnu.org/licenses/>. 
    1919# 
    20 # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     20# Icon (icon.png) and images are from Silk Icons : 
     21# <http://www.famfamfam.com/lab/icons/silk/> 
    2122# 
    2223# ***** END LICENSE BLOCK ***** 
     
    2829        /* Description*/                "Dotclear Popularity Contest (http://popcon.gniark.net/)", 
    2930        /* Author */                    "Moe (http://gniark.net/)", 
    30         /* Version */                   '1.3', 
     31        /* Version */                   '1.4', 
    3132        /* Permissions */               null 
    3233); 
  • plugins/popularityContest/_install.php

    r1577 r2295  
    22# ***** BEGIN LICENSE BLOCK ***** 
    33# 
    4 # This file is part of Popularity Contest. 
    5 # Copyright 2007,2009 Moe (http://gniark.net/) 
     4# This file is part of Popularity Contest, a plugin for Dotclear 2 
     5# Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 
    66# 
    7 # Popularity Contest is free software; you can redistribute it and/or modify 
    8 # it under the terms of the GNU General Public License as published by 
    9 # the Free Software Foundation; either version 3 of the License, or 
    10 # (at your option) any later version. 
     7# Popularity Contest is free software; you can redistribute it and/or 
     8# modify it under the terms of the GNU General Public License v2.0 
     9# as published by the Free Software Foundation. 
    1110# 
    1211# Popularity Contest is distributed in the hope that it will be useful, 
    1312# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1514# GNU General Public License for more details. 
    1615# 
    17 # You should have received a copy of the GNU General Public License 
    18 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     16# You should have received a copy of the GNU General Public 
     17# License along with this program. If not, see 
     18# <http://www.gnu.org/licenses/>. 
    1919# 
    20 # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     20# Icon (icon.png) and images are from Silk Icons : 
     21# <http://www.famfamfam.com/lab/icons/silk/> 
    2122# 
    2223# ***** END LICENSE BLOCK ***** 
     
    5657$core->blog->settings->setNameSpace('system'); 
    5758 
     59# remove the file to force its update 
     60if (file_exists(dirname(__FILE__).'/xml/plugins.xml')) 
     61{ 
     62     unlink(dirname(__FILE__).'/xml/plugins.xml'); 
     63} 
     64 
    5865# La procédure d'installation commence vraiment là 
    5966$core->setVersion('popularityContest',$m_version); 
  • plugins/popularityContest/inc/lib.popularityContest.php

    r1779 r2295  
    22# ***** BEGIN LICENSE BLOCK ***** 
    33# 
    4 # This file is part of Popularity Contest. 
    5 # Copyright 2007,2009 Moe (http://gniark.net/) 
    6 # 
    7 # Popularity Contest is free software; you can redistribute it and/or modify 
    8 # it under the terms of the GNU General Public License as published by 
    9 # the Free Software Foundation; either version 3 of the License, or 
    10 # (at your option) any later version. 
     4# This file is part of Popularity Contest, a plugin for Dotclear 2 
     5# Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 
     6# 
     7# Popularity Contest is free software; you can redistribute it and/or 
     8# modify it under the terms of the GNU General Public License v2.0 
     9# as published by the Free Software Foundation. 
    1110# 
    1211# Popularity Contest is distributed in the hope that it will be useful, 
    1312# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1514# GNU General Public License for more details. 
    1615# 
    17 # You should have received a copy of the GNU General Public License 
    18 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
    19 # 
    20 # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     16# You should have received a copy of the GNU General Public 
     17# License along with this program. If not, see 
     18# <http://www.gnu.org/licenses/>. 
     19# 
     20# Icon (icon.png) and images are from Silk Icons : 
     21# <http://www.famfamfam.com/lab/icons/silk/> 
    2122# 
    2223# ***** END LICENSE BLOCK ***** 
     
    2526{ 
    2627     public static $send_url = 'http://popcon.gniark.net/send.php'; 
    27      public static $plugins_xml_url = 'http://popcon.gniark.net/raw.xml'; 
     28     public static $plugins_xml_url = 'http://popcon.gniark.net/raw2.xml'; 
    2829      
    2930     public static function getComboOptions() 
     
    124125          $plugins_XML = self::getPluginsXML(); 
    125126           
    126           $show_popularity = false; 
    127            
    128           if (($plugins_XML !== false)) 
    129           { 
    130                $show_popularity = true; 
    131                 
    132                $attr = $plugins_XML->attributes(); 
    133                 
    134                $plugins_popularity = array(); 
     127          $show_data = false; 
     128           
     129          $plugins_data = array(); 
     130           
     131          if ($plugins_XML !== false) 
     132          { 
     133               $show_data = true; 
    135134                
    136135               # inspired by daInstaller/inc/class.da.modules.parser.php 
     
    140139                     
    141140                    $id = (string) $attrs['id']; 
    142                     $name = (string) $attrs['name']; 
    143                     $popularity = (string) $attrs['popularity']; 
     141                    $name = (string) $p->name; 
     142                    $url = (string) $p->url; 
     143                    $popularity = (int) $p->popularity; 
    144144                     
    145                     $plugins_popularity[$id] = array( 
    146                          'name' => $name, 
     145                    $plugins_data[$id] = array( 
     146                         //'name' => $name, 
     147                         'url' => $url, 
    147148                         'popularity' => $popularity 
    148149                    ); 
     
    166167          $table->header(__('Name'),'class="nowrap"'); 
    167168          $table->header(__('Version'),'class="nowrap"'); 
    168           if ($show_popularity) {$table->header(__('Popularity'),'class="nowrap"');} 
     169          if ($show_data) {$table->header(__('Popularity'),'class="nowrap"');} 
    169170 
    170171          $table->part('body'); 
    171172 
    172           foreach ($array as $k => $v) 
    173           { 
    174                $table->row(); 
     173          foreach ($array as $id => $v) 
     174          { 
     175               $icon = (file_exists($v['root'].'/icon.png')) ?  
     176                    '<img src="index.php?pf='.$id.'/icon.png" style="height:16px;" alt="" />' : ''; 
     177                
     178               $name = $v['name']; 
     179                
     180               $popularity = '&nbsp'; 
     181                
     182               if ($show_data && (isset($plugins_data[$id]))) 
     183               { 
     184                    $url = $plugins_data[$id]['url']; 
     185                     
     186                    if (!empty($url)) 
     187                    { 
     188                         $name = '<a href="'.$url.'">'.$name.'</a>'; 
     189                    } 
     190                     
     191                    if ($plugins_data[$id]['popularity'] >= 0) 
     192                    { 
     193                         $popularity = $plugins_data[$id]['popularity'].' %'; 
     194                    } 
     195               } 
     196                
     197               # display 
     198               $table->row('class="line"'); 
     199                
    175200               if ($editable) 
    176201               { 
    177                     $table->cell(form::checkbox(array('hidden_plugins[]'),$k, 
    178                          in_array($k,$hidden_plugins))); 
    179                } 
    180                $icon = (file_exists($v['root'].'/icon.png')) ?  
    181                     '<img src="index.php?pf='.$k.'/icon.png" style="height:16px;" alt="" />' : ''; 
     202                    $table->cell(form::checkbox(array('hidden_plugins[]'),$id, 
     203                         in_array($id,$hidden_plugins))); 
     204               } 
    182205               $table->cell($icon); 
    183                $table->cell($k); 
    184                $table->cell($v['name']); 
     206               $table->cell($id); 
     207               $table->cell($name); 
    185208               $table->cell($v['version']); 
    186209                
    187                if ($show_popularity) { 
    188                     $popularity = '&nbsp;'; 
    189                     if (array_key_exists($k,$plugins_popularity)) 
    190                     { 
    191                          $popularity = $plugins_popularity[$k]['popularity'].'%'; 
    192                     } 
    193                     $table->cell($popularity); 
     210               if ($show_data) { 
     211                    $table->cell($popularity,'class="right"'); 
    194212               } 
    195213          } 
     
    243261          $dir = dirname($file); 
    244262           
     263          files::makeDir($dir); 
     264           
    245265          if (!is_writable($dir)) 
    246266          { 
     
    270290          } 
    271291     } 
     292      
     293     # create table 
     294     public static function getResultsTable() 
     295     { 
     296          global $core,$hidden_plugins; 
     297 
     298          $plugins_XML = self::getPluginsXML(); 
     299           
     300          if ($plugins_XML === false) {return;} 
     301           
     302          $table = new table('class="clear" summary="'. 
     303               __('Plugins:').'"'); 
     304          $table->part('head'); 
     305          $table->row(); 
     306          $table->header(__('Icon'),'class="nowrap"'); 
     307          $table->header(__('Plugin'),'class="nowrap"'); 
     308          $table->header(__('Name'),'class="nowrap"'); 
     309          $table->header(__('Installed'),'class="nowrap"'); 
     310          $table->header(__('Popularity'),'class="nowrap"'); 
     311 
     312          $table->part('body'); 
     313 
     314          foreach ($plugins_XML->plugin as $plugin) 
     315          { 
     316               $table->row('class="line"'); 
     317                
     318               $attrs = $plugin->attributes(); 
     319                
     320               $id = (string) $attrs['id']; 
     321                
     322               $moduleExists = $core->plugins->moduleExists($id); 
     323                
     324               $icon = ''; 
     325               if ($moduleExists) 
     326               { 
     327                    $icon = '<img src="index.php?pf='.$id.'/icon.png" style="height:16px;" alt="" />'; 
     328               } 
     329                
     330               $name = (string) $plugin->name; 
     331                
     332               $url = (string) $plugin->url; 
     333                
     334               if (!empty($url)) 
     335               { 
     336                    $name =  '<a href="'.$url.'">'.$name.'</a>'; 
     337               } 
     338                
     339               $installed = (($moduleExists) 
     340                    ? '<img src="images/check-on.png" alt="'.__('yes').'" />' 
     341                    : ''); 
     342                
     343               $popularity = (int) $plugin->popularity; 
     344               if ($popularity >= 0) 
     345               { 
     346                    $popularity .= ' %'; 
     347               } 
     348                
     349               # display 
     350               $table->cell($icon,'class="icon"'); 
     351               $table->cell($id); 
     352               $table->cell($name); 
     353               $table->cell($installed); 
     354               $table->cell($popularity,'class="right"'); 
     355          } 
     356 
     357          return($table->get()); 
     358     } 
    272359} 
    273360 
  • plugins/popularityContest/index.php

    r1577 r2295  
    22# ***** BEGIN LICENSE BLOCK ***** 
    33# 
    4 # This file is part of Popularity Contest. 
    5 # Copyright 2007,2009 Moe (http://gniark.net/) 
    6 # 
    7 # Popularity Contest is free software; you can redistribute it and/or modify 
    8 # it under the terms of the GNU General Public License as published by 
    9 # the Free Software Foundation; either version 3 of the License, or 
    10 # (at your option) any later version. 
     4# This file is part of Popularity Contest, a plugin for Dotclear 2 
     5# Copyright (C) 2007,2009,2010 Moe (http://gniark.net/) 
     6# 
     7# Popularity Contest is free software; you can redistribute it and/or 
     8# modify it under the terms of the GNU General Public License v2.0 
     9# as published by the Free Software Foundation. 
    1110# 
    1211# Popularity Contest is distributed in the hope that it will be useful, 
    1312# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1514# GNU General Public License for more details. 
    1615# 
    17 # You should have received a copy of the GNU General Public License 
    18 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
    19 # 
    20 # Icon (icon.png) is from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ 
     16# You should have received a copy of the GNU General Public 
     17# License along with this program. If not, see 
     18# <http://www.gnu.org/licenses/>. 
     19# 
     20# Icon (icon.png) and images are from Silk Icons : 
     21# <http://www.famfamfam.com/lab/icons/silk/> 
    2122# 
    2223# ***** END LICENSE BLOCK ***** 
     
    2829$settings =& $core->blog->settings; 
    2930 
    30 $msg = (string)''; 
    31 $errors = array(); 
     31$msg = ''; 
    3232$tab = 'popularityContest'; 
     33$tab = 'results'; 
    3334 
    3435$time_interval_last_try = 
     
    122123          dcPage::jsLoad('js/filter-controls.js')); 
    123124  ?> 
     125  <style type="text/css"> 
     126     /*tr:hover {background:#eee none;}*/ 
     127          .icon {text-align:center;} 
     128          .default {background:transparent url(/images/template/default.png) repeat;} 
     129          .popularityContest {background:transparent url(/images/template/popularityContest.png) repeat;} 
     130  </style> 
    124131</head> 
    125132<body> 
     
    169176          <p><?php echo $core->formNonce(); ?></p> 
    170177     </form> 
    171      <p><a href="http://popcon.gniark.net/"><?php echo(__('Click here to see results.')); ?></a></p> 
    172      <h2><?php echo(__('Plugins:')); ?></h2> 
     178     <h3><?php echo(__('Installed plugins:')); ?></h3> 
    173179     <?php echo(popularityContest::getPluginsTable()); ?> 
    174180</div> 
     
    196202</div> 
    197203 
     204<div class="multi-part" id="results" title="<?php echo __('results'); ?>"> 
     205     <p><a href="http://popcon.gniark.net/"><?php echo(__('Click here to see results.')); ?></a></p> 
     206     <h3><?php echo(__('Plugins:')); ?></h3> 
     207     <?php echo(popularityContest::getResultsTable()); ?> 
     208</div> 
     209 
    198210</body> 
    199211</html> 
  • plugins/popularityContest/locales/fr/admin.lang.php

    r1574 r2295  
    116116$GLOBALS['__l10n']['Save configuration'] = 'Enregistrer la configuration'; 
    117117 
     118$GLOBALS['__l10n']['results'] = 'résultats'; 
     119 
     120 
    118121?> 
  • plugins/popularityContest/locales/fr/admin.po

    r1779 r2295  
    162162msgstr "Enregistrer la configuration" 
    163163 
     164msgid "results" 
     165msgstr "résultats" 
Note: See TracChangeset for help on using the changeset viewer.

Sites map