فهرست منبع

Première version pour imprimer les articles

Voir #122
Marien Fressinaud 12 سال پیش
والد
کامیت
3f63195c5f

+ 1 - 0
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 ();

+ 1 - 0
app/i18n/en.php

@@ -193,6 +193,7 @@ return array (
 	'g+'				=> 'Google+',
 	'facebook'			=> 'Facebook',
 	'email'				=> 'Email',
+	'print'				=> 'Print',
 
 	'article'			=> 'Article',
 	'title'				=> 'Title',

+ 1 - 0
app/i18n/fr.php

@@ -193,6 +193,7 @@ return array (
 	'g+'				=> 'Google+',
 	'facebook'			=> 'Facebook',
 	'email'				=> 'Courriel',
+	'print'				=> 'Imprimer',
 
 	'article'			=> 'Article',
 	'title'				=> 'Titre',

+ 2 - 1
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';

+ 1 - 1
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) {
 				?>

+ 7 - 0
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>

+ 16 - 0
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.');
 	}