function parse_query_string(query) {
var vars = query.split("&");
var query_string = {};
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
var key = decodeURIComponent(pair[0]);
var value = decodeURIComponent(pair[1]);
// If first entry with this name
if (typeof query_string[key] === "undefined") {
query_string[key] = decodeURIComponent(value);
// If second entry with this name
} else if (typeof query_string[key] === "string") {
var arr = [query_string[key], decodeURIComponent(value)];
query_string[key] = arr;
// If third or later entry with this name
} else {
query_string[key].push(decodeURIComponent(value));
}
}
return query_string;
}Ext.UrlParam=function(name)
{
var query = window.location.search.substring(1);
var qs = parse_query_string(query);
if (!(name in qs)) return null;
var c=qs[name];
return c;
};Ext.ECSearch=function(cfg) { cfg.renderTo="ecsearch";this.irbDb = cfg.irbDb; cfg.bodyStyle="border: 0;"; cfg.layout="fit";this.udcsearch=new Ext.form.TextField({name:"udcsearch", value:"",width:200});this.udcsearchbutton=new Ext.Button({text:"Поиск по рубрикам...", iconCls:"irb-search",name:"udcsearchbutton",handler:function()
{
var v=this.udcsearch.getRawValue();
if (v=="") { this.udctree.setRootNode({ nodeType: "async", text: "Поиск по УДК", draggable: false, id: "source"}); }
else
{
this.udctree.setRootNode({ nodeType: "async", text: "Результаты поиска по термину "+v, draggable: false, id: "search",loader:new Ext.tree.TreeLoader({dataUrl:"?id=WIrbis&action=ATHRU/GetUdcNodes&db=ATHRU&term="+v})});
this.udctree.getRootNode().expand();
}
},scope:this});
this.udctree = new Ext.tree.TreePanel({ autoHeight:true,useArrows: true, hidden:true, autoScroll: true, animate: true, enableDD: true, containerScroll: true, layout:"fit", border: false, title:"УДК", dataUrl: "?id=WIrbis&action=ATHRU/GetUdcNodes&db=ATHRU",
tbar:[this.udcsearch,this.udcsearchbutton], root: { nodeType: "async", text: "Поиск по УДК", draggable: false, id: "source"}});this.rsudcsearch=new Ext.form.TextField({name:"rsudcsearch", value:"",width:200});this.rsudcsearchbutton=new Ext.Button({text:"Поиск по рубрикам...", iconCls:"irb-search",name:"rsudcsearchbutton",handler:function()
{
var v=this.rsudcsearch.getRawValue();
if (v=="") { this.rsudctree.setRootNode({ nodeType: "async", text: "Поиск по УДК", draggable: false, id: "source"}); }
else
{
this.rsudctree.setRootNode({ nodeType: "async", text: "Результаты поиска по термину "+v, draggable: false, id: "search",loader:new Ext.tree.TreeLoader({dataUrl:"?id=WIrbis&action=RSUDC/GetUdcNodes&db=RSUDC&term="+v})});
this.rsudctree.getRootNode().expand();
}
},scope:this});
this.rsudctree = new Ext.tree.TreePanel({ autoHeight:true,useArrows: true, hidden:true, autoScroll: true, animate: true, enableDD: true, containerScroll: true, layout:"fit", border: false, title:"БД УДК", dataUrl: "?id=WIrbis&action=RSUDC/GetUdcNodes&db=RSUDC",
tbar:[this.rsudcsearch,this.rsudcsearchbutton], root: { nodeType: "async", text: "Поиск по УДК", draggable: false, id: "source"}});this.grntisearch=new Ext.form.TextField({name:"grntisearch", value:"",width:200});this.grntisearchbutton=new Ext.Button({text:"Поиск по рубрикам...", iconCls:"irb-search",name:"grntisearchbutton",handler:function()
{
var v=this.grntisearch.getRawValue();
if (v=="") { this.grntitree.setRootNode({ nodeType: "async", text: "Поиск по ГРНТИ", draggable: false, id: "source"}); }
else
{
this.grntitree.setRootNode({ nodeType: "async", text: "Результаты поиска по термину "+v, draggable: false, id: "search",loader:new Ext.tree.TreeLoader({dataUrl:"?id=WIrbis&action=GRNTI/GetGrntiNodes&termdb="+this.irbDb+"&db=HELP&term="+v})});
this.grntitree.getRootNode().expand();
}
},scope:this});
this.grntitree = new Ext.tree.TreePanel
({
autoHeight:true,useArrows: true, autoScroll: true, animate: true, enableDD: true,
containerScroll: true, layout:"fit", border: false,
tbar:[this.grntisearch,this.grntisearchbutton],
title:"ГРНТИ",
dataUrl: "?id=WIrbis&action=GRNTI/GetGrntiNodes&termdb="+this.irbDb,
root: { nodeType: "async", text: "Поиск по ГРНТИ", draggable: false, id: "source"}
});this.athrssearch=new Ext.form.TextField({name:"athrssearch", value:"",width:200});this.athrssearchbutton=new Ext.Button({text:"Поиск по рубрикам...", iconCls:"irb-search",name:"athrssearchbutton",handler:function()
{
var v=this.athrssearch.getRawValue();
if (v=="") { this.athrstree.setRootNode({ nodeType: "async", text: "Поиск по Авторитетному файлу предметных заголовков", draggable: false, id: "source"}); }
else
{
this.athrstree.setRootNode({ nodeType: "async", text: "Результаты поиска по термину "+v, draggable: false, id: "search",loader:new Ext.tree.TreeLoader({dataUrl:"?id=WIrbis&action=ATHRS/GetATHRSNodes&db=ATHRS&term="+v})});
this.athrstree.getRootNode().expand();
}
},scope:this});
this.athrstree = new Ext.tree.TreePanel
({
autoHeight:true,useArrows: true, autoScroll: true, animate: true, enableDD: true,
containerScroll: true, layout:"fit", border: false,
tbar:[this.athrssearch,this.athrssearchbutton],
title:"Предметные заголовки",
dataUrl: "?id=WIrbis&action=ATHRS/GetATHRSNodes&db=ATHRS",
root: { nodeType: "async", text: "Поиск по Авторитетному файлу предметных заголовков", draggable: false, id: "source"}
});this.athrgsearch=new Ext.form.TextField({name:"athrgsearch", value:"",width:200});this.athrgsearchbutton=new Ext.Button({text:"Поиск по рубрикам...", iconCls:"irb-search",name:"athrgsearchbutton",handler:function()
{
var v=this.athrgsearch.getRawValue();
if (v=="") { this.athrgtree.setRootNode({ nodeType: "async", text: "Поиск по Авторитетному файлу \"Географическое название\"", draggable: false, id: "source"}); }
else
{
this.athrgtree.setRootNode({ nodeType: "async", text: "Результаты поиска по термину "+v, draggable: false, id: "search",loader:new Ext.tree.TreeLoader({dataUrl:"?id=WIrbis&action=ATHRG/GetATHRGNodes&db=ATHRG&term="+v})});
this.athrgtree.getRootNode().expand();
}
},scope:this});
this.athrgtree = new Ext.tree.TreePanel
({
autoHeight:true,useArrows: true, autoScroll: true, animate: true, enableDD: true,
containerScroll: true, layout:"fit", border: false,
tbar:[this.athrgsearch,this.athrgsearchbutton],
title:"Географические заголовки",
dataUrl: "?id=WIrbis&action=ATHRG/GetATHRGNodes&db=ATHRG",
root: { nodeType: "async", text: "Поиск по Авторитетному файлу \"Географическое название\"", draggable: false, id: "source"}
});this.imgnavsearch =new Ext.form.TextField({name:"imgnavsearch", value:"",width:200});this.imgnavsearchbutton=new Ext.Button({text:"Поиск по ящикам...", iconCls:"irb-search",name:"imgnavsearchbutton",handler:function()
{
var v=this.imgnavsearch.getRawValue();
if (v=="") { this.imgnavtree.setRootNode({ nodeType: "async", text: "Поиск по ИМИДЖ-каталогу", draggable: false, id: "source"}); }
else
{
this.imgnavtree.setRootNode({ nodeType: "async", text: "Результаты поиска по термину "+v, draggable: false, id: "search",loader:new Ext.tree.TreeLoader({dataUrl:"?id=WIrbis&action=IMAGENAV/GetImgNavNodesFromDict"+"&db=IMAGENAV&term="+v})});
this.imgnavtree.getRootNode().expand();
}
},scope:this});
this.imgnavtree = new Ext.tree.TreePanel
({ autoHeight:true,useArrows: true, autoScroll: true, animate: true, enableDD: true,
containerScroll: true, layout:"fit", border: false,
tbar:[this.imgnavsearch,this.imgnavsearchbutton],
title:"ИМИДЖ-каталог",
dataUrl: "?id=WIrbis&action=IMAGENAV/GetImgNavNodesFromDict&db=IMAGENAV",
root: { nodeType: "async", text: "Поиск по ИМИДЖ-каталогу", draggable: false, id: "source"}});this.complexRegion=new WIrbis.SearchSelector
({
fieldLabel:"Область поиска",
value:"",
submitValue: false,
layout:"anchor",
anchor:"98%",
irbDb:"ESVODT",
listeners:
{
select: function (combo, record, index)
{
this.complexTerm.setPrefix(record.data.Pref, record.data.Menu);
},
keyup: function (field, event) {
if (event.getKey() == 113) {
this.complexTerm.setPrefix(field.getRawValue(), "");
return;
}
},
scope: this
}
});this.complexTerm = new WIrbis.SearchField
({
irbDb: "ESVODT",
pref: "K=",
submitValue: false,
layout:"anchor",
anchor:"98%",
fieldLabel:"Термин",
value:"",
listeners:
{
select: function (_combo, record, _index)
{
if (!this.complexQuery.isDirty()) {
var newQuery = "\"" + this.complexRegion.getValue() + record.get("key") + this.complexUs.getValue() + "\"";
if (String(this.complexQuery.originalValue) === "") {
this.complexQuery.setRawValue(newQuery);
} else {
this.complexQuery.setRawValue("(" + this.complexQuery.originalValue + ")*(" + newQuery + ")");
}
}
},
scope: this
}
});this.complexQuery = new Ext.form.TextArea({ layout:"anchor", flex:10,anchor:"98%",fieldLabel:"Комплексный поисковый запрос", name:"query", value:cfg.query });this.complexUs = new Ext.form.ComboBox({
mode: "local",
editable:false,
value:"$",
flex: 1,
submitValue: false,
store: new Ext.data.ArrayStore({id: 0,fields: ["myId","displayText"],data: [ ["", "Без усечения"], ["$", "Усечение справа"], ["@", "Морфология"] ] }),
valueField: "myId", displayField: "displayText",lazyRender: true,
forceSelection: true, triggerAction: "all"
});this.applyComplexLogic=function(logic)
{
var prefix = this.complexRegion.getValue();
var term = this.complexTerm.getValue();
var query = this.complexQuery.getRawValue();
var fullterm = "\"" + prefix + term + this.complexUs.getValue() + "\"";
if (term === "" || query.indexOf(fullterm) !== -1) {
return;
}
this.complexTerm.clearValue();
query = "(" + query + ")" + logic + "(" + fullterm + ")";
this.complexQuery.setRawValue(query);
};
this.extsearchtab = new Ext.Panel
({
defaults: { layout: "form"},
layout: "fit",
autoHeight:true,
border: false,
title:"Для профессионалов",
items:[
this.complexRegion,
this.complexTerm,
new Ext.form.CompositeField
({
layout:"anchor", anchor:"98%", name:"fldCompositeExtSearchLogic", fieldLabel:"Добавить с использованием логики",
items:
[
{xtype:"button", text: "И", iconCls:"irb-log-and", flex:1,name:"btnAnd" ,handler:function(a,b){this.applyComplexLogic("*");},scope:this},
{xtype:"button", text: "ИЛИ",iconCls:"irb-log-or", flex:1,name:"btnOr", handler: function(a,b){this.applyComplexLogic("+");},scope:this },
{xtype:"button", text: "И НЕ", iconCls:"irb-log-not", flex:1,name:"btnNot", handler: function(a,b){this.applyComplexLogic("^");}, scope: this },
{xtype:"label",text:"Усечение: "},
this.complexUs
]
}),
this.complexQuery
]});this.specialKeyEvent=function(fld,evt) { if (evt.getKey() == evt.ENTER) { this.doSearch(); } };
this.iamsearchfield=new WIrbis.SearchField({ irbDb:cfg.irbDb, spaceisnew:1, pref:"DS=", layout:"anchor", flex:10,anchor:"98%", name:"ftexpression", value:"" });this.simplesearchpanel=new Ext.Panel({ autoHeight:true,layout:"fit",bodyStyle: "padding-top:15px; border: 0;", defaults: { layout:"anchor",anchor:"98%"},labelWidth:150, title: "Расширенный поиск", items:[new Ext.form.TextField({fieldLabel:"Автор", name:"simples[A=]", inputValue:"", value:""}),new Ext.form.TextField({fieldLabel:"Заглавие", name:"simples[T=]", inputValue:"", value:""}),new Ext.form.TextField({fieldLabel:"Издательство", name:"simples[O=]", inputValue:"", value:""}),new Ext.form.TextField({fieldLabel:"Год издания", name:"simples[G=]", inputValue:"", value:""}),new Ext.form.TextField({fieldLabel:"Заглавие журнала", name:"simples[TJ=]", inputValue:"", value:""}),new Ext.form.Checkbox({fieldLabel:"Наличие полного текста", name:"simples[V=EXT]", inputValue:"", value:""})]});this.searchtabpanel=new Ext.TabPanel
({
activeTab:0,
//height:500,
defaults: { layout: "form"},labelWidth:250,
deferredRender: false,
enableTabScroll: true,
autoHeight:true,
border:false,
items:
[this.simplesearchpanel,this.udctree,this.rsudctree,this.grntitree,this.athrstree,this.athrgtree,this.imgnavtree,this.extsearchtab]
});
this.tabpaneltit=new Ext.Panel({title:"Расширенный поиск ", bodyStyle: "border: 0;",items:[this.searchtabpanel],collapsible:true,collapsed:false,titleCollapse:true,headerCfg:{align:"right"},layout:"anchor",anchor:"98%"});
this.doSearch=function()
{
var fp=this.ecform;
form = fp.getForm();
var pn=fp.ownerCt;
if (form.isValid())
{
if (fp.baseParams && !fp.paramsAdded)
{
for (i in fp.baseParams)
{
fp.add
({
xtype: "hidden",
name: i,
value: fp.baseParams[i]
});
}
fp.doLayout();
fp.paramsAdded = true;
}tree=pn.udctree; sel=tree.getChecked(); for (i=0;i=32) v=v.substr(0,v.length-32); fp.add({xtype:"hidden",name:"orsrc[]",value:"\"UDC="+v+"$\""}); }tree=pn.rsudctree; sel=tree.getChecked(); for (i=0;i=32) v=v.substr(0,v.length-32); fp.add({xtype:"hidden",name:"orsrc[]",value:"\"UDC="+v+"$\""}); }tree=pn.grntitree; sel=tree.getChecked(); for (i=0;i=32) v=v.substr(0,v.length-32); fp.add({xtype:"hidden",name:"orsrc[]",value:"\"R="+v+"$\""}); }tree=pn.athrstree; sel=tree.getChecked(); for (i=0;i