diff options
| author | 2013-11-28 18:57:22 +0100 | |
|---|---|---|
| committer | 2013-11-28 18:57:22 +0100 | |
| commit | 3f63195c5f2a5dcb1d11b974dd2357b161e377c5 (patch) | |
| tree | 2fef1672c672ac1d24e171c7d284dd308ce42050 | |
| parent | dc2e1dc0817f0818943647d6b005ea35683c9c1b (diff) | |
Première version pour imprimer les articles
Voir #122
| -rwxr-xr-x | app/controllers/configureController.php | 1 | ||||
| -rw-r--r-- | app/i18n/en.php | 1 | ||||
| -rw-r--r-- | app/i18n/fr.php | 1 | ||||
| -rwxr-xr-x | app/models/RSSConfiguration.php | 3 | ||||
| -rw-r--r-- | app/views/configure/sharing.phtml | 2 | ||||
| -rw-r--r-- | app/views/helpers/view/normal_view.phtml | 7 | ||||
| -rw-r--r-- | public/scripts/main.js | 16 |
7 files changed, 29 insertions, 2 deletions
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index d4a821b66..4c9ceebbc 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -277,6 +277,7 @@ class configureController extends ActionController { 'g+' => Request::param ('g+', 'no') === 'yes', 'facebook' => Request::param ('facebook', 'no') === 'yes', 'email' => Request::param ('email', 'no') === 'yes', + 'print' => Request::param ('print', 'no') === 'yes' )); $confDAO = new RSSConfigurationDAO (); diff --git a/app/i18n/en.php b/app/i18n/en.php index fdfe865f3..4de7bc94d 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -193,6 +193,7 @@ return array ( 'g+' => 'Google+', 'facebook' => 'Facebook', 'email' => 'Email', + 'print' => 'Print', 'article' => 'Article', 'title' => 'Title', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index c2a9a030f..67a3a1836 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -193,6 +193,7 @@ return array ( 'g+' => 'Google+', 'facebook' => 'Facebook', 'email' => 'Courriel', + 'print' => 'Imprimer', 'article' => 'Article', 'title' => 'Titre', diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index 458362586..c36548e6f 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -357,7 +357,8 @@ class RSSConfigurationDAO extends Model_array { 'twitter' => true, 'g+' => true, 'facebook' => true, - 'email' => true + 'email' => true, + 'print' => true ); public $theme = 'default'; public $anon_access = 'no'; diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml index 855b8536e..311910297 100644 --- a/app/views/configure/sharing.phtml +++ b/app/views/configure/sharing.phtml @@ -42,7 +42,7 @@ <label class="group-name"><?php echo Translate::t ('activate_sharing'); ?></label> <div class="group-controls"> <?php - $services = array ('twitter', 'g+', 'facebook', 'email'); + $services = array ('twitter', 'g+', 'facebook', 'email', 'print'); foreach ($services as $service) { ?> diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index 99e4bedc7..1a977bafe 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -21,6 +21,7 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { $google_plus = $this->conf->sharing ('g+'); $facebook = $this->conf->sharing ('facebook'); $email = $this->conf->sharing ('email'); + $print = $this->conf->sharing ('print'); ?> <?php foreach ($items as $item) { ?> @@ -156,6 +157,12 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { <?php echo Translate::t ('by_email'); ?> </a> </li> + <?php } if ($print) { ?> + <li class="item"> + <a href="#" class="print-article"> + <?php echo Translate::t ('print'); ?> + </a> + </li> <?php } ?> </ul> </div> diff --git a/public/scripts/main.js b/public/scripts/main.js index d54937600..c2a3b3912 100644 --- a/public/scripts/main.js +++ b/public/scripts/main.js @@ -623,6 +623,21 @@ function init_confirm_action() { }); } +function init_print_action() { + $('.print-article').click(function () { + + var content = $(".flux.current .content"); + var tmp_window = window.open(); + tmp_window.document.writeln(content.html()); + tmp_window.document.close(); + tmp_window.focus(); + tmp_window.print(); + tmp_window.close(); + + return false; + }); +} + function init_all() { if (!(window.$ && window.url_freshrss && ((!full_lazyload) || $.fn.lazyload))) { if (window.console) { @@ -647,6 +662,7 @@ function init_all() { init_persona(); } init_confirm_action(); + init_print_action(); if (window.console) { console.log('FreshRSS init done.'); } |
