Dotclear

Changeset 2825


Ignore:
Timestamp:
01/03/11 16:05:18 (13 years ago)
Author:
JcDenis
Message:

joliprint 0.2

  • Changed pictures path and added some buttons style
  • Enable widget on all posts context
  • Added public page to clean post before parse to PDF
Location:
plugins/joliprint
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • plugins/joliprint/_admin.php

    r2807 r2825  
    33# This file is part of joliprint, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2010 JC Denis and contributors 
     5# Copyright (c) 2009-2011 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
  • plugins/joliprint/_define.php

    r2807 r2825  
    33# This file is part of joliprint, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2010 JC Denis and contributors 
     5# Copyright (c) 2009-2011 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    1717     /* Description*/         "Add button to turn articles into pdf", 
    1818     /* Author */             "JC Denis", 
    19      /* Version */            '0.1', 
     19     /* Version */            '0.2', 
    2020     /* Permissions */        'admin' 
    2121); 
    22      /* date */          #20101219 
     22     /* date */          #20110103 
    2323?> 
  • plugins/joliprint/_prepend.php

    r2807 r2825  
    33# This file is part of joliprint, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2010 JC Denis and contributors 
     5# Copyright (c) 2009-2011 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    1313if (!defined('DC_RC_PATH')){return;} 
    1414 
    15 global $__autoload; 
     15global $__autoload, $core; 
    1616 
    1717$__autoload['joliprint'] = dirname(__FILE__).'/inc/class.joliprint.php'; 
     18 
     19$core->url->register('joliprint','joliprint','^joliprint/(.+)$',array('joliprintUrl','joliprint')); 
    1820?> 
  • plugins/joliprint/_public.php

    r2807 r2825  
    33# This file is part of joliprint, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2010 JC Denis and contributors 
     5# Copyright (c) 2009-2011 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    2020 
    2121# behaviors 
    22 $core->addBehavior('publicHeadContent',array('joliprintPublic','publicheadContent')); 
    23 $core->addBehavior('publicEntryBeforeContent',array('joliprintPublic','publicEntryBeforeContent')); 
    24 $core->addBehavior('publicEntryAfterContent',array('joliprintPublic','publicEntryAfterContent')); 
     22$core->addBehavior('publicHeadContent',array('joliprintBhv','publicheadContent')); 
     23$core->addBehavior('publicEntryBeforeContent',array('joliprintBhv','publicEntryBeforeContent')); 
     24$core->addBehavior('publicEntryAfterContent',array('joliprintBhv','publicEntryAfterContent')); 
    2525 
    2626# Template 
    2727$core->tpl->addValue('joliprintButton',array('joliprintTpl','joliprintButton')); 
    2828 
    29 class joliprintPublic 
     29# Tpl 
     30$core->tpl->setPath($core->tpl->getPath(),dirname(__FILE__).'/default-templates'); 
     31 
     32class joliprintBhv 
    3033{ 
    3134     public static function publicHeadContent($core) 
     
    8487          # Params 
    8588          $params = array(); 
    86           $params['url'] = $_ctx->posts->getURL(); 
     89          if ($s->btn_cleanpost) { 
     90               $params['url'] = $core->blog->url.$core->url->getBase('joliprint').'/'.$core->getPostPublicURL($_ctx->posts->post_type,html::sanitizeURL($_ctx->posts->post_url)); 
     91          } 
     92          else { 
     93               $params['url'] = $_ctx->posts->getURL(); 
     94          } 
    8795          $params['server'] = (string) $s->btn_server; 
    8896          $params['button'] = (string) $s->btn_button; 
     
    97105} 
    98106 
     107class joliprintUrl extends dcUrlHandlers 
     108{ 
     109     public static function joliprint($args) 
     110     { 
     111          if ($args == '') { 
     112               # No entry was specified. 
     113               self::p404(); 
     114          } 
     115          elseif (!preg_match('#^([^/]+)/(.*)$#',$args,$m)) 
     116          { 
     117               self::p404(); 
     118          } 
     119          else 
     120          { 
     121               $_ctx =& $GLOBALS['_ctx']; 
     122               $core =& $GLOBALS['core']; 
     123                
     124               $core->blog->withoutPassword(false); 
     125                
     126               $params = new ArrayObject(); 
     127               $params['post_type'] = $m[1]; 
     128               $params['post_url'] = $m[2]; 
     129                
     130               $_ctx->posts = $core->blog->getPosts($params); 
     131                
     132               $_ctx->comment_preview = new ArrayObject(); 
     133               $_ctx->comment_preview['content'] = ''; 
     134               $_ctx->comment_preview['rawcontent'] = ''; 
     135               $_ctx->comment_preview['name'] = ''; 
     136               $_ctx->comment_preview['mail'] = ''; 
     137               $_ctx->comment_preview['site'] = ''; 
     138               $_ctx->comment_preview['preview'] = false; 
     139               $_ctx->comment_preview['remember'] = false; 
     140                
     141               $core->blog->withoutPassword(true); 
     142                
     143               if ($_ctx->posts->isEmpty()) 
     144               { 
     145                    # The specified entry does not exist. 
     146                    self::p404(); 
     147               } 
     148               else 
     149               { 
     150                    $post_id = $_ctx->posts->post_id; 
     151                    $post_password = $_ctx->posts->post_password; 
     152                     
     153                    # Password protected entry 
     154                    if ($post_password != '' && !$_ctx->preview) 
     155                    { 
     156                         # Get passwords cookie 
     157                         if (isset($_COOKIE['dc_passwd'])) { 
     158                              $pwd_cookie = unserialize($_COOKIE['dc_passwd']); 
     159                         } else { 
     160                              $pwd_cookie = array(); 
     161                         } 
     162                          
     163                         # Check for match 
     164                         if ((!empty($_POST['password']) && $_POST['password'] == $post_password) 
     165                         || (isset($pwd_cookie[$post_id]) && $pwd_cookie[$post_id] == $post_password)) 
     166                         { 
     167                              $pwd_cookie[$post_id] = $post_password; 
     168                              setcookie('dc_passwd',serialize($pwd_cookie),0,'/'); 
     169                         } 
     170                         else 
     171                         { 
     172                              self::serveDocument('password-form.html','text/html',false); 
     173                              return; 
     174                         } 
     175                    } 
     176                     
     177                    # The entry 
     178                    self::serveDocument('joliprint.html'); 
     179               } 
     180          } 
     181     } 
     182} 
     183 
    99184class joliprintTpl 
    100185{ 
     
    112197          } 
    113198          elseif ($_ctx->exists('posts')) { 
    114                $res .= "\$joliprint_params['url'] = \$_ctx->posts->getURL(); \n"; 
     199               $res .= "\$joliprint_params['url'] = \$core->blog->settings->joliprint->btn_cleanpost ? \n"; 
     200               $res .= " \$core->blog->url.\$core->url->getBase('joliprint').'/'.\$core->getPostPublicURL(\$_ctx->posts->post_type,html::sanitizeURL(\$_ctx->posts->post_url)) : \n"; 
     201               $res .= " \$_ctx->posts->getURL(); } \n"; 
    115202          } 
    116203          else { 
  • plugins/joliprint/_widgets.php

    r2807 r2825  
    33# This file is part of joliprint, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2010 JC Denis and contributors 
     5# Copyright (c) 2009-2011 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    4444          if (!$s->active) { return; } 
    4545           
    46           if ('post.html' != $_ctx->current_tpl) { return; } 
    47           $params['url'] = $_ctx->posts->getURL(); 
     46          if (!$_ctx->exists('posts')) { return; } 
     47           
     48          $params['url'] = $s->btn_cleanpost ? 
     49               $core->blog->url.$core->url->getBase('joliprint').'/'.$core->getPostPublicURL($_ctx->posts->post_type,html::sanitizeURL($_ctx->posts->post_url)) : 
     50               $_ctx->posts->getURL(); 
    4851           
    4952          $params['button'] = $w->button; 
  • plugins/joliprint/inc/class.joliprint.php

    r2807 r2825  
    33# This file is part of joliprint, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2010 JC Denis and contributors 
     5# Copyright (c) 2009-2011 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    1818     public static $api_path = 'api/rest/url/'; 
    1919     # URL path of joliprint buttons 
    20      public static $api_res = 'res/joliprint/img/buttons/default/'; 
     20     public static $api_res = 'buttons/'; 
    2121      
    2222     # Available button pictures 
     
    2424     { 
    2525          return array( 
     26               __('Big') => 'joliprint-button-big.png', 
    2627               __('Button') => 'joliprint-button.png', 
    27                __('Button big') => 'joliprint-button-big.png', 
    2828               __('Icon') => 'joliprint-icon.png', 
    29                __('Icon small') => 'joliprint-icon-small.png', 
    30                __('Icon pdf') => 'pdf-icone.gif' 
     29               __('Share button') => 'joliprint-share-button.png', 
     30               __('Share style') => 'joliprint-share-style.png', 
     31               __('Colored icon') => 'joliprint-button-both.png', 
     32               __('Black icon') => 'joliprint-icon-small.png', 
     33               __('PDF icon') => 'pdf-icone.gif' 
    3134          ); 
    3235     } 
  • plugins/joliprint/index.php

    r2807 r2825  
    33# This file is part of joliprint, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2010 JC Denis and contributors 
     5# Copyright (c) 2009-2011 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    5252 
    5353$active = (boolean) $s->active; 
     54$btn_cleanpost = (boolean) $s->btn_cleanpost; 
    5455$btn_place = (string) $s->btn_place; 
    5556if (!in_array($btn_place,$places)) $btn_place = 'after'; 
     
    7172     { 
    7273          $active = !empty($_POST['active']); 
     74          $btn_cleanpost = !empty($_POST['btn_cleanpost']); 
    7375          $btn_place = (string) $_POST['btn_place']; 
    7476          $btn_button = (string) $_POST['btn_button']; 
     
    7981           
    8082          $s->put('active',$active); 
     83          $s->put('btn_cleanpost',$btn_cleanpost); 
    8184          $s->put('btn_place',$btn_place); 
    8285          $s->put('btn_button',$btn_button); 
     
    169172form::textarea(array('btn_css'),164,10,$btn_css,'maximal').'</label></p> 
    170173<p class="form-note">'.__('This button is placed in HTML tag "div" of class "postjoliprint".').'</p> 
     174<h4>'.__('Compatibility:').'</h4> 
     175<p><label class="classic">'. 
     176form::checkbox(array('btn_cleanpost'),'1',$btn_cleanpost). 
     177__('Enable usage of a clean version of post').'</label></p> 
     178<p class="form-note">'.__('This can help if some extensions are not correctly transcribed in PDF.').'</p> 
    171179</fieldset> 
    172180 
  • plugins/joliprint/js/joliprint.js

    r2807 r2825  
    22 * This file is part of joliprint, a plugin for Dotclear 2. 
    33 *  
    4  * Copyright (c) 2010 JC Denis and contributors 
     4 * Copyright (c) 2009-2011 JC Denis and contributors 
    55 * jcdenis@gdwd.com 
    66 *  
  • plugins/joliprint/locales/en/help/help.html

    r2807 r2825  
    4141<p>L'extension doit être activée dans la page d'administration du plugin.</p> 
    4242 
     43<h3>Compatibilité</h3> 
     44<p>Certaines extensions de Dotclear sont mal retranscrites par le service Joliprint, si vous activez le mode de compatibilité,  
     45Joliprint utilisera une version d'un article dépourvue de tous les plugins.</p> 
     46 
    4347<h3>Support</h3> 
    4448<p>Si vous souhaitez plus d'aide ou apporter votre contribution à cette extension, voici quelques liens utiles.</p> 
  • plugins/joliprint/locales/fr/help/help.html

    r2807 r2825  
    4141<p>L'extension doit être activée dans la page d'administration du plugin.</p> 
    4242 
     43<h3>Compatibilité</h3> 
     44<p>Certaines extensions de Dotclear sont mal retranscrites par le service Joliprint, si vous activez le mode de compatibilité,  
     45Joliprint utilisera une version d'un article dépourvue de tous les plugins.</p> 
     46 
    4347<h3>Support</h3> 
    4448<p>Si vous souhaitez plus d'aide ou apporter votre contribution à cette extension, voici quelques liens utiles.</p> 
  • plugins/joliprint/locales/fr/main.lang.php

    r2807 r2825  
    11<?php 
    22// Language: Français  
    3 // Module: joliprint - 0.1 
    4 // Date: 2010-12-19 12:25:26  
     3// Module: joliprint - 0.2 
     4// Date: 2011-01-03 14:55:21  
    55// Translated with dcTranslater - 1.5  
    66 
    77#_widgets.php:28 
    8 #index.php:131 
     8#index.php:134 
    99$GLOBALS['__l10n']['Picture:'] = 'Image :'; 
    1010 
    1111#_widgets.php:34 
    12 #index.php:146 
     12#index.php:149 
    1313$GLOBALS['__l10n']['Country:'] = 'Province :'; 
    1414 
    1515#inc/class.joliprint.php:26 
    16 #index.php:130 
    17 $GLOBALS['__l10n']['Button'] = 'Bouton'; 
     16$GLOBALS['__l10n']['Big'] = 'Grand'; 
    1817 
    1918#inc/class.joliprint.php:27 
    20 $GLOBALS['__l10n']['Button big'] = 'Gros bouton'; 
     19#index.php:133 
     20$GLOBALS['__l10n']['Button'] = 'Bouton'; 
    2121 
    2222#inc/class.joliprint.php:28 
     
    2424 
    2525#inc/class.joliprint.php:29 
    26 $GLOBALS['__l10n']['Icon small'] = 'Petite icône'; 
     26$GLOBALS['__l10n']['Share button'] = 'Bouton de partage'; 
    2727 
    2828#inc/class.joliprint.php:30 
    29 $GLOBALS['__l10n']['Icon pdf'] = 'Icône PDF'; 
     29$GLOBALS['__l10n']['Share style'] = 'Style partage'; 
    3030 
    31 #inc/class.joliprint.php:81 
    32 #inc/class.joliprint.php:118 
     31#inc/class.joliprint.php:31 
     32$GLOBALS['__l10n']['Colored icon'] = 'Icône colorée'; 
     33 
     34#inc/class.joliprint.php:32 
     35$GLOBALS['__l10n']['Black icon'] = 'Icône noire'; 
     36 
     37#inc/class.joliprint.php:33 
     38$GLOBALS['__l10n']['PDF icon'] = 'Icône PDF'; 
     39 
     40#inc/class.joliprint.php:84 
     41#inc/class.joliprint.php:121 
    3342$GLOBALS['__l10n']['print with Joliprint'] = 'Imprimer avec Joliprint'; 
    3443 
     
    6372$GLOBALS['__l10n']['Both'] = 'Les deux'; 
    6473 
    65 #index.php:100 
     74#index.php:103 
    6675$GLOBALS['__l10n']['Configuration successfully saved'] = 'Configuration sauvegardée avec succès'; 
    6776 
    68 #index.php:109 
     77#index.php:112 
    6978$GLOBALS['__l10n']['Please wait'] = 'Veuillez patienter'; 
    7079 
    71 #index.php:124 
     80#index.php:127 
    7281$GLOBALS['__l10n']['Plugin activation'] = 'Activation de l\'extension'; 
    7382 
    74 #index.php:127 
     83#index.php:130 
    7584$GLOBALS['__l10n']['Enable extension'] = 'Activer l\'extension'; 
    7685 
    77 #index.php:145 
     86#index.php:148 
    7887$GLOBALS['__l10n']['This text is placed after icon only and on mouseover.'] = 'Ce text est placé après l\'icône seulement et au survole.'; 
    7988 
    80 #index.php:153 
     89#index.php:156 
    8190$GLOBALS['__l10n']['Show on posts from:'] = 'Afficher sur les billets de :'; 
    8291 
    83 #index.php:163 
     92#index.php:166 
    8493$GLOBALS['__l10n']['Place:'] = 'Emplacement :'; 
    8594 
    86 #index.php:167 
     95#index.php:170 
    8796$GLOBALS['__l10n']['Additionnal style sheet:'] = 'Feuille de style additionnelle :'; 
    8897 
    89 #index.php:170 
     98#index.php:173 
    9099$GLOBALS['__l10n']['This button is placed in HTML tag "div" of class "postjoliprint".'] = 'Ce bouton est placé dans une balise HTML "div" de classe "postjoliprint"'; 
    91100 
     101#index.php:174 
     102$GLOBALS['__l10n']['Compatibility:'] = 'Compatibilité :'; 
     103 
     104#index.php:177 
     105$GLOBALS['__l10n']['Enable usage of a clean version of post'] = 'Utiliser la version allégée d\'un billet'; 
     106 
     107#index.php:178 
     108$GLOBALS['__l10n']['This can help if some extensions are not correctly transcribed in PDF.'] = 'Ceci peut aider si des extensions ne sont pas correctement transcrites en PDF.'; 
     109 
    92110?> 
  • plugins/joliprint/locales/fr/main.po

    r2807 r2825  
    11# Language: Français 
    2 # Module: joliprint - 0.1 
    3 # Date: 2010-12-19 12:25:26 
     2# Module: joliprint - 0.2 
     3# Date: 2011-01-03 14:55:21 
    44# Translated with translater 1.5 
    55 
     
    77msgstr "" 
    88"Content-Type: text/plain; charset=UTF-8\n" 
    9 "Project-Id-Version: joliprint 0.1\n" 
     9"Project-Id-Version: joliprint 0.2\n" 
    1010"POT-Creation-Date: \n" 
    11 "PO-Revision-Date: 2010-12-19T12:25:26+00:00\n" 
     11"PO-Revision-Date: 2011-01-03T14:55:21+00:00\n" 
    1212"Last-Translator: JC Denis\n" 
    1313"Language-Team: \n" 
     
    1616 
    1717#: _widgets.php:28 
    18 #: index.php:131 
     18#: index.php:134 
    1919msgid "Picture:" 
    2020msgstr "Image :" 
    2121 
    2222#: _widgets.php:34 
    23 #: index.php:146 
     23#: index.php:149 
    2424msgid "Country:" 
    2525msgstr "Province :" 
    2626 
    2727#: inc/class.joliprint.php:26 
    28 #: index.php:130 
     28msgid "Big" 
     29msgstr "Grand" 
     30 
     31#: inc/class.joliprint.php:27 
     32#: index.php:133 
    2933msgid "Button" 
    3034msgstr "Bouton" 
    31  
    32 #: inc/class.joliprint.php:27 
    33 msgid "Button big" 
    34 msgstr "Gros bouton" 
    3535 
    3636#: inc/class.joliprint.php:28 
     
    3939 
    4040#: inc/class.joliprint.php:29 
    41 msgid "Icon small" 
    42 msgstr "Petite icône" 
     41msgid "Share button" 
     42msgstr "Bouton de partage" 
    4343 
    4444#: inc/class.joliprint.php:30 
    45 msgid "Icon pdf" 
     45msgid "Share style" 
     46msgstr "Style partage" 
     47 
     48#: inc/class.joliprint.php:31 
     49msgid "Colored icon" 
     50msgstr "Icône colorée" 
     51 
     52#: inc/class.joliprint.php:32 
     53msgid "Black icon" 
     54msgstr "Icône noire" 
     55 
     56#: inc/class.joliprint.php:33 
     57msgid "PDF icon" 
    4658msgstr "Icône PDF" 
    4759 
    48 #: inc/class.joliprint.php:81 
    49 #: inc/class.joliprint.php:118 
     60#: inc/class.joliprint.php:84 
     61#: inc/class.joliprint.php:121 
    5062msgid "print with Joliprint" 
    5163msgstr "Imprimer avec Joliprint" 
     
    91103msgstr "Les deux" 
    92104 
    93 #: index.php:100 
     105#: index.php:103 
    94106msgid "Configuration successfully saved" 
    95107msgstr "Configuration sauvegardée avec succès" 
    96108 
    97 #: index.php:109 
     109#: index.php:112 
    98110msgid "Please wait" 
    99111msgstr "Veuillez patienter" 
    100112 
    101 #: index.php:124 
     113#: index.php:127 
    102114msgid "Plugin activation" 
    103115msgstr "Activation de l'extension" 
    104116 
    105 #: index.php:127 
     117#: index.php:130 
    106118msgid "Enable extension" 
    107119msgstr "Activer l'extension" 
    108120 
    109 #: index.php:145 
     121#: index.php:148 
    110122msgid "This text is placed after icon only and on mouseover." 
    111123msgstr "Ce text est placé après l'icône seulement et au survole." 
    112124 
    113 #: index.php:153 
     125#: index.php:156 
    114126msgid "Show on posts from:" 
    115127msgstr "Afficher sur les billets de :" 
    116128 
    117 #: index.php:163 
     129#: index.php:166 
    118130msgid "Place:" 
    119131msgstr "Emplacement :" 
    120132 
    121 #: index.php:167 
     133#: index.php:170 
    122134msgid "Additionnal style sheet:" 
    123135msgstr "Feuille de style additionnelle :" 
    124136 
    125 #: index.php:170 
     137#: index.php:173 
    126138msgid "This button is placed in HTML tag \"div\" of class \"postjoliprint\"." 
    127139msgstr "Ce bouton est placé dans une balise HTML \"div\" de classe \"postjoliprint\"" 
    128140 
     141#: index.php:174 
     142msgid "Compatibility:" 
     143msgstr "Compatibilité :" 
     144 
     145#: index.php:177 
     146msgid "Enable usage of a clean version of post" 
     147msgstr "Utiliser la version allégée d'un billet" 
     148 
     149#: index.php:178 
     150msgid "This can help if some extensions are not correctly transcribed in PDF." 
     151msgstr "Ceci peut aider si des extensions ne sont pas correctement transcrites en PDF." 
     152 
  • plugins/joliprint/release.txt

    r2807 r2825  
     10.2 20110103 
     2 * Changed pictures path and added some buttons style 
     3 * Enable widget on all posts context 
     4 * Added public page to clean post before parse to PDF 
     5 
    160.1 20101219 
    27 * First public release (closes #620) 
Note: See TracChangeset for help on using the changeset viewer.

Sites map