Refactored CMS page-URL accessing to use ->AbsoluteLink(), which can be overridden by defining alternateAbsoluteLink()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41283 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-09-05 06:42:26 +00:00
parent df2b2f695a
commit 1bd7dce68a
2 changed files with 9 additions and 3 deletions

View File

@ -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')) {

View File

@ -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';
}