kevinmschreiner
 Advanced Member Posts:729
 |
| 12 Jan 2007 06:47 PM |
|
To make this work without having to know specifically the Pane will be printed, you can actually instead just print arbitrary items in any order which you desire. To do this, you will need to pass the names of the objects you want printed. I have modified the original script below: To call this - execute the function: printitems();. You can pass any number of parameters to this. For instance: printitems('Div1','Div2','Div3'); ------ <script language=javascript> var srcvalue = ''; var counter = 0; var timer; function printitems() { myRef = window.open('/report.html','mywin','left=20,top=20,width=700,height=700,toolbar=1,resizable=1,scrollbars=yes'); srcvalue = ''; if (arguments.length > 0) { for (x=0;x<arguments;x++) { var docObj = document.getElementById(arguments[x]); if (docObj!=null) srcvalue += docObj.innerHTML + '<BR>'; } } counter = 10; waitfortarget(); } function waitfortarget() { counter--; if (!myRef.document.getElementById('TARGETDIV')) { //DO NOTHING if (counter > 0) { timer=setTimeout("waitfortarget()", 1000); } else { alert('Unable to load report. Please try again later.'); } } else { donetarget(); } } function donetarget() { myRef.document.getElementById('TARGETDIV').innerHTML = srcvalue; myRef.print(); } </script> |
|
|
|
|
radcoder
 New Member Posts:27
 |
| 16 Jan 2007 07:12 PM |
|
Going back a few steps, I also have the same problem described where the print icon appears fine if logged in as admin, but not as a regular user. I am not using ajax. The "show print icon" is checked in settings. Any ideas why the print icon will not appear? It seems like the additional code should not be necessary and perhaps it is something else? |
|
|
|
|
contactdp
 Basic Member Posts:475
 |
| 16 Jan 2007 07:46 PM |
|
Are you talking about Containers. This is some thing with Latest version of DNN. I am also seeing the same problem with Containers even with Text/HTML Module, but the above script is working fine.
Thanks,
|
|
| Durga Prasad(DP) | Senior Web Engineer<br>R2integrated |
|
|
radcoder
 New Member Posts:27
 |
| 16 Jan 2007 08:13 PM |
|
Yes, the print icon that appears in the bottom right of the container used for listx. It is the one enabled in "settings" rather than "view options". |
|
|
|
|
contactdp
 Basic Member Posts:475
 |
| 16 Jan 2007 08:37 PM |
|
Yah that is what I mean it is a container/DNN issue not the ListX issue. Try using the code from the first page of this post, that is a work around for this issue. Thanks, DP |
|
| Durga Prasad(DP) | Senior Web Engineer<br>R2integrated |
|
|
radcoder
 New Member Posts:27
 |
| 16 Jan 2007 10:04 PM |
|
Thanks that works. The only issue now is that it actually says "content pane" at the top of the window to print. It also has the title of the module. How would this be removed? |
|
|
|
|
contactdp
 Basic Member Posts:475
 |
| 16 Jan 2007 10:06 PM |
|
since you are logged in you are seeing the pane name, it will not appear when you log out. |
|
| Durga Prasad(DP) | Senior Web Engineer<br>R2integrated |
|
|
DavidWSnow
 Basic Member Posts:129
 |
| 18 Jan 2007 09:52 PM |
|
I have been playing with printing some more and a few questions came up:
When I try to mail a page with a ListX module the reset of the page comes up ok but the ListX modules are blank. Why? I wouldn't have been surprised that I lost the form data because I was using ajax.
When I use your script to bring up the content pane it looks great and prints great from IE. However if I try to mail the page a I get a message with only a couple of garbage characters. Why? How can I easily mail the content of the page including any links?
I did a link test using W3C's link tester (http://validator.w3.org/checklink) and it didn't notice the links shown in my ListX report. However, when I copyed and pasted lines from the report into a Text/Html module it was happy with them. Any idea what the deal is here? One of the things that I was hoping to do was to use ListX to display the links of my hosting customers so that Google et al would pick up their sites when they crawled mine.
It should be notes that this print method and DNN's container print method don't include a copyright notice, so that the user needs to handle this.
|
|
|
|
|
DavidWSnow
 Basic Member Posts:129
 |
| 21 Jan 2007 05:53 PM |
|
When I finally got around to really troubleshooting this I discovered several things: Javascript is CaseSensitive and that the designer of my skin had named the ContentPane "contentpane". I suspect that DNN has no rules about the names of panes at all, just that your need at least one. When I renamed the pane all worked well.  This has been a real pain. /dave |
|
|
|
|
Savkin
 New Member Posts:1
 |
| 06 Feb 2007 08:39 AM |
|
To go on with conversation. How to pass parameters with the script for printing? If I need to print the content of the module with the "print" link located on another module, what this parameter should be? What are "names of the objects"? BTW. Is there any posibility to insert page breaks. To force multipage printing. Also I need to remove all the data (except module content) from printed page. For example - the link to "report.html" page on the bottom of printed page. Any ideas? |
|
|
|
|
mrwebslinger
 Basic Member Posts:357
 |
| 06 Feb 2007 04:24 PM |
|
I am using a simpler approach but probably not as efficient to generate print reports. I am basically creating a duplicate page that contains the same modules as the page I want to print that I open in a popup window however I am applying a blank skin to it. The blank skin has no menus or graphics and is just the columns that contain the ListX modules. This creates a nice clean report that when printed looks great.
I know its not as sophisticated of a solution but it works great. |
|
|
|
|
mrwebslinger
 Basic Member Posts:357
 |
| 06 Feb 2007 04:42 PM |
|
I forgot to include an example:
http://www.southernland.com/laurelbrooke/AvailableHomes/HomeDetails/tabid/418/Default.aspx?CurrentMlsNum=793224
Click on Printable Brochure
The script can be found http://www.crays.com/jsc/ and they have a code generator tool that is pretty snazzy! |
|
|
|
|
cfguidry
 New Member Posts:8
 |
| 12 Feb 2007 03:49 AM |
|
kevinmschreiner - Thanks for posting the helpful code for printing in a separate pane. I'm still left with two print/display problems. 1) I used conditional background colors for some cells in a table and those colors display fine in the browser, but when I go to print (either in the original pane or in the pop-up window) the colors do not appear. How can I get the colors to print? 2) Almost all of the formatting (font size, weight, color, etc.) gets ignored when viewing the report in Firefox. How can I correct that issue? Thanks! |
|
|
|
|
contactdp
 Basic Member Posts:475
 |
| 12 Feb 2007 04:34 AM |
|
if you include all the CSS files properly in Report.html you will see exact same result. View Source on the actual HTML out put, copy All <Link Rel=... lines form the source and paste in your report.html Hope this helps. Thanks, DP |
|
| Durga Prasad(DP) | Senior Web Engineer<br>R2integrated |
|
|
cfguidry
 New Member Posts:8
 |
| 12 Feb 2007 02:51 PM |
|
Sorry, I suppose I didn't explain my issue clearly enough. The report.html page displays all of the colors and formatting just fine, but if I view the report using print preview, or actually print the report, then the colors get dropped in both of those instances. Here's an example of how I'm setting the background color, which doesn't show up when printed from the original or pop-up page: <TD WIDTH = "45" STYLE = "background: [ColorCd4]">[Variance4]</TD> Also, someone asked about printing in landscape format by default. I don't need to do that for this particular report, but anticipate needing to soon, so I'd like to hear how best to do that. I tried what was suggested here: http://p2p.wrox.com/topic.asp?TOPIC_ID=2387. That worked on a simple test page, but not on my ListX page. Thanks again! |
|
|
|
|
DavidWSnow
 Basic Member Posts:129
 |
| 13 Feb 2007 06:05 PM |
|
I messed with your http://p2p.wrox.com/topic.asp?TOPIC_ID=2387 landscape printing. It works with IE for plain text but really messes up with tables, so it doesn't appear to be of much use with ListX. --- I wish that it worked |
|
|
|
|
DavidWSnow
 Basic Member Posts:129
 |
| 08 Apr 2007 02:08 AM |
|
I was going thru the files that my ListX app requires and "report.html" was one of them. I noticed that a pointer to the portal or skin is hardcoded, so that this will only work in one place. I am about to deploy with several portals and several skins is there a way in javascript to point it to the current skin's skin.css? It would be a shame to winde up with one of these for each skin. /DaveS |
|
|
|
|
pauldes
 Veteran Member Posts:1392
 |
| 09 Apr 2007 07:32 PM |
|
You may be able to do it in the querystring in the window:open you are doing. Go to the Skin changer on the Admin/Host menu, hover over the Preview link for any of the available skins. Then look at the link in the status bar of IE. It will show you how to formulate your URL so that the page will display any skin of your choosing on the new opened window |
|
| ListX....makes you look brilliant, even though you're not. |
|
|
jasonred
 New Member Posts:17
 |
| 13 Nov 2007 08:35 PM |
|
I also have the problem with not being able to see the Print button/icon. But I believe this is a List X issue. Here is what I have found. When logged in with edit rights with "Edit" selected in the control panel I can see the print icon If I select "View" the page refreshes and the print icon goes away. I can correct this issue without adding any extra code by moving the print control in the skin above the content pane of the skin For example if you place the controls next to the title then the print icon will be displayed in view mode |
|
|
|
|
DavidWSnow
 Basic Member Posts:129
 |
| 31 Dec 2007 08:27 PM |
|
I have been using the printcontent() printing for many months with success. However, I just tried printitems() and had no success. has anyone got this to work? /DaveSnow |
|
|
|
|