Closed Bug 276799 Opened 20 years ago Closed 20 years ago

Move inline styles from calPrintEngine.js to a css file

Categories

(Calendar :: General, defect)

Sunbird 0.2
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
Sunbird 0.3

People

(Reporter: sipaq, Assigned: sipaq)

References

()

Details

Attachments

(3 files)

Currently calPrintEngine.js uses inline styles to style the print output. This
is bad. Using a separate calPrintEngine.css file would save us some footprint
and would also make it possible for users to modify the print output via
userchrome.css
While I'm working on this bug, I have a few questions. Mostafah, maybe you can
help me here, since CVS blame shows that you've done most of the work on this file.

1. What does the commented out code at line 272 do? Can it be removed or should I 
   include it in the scope of this bug?
2. IMO the file should use a valid markup. As far as I can see, there is at least 
   one markup error. The <td>-tag opened in line 320 is never closed. IMO it 
   should be closed in line 359 after the </table>-tag.
3. Is there a reason why we don't use quotation marks throughout the HTML code?

I hope this makes some sense.
Status: NEW → ASSIGNED
(In reply to comment #1)
> 3. Is there a reason why we don't use quotation marks throughout the HTML code?

Since the gHtmlStrings are all enclosed in double quotes, double quotes in the
HTML would have to be escaped somehow, which is basically a big pain, so they
were omitted since the markup works without them. 

(In reply to comment #1)
> 1. What does the commented out code at line 272 do? Can it be removed or should I 
>    include it in the scope of this bug?

Just remove it.

> 2. IMO the file should use a valid markup. As far as I can see, there is at least 
>    one markup error. The <td>-tag opened in line 320 is never closed. IMO it 
>    should be closed in line 359 after the </table>-tag.

Feel free to correct any markup errors.

Attached file New stylesheet β€”
This is the new stylesheet for calPrintEngine.js
Attached patch Patch v1 β€” β€” Splinter Review
(In reply to comment #4)
> Created an attachment (id=170648) [edit]
> New stylesheet
> 
> This is the new stylesheet for calPrintEngine.js

(In reply to comment #5)
> Created an attachment (id=170649) [edit]
> Patch v1
> 

Nice job sipaq!
Nominating for target milestone of SB 0.3

Target Milestone: --- → Sunbird 0.3
Comment on attachment 170649 [details] [diff] [review]
Patch v1

>+    gHtmlString += "<table><tr><td valign=bottom align=center>";

Ugh, that should be

+    gHtmlString += "<table><tr><td class=bottomcenter>";

Mostafah, you want a new patch (incorporating that change) or can you work with
the current patch?
Comment on attachment 170649 [details] [diff] [review]
Patch v1

I couldn't test the patch, because 1) my printer is broken and 2) printing is
broken, because the code is not hooked up to the new apis yet.

Because of that I would like to have two reviews on this patch. I'm asking mvl
to review this patch in addition to Mostafah, because he's worked quite a lot
on our printing code. Thanks in advance, guys!
Attachment #170649 - Flags: second-review?(mvl)
Attachment #170649 - Flags: first-review?(mostafah)
Comment on attachment 170649 [details] [diff] [review]
Patch v1

Patch works fine for me. I tested it on the 0.2 branch. The little change can
be made when the patch is checked in.
Attachment #170649 - Flags: first-review?(mostafah) → first-review+
Comment on attachment 170649 [details] [diff] [review]
Patch v1

Patch looks ok to me.

>+      gHtmlString += "<td class=bordertop width=14%>";
>+      gHtmlString += "<table height=100 width=100% class=noborder>";

I think those sizes be moved to css as well. And maybe the names of the classes
can be more descriptive. But feel free to do that in a follow-up bug if you
prefer.

You should add a license block to the css file.
Attachment #170649 - Flags: second-review?(mvl) → second-review+
Patch and file checked in. Change from comment #7 applied.
This patch adds the usual license section to the new CSS file.
Mostafah, can you please check this in, when you find the time.
(In reply to comment #10)

Hi mvl, thanks for the review.

> >+      gHtmlString += "<td class=bordertop width=14%>";
> >+      gHtmlString += "<table height=100 width=100% class=noborder>";
> 
> I think those sizes be moved to css as well.

Yes, you could move them to css. I left them in, because that would only result
in more code, instead of less code, which was the original intent behind this bug.

> And maybe the names of the classes can be more descriptive. But feel free to 
> do that in a follow-up bug if you prefer.

Sure. Do you have any particular classes that bug you the most or any
suggestions on what the names should look like?

> You should add a license block to the css file.

Already done. See the new patch in this bug.
(In reply to comment #13)
> > >+      gHtmlString += "<td class=bordertop width=14%>";
> 
> Sure. Do you have any particular classes that bug you the most or any
> suggestions on what the names should look like?
> 
for example 'bordertop'. It describes the content of the style: a border on top.
I think it would be better if it describes the class: 'contentrow' (or something
like that. I don't know when that class is used).
or 'top'. That sounds to me like it is the top of the page, but it just means
the style says that is should be top-aligned.
Comment on attachment 171377 [details] [diff] [review]
Add license section to new css file (checked in)

Mostafah, can you please check this in.
Attachment #171377 - Flags: first-review?(mostafah)
Attachment #171377 - Attachment description: Add license section to new css file → Add license section to new css file (checked in)
Attachment #171377 - Flags: first-review?(mostafah) → first-review+
Simon, what's left to be done here?
(In reply to comment #16)
> Simon, what's left to be done here?

Mainly your comments in comment 14. But I think we can spin this off into a
followup bug.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
The bugspam monkeys have been set free and are feeding on Calendar :: General. Be afraid for your sanity!
QA Contact: gurganbl → general
Status: RESOLVED → VERIFIED
Version: Sunbird 0.2RC1 → Sunbird 0.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: