OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Add new fields to submission step 3

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

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

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

Add new fields to submission step 3

Postby bgarnicnig » Fri Dec 10, 2010 3:02 pm

I have to add one field to step 3 (an editors introduction/summary to the article) in the submission form. Loosely following this example http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=2731#p9820 I tried to insert the new field into the following files, adding my new field whereever I found references to the 'abstract' field, which I use as a guideline:

templates/author/submit/step3.tpl
templates/submission/metadata/metadataView.tpl
templates/submission/metadata/metadataEdit.tpl
locale/en_US/
lib/pkp/classes/submission/Submission.inc.php (set & get)
classes/submission/form/MetadataForm.inc.php
classes/article/ArticleDAO.inc.php
classes/author/form/submit/AuthorSubmitStep3Form.inc.php

The additional field does show in the submission and review forms, yet its contents are not saved. I guess I have to add the name new field to a class or model definition, but I couldn't find exactly where that belongs. Any help would be much appreciated!
Last edited by bgarnicnig on Mon Dec 13, 2010 12:15 pm, edited 1 time in total.
bgarnicnig
 
Posts: 7
Joined: Sun Nov 07, 2010 10:01 am

Re: Add new fields to submission step 3

Postby bgarnicnig » Mon Dec 13, 2010 2:52 am

To be more specific about what works and what doesn't: The fields contents are not saved during the regular author submission process, they are saved in the editors Metadata form though...
bgarnicnig
 
Posts: 7
Joined: Sun Nov 07, 2010 10:01 am

Re: Add new fields to submission step 3

Postby jmacgreg » Mon Dec 13, 2010 11:47 am

Hi there,

There are a number of threads on the forum that address this -- see for example viewtopic.php?f=8&t=2731, and this search for examples. If you have further questions, just let us know.

Cheers,
James
jmacgreg
 
Posts: 4162
Joined: Tue Feb 14, 2006 10:50 am

Re: Add new fields to submission step 3

Postby bgarnicnig » Mon Dec 13, 2010 12:14 pm

Hi James,

thanks for the pointer, that first thread you mention was the one I was following in my humble attempt at implementing the additional field. I just cross-checked all the files from that thread to the files I already edited, and I think I changed all those which apply for my modification (Article data, not Author data) - is there any file I'm missing? Thanks for reconsidering my request.
bgarnicnig
 
Posts: 7
Joined: Sun Nov 07, 2010 10:01 am

Re: Add new fields to submission step 3

Postby mcrider » Mon Dec 20, 2010 12:15 pm

Hi bgarnicnig,

Did you add the field name (the value of the attribute 'name' for the input you added to the template file) to the array in MetadataForm::readInputData()? That will tell the form class to read that value, then in the execute() method of MetadataForm, you can access that value by calling $this->getData('fieldname') (e.g. $submission->setBlah($this->getData('blah');). If you're following the pattern used to saved abstracts, then that field would be localized, so you'd also have to add the name to the array in MetadataForm::getLocaleFieldNames() -- You'd also have to add the field to classes/article/ArticleDAO::getLocaleFieldNames() (I think that's it--you might want to do a grep of OJS for 'abstract' to see if it needs to be anywhere else). This means that the field is stored in the article_settings table, and you won't have to add a column to the articles table. This also means that people can enter different values into that field for different languages.

Otherwise, I'd highly recommend using a debugger, such as the one that comes with Eclipse, to step through the code and find out where your value is getting lost :)

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Add new fields to submission step 3

Postby cristianviza » Thu Mar 07, 2013 9:38 am

where defined the function getSetting('bla') . ???
cristianviza
 
Posts: 60
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: Add new fields to submission step 3

Postby asmecher » Thu Mar 07, 2013 10:35 am

Hi cristianviza,

There are many "getSetting" functions; which object are you querying?

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

Re: Add new fields to submission step 3

Postby cristianviza » Thu Mar 07, 2013 12:08 pm

hello asmecher, well I'm follow the steps described above, and this post viewtopic.php?f=8&t=2731.
then:

step1 : modify templates/author/submit/step3.tpl -->image source: http://www.subimelafoto.com.ar/images/705sourceSTEP3.jpg
step2: modify templates/submission/metadata/metadataView.tpl -->image source: http://www.subimelafoto.com.ar/images/599sourceMetaView.jpg
step3: modify templates/submission/metadata/metadataEdit.tpl--> image source: http://www.subimelafoto.com.ar/images/128sourceMetaEdit.jpg
step4: modify locale/es_ES/locale.xml --> image source: http://www.subimelafoto.com.ar/images/541sourceLocalexml.jpg
step5: modify lib/pkp/classes/submission/Submission.inc.php (set & get)--> image source : http://www.subimelafoto.com.ar/images/466sourceSubmissioninc.jpg
step6: modify classes/submission/form/MetadataForm.inc.php--> image source1: http://www.subimelafoto.com.ar/images/480sourceMetaFrom1.jpg
image source2: http://www.subimelafoto.com.ar/images/308sourceMetaFrom2.jpg
image source3:http://www.subimelafoto.com.ar/images/874sourceMetaFrom3.jpg
also modify function execute(&$request) add -->$article->setAgregado($this->getData('agregado'), null); // Localized ---- MY FUNCTION ------------------------------
step7: classes/article/ArticleDAO.inc.php , add agregado in function getLocaleFieldNames
step8: classes/author/form/submit/AuthorSubmitStep3Form.inc.php ---> image source 1 : http://www.subimelafoto.com.ar/images/8561.jpg
image source 2 : http://www.subimelafoto.com.ar/images/1702.jpg
image source 3 : http://www.subimelafoto.com.ar/images/2553.jpg

but i have a problem when in step3.tpl in {if $currentJournal->getSetting('metaAgregado')}. didn't not show any change, buy I change metaAgregado by metaDiscipline for example, show my changes. because I have this problem, where initialize getSetting function ? what parameter ??
Thank You
cristianviza
 
Posts: 60
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: Add new fields to submission step 3

Postby asmecher » Thu Mar 07, 2013 1:23 pm

Hi cristianviza,

The $currentJournal object represents the journal (with settings stored in the journal_settings table in MySQL), and it sounds to me like you're trying to add article-level metadata (which is generally stored in article_settings). Unless you're creating a journal setting with that name, which I don't see in the process you outline above, it won't exist.

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

Re: Add new fields to submission step 3

Postby cristianviza » Thu Mar 07, 2013 2:39 pm

Yesss !! :) asmecher,you are right! I'm trying to add article-level metadata. I want to put more metadata than it has since the ojs default in step 3 . This way is correct ? .... or nouu :( :( . what files I need modify ??

I attached a picture to better understand where I want to add metadata http://www.subimelafoto.com.ar/images/878Captura.jpg
Last edited by cristianviza on Thu Mar 07, 2013 3:00 pm, edited 1 time in total.
cristianviza
 
Posts: 60
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: Add new fields to submission step 3

Postby asmecher » Thu Mar 07, 2013 2:59 pm

Hi cristianviza,

It's an educated guess from this perspective, but it sounds like you're on the right track. I think you're confused about the purpose of the "{if $currentJournal->getSetting('metaDiscipline')}" line, though: that's used to test whether the journal is configured with that metadata field enabled. If so, then the field is presented for editing on the metadata forms; if not, it's hidden. In your case, I suspect you'll always want that field shown regardless of the journal's configuration, so those {if ...} statements aren't necessary for the new field.

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

Re: Add new fields to submission step 3

Postby cristianviza » Wed Mar 13, 2013 7:46 am

hello asmecher , I have now another problem.
in that case, I want add new fields in Plugin QuickSubmit, in this Plugin not show my metadata "agregado". why?

otherwise, it leaves me just put dates to 2003 and I have published articles in other media that I will migrate earlier dates. how do I add years to menu??
image http://www.subimelafoto.com.ar/images/994Pantallazo_2.png
cristianviza
 
Posts: 60
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina

Re: Add new fields to submission step 3

Postby asmecher » Wed Mar 13, 2013 8:42 am

Hi cristianviza,

Look in plugins/importexport/quickSubmit/index.tpl for the lines:
Code: Select all
{math|assign:"minYear" equation="min(x,y)-10" x=$publishedYear y=$currentYear}
...and...
Code: Select all
{math|assign:"minYear" equation="x-10" x=$currentYear}
Change these to go back further than 10 years.

(I'm not sure if you're also describing another problem -- if so, please describe it in more detail.)

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

Re: Add new fields to submission step 3

Postby cristianviza » Fri Mar 15, 2013 9:34 am

the other problem and fix it. I wanted to put another item for indexing in Quicksubmit
http://www.subimelafoto.com.ar/images/123Pantallazo_3.png.

I modifed QuickSubmitForm.inc.php, index.tpl :)
cristianviza
 
Posts: 60
Joined: Tue Nov 06, 2012 10:22 am
Location: Argentina


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 3 guests