API CHANGE Removed ModalForm, ModalDialog, GBModalDialog javascript classes from cms, were superseded by a simple javascript alert a while ago (see r11727 and r12245)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92577 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 02:35:07 +00:00
parent e68fca146a
commit 094c30ea4a
6 changed files with 0 additions and 208 deletions

View File

@ -30,14 +30,12 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'addmember', 'addmember',
'addpage', 'addpage',
'buildbrokenlinks', 'buildbrokenlinks',
'canceldraftchangesdialog',
'compareversions', 'compareversions',
'createtranslation', 'createtranslation',
'delete', 'delete',
'deletefromlive', 'deletefromlive',
'deleteitems', 'deleteitems',
'DeleteItemsForm', 'DeleteItemsForm',
'dialog',
'duplicate', 'duplicate',
'duplicatewithchildren', 'duplicatewithchildren',
'getpagecount', 'getpagecount',
@ -966,43 +964,6 @@ JS;
} }
} }
function dialog() {
Requirements::clear();
$buttons = new DataObjectSet;
if($_REQUEST['Buttons']) foreach($_REQUEST['Buttons'] as $button) {
list($name, $title) = explode(',',$button,2);
$buttons->push(new ArrayData(array(
"Name" => $name,
"Title" => $title,
)));
}
return array(
"Message" => htmlentities($_REQUEST['Message']),
"Buttons" => $buttons,
"Modal" => $_REQUEST['Modal'] ? true : false,
);
}
function canceldraftchangesdialog() {
Requirements::clear();
Requirements::css(CMS_DIR . 'css/dialog.css');
Requirements::javascript(THIRDPARTY_DIR . '/prototype.js');
Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js');
Requirements::javascript(THIRDPARTY_DIR . '/prototype_improvements.js');
Requirements::javascript(CMS_DIR . '/javascript/dialog.js');
$message = _t('CMSMain.COPYPUBTOSTAGE',"Do you really want to copy the published content to the stage site?");
$buttons = "<button name=\"OK\">" . _t('CMSMain.OK','OK') ."</button><button name=\"Cancel\">" . _t('CMSMain.CANCEL',"Cancel") . "</button>";
return $this->customise( array(
'Message' => $message,
'Buttons' => $buttons,
'DialogType' => 'alert'
))->renderWith('Dialog');
}
/** /**
* Batch Actions Handler * Batch Actions Handler
*/ */

View File

@ -1,18 +0,0 @@
p.message {
/*background: url(../cms/images/dialogs/alert.gif) repeat top left;*/
padding-left: 60px;
}
img {
float: left;
margin-left: -60px;
}
span {
clear: right;
}
body {
font-family: Arial, sans-serif;
font-size: 1em;
}

View File

@ -661,96 +661,6 @@ ModalForm.prototype = {
} }
} }
function doYouWantToRollback(handlers) {
var url = document.getElementsByTagName('base')[0].href + 'admin/canceldraftchangesdialog';
OpenModalDialog(url, handlers, 'Are you sure?' );
}
function modalDialog(url, handlers) {
var baseURL = document.getElementsByTagName('base')[0].href;
if(window.showModalDialog) {
var result = showModalDialog(baseURL + url + '&Modal=1', null, "status:no;dialogWidth:400px;dialogHeight:150px;edge:sunken");
if(handlers[result])
handlers[result]();
}
}
ModalDialog = Class.create();
ModalDialog.prototype = {
initialize: function(url, handlers) {
this.url = url;
this.handlers = handlers;
this.timer = setInterval(this.interval.bind(this), 50);
this.window = window.open(this.url, 'dialog', "status=no,width=400,height=150,edge=sunken");
this.window.dialogObject = this;
this.window.linkedObject = this;
setTimeout( (function(){this.window.linkedObject = this;}).bind(this), 500);
},
force: function (val) {
this.finished = true;
this.clearInterval(this.time);
if(this.handlers[val]) {
_DO_YOU_WANT_TO_SAVE_IS_OPEN = false;
(this.handlers[val])();
} else {
throw("Couldn't find a handler called '" + this.result + "'");
}
},
interval: function() {
if(this.finished) {
clearInterval(this.timer);
return;
}
if(!this.window || this.window.closed) {
clearInterval(this.timer);
if(this.handlers) {
if(this.handlers[this.result]) {
_DO_YOU_WANT_TO_SAVE_IS_OPEN = false;
(this.handlers[this.result])();
} else {
throw("Couldn't find a handler called '" + this.result + "'");
}
}
} else {
this.window.focus();
}
}
}
window.top._OPEN_DIALOG = null;
OpenModalDialog = function( url, handlers, message ) {
var dialog = new GBModalDialog( url, handlers, message );
}
GBModalDialog = Class.create();
GBModalDialog.prototype = {
initialize: function( url, handlers, message ) {
this.url = url;
this.handlers = handlers;
this.caption = message;
window.top._OPEN_DIALOG = this;
GB_show( this.caption, this.url, 110, 450 );
},
execHandler: function( handler ) {
GB_hide();
if( this.handlers[handler] )
this.handlers[handler]();
else
throw( "Unknown handler '" + handler + "'" );
}
}
function hideLoading() { function hideLoading() {
if($('Loading')) $('Loading').style.display = 'none'; if($('Loading')) $('Loading').style.display = 'none';
Element.removeClassName(document.body, 'stillLoading'); Element.removeClassName(document.body, 'stillLoading');

View File

@ -1,10 +0,0 @@
Behaviour.register({
'.buttons button' : {
onclick: function() {
window.top._OPEN_DIALOG.execHandler( this.name );
return false;
}
}
});

View File

@ -1,36 +0,0 @@
<html>
<head>
<script>
function buttonClick(el) {
<% if Modal %>
window.returnValue = el.name;
window.close();
<% else %>
if(window.linkedObject) {
if(el.name) {
window.linkedObject.result = el.name;
} else {
throw("<% _t('BUTTONNOTFOUND', 'Couldn\'t find the button name') %>");
}
} else {
throw("<% _t('NOLINKED', 'Can\'t find window.linkedObject to send the button click back to the main window') %>");
}
window.close();
<% end_if %>
}
</script>
</head>
<body>
<p>$Message</p>
<p style="align: center">
<% control Buttons %>
<input type="button" value="$Title" name="$Name" onclick="buttonClick(this);" />
<% end_control %>
</p>
</body>
</html>

View File

@ -1,15 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<% base_tag %>
<title>$Title</title>
</head>
<body class="$DialogType">
<p class="message"><img src="cms/images/dialogs/{$DialogType}.gif" /><span>$Message</span></p>
<div class="buttons">
$Buttons
</div>
</body>
</html>