Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F785343
advanced
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 12, 9:10 AM
Size
4 KB
Mime Type
text/x-diff
Expires
Fri, Feb 14, 9:10 AM (1 d, 5 h)
Engine
blob
Format
Raw Data
Handle
564378
Attached To
rTADV Themes.Advanced
advanced
View Options
Index: platform/template_manager/inc/template_manager.js
===================================================================
--- platform/template_manager/inc/template_manager.js (revision 11483)
+++ platform/template_manager/inc/template_manager.js (revision 11484)
@@ -1,168 +1,174 @@
function TemplateManager ($edit_url) {
this._editUrl = $edit_url;
this._blocks = {};
this._blockOrder = Array ();
$(document).ready(
function() {
aTemplateManager.searchBlocks();
}
);
}
TemplateManager.prototype.onBtnClick = function ($e, $element) {
var $id = $element.id.replace(/_btn$/, '');
var $block_info = this._blocks[$id];
var $url = this._editUrl.replace('#BLOCK#', $block_info.block_name + ':' + $block_info.function_name).replace('#EVENT#', '');
this.setFullscreen();
TB.show(
{
url: $url,
onDataReceived: TemplateManager.prototype.onDataReceived,
onAfterShow: function() {
TemplateManager.prototype.initEditor.call(this);
}
}
);
$e.stopPropagation();
}
TemplateManager.prototype.setFullscreen = function ($restore) {
getFrame('head').$FrameResizer.fullScreen($restore);
}
TemplateManager.prototype.saveBlock = function () {
var $url = this._editUrl.replace('#BLOCK#', $('#block').val() ).replace('#EVENT#', 'OnSaveBlock');
function_body.toggleEditor(); // disable editor (global variable from edit_template.tpl via ajax)
TB.show(
{
url: $url,
onDataReceived: TemplateManager.prototype.onDataReceived,
onAfterShow: function() {
TemplateManager.prototype.initEditor.call(this);
},
postParams: $('#template_editor_form').serializeArray()
}
);
}
TemplateManager.prototype.cancelEditing = function () {
TB.remove();
this.setFullscreen(true);
}
TemplateManager.prototype.onMouseOver = function ($e, $element) {
if (!$element.className.match(/[ ]{0,1}block-container-over[ ]{0,1}/)) {
$element.className += ' block-container-over';
}
$e.stopPropagation();
}
TemplateManager.prototype.onMouseOut = function ($e, $element) {
$element.className = $element.className.replace(/[ ]{0,1}block-container-over[ ]{0,1}/, '');
$e.stopPropagation();
}
TemplateManager.prototype.searchBlocks = function () {
$('div').each (
function () {
var $id = this.getAttribute('id');
if (!$id || !$id.match(/parser_block\[.*\]/)) {
// skip other divs
return true;
}
TemplateManager.prototype.registerBlock.call(aTemplateManager, this);
}
);
}
TemplateManager.prototype.registerBlock = function ($element) {
var $params = $element.getAttribute('params').split(':');
this._blocks[$element.id] = {
block_name: $params[0],
function_name: $params[1]
};
var $btn = document.getElementById($element.id + '_btn');
$($btn).bind(
'click',
function(ev) {
TemplateManager.prototype.onBtnClick.call(aTemplateManager, ev, this);
}
);
$($element).bind(
'mouseover',
function(ev) {
TemplateManager.prototype.onMouseOver.call(aTemplateManager, ev, this);
}
);
$($element).bind(
'mouseout',
function(ev) {
TemplateManager.prototype.onMouseOut.call(aTemplateManager, ev, this);
}
);
this._blockOrder.push($element.id);
}
TemplateManager.prototype.onDataReceived = function ($data) {
if ($data == '0') {
TB.remove();
return false;
}
return true;
}
TemplateManager.prototype.initEditor = function () {
var $id = 'function_body';
var $textarea = document.getElementById($id);
$textarea.id += '_cp';
window[$id] = new CodePress($textarea);
$( window[$id] ).insertBefore($textarea);
}
function getFrame($name)
{
var $main_window = window;
// 1. cycle through popups to get main window
try {
// will be error, when other site is opened in parent window
+ var $i = 0;
while ($main_window.opener) {
+ if ($i == 10) {
+ break;
+ }
+
$main_window = $main_window.opener;
+ $i++;
}
}
catch (err) {
// catch Access/Permission Denied error
// alert('getFrame.Error: [' + err.description + ']');
return window;
}
var $frameset = $main_window.parent.frames;
for ($i = 0; $i < $frameset.length; $i++) {
if ($frameset[$i].name == $name) {
return $frameset[$i];
}
}
return $main_window.parent;
}
\ No newline at end of file
Property changes on: platform/template_manager/inc/template_manager.js
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1.2.1
\ No newline at end of property
+1.1.2.2
\ No newline at end of property
Event Timeline
Log In to Comment