PKP Bugzilla – Bug 6900
Submissions with tags in titles truncated to '...' in submission lists
Last modified: 2012-05-01 14:19:42 PDT
Submissions with e.g. italics tags in the first 40 characters are showing up as '...' in the submission lists (e.g. editor's 'submissions in editing' page).
Our site is also experiencing this issue. It occurs in all lists under the editor interface, and is the result of using strip_unsafe_tags in combination with truncate. Basically, this allows 'safe' tags (e.g., italics) through but in many cases cuts off one or more closing tags, resulting in non-well-formed HTML. For instance, in templates/editor/issues/issueToc.tpl: Original line: <td class="drag">{if !$isLayoutEditor}<a href="{url op="submission" path=$articleId}" class="action">{/if}{$article->getLocalizedTitle()|strip_unsafe_html|truncate:60:"..."}{if !$isLayoutEditor}</a>{/if}</td> (the above produces "..." in many cases). Workaround 1: Change strip_unsafe_html to strip_tags (removes all tags, making the text safe for truncate). <td class="drag">{if !$isLayoutEditor}<a href="{url op="submission" path=$articleId}" class="action">{/if}{$article->getLocalizedTitle()|strip_tags|truncate:60:"..."}{if !$isLayoutEditor}</a>{/if}</td> (the above produces "High quality draft genome sequence of Segniliparus...", where 'Segniliparus' is the first word of an italicized phrase). Workaround 2: Remove '|truncate:60:"..."' (prevents stranded opening tags). <td class="drag">{if !$isLayoutEditor}<a href="{url op="submission" path=$articleId}" class="action">{/if}{$article->getLocalizedTitle()|strip_unsafe_html}{if !$isLayoutEditor}</a>{/if}</td> (the above produces "High quality draft genome sequence of <i>Segniliparus rugosus</i> CDC 945T= (ATCC BAA-974T)", the complete title with starting and closing tags). I prefer workaround 1. Based on a quick search of the code, it looks like this may be an issue in at least 24 places in the code: grep -r strip_ ./OJS/templates/ | grep truncate | wc -l 24 Also refer to the following forum thread: http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=7872
This appears to be the complete list of affected source files: # grep -r strip_unsafe OJS | grep truncate | grep -v cache | cut -d':' -f1 OJS/plugins/generic/booksForReview/templates/editor/submissions.tpl OJS/plugins/generic/staticPages/settingsForm.tpl OJS/templates/author/active.tpl OJS/templates/author/active.tpl (NOTE: 2 cases in this file) OJS/templates/author/completed.tpl OJS/templates/comment/comments.tpl OJS/templates/copyeditor/active.tpl OJS/templates/copyeditor/completed.tpl OJS/templates/editor/index.tpl OJS/templates/editor/issues/issueToc.tpl OJS/templates/editor/submissionsArchives.tpl OJS/templates/editor/submissionsInEditing.tpl OJS/templates/editor/submissionsInReview.tpl OJS/templates/editor/submissionsUnassigned.tpl OJS/templates/layoutEditor/active.tpl OJS/templates/layoutEditor/completed.tpl OJS/templates/proofreader/active.tpl OJS/templates/proofreader/completed.tpl OJS/templates/reviewer/active.tpl OJS/templates/reviewer/completed.tpl OJS/templates/rt/rt.tpl OJS/templates/sectionEditor/submissionEventLog.tpl OJS/templates/sectionEditor/submissionHistory.tpl OJS/templates/sectionEditor/submissionsArchives.tpl OJS/templates/sectionEditor/submissionsInEditing.tpl OJS/templates/sectionEditor/submissionsInReview.tpl
Additionally, it wouldn't hurt to check all other uses of truncate to ensure there are not additional forms of this error. grep -r "truncate:" . | grep -v strip_ | wc -l 50 strip_tags should be used in any of the above cases where HTML is potentially contained in a variable.
We're experiencing this problem at the California Digital Library as well. This poses a significant problem for many of our journals who have many articles with HTML mark-up in them.
Thank you Chuck for tracking this down and providing the additional shortlist of affected files. Barbara and Chuck, if there are no additional comments from your end, I'll be updating the identified affected files with workaround #1, replacing strip_unsafe_html with strip_tags.
Created attachment 3750 [details] Patch against OJS 2.3.7 (should also work with 2.3.6, 2.3.5, etc.)
The following files are affected in OCS stable: plugins/generic/staticPages/settingsForm.tpl templates/author/active.tpl templates/author/active.tpl templates/author/completed.tpl templates/comment/comments.tpl templates/director/schedulingQueue.tpl templates/director/submissionsAccepted.tpl templates/director/submissionsArchives.tpl templates/director/submissionsInReview.tpl templates/director/submissionsUnassigned.tpl templates/manager/conferenceEventLog.tpl templates/manager/conferenceEventLog.tpl templates/manager/reviewForms/reviewFormElements.tpl templates/reviewer/active.tpl templates/reviewer/completed.tpl templates/rt/rt.tpl templates/trackDirector/submissionEventLog.tpl templates/trackDirector/submissionEventLog.tpl templates/trackDirector/submissionEventLogEntry.tpl templates/trackDirector/submissionHistory.tpl templates/trackDirector/submissionHistory.tpl templates/trackDirector/submissionsAccepted.tpl templates/trackDirector/submissionsArchives.tpl templates/trackDirector/submissionsInReview.tpl
Created attachment 3751 [details] Patch against OCS 2.3.5 (should also work with 2.3.4, 2.3.3, etc.)
Committed to OJS and OCS stable.
Submissions with tags in titles truncated to '...' in submission lists https://github.com/pkp/ocs/commit/a92b7dcb13c5d86de3dc66d1bd4152f28f4c3978
Committed to OJS and OCS master.
Fixed.
Submissions with tags in titles truncated to '...' in submission lists https://github.com/pkp/ojs/commit/6ced85ef97f704cfdd1323f0f2c662ebd84463b3
Submissions with tags in titles truncated to '...' in submission lists https://github.com/pkp/ocs/commit/4dc63b922355c16674d272ceb27540c31e3e2fe5
Michael, this appears to affect the reading tools header where OTOH I'm not sure it should -- see the patch to rt.tpl. Also in templates/sectionEditor/submissionEventLog.tpl, templates/sectionEditor/submissionHistory.tpl.
Alec, are you suggesting that we simply remove the truncate in these cases (i.e. workaround #2)? That may be problematic for long article titles and/or log entries ...
Sorry, I read too fast -- you're right.