Version 3.1.4
This commit is contained in:
1 parent
1d4720f3e2
commit
ae5c01cc78
2563 files changed
+283048
-240689
No files matched your search
@@ -28,8 +28,8 @@ _temp.prototype.template_editor = {
|
||||
// the editor though, I'm going to create a map here of old ID => new ID. We can check this to
|
||||
// make sure the correct ID is sent for relevant requests. Got it?
|
||||
modifyMap: {
|
||||
'css': $A,
|
||||
'template': $A
|
||||
'css': $H(),
|
||||
'template': $H()
|
||||
},
|
||||
|
||||
/* ------------------------------ */
|
||||
@@ -52,7 +52,28 @@ _temp.prototype.template_editor = {
|
||||
$( 'css_add_css' ).observe('click', acp.template_editor.launchAddCSS);
|
||||
|
||||
// Add a body event handler to detect unsaved files
|
||||
Event.observe( window, 'beforeunload', acp.template_editor.checkUnsavedFiles );
|
||||
// Event.observe( window, 'beforeunload', acp.template_editor.checkUnsavedFiles );
|
||||
// Doesn't work in Safari, but appears to be Event.observe related, rather than the event itself.
|
||||
// @link http://scoop.simplyexcited.co.uk/2007/12/14/prototype-script-onbeforeunload-when-leaving-a-page/ (read comments)
|
||||
window.onbeforeunload = function()
|
||||
{
|
||||
var files = $H( acp.tabbedEditor.getAllFiles() );
|
||||
var changes = false;
|
||||
|
||||
if( !Object.isUndefined( files ) && files.size() )
|
||||
{
|
||||
files.each( function( file ){
|
||||
if( file.value['edited'] ){
|
||||
changes = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if( changes )
|
||||
{
|
||||
return ipb.lang['templates_navigate'];
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/* ------------------------------ */
|
||||
@@ -135,15 +156,15 @@ _temp.prototype.template_editor = {
|
||||
|
||||
// Does the toolbar need enabling?
|
||||
if( acp.template_editor.toolbarDisabled ){
|
||||
acp.template_editor.enableToolbar('css');
|
||||
acp.template_editor.enableToolbar('css', cssid );
|
||||
}
|
||||
|
||||
// And finally...
|
||||
$('add_css_name').value = '';
|
||||
acp.template_editor.popups['add_css'].hide();
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) },
|
||||
onException: function( f,e ){ alert( "Exception: " + e ); },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ); },
|
||||
onComplete: function(t){ acp.template_editor.setLoadingMsg(''); }
|
||||
});
|
||||
},
|
||||
@@ -266,11 +287,11 @@ _temp.prototype.template_editor = {
|
||||
}
|
||||
|
||||
// Reload bits
|
||||
acp.template_editor.loadGroupBits(e, currentGroup, true)
|
||||
acp.template_editor.loadGroupBits(e, currentGroup, true);
|
||||
|
||||
// Does the toolbar need enabling?
|
||||
if( acp.template_editor.toolbarDisabled ){
|
||||
acp.template_editor.enableToolbar('template');
|
||||
acp.template_editor.enableToolbar('template', templateid );
|
||||
}
|
||||
|
||||
|
||||
@@ -280,8 +301,8 @@ _temp.prototype.template_editor = {
|
||||
acp.template_editor.popups['add_bit'].hide();
|
||||
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) },
|
||||
onException: function( f,e ){ alert( "Exception: " + e ); },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ); },
|
||||
onComplete: function(t){ acp.template_editor.setLoadingMsg(''); }
|
||||
|
||||
});
|
||||
@@ -303,7 +324,7 @@ _temp.prototype.template_editor = {
|
||||
*
|
||||
* @param {event} e The event
|
||||
*/
|
||||
checkUnsavedFiles: function(e)
|
||||
checkUnsavedFiles: function()
|
||||
{
|
||||
var files = $H( acp.tabbedEditor.getAllFiles() );
|
||||
var changes = false;
|
||||
@@ -321,7 +342,7 @@ _temp.prototype.template_editor = {
|
||||
{
|
||||
if( !confirm( ipb.lang['templates_navigate'] ) )
|
||||
{
|
||||
Event.stop(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,6 +592,7 @@ _temp.prototype.template_editor = {
|
||||
},
|
||||
|
||||
/* ------------------------------ */
|
||||
/* ! loadGroupBits */
|
||||
/**
|
||||
* Loads the template bits within a group
|
||||
*
|
||||
@@ -814,6 +836,18 @@ _temp.prototype.template_editor = {
|
||||
acp.tabbedEditor.closeTab( 'template_' + fileid );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
var _oldId = acp.template_editor.reverseCheckMap( fileid, 'template' );
|
||||
|
||||
if( _oldId )
|
||||
{
|
||||
if( !Object.isUndefined( acp.template_editor.currentlyOpen.get('template_' + _oldId) ) ){
|
||||
acp.tabbedEditor.closeTab( 'template_' + _oldId );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -823,8 +857,8 @@ _temp.prototype.template_editor = {
|
||||
}
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) },
|
||||
onException: function( f,e ){ alert( "Exception: " + e ); },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ); },
|
||||
onComplete: function(t){ acp.template_editor.setLoadingMsg(''); }
|
||||
});
|
||||
},
|
||||
@@ -936,8 +970,8 @@ _temp.prototype.template_editor = {
|
||||
//Debug.dir( t.responseJSON );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) },
|
||||
onException: function( f,e ){ alert( "Exception: " + e ); },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ); },
|
||||
onComplete: function(t){ acp.template_editor.setLoadingMsg(''); }
|
||||
});
|
||||
},
|
||||
@@ -983,8 +1017,8 @@ _temp.prototype.template_editor = {
|
||||
//Debug.dir( template );
|
||||
acp.template_editor.openTemplateBit( templateid, template );
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) },
|
||||
onException: function( f,e ){ alert( "Exception: " + e ); },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ); },
|
||||
onComplete: function(t){ acp.template_editor.setLoadingMsg(''); }
|
||||
} );
|
||||
},
|
||||
@@ -1015,6 +1049,7 @@ _temp.prototype.template_editor = {
|
||||
},
|
||||
|
||||
/* ------------------------------ */
|
||||
/* ! enableToolbar */
|
||||
/**
|
||||
* Enables the toolbar for templates or css
|
||||
*
|
||||
@@ -1052,14 +1087,20 @@ _temp.prototype.template_editor = {
|
||||
{
|
||||
// Get current file info
|
||||
var info = acp.template_editor.currentlyOpen.get( 'template_' + _fileid );
|
||||
var state = $('group_' + info['template_group'] + '_bit_' + fileid).readAttribute('state');
|
||||
|
||||
if( !Object.isUndefined( info ) && $('group_' + info['template_group'] + '_bit_' + fileid) )
|
||||
{
|
||||
var state = $('group_' + info['template_group'] + '_bit_' + fileid).readAttribute('state');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = acp.template_editor.currentlyOpen.get( 'css_' + fileid );
|
||||
var state = $('css_' + fileid).readAttribute('state');
|
||||
if( $('css_' + fileid) )
|
||||
{
|
||||
var state = $('css_' + fileid).readAttribute('state');
|
||||
}
|
||||
}
|
||||
} catch(err) { Debug.error( err ) }
|
||||
} catch(err) { Debug.error( err ); }
|
||||
|
||||
if( state == 'modified' )
|
||||
{
|
||||
@@ -1290,8 +1331,8 @@ _temp.prototype.template_editor = {
|
||||
acp.template_editor._buildCSS( true );
|
||||
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) },
|
||||
onException: function( f,e ){ alert( "Exception: " + e ); },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ); },
|
||||
onComplete: function(t){ acp.template_editor.setLoadingMsg(''); }
|
||||
});
|
||||
},
|
||||
@@ -1409,14 +1450,15 @@ _temp.prototype.template_editor = {
|
||||
acp.template_editor.popups.get('variables_' + fileid).hide();
|
||||
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) },
|
||||
onException: function( f,e ){ alert( "Exception: " + e ); },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ); },
|
||||
onComplete: function(t){ acp.template_editor.setLoadingMsg(''); }
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/* ------------------------------ */
|
||||
/* ! saveCurrentFile */
|
||||
/**
|
||||
* Saves the currently open file
|
||||
*
|
||||
@@ -1521,8 +1563,8 @@ _temp.prototype.template_editor = {
|
||||
acp.template_editor._buildCSS( true );
|
||||
}
|
||||
},
|
||||
onException: function( f,e ){ alert( "Exception: " + e ) },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ) },
|
||||
onException: function( f,e ){ alert( "Exception: " + e ); },
|
||||
onFailure: function( t ){ alert( "Failure: " + t.responseText ); },
|
||||
onComplete: function(t){ acp.template_editor.setLoadingMsg(''); }
|
||||
});
|
||||
},
|
||||
@@ -1619,7 +1661,7 @@ _temp.prototype.template_editor = {
|
||||
popup.ready = false;
|
||||
$( popup.getObj() ).remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
/* CSS file */
|
||||
else
|
||||
@@ -1634,10 +1676,10 @@ _temp.prototype.template_editor = {
|
||||
popup.ready = false;
|
||||
$( popup.getObj() ).remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var _dims = document.viewport.getDimensions();
|
||||
var _dims = document.viewport.getDimensions();
|
||||
|
||||
popup = new ipb.Popup( 'comparison', { type: 'pane', modal: true, w: ( _dims.width - 50 ) + 'px', h: ( _dims.height - 50 ) + 'px', ajaxURL: url, hideAtStart: false, close: 'a[rel="close"]' }, { 'afterAjax': _callback } );
|
||||
return false;
|
||||
@@ -1651,7 +1693,7 @@ _temp.prototype.template_editor = {
|
||||
*/
|
||||
setLoadingMsg: function(msg)
|
||||
{
|
||||
if( msg.blank() )
|
||||
if( msg == undefined || msg.blank() )
|
||||
{
|
||||
$('t_status').removeClassName('loading').update();
|
||||
return;
|
||||
@@ -1736,10 +1778,4 @@ _temp.prototype.template_editor = {
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
Reference in new issue
Block a user