forked from science-ation/science-ation
Add support for a minimum number of words in the project description. Resolves RFE 162.
This commit is contained in:
parent
30072d182d
commit
18aafbea9c
@ -1 +1 @@
|
|||||||
82
|
83
|
||||||
|
1
db/db.update.83.sql
Normal file
1
db/db.update.83.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
INSERT INTO `config` ( `var` , `val` , `category`, `ord` , `description` , `year`) VALUES ('participant_project_summary_wordmin', 0, 'Participant Registration', 1110, 'The minimum number of words acceptable in the project summary', -1);
|
@ -87,7 +87,7 @@ echo mysql_error();
|
|||||||
{
|
{
|
||||||
$summarywords=preg_split("/[\s,]+/",$_POST['summary']);
|
$summarywords=preg_split("/[\s,]+/",$_POST['summary']);
|
||||||
$summarywordcount=count($summarywords);
|
$summarywordcount=count($summarywords);
|
||||||
if($summarywordcount>$config['participant_project_summary_wordmax'])
|
if($summarywordcount>$config['participant_project_summary_wordmax'] || $summarywordcount<$config['participant_project_summary_wordmin'])
|
||||||
$summarycountok=0;
|
$summarycountok=0;
|
||||||
else
|
else
|
||||||
$summarycountok=1;
|
$summarycountok=1;
|
||||||
@ -176,6 +176,7 @@ else if($newstatus=="complete")
|
|||||||
function countwords()
|
function countwords()
|
||||||
{
|
{
|
||||||
var wordmax=<?=$config['participant_project_summary_wordmax'];?>;
|
var wordmax=<?=$config['participant_project_summary_wordmax'];?>;
|
||||||
|
var wordmin=<?=$config['participant_project_summary_wordmin'];?>;
|
||||||
var summaryobj=document.getElementById('summary');
|
var summaryobj=document.getElementById('summary');
|
||||||
var wordcountobj=document.getElementById('wordcount');
|
var wordcountobj=document.getElementById('wordcount');
|
||||||
var wordcountmessageobj=document.getElementById('wordcountmessage');
|
var wordcountmessageobj=document.getElementById('wordcountmessage');
|
||||||
@ -183,7 +184,7 @@ function countwords()
|
|||||||
var wordarray=summaryobj.value.replace(/\s+/g," ").split(" ");
|
var wordarray=summaryobj.value.replace(/\s+/g," ").split(" ");
|
||||||
var wordcount=wordarray.length;
|
var wordcount=wordarray.length;
|
||||||
|
|
||||||
if(wordcount>wordmax)
|
if(wordcount>wordmax || wordcount<wordmin)
|
||||||
wordcountmessageobj.className="incomplete";
|
wordcountmessageobj.className="incomplete";
|
||||||
else
|
else
|
||||||
wordcountmessageobj.className="complete";
|
wordcountmessageobj.className="complete";
|
||||||
@ -315,6 +316,10 @@ function countwords()
|
|||||||
|
|
||||||
echo "<span id=\"wordcount\">$summarywordcount</span>/";
|
echo "<span id=\"wordcount\">$summarywordcount</span>/";
|
||||||
echo i18n("%1 words maximum",array($config['participant_project_summary_wordmax']));
|
echo i18n("%1 words maximum",array($config['participant_project_summary_wordmax']));
|
||||||
|
if($config['participant_project_summary_wordmin'] > 0)
|
||||||
|
{
|
||||||
|
echo i18n(", %1 words minimum", array($config['participant_project_summary_wordmin']));
|
||||||
|
}
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
Loading…
Reference in New Issue
Block a user