diff --git a/cck/driver/WizardMachine.cpp b/cck/driver/WizardMachine.cpp index 4c6cf1921ed..9ddb8c10110 100644 --- a/cck/driver/WizardMachine.cpp +++ b/cck/driver/WizardMachine.cpp @@ -532,7 +532,7 @@ NODE* CWizardMachineApp::CreateNode(NODE *parentNode, CString iniFile) NewNode->images = (IMAGE **) GlobalAlloc(0, 20 * sizeof(IMAGE *)); NewNode->numImages = 0; - char sectionBuffer[MID_SIZE]; + char sectionBuffer[MAX_SIZE]; GetPrivateProfileString(NULL, NULL, "", sectionBuffer, MAX_SIZE, iniFile); char iniSection[MID_SIZE]; @@ -1110,7 +1110,10 @@ BOOL CWizardMachineApp::FileExists(CString file) if (! (f = fopen(file, "r") )) return FALSE; else + { + fclose(f); return TRUE; + } } BOOL CWizardMachineApp::FillGlobalWidgetArray(CString file) @@ -1378,6 +1381,11 @@ void CWizardMachineApp::BuildWidget(WIDGET* aWidget, CString iniSection, CString GetPrivateProfileString(iniSection, "onCommand", "", buffer, MAX_SIZE, iniFile); aWidget->action.onCommand = buffer; + // Used in the ShowSection command to show and hide widgets based on selection in a listbox. + GetPrivateProfileString(iniSection, "ShowInSection", "", buffer, MAX_SIZE, iniFile); + aWidget->showinsection = buffer; + + /// Dynamic ID allocation aWidget->widgetID = pageBaseIndex + idCounter; diff --git a/cck/driver/WizardTypes.h b/cck/driver/WizardTypes.h index a52f3a85e62..496b7491b79 100644 --- a/cck/driver/WizardTypes.h +++ b/cck/driver/WizardTypes.h @@ -53,7 +53,8 @@ typedef struct WIDGET CString title; CString group; CString target; - CString description; + CString description; + CString showinsection; // Used in the ShowSection command to show and hide widgets based on selection in a listbox. POINT location; DIMENSION size; FIELDLEN fieldlen; diff --git a/cck/driver/WizardUI.cpp b/cck/driver/WizardUI.cpp index d719a660a51..8332d5088e6 100644 --- a/cck/driver/WizardUI.cpp +++ b/cck/driver/WizardUI.cpp @@ -176,7 +176,7 @@ LRESULT CWizardUI::OnWizardBack() UpdateGlobals(); DestroyCurrentScreenWidgets(); return FALSE; - } + } if (!prevLock.IsLocked()) { prevLock.Lock(); @@ -202,7 +202,7 @@ LRESULT CWizardUI::OnWizardNext() DestroyCurrentScreenWidgets(); return FALSE; } - + if (!nextLock.IsLocked()) { nextLock.Lock(); @@ -389,6 +389,8 @@ BOOL CWizardUI::OnCommand(WPARAM wParam, LPARAM lParam) if (curWidget->numOfOptDesc > 0) SetDescription(curWidget); + + } break; } @@ -547,18 +549,18 @@ void CWizardUI::UpdateScreenWidget(WIDGET *curWidget) if (widg) widg->control->EnableWindow(TRUE); } - else if ((strcmp(curWidget->value,"Linux")==0) && (direxist != -1)) - { - WIDGET *widg = findWidget("LinuxPath"); - if (widg) - widg->control->EnableWindow(FALSE); - widg = findWidget("Text7888"); - if (widg) - widg->control->EnableWindow(FALSE); - widg = findWidget("Button9888"); - if (widg) - widg->control->EnableWindow(FALSE); - } + else if ((strcmp(curWidget->value,"Linux")==0) && (direxist != -1)) + { + WIDGET *widg = findWidget("LinuxPath"); + if (widg) + widg->control->EnableWindow(FALSE); + widg = findWidget("Text7888"); + if (widg) + widg->control->EnableWindow(FALSE); + widg = findWidget("Button9888"); + if (widg) + widg->control->EnableWindow(FALSE); + } } if (selRv == CB_ERR) diff --git a/cck/driver/interpret.cpp b/cck/driver/interpret.cpp index ad6e69cac67..7a0ff30be0d 100644 --- a/cck/driver/interpret.cpp +++ b/cck/driver/interpret.cpp @@ -143,9 +143,9 @@ BOOL CInterpret::BrowseFile(WIDGET *curWidget) // if ((fullFileName.Right(fileLength - dotPlace -1) == fileExt) && (tmpWidget && (CEdit*)tmpWidget->control)) if (tmpWidget && (CEdit*)tmpWidget->control) { - tmpWidget->value = fullFileName; - if (tmpWidget->name == "LinuxPath") - tmpWidget->display = fullFileName; + tmpWidget->value = fullFileName; + if (tmpWidget->name == "LinuxPath") + tmpWidget->display = fullFileName; else tmpWidget->display = GetTrimFile(fullFileName); } @@ -292,6 +292,59 @@ BOOL CInterpret::IterateListBox(char *parms) return TRUE; } +// The function goes through all widgets with a showinsection attribute set, and hides +// those which don't match the selected name from this listbox and unhides those +// which do match. +BOOL CInterpret::ShowSection(WIDGET *curWidget) +{ + if (!curWidget) + return FALSE; + + if (curWidget->type != "ListBox") + return FALSE; + + if (!curWidget->control) + return FALSE; + + // Get the selected text from the list box. + int sel = ((CListBox*)curWidget->control)->GetCurSel(); + if (sel < 0) + return FALSE; + + CString Section; + ((CListBox*)curWidget->control)->GetText(sel, Section); + if (Section.IsEmpty()) + return FALSE; + + // Search all widgets for ones with ShowInSection tags, which means they + // belong in some section. + for (int i = 0; i < GlobalArrayIndex; i++) + { + // If the control is created and the ShowInSection tag exists, hide or unhide the control. + if (GlobalWidgetArray[i].control && !GlobalWidgetArray[i].showinsection.IsEmpty()) + { + // Belongs in this section. + if (GlobalWidgetArray[i].showinsection.Compare(Section) == 0) + { + if (!GlobalWidgetArray[i].control->IsWindowVisible()) + GlobalWidgetArray[i].control->ShowWindow(SW_SHOW); + } + else // Belongs in another section. + { + if (GlobalWidgetArray[i].control->IsWindowVisible()) + GlobalWidgetArray[i].control->ShowWindow(SW_HIDE); + } + + // Cause a repaint so the show/hide takes effect. + curWidget->control->GetParent()->GetParent()->Invalidate(); + } + } + + + + return TRUE; +} + BOOL CInterpret::GetRegistryKey( HKEY key, const char *subkey, char *retdata ) { long retval; @@ -606,84 +659,84 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget) { if (!IterateListBox(parms)) return FALSE; - } - else if(strcmp(pcmd, "IsMailfieldempty") ==0) - { - CString ispDomainName = GetGlobal("DomainName"); - CString ispPrettyName = GetGlobal("PrettyName"); - CString ispLongName = GetGlobal("LongName"); - CString ispInServer = GetGlobal("IncomingServer"); - CString ispOutServer = GetGlobal("OutgoingServer"); - CString ispPortNumber = GetGlobal("PortNumber"); - if ((ispDomainName.IsEmpty()) || - (ispPrettyName.IsEmpty()) || - (ispLongName.IsEmpty()) || - (ispInServer.IsEmpty()) || - (ispOutServer.IsEmpty()) || - (ispPortNumber.IsEmpty())) - { - if (!((ispDomainName.IsEmpty()) && - (ispPrettyName.IsEmpty()) && - (ispLongName.IsEmpty()) && - (ispInServer.IsEmpty()) && - (ispOutServer.IsEmpty()) && - (ispPortNumber.IsEmpty()))) - { - AfxMessageBox("All fields must be filled to create a customized mail account", MB_OK); - return FALSE; - } - } } - else if(strcmp(pcmd, "IsNewsfieldempty") ==0) - { - CString newsDomainName = GetGlobal("nDomainName"); - CString newsPrettyName = GetGlobal("nPrettyName"); - CString newsLongName = GetGlobal("nLongName"); - CString newsServer = GetGlobal("nServer"); - CString newsPortNumber = GetGlobal("nPortNumber"); - if ((newsDomainName.IsEmpty()) || - (newsPrettyName.IsEmpty()) || - (newsLongName.IsEmpty()) || - (newsServer.IsEmpty()) || - (newsPortNumber.IsEmpty())) - { - if (!((newsDomainName.IsEmpty()) && - (newsPrettyName.IsEmpty()) && - (newsLongName.IsEmpty()) && - (newsServer.IsEmpty()) && - (newsPortNumber.IsEmpty()))) - { - AfxMessageBox("All fields must be filled to create a customized news account", MB_OK); - return FALSE; - } - } - } - else if (strcmp(pcmd, "IsAutourlempty") == 0) - { - CString proxyConfigoption = GetGlobal("radioGroup2"); - if (proxyConfigoption == "3") - { - WIDGET *wid; - wid = findWidget("autoproxyurl"); - CString autourl = CWizardUI::GetScreenValue(wid); - if (autourl == "") - { - AfxMessageBox("Please enter a URL for automatic proxy configuration", MB_OK); - return FALSE; - } - } - } - else if (strcmp(pcmd, "IsSamedomain") == 0) - { - CString ispDomainName = GetGlobal("DomainName"); - CString newsDomainName; - newsDomainName = CWizardUI::GetScreenValue(curWidget); - if (newsDomainName == ispDomainName) - { - AfxMessageBox("The domain name for News must be different from the domain name used for Mail", MB_OK); - return FALSE; - } - } + else if(strcmp(pcmd, "IsMailfieldempty") ==0) + { + CString ispDomainName = GetGlobal("DomainName"); + CString ispPrettyName = GetGlobal("PrettyName"); + CString ispLongName = GetGlobal("LongName"); + CString ispInServer = GetGlobal("IncomingServer"); + CString ispOutServer = GetGlobal("OutgoingServer"); + CString ispPortNumber = GetGlobal("PortNumber"); + if ((ispDomainName.IsEmpty()) || + (ispPrettyName.IsEmpty()) || + (ispLongName.IsEmpty()) || + (ispInServer.IsEmpty()) || + (ispOutServer.IsEmpty()) || + (ispPortNumber.IsEmpty())) + { + if (!((ispDomainName.IsEmpty()) && + (ispPrettyName.IsEmpty()) && + (ispLongName.IsEmpty()) && + (ispInServer.IsEmpty()) && + (ispOutServer.IsEmpty()) && + (ispPortNumber.IsEmpty()))) + { + AfxMessageBox("All fields must be filled to create a customized mail account", MB_OK); + return FALSE; + } + } + } + else if(strcmp(pcmd, "IsNewsfieldempty") ==0) + { + CString newsDomainName = GetGlobal("nDomainName"); + CString newsPrettyName = GetGlobal("nPrettyName"); + CString newsLongName = GetGlobal("nLongName"); + CString newsServer = GetGlobal("nServer"); + CString newsPortNumber = GetGlobal("nPortNumber"); + if ((newsDomainName.IsEmpty()) || + (newsPrettyName.IsEmpty()) || + (newsLongName.IsEmpty()) || + (newsServer.IsEmpty()) || + (newsPortNumber.IsEmpty())) + { + if (!((newsDomainName.IsEmpty()) && + (newsPrettyName.IsEmpty()) && + (newsLongName.IsEmpty()) && + (newsServer.IsEmpty()) && + (newsPortNumber.IsEmpty()))) + { + AfxMessageBox("All fields must be filled to create a customized news account", MB_OK); + return FALSE; + } + } + } + else if (strcmp(pcmd, "IsAutourlempty") == 0) + { + CString proxyConfigoption = GetGlobal("radioGroup2"); + if (proxyConfigoption == "3") + { + WIDGET *wid; + wid = findWidget("autoproxyurl"); + CString autourl = CWizardUI::GetScreenValue(wid); + if (autourl == "") + { + AfxMessageBox("Please enter a URL for automatic proxy configuration", MB_OK); + return FALSE; + } + } + } + else if (strcmp(pcmd, "IsSamedomain") == 0) + { + CString ispDomainName = GetGlobal("DomainName"); + CString newsDomainName; + newsDomainName = CWizardUI::GetScreenValue(curWidget); + if (newsDomainName == ispDomainName) + { + AfxMessageBox("The domain name for News must be different from the domain name used for Mail", MB_OK); + return FALSE; + } + } else if(strcmp(pcmd, "IsNumeric") ==0) { WIDGET *wid; @@ -715,20 +768,20 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget) } } - else if(strcmp(pcmd, "IsPortnumEmpty") ==0) - { - WIDGET *wid; - wid = curWidget; - if (wid) - { - CString retval = CWizardUI::GetScreenValue(curWidget); - if (retval == "") - { - SetGlobal(curWidget->value,"0"); - ((CEdit*)wid->control)->SetWindowText("0"); - } - } - } + else if(strcmp(pcmd, "IsPortnumEmpty") ==0) + { + WIDGET *wid; + wid = curWidget; + if (wid) + { + CString retval = CWizardUI::GetScreenValue(curWidget); + if (retval == "") + { + SetGlobal(curWidget->value,"0"); + ((CEdit*)wid->control)->SetWindowText("0"); + } + } + } else if (strcmp(pcmd, "VerifySet") == 0) { // VerifySet checks to see if the first parameter has any value @@ -795,7 +848,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget) theApp.FillGlobalWidgetArray(CachePath); // Ignore failure, we'll write one out later IsSameCache = FALSE; } - // Switch pre-set target platform and create working installer + // Switch pre-set target platform and create working installer else if (strcmp(pcmd, "ChangePlatform") ==0) { WIDGET *w = findWidget(parms); @@ -809,20 +862,20 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget) strcpy(deletePath, outputPath); CallDLL("IBEngine", "EraseDirectory", deletePath, w); } - } - // change pre-set CD autorun option - else if (strcmp(pcmd, "ChangeCDScreen") ==0) - { - WIDGET *w = findWidget(parms); - if (w) - { - CString rootPath = GetGlobal("Root"); - CString configName = GetGlobal("CustomizationList"); - CString outputPath = rootPath + "Configs\\" + configName + "\\Output"; - char deletePath[MAX_SIZE]; - strcpy(deletePath, outputPath); - CallDLL("IBEngine", "EraseDirectory", deletePath, w); - } + } + // change pre-set CD autorun option + else if (strcmp(pcmd, "ChangeCDScreen") ==0) + { + WIDGET *w = findWidget(parms); + if (w) + { + CString rootPath = GetGlobal("Root"); + CString configName = GetGlobal("CustomizationList"); + CString outputPath = rootPath + "Configs\\" + configName + "\\Output"; + char deletePath[MAX_SIZE]; + strcpy(deletePath, outputPath); + CallDLL("IBEngine", "EraseDirectory", deletePath, w); + } } else if (strcmp(pcmd, "WriteCache") ==0) { @@ -1141,6 +1194,18 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget) } } } + else if (strcmp(pcmd, "ShowSection") == 0) + { + // ShowSection is a way to use a listbox to choose a subset of widgets to display. + // To use, create a listbox widget, and fill it will sectionnames. + // Set its onCommand=ShowSection. + // Then give the widgets you want in each section a "ShowInSection=sectionname". + // When "sectionname" is selected in the listbox, all widgets with matching ShowInSection + // are shown, and all widgets with some other sectiion are hidden. Widgets without + // the ShowInSection attribute are left alone. + + ShowSection(curWidget); + } } // This is an extra free... //free(pcmd); diff --git a/cck/driver/interpret.h b/cck/driver/interpret.h index f94f3810500..89942ece283 100644 --- a/cck/driver/interpret.h +++ b/cck/driver/interpret.h @@ -42,6 +42,7 @@ public: CString BrowseDir(WIDGET *curWidget); void GenerateList(CString action, WIDGET* curWidget, CString ext); BOOL Progress(); // Not actually used right now + BOOL ShowSection(WIDGET *curWidget); BOOL IterateListBox(char *parms); CString replaceVars(CString str, char *listval); CString replaceVars(char *str, char *listval); diff --git a/cck/ib/ib.cpp b/cck/ib/ib.cpp index 11221000ba5..4589c2e763e 100644 --- a/cck/ib/ib.cpp +++ b/cck/ib/ib.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include #include -#include +#include #include #include "globals.h" #include "comp.h" @@ -12,8 +12,9 @@ #include "resource.h" #include "NewDialog.h" #define MAX_SIZE 1024 -#define CRVALUE 0x0D -#define BUF_SIZE 4096 +#define CRVALUE 0x0D +#define BUF_SIZE 4096 + // Required disk space for Win build #define WDISK_SPACE 27577549 // Required disk space for Linux build @@ -35,17 +36,17 @@ CString nscpxpiPath; CString cdshellPath; CString outputPath; CString xpiDstPath; -// variables for CCK Linux build -CString linuxOption; -CString linuxblobPath; -CString templinuxPath; -CString linuxDir; -CString nscpxpilinuxPath; -CString nsinstPath; -CString nsinstallerDir; -CString xpiDir; -CString templinuxDir; -CString tarfile; +// variables for CCK Linux build +CString linuxOption; +CString linuxblobPath; +CString templinuxPath; +CString linuxDir; +CString nscpxpilinuxPath; +CString nsinstPath; +CString nsinstallerDir; +CString xpiDir; +CString templinuxDir; +CString tarfile; WIDGET *tempWidget; char buffer[50000]; @@ -62,15 +63,15 @@ BOOL prefDoesntExist = TRUE; COMPONENT Components[100]; int numComponents; int componentOrder; -CString componentstr; +CString componentstr; char tempcomponentstr[MAX_SIZE]; int findXPI(CString xpiname, CString filename) { int found = FALSE; - for (int i=0; !found && i<=xpiLen; i++) - //xpiList is an array of structures where each structure contains + for (int i=0; !found && i<=xpiLen; i++) + //xpiList is an array of structures where each structure contains //the name of the xpi file and the subpath of the file within. if (xpiList[i].xpiname == xpiname && xpiList[i].filename == filename) found = TRUE; @@ -114,11 +115,11 @@ int ReplaceXPIFiles() xpiArchive = nscpxpiPath + "\\" + xpiList[i].xpiname;//nscpxpiPath=CCKTool\NSCPXPI xpiArcDest = xpiDstPath + "\\" + xpiList[i].xpiname; //xpiDstPath=CCKTool\Configs\ configName\Output\Core if (!CopyFile(xpiArchive, xpiArcDest, TRUE)) - DWORD e = GetLastError(); - if ((strcmp(xpiList[i].filename,"bin/defaults/isp/US") == 0) || (strcmp(xpiList[i].filename,"bin/defaults/isp") == 0)) - command = quotes + rootPath + "zip.exe" + quotes + "-m " + spaces + quotes +xpiArcDest + quotes + spaces + quotes + xpiList[i].filename + "/*.*" + quotes; - else - command = quotes + rootPath + "zip.exe" + quotes + "-m " + spaces + quotes +xpiArcDest + quotes + spaces + quotes + xpiList[i].filename + quotes; + DWORD e = GetLastError(); + if ((strcmp(xpiList[i].filename,"bin/defaults/isp/US") == 0) || (strcmp(xpiList[i].filename,"bin/defaults/isp") == 0)) + command = quotes + rootPath + "zip.exe" + quotes + "-m " + spaces + quotes +xpiArcDest + quotes + spaces + quotes + xpiList[i].filename + "/*.*" + quotes; + else + command = quotes + rootPath + "zip.exe" + quotes + "-m " + spaces + quotes +xpiArcDest + quotes + spaces + quotes + xpiList[i].filename + quotes; ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE); } @@ -144,6 +145,24 @@ int findJAR(CString jarname, CString filename) return found; } +// Decrypt a file to another file. +int UnHash(CString HashedFile, CString ClearTextFile) +{ + CString command = quotes + rootPath + "parse_cfg.exe" + quotes + " -Y -input " + HashedFile + " -output " + ClearTextFile; + ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE); + + return TRUE; +} + +// Encrypt a file to another file. +int Hash(CString ClearTextFile, CString HashedFile) +{ + CString command = quotes + rootPath + "make_cfg.exe" + quotes + " -Y -input " + ClearTextFile + " -output " + HashedFile; + ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE); + + return TRUE; +} + int ExtractJARFile(CString xpiname, CString jarname, CString xpifile) { // AfxMessageBox("The xpiname is "+xpiname+" and the jar name is "+jarname+" and the file is "+xpifile,MB_OK); @@ -236,7 +255,8 @@ int ReplaceINIFile() return TRUE; } -void ModifyPref(char *buffer, CString entity, CString newvalue) + +void ModifyPref(char *buffer, CString entity, CString newvalue, BOOL bLockPref) { CString buf(buffer); @@ -258,6 +278,13 @@ void ModifyPref(char *buffer, CString entity, CString newvalue) buf.Delete(i, j-i+1); buf.Insert(i, newvalue); + if (bLockPref) + { + // If it's not lock_pref( already. + if (buf.Find("lock_pref(") < 0) + buf.Replace("pref(", "lock_pref("); + } + strcpy(buffer, (char *)(LPCTSTR) buf); prefDoesntExist = FALSE; } @@ -299,7 +326,7 @@ int ModifyProperties(CString xpifile, CString entity, CString newvalue) rename(tempFile, xpifile); return rv; } -void AddPref(CString xpifile, CString entity, CString newvalue) +void AddPref(CString xpifile, CString entity, CString newvalue, BOOL bUseQuotes, BOOL bLockPref) { int rv = TRUE; @@ -315,8 +342,6 @@ void AddPref(CString xpifile, CString entity, CString newvalue) return; } - tf<< "pref("<< entity <<", \""<< newvalue <<"\");\n"; - ifstream pf(prefFile); if (!pf) { @@ -330,6 +355,11 @@ void AddPref(CString xpifile, CString entity, CString newvalue) pf.getline(properties,400); tf < 0) - { - if (*cpin == CRVALUE) - cpin++; - else - { - *cpout++ = *cpin++; - cnt2++; - } - } - fwrite(&outbuf, sizeof(char), cnt2, fout); - if (ferror(fout)) - { - AfxMessageBox("Error in writing Config.ini file", MB_OK); - exit(3); - } - cnt2=0; - } - fclose(fin); - } - fclose(fout); - DeleteFile(templinuxPath+"\\Config.ini"); - rename(templinuxPath+"\\config.tmp",templinuxPath+"\\config.ini"); - - _chdir(outputPath); - templinuxPath = tempPath; - templinuxPath.Replace("\\", "/"); - templinuxPath.Replace(":",""); - templinuxPath.Insert(0,"/cygdrive/"); - DeleteFile(tarfile); - CString command = "tar -zcvf " + tarfile + " -C " +quotes+ templinuxPath + "/" + templinuxDir +quotes+ spaces + nsinstallerDir; - ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE); - _chdir(currentdir); -} + CopyFile(xpiDstPath+"\\Config.ini", templinuxPath+"\\Config.ini",FALSE); + DeleteFile(templinuxPath + xpiDir + "\\Config.ini"); + + FILE *fout = fopen(templinuxPath+"\\config.tmp", "wb"); + if (!fout) + { + AfxMessageBox("Cannot open output file", MB_OK); + exit(3); + } + FILE *fin = fopen(templinuxPath+"\\Config.ini", "rb"); + if (!fin) + { + AfxMessageBox("Cannot open Config.ini file", MB_OK); + exit(3); + } + else + { + char inbuf[BUF_SIZE], outbuf[BUF_SIZE]; + int cnt2=0; + while(!feof(fin)) + { + int count = fread(&inbuf, sizeof(char), sizeof(inbuf), fin); + if (ferror(fin)) + { + AfxMessageBox("Error in reading Config.ini file", MB_OK); + exit(3); + } + char *cpin = inbuf; + char *cpout = outbuf; + while (count-- > 0) + { + if (*cpin == CRVALUE) + cpin++; + else + { + *cpout++ = *cpin++; + cnt2++; + } + } + fwrite(&outbuf, sizeof(char), cnt2, fout); + if (ferror(fout)) + { + AfxMessageBox("Error in writing Config.ini file", MB_OK); + exit(3); + } + cnt2=0; + } + fclose(fin); + } + fclose(fout); + DeleteFile(templinuxPath+"\\Config.ini"); + rename(templinuxPath+"\\config.tmp",templinuxPath+"\\config.ini"); + + _chdir(outputPath); + templinuxPath = tempPath; + templinuxPath.Replace("\\", "/"); + templinuxPath.Replace(":",""); + templinuxPath.Insert(0,"/cygdrive/"); + DeleteFile(tarfile); + CString command = "tar -zcvf " + tarfile + " -C " +quotes+ templinuxPath + "/" + templinuxDir +quotes+ spaces + nsinstallerDir; + ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE); + _chdir(currentdir); +} void InsertComma(CString& requiredSpace) { @@ -1258,42 +1402,42 @@ int StartIB(CString parms, WIDGET *curWidget) networkPath = configPath + "\\Network"; tempPath = configPath + "\\Temp"; iniDstPath = cdPath + "\\config.ini"; - scriptPath = rootPath + "\\script.ib"; + scriptPath = rootPath + "script.ib"; workspacePath = configPath + "\\Workspace"; - xpiDstPath = cdPath; - // initializing variables for CCK linux build - linuxOption = GetGlobal("lPlatform"); - linuxblobPath = GetGlobal("LinuxPath"); - templinuxPath = tempPath + "\\templinux\\netscape-installer"; - linuxDir = "nscpxpiLinux"; - nscpxpilinuxPath = rootPath + linuxDir; - nsinstPath = "\\netscape-installer\\xpi"; - nsinstallerDir = "netscape-installer"; - xpiDir = "\\xpi"; - templinuxDir = "tempLinux"; - tarfile = "netscape-i686-pc-linux-gnu-sea.tar.gz"; + xpiDstPath = cdPath; + // initializing variables for CCK linux build + linuxOption = GetGlobal("lPlatform"); + linuxblobPath = GetGlobal("LinuxPath"); + templinuxPath = tempPath + "\\templinux\\netscape-installer"; + linuxDir = "nscpxpiLinux"; + nscpxpilinuxPath = rootPath + linuxDir; + nsinstPath = "\\netscape-installer\\xpi"; + nsinstallerDir = "netscape-installer"; + xpiDir = "\\xpi"; + templinuxDir = "tempLinux"; + tarfile = "netscape-i686-pc-linux-gnu-sea.tar.gz"; if (SearchPath(workspacePath, "NSCPXPI", NULL, 0, NULL, NULL)) nscpxpiPath = workspacePath + "\\NSCPXPI"; else - nscpxpiPath = rootPath + "NSCPXPI"; - if (linuxOption == "Linux") - { - nscpxpiPath = nscpxpilinuxPath + nsinstPath; - char currentdir[_MAX_PATH]; - _getcwd(currentdir,_MAX_PATH); - _mkdir(tempPath); - _chdir(tempPath); - _mkdir(templinuxDir); - _chdir(templinuxDir); - _mkdir(nsinstallerDir); - _chdir(nsinstallerDir); - - CString tPath = nscpxpiPath; - tPath.Replace(xpiDir,""); + nscpxpiPath = rootPath + "NSCPXPI"; + if (linuxOption == "Linux") + { + nscpxpiPath = nscpxpilinuxPath + nsinstPath; + char currentdir[_MAX_PATH]; + _getcwd(currentdir,_MAX_PATH); + _mkdir(tempPath); + _chdir(tempPath); + _mkdir(templinuxDir); + _chdir(templinuxDir); + _mkdir(nsinstallerDir); + _chdir(nsinstallerDir); + + CString tPath = nscpxpiPath; + tPath.Replace(xpiDir,""); CopyDirectory(tPath, templinuxPath, FALSE); - - // get rid of this ugly code when bugzilla bug 105351 is fixed + + // get rid of this ugly code when bugzilla bug 105351 is fixed CopyFile(nscpxpiPath+"\\full.start", templinuxPath+"\\xpi\\full.start", FALSE); CopyFile(nscpxpiPath+"\\full.end", @@ -1302,25 +1446,25 @@ int StartIB(CString parms, WIDGET *curWidget) templinuxPath+"\\xpi\\recommended.start", FALSE); CopyFile(nscpxpiPath+"\\recommended.end", templinuxPath+"\\xpi\\recommended.end", FALSE); - - _chdir(currentdir); + + _chdir(currentdir); } iniSrcPath = nscpxpiPath + "\\config.ini"; //Check for disk space before continuing ULARGE_INTEGER nTotalBytes, nTotalFreeBytes, nTotalAvailable; - GetDiskFreeSpaceEx(NULL,&nTotalAvailable, &nTotalBytes, &nTotalFreeBytes); + GetDiskFreeSpaceEx(NULL,&nTotalAvailable, &nTotalBytes, &nTotalFreeBytes); // Checking for 26.3MB disk space - if (linuxOption != "Linux") - { + if (linuxOption != "Linux") + { if ((nTotalAvailable.QuadPart) < WDISK_SPACE) { DiskSpaceAlert(WDISK_SPACE,(nTotalAvailable.QuadPart)); return FALSE; } - } - else - { + } + else + { if ((nTotalAvailable.QuadPart) < LDISK_SPACE) { DiskSpaceAlert(LDISK_SPACE,(nTotalAvailable.QuadPart)); @@ -1338,16 +1482,21 @@ int StartIB(CString parms, WIDGET *curWidget) //checking to see if the AnimatedLogoURL has a http:// appended in front of it //if not then we have to append it; -//Check to see if the User Agent string exists and if so then append -CCK to it ; +//Check to see if the User Agent string exists and if so then prefix with -CK +//(-CK can be replaced with a string UserAgentPrefix global.) + CString userAgentPrefix = GetGlobal("UserAgentPrefix"); + if (userAgentPrefix.IsEmpty()) + userAgentPrefix = "CK-"; CString userAgent = GetGlobal("OrganizationName"); - if (userAgent) - { - CString templeft = userAgent.Left(3); - if ((templeft.CompareNoCase("CK-")) != 0) - userAgent = "CK-" + userAgent; - } + if (userAgent) + { + CString templeft = userAgent.Left(3); + if ((templeft.CompareNoCase(userAgentPrefix)) != 0) + userAgent = userAgentPrefix + userAgent; + } SetGlobal("OrganizationName",userAgent); + // check to see if the bmp for rshell background is bigger than 302KB; HANDLE hFile; DWORD dwFileSize; @@ -1390,29 +1539,29 @@ int StartIB(CString parms, WIDGET *curWidget) SetGlobal("HlpRDF",setHlpRDF); CreateHelpMenu(); - CString setIspRDF = tempPath +"\\mailaccount.rdf"; - SetGlobal("IspRDF",setIspRDF); - CreateIspMenu(); - - CString setnewsRDF = tempPath +"\\newsaccount.rdf"; - SetGlobal("NewsRDF",setnewsRDF); - CreateNewsMenu(); - - // Determine which proxy configuration is chosen - CString proxyConfigoption = GetGlobal("radioGroup2"); - if (proxyConfigoption == "3") - SetGlobal("ProxyConfig","2"); - else if (proxyConfigoption == "2") - SetGlobal("ProxyConfig","1"); - else - SetGlobal("ProxyConfig","0"); - // Determine which SOCKS version is chosen - CString socksVer = GetGlobal("socksv"); - if (socksVer == "SOCKS v4") - SetGlobal("SocksVersion","4"); - else - SetGlobal("SocksVersion","5"); - + CString setIspRDF = tempPath +"\\mailaccount.rdf"; + SetGlobal("IspRDF",setIspRDF); + CreateIspMenu(); + + CString setnewsRDF = tempPath +"\\newsaccount.rdf"; + SetGlobal("NewsRDF",setnewsRDF); + CreateNewsMenu(); + + // Determine which proxy configuration is chosen + CString proxyConfigoption = GetGlobal("radioGroup2"); + if (proxyConfigoption == "3") + SetGlobal("ProxyConfig","2"); + else if (proxyConfigoption == "2") + SetGlobal("ProxyConfig","1"); + else + SetGlobal("ProxyConfig","0"); + // Determine which SOCKS version is chosen + CString socksVer = GetGlobal("socksv"); + if (socksVer == "SOCKS v4") + SetGlobal("SocksVersion","4"); + else + SetGlobal("SocksVersion","5"); + if (cdDir.Compare("1") ==0) { _mkdir((char *)(LPCTSTR) cdPath); @@ -1483,8 +1632,8 @@ int StartIB(CString parms, WIDGET *curWidget) // Put all the extracted files back into their new XPI homes ReplaceJARFiles(); - - dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||"); + + dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||"); ReplaceXPIFiles(); @@ -1503,17 +1652,17 @@ int StartIB(CString parms, WIDGET *curWidget) CopyFile(nscpxpiPath + "\\" + Components[i].archive, xpiDstPath + "\\" + Components[i].archive, TRUE); } - - if (linuxOption != "Linux") + + if (linuxOption != "Linux") { if (cdDir.Compare("1") ==0) { CString shellPath = workspacePath + "\\Autorun\\"; CopyDir(shellPath, outputPath, NULL, TRUE); - CreateRshell (); - WritePrivateProfileString("Message Stream", "Status", "Disabled", iniDstPath); - + CreateRshell (); + WritePrivateProfileString("Message Stream", "Status", "Disabled", iniDstPath); + } else { @@ -1525,7 +1674,7 @@ int StartIB(CString parms, WIDGET *curWidget) fprintf(infout,"[autorun]\nopen = setup.exe"); } - } + } CString component; CString configiniPath = xpiDstPath +"\\config.ini"; @@ -1544,42 +1693,42 @@ int StartIB(CString parms, WIDGET *curWidget) WritePrivateProfileString("Site Selector", "Identifier0", "Site0", configiniPath); WritePrivateProfileString("Site Selector", "Description0", "Default", configiniPath); WritePrivateProfileString("Site Selector", "Domain0", ftpLocation, configiniPath); - // HTTP support for network installer - CString httpstr = ftpLocation.Left(7); - if (httpstr.Compare("http://") == 0) - WritePrivateProfileString("Dialog Advanced Settings", - "Use Protocol", "HTTP", configiniPath); - else - WritePrivateProfileString("Dialog Advanced Settings", - "Use Protocol", "FTP", configiniPath); + // HTTP support for network installer + CString httpstr = ftpLocation.Left(7); + if (httpstr.Compare("http://") == 0) + WritePrivateProfileString("Dialog Advanced Settings", + "Use Protocol", "HTTP", configiniPath); + else + WritePrivateProfileString("Dialog Advanced Settings", + "Use Protocol", "FTP", configiniPath); // } } // Didn't work... dlg->SetWindowText(" Customization is in Progress \n |||||||||||||||||||||||||||"); - - if (linuxOption == "Linux") - { - LinuxInvisible(); + + if (linuxOption == "Linux") + { + LinuxInvisible(); dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||||||||||||||||||||"); AddThirdParty(); dlg->SetWindowText(" Customization is in Progress \n |||||||||||||||||||||||||||||||||||||||||||||"); CreateLinuxInstaller(); dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||||||||||||||||||||||||||||||||||||||"); - } - else + } + else { invisible(); - + dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||||||||||||||||||||"); AddThirdParty(); - + dlg->SetWindowText(" Customization is in Progress \n |||||||||||||||||||||||||||||||||||||||||||||"); - + ReplaceINIFile(); - + dlg->SetWindowText(" Customization is in Progress \n ||||||||||||||||||||||||||||||||||||||||||||||||||||||"); } SetCurrentDirectory(olddir); diff --git a/cck/include/WizardTypes.h b/cck/include/WizardTypes.h index c871c630928..c199b219f90 100644 --- a/cck/include/WizardTypes.h +++ b/cck/include/WizardTypes.h @@ -54,6 +54,7 @@ typedef struct WIDGET CString group; CString target; CString description; + CString showinsection; // Used in the ShowSection command to show and hide widgets based on selection in a listbox. POINT location; DIMENSION size; FIELDLEN fieldlen;