Source code of file oscpmwin_v0.4.1.816/configmod.pas from the
osCommerce Product Manager for Windows.


0000:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001:   osCommerce Product Manager for Windows (oscpmwin).
0002:   Copyright �2003-2006 by Mario A. Valdez-Ramirez.
0003:   
0004:   You can contact Mario A. Valdez-Ramirez
0005:   by email at mario@mariovaldez.org or paper mail at
0006:   Olmos 809, San Nicolas, NL. 66495, Mexico.
0007:   
0008:   This program is free software; you can redistribute it and/or modify
0009:   it under the terms of the GNU General Public License as published by
0010:   the Free Software Foundation; either version 2 of the License, or (at
0011:   your option) any later version.
0012:   
0013:   This program is distributed in the hope that it will be useful, but
0014:   WITHOUT ANY WARRANTY; without even the implied warranty of
0015:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0016:   General Public License for more details.
0017:   
0018:   You should have received a copy of the GNU General Public License
0019:   along with this program; if not, write to the Free Software
0020:   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0021:   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0022:   unit configmod;
0023:   
0024:   interface
0025:   
0026:   uses
0027:     SysUtils, Controls, Forms, Dialogs, StdCtrls, Spin, Buttons, Classes;
0028:   
0029:   type
0030:     Topm_Form_ConfigMod = class(TForm)
0031:       opm_BitBtn_ConfigModOk: TBitBtn;
0032:       opm_BitBtn_ConfigModCancel: TBitBtn;
0033:       opm_Label_ConfigModName: TLabel;
0034:       opm_Edit_ConfigModName: TEdit;
0035:       opm_Label_ConfigModFile: TLabel;
0036:       opm_Edit_ConfigModCmd: TEdit;
0037:       opm_BitBtn_ConfigModFile: TBitBtn;
0038:       opm_Label_ConfigModPara: TLabel;
0039:       opm_Edit_ConfigModPara: TEdit;
0040:       opm_Label_ConfigModPort: TLabel;
0041:       opm_SpinEdit_ConfigModPort: TSpinEdit;
0042:       opm_CheckBox_ConfigModJustRun: TCheckBox;
0043:       opm_CheckBox_ConfigModOnSelection: TCheckBox;
0044:       opm_CheckBox_ConfigModRemote: TCheckBox;
0045:       opm_Label_ConfigModIndex: TLabel;
0046:       opm_ComboBox_ConfigModIndex: TComboBox;
0047:       opm_Label_ConfigModResult: TLabel;
0048:       opm_ComboBox_ConfigModResult: TComboBox;
0049:       opm_OpenDialog_ConfigMod: TOpenDialog;
0050:       procedure opm_BitBtn_ConfigModFileClick(Sender: TObject);
0051:       procedure opm_BitBtn_ConfigModOkClick(Sender: TObject);
0052:       procedure FormCreate(Sender: TObject);
0053:       procedure FormShow(Sender: TObject);
0054:     private
0055:       { Private declarations }
0056:     public
0057:       MC_Name : STRING;
0058:       MC_AddEdit : BOOLEAN;
0059:     end;
0060:   
0061:   var
0062:     opm_Form_ConfigMod: Topm_Form_ConfigMod;
0063:   
0064:   implementation
0065:   
0066:   {$R *.dfm}
0067:   
0068:   Uses gnugettext, oscpmdata, dataman, attention, modules;
0069:   
0070:   
0071:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0072:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0073:   procedure Topm_Form_ConfigMod.opm_BitBtn_ConfigModFileClick (Sender: TObject);
0074:   begin
0075:     opm_OpenDialog_ConfigMod.DefaultExt := opmC_Def_LoadModExt;
0076:     opm_OpenDialog_ConfigMod.FileName := '';
0077:     opm_OpenDialog_ConfigMod.Filter := _('Executable files') + ' (' + opmC_Def_LoadModFilter + ')|' + opmC_Def_LoadModFilter + '|' + _('All files (*.*)');
0078:     opm_OpenDialog_ConfigMod.Title := _('Choosing module file...');
0079:     opm_OpenDialog_ConfigMod.InitialDir := opm_ModuleDirectory;
0080:     IF (opm_OpenDialog_ConfigMod.Execute = TRUE) THEN
0081:       BEGIN
0082:         opm_Edit_ConfigModCmd.Text := TRIM (ExtractFileName (opm_OpenDialog_ConfigMod.FileName));
0083:       END;
0084:   end;
0085:   
0086:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0087:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0088:   procedure Topm_Form_ConfigMod.opm_BitBtn_ConfigModOkClick(Sender: TObject);
0089:   begin
0090:     opm_CurrentModuleRecord.Name := FNopm_CleanUploadName (TRIM (opm_Edit_ConfigModName.Text));
0091:     opm_CurrentModuleRecord.CommandFile := ExtractFileName (TRIM (opm_Edit_ConfigModCmd.Text));
0092:     opm_CurrentModuleRecord.CommandPara := TRIM (opm_Edit_ConfigModPara.Text);
0093:     opm_CurrentModuleRecord.Port := opm_SpinEdit_ConfigModPort.Value;
0094:     IF (opm_CheckBox_ConfigModRemote.Checked = TRUE) THEN opm_CurrentModuleRecord.Remote := 1 ELSE opm_CurrentModuleRecord.Remote := 0;
0095:     IF (opm_CheckBox_ConfigModJustRun.Checked = TRUE) THEN opm_CurrentModuleRecord.JustRun := 1 ELSE opm_CurrentModuleRecord.JustRun := 0;
0096:     IF (opm_CheckBox_ConfigModOnSelection.Checked = TRUE) THEN opm_CurrentModuleRecord.OnSelection := 1 ELSE opm_CurrentModuleRecord.OnSelection := 0;
0097:     opm_CurrentModuleRecord.IndexData := TRIM (opm_ComboBox_ConfigModIndex.Text);
0098:     opm_CurrentModuleRecord.ResultData := TRIM (opm_ComboBox_ConfigModResult.Text);
0099:     IF (opm_FNSave_ModuleData (opm_CurrentModuleRecord) = FALSE) THEN
0100:       BEGIN
0101:         FNopm_Message (_('Missing or wrong data.'), mtError, [mbOK], opmG_UISilent);
0102:         ModalResult := mrNone;
0103:       END;
0104:   end;
0105:   
0106:   
0107:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0108:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0109:   procedure Topm_Form_ConfigMod.FormCreate(Sender: TObject);
0110:   begin
0111:     MC_Name := '';
0112:     MC_AddEdit := FALSE;
0113:     opm_SpinEdit_ConfigModPort.MinValue := opmC_Min_ModPort;
0114:     opm_SpinEdit_ConfigModPort.MaxValue := opmC_Max_ModPort;
0115:     opm_ComboBox_ConfigModIndex.Sorted := FALSE;
0116:     opm_ComboBox_ConfigModResult.Sorted := FALSE;
0117:     opm_Edit_ConfigModName.MaxLength := opmC_Max_ModNameWidth;
0118:     opm_Edit_ConfigModCmd.MaxLength := opmC_Max_ModCMDWidth;
0119:     TranslateComponent (self);
0120:   end;
0121:   
0122:   
0123:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0124:   {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0125:   procedure Topm_Form_ConfigMod.FormShow(Sender: TObject);
0126:   begin
0127:     opm_Form_ConfigMod.Caption := _('Module configuration');
0128:     opm_ComboBox_ConfigModIndex.Items := opmG_ModIndexData_BoxList;
0129:     opm_ComboBox_ConfigModResult.Items := opmG_ModResultData_BoxList;
0130:     opm_Edit_ConfigModName.Enabled := MC_AddEdit;
0131:     opm_CurrentModuleRecord := opm_FNLoad_ModuleData (MC_Name);
0132:     IF (MC_AddEdit = TRUE) THEN
0133:       BEGIN
0134:         opm_Edit_ConfigModName.Text := '';
0135:         opm_Edit_ConfigModCmd.Text := '';
0136:         opm_Edit_ConfigModPara.Text := '';
0137:         opm_SpinEdit_ConfigModPort.Value := opmC_Def_ModPort;
0138:         opm_CheckBox_ConfigModRemote.Checked := FALSE;
0139:         opm_CheckBox_ConfigModJustRun.Checked := FALSE;
0140:         opm_CheckBox_ConfigModOnSelection.Checked := TRUE;
0141:         opm_ComboBox_ConfigModIndex.ItemIndex := 0;
0142:         opm_ComboBox_ConfigModResult.ItemIndex := 0;
0143:       END
0144:     ELSE
0145:       BEGIN
0146:         opm_Edit_ConfigModName.Text := opm_CurrentModuleRecord.Name;
0147:         opm_Edit_ConfigModCmd.Text := opm_CurrentModuleRecord.CommandFile;
0148:         opm_Edit_ConfigModPara.Text := opm_CurrentModuleRecord.CommandPara;
0149:         opm_SpinEdit_ConfigModPort.Value := opm_CurrentModuleRecord.Port;
0150:         opm_CheckBox_ConfigModRemote.Checked := (opm_CurrentModuleRecord.Remote > 0);
0151:         opm_CheckBox_ConfigModJustRun.Checked := (opm_CurrentModuleRecord.JustRun > 0);
0152:         opm_CheckBox_ConfigModOnSelection.Checked := (opm_CurrentModuleRecord.OnSelection > 0);
0153:         opm_ComboBox_ConfigModIndex.ItemIndex := opm_FNGetListIndexByString (opm_CurrentModuleRecord.IndexData, opmG_ModIndexData_BoxList);
0154:         opm_ComboBox_ConfigModResult.ItemIndex := opm_FNGetListIndexByString (opm_CurrentModuleRecord.ResultData, opmG_ModResultData_BoxList);
0155:       END;
0156:   end;
0157:   
0158:   end.
 
 
NA fum/lmd: 2007.07.15
Copyright ©1994-2024 by Mario A. Valdez-Ramírez.
no siga este enlace / do not follow this link