Commit d7279b85 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Turn on auto_escape, minor fixes to resume/profile blocktype templates


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 4e73f30b
{auto_escape off}
<div>
{if !$simpledisplay}<h3>{$title|escape}</h3>{/if}
<div>{$description|escape}</div>
{if !$simpledisplay}<h3>{$title}</h3>{/if}
<div>{$description}</div>
{if $tags}<div class="tags">{str tag=tags}: {list_tags owner=$owner tags=$tags}</div>{/if}
<div>
{if (isset($children))}
......@@ -20,9 +19,9 @@
<tbody>
{foreach from=$children item=child}
<tr class="{cycle values='r0,r1'}">
<td><img src="{$child->iconsrc|escape}" border="0" alt="{$child->artefacttype|escape}"></td>
<td><a href="{$WWWROOT}view/artefact.php?artefact={$child->id|escape}&amp;view={$viewid|escape}" title="{$child->hovertitle|escape}">{$child->title|escape}</a></td>
<td>{$child->description|escape}</td>
<td><img src="{$child->iconsrc}" border="0" alt="{$child->artefacttype}"></td>
<td><a href="{$WWWROOT}view/artefact.php?artefact={$child->id}&amp;view={$viewid}" title="{$child->hovertitle}">{$child->title}</a></td>
<td>{$child->description}</td>
{if !$simpledisplay}
<td>{$child->date}</td>
{/if}
......@@ -34,4 +33,4 @@
{/if}
</div>
</div>
{/auto_escape}
......@@ -59,7 +59,7 @@ class PluginBlocktypeContactinfo extends PluginBlocktype {
foreach ($configdata['artefactids'] as $id) {
try {
$artefact = artefact_instance_from_id($id);
if ($artefact->get('owner') == $viewowner) {
if (is_a($artefact, 'ArtefactTypeProfile') && $artefact->get('owner') == $viewowner) {
$rendered = $artefact->render_self(array('link' => true));
$data[$artefact->get('artefacttype')] = $rendered['html'];
}
......
{auto_escape off}
<ul>
{foreach from=$profileinfo key=key item=item}
<li><strong>{str tag=$key section=artefact.internal}:</strong> {$item}</li>
<li><strong>{str tag=$key section=artefact.internal}:</strong> {$item|safe}</li>
{/foreach}
</ul>
{/auto_escape}
</ul>
\ No newline at end of file
......@@ -59,7 +59,7 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype {
foreach ($configdata['artefactids'] as $id) {
try {
$artefact = artefact_instance_from_id($id);
if ($artefact->get('owner') == $viewowner) {
if (is_a($artefact, 'ArtefactTypeProfile') && $artefact->get('owner') == $viewowner) {
$rendered = $artefact->render_self(array('link' => true));
$data[$artefact->get('artefacttype')] = $rendered['html'];
}
......
......@@ -2,7 +2,7 @@
<p>{$profileinfo.introduction|clean_html|safe}</p>
{if $profileinfo && (count($profileinfo) != 1 || !$profileinfo.introduction)}<ul>
{foreach from=$profileinfo key=key item=item}
{if !in_array($key, array('introduction'))} <li><strong>{str tag=$key section=artefact.internal}:</strong> {$item}</li>
{if !in_array($key, array('introduction'))} <li><strong>{str tag=$key section=artefact.internal}:</strong> {$item|safe}</li>
{/if}
{/foreach}
</ul>{/if}
......
......@@ -604,7 +604,11 @@ class ArtefactTypeWebAddress extends ArtefactTypeProfileField {
class ArtefactTypeOfficialwebsite extends ArtefactTypeWebAddress {}
class ArtefactTypePersonalwebsite extends ArtefactTypeWebAddress {}
class ArtefactTypeBlogAddress extends ArtefactTypeWebAddress {}
class ArtefactTypeAddress extends ArtefactTypeProfileField {}
class ArtefactTypeAddress extends ArtefactTypeProfileField {
public function render_self($options) {
return array('html' => format_whitespace($this->title), 'javascript' => null);
}
}
class ArtefactTypeTown extends ArtefactTypeProfileField {}
class ArtefactTypeCity extends ArtefactTypeProfileField {}
class ArtefactTypeCountry extends ArtefactTypeProfileField {
......
......@@ -44,8 +44,6 @@ class PluginBlocktypeEntireresume extends PluginBlocktype {
public static function render_instance(BlockInstance $instance, $editing=false) {
require_once(get_config('docroot') . 'artefact/lib.php');
$smarty = smarty_core();
//$configdata = $instance->get('configdata');
//$configdata['viewid'] = $instance->get('view');
// Get data about the resume fields the user has
$return = '';
......
{auto_escape off}
{if $coverletter}<h2>{str tag=coverletter section=artefact.resume}</h2>
{$coverletter}{/if}
{$coverletter|safe}{/if}
{if $interest}<h3>{str tag=interest section=artefact.resume}</h3>
{$interest}{/if}
{$interest|safe}{/if}
{if $contactinformation}<h3>{str tag=contactinformation section=artefact.resume}</h3>
{$contactinformation}{/if}
{$contactinformation|safe}{/if}
{if $personalinformation}<h3>{str tag=personalinformation section=artefact.resume}</h3>
{$personalinformation}{/if}
{$personalinformation|safe}{/if}
{if $employmenthistory || $educationhistory}<h2>{str tag=History section=blocktype.resume/entireresume}</h2>{/if}
{if $employmenthistory}<h3>{str tag=employmenthistory section=artefact.resume}</h3>
{$employmenthistory}{/if}
{$employmenthistory|safe}{/if}
{if $educationhistory}<h3>{str tag=educationhistory section=artefact.resume}</h3>
{$educationhistory}{/if}
{$educationhistory|safe}{/if}
{if $certification}<h2>{str tag=certification section=artefact.resume}</h2>
{$certification}{/if}
{$certification|safe}{/if}
{if $book}<h2>{str tag=book section=artefact.resume}</h2>
{$book}{/if}
{$book|safe}{/if}
{if $membership}<h2>{str tag=membership section=artefact.resume}</h2>
{$membership}{/if}
{/auto_escape}
{$membership|safe}{/if}
......@@ -220,18 +220,13 @@ class ArtefactTypeContactinformation extends ArtefactTypeResume {
try {
$$f = artefact_instance_from_type($f, $this->get('owner'));
$rendered = $$f->render_self(array());
$smarty->assign($f, format_whitespace($rendered['html']));
$smarty->assign($f, $rendered['html']);
$smarty->assign('hascontent', true);
}
catch (Exception $e) { }
}
$template = 'artefact:resume:fragments/contactinformation.';
if (!empty($options['editing'])) {
$template .= 'editing.';
}
$template .= 'tpl';
return array('html' => $smarty->fetch($template));
return array('html' => $smarty->fetch('artefact:resume:fragments/contactinformation.tpl'));
}
public static function is_singular() {
......
{auto_escape off}
<table class="resumecontactinfo">
<tr>
<th>{str tag='address' section='artefact.internal'}</th>
<td>{$address}</td>
</tr>
<tr>
<th>{str tag='town' section='artefact.internal'}</th>
<td>{$town}</td>
</tr>
<tr>
<th>{str tag='city' section='artefact.internal'}</th>
<td>{$city}</td>
</tr>
<tr>
<th>{str tag='country' section='artefact.internal'}</th>
<td>{$country}</td>
</tr>
<tr>
<th>{str tag='faxnumber' section='artefact.internal'}</th>
<td>{$faxnumber}</td>
</tr>
<tr>
<th>{str tag='businessnumber' section='artefact.internal'}</th>
<td>{$businessnumber}</td>
</tr>
<tr>
<th>{str tag='homenumber' section='artefact.internal'}</th>
<td>{$homenumber}</td>
</tr>
<tr>
<th>{str tag='mobilenumber' section='artefact.internal'}</th>
<td>{$mobilenumber}</td>
</tr>
<tr>
<td colspan="2"> <button onClick="return editprofilebutton();">{str tag='editprofile' section='artefact.internal'}</button></td>
</tr>
</table>
{/auto_escape}
{auto_escape off}
{if $hascontent}
<table class="resumecontactinfo">
<colgroup width="50%" span="2"></colgroup>
{if $address}
<tr>
<th>{str tag='address' section='artefact.internal'}</th>
<td>{$address}</td>
<td>{$address|safe}</td>
</tr>
{/if}
{if $town}
<tr>
<th>{str tag='town' section='artefact.internal'}</th>
<td>{$town}</td>
<td>{$town|safe}</td>
</tr>
{/if}
{if $city}
<tr>
<th>{str tag='city' section='artefact.internal'}</th>
<td>{$city}</td>
<td>{$city|safe}</td>
</tr>
{/if}
{if $country}
<tr>
<th>{str tag='country' section='artefact.internal'}</th>
<td>{$country}</td>
<td>{$country|safe}</td>
</tr>
{/if}
{if $faxnumber}
<tr>
<th>{str tag='faxnumber' section='artefact.internal'}</th>
<td>{$faxnumber}</td>
<td>{$faxnumber|safe}</td>
</tr>
{/if}
{if $businessnumber}
<tr>
<th>{str tag='businessnumber' section='artefact.internal'}</th>
<td>{$businessnumber}</td>
<td>{$businessnumber|safe}</td>
</tr>
{/if}
{if $homenumber}
<tr>
<th>{str tag='homenumber' section='artefact.internal'}</th>
<td>{$homenumber}</td>
<td>{$homenumber|safe}</td>
</tr>
{/if}
{if $mobilenumber}
<tr>
<th>{str tag='mobilenumber' section='artefact.internal'}</th>
<td>{$mobilenumber}</td>
<td>{$mobilenumber|safe}</td>
</tr>
{/if}
</table>
{/if}
{/auto_escape}
{auto_escape off}
<table class="resumepersonalinfo">
<colgroup width="50%" span="2"></colgroup>
{foreach from=$fields key='field' item='value'}
<tr>
<th>{$field|escape}</th>
<td>{$value|escape}</td>
<th>{$field}</th>
<td>{$value}</td>
</tr>
{/foreach}
</table>
{/auto_escape}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment