I'll try to give some code to get this working:
I didn't put this code in the Wiki beacuse of somedirty coding, and I have not tried
above Atk 5.5.
1)Modify the templates:
In editform.tlp & viewform.tlp add the the following code behind the {$field.full}:
Code:
{$field.full}{if $field.rev_link!=""}{$field.rev_link}{/if}
2) Add the following in the edithandler
just below the tooltip code and before the "$indexno++;":
Code:
if (in_array($field['name'],$node->m_revision_fields)) {
$popupurl="'/include.php?file=show_revision.inc&node=".$node->m_module.'.'.$node->m_type.'&rev_table='.$node->m_table.'&rev_field='.$field['name'].'&rev_atkprimkey='.rawurlencode(str_replace("'",'',$record['atkprimkey']))."'";
$popuptitle="'Revisioner'";
$tplfield["rev_link"]=' <a href="show_revisions.html" onclick="javascript:NewWindow2('.$popupurl.',event,'.$popuptitle.',700,250,1,1);return false;"><u>(Rev)</u></a>';
}
2) Add the following in the view handler
below the tooltip as well, and before the "$tplfield["full"] = $editsrc;":
Code:
if (in_array($field_name,$node->m_revision_fields) and !$simple)
{
$popupurl="'/include.php?file=show_revision.inc&node=".$node->m_module.'.'.$node->m_type.'&rev_table='.$node->m_table.'&rev_field='.$field_name.'&rev_atkprimkey='.rawurlencode(str_replace("'",'',$record['atkprimkey']))."'";
$popuptitle="'Revisioner'";
$tplfield["rev_link"]=' <a href="show_revisions.html" onclick="javascript:NewWindow2('.$popupurl.',event,'.$popuptitle.',700,250,1,1);return false;"><u>(Rev)</u></a>';
}
3 Then file show_revision.inc must be created which must be in allowed_includes & placed in root directory ( in this example):
Code:
<?php
include_once("atk.inc");
atksession();
atksecure();
$lng = atkconfig("language");
$rev_atkprimkey = rawurldecode($_GET["rev_atkprimkey"]);
//echo $rev_atkprimkey;
$rev_table = $_GET["rev_table"];
$rev_field= $_GET["rev_field"];
$module_node = $_GET["node"];
$arr=explode(".",$module_node);
$node=$arr[1];
$module=$arr[0];
$rev_field_text1= atktext("rev_field","revision",$lng);
$rev_field_text2= atktext($rev_field,$module,$lng);
$valuetext=atktext("rev_value","revision",$lng);
if (!$node)
$node=$module;
$SecurityManager=&atkGetSecurityManager();
$nodeobj=&atkGetNode($module_node);
if (!is_object($nodeobj) or $nodeobj->allowed('view')===false)
{
echo "<html><title>Error</title>";
echo '<body onblur="window.close();">';
echo atktext("error_node_action_access_denied","application",$lng );
echo '</body></html>';
die();
}
$title="Revisjonshistorikk for ".atktext("modul","application",$lng );
$title.=": ".atktext($node,$module, $lng );
echo "<html><title>$title</title>";
echo '<body onblur="window.close();">';
$db=&atkGetDb();
$arr=$db->getrows("select replace(rev_value,char(13),'<br>') as rev_value,rev_datetime,rev_username from revision where rev_atkprimkey='$rev_atkprimkey' and rev_table='$rev_table' and rev_field='$rev_field' order by rev_datetime desc");
echo '<div align="left"><a href="javascript:window.close();">'.text("close").'</a></div>';
$data=html_table($arr,true,"revision");
$data=str_replace($valuetext,$rev_field_text1.': '.$rev_field_text2,substr($data,0,50)).substr($data,50);
echo $data;
echo "</body></html>";
die();
function html_table($arr,$header=FALSE,$module="application",$columns=array())
{
$res="<table border='1'>";
foreach ($arr as $line)
{
if ($header)
{
$res.="<tr>";
foreach ($line as $key=>$col_value)
if(count($columns)==0 or in_array($key,$columns))
$res.="<th>".atktext($key,$module)."</th>";
$res.="</tr>";
$header=false;
}
$res.="<tr>";
foreach ($line as $key=>$col_value)
if(count($columns)==0 or in_array($key,$columns))
$res.="<td>$col_value</td>";
$res.="</tr>";
}
$res.="</table>";
return $res;
}
?>
There are probably something missing somewhere, but try this first.