4 * Copyright(c) 2006-2007, Ext JS, LLC.
6 * Originally Released Under LGPL - original licence link has changed is not relivant.
9 * <script type="text/javascript">
11 Roo.BLANK_IMAGE_URL = '../../images/default/s.gif';
13 Roo.example = function(){
16 function createBox(t, s){
17 return ['<div class="msg">',
18 '<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>',
19 '<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><h3>', t, '</h3>', s, '</div></div></div>',
20 '<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',
24 msg : function(title, format){
26 msgCt = Roo.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);
28 msgCt.alignTo(document, 't-t');
29 var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1));
30 var m = Roo.DomHelper.append(msgCt, {html:createBox(title, s)}, true);
31 m.slideIn('t').pause(1).ghost("t", {remove:true});
35 var s = Roo.get('extlib'), t = Roo.get('exttheme');
36 if(!s || !t){ // run locally?
39 var lib = Cookies.get('extlib') || 'ext',
40 theme = Cookies.get('exttheme') || 'aero';
46 Roo.get(document.body).addClass('x-'+theme);
48 s.on('change', function(){
49 Cookies.set('extlib', s.getValue());
50 setTimeout(function(){
51 window.location.reload();
55 t.on('change', function(){
56 Cookies.set('exttheme', t.getValue());
57 setTimeout(function(){
58 window.location.reload();
65 Roo.onReady(Roo.example.init, Roo.example);
68 // old school cookie functions grabbed off the web
70 Cookies.set = function(name, value){
72 var argc = arguments.length;
73 var expires = (argc > 2) ? argv[2] : null;
74 var path = (argc > 3) ? argv[3] : '/';
75 var domain = (argc > 4) ? argv[4] : null;
76 var secure = (argc > 5) ? argv[5] : false;
77 document.cookie = name + "=" + escape (value) +
78 ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
79 ((path == null) ? "" : ("; path=" + path)) +
80 ((domain == null) ? "" : ("; domain=" + domain)) +
81 ((secure == true) ? "; secure" : "");
84 Cookies.get = function(name){
86 var alen = arg.length;
87 var clen = document.cookie.length;
92 if (document.cookie.substring(i, j) == arg)
93 return Cookies.getCookieVal(j);
94 i = document.cookie.indexOf(" ", i) + 1;
101 Cookies.clear = function(name) {
102 if(Cookies.get(name)){
103 document.cookie = name + "=" +
104 "; expires=Thu, 01-Jan-70 00:00:01 GMT";
108 Cookies.getCookieVal = function(offset){
109 var endstr = document.cookie.indexOf(";", offset);
111 endstr = document.cookie.length;
113 return unescape(document.cookie.substring(offset, endstr));
117 RooDocs.viewSource = {
118 show : function(page)
122 //this.contentPanel.getEl().dom.src = 'about:blank';
123 //this.printContentPanel.refresh();
124 this.dialog.getLayout().beginUpdate();
126 this.dialog.resizeTo(window.innerWidth - 70,window.innerHeight - 70);
128 this.dialog.resizeTo(document.body.offsetWidth - 70,document.body.offsetHeight - 70);
131 this.dialog.getLayout().endUpdate();
132 this.contentPanel.getEl().dom.style.width = this.dialog.getLayout().getRegion("center").box.width -7;
133 this.contentPanel.getEl().dom.style.height = this.dialog.getLayout().getRegion("center").box.height -7;
135 var dl =document.location.pathname.split('/');
137 this.contentPanel.getEl().load( dl.join('/') + page);
148 var jd = Roo.get(document.body).createChild({tag:'div'});
149 this.dialog = new Roo.LayoutDialog(jd, {
165 // tabPosition: 'top',
169 alwaysShowTabs: false
173 this.dialog.addButton('Close', this.dialog.hide, this.dialog);
174 var layout = this.dialog.getLayout();
175 layout.beginUpdate();
176 //this.view = new Roo.ContentPanel(Roo.id(), { autoCreate:true, title: '', background:true});
177 var frm = layout.getEl().createChild({ tag:'div' });
178 this.contentPanel = new Roo.ContentPanel(frm, {title: 'View Source', fitContainer: true, autoScroll: true});
179 this.contentPanel.getEl().getUpdateManager().setRenderer(new Roo.UpdateManager.RawRenderer());
180 layout.add('center', this.contentPanel);
187 Roo.UpdateManager.RawRenderer = function(){};
189 Roo.UpdateManager.RawRenderer.prototype = {
191 render : function(el, response, updateManager, callback){
192 el.update('<PRE style="margin:10px;">' + Roo.util.Format.htmlEncode(response.responseText) +'</PRE>', updateManager.loadScripts, callback);