⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.asp

📁 BugTrack is a basic, yet fully functional web based Bug Tracking system that you may use as a framew
💻 ASP
字号:
<!-- #INCLUDE FILE="Common.asp" -->

<%
'
'   Filename: Default.asp
'   Generated with CodeCharge 1.2.0
'   ASPTemplates.ccp build 5/9/2001
'


sFileName = "Default.asp"
sTemplateFileName = "Default.html"


' Default Open Event start
' Default Open Event end


' Default PageSecurity begin

' Default PageSecurity end

' Default OpenAnyPage Event start
' Default OpenAnyPage Event end


LoadTemplate sAppPath & sTemplateFileName, "main"

LoadTemplate sHeaderFileName, "Header"


SetVar "FileName", sFileName


Menu_Show
Search_Show
Bugs_Show
Parse "Header", False
Parse "main", False
Response.write PrintVar("main")

' Default Close Event start
' Default Close Event end


'--------------------------------------------------



Sub Search_Show()
      
' Search Open Event start
' Search Open Event end

      SetVar "ActionPage", "Default.asp"

      ' Set variables with search parameters
      
      fldproject_id = GetParam("project_id")
      fldassigned_to = GetParam("assigned_to")
      fldpriority_id = GetParam("priority_id")
      fldstatus_id = GetParam("status_id")
      ' Show fields
      
      ' Search Show begin
      
' Search Show Event start
' Search Show Event end


      SetVar "LBproject_id", ""
      SetVar "ID", ""
      SetVar "Value", "All"
      Parse "LBproject_id", True
      openrs rsproject_id, "select project_id, project_name from projects order by 2"
      while not rsproject_id.EOF
        SetVar "ID", GetValue(rsproject_id, 0) : SetVar "Value", GetValue(rsproject_id, 1)
        if cstr(GetValue(rsproject_id, 0)) = cstr(fldproject_id) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
        Parse "LBproject_id", True
        rsproject_id.MoveNext
      wend
      set rsproject_id = nothing
    
      SetVar "LBassigned_to", ""
      SetVar "ID", ""
      SetVar "Value", "All"
      Parse "LBassigned_to", True
      openrs rsassigned_to, "select employee_id, employee_name from employees order by 2"
      while not rsassigned_to.EOF
        SetVar "ID", GetValue(rsassigned_to, 0) : SetVar "Value", GetValue(rsassigned_to, 1)
        if cstr(GetValue(rsassigned_to, 0)) = cstr(fldassigned_to) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
        Parse "LBassigned_to", True
        rsassigned_to.MoveNext
      wend
      set rsassigned_to = nothing
    
      SetVar "LBpriority_id", ""
      SetVar "ID", ""
      SetVar "Value", "All"
      Parse "LBpriority_id", True
      openrs rspriority_id, "select priority_id, priority_desc from priorities order by 2"
      while not rspriority_id.EOF
        SetVar "ID", GetValue(rspriority_id, 0) : SetVar "Value", GetValue(rspriority_id, 1)
        if cstr(GetValue(rspriority_id, 0)) = cstr(fldpriority_id) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
        Parse "LBpriority_id", True
        rspriority_id.MoveNext
      wend
      set rspriority_id = nothing
    
      SetVar "LBstatus_id", ""
      SetVar "ID", ""
      SetVar "Value", "All"
      Parse "LBstatus_id", True
      openrs rsstatus_id, "select status_id, status from statuses order by 2"
      while not rsstatus_id.EOF
        SetVar "ID", GetValue(rsstatus_id, 0) : SetVar "Value", GetValue(rsstatus_id, 1)
        if cstr(GetValue(rsstatus_id, 0)) = cstr(fldstatus_id) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
        Parse "LBstatus_id", True
        rsstatus_id.MoveNext
      wend
      set rsstatus_id = nothing
    
      ' Search Show end
      
' Search Close Event start
' Search Close Event end

      Parse "FormSearch", False
End Sub



Sub Bugs_Show()
  
  Dim sWhere, sOrder, sSQL, HasParam
  sWhere = ""
  sOrder = ""
  sSQL = ""
  HasParam = false

  SetVar "TransitParams", "assigned_to=" & ToURL(GetParam("assigned_to")) & "&priority_id=" & ToURL(GetParam("priority_id")) & "&project_id=" & ToURL(GetParam("project_id")) & "&status_id=" & ToURL(GetParam("status_id")) & "&"
  SetVar "FormParams", "assigned_to=" & ToURL(GetParam("assigned_to")) & "&priority_id=" & ToURL(GetParam("priority_id")) & "&project_id=" & ToURL(GetParam("project_id")) & "&status_id=" & ToURL(GetParam("status_id")) & "&"

' Build WHERE statement

  passigned_to = GetParam("assigned_to")
  if IsNumeric(passigned_to) and not isEmpty(passigned_to) then passigned_to = ToSQL(passigned_to, "Number") else passigned_to = Empty
  if not isEmpty(passigned_to) then
    HasParam = true
    sWhere = sWhere & "b.[assigned_to]=" & passigned_to
  end if
  
  ppriority_id = GetParam("priority_id")
  if IsNumeric(ppriority_id) and not isEmpty(ppriority_id) then ppriority_id = ToSQL(ppriority_id, "Number") else ppriority_id = Empty
  if not isEmpty(ppriority_id) then
    if not (sWhere = "") then sWhere = sWhere & " and "
    HasParam = true
    sWhere = sWhere & "b.[priority_id]=" & ppriority_id
  end if
  
  pproject_id = GetParam("project_id")
  if IsNumeric(pproject_id) and not isEmpty(pproject_id) then pproject_id = ToSQL(pproject_id, "Number") else pproject_id = Empty
  if not isEmpty(pproject_id) then
    if not (sWhere = "") then sWhere = sWhere & " and "
    HasParam = true
    sWhere = sWhere & "b.[project_id]=" & pproject_id
  end if
  
  pstatus_id = GetParam("status_id")
  if IsNumeric(pstatus_id) and not isEmpty(pstatus_id) then pstatus_id = ToSQL(pstatus_id, "Number") else pstatus_id = Empty
  if not isEmpty(pstatus_id) then
    if not (sWhere = "") then sWhere = sWhere & " and "
    HasParam = true
    sWhere = sWhere & "b.[status_id]=" & pstatus_id
  end if
  
  if HasParam then sWhere = " AND (" & sWhere & ")"
  ' Build ORDER statement
  iSort = GetParam("FormBugs_Sorting")
  iSorted = GetParam("FormBugs_Sorted")
  sDirection = ""
  if IsEmpty(iSort) then
    SetVar "Form_Sorting", ""
  else
    if iSort = iSorted then 
      SetVar "Form_Sorting", ""
      sDirection = " DESC"
      sSortParams = "FormBugs_Sorting=" & iSort & "&FormBugs_Sorted=" & iSort & "&"
    else
      SetVar "Form_Sorting", iSort
      sDirection = " ASC"
      sSortParams = "FormBugs_Sorting=" & iSort & "&FormBugs_Sorted=" & "&"
    end if
    
    if iSort = 1 then sOrder = " order by b.[bug_id]" & sDirection
    if iSort = 2 then sOrder = " order by b.[bug_name]" & sDirection
    if iSort = 3 then sOrder = " order by p.[project_name]" & sDirection
    if iSort = 4 then sOrder = " order by p1.[priority_desc]" & sDirection
    if iSort = 5 then sOrder = " order by e.[employee_name]" & sDirection
    if iSort = 6 then sOrder = " order by s.[status]" & sDirection
  end if
  

  ' Build full SQL statement
  
  sSQL = "select [b].[assigned_to] as b_assigned_to, " & _
    "[b].[bug_id] as b_bug_id, " & _
    "[b].[bug_name] as b_bug_name, " & _
    "[b].[priority_id] as b_priority_id, " & _
    "[b].[project_id] as b_project_id, " & _
    "[b].[status_id] as b_status_id, " & _
    "[p].[project_id] as p_project_id, " & _
    "[p].[project_name] as p_project_name, " & _
    "[p1].[priority_id] as p1_priority_id, " & _
    "[p1].[priority_desc] as p1_priority_desc, " & _
    "[e].[employee_id] as e_employee_id, " & _
    "[e].[employee_name] as e_employee_name, " & _
    "[s].[status_id] as s_status_id, " & _
    "[s].[status] as s_status " & _
    " from [bugs] b, [projects] p, [priorities] p1, [employees] e, [statuses] s" & _
    " where [p].[project_id]=b.[project_id] and [p1].[priority_id]=b.[priority_id] and [e].[employee_id]=b.[assigned_to] and [s].[status_id]=b.[status_id]  "

' Bugs Open Event start
' Bugs Open Event end

  sSQL = sSQL & sWhere & sOrder

  
  SetVar "FormAction", "BugRecord.asp"
  SetVar "SortParams", sSortParams
  

  ' Open recordset

  openrs rs, sSQL
	
  
  if rs.eof then
    ' Recordset is empty
    set rs = nothing
    SetVar "DListBugs", ""
    Parse "BugsNoRecords", False
    SetVar "BugsNavigator", ""
    Parse "FormBugs", False
    exit sub
  end if


  iRecordsPerPage = 20
  iCounter = 0
  ' Select current page
  iPage = GetParam("FormBugs_Page")
  
  if IsEmpty(iPage) then iPage = 1 else iPage = CLng(iPage)

  while not rs.eof and iCounter < (iPage-1)*iRecordsPerPage
    rs.movenext
		iCounter = iCounter + 1
  wend
  iCounter = 0
  

  ' Show main table based on recordset
  while not rs.EOF  and iCounter < iRecordsPerPage
    fldassigned_to = GetValue(rs, "e_employee_name")
    fldbug_id = GetValue(rs, "b_bug_id")
    fldbug_name_URLLink = "BugRecord.asp"
    fldbug_name_bug_id = GetValue(rs, "b_bug_id")
    fldbug_name = GetValue(rs, "b_bug_name")
    fldpriority_id = GetValue(rs, "p1_priority_desc")
    fldproject_id = GetValue(rs, "p_project_name")
    fldstatus_id = GetValue(rs, "s_status")
    ' Bugs Show begin
    
' Bugs Show Event start
' Bugs Show Event end


      SetVar "bug_id", ToHTML(fldbug_id)
      SetVar "bug_name", ToHTML(fldbug_name)
      SetVar "bug_name_URLLink", "BugRecord.asp"
      SetVar "Prmbug_name_bug_id", ToURL(fldbug_name_bug_id)
      SetVar "project_id", ToHTML(fldproject_id)
      SetVar "priority_id", fldpriority_id
      SetVar "assigned_to", ToHTML(fldassigned_to)
      SetVar "status_id", ToHTML(fldstatus_id)
    Parse "DListBugs", True
    ' Bugs Show end
    
    rs.MoveNext

    iCounter = iCounter + 1
  wend

  ' Bugs Navigation begin
  isEndOfRS = rs.EOF
  ' Parse Navigator
  if isEndOfRS and iPage = 1 then
    SetVar "BugsNavigator", ""
  else
    if isEndOfRS then
      SetVar "BugsNavigatorLastPage", "_"
    else
      SetVar "NextPage", (iPage + 1)
    end if
    if iPage = 1 then
      SetVar "BugsNavigatorFirstPage", "_"
    else
      SetVar "PrevPage", (iPage - 1)
    end if

    SetVar "BugsCurrentPage", iPage
    Parse "BugsNavigator", False
  end if
  ' Bugs Navigation end
  set rs = nothing
  SetVar "BugsNoRecords", ""
  Parse "FormBugs", False
  
' Bugs Close Event start
' Bugs Close Event end

End Sub

%>

<!-- #INCLUDE FILE="Header.asp" -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -