2004-09-21 01:30:29 +00:00
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
// The contents of this file are subject to the BOINC Public License
|
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
// Revision History:
|
|
|
|
//
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "ViewProjects.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "stdwx.h"
|
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "MainDocument.h"
|
2004-09-24 22:19:02 +00:00
|
|
|
#include "BOINCTaskCtrl.h"
|
|
|
|
#include "BOINCListCtrl.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "ViewProjects.h"
|
2004-09-22 21:53:07 +00:00
|
|
|
#include "DlgAttachProject.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "Events.h"
|
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
#include "wx/arrimpl.cpp"
|
|
|
|
|
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
#include "res/boinc.xpm"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "res/proj.xpm"
|
|
|
|
#include "res/task.xpm"
|
|
|
|
#include "res/web.xpm"
|
|
|
|
#include "res/tips.xpm"
|
|
|
|
|
|
|
|
|
|
|
|
#define COLUMN_PROJECT 0
|
|
|
|
#define COLUMN_ACCOUNTNAME 1
|
|
|
|
#define COLUMN_TEAMNAME 2
|
|
|
|
#define COLUMN_TOTALCREDIT 3
|
|
|
|
#define COLUMN_AVGCREDIT 4
|
|
|
|
#define COLUMN_RESOURCESHARE 5
|
2004-09-29 22:21:45 +00:00
|
|
|
#define COLUMN_STATUS 6
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
WX_DEFINE_OBJARRAY( CProjectCache );
|
|
|
|
|
|
|
|
|
|
|
|
CProject::CProject()
|
|
|
|
{
|
|
|
|
m_strProjectName = wxEmptyString;
|
|
|
|
m_strAccountName = wxEmptyString;
|
|
|
|
m_strTeamName = wxEmptyString;
|
|
|
|
m_strTotalCredit = wxEmptyString;
|
|
|
|
m_strAVGCredit = wxEmptyString;
|
|
|
|
m_strResourceShare = wxEmptyString;
|
|
|
|
m_strStatus = wxEmptyString;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CProject::~CProject()
|
|
|
|
{
|
|
|
|
m_strProjectName.Clear();
|
|
|
|
m_strAccountName.Clear();
|
|
|
|
m_strTeamName.Clear();
|
|
|
|
m_strTotalCredit.Clear();
|
|
|
|
m_strAVGCredit.Clear();
|
|
|
|
m_strResourceShare.Clear();
|
|
|
|
m_strStatus.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::GetProjectName( wxString& strProjectName )
|
|
|
|
{
|
|
|
|
strProjectName = m_strProjectName;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::GetAccountName( wxString& strAccountName )
|
|
|
|
{
|
|
|
|
strAccountName = m_strAccountName;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::GetTeamName( wxString& strTeamName )
|
|
|
|
{
|
|
|
|
strTeamName = m_strTeamName;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::GetTotalCredit( wxString& strTotalCredit )
|
|
|
|
{
|
|
|
|
strTotalCredit = m_strTotalCredit;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::GetAVGCredit( wxString& strAVGCredit )
|
|
|
|
{
|
|
|
|
strAVGCredit = m_strAVGCredit;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::GetResourceShare( wxString& strResourceShare )
|
|
|
|
{
|
|
|
|
strResourceShare = m_strResourceShare;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::GetStatus( wxString& strStatus )
|
|
|
|
{
|
|
|
|
strStatus = m_strStatus;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::SetProjectName( wxString& strProjectName )
|
|
|
|
{
|
|
|
|
m_strProjectName = strProjectName;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::SetAccountName( wxString& strAccountName )
|
|
|
|
{
|
|
|
|
m_strAccountName = strAccountName;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::SetTeamName( wxString& strTeamName )
|
|
|
|
{
|
|
|
|
m_strTeamName = strTeamName;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::SetTotalCredit( wxString& strTotalCredit )
|
|
|
|
{
|
|
|
|
m_strTotalCredit = strTotalCredit;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::SetAVGCredit( wxString& strAVGCredit )
|
|
|
|
{
|
|
|
|
m_strAVGCredit = strAVGCredit;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::SetResourceShare( wxString& strResourceShare )
|
|
|
|
{
|
|
|
|
m_strResourceShare = strResourceShare;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CProject::SetStatus( wxString& strStatus )
|
|
|
|
{
|
|
|
|
m_strStatus = strStatus;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CViewProjects, CBOINCBaseView)
|
|
|
|
|
|
|
|
|
|
|
|
CViewProjects::CViewProjects()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CViewProjects::CViewProjects(wxNotebook* pNotebook) :
|
2004-10-27 21:10:22 +00:00
|
|
|
CBOINCBaseView( pNotebook, ID_HTML_PROJECTSVIEW, DEFAULT_HTML_FLAGS, ID_LIST_PROJECTSVIEW, DEFAULT_LIST_SINGLE_SEL_FLAGS )
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-12-23 01:06:41 +00:00
|
|
|
//
|
|
|
|
// Globalization/Localization
|
|
|
|
//
|
|
|
|
VIEW_HEADER = wxT("proj");
|
|
|
|
|
|
|
|
SECTION_TASK = VIEW_HEADER + wxT("task");
|
|
|
|
SECTION_WEB = VIEW_HEADER + wxT("web");
|
|
|
|
SECTION_TIPS = VIEW_HEADER + wxT("tips");
|
|
|
|
|
|
|
|
BITMAP_PROJECTS = VIEW_HEADER + wxT(".xpm");
|
|
|
|
BITMAP_TASKHEADER = SECTION_TASK + wxT(".xpm");
|
|
|
|
BITMAP_WEBHEADER = SECTION_WEB + wxT(".xpm");
|
|
|
|
BITMAP_TIPSHEADER = SECTION_TIPS + wxT(".xpm");
|
|
|
|
BITMAP_BOINC = wxT("boinc.xpm");
|
|
|
|
|
|
|
|
|
|
|
|
LINKDESC_DEFAULT =
|
|
|
|
_("Click a project to see additional options.");
|
|
|
|
|
|
|
|
LINK_TASKATTACH = SECTION_TASK + wxT("attach");
|
|
|
|
LINKDESC_TASKATTACH =
|
|
|
|
_("<b>Attach to new project</b><br>"
|
|
|
|
"Attach this computer to a BOINC project. "
|
|
|
|
"You'll need a project URL and account key "
|
|
|
|
"(visit the project's web site to get these).");
|
|
|
|
|
|
|
|
LINK_TASKDETACH = SECTION_TASK + wxT("detach");
|
|
|
|
LINKDESC_TASKDETACH =
|
|
|
|
_("<b>Detach from project</b><br>"
|
|
|
|
"Detach this computer from this project. "
|
|
|
|
"Work in progress will be lost. "
|
|
|
|
"You can update the project first to report "
|
|
|
|
"any completed work.");
|
|
|
|
|
|
|
|
LINK_TASKRESET = SECTION_TASK + wxT("reset");
|
|
|
|
LINKDESC_TASKRESET =
|
|
|
|
_("<b>Reset project</b><br>"
|
|
|
|
"Delete all files and work associated with this project, "
|
|
|
|
"and get new work. "
|
|
|
|
"You can update the project "
|
|
|
|
"first to report any completed work.");
|
|
|
|
|
|
|
|
LINK_TASKSUSPEND = SECTION_TASK + wxT("suspend");
|
|
|
|
LINKDESC_TASKSUSPEND =
|
|
|
|
_("<b>Suspend project</b><br>"
|
|
|
|
"Stop work for this project "
|
|
|
|
"(you can resume later).");
|
|
|
|
|
|
|
|
LINK_TASKRESUME = SECTION_TASK + wxT("resume");
|
|
|
|
LINKDESC_TASKRESUME =
|
|
|
|
_("<b>Resume project</b><br>"
|
|
|
|
"Resume work for this project");
|
|
|
|
|
|
|
|
LINK_TASKUPDATE = SECTION_TASK + wxT("update");
|
|
|
|
LINKDESC_TASKUPDATE =
|
|
|
|
_("<b>Update project</b><br>"
|
|
|
|
"Report all completed work and refresh "
|
|
|
|
"your credit and preferences for this project.");
|
|
|
|
|
|
|
|
LINK_WEBBOINC = SECTION_WEB + wxT("boinc");
|
|
|
|
LINKDESC_WEBBOINC =
|
|
|
|
_("<b>BOINC home page</b><br>"
|
|
|
|
"Open the BOINC home page in a web browser.");
|
|
|
|
|
|
|
|
LINK_WEBPROJECT = SECTION_WEB + wxT("project");
|
|
|
|
LINKDESC_WEBPROJECT =
|
|
|
|
_("<b>Project home page</b><br>"
|
|
|
|
"Open this project's home page in a web browser.");
|
|
|
|
|
|
|
|
LINK_WEB = SECTION_WEB + wxT(":");
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Setup View
|
|
|
|
//
|
2004-09-21 01:30:29 +00:00
|
|
|
wxBitmap bmpProject(proj_xpm);
|
|
|
|
wxBitmap bmpTask(task_xpm);
|
|
|
|
wxBitmap bmpWeb(web_xpm);
|
|
|
|
wxBitmap bmpTips(tips_xpm);
|
2004-09-24 02:01:53 +00:00
|
|
|
wxBitmap bmpBOINC(boinc_xpm);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
|
|
|
bmpProject.SetMask(new wxMask(bmpProject, wxColour(255, 0, 255)));
|
2004-09-22 21:53:07 +00:00
|
|
|
bmpTask.SetMask(new wxMask(bmpTask, wxColour(255, 0, 255)));
|
|
|
|
bmpWeb.SetMask(new wxMask(bmpWeb, wxColour(255, 0, 255)));
|
|
|
|
bmpTips.SetMask(new wxMask(bmpTips, wxColour(255, 0, 255)));
|
2004-09-24 02:01:53 +00:00
|
|
|
bmpBOINC.SetMask(new wxMask(bmpBOINC, wxColour(255, 0, 255)));
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
m_pTaskPane->AddVirtualFile(BITMAP_PROJECTS, bmpProject, wxBITMAP_TYPE_XPM);
|
|
|
|
m_pTaskPane->AddVirtualFile(BITMAP_BOINC, bmpBOINC, wxBITMAP_TYPE_XPM);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_TASKHEADER, bmpTask, _("Tasks"));
|
2004-11-22 19:17:13 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_WEBHEADER, bmpWeb, _("Web sites"));
|
2004-12-19 20:35:37 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_TIPSHEADER, bmpTips, _("Tips"));
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-10-19 19:41:29 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 150);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_ACCOUNTNAME, _("Account"), wxLIST_FORMAT_LEFT, 80);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_TEAMNAME, _("Team"), wxLIST_FORMAT_LEFT, 80);
|
2004-12-19 20:35:37 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_TOTALCREDIT, _("Total credit"), wxLIST_FORMAT_RIGHT, 80);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_AVGCREDIT, _("Avg. credit"), wxLIST_FORMAT_RIGHT, 80);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_RESOURCESHARE, _("Resource share"), wxLIST_FORMAT_CENTRE, 85);
|
2004-10-19 19:41:29 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_STATUS, _("Status"), wxLIST_FORMAT_LEFT, 150);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-09-23 08:28:50 +00:00
|
|
|
m_bTipsHeaderHidden = false;
|
2004-10-26 17:12:58 +00:00
|
|
|
m_bItemSelected = false;
|
2004-09-23 08:28:50 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
SetCurrentQuickTip(
|
2004-10-05 02:55:26 +00:00
|
|
|
LINK_DEFAULT,
|
2004-10-19 19:41:29 +00:00
|
|
|
LINKDESC_DEFAULT
|
2004-09-24 02:01:53 +00:00
|
|
|
);
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
UpdateSelection();
|
2004-09-21 01:30:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CViewProjects::~CViewProjects()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString CViewProjects::GetViewName()
|
|
|
|
{
|
|
|
|
return wxString(_("Projects"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char** CViewProjects::GetViewIcon()
|
|
|
|
{
|
|
|
|
return proj_xpm;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
wxInt32 CViewProjects::GetDocCount()
|
2004-10-26 08:41:02 +00:00
|
|
|
{
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
return pDoc->GetProjectCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString CViewProjects::OnListGetItemText(long item, long column) const
|
|
|
|
{
|
2004-12-02 07:43:47 +00:00
|
|
|
CProject& project = m_ProjectCache.Item( item );
|
|
|
|
wxString strBuffer = wxEmptyString;
|
2004-10-21 21:19:49 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
switch(column)
|
|
|
|
{
|
|
|
|
case COLUMN_PROJECT:
|
|
|
|
project.GetProjectName( strBuffer );
|
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
|
|
|
project.GetAccountName( strBuffer );
|
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
|
|
|
project.GetTeamName( strBuffer );
|
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
|
|
|
project.GetTotalCredit( strBuffer );
|
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
|
|
|
project.GetAVGCredit( strBuffer );
|
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
|
|
|
project.GetResourceShare( strBuffer );
|
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
|
|
|
project.GetStatus( strBuffer );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString CViewProjects::OnDocGetItemText(long item, long column) const
|
|
|
|
{
|
|
|
|
wxString strBuffer = wxEmptyString;
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
switch(column)
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
case COLUMN_PROJECT:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatProjectName( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatAccountName( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatTeamName( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatTotalCredit( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatAVGCredit( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatResourceShare( item, strBuffer );
|
2004-09-29 22:21:45 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
2004-10-22 00:41:18 +00:00
|
|
|
FormatStatus( item, strBuffer );
|
2004-09-21 01:30:29 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
void CViewProjects::OnTaskLinkClicked( const wxHtmlLinkInfo& link )
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
wxInt32 iAnswer = 0;
|
|
|
|
wxInt32 iProjectIndex = 0;
|
|
|
|
wxInt32 iWebsiteIndex = 0;
|
|
|
|
wxString strProjectName = wxEmptyString;
|
|
|
|
wxString strURL = wxEmptyString;
|
|
|
|
wxString strMessage = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-24 02:01:53 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-12-23 03:36:51 +00:00
|
|
|
m_bTaskHeaderHidden = false;
|
|
|
|
m_bWebsiteHeaderHidden = false;
|
|
|
|
m_bTipsHeaderHidden = false;
|
|
|
|
|
|
|
|
if ( link.GetHref() == LINK_TASKATTACH )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
|
|
|
CDlgAttachProject* pDlg = new CDlgAttachProject(this);
|
|
|
|
wxASSERT(NULL != pDlg);
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
iAnswer = pDlg->ShowModal();
|
|
|
|
|
2004-11-13 01:31:43 +00:00
|
|
|
if ( wxID_OK == iAnswer )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectAttach(
|
2004-09-25 21:33:24 +00:00
|
|
|
pDlg->m_strProjectAddress,
|
|
|
|
pDlg->m_strProjectAccountKey
|
|
|
|
);
|
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
if (pDlg)
|
|
|
|
pDlg->Destroy();
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKDETACH )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->GetProjectProjectName(iProjectIndex, strProjectName);
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage.Printf(
|
2004-11-22 19:17:13 +00:00
|
|
|
_("Are you sure you want to detach from project '%s'?"),
|
2004-09-25 21:33:24 +00:00
|
|
|
strProjectName.c_str());
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
iAnswer = wxMessageBox(
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage,
|
|
|
|
_("Detach from Project"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
if ( wxYES == iAnswer )
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectDetach(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2004-09-25 21:33:24 +00:00
|
|
|
);
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKRESET )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->GetProjectProjectName(iProjectIndex, strProjectName);
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage.Printf(
|
2004-11-22 19:17:13 +00:00
|
|
|
_("Are you sure you want to reset project '%s'?"),
|
2004-09-25 21:33:24 +00:00
|
|
|
strProjectName.c_str());
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
iAnswer = wxMessageBox(
|
2004-09-24 02:01:53 +00:00
|
|
|
strMessage,
|
|
|
|
_("Reset Project"),
|
|
|
|
wxYES_NO | wxICON_QUESTION,
|
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
if ( wxYES == iAnswer )
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectReset(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2004-09-25 21:33:24 +00:00
|
|
|
);
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKUPDATE )
|
2004-09-28 01:19:46 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2004-09-28 01:19:46 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectUpdate(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2004-09-28 01:19:46 +00:00
|
|
|
);
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKSUSPEND )
|
2004-09-28 01:19:46 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2004-09-28 01:19:46 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectSuspend(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2004-09-28 01:19:46 +00:00
|
|
|
);
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_TASKRESUME )
|
2004-09-28 01:19:46 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
2004-09-28 01:19:46 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->ProjectResume(
|
2004-10-21 14:29:59 +00:00
|
|
|
iProjectIndex
|
2004-09-28 01:19:46 +00:00
|
|
|
);
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( link.GetHref() == LINK_WEBBOINC )
|
|
|
|
{
|
|
|
|
ExecuteLink(wxT("http://boinc.berkeley.edu"));
|
|
|
|
}
|
|
|
|
else if ( link.GetHref() == LINK_WEBPROJECT )
|
|
|
|
{
|
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
pDoc->GetProjectProjectURL(iProjectIndex, strURL);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
ExecuteLink(strURL);
|
|
|
|
}
|
|
|
|
else if ( link.GetHref().StartsWith( LINK_WEB ) )
|
|
|
|
{
|
|
|
|
ConvertLinkToWebsiteIndex( link.GetHref(), iProjectIndex, iWebsiteIndex );
|
|
|
|
pDoc->GetProjectWebsiteLink(iProjectIndex, iWebsiteIndex, strURL);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
ExecuteLink(strURL);
|
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
UpdateSelection();
|
2004-10-21 14:29:59 +00:00
|
|
|
m_pListPane->Refresh();
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-19 08:11:49 +00:00
|
|
|
void CViewProjects::OnTaskCellMouseHover( wxHtmlCell* cell, wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
|
|
|
if ( NULL != cell->GetLink() )
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
bool bUpdateSelection = false;
|
|
|
|
wxString strLink = wxEmptyString;
|
|
|
|
wxString strWebsiteLink = wxEmptyString;
|
|
|
|
wxString strWebsiteDescripton = wxEmptyString;
|
|
|
|
wxInt32 iProjectIndex = 0;
|
|
|
|
wxInt32 iWebsiteIndex = 0;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
strLink = cell->GetLink()->GetHref();
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
if ( UpdateQuickTip( strLink, LINK_TASKATTACH, LINKDESC_TASKATTACH ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKDETACH, LINKDESC_TASKDETACH ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKRESET, LINKDESC_TASKRESET ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKSUSPEND, LINKDESC_TASKSUSPEND ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKRESUME, LINKDESC_TASKRESUME ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKUPDATE, LINKDESC_TASKUPDATE ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_WEBBOINC, LINKDESC_WEBBOINC ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_WEBPROJECT, LINKDESC_WEBPROJECT ) )
|
|
|
|
bUpdateSelection = true;
|
2004-10-09 03:05:01 +00:00
|
|
|
else if ( IsWebsiteLink( strLink ) )
|
|
|
|
{
|
|
|
|
ConvertLinkToWebsiteIndex( strLink, iProjectIndex, iWebsiteIndex );
|
|
|
|
|
|
|
|
pDoc->GetProjectWebsiteDescription( iProjectIndex, iWebsiteIndex, strWebsiteDescripton );
|
|
|
|
|
|
|
|
UpdateQuickTip( strLink, strLink, strWebsiteDescripton );
|
|
|
|
|
|
|
|
bUpdateSelection = true;
|
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
else
|
|
|
|
{
|
2004-10-05 02:55:26 +00:00
|
|
|
if ( 0 == m_pListPane->GetSelectedItemCount() )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
2004-12-23 03:36:51 +00:00
|
|
|
if ( ( LINK_DEFAULT != GetCurrentQuickTip() ) &&
|
|
|
|
( LINK_TASKATTACH != strLink ) &&
|
|
|
|
( LINK_WEBBOINC != strLink ) )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
|
|
|
SetCurrentQuickTip(
|
2004-10-05 03:40:28 +00:00
|
|
|
LINK_DEFAULT,
|
2004-10-19 19:41:29 +00:00
|
|
|
LINKDESC_DEFAULT
|
2004-09-24 02:01:53 +00:00
|
|
|
);
|
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
bUpdateSelection = true;
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
if ( bUpdateSelection )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
2004-09-24 22:19:02 +00:00
|
|
|
UpdateSelection();
|
2004-09-24 02:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
wxInt32 CViewProjects::AddCacheElement()
|
|
|
|
{
|
|
|
|
CProject* pItem = new CProject();
|
|
|
|
wxASSERT( NULL != pItem );
|
|
|
|
if ( NULL != pItem )
|
|
|
|
{
|
|
|
|
m_ProjectCache.Add( pItem );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::EmptyCache()
|
|
|
|
{
|
|
|
|
m_ProjectCache.Empty();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::GetCacheCount()
|
|
|
|
{
|
|
|
|
return m_ProjectCache.GetCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::RemoveCacheElement()
|
|
|
|
{
|
|
|
|
m_ProjectCache.RemoveAt( GetCacheCount() - 1 );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::UpdateCache( long item, long column, wxString& strNewData )
|
|
|
|
{
|
|
|
|
CProject& project = m_ProjectCache.Item( item );
|
|
|
|
|
|
|
|
switch(column)
|
|
|
|
{
|
|
|
|
case COLUMN_PROJECT:
|
|
|
|
project.SetProjectName( strNewData );
|
|
|
|
break;
|
|
|
|
case COLUMN_ACCOUNTNAME:
|
|
|
|
project.SetAccountName( strNewData );
|
|
|
|
break;
|
|
|
|
case COLUMN_TEAMNAME:
|
|
|
|
project.SetTeamName( strNewData );
|
|
|
|
break;
|
|
|
|
case COLUMN_TOTALCREDIT:
|
|
|
|
project.SetTotalCredit( strNewData );
|
|
|
|
break;
|
|
|
|
case COLUMN_AVGCREDIT:
|
|
|
|
project.SetAVGCredit( strNewData );
|
|
|
|
break;
|
|
|
|
case COLUMN_RESOURCESHARE:
|
|
|
|
project.SetResourceShare( strNewData );
|
|
|
|
break;
|
|
|
|
case COLUMN_STATUS:
|
|
|
|
project.SetStatus( strNewData );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-24 02:01:53 +00:00
|
|
|
void CViewProjects::UpdateSelection()
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-24 02:01:53 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
if ( 0 == m_pListPane->GetSelectedItemCount() )
|
2004-09-24 02:01:53 +00:00
|
|
|
{
|
|
|
|
m_bTaskHeaderHidden = false;
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskAttachHidden = false;
|
|
|
|
m_bTaskDetachHidden = true;
|
|
|
|
m_bTaskResetHidden = true;
|
|
|
|
m_bTaskSuspendHidden = true;
|
|
|
|
m_bTaskResumeHidden = true;
|
|
|
|
m_bTaskUpdateHidden = true;
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
m_bWebsiteHeaderHidden = false;
|
|
|
|
m_bWebsiteBOINCHidden = false;
|
|
|
|
m_bWebsiteProjectHidden = true;
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
if ( m_bItemSelected )
|
|
|
|
{
|
|
|
|
SetCurrentQuickTip(
|
|
|
|
LINK_DEFAULT,
|
2004-12-23 03:36:51 +00:00
|
|
|
LINKDESC_DEFAULT
|
2004-10-09 03:05:01 +00:00
|
|
|
);
|
|
|
|
}
|
2004-09-24 02:01:53 +00:00
|
|
|
m_bItemSelected = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_bTaskHeaderHidden = false;
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskAttachHidden = false;
|
|
|
|
m_bTaskDetachHidden = false;
|
|
|
|
m_bTaskResetHidden = false;
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
if ( pDoc->IsProjectSuspended(m_pListPane->GetFirstSelected()) )
|
2004-09-29 22:21:45 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskSuspendHidden = true;
|
|
|
|
m_bTaskResumeHidden = false;
|
2004-09-29 22:21:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskSuspendHidden = false;
|
|
|
|
m_bTaskResumeHidden = true;
|
2004-09-29 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
m_bTaskUpdateHidden = false;
|
2004-09-24 02:01:53 +00:00
|
|
|
|
|
|
|
m_bWebsiteHeaderHidden = false;
|
|
|
|
m_bWebsiteBOINCHidden = false;
|
|
|
|
m_bWebsiteProjectHidden = false;
|
|
|
|
|
|
|
|
m_bItemSelected = true;
|
|
|
|
}
|
|
|
|
UpdateTaskPane();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-22 21:53:07 +00:00
|
|
|
void CViewProjects::UpdateTaskPane()
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
wxInt32 iProjectIndex = 0;
|
|
|
|
wxInt32 iWebsiteIndex = 0;
|
|
|
|
wxInt32 iWebsiteCount = 0;
|
|
|
|
wxString strWebsiteName = wxEmptyString;
|
|
|
|
wxString strWebsiteLink = wxEmptyString;
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-09-22 21:53:07 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
|
|
|
|
m_pTaskPane->BeginTaskPage();
|
|
|
|
|
2004-12-23 03:36:51 +00:00
|
|
|
m_pTaskPane->BeginTaskSection( BITMAP_TASKHEADER, m_bTaskHeaderHidden );
|
2004-09-23 08:28:50 +00:00
|
|
|
if (!m_bTaskHeaderHidden)
|
2004-09-22 21:53:07 +00:00
|
|
|
{
|
2004-12-23 04:11:28 +00:00
|
|
|
m_pTaskPane->CreateTask( LINK_TASKUPDATE, _("Update project"), m_bTaskUpdateHidden );
|
2004-12-23 03:36:51 +00:00
|
|
|
m_pTaskPane->CreateTask( LINK_TASKSUSPEND, _("Suspend project"), m_bTaskSuspendHidden );
|
|
|
|
m_pTaskPane->CreateTask( LINK_TASKRESUME, _("Resume project"), m_bTaskResumeHidden );
|
2004-12-23 04:11:28 +00:00
|
|
|
|
|
|
|
m_pTaskPane->CreateTaskSeperator( m_bTaskUpdateHidden || (m_bTaskSuspendHidden && m_bTaskResumeHidden) );
|
|
|
|
|
|
|
|
m_pTaskPane->CreateTask( LINK_TASKDETACH, _("Detach from project"), m_bTaskDetachHidden );
|
|
|
|
m_pTaskPane->CreateTask( LINK_TASKRESET, _("Reset project"), m_bTaskResetHidden );
|
|
|
|
|
|
|
|
m_pTaskPane->CreateTaskSeperator( m_bTaskDetachHidden || m_bTaskResetHidden );
|
|
|
|
|
|
|
|
m_pTaskPane->CreateTask( LINK_TASKATTACH, _("Attach to new project"), m_bTaskAttachHidden );
|
2004-09-22 21:53:07 +00:00
|
|
|
}
|
2004-09-23 08:28:50 +00:00
|
|
|
m_pTaskPane->EndTaskSection( m_bTaskHeaderHidden );
|
2004-09-22 21:53:07 +00:00
|
|
|
|
|
|
|
|
2004-12-23 03:36:51 +00:00
|
|
|
m_pTaskPane->BeginTaskSection( BITMAP_WEBHEADER, m_bWebsiteHeaderHidden );
|
2004-09-23 08:28:50 +00:00
|
|
|
if (!m_bWebsiteHeaderHidden)
|
2004-09-22 21:53:07 +00:00
|
|
|
{
|
2004-12-23 03:36:51 +00:00
|
|
|
m_pTaskPane->CreateTask( LINK_WEBBOINC, _("BOINC"), m_bWebsiteBOINCHidden );
|
|
|
|
m_pTaskPane->CreateTask( LINK_WEBPROJECT, _("Project"), m_bWebsiteProjectHidden );
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
iProjectIndex = m_pListPane->GetFirstSelected();
|
|
|
|
if ( -1 != iProjectIndex )
|
|
|
|
{
|
|
|
|
iWebsiteCount = pDoc->GetProjectWebsiteCount(iProjectIndex);
|
|
|
|
for ( iWebsiteIndex = 0; iWebsiteIndex < iWebsiteCount; iWebsiteIndex++ )
|
|
|
|
{
|
|
|
|
ConvertWebsiteIndexToLink( iProjectIndex, iWebsiteIndex, strWebsiteLink );
|
|
|
|
pDoc->GetProjectWebsiteName(iProjectIndex, iWebsiteIndex, strWebsiteName);
|
|
|
|
|
2004-12-23 03:36:51 +00:00
|
|
|
m_pTaskPane->CreateTask( strWebsiteLink, strWebsiteName, false );
|
2004-10-09 03:05:01 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-22 21:53:07 +00:00
|
|
|
}
|
2004-09-23 08:28:50 +00:00
|
|
|
m_pTaskPane->EndTaskSection(m_bWebsiteHeaderHidden);
|
2004-09-22 21:53:07 +00:00
|
|
|
|
2004-12-23 03:36:51 +00:00
|
|
|
m_pTaskPane->UpdateQuickTip( BITMAP_TIPSHEADER, GetCurrentQuickTipText(), m_bTipsHeaderHidden );
|
2004-09-22 21:53:07 +00:00
|
|
|
|
|
|
|
m_pTaskPane->EndTaskPage();
|
|
|
|
}
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatProjectName( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectProjectName(item, strBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatAccountName( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectAccountName(item, strBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatTeamName( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectTeamName(item, strBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatTotalCredit( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
float fBuffer;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectTotalCredit(item, fBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Printf(wxT("%0.2f"), fBuffer);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatAVGCredit( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
float fBuffer;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectAvgCredit(item, fBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Printf(wxT("%0.2f"), fBuffer);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatResourceShare( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
float fResourceShareBuffer;
|
|
|
|
float fTotalResourceShareBuffer;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectResourceShare(item, fResourceShareBuffer);
|
|
|
|
pDoc->GetProjectTotalResourceShare(item, fTotalResourceShareBuffer);
|
2004-10-05 02:55:26 +00:00
|
|
|
strBuffer.Printf(wxT("%0.0f ( %0.2f%% )"), fResourceShareBuffer, ((fResourceShareBuffer / fTotalResourceShareBuffer) * 100));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::FormatStatus( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
wxInt32 iNextRPC;
|
2004-10-09 03:05:01 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
if (pDoc->IsProjectSuspended(item))
|
2004-10-05 02:55:26 +00:00
|
|
|
{
|
|
|
|
strBuffer = _("Project Suspended");
|
|
|
|
}
|
2004-10-09 03:05:01 +00:00
|
|
|
else if (pDoc->IsProjectRPCPending(item))
|
2004-10-05 02:55:26 +00:00
|
|
|
{
|
2004-10-09 03:05:01 +00:00
|
|
|
pDoc->GetProjectMinRPCTime(item, iNextRPC);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
wxDateTime dtNextRPC((time_t)iNextRPC);
|
|
|
|
wxDateTime dtNow(wxDateTime::Now());
|
|
|
|
|
|
|
|
if (dtNextRPC > dtNow)
|
|
|
|
{
|
|
|
|
wxTimeSpan tsNextRPC(dtNextRPC - dtNow);
|
|
|
|
strBuffer = _("Retry in ") + tsNextRPC.Format();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
bool CViewProjects::IsWebsiteLink( const wxString& strLink )
|
|
|
|
{
|
|
|
|
bool bReturnValue = false;
|
|
|
|
|
|
|
|
if ( strLink.StartsWith( LINK_WEB + wxT(":") ) )
|
|
|
|
bReturnValue = true;
|
|
|
|
|
|
|
|
return bReturnValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::ConvertWebsiteIndexToLink( wxInt32 iProjectIndex, wxInt32 iWebsiteIndex, wxString& strLink )
|
|
|
|
{
|
2004-10-21 22:52:56 +00:00
|
|
|
strLink.Printf(wxT("%s:%d:%d"), LINK_WEB.c_str(), iProjectIndex, iWebsiteIndex);
|
2004-10-09 03:05:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewProjects::ConvertLinkToWebsiteIndex( const wxString& strLink, wxInt32& iProjectIndex, wxInt32& iWebsiteIndex )
|
|
|
|
{
|
|
|
|
wxString strTemplate = strLink;
|
|
|
|
wxString strBuffer = wxEmptyString;
|
|
|
|
|
|
|
|
strTemplate.Replace( LINK_WEB + wxT(":"), wxEmptyString );
|
|
|
|
|
|
|
|
strBuffer = strTemplate;
|
|
|
|
strBuffer.Remove( strBuffer.Find( wxT(":") ) );
|
|
|
|
strBuffer.ToLong( (long*) &iProjectIndex );
|
|
|
|
|
|
|
|
strBuffer = strTemplate;
|
|
|
|
strBuffer = strBuffer.Mid( strBuffer.Find( wxT(":") ) + 1 );
|
|
|
|
strBuffer.ToLong( (long*) &iWebsiteIndex );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewProjects::ExecuteLink( const wxString &strLink )
|
|
|
|
{
|
|
|
|
wxString strMimeType = wxEmptyString;
|
|
|
|
|
|
|
|
if ( strLink.StartsWith(wxT("http://")) )
|
|
|
|
strMimeType = wxT("text/html");
|
|
|
|
else if ( strLink.StartsWith(wxT("ftp://")) )
|
|
|
|
strMimeType = wxT("text/html");
|
|
|
|
else if ( strLink.StartsWith(wxT("mailto:")) )
|
|
|
|
strMimeType = wxT("message/rfc822");
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxFileType* ft = wxTheMimeTypesManager->GetFileTypeFromMimeType(strMimeType);
|
|
|
|
if ( ft )
|
|
|
|
{
|
|
|
|
wxString cmd;
|
|
|
|
if ( ft->GetOpenCommand( &cmd, wxFileType::MessageParameters(strLink) ) )
|
|
|
|
{
|
|
|
|
cmd.Replace(wxT("file://"), wxEmptyString);
|
|
|
|
::wxExecute(cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete ft;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-08 00:40:19 +00:00
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_b4edf777fc = "$Id$";
|