PDA

View Full Version : How to Open document in extjs frame when send in Mail.



talekaramit
6 Oct 2009, 10:33 AM
I am using extnd 3R1 version. I want to open a document link in extjs frame as a new tab when clicked on url in Mail.

I tried below url format which use to work in extnd r2 version but do not work in extnd 3.

[/URL]Can any one suggest me the solution?

[url]http://openntf.org/extnd/demo.nsf/main.html?Open&link=f1/006AB1F1C59B2B9885256C390075EF06%3FOpenDocument (http://openntf.org/extnd/demo.nsf/main.html?Open&link=f1/006AB1F1C59B2B9885256C390075EF06%3FOpenDocumentCan)

breckster
7 Oct 2009, 8:19 AM
If you are using Ext.nd.DominoUI, then read this post

http://www.extjs.com/forum/showthread.php?t=30374&highlight=email+link


However if you are using a "complex layout" adding the components as items like "main-beta2.html" in the demobase, then you'll have to manually add the necessary code

I took what Jack did in the DominoUI and apply it to the page containing the complex layout


// allow for link in
var href = window.location.href;
var defaultTab = 0
var mlink
if (href.indexOf('?') > 0 || href.indexOf('!') > 0) {
var qs = (href.indexOf('?') > 0) ? href.split('?')[1] : href.split('!')[1];
var ps = Ext.urlDecode(qs);
var link = ps['link'];
var title = link;
if (link) {


Ext.nd.util.addIFrame({
target: 'center-region',
url: Ext.nd.Session.currentDatabase.webFilePath+link,
id: "EmailLink",
title: 'Loading .....',
useDocumentWindowTitle: false,
closable: true,
targetDefaults: 'center-region'
});

}
}

talekaramit
7 Oct 2009, 12:20 PM
thanks breckster (http://www.extjs.com/forum/member.php?u=30129),

Can you guide me to position you suggested code in my code below.

This code is on 'Jsheader' of main.html



var ExtndAsset = function() {
return {
init : function(){
this.ui = new Ext.nd.DominoUI({
uiOutline : {
outlineName: 'OLmain',
viewDefaults : {emptyText: 'No document Found'}
},
uiView : {
viewName: 'vwByEmpName.FE',
title : "Employee Name"
}
});
} // init
} // return
}();


var vpoverride = Ext.override(Ext.nd.DominoUI, {
createDominoUI: function() {

var north= {

region: 'north',
xtype: 'toolbar',


items:[
' ',
'Welcome ' + '<b>' + Ext.nd.Session.commonUserName + '<b>',
new Date().format("\\T\\o\\d\\a\\y \\i\\s l F d, Y"),
'->',
{ text: '<b>' + 'Company Name' + '</b>' } ,
'',
'->',
'-',
' ',' '
], // end toolbar items
height: 25

};


var west = Ext.apply({

region: 'west',
id: 'xnd-outline-panel',
xtype: 'xnd-uioutline',
target: 'xnd-center-panel',
viewTarget: 'xnd-grid-panel',

title: Ext.nd.Session.currentDatabase.title,
split: true,
width: 200
}, this.uiOutline);



var center = {
region: 'center',
id: 'xnd-center-panel',
xtype: 'tabpanel',
target: 'xnd-center-panel',
defaults : {
target : 'xnd-center-panel',
border : true
},
enableTabScroll: true,
activeTab: 0,
items: [Ext.apply({
id: 'xnd-grid-panel',
layout: 'fit',
xtype: 'xnd-uiview',
target: 'xnd-center-panel',
closable: false
}, this.uiView)
]};

this.viewport = new Ext.Viewport({
layout: 'border',
id: 'extnd-viewport',
items: [ north
,west, center]
});

}

}); // end of overrride

Ext.onReady(ExtndAsset.init, ExtndAsset, vpoverride,true);

ameliaalex
13 Oct 2009, 5:48 AM
I have been working on the same problem. The code below will open a URL as a new tab. Getting the reference to target was the missing link for me:


var target = window.target

Past this function into your JS Header and call the function directly passing in the URL as a parameter.


function loadLink(link){
var target = window.target
Ext.nd.util.addIFrame({
target: target,
url: link,
id: '',
useDocumentWindowTitle : true,
closable : true,
targetDefaults: target.targetDefaults
});
}

I am going to start work on adding the functions openDocument and openURL to the Session object.

Hope this helps,

GP