pages/DatabaseConfig.nsi
author Dan Fuhry <dan@enanocms.org>
Sat, 21 Aug 2010 18:19:58 -0400
changeset 10 014d58335b6d
parent 3 0cce88c7cf7c
permissions -rw-r--r--
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     1
!macro ShowRange hwnd low high value
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     2
  !define tmp_id ${__LINE__}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     3
  StrCpy $R0 ${low}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     4
  loop.${tmp_id}:
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     5
    GetDlgItem $R1 ${hwnd} $R0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     6
    ShowWindow $R1 ${value}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     7
    IntOp $R0 $R0 + 1
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     8
    IntCmp $R0 ${high} loop.${tmp_id} loop.${tmp_id}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     9
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    10
  !undef tmp_id
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    11
!macroend
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    12
!define ShowRange "!insertmacro ShowRange"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    13
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    14
Page custom DatabaseConfigCreate DatabaseConfigLeave " - Database configuration"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    15
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    16
Function DatabaseConfigCreate
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    17
  StrCmp $XPUI_ABORTED 1 0 +2
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    18
    Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    19
  !insertmacro XPUI_INSTALLOPTIONS_EXTRACT_AS "pages\DatabaseConfig.ini" "DatabaseConfig.ini"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    20
  !insertmacro XPUI_HEADER_TEXT "Database configuration" "Configure how $(^Name) will access your database."
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    21
  WriteINIStr "$PLUGINSDIR\DatabaseConfig.ini" "Field 9" "Text" \
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    22
    "$(^Name) needs database access to work properly. Setup can create a database for you if you provide \
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    23
     $db_dbmsname's administration password, or you can choose to enter credentials for a database that already exists."
3
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    24
     
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    25
  StrCpy $R2 0 ; Hide manual credential items
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    26
  StrCpy $R3 0 ; Hide root password/set manual to disabled
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    27
     
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    28
  ; if the back button was clicked we might have use manual checked
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    29
  ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 3" "State"
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    30
  IntCmp $0 1 UseManualIsOn
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    31
  
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    32
    StrCpy $R2 1
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    33
    
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    34
  UseManualIsOn:
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    35
    
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    36
    ; do we need to disable the checkbox?
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    37
    ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 2" "State"
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    38
    IntCmp $0 1   0 ShowDialog ShowDialog
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    39
    
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    40
      StrCpy $R3 1
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    41
      
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    42
  ShowDialog:
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    43
    
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    44
  !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG "DatabaseConfig.ini"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    45
  Pop $XPUI_HWND
3
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    46
  
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    47
  ; Our bold font
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    48
  CreateFont $2 "$(^Font)" "$(^FontSize)" 700
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    49
  ; Paint controls
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    50
  GetDlgItem $1 $XPUI_HWND 1200
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    51
  SendMessage $1 ${WM_SETFONT} $2 0
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    52
  GetDlgItem $1 $XPUI_HWND 1201
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    53
  SendMessage $1 ${WM_SETFONT} $2 0
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    54
  GetDlgItem $1 $XPUI_HWND 1214
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    55
  SendMessage $1 ${WM_SETFONT} $2 0
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    56
  
3
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    57
  IntCmp $R2 1 "" SkipHideManual
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    58
  
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    59
    ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE}
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    60
    ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE}
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    61
    
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    62
  SkipHideManual:
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    63
    
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    64
  IntCmp $R3 1 "" SkipForceManual
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    65
3
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    66
    ; check the box and disable
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    67
    GetDlgItem $0 $XPUI_HWND 1202
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    68
    SendMessage $0 ${BM_SETCHECK} ${BST_CHECKED} 0
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    69
    EnableWindow $0 0
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    70
    
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    71
    ; hide the root password, enter manually is selected
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    72
    GetDlgItem $0 $XPUI_HWND 1203
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    73
    ShowWindow $0 ${SW_HIDE}
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    74
    GetDlgItem $0 $XPUI_HWND 1209
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    75
    ShowWindow $0 ${SW_HIDE}
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    76
3
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    77
  SkipForceManual:
0cce88c7cf7c Added Makefile
Dan
parents: 2
diff changeset
    78
    
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    79
  !insertmacro XPUI_INSTALLOPTIONS_SHOW
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    80
FunctionEnd
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    81
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    82
Function DatabaseConfigLeave
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    83
  StrCmp $XPUI_ABORTED 1 0 +2
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    84
    Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    85
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    86
  ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Settings" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    87
  StrCmp $0 1 RadioButtonClicked
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    88
  StrCmp $0 2 RadioButtonClicked
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    89
  StrCmp $0 15 RadioButtonClicked
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    90
  StrCmp $0 3 UseManualClicked
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    91
  Goto NextClicked
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    92
  
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    93
  RadioButtonClicked:
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    94
    LockWindow on
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    95
	ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 15" "State"
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    96
	IntCmp $0 1 SetBypass
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    97
    ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 1" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    98
    IntCmp $0 0 SetUseExisting
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    99
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   100
      ; Show root password
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   101
      GetDlgItem $0 $XPUI_HWND 1203
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   102
      ShowWindow $0 ${SW_SHOW}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   103
      GetDlgItem $0 $XPUI_HWND 1209
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   104
      ShowWindow $0 ${SW_SHOW}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   105
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   106
      GetDlgItem $0 $XPUI_HWND 1202 ; Checkbox
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   107
      SendMessage $0 ${BM_SETCHECK} ${BST_UNCHECKED} 0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   108
      EnableWindow $0 1
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   109
      ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   110
      ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   111
      LockWindow off
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   112
      Abort
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   113
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   114
    SetUseExisting:
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   115
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   116
      ; Hide root password
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   117
      GetDlgItem $0 $XPUI_HWND 1203
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   118
      ShowWindow $0 ${SW_HIDE}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   119
      GetDlgItem $0 $XPUI_HWND 1209
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   120
      ShowWindow $0 ${SW_HIDE}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   121
      
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   122
      GetDlgItem $0 $XPUI_HWND 1202 ; Checkbox
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   123
      SendMessage $0 ${BM_SETCHECK} ${BST_CHECKED} 0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   124
      EnableWindow $0 0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   125
      ${ShowRange} $XPUI_HWND 1204 1207 ${SW_SHOW}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   126
      ${ShowRange} $XPUI_HWND 1210 1213 ${SW_SHOW}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   127
      LockWindow off
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   128
      Abort
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   129
      
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   130
    SetBypass:
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   131
    	
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   132
      ; Hide root password
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   133
      GetDlgItem $0 $XPUI_HWND 1203
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   134
      ShowWindow $0 ${SW_HIDE}
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   135
      GetDlgItem $0 $XPUI_HWND 1209
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   136
      ShowWindow $0 ${SW_HIDE}
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   137
      
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   138
      GetDlgItem $0 $XPUI_HWND 1202 ; Checkbox
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   139
      SendMessage $0 ${BM_SETCHECK} ${BST_UNCHECKED} 0
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   140
      EnableWindow $0 0
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   141
      ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE}
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   142
      ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE}
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   143
      LockWindow off
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   144
      Abort
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   145
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   146
  UseManualClicked:
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   147
    ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 3" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   148
    IntOp $0 $0 * ${SW_SHOW}
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   149
    ${ShowRange} $XPUI_HWND 1204 1207 $0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   150
    ${ShowRange} $XPUI_HWND 1210 1213 $0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   151
    Abort
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   152
  
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   153
  NextClicked:
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   154
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   155
    ; Figure out how we want to go about this.
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   156
    StrCpy $db_needroot 0
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   157
    StrCpy $skip_install 0
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   158
    ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 15" "State"
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   159
    IntCmp $0 1 BypassInstaller
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   160
    ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 1" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   161
    IntCmp $0 0 UseCustomLogin
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   162
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   163
      ; Validate based on root password.
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   164
      StrCpy $db_needroot 1
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   165
      ReadINIStr $db_rootpass "$PLUGINSDIR\DatabaseConfig.ini" "Field 4" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   166
      ${db_connect} $1 "$db_rootuser" "$db_rootpass"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   167
      IntCmp $1 0 +3
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   168
        MessageBox MB_OK|MB_ICONEXCLAMATION "The $db_dbmsname root password you entered is incorrect. Please re-enter it."
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   169
        Abort
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   170
        
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   171
      ; Does the user have their own credentials?
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   172
      ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 3" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   173
      IntCmp $0 0 GenerateRandomLogin
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   174
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   175
    UseCustomLogin:
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   176
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   177
      ; Pull database settings from dialog
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   178
      ReadINIStr $db_name "$PLUGINSDIR\DatabaseConfig.ini" "Field 5" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   179
      ReadINIStr $db_user "$PLUGINSDIR\DatabaseConfig.ini" "Field 6" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   180
      ReadINIStr $db_password "$PLUGINSDIR\DatabaseConfig.ini" "Field 7" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   181
      ReadINIStr $R0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 8" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   182
      
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   183
      ; Check password length
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   184
      ; but don't if the user entered credentials that already exist
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   185
      IntCmp $db_needroot 0 SkipLengthCheck
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   186
        StrLen $R1 $R0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   187
        IntCmp $R1 6 +3 0 +3
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   188
          MessageBox MB_OK|MB_ICONEXCLAMATION "Please choose a database password that is at least 6 characters in length."
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   189
          Abort
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   190
          
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   191
      SkipLengthCheck:
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   192
      ; Check password/confirm fields
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   193
      StrCmp $db_password $R0 +3
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   194
        MessageBox MB_OK|MB_ICONEXCLAMATION "The passwords you entered do not match. Please enter them again."
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   195
        Abort
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   196
        
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   197
      ; If we're root, we can assume the login doesn't exist yet, so skip the validation
2
0c0d5dadfca3 Added LockWindow calls to all custom page exit paths to smooth transitions
Dan
parents: 0
diff changeset
   198
      IntCmp $db_needroot 0 +3
0c0d5dadfca3 Added LockWindow calls to all custom page exit paths to smooth transitions
Dan
parents: 0
diff changeset
   199
        LockWindow on
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   200
        Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   201
        
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   202
      ${db_connect} $R0 $db_user $db_password
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   203
      IntCmp $R0 0 +3
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   204
        ; Database auth failed
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   205
        MessageBox MB_OK|MB_ICONEXCLAMATION "The username and password you entered are invalid. Please enter them again."
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   206
        Abort
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   207
        
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   208
      /*
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   209
      ; This can be an error-prone process because entering credentials manually will keep
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   210
      ; the installer from touching the database. If tables already exist, Enano's installer
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   211
      ; will throw an error. Confirm this with the user.
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   212
      MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you want to use manual database settings?$\r$\n\
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   213
                                           $\r$\n\
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   214
                                           Without your database root password, Setup cannot change your existing database. If there is an Enano installation \
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   215
                                           in this database already, the installer will fail with this option; you should go back and choose the $\"Upgrade or \
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   216
                                           configure database manually$\" option." IDYES +2
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   217
        Abort ; on No
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   218
      */
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   219
      
2
0c0d5dadfca3 Added LockWindow calls to all custom page exit paths to smooth transitions
Dan
parents: 0
diff changeset
   220
      LockWindow on
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   221
      Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   222
      
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   223
    BypassInstaller:
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   224
    	
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   225
      ; No validation - the user opted to configure everything manually.
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   226
      StrCpy $skip_install 1
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   227
      
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   228
    GenerateRandomLogin:
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   229
      StrCpy $db_name "bn_enanocms"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   230
      StrCpy $db_user "bn_enanocms"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   231
      Call GenerateRandomPassword
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   232
      Pop $db_password
2
0c0d5dadfca3 Added LockWindow calls to all custom page exit paths to smooth transitions
Dan
parents: 0
diff changeset
   233
      LockWindow on
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   234
      Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   235
  
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   236
FunctionEnd
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   237
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   238
Function GenerateRandomPassword
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   239
  SetOutPath $PLUGINSDIR
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   240
  File "inst-resources\randompass.php"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   241
  nsExec::ExecToStack '"$stack_instdir\php\php.exe" "$PLUGINSDIR\randompass.php"'
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   242
  Pop $R0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
   243
FunctionEnd
10
014d58335b6d Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   244