Splash Screen for each Journal

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
asmecher
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm
Contact:

Postby asmecher » Tue Feb 20, 2007 4:01 pm

Hi Alf,

Looks good so far. The next step will depend on how you want the splash screen to behave. When do you want this page to be displayed, and where should the "click here..." link go?

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/

nelson
Posts: 36
Joined: Fri Jan 12, 2007 6:17 am
Contact:

Splash Screen for each Journal

Postby nelson » Tue Feb 20, 2007 4:01 pm

Hallo,
I'm working on a patch to have a Splash Screen for each Journal. After Alec suggestions, I wrote this:

1) Added at lines 433-451 ojs/templates/manager/setup/step5.tpl - this code portion:

Code: Select all

 

<div class="separator"></div>


<h3>5.9 {translate key="manager.setup.journalSplashScreen"}</h3>

<p>{translate key="manager.setup.journalSplashScreenDescription"}</p>

<table width="100%" class="data">
<tr>
   <td width="20%" class="label">{translate key="manager.setup.useJournalSplashScreen"}</td>
   <td width="80%" class="value"><input type="file" name="journalSplashScreen" class="uploadField" /> <input type="submit" name="uploadJournalSplashScreen" value="{translate key="common.upload"}" class="button" /></td>
</tr>
</table>

{if $journalSplashScreen}
{translate key="common.fileName"}: <a href="{$publicFilesDir}/{$journalSplashScreen.uploadName}" class="file">{$journalSplashScreen.name}</a> {$journalSplashScreen.dateUploaded|date_format:$datetimeFormatShort} <input type="submit" name="deleteJournalSplashScreen" value="{translate key="common.delete"}" class="button" />
{/if}

<div class="separator"></div>


2) Added in localizations:
IT-->locale.xml

Code: Select all

   <!--Splash screen locale keys-->
   <message key="manager.setup.journalSplashScreen">Splash Screen della rivista</message>
   <message key="manager.setup.journalSplashScreenDescription">&#x00C8; possibile inserire, tramite upload, uno Splash Screen specifico per questa rivista.</message>
   <message key="manager.setup.useJournalSplashScreen">Splash Screen della rivista</message>
   <message key="manager.setup.noSplashScreenUploaded">Non &#x00E8; stato inserito nessuno Splash Screen.</message>

EN--->locale.xml

Code: Select all

   <!-- Splash Screen locale keys-->
   <message key="manager.setup.journalSplashScreen">Journal Splash Screen</message>
   <message key="manager.setup.journalSplashScreenDescription">The default Journal Home Page can be overridden by uploading a journal-specific html Splash Screen.</message>
   <message key="manager.setup.useJournalSplashScreen">Journal Splash Screen</message>
   <message key="manager.setup.noSplashScreenUploaded">No Splash Screen uploaded.</message>


3) Added in classes/manager/form/setup/JournalSetupStep5Form.inc.php
the function: uploadSplashScreen()

Code: Select all

   /**
    * Uploads journal custom Splash Screen.
    * @param $settingName string setting key associated with the file
    */
   function uploadSplashScreen($settingName) {
      $journal = &Request::getJournal();
      $settingsDao = &DAORegistry::getDAO('JournalSettingsDAO');
   
      import('file.PublicFileManager');
      $fileManager = &new PublicFileManager();
      if ($fileManager->uploadedFileExists($settingName)) {
         $type = $fileManager->getUploadedFileType($settingName);
         if ($type != 'text/plain' && $type != 'text/html') {
            return false;
         }
   
         $uploadName = $settingName . '.html';
         if($fileManager->uploadJournalFile($journal->getJournalId(), $settingName, $uploadName)) {         
            $value = array(
               'name' => $fileManager->getUploadedFileName($settingName),
               'uploadName' => $uploadName,
               'dateUploaded' => date("Y-m-d g:i:s")
            );
            
            return $settingsDao->updateSetting($journal->getJournalId(), $settingName, $value, 'object');
         }
      }
      
      return false;
   }


4) Added in page/manager/SetupHandler.inc.php
after line 342

Code: Select all

else if (Request::getUserVar('uploadJournalSplashScreen')) {
   if ($setupForm->uploadSplashScreen('journalSplashScreen')) {
      $editData = true;
      } else {
      $setupForm->addError('journalSplashScreen', 'manager.setup.journalSplashScreenInvalid');
      }
      } else if (Request::getUserVar('deleteJournalSplashScreen')) {
      $editData = true;
      $setupForm->deleteImage('journalSplashScreen');
      }


It works, and uploads in the journal Dir the html page, renaming it journalSplashScreen.html.

But now I don't know how to proceed to override the home page with the uploaded file.

Thanks
Alf

nelson
Posts: 36
Joined: Fri Jan 12, 2007 6:17 am
Contact:

Postby nelson » Tue Feb 20, 2007 4:20 pm

The Splash Screen has to override the page usually displayed at:

http://www.myojs.it/index.php/MYJOURNAL/index

It has to be displayed when you click on the HOME link on the journal navigation bar, or ou click in "View Journal" in OJS container.

Then each link on it should be declared statically.
But to prevent links errors, should appear at the end of the page a text link to the CURRENT JOURNAL.

I still made something for an other portal, you can see it on:

http://www.foriocultura.it

Thats just html and css.

Thanks
Alfredo

nelson
Posts: 36
Joined: Fri Jan 12, 2007 6:17 am
Contact:

Postby nelson » Wed Feb 21, 2007 10:15 am

strange! your reply is before my first message ... ???

didn't I undestood your suggestion? I don't know how to continue now...

bye
Alf

asmecher
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm
Contact:

Postby asmecher » Thu Feb 22, 2007 10:42 am

Hi Alf,

There is an implementation of the splash page almost as you describe for custom issue cover pages in pages/issue/IssueHandler.inc.php and templates/issue/view.tpl. What it does is this: If you come to the issue's URL without showToc at the end, and a custom cover page exists, it displays the custom cover page including a link to the same URL with "showToc" at the end.

The differences between this and your implementation are:
  • Your implementation requires the display of an entire HTML page, rather than a couple of custom-generated fields. You can use classes/file/PublicFileManager.inc.php to fetch the contents. (You should have already used this class to upload the HTML in the first place.)
  • You'll probably need to use a PHP string replacement function to replace some tag built into the splash page HTML with the URL to the journal's actual homepage. Use the Request::url function to generate this URL.
Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/

nelson
Posts: 36
Joined: Fri Jan 12, 2007 6:17 am
Contact:

Postby nelson » Fri Feb 23, 2007 5:35 pm

Dear Alec,
I'm looking at OJS files and technical reference. So I think: instead of edit an other handler similar to issue handler, don't you think that may be better to edit a condition for the splash page directly on IndexHandler.inc.php ?
thanks
Alf

asmecher
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm
Contact:

Postby asmecher » Sat Feb 24, 2007 6:46 pm

Hi Alf,

That's a question of programming style -- either approach would work, and either would suit the existing OJS codebase just fine.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/

mbria
Posts: 352
Joined: Wed Dec 14, 2005 4:15 am
Contact:

Re: Splash Screen for each Journal

Postby mbria » Tue May 13, 2008 2:48 am

Thanks Alf to share.

The Editor of our magazine wanted to show a really big logo on every page (what is against usability) so I suggested an splash screen (including the logos where the magazine is indexed).

Alf, you patch is exactly what I was looking for so I will update it to 2.2 and give a try.

BTW Alec, don't you think is a good addition to OJS? I know about some magazines that will be really happy with this feature. Alf code looks nice and it function could be disabled by default so don't annoy anybody.

I will upload the updated 2.2 patch here as soon as I finish.

Cheers,

m.

asmecher
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm
Contact:

Re: Splash Screen for each Journal

Postby asmecher » Tue May 13, 2008 9:47 am

Hi mbria & Alf,

Yes, this would make a good addition to OJS -- please do submit an updated patch for 2.2 and I'll look into merging it into CVS for version 2.2.1.

Regards,
Alec Smecher
Public Knowledge Project Team

kurtmathiesen
Posts: 8
Joined: Mon Apr 30, 2007 4:40 am
Location: Copenhagen, Denmark
Contact:

Re: Splash Screen for each Journal

Postby kurtmathiesen » Wed Dec 17, 2008 1:18 am

This is also a wish from one of "our" journals. Unfortunately we're not running 2.2 yet. Is this included in version 2.2? And can anyone provide link to an example?
Regards,
Kurt
Copenhagen Business School

jmacgreg
Posts: 4191
Joined: Tue Feb 14, 2006 10:50 am
Contact:

Re: Splash Screen for each Journal

Postby jmacgreg » Wed Dec 17, 2008 11:29 am

Hi Kurt,

This hasn't been included, but you can find a workaround in our Customizing OJS document: http://pkp.sfu.ca/files/docs/customizingojs/index.html.

Cheers,
James


Return to “OJS Development”

Who is online

Users browsing this forum: No registered users and 1 guest