Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: EME on December 30, 2016, 10:15:20 am

Title: Applying CSS only to table in Single Upload Form
Post by: EME on December 30, 2016, 10:15:20 am
I am trying to shrink the width of the table on the single upload page and remove cell borders.  I have accomplished it by adding the following CSS to style.css in the Water Drop theme:

   form#cpgform table {
       border-collapse: collapse;

However, I discovered when testing the site after this change that it has applied the css to other tables throughout the site, such as the one activated by the admin's config button.  That sent me looking through upload.php to see what the HTML looked like.  Around line 731 I found an instance of the function starttable which looks to be generating it:

    // Open the form table.
    starttable('100%', $upload_table_header, 2);

That function is defined around line 4047 of

    // Function to start a 'standard' table

    function starttable($width = '-1', $title = '', $title_colspan = '1', $zebra_class = '', $return = false)

By changing the value of $width in the above-mentioned instance in upload.php I am able to get the width where I want it.  But from what I can see the function does not support inline CSS.  So I can't apply border-collapse: collapse.

I did figure out that I can add a class to the single upload form by rewriting the function as follows:

    // Open the form table.
    starttable('100%', $upload_table_header, 2, 'uploadtest');

That then allows me to apply CSS to the single upload page with the following:

   form#cpgform table.maintable.uploadtest {
       border-collapse: collapse;

My question has two parts:

1) It looks like adding the class where I did is only applying it to the single upload page.  Testing has so far supported that.  But I don't know your system terribly well.  Is that class being applied somewhere else that I don't see at the moment?

2) Is there a way to execute this change without altering the core file upload.php? I am not terribly familiar with how Coppermine themes work.  Ideally it is best to change stuff like this inside the theme, and the installation I'm working on already has several core changes.
Title: Re: Applying CSS only to table in Single Upload Form
Post by: phill104 on December 30, 2016, 05:46:48 pm
Not able to give you the exact location as I am responding on a windows phone. What you would normally do is apply the required changes in theme.php. In the waterdrop theme this file only contains a few elements that override the default. So to add the block you need to change you copy the block you need from the sample theme as that contains everything.

This section of the docs explains this in more detail paying particular attention to the links in the what's next section  -

If you still need help hopefully one of the team or community can assist as I am away from home for the next few weeks.

Title: Re: Applying CSS only to table in Single Upload Form
Post by: Αndré on June 30, 2017, 04:15:13 pm
Do you still need help with this?