Skip to content
Snippets Groups Projects
Commit 639a4573 authored by Tim Steiner's avatar Tim Steiner
Browse files

Bulletin Diff bug fix where nested <del> or <ins> tags were occuring.

parent 05d57eb3
No related branches found
No related tags found
No related merge requests found
......@@ -20,13 +20,13 @@ $this->layout()->tagline = $tagline . ': ' . $this->course->getCourseCode() . '
<div class="current">
<h2>Current</h2>
<div class="bulletinEntry">
<?php echo $this->bulletinEntryDiff($parentCourse, $course, $this->request); ?>
<?php echo $this->bulletinEntryDiff($parentCourse, $course, $this->request, 'current'); ?>
</div>
</div>
<div class="proposed">
<h2>Proposed</h2>
<div class="bulletinEntry">
<?php echo $this->bulletinEntryDiff($parentCourse, $course, $this->request); ?>
<?php echo $this->bulletinEntryDiff($parentCourse, $course, $this->request, 'proposed'); ?>
</div>
</div>
<div class="clear"></div>
......
......@@ -4,7 +4,7 @@ class App_View_Helper_BulletinEntryDiff
{
static protected $_diffRenderer;
public function bulletinEntryDiff(Courses_CourseModel $currentCourse, Courses_CourseModel $proposedCourse, $request)
public function bulletinEntryDiff(Courses_CourseModel $currentCourse, Courses_CourseModel $proposedCourse, $request, $parts = 'both')
{
// ES and IS
$currentES = ($currentCourse->isEssentialStudies() ? '[ES]' : '');
......@@ -130,6 +130,24 @@ class App_View_Helper_BulletinEntryDiff
$tidyConfig = array('show-body-only' => true);
$html = ob_get_clean();
if ($parts == 'current') {
for ($start = strpos($html, '<ins>'); $start != FALSE; $start = strpos($html, '<ins>', $start)) {
$end = strpos($html, '</ins>', $start);
if ($end > $start) {
$html = substr($html, 0, $start) . substr($html, $end + 6);
}
}
}
if ($parts == 'proposed') {
for ($start = strpos($html, '<del>'); $start != FALSE; $start = strpos($html, '<del>', $start)) {
$end = strpos($html, '</del>', $start);
if ($end > $start) {
$html = substr($html, 0, $start) . substr($html, $end + 6);
}
}
}
$html = tidy_repair_string($html, $tidyConfig, 'utf8');
return $html;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment