diff --git a/code/CMSMain.php b/code/CMSMain.php index ee7127f0..6c515ddc 100644 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -282,8 +282,14 @@ JS; $idField->setValue($id); - if($record->ID && is_numeric( $record->ID ) ) $liveURLField->setValue(DB::query("SELECT URLSegment FROM SiteTree_Live WHERE ID = $id")->value()); - if(!$record->DeletedFromStage) $stageURLField->setValue($record->URLSegment); + if($record->ID && is_numeric( $record->ID ) ) { + $liveRecord = Versioned::get_one_by_stage('SiteTree', 'Live', "`SiteTree`.ID = $record->ID"); + if($liveRecord) $liveURLField->setValue($liveRecord->AbsoluteLink()); + } + + if(!$record->DeletedFromStage) { + $stageURLField->setValue($record->AbsoluteLink()); + } // getAllCMSActions can be used to completely redefine the action list if($record->hasMethod('getAllCMSActions')) { diff --git a/javascript/LeftAndMain_right.js b/javascript/LeftAndMain_right.js index a6b14061..58a4dbd1 100755 --- a/javascript/LeftAndMain_right.js +++ b/javascript/LeftAndMain_right.js @@ -433,7 +433,7 @@ StageLink.prototype = { var linkVal = linkField ? linkField.value : null; if(linkVal) { if(this.id != 'viewArchivedSite') this.style.display = ''; - this.href = this.baseURL() + linkVal + '/' + this.getVars; + this.href = linkVal + this.getVars; } else { if(this.id != 'viewArchivedSite') this.style.display = 'none'; }