$PBExportHeader$w_shortcut_add.srw forward global type w_shortcut_add from w_publ_base end type type tv_func from treeview within w_shortcut_add end type type lv_shortcut from listview within w_shortcut_add end type type ln_bar from line within w_shortcut_add end type type ln_bar2 from line within w_shortcut_add end type type r_bar from rectangle within w_shortcut_add end type end forward global type w_shortcut_add from w_publ_base integer width = 2880 integer height = 2136 string title = "添加快捷方式" boolean minbox = false windowtype windowtype = response! tv_func tv_func lv_shortcut lv_shortcut ln_bar ln_bar ln_bar2 ln_bar2 r_bar r_bar end type global w_shortcut_add w_shortcut_add type variables Long deep = 0,il_handle Long ins_x,ins_y datastore ds_shortcutinfo datastore ds_shortcuttree end variables forward prototypes public function integer pf_menutreegrowth (long arg_handl, long arg_funcid, integer arg_lp) public function integer wf_build_functree () public subroutine wf_refresh_func () public function integer wf_refresh_shortcut () public function integer pf_menutreegrowth_bk (long arg_handl, long arg_funcid, integer arg_lp) public function integer pf_menutreegrowth_plugins (ref s_sys_func arg_s_func[], long arg_parentid) end prototypes public function integer pf_menutreegrowth (long arg_handl, long arg_funcid, integer arg_lp);Int rslt = 1 s_sys_func ls_s_func[] Long count = 0,ls_i Long handl String ls_power_str Long ll_hand treeviewitem tvi String ls_filter IF sys_if_network = 1 THEN ls_filter = 'parentid='+String(arg_funcid)+ ' and worktype <> 1 ' ELSE ls_filter = 'parentid='+String(arg_funcid)+ ' and worktype <> 2 ' END IF IF sys_version_type = 0 THEN ls_filter = ls_filter + 'and ( Versiontype = 0 or Versiontype = -1 )' ELSEIF sys_version_type = 1 THEN ls_filter = ls_filter + 'and ( Versiontype = 1 or Versiontype = -1 )' ELSEIF sys_version_type = 2 THEN ls_filter = ls_filter + 'and ( Versiontype = 0 or Versiontype = -1 or Versiontype = 2 )' END IF sys_ds_maininfo.SetFilter(ls_filter) sys_ds_maininfo.Filter() deep++ IF deep > 1000 THEN //防止死递归 RETURN 0 END IF FOR ls_i = 1 To sys_ds_maininfo.RowCount( ) IF sys_ds_maininfo.Object.if_use[ls_i] = 0 THEN CONTINUE IF sys_ds_maininfo.Object.functype[ls_i] < 9 THEN IF sys_ds_maininfo.Object.parentid[ls_i] = arg_funcid THEN IF Mid(sys_right,sys_ds_maininfo.Object.funcid[ls_i],1) = '1' THEN IF sys_ds_maininfo.Object.treename[ls_i] = '生产辅助' And & sys_option_hide_sc = 1 THEN CONTINUE END IF IF sys_ds_maininfo.Object.treename[ls_i] = '外协' And & sys_option_hide_wfjg = 1 THEN CONTINUE END IF IF sys_ds_maininfo.Object.treename[ls_i] = '财务' And & sys_option_hide_money = 1 THEN CONTINUE END IF count++ ls_s_func[count].funcid = sys_ds_maininfo.Object.funcid[ls_i] ls_s_func[count].treename = sys_ds_maininfo.Object.treename[ls_i] ls_s_func[count].MenuName = sys_ds_maininfo.Object.MenuName[ls_i] ls_s_func[count].parentid = sys_ds_maininfo.Object.parentid[ls_i] ls_s_func[count].sortflag = sys_ds_maininfo.Object.sortflag[ls_i] ls_s_func[count].functype = sys_ds_maininfo.Object.functype[ls_i] ls_s_func[count].mainid = sys_ds_maininfo.Object.mainid[ls_i] ls_s_func[count].if_use = sys_ds_maininfo.Object.if_use[ls_i] END IF END IF END IF NEXT //IF arg_funcid = 0 THEN // //加入插件 // Long ll_pluginscnt // datastore ds // ds = Create datastore // ds.DataObject = 'u_plugins_index' // ds.SetTransObject(sqlca) // ll_pluginscnt = ds.Retrieve(sys_user_plugins) // IF ll_pluginscnt > 0 THEN // count++ // ls_s_func[count].funcid = 40000 // ls_s_func[count].MenuName = "外挂" // ls_s_func[count].treename = "外挂" // ls_s_func[count].parentid = 0 // ls_s_func[count].functype = 0 // ls_s_func[count].sortflag = count // END IF // destroy ds //END IF //IF arg_funcid = 40000 THEN // pf_menutreegrowth_plugins(ls_s_func) // count = UpperBound(ls_s_func) //END IF Long ll_parentid_plugins[] = {40000,40001,40002,40003,40004,40005,40006,40007,40008,40009,40010,40011} Long ll_funcid_plugins[] = {0, 256,258,259,349,1047,260,1541,1542,1543,1046,1557} Boolean lb_plugins = False Long ll_plugins_parentid //检查是否有插件 FOR ls_i = 1 To UpperBound(ll_funcid_plugins) IF ll_funcid_plugins[ls_i] = arg_funcid THEN ll_plugins_parentid = ll_parentid_plugins[ls_i] lb_plugins = True EXIT END IF NEXT IF lb_plugins THEN //加入插件 Long ll_pluginscnt datastore ds ds = Create datastore ds.DataObject = 'u_plugins_index' ds.SetTransObject(sqlca) ll_pluginscnt = ds.Retrieve(sys_user_plugins, ll_plugins_parentid) // if ll_plugins_parentid = 0 then ll_plugins_parentid = 40000 IF ll_pluginscnt > 0 THEN count++ ls_s_func[count].funcid = ll_plugins_parentid ls_s_func[count].MenuName = "外挂" ls_s_func[count].treename = "外挂" ls_s_func[count].parentid = arg_funcid ls_s_func[count].functype = 0 ls_s_func[count].sortflag = count END IF Destroy ds END IF IF arg_funcid >= 40000 THEN pf_menutreegrowth_plugins(ls_s_func, arg_funcid) count = UpperBound(ls_s_func) END IF FOR ls_i = 1 To count //build tree IF ls_s_func[ls_i].functype = 0 THEN arg_lp = 2 ELSEIF ls_s_func[ls_i].functype = 8 THEN arg_lp = 3 ELSEIF ls_s_func[ls_i].functype = 9 THEN arg_lp = 4 END IF handl = tv_func.InsertItemLast(arg_handl,ls_s_func[ls_i].treename,arg_lp) //生成树 tv_func.GetItem(handl,tvi) tvi.Data = ls_s_func[ls_i] tv_func.SetItem(handl,tvi) //build menu pf_menutreegrowth(handl,ls_s_func[ls_i].funcid,arg_lp+1) //下级生成树 NEXT RETURN rslt end function public function integer wf_build_functree ();long hand,ll_getitem deep = 1 s_sys_func s_sf_ls treeviewitem ltvi_item long tvi_hdl = 0 do until tv_func.finditem(roottreeitem!, 0) = -1 tv_func.deleteitem(tvi_hdl) loop hand = tv_func.insertitemlast(0,sys_message_title,1) ll_getitem = tv_func.getitem(hand, ltvi_item) if ll_getitem > 0 then ltvi_item.data = s_sf_ls tv_func.setitem( hand, ltvi_item) end if pf_menutreegrowth(hand,0,2) tv_func.expanditem(hand) return 1 end function public subroutine wf_refresh_func ();wf_build_functree() //sys_ds_maininfo.RowsMove(1, sys_ds_maininfo.DeletedCount(), Delete!, sys_ds_maininfo, 1, Primary!) end subroutine public function integer wf_refresh_shortcut ();String str_shortcutstr,str_tmp Int rslt = 1 s_sys_func ls_s_func[] Long count = 0,ls_i Long handl String ls_power_str Long ll_hand,ll_funcid treeviewitem tvi SELECT shortcutstr INTO :str_shortcutstr FROM u_user Where scid = :sys_scid And empid = :sys_empid; IF sqlca.SQLCode <> 0 THEN RETURN 0 END IF sys_ds_maininfo.setfilter('') sys_ds_maininfo.filter() Long ll_fileid, ll_parentid string ls_filename IF str_shortcutstr <> '' THEN DO WHILE Pos(str_shortcutstr,',') <> 0 str_tmp = Trim(Left(str_shortcutstr,Pos(str_shortcutstr,',') - 1 )) str_shortcutstr = Right(str_shortcutstr,Len(str_shortcutstr) - Pos(str_shortcutstr,',')) ll_funcid = Long(str_tmp) IF ll_funcid < 40000 THEN ls_i = sys_ds_maininfo.Find('funcid = ' + String(ll_funcid), 1, sys_ds_maininfo.RowCount()) IF ls_i > 0 THEN count++ ls_s_func[count].funcid = sys_ds_maininfo.Object.funcid[ls_i] ls_s_func[count].treename = sys_ds_maininfo.Object.treename[ls_i] ls_s_func[count].MenuName = sys_ds_maininfo.Object.MenuName[ls_i] ls_s_func[count].parentid = sys_ds_maininfo.Object.parentid[ls_i] ls_s_func[count].sortflag = sys_ds_maininfo.Object.sortflag[ls_i] ls_s_func[count].functype = sys_ds_maininfo.Object.functype[ls_i] ls_s_func[count].mainid = sys_ds_maininfo.Object.mainid[ls_i] END IF ELSE ll_fileid = ll_funcid - 41000 SELECT filename, parentid INTO :ls_filename, :ll_parentid FROM u_plugins Where fileid = :ll_fileid; IF sqlca.SQLCode <> 0 THEN ls_filename = '' END IF IF ls_filename <> '' THEN count++ ls_s_func[count].funcid = ll_funcid ls_s_func[count].treename = ls_filename+'(外挂)' ls_s_func[count].MenuName = ls_filename+'(外挂)' ls_s_func[count].parentid = ll_parentid ls_s_func[count].sortflag = count ls_s_func[count].functype = 8 ls_s_func[count].mainid = ll_funcid ls_s_func[count].if_use = 1 END IF END IF // FOR ls_i = 1 To ds_shortcutinfo.RowCount( ) // IF ds_shortcutinfo.Object.if_use[ls_i] = 0 THEN CONTINUE // IF ds_shortcutinfo.Object.functype[ls_i] < 9 THEN // IF ds_shortcutinfo.Object.funcid[ls_i] = ll_funcid THEN // count++ // ls_s_func[count].funcid = ds_shortcutinfo.Object.funcid[ls_i] // ls_s_func[count].treename = ds_shortcutinfo.Object.treename[ls_i] // ls_s_func[count].MenuName = ds_shortcutinfo.Object.MenuName[ls_i] // ls_s_func[count].parentid = ds_shortcutinfo.Object.parentid[ls_i] // ls_s_func[count].sortflag = ds_shortcutinfo.Object.sortflag[ls_i] // ls_s_func[count].functype = ds_shortcutinfo.Object.functype[ls_i] // ls_s_func[count].mainid = ds_shortcutinfo.Object.mainid[ls_i] // ls_s_func[count].if_use = ds_shortcutinfo.Object.if_use[ls_i] // END IF // END IF // NEXT LOOP END IF lv_shortcut.DeleteItems() listviewitem l_lvi FOR ls_i = 1 To count l_lvi.Label = ls_s_func[ls_i].treename l_lvi.Data = ls_s_func[ls_i] IF right(ls_s_func[ls_i].treename,1) = "表" THEN l_lvi.PictureIndex = 3 ELSEIF pos(ls_s_func[ls_i].treename, "(外挂)") > 0 THEN l_lvi.PictureIndex = 2 ELSE l_lvi.PictureIndex = 1 END IF lv_shortcut.AddItem(l_lvi) NEXT RETURN 1 end function public function integer pf_menutreegrowth_bk (long arg_handl, long arg_funcid, integer arg_lp);Int rslt = 1 s_sys_func ls_s_func[] Long count = 0,ls_i Long handl String ls_power_str Long ll_hand treeviewitem tvi String ls_filter IF sys_if_network = 1 THEN ls_filter = 'parentid='+String(arg_funcid)+ ' and worktype <> 1 ' ELSE ls_filter = 'parentid='+String(arg_funcid)+ ' and worktype <> 2 ' END IF IF sys_version_type = 0 THEN ls_filter = ls_filter + 'and ( Versiontype = 0 or Versiontype = -1 )' ELSEIF sys_version_type = 1 THEN ls_filter = ls_filter + 'and ( Versiontype = 1 or Versiontype = -1 )' ELSEIF sys_version_type = 2 THEN ls_filter = ls_filter + 'and ( Versiontype = 0 or Versiontype = -1 or Versiontype = 2 )' END IF ds_shortcuttree.SetFilter(ls_filter) ds_shortcuttree.Filter() deep++ IF deep > 1000 THEN //防止死递归 RETURN 0 END IF FOR ls_i = 1 To ds_shortcuttree.RowCount( ) IF ds_shortcuttree.Object.if_use[ls_i] = 0 THEN CONTINUE IF ds_shortcuttree.Object.functype[ls_i] < 9 THEN IF ds_shortcuttree.Object.parentid[ls_i] = arg_funcid THEN IF Mid(sys_right,ds_shortcuttree.Object.funcid[ls_i],1) = '1' THEN count++ ls_s_func[count].funcid = ds_shortcuttree.Object.funcid[ls_i] ls_s_func[count].treename = ds_shortcuttree.Object.treename[ls_i] ls_s_func[count].MenuName = ds_shortcuttree.Object.MenuName[ls_i] ls_s_func[count].parentid = ds_shortcuttree.Object.parentid[ls_i] ls_s_func[count].sortflag = ds_shortcuttree.Object.sortflag[ls_i] ls_s_func[count].functype = ds_shortcuttree.Object.functype[ls_i] ls_s_func[count].mainid = ds_shortcuttree.Object.mainid[ls_i] ls_s_func[count].if_use = ds_shortcuttree.Object.if_use[ls_i] // ds_shortcuttree.deleterow(ls_i) // ls_i = ls_i - 1 END IF END IF END IF NEXT FOR ls_i = 1 To count //build tree IF ls_s_func[ls_i].functype = 0 THEN arg_lp = 2 ELSEIF ls_s_func[ls_i].functype = 8 THEN arg_lp = 3 ELSEIF ls_s_func[ls_i].functype = 9 THEN arg_lp = 4 END IF handl = tv_func.InsertItemLast(arg_handl,ls_s_func[ls_i].treename,arg_lp) //生成树 tv_func.GetItem(handl,tvi) tvi.Data = ls_s_func[ls_i] tv_func.SetItem(handl,tvi) //build menu pf_menutreegrowth(handl,ls_s_func[ls_i].funcid,arg_lp+1) //下级生成树 NEXT RETURN rslt end function public function integer pf_menutreegrowth_plugins (ref s_sys_func arg_s_func[], long arg_parentid);String str_shortcutstr,str_tmp Int rslt = 1 s_sys_func ls_s_func[] Long count = 0,ls_i Long handl String ls_power_str Long ll_hand,ll_funcid String ls_filepath, ls_filename count = UpperBound(arg_s_func) //加入插件 Long ll_pluginscnt datastore ds ds = Create datastore ds.DataObject = 'u_plugins_index' ds.SetTransObject(sqlca) ll_pluginscnt = ds.Retrieve(sys_user_plugins, arg_parentid) FOR ls_i = 1 To ll_pluginscnt ls_filename = Trim(ds.Object.Filename[ls_i]) ls_filepath = Trim(ds.Object.FilePath[ls_i]) ll_funcid = 41000 + ds.Object.fileid[ls_i] count++ ls_s_func[count].funcid = ll_funcid ls_s_func[count].treename = ls_filename+'(外挂)' ls_s_func[count].MenuName = ls_filename+'(外挂)' ls_s_func[count].parentid = arg_parentid ls_s_func[count].sortflag = ls_i ls_s_func[count].functype = 8 ls_s_func[count].mainid = ll_funcid ls_s_func[count].if_use = 1 IF Not Pos(ls_filepath,'.exe') > 0 THEN s_sys_win_open[ll_funcid].funcid = String(ll_funcid) s_sys_win_open[ll_funcid].Name = ls_filepath s_sys_win_open[ll_funcid].Title = ls_filename s_sys_win_open[ll_funcid].ifarg = True s_sys_win_open[ll_funcid].if_retrieve_all = True END IF NEXT arg_s_func = ls_s_func Destroy ds RETURN 1 end function on w_shortcut_add.create int iCurrent call super::create this.tv_func=create tv_func this.lv_shortcut=create lv_shortcut this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 this.r_bar=create r_bar iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.tv_func this.Control[iCurrent+2]=this.lv_shortcut this.Control[iCurrent+3]=this.ln_bar this.Control[iCurrent+4]=this.ln_bar2 this.Control[iCurrent+5]=this.r_bar end on on w_shortcut_add.destroy call super::destroy destroy(this.tv_func) destroy(this.lv_shortcut) destroy(this.ln_bar) destroy(this.ln_bar2) destroy(this.r_bar) end on event open;call super::open;ds_shortcutinfo = create datastore ds_shortcuttree = create datastore ds_shortcutinfo.dataobject='ds_sys_funcpwr' ds_shortcuttree.dataobject='ds_sys_funcpwr' wf_refresh_func() wf_refresh_shortcut() end event event close;call super::close;IF sys_version_type = 0 THEN IF IsValid(w_main_scware) THEN w_main_scware.wf_refresh_shortcut() END IF ELSE // IF IsValid(w_main_scware_biz) THEN // w_main_scware_biz.wf_refresh_shortcut() // END IF END IF end event event resize;call super::resize;ln_bar.endx = this.width ln_bar2.endx = this.width r_bar.width = this.width end event type cb_func from w_publ_base`cb_func within w_shortcut_add boolean visible = false integer x = 631 integer height = 172 end type type cb_exit from w_publ_base`cb_exit within w_shortcut_add integer x = 0 integer width = 165 integer height = 172 integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type type tv_func from treeview within w_shortcut_add event ue_add_shortcut ( ) integer y = 184 integer width = 1115 integer height = 1776 integer taborder = 10 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 borderstyle borderstyle = stylelowered! boolean linesatroot = true boolean trackselect = true string picturename[] = {"application.ico","graphics\Shell32 005.ico","graphics\blue folder.ico","graphics\Shell32 025.ico"} integer picturewidth = 16 integer pictureheight = 16 long picturemaskcolor = 536870912 string statepicturename[] = {"Continue!"} long statepicturemaskcolor = 536870912 end type event ue_add_shortcut();Long ll_hand,funcid treeviewitem tvi String arg_msg s_sys_func s_lss listviewitem lv_li uo_userpwr uo_user uo_user = Create uo_userpwr ll_hand = This.FindItem(CurrentTreeItem!,0) This.GetItem(ll_hand,tvi) s_lss = tvi.Data funcid = s_lss.funcid IF funcid > 0 THEN IF s_lss.functype <> 8 THEN RETURN IF uo_user.add_shortcut(sys_scid,sys_empid,funcid,arg_msg,True) = 0 THEN MessageBox('提示',arg_msg, Information!, OK! ) ELSE wf_refresh_shortcut() END IF END IF Destroy uo_userpwr end event event itemexpanded;treeviewitem tvi THIS.GetItem(Handle,tvi) tvi.PictureIndex = 4 end event event rightclicked;IF Handle <= 0 THEN RETURN il_handle = Handle this.SelectItem(il_handle) m_popup_shortcut_add om_1 om_1 = CREATE m_popup_shortcut_add om_1.anyobject = THIS om_1.popupmenu(THIS.X+THIS.PointerX(),THIS.Y+THIS.PointerY()) DESTROY om_1 end event type lv_shortcut from listview within w_shortcut_add event ue_del_shortcut ( ) event mousemove pbm_mousemove integer x = 1115 integer y = 184 integer width = 1691 integer height = 1776 integer taborder = 50 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 16777215 borderstyle borderstyle = stylelowered! boolean autoarrange = true boolean editlabels = true boolean extendedselect = true boolean fixedlocations = true boolean showheader = false boolean trackselect = true boolean oneclickactivate = true boolean twoclickactivate = true boolean headerdragdrop = true string largepicturename[] = {"graphics\shortcut1.bmp","graphics\define.bmp","graphics\report.bmp","Custom082!"} long largepicturemaskcolor = 536870912 string smallpicturename[] = {"AppIcon!","AlignRight!"} long smallpicturemaskcolor = 536870912 long statepicturemaskcolor = 536870912 end type event ue_del_shortcut();Long ll_hand,funcid listviewitem l_lvi String ls_tv_label,arg_msg s_sys_func s_lss uo_userpwr uo_user uo_user = CREATE uo_userpwr THIS.GetItem(THIS.SelectedIndex(),l_lvi) s_lss = l_lvi.Data funcid = s_lss.funcid IF funcid > 0 THEN IF uo_user.del_shortcut(sys_scid,sys_empid,funcid,arg_msg,TRUE) = 0 THEN MessageBox('提示',arg_msg, Information!, OK! ) ELSE wf_refresh_shortcut() END IF END IF DESTROY uo_userpwr end event event mousemove;ins_x = xpos ins_y = ypos end event event rightclicked;IF Index <= 0 THEN RETURN m_popup_shortcut_del_2 om_1 om_1 = CREATE m_popup_shortcut_del_2 om_1.popupmenu(lv_shortcut.X+ins_x,lv_shortcut.Y+ins_y) DESTROY om_1 end event type ln_bar from line within w_shortcut_add long linecolor = 268435456 integer linethickness = 4 integer beginy = 176 integer endx = 3323 integer endy = 176 end type type ln_bar2 from line within w_shortcut_add long linecolor = 16777215 integer linethickness = 4 integer beginy = 180 integer endx = 3323 integer endy = 180 end type type r_bar from rectangle within w_shortcut_add long linecolor = 16777215 long fillcolor = 1073741824 integer x = 1522 integer width = 73 integer height = 172 end type event constructor;this.fillcolor = 14215660 this.linecolor = 14215660 this.x = -1 this.y = -1 this.height = ln_bar2.beginy - 5 end event