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.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.complexRegion=new WIrbis.SearchSelector
({
fieldLabel:"Область поиска",
value:"",
submitValue: false,
layout:"anchor",
anchor:"98%",
irbDb:"ECO",
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: "ECO",
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:[{xtype:"hidden", name:"simplePref[profile-0]", value:"VK="},{xtype:"hidden", name:"simpleLogic[profile-0]", value:"phrase"},new Ext.form.CompositeField({fieldLabel:"Коллекция",layout:"anchor",anchor:"98%",items:[new WIrbis.Mnu.ComboSelector({irbDb:cfg.irbDb,irbMnuName:"vk.mnu",name:"simpleValue[profile-0][]",hiddenName:"simpleValue[profile-0][]",flex:3,height:22}),new Ext.form.ComboBox({hiddenName:"simpleTrunc[profile-0]",name:"simpleTrunc[profile-0]",mode:"local",triggerAction:"all",editable:false,width:120,value:"right",valueField:"value",displayField:"title",store:new Ext.data.ArrayStore({fields:["value","title"],data:[["right","Усечение справа"],["exact","Точно"]]})})]}),{xtype:"hidden", name:"simplePref[profile-1]", value:"K="},{xtype:"hidden", name:"simpleLogic[profile-1]", value:"phrase"},new Ext.form.CompositeField({fieldLabel:"Ключевое слово",layout:"anchor",anchor:"98%",items:[new WIrbis.SearchField({irbDb:cfg.irbDb,pref:"K=",Menu:"",name:"simpleValue[profile-1][]",hiddenName:"simpleValue[profile-1][]",value:"",flex:3,height:22}),new Ext.form.ComboBox({hiddenName:"simpleTrunc[profile-1]",name:"simpleTrunc[profile-1]",mode:"local",triggerAction:"all",editable:false,width:120,value:"right",valueField:"value",displayField:"title",store:new Ext.data.ArrayStore({fields:["value","title"],data:[["right","Усечение справа"],["exact","Точно"],["morph","Морфология"]]})})]}),new WIrbis.SearchField({irbDb:cfg.irbDb,pref:"A=",fieldLabel:"Автор",name:"simples[A=][]",hiddenName:"simples[A=][]",value:""}),{xtype:"hidden", name:"simplePref[profile-3]", value:"T="},{xtype:"hidden", name:"simpleLogic[profile-3]", value:"phrase"},new Ext.form.CompositeField({fieldLabel:"Заглавие",layout:"anchor",anchor:"98%",items:[new WIrbis.SearchField({irbDb:cfg.irbDb,pref:"T=",Menu:"",name:"simpleValue[profile-3][]",hiddenName:"simpleValue[profile-3][]",value:"",flex:3,height:22}),new Ext.form.ComboBox({hiddenName:"simpleTrunc[profile-3]",name:"simpleTrunc[profile-3]",mode:"local",triggerAction:"all",editable:false,width:120,value:"right",valueField:"value",displayField:"title",store:new Ext.data.ArrayStore({fields:["value","title"],data:[["right","Усечение справа"],["exact","Точно"]]})})]}),{xtype:"hidden", name:"simplePref[profile-4]", value:"TJ="},{xtype:"hidden", name:"simpleLogic[profile-4]", value:"phrase"},new Ext.form.CompositeField({fieldLabel:"Заглавие журнала",layout:"anchor",anchor:"98%",items:[new WIrbis.SearchField({irbDb:cfg.irbDb,pref:"TJ=",Menu:"",name:"simpleValue[profile-4][]",hiddenName:"simpleValue[profile-4][]",value:"",flex:3,height:22}),new Ext.form.ComboBox({hiddenName:"simpleTrunc[profile-4]",name:"simpleTrunc[profile-4]",mode:"local",triggerAction:"all",editable:false,width:120,value:"right",valueField:"value",displayField:"title",store:new Ext.data.ArrayStore({fields:["value","title"],data:[["right","Усечение справа"],["exact","Точно"]]})})]}),{xtype:"hidden", name:"simplePref[profile-5]", value:"O="},{xtype:"hidden", name:"simpleLogic[profile-5]", value:"phrase"},new Ext.form.CompositeField({fieldLabel:"Издательство",layout:"anchor",anchor:"98%",items:[new WIrbis.SearchField({irbDb:cfg.irbDb,pref:"O=",Menu:"",name:"simpleValue[profile-5][]",hiddenName:"simpleValue[profile-5][]",value:"",flex:3,height:22}),new Ext.form.ComboBox({hiddenName:"simpleTrunc[profile-5]",name:"simpleTrunc[profile-5]",mode:"local",triggerAction:"all",editable:false,width:120,value:"right",valueField:"value",displayField:"title",store:new Ext.data.ArrayStore({fields:["value","title"],data:[["right","Усечение справа"],["exact","Точно"]]})})]}),new WIrbis.SearchField({irbDb:cfg.irbDb,pref:"G=",fieldLabel:"Год издания с",name:"simples[GSTART=][]",hiddenName:"simples[GSTART=][]",value:""}),new WIrbis.SearchField({irbDb:cfg.irbDb,pref:"G=",fieldLabel:"Год издания по",name:"simples[GEND=][]",hiddenName:"simples[GEND=][]",value:""}),{xtype:"hidden", name:"simplePref[profile-8]", value:"Поиск по шифру KATBW"},{xtype:"hidden", name:"simpleLogic[profile-8]", value:"phrase"},new Ext.form.CompositeField({fieldLabel:"SYNCI=KATBW-",layout:"anchor",anchor:"98%",items:[new WIrbis.SearchField({irbDb:cfg.irbDb,pref:"Поиск по шифру KATBW",Menu:"",name:"simpleValue[profile-8][]",hiddenName:"simpleValue[profile-8][]",value:"",flex:3,height:22}),new Ext.form.ComboBox({hiddenName:"simpleTrunc[profile-8]",name:"simpleTrunc[profile-8]",mode:"local",triggerAction:"all",editable:false,width:120,value:"right",valueField:"value",displayField:"title",store:new Ext.data.ArrayStore({fields:["value","title"],data:[["right","Усечение справа"],["exact","Точно"]]})})]}),{xtype:"hidden", name:"simplePref[profile-9]", value:"S="},{xtype:"hidden", name:"simpleLogic[profile-9]", value:"phrase"},new Ext.form.CompositeField({fieldLabel:"Предметная рубрика",layout:"anchor",anchor:"98%",items:[new WIrbis.SearchField({irbDb:cfg.irbDb,pref:"S=",Menu:"",name:"simpleValue[profile-9][]",hiddenName:"simpleValue[profile-9][]",value:"EXT",flex:3,height:22}),new Ext.form.ComboBox({hiddenName:"simpleTrunc[profile-9]",name:"simpleTrunc[profile-9]",mode:"local",triggerAction:"all",editable:false,width:120,value:"right",valueField:"value",displayField:"title",store:new Ext.data.ArrayStore({fields:["value","title"],data:[["right","Усечение справа"],["exact","Точно"]]})})]}),{xtype:"hidden", name:"simplePref[profile-10]", value:"V="},{xtype:"hidden", name:"simpleLogic[profile-10]", value:"phrase"},new Ext.form.CompositeField({fieldLabel:"Вид/тип документа",layout:"anchor",anchor:"98%",items:[new WIrbis.Mnu.ComboSelector({irbDb:cfg.irbDb,irbMnuName:"vd.mnu",name:"simpleValue[profile-10][]",hiddenName:"simpleValue[profile-10][]",flex:3,height:22}),new Ext.form.ComboBox({hiddenName:"simpleTrunc[profile-10]",name:"simpleTrunc[profile-10]",mode:"local",triggerAction:"all",editable:false,width:120,value:"right",valueField:"value",displayField:"title",store:new Ext.data.ArrayStore({fields:["value","title"],data:[["right","Усечение справа"],["exact","Точно"]]})})]}),{xtype:"hidden", name:"simplePref[profile-11]", value:"V="},{xtype:"hidden", name:"simpleLogic[profile-11]", value:"phrase"},{xtype:"hidden", name:"simpleTrunc[profile-11]", value:"exact"},new Ext.form.Checkbox({fieldLabel:"Наличие полного текста.",name:"simpleValue[profile-11][]",inputValue:"EXT"})]});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.grntitree,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.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+"$\""}); }
if (!this.complexQuery.isDirty() && this.complexTerm.getRawValue() !== "" && this.complexRegion.getValue() !== "")
{
var newQuery = "\"" + this.complexRegion.getValue() + this.complexTerm.getRawValue() + this.complexUs.getValue() + "\"";
if (String(this.complexQuery.originalValue) === "") {
this.complexQuery.setRawValue(newQuery);
} else {
this.complexQuery.setRawValue("(" + this.complexQuery.originalValue + ")*(" + newQuery + ")");
}
}
fp.doLayout();
form.submit();
}
}
this.searchButton=new Ext.Button({ text: "ПОИСК", align:"right",flex:1,iconCls:"irb-search", handler: function(a,b){this.th.doSearch();} });
this.searchButtonFull=new Ext.form.CompositeField({fieldLabel:"", defaults: { layout: "form",flex:1 }, layout:"anchor",anchor:"98%",labelWidth:300,items:[this.iamsearchfield,this.searchButton]});
this.searchButton.th=this;
this.iamsearchfieldfull=new Ext.form.CompositeField({fieldLabel:"Я ИЩУ", defaults: { layout: "form",flex:1 }, layout:"anchor",anchor:"98%",labelWidth:300,items:[this.iamsearchfield,this.searchButton]});
this.ecform=new Ext.form.FormPanel
({
method:"GET",
//layout:"fit",
bodyStyle: "padding-top:15px; border: 0;",
autoHeight:true,
standardSubmit:true,
hideLabels: false,
labelAlign: "right",
labelWidth: 60, // defaults to 100
//labelPad: 8, // defaults to 5, must specify labelWidth to be honored
border:false,
items:
[
{xtype:"hidden", name:"id", value:"EC"},
{xtype:"hidden", name:"lf", value:"1"},
{xtype:"hidden", name:"rc", value:"20"},
{xtype:"hidden", name:"base[]", value:this.irbDb},
{xtype:"hidden", name:"showHumanSrc", value:"1"},
{xtype:"hidden", name:"allowHumanSaveSrc", value:"1"},
{xtype:"hidden", name:"o", value:"Search"},
this.iamsearchfieldfull,this.searchButtonFull,new Ext.form.ComboBox
({
typeAhead: true,
fieldLabel: "Выбор профиля",
resizable:true,
editable:false,
triggerAction: "all",
lazyRender:true,
mode: "local",
hideLabels: false,
labelAlign: "right",
labelWidth: 300,
labelPad: 8,
layout:"anchor",
anchor:"98%",
valueField: "myId", displayField: "displayText",
hiddenName:"profilesid_EC",
value:"d45a4e505c4e6efec0f2869713c6f875",
listeners:
{
select:function(combo,record,index)
{
document.location="?id=EC/Show&profilesid_EC="+record.get("myId");
},
scope:this
},
store: new Ext.data.JsonStore({ root:"selectitems", fields: ["myId","displayText"], data: {selectitems:[
{myId:"d45a4e505c4e6efec0f2869713c6f875",displayText:"\u041f\u0440\u043e\u0444\u0438\u043b\u044c \u0410\u0420\u041c \u0427\u0438\u0442\u0430\u0442\u0435\u043b\u044c: cateco.gpntb.ru"},{myId:"9a99be14830e6848aee684c5e33a9836",displayText:"\u041f\u0440\u043e\u0444\u0438\u043b\u044c \u0410\u0420\u041c \u0427\u0438\u0442\u0430\u0442\u0435\u043b\u044c: dev.gpntb.ru"}]}})}),this.tabpaneltit
]
});
cfg.items=
[
this.ecform
];
Ext.ECSearch.superclass.constructor.call(this,cfg);
this.ecform.ECSearchPanel=this;
};
Ext.extend(Ext.ECSearch,Ext.Panel);