pages/DatabaseConfig.nsi
changeset 10 014d58335b6d
parent 3 0cce88c7cf7c
equal deleted inserted replaced
8:af10a4dbafb4 10:014d58335b6d
    42   ShowDialog:
    42   ShowDialog:
    43     
    43     
    44   !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG "DatabaseConfig.ini"
    44   !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG "DatabaseConfig.ini"
    45   Pop $XPUI_HWND
    45   Pop $XPUI_HWND
    46   
    46   
       
    47   ; Our bold font
       
    48   CreateFont $2 "$(^Font)" "$(^FontSize)" 700
       
    49   ; Paint controls
       
    50   GetDlgItem $1 $XPUI_HWND 1200
       
    51   SendMessage $1 ${WM_SETFONT} $2 0
       
    52   GetDlgItem $1 $XPUI_HWND 1201
       
    53   SendMessage $1 ${WM_SETFONT} $2 0
       
    54   GetDlgItem $1 $XPUI_HWND 1214
       
    55   SendMessage $1 ${WM_SETFONT} $2 0
       
    56   
    47   IntCmp $R2 1 "" SkipHideManual
    57   IntCmp $R2 1 "" SkipHideManual
    48   
    58   
    49     ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE}
    59     ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE}
    50     ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE}
    60     ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE}
    51     
    61     
    74     Return
    84     Return
    75     
    85     
    76   ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Settings" "State"
    86   ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Settings" "State"
    77   StrCmp $0 1 RadioButtonClicked
    87   StrCmp $0 1 RadioButtonClicked
    78   StrCmp $0 2 RadioButtonClicked
    88   StrCmp $0 2 RadioButtonClicked
       
    89   StrCmp $0 15 RadioButtonClicked
    79   StrCmp $0 3 UseManualClicked
    90   StrCmp $0 3 UseManualClicked
    80   Goto NextClicked
    91   Goto NextClicked
    81   
    92   
    82   RadioButtonClicked:
    93   RadioButtonClicked:
    83     LockWindow on
    94     LockWindow on
       
    95 	ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 15" "State"
       
    96 	IntCmp $0 1 SetBypass
    84     ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 1" "State"
    97     ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 1" "State"
    85     IntCmp $0 0 SetUseExisting
    98     IntCmp $0 0 SetUseExisting
    86     
    99     
    87       ; Show root password
   100       ; Show root password
    88       GetDlgItem $0 $XPUI_HWND 1203
   101       GetDlgItem $0 $XPUI_HWND 1203
   111       EnableWindow $0 0
   124       EnableWindow $0 0
   112       ${ShowRange} $XPUI_HWND 1204 1207 ${SW_SHOW}
   125       ${ShowRange} $XPUI_HWND 1204 1207 ${SW_SHOW}
   113       ${ShowRange} $XPUI_HWND 1210 1213 ${SW_SHOW}
   126       ${ShowRange} $XPUI_HWND 1210 1213 ${SW_SHOW}
   114       LockWindow off
   127       LockWindow off
   115       Abort
   128       Abort
       
   129       
       
   130     SetBypass:
       
   131     	
       
   132       ; Hide root password
       
   133       GetDlgItem $0 $XPUI_HWND 1203
       
   134       ShowWindow $0 ${SW_HIDE}
       
   135       GetDlgItem $0 $XPUI_HWND 1209
       
   136       ShowWindow $0 ${SW_HIDE}
       
   137       
       
   138       GetDlgItem $0 $XPUI_HWND 1202 ; Checkbox
       
   139       SendMessage $0 ${BM_SETCHECK} ${BST_UNCHECKED} 0
       
   140       EnableWindow $0 0
       
   141       ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE}
       
   142       ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE}
       
   143       LockWindow off
       
   144       Abort
   116     
   145     
   117   UseManualClicked:
   146   UseManualClicked:
   118     ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 3" "State"
   147     ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 3" "State"
   119     IntOp $0 $0 * ${SW_SHOW}
   148     IntOp $0 $0 * ${SW_SHOW}
   120     ${ShowRange} $XPUI_HWND 1204 1207 $0
   149     ${ShowRange} $XPUI_HWND 1204 1207 $0
   123   
   152   
   124   NextClicked:
   153   NextClicked:
   125 
   154 
   126     ; Figure out how we want to go about this.
   155     ; Figure out how we want to go about this.
   127     StrCpy $db_needroot 0
   156     StrCpy $db_needroot 0
       
   157     StrCpy $skip_install 0
       
   158     ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 15" "State"
       
   159     IntCmp $0 1 BypassInstaller
   128     ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 1" "State"
   160     ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 1" "State"
   129     IntCmp $0 0 UseCustomLogin
   161     IntCmp $0 0 UseCustomLogin
   130     
   162     
   131       ; Validate based on root password.
   163       ; Validate based on root password.
   132       StrCpy $db_needroot 1
   164       StrCpy $db_needroot 1
   171       IntCmp $R0 0 +3
   203       IntCmp $R0 0 +3
   172         ; Database auth failed
   204         ; Database auth failed
   173         MessageBox MB_OK|MB_ICONEXCLAMATION "The username and password you entered are invalid. Please enter them again."
   205         MessageBox MB_OK|MB_ICONEXCLAMATION "The username and password you entered are invalid. Please enter them again."
   174         Abort
   206         Abort
   175         
   207         
       
   208       /*
   176       ; This can be an error-prone process because entering credentials manually will keep
   209       ; This can be an error-prone process because entering credentials manually will keep
   177       ; the installer from touching the database. If tables already exist, Enano's installer
   210       ; the installer from touching the database. If tables already exist, Enano's installer
   178       ; will throw an error. Confirm this with the user.
   211       ; will throw an error. Confirm this with the user.
   179       MessageBox MB_YESNO|MB_ICONQUESTION "Do you really want to use manual database settings?$\r$\n\
   212       MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you want to use manual database settings?$\r$\n\
   180                                            $\r$\n\
   213                                            $\r$\n\
   181                                            Setup will not attempt to modify your existing database. If there is \
   214                                            Without your database root password, Setup cannot change your existing database. If there is an Enano installation \
   182                                            already an installation of $(^Name) in the database, the installer will \
   215                                            in this database already, the installer will fail with this option; you should go back and choose the $\"Upgrade or \
   183                                            fail. This option is recommended only for advanced users." IDYES +2
   216                                            configure database manually$\" option." IDYES +2
   184         Abort ; on No
   217         Abort ; on No
       
   218       */
   185       
   219       
   186       LockWindow on
   220       LockWindow on
   187       Return
   221       Return
       
   222       
       
   223     BypassInstaller:
       
   224     	
       
   225       ; No validation - the user opted to configure everything manually.
       
   226       StrCpy $skip_install 1
   188       
   227       
   189     GenerateRandomLogin:
   228     GenerateRandomLogin:
   190       StrCpy $db_name "bn_enanocms"
   229       StrCpy $db_name "bn_enanocms"
   191       StrCpy $db_user "bn_enanocms"
   230       StrCpy $db_user "bn_enanocms"
   192       Call GenerateRandomPassword
   231       Call GenerateRandomPassword
   200   SetOutPath $PLUGINSDIR
   239   SetOutPath $PLUGINSDIR
   201   File "inst-resources\randompass.php"
   240   File "inst-resources\randompass.php"
   202   nsExec::ExecToStack '"$stack_instdir\php\php.exe" "$PLUGINSDIR\randompass.php"'
   241   nsExec::ExecToStack '"$stack_instdir\php\php.exe" "$PLUGINSDIR\randompass.php"'
   203   Pop $R0
   242   Pop $R0
   204 FunctionEnd
   243 FunctionEnd
       
   244