MINOR: Removed 2.3 specific code. Userforms trunk is now 2.4+ compatible only. For 2.3 compatibility use branches/0.2. BUGFIX: fixed paths for fieldeditor js

This commit is contained in:
Will Rossiter 2009-12-07 00:52:00 +00:00
parent 81a2cd0a1f
commit dfc2476c79
5 changed files with 15 additions and 33 deletions

2
README
View File

@ -12,7 +12,7 @@ Sean Harvey (Nickname: sharvey, halkyon)
Requirements
-----------------------------------------------
SilverStripe 2.3.2+
SilverStripe 2.4.0+
Documentation
-----------------------------------------------

View File

@ -115,11 +115,8 @@ class UserDefinedForm extends Page {
*/
public function doPublish() {
// remove fields on the live table which could have been orphaned.
if(defined('DB::USE_ANSI_SQL')) {
$live = Versioned::get_by_stage("EditableFormField", "Live", "\"EditableFormField\".\"ParentID\" = $this->ID");
} else {
$live = Versioned::get_by_stage("EditableFormField", "Live", "`EditableFormField`.ParentID = $this->ID");
}
$live = Versioned::get_by_stage("EditableFormField", "Live", "\"EditableFormField\".\"ParentID\" = $this->ID");
if($live) {
foreach($live as $field) {
$field->deleteFromStage('Live');

View File

@ -31,11 +31,8 @@ class EditableMultipleOptionField extends EditableFormField {
* @return void
*/
public function publish($fromStage, $toStage, $createNewVersion = false) {
if(defined('DB::USE_ANSI_SQL')) {
$live = Versioned::get_by_stage("EditableOption", "Live", "\"EditableOption\".\"ParentID\" = $this->ID");
} else {
$live = Versioned::get_by_stage("EditableOption", "Live", "`EditableOption`.ParentID = $this->ID");
}
$live = Versioned::get_by_stage("EditableOption", "Live", "\"EditableOption\".\"ParentID\" = $this->ID");
if($live) {
foreach($live as $option) {
$option->delete();

View File

@ -48,8 +48,8 @@ class FieldEditor extends FormField {
*/
function Fields() {
Requirements::css("userforms/css/FieldEditor.css");
Requirements::javascript("jsparty/jquery/ui/ui.core.js");
Requirements::javascript("jsparty/jquery/ui/ui.sortable.js");
Requirements::javascript(SAPPHIRE_DIR ."/thirdparty/jquery-ui/ui.core.js");
Requirements::javascript(SAPPHIRE_DIR ."/thirdparty/jquery-ui/ui.sortable.js");
Requirements::javascript("userforms/javascript/UserForm.js");
// Don't return any fields unless we actually have the dependent parameters set on the form field
@ -178,13 +178,9 @@ class FieldEditor extends FormField {
$parentID = $this->form->getRecord()->ID;
if($parentID) {
$parentID = Convert::raw2sql($parentID); // who knows what could happen
$parentID = Convert::raw2sql($parentID);
if(defined('DB::USE_ANSI_SQL')) {
$highestSort = DB::query("SELECT MAX(\"Sort\") FROM \"EditableFormField\" WHERE \"ParentID\" = '$parentID'");
} else {
$highestSort = DB::query("SELECT MAX(Sort) FROM EditableFormField WHERE ParentID = '$parentID'");
}
$highestSort = DB::query("SELECT MAX(\"Sort\") FROM \"EditableFormField\" WHERE \"ParentID\" = '$parentID'");
$sort = $highestSort->value() + 1;
@ -218,11 +214,7 @@ class FieldEditor extends FormField {
if($parent) {
$sql_parent = Convert::raw2sql($parent);
if(defined('DB::USE_ANSI_SQL')) {
$highestSort = DB::query("SELECT MAX(\"Sort\") FROM \"EditableOption\" WHERE \"ParentID\" = '$sql_parent'");
} else {
$highestSort = DB::query("SELECT MAX(Sort) FROM EditableOption WHERE ParentID = '$sql_parent'");
}
$highestSort = DB::query("SELECT MAX(\"Sort\") FROM \"EditableOption\" WHERE \"ParentID\" = '$sql_parent'");
$sort = $highestSort->value() + 1;

View File

@ -82,11 +82,7 @@ class SubmittedFormReportField extends FormField {
// Get the CSV header rows from the database
if(defined('DB::USE_ANSI_SQL')) {
$tmp = DB::query("SELECT DISTINCT \"Name\", \"Title\" FROM \"SubmittedFormField\" LEFT JOIN \"SubmittedForm\" ON \"SubmittedForm\".\"ID\" = \"SubmittedFormField\".\"ParentID\" WHERE \"SubmittedFormField\".\"ParentID\" IN (" . implode(',', $inClause) . ") ORDER BY \"SubmittedFormField\".\"ID\"");
} else {
$tmp = DB::query("SELECT DISTINCT `Name`, `Title` FROM `SubmittedFormField` LEFT JOIN `SubmittedForm` ON `SubmittedForm`.`ID` = `SubmittedFormField`.`ParentID` WHERE `SubmittedFormField`.`ParentID` IN (" . implode(',', $inClause) . ") ORDER BY `SubmittedFormField`.`ID`");
}
$tmp = DB::query("SELECT DISTINCT \"Name\", \"Title\" FROM \"SubmittedFormField\" LEFT JOIN \"SubmittedForm\" ON \"SubmittedForm\".\"ID\" = \"SubmittedFormField\".\"ParentID\" WHERE \"SubmittedFormField\".\"ParentID\" IN (" . implode(',', $inClause) . ") ORDER BY \"SubmittedFormField\".\"ID\"");
// Sort the Names and Titles from the database query into separate keyed arrays
foreach($tmp as $array) {
@ -137,8 +133,8 @@ class SubmittedFormReportField extends FormField {
user_error("No submissions to export.", E_USER_ERROR);
}
if(class_exists('SS_HTTPRequest')) SS_HTTPRequest::send_file($csvData, $fileName)->output();
else HTTPRequest::send_file($csvData, $fileName)->output();
SS_HTTPRequest::send_file($csvData, $fileName)->output();
} else {
user_error("'$SQL_ID' is a valid type, but we can't find a UserDefinedForm in the database that matches the ID.", E_USER_ERROR);
}