Skip to content

Commit

Permalink
setDataFromPost should actually simulate data being saved, as Entry->…
Browse files Browse the repository at this point in the history
…commit will do a repeat call without simulation to save the data
  • Loading branch information
brendo committed Jul 1, 2011
1 parent b4022d8 commit 2df7104
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions symphony/content/content.publish.php
Expand Up @@ -62,9 +62,9 @@ public function __viewIndex(){
$filters = array();
$filter_querystring = $prepopulate_querystring = $where = $joins = NULL;
$current_page = (isset($_REQUEST['pg']) && is_numeric($_REQUEST['pg']) ? max(1, intval($_REQUEST['pg'])) : 1);

if(isset($_REQUEST['filter'])) {

// legacy implementation, convert single filter to an array
// split string in the form ?filter=handle:value
if(!is_array($_REQUEST['filter'])) {
Expand All @@ -73,9 +73,9 @@ public function __viewIndex(){
} else {
$filters = $_REQUEST['filter'];
}

foreach($filters as $handle => $value) {

$field_id = Symphony::Database()->fetchVar('id', 0, sprintf(
"SELECT `f`.`id`
FROM `tbl_fields` AS `f`, `tbl_sections` AS `s`
Expand All @@ -86,21 +86,21 @@ public function __viewIndex(){
$handle,
$section->get('handle'))
);

$field = $entryManager->fieldManager->fetch($field_id);

if($field instanceof Field) {
// For deprecated reasons, call the old, typo'd function name until the switch to the
// properly named buildDSRetrievalSQL function.
$field->buildDSRetrivalSQL(array($value), $joins, $where, false);
$filter_querystring .= sprintf("filter[%s]=%s&", $handle, rawurlencode($value));
$prepopulate_querystring .= sprintf("prepopulate[%d]=%s&", $field_id, rawurlencode($value));
$prepopulate_querystring .= sprintf("prepopulate[%d]=%s&", $field_id, rawurlencode($value));
} else {
unset($filters[$i]);
}

}

$filter_querystring = preg_replace("/&$/", '', $filter_querystring);
$prepopulate_querystring = preg_replace("/&$/", '', $prepopulate_querystring);

Expand Down Expand Up @@ -292,11 +292,11 @@ public function __viewIndex(){
* @param string $context
* '/publish/'
* @param array $tableData
* An array of `Widget::TableData`, passed by reference
* An array of `Widget::TableData`, passed by reference
* @param integer $section_id
* The current Section ID
* The current Section ID
* @param integer $entry_id
* The Entry ID for this row
* The Entry ID for this row
*/
Symphony::ExtensionManager()->notifyMembers('AddCustomPublishColumnData', '/publish/', array('tableData' => &$tableData, 'section_id' => $section->get('id'), 'entry_id' => $entry));

Expand Down Expand Up @@ -406,14 +406,14 @@ public function __actionIndex(){
* @param string $context
* '/publish/'
* @param array $checked
* An array of Entry ID's passed by reference
* An array of Entry ID's passed by reference
*/
Symphony::ExtensionManager()->notifyMembers('Delete', '/publish/', array('entry_id' => &$checked));

$entryManager = new EntryManager($this->_Parent);
$entryManager->delete($checked);

redirect($_SERVER['REQUEST_URI']);
redirect($_SERVER['REQUEST_URI']);

default:

Expand Down Expand Up @@ -499,7 +499,7 @@ public function __viewNew() {

// Check if there is a field to prepopulate
if (isset($_REQUEST['prepopulate'])) {

foreach($_REQUEST['prepopulate'] as $field_id => $value) {

$this->Form->prependChild(Widget::Input(
Expand All @@ -515,7 +515,7 @@ public function __viewNew() {
$field->processRawFieldData($value, $error, true)
);
}

}

}
Expand Down Expand Up @@ -652,7 +652,7 @@ public function __actionNew(){
$prepopulate_querystring = trim($prepopulate_querystring, '&');
}

redirect(sprintf(
redirect(sprintf(
'%s/publish/%s/edit/%d/created/%s',
SYMPHONY_URL,
$this->_context['section_handle'],
Expand Down Expand Up @@ -725,7 +725,7 @@ public function __viewEdit() {

if(isset($_REQUEST['prepopulate'])){
$link .= '?';
foreach($_REQUEST['prepopulate'] as $field_id => $value) {
foreach($_REQUEST['prepopulate'] as $field_id => $value) {
$link .= "prepopulate[$field_id]=$value&";
}
$link = preg_replace("/&$/", '', $link);
Expand Down Expand Up @@ -781,7 +781,7 @@ public function __viewEdit() {
"prepopulate[{$field_id}]",
rawurlencode($value),
'hidden'
));
));
}
}

Expand Down Expand Up @@ -860,7 +860,7 @@ public function __actionEdit(){
if(__ENTRY_FIELD_ERROR__ == $entry->checkPostData($fields, $this->_errors)):
$this->pageAlert(__('Some errors were encountered while attempting to save.'), Alert::ERROR);

elseif(__ENTRY_OK__ != $entry->setDataFromPost($fields, $error)):
elseif(__ENTRY_OK__ != $entry->setDataFromPost($fields, $error, true)):
$this->pageAlert($error['message'], Alert::ERROR);

else:
Expand All @@ -883,7 +883,7 @@ public function __actionEdit(){

}

else{
else {

/**
* Just after the editing of an Entry
Expand Down Expand Up @@ -926,7 +926,7 @@ public function __actionEdit(){
* @param string $context
* '/publish/'
* @param array $checked
* An array of Entry ID's passed by reference
* An array of Entry ID's passed by reference
*/
$checked = array($entry_id);
Symphony::ExtensionManager()->notifyMembers('Delete', '/publish/', array('entry_id' => &$checked));
Expand Down

0 comments on commit 2df7104

Please sign in to comment.