Reply to Opening an admin window in Ajaxel CMS
Opening an admin window in Ajaxel CMS Posted by Alexander Shatalov Javascript ,open:function(url, post, obj, no_block) { /* if (S.E.ctrlKey||S.A.Conf.open_in_popup) { S.E.ctrlKey=false; return this.pop(false,url); } */ url = '/'+S.C.HTTP_EXT+'?window'+url.replace(/\?/,'&').replace('&&','&'); if (obj) { if ($(obj).attr('title') && $(obj).attr('title').length>1) { t=$(obj).attr('title'); } else if ($(obj).text().length>1) { t=$(obj).html(); } else { t=url; } $('#a-area .a-sel').removeClass('a-sel'); $(obj).closest('tr').addClass('a-sel'); } else { t=url; } S.A.Conf.open_inline = false; if (!S.A.Conf.open_inline) { var total = this.total(); if (!total&&!no_block) this.block(); var title='',t=''; var width=$(window).width(); var height=$(window).height(); var data = ' <span class="ui-dialog-title" style="width:440px;height:19px;overflow:hidden;white-space:nowrap">'+t+'</span> <a href="javascript:;" class="a-window_min"></a><a href="javascript:;" class="a-window_resize"></a><a href="javascript:;" onclick="S.A.W.temp_win.remove();S.A.W.temp_win=false" class="a-window_close"></a> <img src="/'+S.C.FTP_EXT+'tpls/img/loading/loading6.gif" />'; if (this.temp_win) { this.temp_win.remove(); this.temp_win=false; } this.temp_win=$(' ').addClass('a-window a-abs').css({ position: 'fixed', left: width/2-250+total*16, top: 200+total*16, zIndex:S.A.W.zIndex, width:470, height:200 }).show(); S.G.html(this.temp_win,data); this.temp_win.prependTo(document.body); } S.G.loader=false; $.ajax({ cache: false, dataType: 'html', url: url, type: 'POST', data: post, success: function(data){ if (S.A.W.empty(data,url)) { if (S.A.W.temp_win) { S.A.W.temp_win.remove(); S.A.W.temp_win=false; } return false; } var pos = data.indexOf('<window>'); if (pos===-1) { S.G.alert(data,'Cannot find <window> tag'); if (S.A.W.temp_win) { S.A.W.temp_win.remove(); S.A.W.temp_win=false; } return false; } var s=data.substring(pos); s=s.substring(8,s.indexOf('</window>')).split('|'); var name_id=s[0],w2=s[1],h2=600,w1=15,h1=15,win_id='window_'+s[0]; if (!title) title=s[2]; data = ' <span class="ui-dialog-title" style="width:'+(w2-160)+'px;height:19px;overflow:hidden">'+title+'</span> '+(!S.A.Conf.open_inline?'<a href="javascript:;" onmousedown="S.A.W.dock(\'window_'+name_id+'\');" class="a-window_min"></a><a href="javascript:;" onmousedown="S.A.W.maximize(\'window_'+name_id+'\')" class="a-window_resize"></a>':'')+'<a href="javascript:;" onclick="S.A.W.close(\'window_'+name_id+'\')" class="a-window_close"></a> '+data+''; if (S.A.Conf.open_inline) { S.G.html('a-area',data); } else { if (obj) var p = $(obj).offset(),t1=p.top,l1=p.left;else var t1=0,l1=0; var t2=parseInt(height/2-h2/2-100),l2=parseInt(width/2-w2/2); if (t2<40) t2 = 40; l2 += total * 16;t2 += total * 16; var win = $(' ').addClass('a-window a-abs').css({ visibility:'hidden',position:'fixed',top:t1,left:l1,top:t2,left:l2,width:w2, zIndex: S.A.W.zIndex++ }); S.G.html(win,data); win.prependTo(S.A.prepend).draggable(S.A.W.draggable(win_id)).mousedown(function(){ $(this).css('z-index',S.A.W.zIndex++); S.A.W.wins[win_id].z=S.A.W.zIndex; S.A.W.win_id=win_id; }) S.A.W.temp_win.remove(); S.A.W.temp_win=false; if (!$('#a-dock').length) { $(' ').attr('id','a-dock').prependTo(document.body); } var dock=$(' ').addClass('a-dock_item ui-dialog-titlebar ui-widget-header ui-corner-all ui-state-default ui-state-active').html(title).appendTo($('#a-dock')).mouseover(function(){ $(this).addClass('ui-state-hover'); }).mouseout(function(){ $(this).removeClass('ui-state-hover'); }).click(function(){ S.A.W.dock(win_id,true); }); /* dock.find('a').click(function(){ return false; }); */ setTimeout(function(){ if (parseInt(height)-10 60?t1-60:60); S.A.W.wins[win_id].win.css({ visibility: '', top:S.A.W.wins[win_id].t1 }); /*S.A.W.dockSort();*/ S.A.W.win_id = win_id; } S.G.loader=true; } }) } |