OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Add icon for EPUB or other file formats?

Are you responsible for making OMP work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, asmecher

Forum rules
What to do if you have a technical problem with OMP:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OMP Discussion subforum; if you have a development question, try the OMP Development subforum.

Add icon for EPUB or other file formats?

Postby rootl » Wed Jun 05, 2013 12:47 pm

Hello,

We would like to add an icon for the EPUB file format. Or, at least a 'generic' icon for a file format that is not one of the defaults (pdf, word, excel) How can we go about doing this?

Thanks.
rootl
 
Posts: 62
Joined: Wed Feb 20, 2013 7:17 am

Re: Add icon for EPUB or other file formats?

Postby asmecher » Wed Jun 05, 2013 1:00 pm

Hi rootl,

The sprite sheet that includes the icons for PDF and others is in lib/pkp/templates/images/structure/sprites.png; you'll need to edit that image to add a new sprite (making sure to stick with the 24x24 icon size and grid alignment).

Then edit lib/pkp/styles/sprites.less and add the new sprite to the LessCSS code. Compile the LessCSS into CSS by running lib/pkp/tools/buildCss.php.

Finally, edit lib/pkp/classes/file/FileManager.inc.php and look for the getDocumentType function. You'll need to add a new case there for the MIME type for EPUB, defining a matching DOCUMENT_TYPE_... constant at the top of the file.

That should be it! If you do tackle this, please consider contributing it back as a github.com pull request; it would be a worthwhile addition.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8910
Joined: Wed Aug 10, 2005 12:56 pm

Re: Add icon for EPUB or other file formats?

Postby rootl » Fri Jun 14, 2013 6:07 am

We are running OMP on a Windows 2008 server, using Apache 2.2 and PHP version 5.3.14. The server is set up where we can execute php scripts, but we have not been able to run lib/pkp/tools/buildCss.php successfully.

Any advice for running the script on a Windows 2008 server? ( We are not using IIS by the way)

Is there an alternative method where we can compile the .less files? I have used WinLess for other projects, but OMP is a bit different in the way that it is structured.

Or, Can we just directly add the styles to a specific css file?

Thanks. If we can get this working, we will gladly contribute it to github.
rootl
 
Posts: 62
Joined: Wed Feb 20, 2013 7:17 am

Re: Add icon for EPUB or other file formats?

Postby asmecher » Fri Jun 14, 2013 9:15 am

Hi rootl,

You should be able to run the following from the OMP installation directory:
Code: Select all
php lib\pkp\tools\buildCss.php
You may need to specify the path to the PHP interpreter if it's not in your system's $PATH. If that's not working, can you provide more details on what you get?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8910
Joined: Wed Aug 10, 2005 12:56 pm

Re: Add icon for EPUB or other file formats?

Postby rootl » Mon Jun 17, 2013 8:39 am

Hello,

Apologies - the script executed fine and the changes were successful. I needed to clear the cache a few times to see the icon display properly.

This is on a dev server so I can't show the url. I have attached a screen shot instead. The file extension shows and downloads properly as .epub .

We may choose a different icon to represent ePub also.

We will go ahead and submit this to GitHub. Thanks again.
Attachments
test-showing-epub-icon.PNG
example showing new ePub format and icon
test-showing-epub-icon.PNG (182.12 KiB) Viewed 1423 times
rootl
 
Posts: 62
Joined: Wed Feb 20, 2013 7:17 am

Re: Add icon for EPUB or other file formats?

Postby asmecher » Mon Jun 17, 2013 9:35 am

Hi rootl,

Excellent! Looking forward to it. This ought to make it into our next release.

Cheers,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8910
Joined: Wed Aug 10, 2005 12:56 pm

Re: Add icon for EPUB or other file formats?

Postby brianh » Wed Aug 20, 2014 6:39 am

Hi Alec and co.,

A quick one - in the 1.1 release of OMP the buildCss.php file has disappeared. Is this intentional, and if so is there now an alternative way to compile the CSS? If not, how can we get it back ;o)

Many thanks,
Brian
brianh
 
Posts: 20
Joined: Sat Apr 11, 2009 6:49 am

Re: Add icon for EPUB or other file formats?

Postby asmecher » Wed Aug 20, 2014 7:52 am

Hi Brian,

Starting with OMP 1.1, the CSS should be generated automatically if the file doesn't exist. This is done in lib/pkp/controllers/page/PageHandler.inc.php in the "css" function, which is the function OMP will direct the browser to fetch markup from.

If you make changes e.g. to the .less files, just delete cache/*.css and the CSS should be automatically re-generated.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8910
Joined: Wed Aug 10, 2005 12:56 pm


Return to OMP Technical Support

Who is online

Users browsing this forum: No registered users and 1 guest