OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Limit the Abstract to 250 word

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

Moderators: jmacgreg, michael, John

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

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. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

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 OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

Limit the Abstract to 250 word

Postby ranjitsaurav » Thu Jan 01, 2009 1:53 am

Hi all,
I am Saurav Ranjit. I need to limit the "Abstract" word to 250 words. Could any one tell me how to limit the "Abstract" word to 250 word .
Saurav Ranjit
ranjitsaurav
 
Posts: 7
Joined: Thu Jan 01, 2009 1:48 am

Re: Limit the Abstract to 250 word

Postby jmacgreg » Fri Jan 02, 2009 11:48 am

Hi Saurav,

You can do this by editing the template that contains the abstract field: templates/presenter/submit/step2.tpl. You'll have to enter your own Javascript stuff in there; also, keep in mind that restricting the abstract to x words rather than x characters might be difficult.

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

Re: Limit the Abstract to 250 word

Postby ranjitsaurav » Sat Jan 03, 2009 2:22 am

I have done something like this Please correct me if I am wrong, This code runs smoothly on .html, but not working on .tpl file.

{literal}
<script type="text/javascript"><!--
var wordLen = 250; // Maximum word length
function checkWordLen(obj){
var len = obj.value.split(/[\s]+/);
if(len.length > wordLen){
alert("You cannot put more than "+wordLen+" words in this text area.");
obj.oldValue = obj.value!=obj.oldValue?obj.value:obj.oldValue;
obj.value = obj.oldValue?obj.oldValue:"";
return false;
}
return true;
}
//--></script>
{/literal}

.
.
.
.
.
.
.
<tr valign="top">
<td width="20%" class="label">{fieldLabel name="abstract" key="paper.abstract" required="true"}</td>
<td width="80%" class="value"><textarea name="abstract[{$formLocale|escape}]" id="abstract" class="textArea" rows="15" cols="60" onKeyUp="checkWordLen(this);">{$abstract[$formLocale]|escape}</textarea></td>
</tr>
ranjitsaurav
 
Posts: 7
Joined: Thu Jan 01, 2009 1:48 am

Re: Limit the Abstract to 250 word

Postby asmecher » Sat Jan 03, 2009 9:57 am

Hi Saurav,

Try disabling the TinyMCE plugin and see if that's interfering. If so, the following thread may be helpful: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=1922

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

Re: Limit the Abstract to 250 word

Postby ranjitsaurav » Mon Jan 05, 2009 2:15 am

Thanks to all.
I am able to limit the Abstract to 250 words.
I made the following changes in the TinyMCE plugin file "fc-pluginSettings-4-0-TinyMCEPlugin"

<?php return array (
'enabled' => false,
); ?>

Here 'enabled' was entitled to 'true' earlier . I made it 'false' . Now with this change and the previous code that i send earlier i was able to limit the Abstract to 250 word.
The only thing that I am concerned is that will it effect the other features of the "Open Conference System" . Please Let me know.

Saurav Ranjit
ranjitsaurav
 
Posts: 7
Joined: Thu Jan 01, 2009 1:48 am

Re: Limit the Abstract to 250 word

Postby asmecher » Mon Jan 05, 2009 9:20 am

Hi Saurav,

Don't modify the files in the "cache" directory -- your changes will be overwritten. Instead, go to the System Plugins page and enable/disable the plugin there.

Instead of disabling the TinyMCE plugin entirely, another option is to remove support for it from the Abstract field only; do this by modifying plugins/generic/tinymce/TinyMCEPlugin.inc.php and removing the 'abstract' field from the list of supported fields. Alternately, follow the link posted above to find out how other users have added word count support to TinyMCE-enabled fields.

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

Re: Limit the Abstract to 250 word

Postby gonetil » Thu Apr 16, 2009 6:52 am

I have include this feature in OCS when using TinyMCE. It limits to 300 words, but it is easy to change to 250 (or to n words)
I leave you this, hope it helps.
Even though it works fine, it is applied to all conferences in this OCS installation. I would like to write a plugin with this feature, and allow Conf. Managers to set up the preferred length (or zero for unlimited). Does anyone know how should I proceed?

Best wishes
Attachments
step2.tpl.tar
Replace templates/presenter/submit/step2.tpl with this file, after extracting it.
(30 KiB) Downloaded 69 times
gonetil
 
Posts: 9
Joined: Mon Apr 06, 2009 7:24 am
Location: La Plata, Buenos Aires, Argentina

Re: Limit the Abstract to 250 word

Postby mcrider » Fri Apr 17, 2009 5:10 pm

Hi gonetil,

Implementing that as a plugin would take a good deal of work--I'd suggest looking into the tinyMCE plugin (plugins/generic/tinymce/) and making a simplified version of it. The callback function in TinyMCEPlugin.inc.php injects the included javascript into a page if the user is on a page specificied by the 'switch' statement in the getEnableFileds function. Instead, you could rewrite the callback function to get the abstract length value from either the database (which would involve creating a new conference setup field, which is quite a task in its own right, and would break the self-containedness of the plugin), or hardcode the length in an array in the plugin. Then, you can add that value to the javascript as a PHP variable. The last step would be to ensure that the callback only returns javascript if you are on the author/submit page, so it doesn't get added to every page. Actually getting this to work will require a good deal more effort, but I'll leave that up to you--But let us know if you want any further help.

Also, I recently wrote a guide on writing block plugins. Though this is not a block plugin, some of the instructions would be relevant to writing a generic plugin.

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

Re: Limit the Abstract to 250 word

Postby gonetil » Sun Apr 19, 2009 5:43 am

Matt,
thanks for your advices. And also for the guide you wrote, I've been looking for this for a while.
I will see what I can do. Best wishes
gonetil
 
Posts: 9
Joined: Mon Apr 06, 2009 7:24 am
Location: La Plata, Buenos Aires, Argentina

Re: Limit the Abstract to 250 word

Postby marcob » Fri Jun 12, 2009 2:02 pm

I also would like the abstract to have a word limit.
I have seen the answers posted, and I could try replacing the step2 file,
as suggested by gonetil, but I'm a bit worried about the effects (untested I assume)
and this is code that I do not personally understand.
Can I ask whether this solution would survive an upgrade of OCS?

Basically I'd like to add my voice to what many others have said already,
a word limit is a very common standard feature of abstract submission, it
really should be part of OCS. If the patch that has been posted works
well is there any chance it will be incorporated in OCS in the future?

Thanks,

cheers, Marco B
marcob
 
Posts: 15
Joined: Fri Jun 27, 2008 2:50 am

Re: Limit the Abstract to 250 word

Postby jmacgreg » Mon Jun 15, 2009 10:36 pm

Hi all,

Thanks for your input -- I have filed this as a feature request here: http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=4441. Please feel free to CC yourself to that report for further updates, and also please provide any other comments there as well.

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

Re: Limit the Abstract to 250 word

Postby igotea » Fri Jan 15, 2010 1:04 am

Hello,

How should i implement the limitation of the abstract in my ocs site (Latest version: 2.1.2 (June 21, 2009)) ?
Last edited by igotea on Wed Jul 27, 2011 11:25 pm, edited 1 time in total.
igotea
 
Posts: 23
Joined: Fri Aug 15, 2008 7:33 am

Re: Limit the Abstract to 250 word

Postby jmacgreg » Tue Jan 19, 2010 9:17 pm

Hi Igotea,

You can take a look at the patches attached to that Bug entry and try to patch your 2.1.2 system with them, but keep in mind that since they are meant for 2.3 they may not apply cleanly or even work. You could also upgrade to OCS 2.3 which has just been released.

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

Re: Limit the Abstract to 250 word

Postby igotea » Wed Jan 20, 2010 9:21 am

Hi, thanks for the suggestions.

I have already tried to apply the patch and is not working, so i have to rewrite the files affected by the patch. Then I have applied the method sugested here: viewtopic.php?f=3&t=3931#p15179 and is working but is not so elegant.

No, if you say that the new version is already received, i will try to update. I have seen from the patch that i have applied, that at the configuration of conference tracks, it is possible to limit the abstract.

Best regards,
igotea
 
Posts: 23
Joined: Fri Aug 15, 2008 7:33 am

Re: Limit the Abstract to 250 word

Postby igotea » Wed Jan 20, 2010 9:51 am

Hi,

Now I'm trying to update to OCS 2.3

If I run
Code: Select all
php tools/upgrade.php patch
the response is:

Code version: 2.1.2.0
Database version: 2.1.2.1
Latest version: 2.3.0.0
Database version is newer than code version!


I have downloaded the patch: patch from OCS 2.1.2-1 http://pkp.sfu.ca/ocs/download/patch/ocs-2.1.2-1_to_2.3.patch.gz then run:
Code: Select all
patch -p1 < ocs-2.1.2-1_to_2.3.patch
The response is:

The next patch would create the file classes/admin/form/ConferenceSiteSettingsForm.inc.php,
which already exists! Assume -R? [n]


What does it mean Assume -R?
 [n] i suppose is No

It is the corect patch that I try to apply ?
Last edited by igotea on Wed Jul 27, 2011 11:25 pm, edited 1 time in total.
igotea
 
Posts: 23
Joined: Fri Aug 15, 2008 7:33 am

Next

Return to OCS Technical Support

Who is online

Users browsing this forum: No registered users and 1 guest