diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp index af0cc5749d..fc629a8892 100644 --- a/clientgui/AdvancedFrame.cpp +++ b/clientgui/AdvancedFrame.cpp @@ -37,6 +37,7 @@ #include "MainDocument.h" #include "BOINCBaseFrame.h" #include "BOINCBaseView.h" +#include "BOINCListCtrl.h" #include "BOINCTaskBar.h" #include "BOINCClientManager.h" #include "BOINCDialupManager.h" @@ -1044,6 +1045,31 @@ void CAdvancedFrame::SaveWindowDimensions() { } +void CAdvancedFrame::RestoreStandardListColumns() { + wxWindow* pwndNotebookPage = NULL; + CBOINCBaseView* pView = NULL; + long iIndex; + long iPageCount; + + // Convert to a zero based index + iPageCount = (long)m_pNotebook->GetPageCount() - 1; + + for (iIndex = 0; iIndex <= iPageCount; iIndex++) { + + pwndNotebookPage = m_pNotebook->GetPage(iIndex); + wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView)); + + pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView); + wxASSERT(pView); + + CBOINCListCtrl* listPane = pView->GetListCtrl(); + if (listPane) { + listPane->SetStandardColumnOrder(); + } + } +} + + void CAdvancedFrame::OnSize(wxSizeEvent& event) { SaveWindowDimensions(); event.Skip(); diff --git a/clientgui/AdvancedFrame.h b/clientgui/AdvancedFrame.h index dea1b1cd7a..085466c42b 100644 --- a/clientgui/AdvancedFrame.h +++ b/clientgui/AdvancedFrame.h @@ -101,6 +101,7 @@ public: bool RestoreState(); bool SaveState(); + void RestoreStandardListColumns(); #ifdef __WXMAC__ void OnKeyPressed(wxKeyEvent &event); diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index 287577af86..b1a9bae122 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -315,7 +315,6 @@ bool CBOINCBaseView::OnSaveState(wxConfigBase* pConfig) { if (!m_pListPane->OnSaveState(pConfig)) { bReturnValue = false; } - return bReturnValue; } diff --git a/clientgui/BOINCBaseView.h b/clientgui/BOINCBaseView.h index 0b40d84072..9bfe711515 100644 --- a/clientgui/BOINCBaseView.h +++ b/clientgui/BOINCBaseView.h @@ -124,9 +124,10 @@ public: void ClearSavedSelections(); void ClearSelections(); void RefreshTaskPane(); - -#ifdef __WXMAC__ + CBOINCListCtrl* GetListCtrl() { return m_pListPane; } + +#ifdef __WXMAC__ void OnKeyPressed(wxKeyEvent &event); #endif @@ -134,7 +135,8 @@ public: int m_iSortColumn; bool m_bReverseSort; - + wxArrayString* m_aStdColNameOrder; + private: wxArrayString m_arrSelectedKeys1; //array for remembering the current selected rows by primary key column value diff --git a/clientgui/BOINCListCtrl.cpp b/clientgui/BOINCListCtrl.cpp index 1e61bf42c6..0989f3b8b8 100644 --- a/clientgui/BOINCListCtrl.cpp +++ b/clientgui/BOINCListCtrl.cpp @@ -95,10 +95,8 @@ bool CBOINCListCtrl::OnSaveState(wxConfigBase* pConfig) { wxInt32 iIndex = 0; wxInt32 iColumnCount = 0; - wxASSERT(pConfig); - // Retrieve the base location to store configuration information // Should be in the following form: "/Projects/" strBaseConfigLocation = pConfig->GetPath() + wxT("/"); @@ -131,6 +129,28 @@ bool CBOINCListCtrl::OnSaveState(wxConfigBase* pConfig) { pConfig->Write(wxT("SortColumn"), m_pParentView->m_iSortColumn); pConfig->Write(wxT("ReverseSortOrder"), m_pParentView->m_bReverseSort); + // Save Column Order +#ifdef wxHAS_LISTCTRL_COLUMN_ORDER + wxString strColumnOrder; + wxString strBuffer; + wxArrayInt aOrder(GetColumnCount()); + CBOINCBaseView* pView = (CBOINCBaseView*)GetParent(); + wxASSERT(wxDynamicCast(pView, CBOINCBaseView)); + + + aOrder = GetColumnsOrder(); + + strColumnOrder.Printf(wxT("%s"), pView->m_aStdColNameOrder->Item(aOrder[0])); + + for (int i = 1; i < aOrder.Count(); ++i) + { + strBuffer.Printf(wxT(";%s"), pView->m_aStdColNameOrder->Item(aOrder[i])); + strColumnOrder += strBuffer; + } + + pConfig->Write(wxT("ColumnOrder"), strColumnOrder); +#endif + return true; } @@ -192,10 +212,76 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) { m_pParentView->InitSort(); } + // Restore Column Order +#ifdef wxHAS_LISTCTRL_COLUMN_ORDER + wxString strColumnOrder; + + if (pConfig->Read(wxT("ColumnOrder"), &strColumnOrder)) { + SetListColumnOrder(strColumnOrder, ";"); + } +#endif + return true; } +void CBOINCListCtrl::TokenizedStringToArray(wxString tokenized, char * delimiters, wxArrayString* array) { + wxString name; + + array->Clear(); + wxStringTokenizer tok(tokenized, delimiters); + while (tok.HasMoreTokens()) + { + name = tok.GetNextToken(); + if (name.IsEmpty()) continue; + array->Add(name); + } +} + + +void CBOINCListCtrl::SetListColumnOrder(wxString tokenized, char * delimiters) { +#ifdef wxHAS_LISTCTRL_COLUMN_ORDER + wxArrayString orderArray; + int i, j, stdCount, orderCount; + int colCount = GetColumnCount(); + wxArrayInt aOrder(colCount); + + CBOINCBaseView* pView = (CBOINCBaseView*)GetParent(); + wxASSERT(wxDynamicCast(pView, CBOINCBaseView)); + + TokenizedStringToArray(tokenized, delimiters, &orderArray); + stdCount = pView->m_aStdColNameOrder->GetCount(); + wxASSERT(stdCount == colCount); + + orderCount = orderArray.GetCount(); + wxASSERT(orderCount == colCount); // Temporary until selective hiding implemented + + for (i=0; im_aStdColNameOrder->Item(j))) { + aOrder[i] = j; + } + } + } + SetColumnsOrder(aOrder); +#endif +} + + +void CBOINCListCtrl::SetStandardColumnOrder() { +#ifdef wxHAS_LISTCTRL_COLUMN_ORDER + int i; + int colCount = GetColumnCount(); + wxArrayInt aOrder(colCount); + + for (i=0; iUpdateControls(); + m_aStdColNameOrder = new wxArrayString; + m_pListPane->TokenizedStringToArray(default_column_names, ";", m_aStdColNameOrder); + // Create List Pane Items m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 150); m_pListPane->InsertColumn(COLUMN_ACCOUNTNAME, _("Account"), wxLIST_FORMAT_LEFT, 80); diff --git a/clientgui/ViewTransfers.cpp b/clientgui/ViewTransfers.cpp index 07376260b1..3717c42b5f 100644 --- a/clientgui/ViewTransfers.cpp +++ b/clientgui/ViewTransfers.cpp @@ -34,6 +34,10 @@ #include "res/xfer.xpm" +// This string must contain internal (non-localized) column names +// in standard order separated by a delimiter +static char* default_column_names = "Project;File;Progress;Size;Elapsed;Speed;Status"; + #define COLUMN_PROJECT 0 #define COLUMN_FILE 1 #define COLUMN_PROGRESS 2 @@ -183,6 +187,9 @@ CViewTransfers::CViewTransfers(wxNotebook* pNotebook) : // Create Task Pane Items m_pTaskPane->UpdateControls(); + m_aStdColNameOrder = new wxArrayString; + m_pListPane->TokenizedStringToArray(default_column_names, ";", m_aStdColNameOrder); + // Create List Pane Items m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 125); m_pListPane->InsertColumn(COLUMN_FILE, _("File"), wxLIST_FORMAT_LEFT, 205); diff --git a/clientgui/ViewWork.cpp b/clientgui/ViewWork.cpp index 9905fd2f7f..a87269a5f4 100644 --- a/clientgui/ViewWork.cpp +++ b/clientgui/ViewWork.cpp @@ -36,6 +36,10 @@ #include "res/result.xpm" +// This string must contain internal (non-localized) column names +// in standard order separated by a delimiter +static char* default_column_names = "Project;Progress;Status;Elapsed;Remaining;Deadline;Application;Name"; + #define COLUMN_PROJECT 0 #define COLUMN_PROGRESS 1 #define COLUMN_STATUS 2 @@ -233,6 +237,9 @@ CViewWork::CViewWork(wxNotebook* pNotebook) : // Create Task Pane Items m_pTaskPane->UpdateControls(); + m_aStdColNameOrder = new wxArrayString; + m_pListPane->TokenizedStringToArray(default_column_names, ";", m_aStdColNameOrder); + // Create List Pane Items m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 125); m_pListPane->InsertColumn(COLUMN_PROGRESS, _("Progress"), wxLIST_FORMAT_RIGHT, 60); diff --git a/html/user/submit_rpc_handler.php b/html/user/submit_rpc_handler.php index ed72f4af4a..302a1d3786 100644 --- a/html/user/submit_rpc_handler.php +++ b/html/user/submit_rpc_handler.php @@ -202,7 +202,7 @@ function submit_jobs( $x .= "\n"; } - $cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $job->rsc_fpops_est --priority $priority --stdin"; + $cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $job->rsc_fpops_est --priority $priority"; if ($result_template_file) { $cmd .= " --result_template templates/$result_template_file"; } @@ -302,6 +302,7 @@ function submit_batch($r) { if (!$ret) xml_error(-1, "BOINC server: batch->update() failed"); } else { $batch_name = (string)($r->batch->batch_name); + $batch_name = BoincDb::escape_string($batch_name); $batch_id = BoincBatch::insert( "(user_id, create_time, njobs, name, app_id, logical_end_time, state) values ($user->id, $now, $njobs, '$batch_name', $app->id, $let, ".BATCH_STATE_INIT.")" ); @@ -342,6 +343,7 @@ function create_batch($r) { list($user, $user_submit) = authenticate_user($r, $app); $now = time(); $batch_name = (string)($r->batch->batch_name); + $batch_name = BoincDb::escape_string($batch_name); $expire_time = (double)($r->expire_time); $batch_id = BoincBatch::insert( "(user_id, create_time, name, app_id, state, expire_time) values ($user->id, $now, '$batch_name', $app->id, ".BATCH_STATE_INIT.", $expire_time)" diff --git a/samples/vboxwrapper/vbox_mscom_impl.cpp b/samples/vboxwrapper/vbox_mscom_impl.cpp index d977263161..9c6be6b0db 100644 --- a/samples/vboxwrapper/vbox_mscom_impl.cpp +++ b/samples/vboxwrapper/vbox_mscom_impl.cpp @@ -1144,7 +1144,11 @@ int VBOX_VM::deregister_vm(bool delete_media) { pMediumAttachment->get_Port(&lPort); pMediumAttachment->get_Medium(&pMedium); - mediums.push_back(CComPtr(pMedium)); + // If the device in question is a DVD/CD-ROM drive, the medium may have been ejected. + // If so, pMedium will be NULL. + if (pMedium) { + mediums.push_back(CComPtr(pMedium)); + } rc = pMachine->DetachDevice(strController, lPort, lDevice); CHECK_ERROR(rc);