Commit ccf9d76f authored by Carsten  Rose's avatar Carsten Rose
Browse files

Report.php: removed '$this->pageDefaults["sip"]' - all 'page' links contains now be default a sip.

parent bfd2b54f
......@@ -128,9 +128,9 @@ class Report {
$this->pageDefaults["msgbox"]["pagec"] = "Please confirm!";
$this->pageDefaults["sip"]["paged"] = TOKEN_SIP;
$this->pageDefaults["sip"]["pagee"] = TOKEN_SIP;
$this->pageDefaults["sip"]["pagen"] = TOKEN_SIP;
// $this->pageDefaults["sip"]["paged"] = TOKEN_SIP;
// $this->pageDefaults["sip"]["pagee"] = TOKEN_SIP;
// $this->pageDefaults["sip"]["pagen"] = TOKEN_SIP;
$this->pageDefaults["icon"]["paged"] = TOKEN_DELETE;
$this->pageDefaults["icon"]["pagee"] = TOKEN_EDIT;
......@@ -847,10 +847,10 @@ class Report {
if (!empty($allParam[6]))
$link .= $this->composeLinkPart(TOKEN_RENDER, $allParam[6]); // -- render mode --
if (!empty($allParam[7]))
$allParam[7] = $this->pageDefaults["sip"][$columnName]; // if no SIP behaviour defined, use default
if (empty($allParam[7]))
$allParam[7] = '1'; // if no SIP behaviour defined: sip is set
$link .= TOKEN_SIP . "|"; // page always get a sip
$link .= $this->composeLinkPart(TOKEN_SIP, $allParam[7]); // -- SIP --
if ($this->pageDefaults["icon"][$columnName])
$link .= $this->pageDefaults["icon"][$columnName] . "|";
......@@ -858,15 +858,6 @@ class Report {
return ($link);
}
/**
* The main method of the PlugIn
*
* @param string $content : The PlugIn content
* @param array $conf : The PlugIn configuration
* @return string The content that is displayed on the website
*/
//Check ob arr1 nur 1 Feld mehr hat als arr2
/**
* If there is a value (or a defaultValue): compose it together with qualifier and delimiter.
*
......@@ -888,7 +879,7 @@ class Report {
}
/**
* Renders pageX: extract token and determine if any default value has be applied
* Renders _pageX: extract token and determine if any default value has to be applied
*
* @param string $columnName
* @param string $columnValue
......@@ -902,14 +893,16 @@ class Report {
$param = explode('|', $columnValue);
# get all defaultvalues, depending on the columnname
$defaultImage = $this->pageDefaults["icon"][$columnName];
$defaultHash = $this->pageDefaults["sip"][$columnName];
$defaultImage = isset($this->pageDefaults["icon"][$columnName]) ? $this->pageDefaults["icon"][$columnName] : '';
$defaultSip = 's';
# define defaultquestion only, if pagetype needs a question
if ($this->pageDefaults["msgbox"][$columnName]) $defaultQuestion = 'q:' . $this->pageDefaults["msgbox"][$columnName];
if (!empty($this->pageDefaults["msgbox"][$columnName])) {
$defaultQuestion = 'q:' . $this->pageDefaults["msgbox"][$columnName];
}
foreach ($param as $key) {
switch (substr($key, 0, 1)) {
switch ($key[0]) {
case TOKEN_PICTURE:
case TOKEN_EDIT:
case TOKEN_NEW:
......@@ -922,7 +915,7 @@ class Report {
$defaultImage = ''; // if any of the img token is given: no default
break;
case TOKEN_SIP:
$defaultHash = ''; // if a hash definition is given: no default
$defaultSip = ''; // if a hash definition is given: no default
break;
case TOKEN_QUESTION:
$defaultQuestion = ''; // if a question is given: no default
......@@ -932,12 +925,16 @@ class Report {
$columnValue .= "|";
// append defaulst
if ($defaultImage) $columnValue .= $defaultImage . "|";
if ($defaultHash) $columnValue .= $defaultHash . "|";
if ($defaultQuestion) $columnValue .= $defaultQuestion . "|";
#debug($columnValue);
// append defaults
if ($defaultImage !== '') {
$columnValue .= $defaultImage . "|";
}
if ($defaultSip !== '') {
$columnValue .= $defaultSip . "|";
}
if ($defaultQuestion !== '') {
$columnValue .= $defaultQuestion . "|";
}
return ($columnValue);
}
......
......@@ -11,6 +11,7 @@ use qfq\Store;
require_once(__DIR__ . '/../../qfq/Database.php');
require_once(__DIR__ . '/../../qfq/store/Store.php');
require_once(__DIR__ . '/../../qfq/store/Sip.php');
/**
* Class AbstractDatabaseTest
......@@ -32,6 +33,11 @@ abstract class AbstractDatabaseTest extends PHPUnit_Framework_TestCase {
*/
protected $store = null;
/*
* @var qfq\Sip
*/
protected $sip = null;
/**
* @param $filename
* @param $ignoreError
......@@ -59,13 +65,16 @@ abstract class AbstractDatabaseTest extends PHPUnit_Framework_TestCase {
protected function setUp() {
// Init the store also reads db credential configuration
$this->store = \qfq\Store::getInstance('', true);
$this->store = qfq\Store::getInstance('', true);
$this->sip = new qfq\Sip('fakesessionname', true);
$this->sip->sipUniqId('badcaffee1234');
// SWITCH to TestDB
$this->store->setVar(SYSTEM_DB_NAME, $this->store->getVar(SYSTEM_DB_NAME_TEST, STORE_SYSTEM), STORE_SYSTEM);
if ($this->db === null) {
$this->db = new \qfq\Database();
$this->db = new qfq\Database();
}
/// Establish additional mysqli access
......
......@@ -837,7 +837,6 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
// Sip: Page
$result = $link->renderLink('p:form&r=12&xId=2345&L=1&type=99&gId=55|s');
$this->assertEquals('<a href="index.php?id=form&L=1&type=99&s=badcaffee1234" class="internal" >index.php?id=form&L=1&type=99&s=badcaffee1234</a>', $result);
}
......
......@@ -213,6 +213,7 @@ class ReportTest extends AbstractDatabaseTest {
protected function setUp() {
parent::setUp();
$GLOBALS["TSFE"] = new FakeTSFEReport();
$this->eval = new qfq\Evaluate($this->store, $this->db);
$this->report = new qfq\Report(array(), $this->store->getVar(SYSTEM_SESSION_NAME, STORE_SYSTEM), $this->eval, true);
......
Supports Markdown
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