Переглянути джерело

Finishing touch to the "Printer friendly version" of the details page.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3743 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 9 роки тому
батько
коміт
662ec6f038

+ 0 - 6
application/cmdbabstract.class.inc.php

@@ -183,12 +183,6 @@ EOF
 		{
 			$aIcons[] = '<img src="../images/reload.png" style="cursor:pointer;vertical-align:middle;margin-left:1em;" onclick="window.location.reload();" title="'.htmlentities(Dict::S('UI:Button:Refresh'), ENT_QUOTES, 'UTF-8').'"/>';
 		}
-		if (!$oPage->IsPrintableVersion())
-		{
-			$sPrintableUrl = ApplicationContext::MakeObjectUrl(get_class($this), $this->GetKey()).'&printable=1';
-			//$sPrintModeIcon = '<img src="../images/printableversion.png" style="cursor:pointer;vertical-align:middle;margin-left:1em;" onclick="window.open(\''.$sPrintableUrl.'\', \'printable_version\', \'toolbar=yes,scrollbar=yes\')" title="'.htmlentities(Dict::S('UI:Button:PrintableVersion'), ENT_QUOTES, 'UTF-8').'"/>';
-			$aIcons[] = '<a href="'.$sPrintableUrl.'" target="_blank"><img src="../images/printableversion.png" style="cursor:pointer;vertical-align:middle;margin-left:1em;" title="'.htmlentities(Dict::S('UI:Button:PrintableVersion'), ENT_QUOTES, 'UTF-8').'"/></a>';
-		}
 
 		// Master data sources
 		$bSynchronized = false;

+ 3 - 1
application/itopwebpage.class.inc.php

@@ -776,9 +776,11 @@ EOF
 		if ($this->IsPrintableVersion())
 		{
 			$sHtml .= "<div class=\"explain-printable not-printable\">";
-			$sHtml .= '<p>'.Dict::S('UI:ExplainPrintable').'</p>';
+			$sHtml .= '<p>'.Dict::Format('UI:ExplainPrintable', '<img src="../images/eye-open-555.png" style="vertical-align:middle">').'</p>';
 			$sHtml .= "<div id=\"hiddeable_chapters\"></div>";
 			$sHtml .= '<button onclick="window.print()">'.htmlentities(Dict::S('UI:Button:GoPrint'), ENT_QUOTES, 'UTF-8').'</button>';
+			$sHtml .= '&nbsp;';
+			$sHtml .= '<button onclick="window.close()">'.htmlentities(Dict::S('UI:Button:Cancel'), ENT_QUOTES, 'UTF-8').'</button>';
 			$sHtml .= "</div>";
 		}
 

+ 2 - 0
application/utils.inc.php

@@ -832,6 +832,8 @@ class utils
 				new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), "mailto:?subject=".urlencode($oObj->GetRawName())."&body=".urlencode($sUrl).' '), // Add an extra space to make it work in Outlook
 				new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('$sOQL', '', 'csv', ".json_encode(Dict::S('UI:Menu:CSVExport')).")"),
 				new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")"),
+				new SeparatorPopupMenuItem(),
+				new URLPopupMenuItem('UI:Menu:PrintableVersion', Dict::S('UI:Menu:PrintableVersion'), $sUrl.'&printable=1', '_blank'),
 			);
 			break;
 

+ 11 - 2
core/displayablegraph.class.inc.php

@@ -1297,9 +1297,17 @@ class DisplayableGraph extends SimpleGraph
 		}
 		$oP->add("<div class=\"not-printable\">\n");
 		$oP->add("<div id=\"ds_flash\" class=\"SearchDrawer\" style=\"display:none;\">\n");
-		$oP->add_ready_script(
+		if (!$oP->IsPrintableVersion())
+		{
+			$oP->add_ready_script(
 <<<EOF
 	$( "#tabbedContent_0" ).tabs({ heightStyle: "fill" });
+EOF
+			);
+		}
+		
+		$oP->add_ready_script(
+<<<EOF
 	$("#dh_flash").click( function() {
 		$("#ds_flash").slideToggle('normal', function() { $("#ds_flash").parent().resize(); $("#dh_flash").trigger('toggle_complete'); } );
 		$("#dh_flash").toggleClass('open');
@@ -1368,7 +1376,8 @@ EOF
 			if ($oP->IsPrintableVersion())
 			{
 				// Optimize for printing on A4/Letter vertically
-				$sStyle = 'max-width: 17cm; margin-left:auto; margin-right:auto;';
+				$sStyle = 'margin-left:auto; margin-right:auto;';
+				$oP->add_ready_script("$('.simple-graph').width(18/2.54*96).resizable({ stop: function() { $(window).trigger('resized'); }});"); // Default width about 18 cm, since most browsers assume 96 dpi
 			}
 			$oP->add('<div id="'.$sId.'" class="simple-graph" style="'.$sStyle.'"></div>');
 			$aParams = array(

+ 5 - 0
css/light-grey.css

@@ -2054,6 +2054,11 @@ div.explain-printable {
 }
 
 
+h2.printable-tab-title {
+  border-bottom: 2px solid;
+}
+
+
 .strikethrough {
   text-decoration: line-through;
 }

+ 3 - 0
css/light-grey.scss

@@ -1516,6 +1516,9 @@ div.explain-printable {
 .printable-version fieldset.strikethrough span {
 	display: none;
 }
+h2.printable-tab-title {
+	border-bottom: 2px solid;
+}
 .strikethrough {
 	text-decoration: line-through;
 }

+ 5 - 2
css/print.css

@@ -14,7 +14,6 @@ div.itop-tab { border: #ccc 1px solid; margin-top: 1em; padding-bottom:1em; }
 #combodo_logo { display:none; }
 div.graph_config { display:none; }
 h2.printable-tab-title {
-	border-bottom: 2px solid;
 	page-break-after: avoid;
 }
 div#tabbedContent_0 { border:none; }
@@ -22,4 +21,8 @@ p a, .ui-widget-content td a, p a:hover, .ui-widget-content td a:hover {
 	padding-left: 0;
 	background: transparent;
 }
-body { margin:none; }
+body { margin:none; }
+.printable-tab {
+	-webkit-region-break-inside: avoid;
+	page-break-inside: avoid;
+}

+ 2 - 0
dictionaries/de.dictionary.itop.ui.php

@@ -781,6 +781,7 @@ Wenn Aktionen mit Trigger verknüpft sind, bekommt jede Aktion eine Auftragsnumm
 	'UI:RelationOption:GroupingThreshold' => 'Grouping threshold~~',
 	'UI:Relation:AdditionalContextInfo' => 'Additional context info~~',
 	'UI:Relation:NoneSelected' => 'Nichts~~',
+	'UI:Relation:Zoom' => 'Zoom',
 	'UI:Relation:ExportAsDocument' => 'Export as Document...~~',
 	'UI:Relation:DrillDown' => 'Details...~~',
 	'UI:Relation:PDFExportOptions' => 'PDF Export Options~~',
@@ -1023,6 +1024,7 @@ Wenn Aktionen mit Trigger verknüpft sind, bekommt jede Aktion eine Auftragsnumm
 	'UI:Menu:KillConcurrentLock' => 'Sperre für simultane Änderungen löschen! ',
 	
 	'UI:Menu:ExportPDF' => 'Als PDF exportieren... ',
+	'UI:Menu:PrintableVersion' => 'Druckversion',
 	'Class:UserInternal' => 'Interner Benutzer',
 	'Class:UserInternal+' => 'Benutzer, der innerhalb iTop definiert wird',
 	'UI:Button:Rename' => 'Umbenennen... ',

+ 2 - 2
dictionaries/dictionary.itop.ui.php

@@ -1080,9 +1080,8 @@ When associated with a trigger, each action is given an "order" number, specifyi
 	'UI:OrderByHint_Values' => 'Sort order: %1$s',
 	'UI:Menu:AddToDashboard' => 'Add To Dashboard...',
 	'UI:Button:Refresh' => 'Refresh',
-	'UI:Button:PrintableVersion' => 'Printable version',
 	'UI:Button:GoPrint' => 'Print...',
-	'UI:ExplainPrintable' => 'Click onto the chapters or items that you want to exclude from the print. This header and other tuning controls will not be printed. It is highly recommended to use the "print preview" feature provided by your browser, before proceeding.',
+	'UI:ExplainPrintable' => 'Click onto the %1$s icon to hide items from the print.<br/>Use the "print preview" feature of your browser to preview before printing.<br/>Note: this header and the other tuning controls will not be printed.',
 
 	'UI:ConfigureThisList' => 'Configure This List...',
 	'UI:ListConfigurationTitle' => 'List Configuration',
@@ -1293,5 +1292,6 @@ When associated with a trigger, each action is given an "order" number, specifyi
 	'UI:Menu:KillConcurrentLock' => 'Kill the Concurrent Modification Lock !',
 	
 	'UI:Menu:ExportPDF' => 'Export as PDF...',
+	'UI:Menu:PrintableVersion' => 'Printer friendly version',
 ));
 ?>

+ 1 - 0
dictionaries/es_cr.dictionary.itop.ui.php

@@ -1426,5 +1426,6 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
 	'UI:ConcurrentLockKilled' => 'The lock preventing modifications on the current object has been deleted.~~',
 	'UI:Menu:KillConcurrentLock' => 'Kill the Concurrent Modification Lock !~~',
 	'UI:Menu:ExportPDF' => 'Export as PDF...~~',
+	'UI:Menu:PrintableVersion' => 'Versión imprimible',
 ));
 ?>

+ 3 - 3
dictionaries/fr.dictionary.itop.ui.php

@@ -924,10 +924,9 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
 	'UI:OrderByHint_Values' => 'Ordre de tri: %1$s',
 	'UI:Menu:AddToDashboard' => 'Ajouter au Tableau de Bord...',
 	'UI:Button:Refresh' => 'Rafraîchir',
-	'UI:Button:PrintableVersion' => 'Version imprimable',
 	'UI:Button:GoPrint' => 'Imprimer...',
-	'UI:ExplainPrintable' => 'Cliquez sur les chapitres ou les éléments que vous voulez exclure de l\'impression. Cet en-tête, ainsi que les éléments de contrôle qui pourraient apparaitre dans cette page, ne seront pas imprimés. Il est recommandé d\'utiliser la fonction "Aperçu avant impression" de votre navigateur pour voir le rendu exact avant de lancer l\'impression.',
-
+	'UI:ExplainPrintable' => 'Cliquez sur les icones %1$s pour cacher des éléments lors de l\'impression.<br/>Utilisez la fonction "Aperçu avant impression" de votre navigateur pour prévisualiser avant d\'imprimer.<br/>Note: cet en-tête ainsi que les icones %1$s ne seront pas imprimés.',
+	
 	'UI:ConfigureThisList' => 'Configurer Cette Liste...',
 	'UI:ListConfigurationTitle' => 'Configuration de la liste',
 	'UI:ColumnsAndSortOrder' => 'Colonnes et ordre de tri:',
@@ -1135,4 +1134,5 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé
 	'UI:Menu:KillConcurrentLock' => 'Supprimer le verrouillage !',
 	
 	'UI:Menu:ExportPDF' => 'Exporter en PDF...',
+	'UI:Menu:PrintableVersion' => 'Version imprimable',
 ));