$.fn.extend({
lookup: function(){
return this.each(function(){
var $this = $(this), options = {mask:true,
width:$this.attr('width')||820, height:$this.attr('height')||400,
maxable:eval($this.attr("maxable") || "true"),
resizable:eval($this.attr("resizable") || "true")
};
$this.click(function(event){
_lookup = $.extend(_lookup, {
currentGroup: $this.attr("lookupGroup") || "",
suffix: $this.attr("suffix") || "",
$target: $this,
pk: $this.attr("lookupPk") || "id"
});
var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
if (!url.isFinishedTm()) {
alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
return false;
}
$.pdialog.open(url, "_blank", $this.attr("title") || $this.text(), options);
return false;
});
});
},
multLookup: function(){
return this.each(function(){
var $this = $(this), args={};
$this.click(function(event){
var $unitBox = $this.parents(".unitBox:first");
$unitBox.find("[name='"+$this.attr("multLookup")+"']").filter(":checked").each(function(){
var _args = DWZ.jsonEval($(this).val());
for (var key in _args) {
var value = args[key] ? args[key]+"," : "";
args[key] = value + _args[key];
}
});
if ($.isEmptyObject(args)) {
alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
return false;
}
$.bringBack(args);
});
});
},