|
From: <cod...@go...> - 2008-12-01 22:16:17
|
Author: M0E.lnx
Date: Mon Dec 1 14:14:54 2008
New Revision: 331
Added:
branches/iVL/FrmImportAccts.class
branches/iVL/FrmImportAccts.form
branches/iVL/FrmResetSettings.class
branches/iVL/FrmResetSettings.form
branches/iVL/MdlImportAccts.module
branches/iVL/MdlResetSettings.module
Modified:
branches/iVL/.project
branches/iVL/FrmUserAdd.class
branches/iVL/MdlUsrAdd.module
Log:
began working on importing user accounts into new installation
Modified: branches/iVL/.project
==============================================================================
--- branches/iVL/.project (original)
+++ branches/iVL/.project Mon Dec 1 14:14:54 2008
@@ -1,7 +1,7 @@
# Gambas Project File 2.0
# Compiled with Gambas 2.9.0
Title=VectorLinux Installer
-Startup=MdlCore
+Startup=FrmImportAccts
Version=0.1.11
Library=gb.gtk
Library=gb.form
Added: branches/iVL/FrmImportAccts.class
==============================================================================
--- (empty file)
+++ branches/iVL/FrmImportAccts.class Mon Dec 1 14:14:54 2008
@@ -0,0 +1,100 @@
+' Gambas class file
+
+' This file is part of vinstall-ng
+
+' vinstall-ng is free software: you can redistribute it and/or modify
+' it under the terms of the GNU General Public License as published by
+' the Free Software Foundation, either version 2 of the License, or
+' (at your option) any later version.
+
+' vinstall-ng is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+
+' You should have received a copy of the GNU General Public License
+' along with vinstall-ng. If not, see <http://www.gnu.org/licenses/>.
+
+PUBLIC SUB Form_Open()
+
+ WITH ME
+ .tlBanner.Text = "<b>" & .tlBanner.Text & "</b>"
+ END WITH
+ MdlImportAccts.LIST_EXISTING_ACCOUNTS()
+ MdlUsrAdd.DISPLAY_USER_GROUP_OPTIONS(ME.frmUsrGrps)
+END
+
+PUBLIC SUB btBrowsePic_Click()
+
+
+
+ dialog.Title = ("Select picture for user Login")
+ Dialog.path = ClsGlobal.sTargetMnt &/ "usr" &/ "share" &/ "apps"
&/ "kdm" &/ "pics" &/ "users"
+ Dialog.Filter = ["*.png", "Picture Files", "*.jpg", "JPEG Graphics"]
+ IF Dialog.OpenFile() THEN RETURN
+ tbPicPath.text = Replace(Dialog.path, ClsGlobal.sSourceMnt, "")
+ ME.pbLogin = NEW PictureBox(ME)
+ ME.pbLogin.Move(ME.tbPass2.left + ME.tbPass2.Width + 4,
ME.tlPasswd2.top, 64, 64)
+ ME.pbLogin.Picture = Picture[dialog.path]
+ ME.pbLogin.Stretch = TRUE
+
+
+
+END
+
+
+
+PUBLIC SUB btResetSettings_Click()
+
+
+ FrmResetSettings.Title = ("Reset settings for") & Space(1) &
Trim(ME.cbAccntList.Text)
+ FrmResetSettings.ShowDialog()
+
+END
+
+PUBLIC SUB btcancel_Click()
+
+ ME.Close()
+
+END
+
+PUBLIC SUB btImportAccnt_Click()
+
+ IF ME.tbPass1.Text = "" OR ME.tbPass2.Text = "" THEN
+ Message.Error(("Password fields cannot be blank. Please enter a
password for") & Space(1) & ME.cbAccntList.Text)
+ RETURN
+ END IF
+ IF ME.tbPass1.Text <> ME.tbPass2.Text THEN
+ Message.Error(("Selected passwords dont match. Please enter the same
password twice"))
+ RETURN
+ ELSE
+ ME.pbLogin.Delete
+ 'pbLogin = NEW PictureBox(ME)
+ 'me.pbLogin.Move(
+ MdlUsrAdd.DISPLAY_USER_GROUP_OPTIONS(ME.frmUsrGrps)
+ 'ME.Close
+ 'ME.pbLogin.Picture.Image.Clear
+END IF
+
+
+END
+
+PUBLIC SUB Form_Resize()
+
+ WITH ME
+ .tlBanner.Move(4, 4)
+ .hrsep.Move(4, .tlBanner.top + .tlBanner.Height + 1, .ClientWidth -
(.hrsep.Left * 2))
+ .tlLogin.Move(4, .hrsep.top + 8,
MdlObjSizer.get_object_width(.tlLogin.Text))
+ .cbAccntList.Move(.tlLogin.Left + .tlLogin.Width +
8, .tlLogin.Top, .tlLogin.Width * 2.5)
+ .tlPasswd.Move(4, .tlLogin.top + .tlLogin.Height + 8,
MdlObjSizer.get_object_width(.tlPasswd.Text))
+ .tbPass1.Move(4, .tlPasswd.top + .tlPasswd.Height + 4, 175)
+ .tlPasswd2.Move(.tbPass1.Left + .tbPass1.Width + 8, .tlPasswd.Top,
MdlObjSizer.get_object_width(.tlPasswd2.Text))
+ .tbPass2.Move(.tlPasswd2.Left, .tbPass1.top, 175)
+ .tlPicPath.Move(4, .tbPass1.top + .tbPass1.Height + 8,
MdlObjSizer.get_object_width(.tlPicPath.Text))
+ .btBrowsePic.Move(.ClientWidth - .btBrowsePic.Width - 8, .tlPicPath.top
+ .tlPicPath.Height + 8, MdlObjSizer.get_object_width(.btBrowsePic.Text) +
36)
+ .tbPicPath.Move(4, .btBrowsePic.top, (.ClientWidth - .btBrowsePic.Width)
- (.tbPicPath.Left * 2) - 8)
+ .pbLogin.Move(.tbPass2.Left + .tbPass2.Width + 8, .tlPasswd2.top + 4,
48, 48)
+ '.btBrowsePic.Move(.ClientWidth - .btBrowsePic.Width - 8,.tbPass2.top
+ .tbPass1
+ END WITH
+
+END
Added: branches/iVL/FrmImportAccts.form
==============================================================================
--- (empty file)
+++ branches/iVL/FrmImportAccts.form Mon Dec 1 14:14:54 2008
@@ -0,0 +1,84 @@
+# Gambas Form File 2.0
+
+{ Form Form
+ MoveScaled(0,0,70,59)
+ Text = ("")
+ { tlLogin TextLabel
+ MoveScaled(1,8,9,3)
+ Text = ("Account")
+ Alignment = Align.Normal
+ }
+ { cbAccntList ComboBox
+ MoveScaled(11,8,17,3)
+ Text = ("")
+ ReadOnly = True
+ }
+ { tlPasswd TextLabel
+ MoveScaled(1,12,25,3)
+ Text = ("New Password")
+ }
+ { tbPass1 TextBox
+ MoveScaled(1,15,25,3)
+ Text = ("")
+ Password = True
+ }
+ { tbPass2 TextBox
+ MoveScaled(28,15,25,3)
+ Text = ("")
+ Password = True
+ }
+ { tlPicPath TextLabel
+ MoveScaled(1,19,35,3)
+ Text = ("Select login Image")
+ }
+ { tbPicPath TextBox
+ MoveScaled(1,22,53,3)
+ Text = ("")
+ }
+ { btBrowsePic Button
+ MoveScaled(55,22,11,3)
+ Text = ("Select")
+ Picture = Picture["icon:/small/open"]
+ }
+ { pbLogin PictureBox
+ MoveScaled(54,12,6,6)
+ }
+ { tlPasswd2 TextLabel
+ MoveScaled(28,12,25,3)
+ Text = ("Verify Password")
+ }
+ { ScrollView1 ScrollView
+ MoveScaled(1,26,66,18)
+ Expand = True
+ Border = False
+ { frmUsrGrps Frame
+ MoveScaled(0,0,65,15)
+ Text = ("User Rights Management")
+ }
+ }
+ { btResetSettings Button
+ MoveScaled(1,45,23,3)
+ Text = ("Reset settings")
+ Picture = Picture["icon:/small/undo"]
+ }
+ { btImportAccnt Button
+ MoveScaled(1,49,23,3)
+ Text = ("Import Account")
+ Picture = Picture["icon:/small/redo"]
+ }
+ { btcancel Button
+ MoveScaled(26,49,14,3)
+ Text = ("Cancel")
+ Picture = Picture["icon:/16/cancel"]
+ }
+ { tlBanner TextLabel
+ MoveScaled(0,0,43,3)
+ Expand = True
+ Text = ("Import Existing User Accounts")
+ Alignment = Align.Normal
+ }
+ { hrsep Separator
+ MoveScaled(1,4,16,1)
+ Expand = True
+ }
+}
Added: branches/iVL/FrmResetSettings.class
==============================================================================
--- (empty file)
+++ branches/iVL/FrmResetSettings.class Mon Dec 1 14:14:54 2008
@@ -0,0 +1,74 @@
+' Gambas class file
+' This file is part of vinstall-ng
+
+' vinstall-ng is free software: you can redistribute it and/or modify
+' it under the terms of the GNU General Public License as published by
+' the Free Software Foundation, either version 2 of the License, or
+' (at your option) any later version.
+
+' vinstall-ng is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+
+' You should have received a copy of the GNU General Public License
+' along with vinstall-ng. If not, see <http://www.gnu.org/licenses/>.
+PRIVATE pYes AS Picture = FrmPkgSel.pyes
+
+PUBLIC SUB Form_Open()
+
+ 'pyes = FrmPkgSel.pYes
+ ME.tlBanner.Text = "<b>" & tlbanner.text & "</b>"
+ ME.size_grid()
+ MdlResetSettings.LIST_RESETABLE_SETTINGS()
+
+END
+PUBLIC SUB size_grid()
+
+ WITH ME.gvSettings
+ .Columns.count = 3
+ .Columns[0].Width = 32
+ .Columns[1].Width = 400
+ .Columns[2].Width = 1
+ .Rows.Count = 1
+
+ END WITH
+
+END
+
+PUBLIC SUB gvSettings_Click()
+
+ IF LAST.column > 0 THEN RETURN
+
+ IF gvSettings[LAST.row, 0].Picture = pyes THEN
+ 'gvSettings[LAST.row, 0].Picture = FrmPkgSel.pNo
+ 'gvSettings[LAST.row, 0].Picture = FrmPkgSel.pno
+ gvSettings[LAST.row, 0].Clear()
+
+ ELSE
+ gvSettings[LAST.ROW, 0].Picture = pYes
+ END IF
+ gvSettings.Refresh()
+
+
+
+END
+
+PUBLIC SUB btDone_Click()
+
+ ME.Close
+
+END
+
+PUBLIC SUB Form_Resize()
+
+ WITH ME
+ .tlBanner.Move(4, 4)
+ .gvSettings.Move(4, .tlBanner.top + .tlBanner.Height + 4, .ClientWidth
- (.gvSettings.Left * 2), .ClientH - (.gvSettings.Top * 2))
+ .btDone.Move(4, .gvSettings.Top + .gvSettings.Height + 8,
MdlObjSizer.get_object_width(.btDone.Text) + 36, 21)
+ '.gvSettings.Columns[1].Width = .gvSettings.Width -
(.gvSettings.Columns[0].Width * 1.25)
+ END WITH
+
+
+
+END
Added: branches/iVL/FrmResetSettings.form
==============================================================================
--- (empty file)
+++ branches/iVL/FrmResetSettings.form Mon Dec 1 14:14:54 2008
@@ -0,0 +1,18 @@
+# Gambas Form File 2.0
+
+{ Form Form
+ MoveScaled(0,0,69,35)
+ Text = ("")
+ { tlBanner TextLabel
+ MoveScaled(1,1,40,3)
+ Text = ("Select which settings to reset")
+ }
+ { gvSettings GridView
+ MoveScaled(1,6,63,21)
+ }
+ { btDone Button
+ MoveScaled(2,28,10,3)
+ Text = ("Done")
+ Picture = Picture["icon:/small/apply"]
+ }
+}
Modified: branches/iVL/FrmUserAdd.class
==============================================================================
--- branches/iVL/FrmUserAdd.class (original)
+++ branches/iVL/FrmUserAdd.class Mon Dec 1 14:14:54 2008
@@ -45,10 +45,10 @@
Fmain.frmcurr = ME
MdlUsrAdd.iUsrAccts = 0
WITH FMain
- .FrmCurr = ME
- .tvPlan["Conf2"].Picture = MdlCore.sDonePic
- .tvPlan["Conf3"].picture = MdlCore.sNowPic
- .tvPlan["Conf3"].Selected = TRUE
+ ' .FrmCurr = ME
+ ' .tvPlan["Conf2"].Picture = MdlCore.sDonePic
+ ' .tvPlan["Conf3"].picture = MdlCore.sNowPic
+ ' .tvPlan["Conf3"].Selected = TRUE
END WITH
WITH ME
.tlBanner.Text = "<h3>" & ("Create User Accounts") & "</h3>"
@@ -73,7 +73,7 @@
END WITH
- MdlUsrAdd.DISPLAY_USER_GROUP_OPTIONS()
+ MdlUsrAdd.DISPLAY_USER_GROUP_OPTIONS(ME.fGroupSel)
FMain.btnext.Enabled = TRUE
ME.tbUsername.SetFocus
END
@@ -294,7 +294,7 @@
.fGroupSel.Move(4, .tbPicPath.top + .tbPicPath.Height + 4, .ClientW -
(.fGroupSel.Left * 2), .ClientH - (.fGroupSel.top + (.Button1.Height)))
.Button1.Move(4, .fGroupSel.top + .fGroupSel.Height + 8,
MdlObjSizer.get_object_width(.Button1.Text) + 36)
.btClrFrm.Move(.Button1.Left + .Button1.Width + 4, .Button1.top,
MdlObjSizer.get_object_width(.btClrFrm.text) + 36)
- .btImportAcct.Move(.btClrFrm.Left + .btClrFrm.W + 4, .btClrFrm.top,
MdlObjSizer.get_object_width(.btImportAcct) + 36)
+ .btImportAcct.Move(.btClrFrm.Left + .btClrFrm.W + 4, .btClrFrm.top,
MdlObjSizer.get_object_width(.btImportAcct.Text) + 38)
'.pbUsrPic.Move(.tbUsername.Left + (.tbUsername.Width +
2), .tbUsername.top)
'.pbUsrPic.Move(.btBrowse.Left + .btBrowse.Width, tbUsername.top)
.btgrpHelp.Move(.fGroupSel.Width - (.btgrpHelp.Width + 4), 12)
Added: branches/iVL/MdlImportAccts.module
==============================================================================
--- (empty file)
+++ branches/iVL/MdlImportAccts.module Mon Dec 1 14:14:54 2008
@@ -0,0 +1,29 @@
+' Gambas module file
+
+' This file is part of vinstall-ng
+
+' vinstall-ng is free software: you can redistribute it and/or modify
+' it under the terms of the GNU General Public License as published by
+' the Free Software Foundation, either version 2 of the License, or
+' (at your option) any later version.
+
+' vinstall-ng is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+
+' You should have received a copy of the GNU General Public License
+' along with vinstall-ng. If not, see <http://www.gnu.org/licenses/>.
+
+PUBLIC SUB LIST_EXISTING_ACCOUNTS()
+
+ DIM sDir AS String
+ FOR EACH sdir IN Dir("/home", "*", gb.Directory)
+ IF sdir <> "ftp" THEN
+ IF FrmImportAccts.cbAccntList.Find(sdir) = -1 THEN
+ FrmImportAccts.cbAccntList.Add(sdir)
+ END IF
+ END IF
+ NEXT
+
+END
Added: branches/iVL/MdlResetSettings.module
==============================================================================
--- (empty file)
+++ branches/iVL/MdlResetSettings.module Mon Dec 1 14:14:54 2008
@@ -0,0 +1,67 @@
+' Gambas module file
+
+' This file is part of vinstall-ng
+
+' vinstall-ng is free software: you can redistribute it and/or modify
+' it under the terms of the GNU General Public License as published by
+' the Free Software Foundation, either version 2 of the License, or
+' (at your option) any later version.
+
+' vinstall-ng is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+
+' You should have received a copy of the GNU General Public License
+' along with vinstall-ng. If not, see <http://www.gnu.org/licenses/>.
+
+PUBLIC pYes AS Picture
+PUBLIC SUB LIST_RESETABLE_SETTINGS()
+ DIM sFile, sDesc AS String
+ DIM i AS Integer
+ i = 0
+ pYes = FrmPkgSel.pYes
+
+ FOR EACH sfile IN Dir(User.home, "*")
+ SELECT CASE sFile
+
+ CASE ".kde"
+ sDesc = "KDE Settings (Menu, Window decorations, etc)"
+ CASE ".qt"
+ sDesc = "QT Toolkit settings (KDE Visual Effects)"
+ CASE ".gtkrc-*"
+ sDesc = "GTK Tookit theme Settings"
+ CASE ".Xdefaults"
+ sDesc = "X-window basic settings (includes xterm settings)"
+ CASE ".bashrc"
+ sDesc = "Bash init script"
+ CASE ".asoundrc"
+ sDesc = "Sound system preferences"
+ CASE ".xinitrc"
+ sDesc = "Graphical inteface preferences"
+ CASE "Desktop"
+ sDesc = "Desktop icons, folders, launchers"
+ CASE ".IceWM"
+ sDesc = "IceWM settings, preferences, menu"
+ CASE ".xmms"
+ sDesc = "XMMS Audio player preferences"
+ CASE ".Choices", "Choices"
+ sDesc = "ROX Filer Desktop settings"
+ CASE ".mplayer"
+ sDesc = "MPlayer Multimedia Player Settings"
+ CASE ELSE
+ sDesc = ""
+
+ END SELECT
+ IF sDesc THEN
+ 'INC i
+ INC FrmResetSettings.gvSettings.Rows.Count
+ FrmResetSettings.gvSettings[i, 1].Text = sDesc
+ FrmResetSettings.gvSettings[i, 2].Text = sFile
+ INC i
+ END IF
+ NEXT
+ FrmResetSettings.gvSettings.Columns[1].Width =
FrmResetSettings.gvSettings.Width -
(FrmResetSettings.gvSettings.Columns[0].Width * 1.75)
+ FrmResetSettings.gvSettings.Columns[2].Width = 0
+ DEC FrmResetSettings.gvSettings.Rows.Count
+END
Modified: branches/iVL/MdlUsrAdd.module
==============================================================================
--- branches/iVL/MdlUsrAdd.module (original)
+++ branches/iVL/MdlUsrAdd.module Mon Dec 1 14:14:54 2008
@@ -19,7 +19,7 @@
PUBLIC objGrps AS Object[]
-PUBLIC SUB DISPLAY_USER_GROUP_OPTIONS()
+PUBLIC FUNCTION DISPLAY_USER_GROUP_OPTIONS(frmParent AS Frame)
DIM sGrpList AS String
= "cdrom,floppy,lp,scanner,audio,video,games,adm,sys,wheel,plugdev,disk"
DIM sGrpArr AS String[]
DIM i AS Integer
@@ -84,7 +84,8 @@
' ' ' htotal = x
' ' ' END IF
'y = 12
-cb = NEW CheckBox(FrmUserAdd.fGroupSel)
+'cb = NEW CheckBox(FrmUserAdd.fGroupSel)
+cb = NEW CheckBox(frmParent)
WITH cb
.text = sLabel
.Value = bdefval
@@ -104,7 +105,7 @@
' now move the objects to their places
x = 4
htotal = 4
- y = 16
+ y = 24
FOR EACH cb IN objGrps
cb.Move(x, y)
x = x + 116
@@ -120,6 +121,109 @@
END
+
+
+' PUBLIC SUB DISPLAY_USER_GROUP_OPTIONS()
+' DIM sGrpList AS String
= "cdrom,floppy,lp,scanner,audio,video,games,adm,sys,wheel,plugdev,disk"
+' DIM sGrpArr AS String[]
+' DIM i AS Integer
+' DIM sLabel, sComment, sToolTip AS String
+' DIM cb AS CheckBox
+' DIM x, y, htotal AS Integer
+' DIM bdefval AS Boolean
+'
+' objGrps = NEW Object[]
+' sGrpArr = Split(sGrpList, ",")
+'
+'
+'
+'
+'
+' y = 24
+' x = 4
+' FOR i = 0 TO sGrpArr.Count - 1
+' sLabel = Trim(sGrpArr[i])
+' SELECT CASE sLabel
+' CASE "cdrom"
+' sComment = ("This user can access CD/DVD devices")
+' bdefval = TRUE
+' CASE "floppy"
+' sComment = ("This user can access floppy disks")
+' bdefval = TRUE
+' CASE "lp"
+' sComment = ("This user is allowed to print")
+' bdefval = TRUE
+' CASE "scanner"
+' sComment = ("This user can access scanner devices")
+' bdefval = TRUE
+' CASE "audio"
+' sComment = ("This user is allowed to change audio settings")
+' bdefval = TRUE
+' CASE "video"
+' sComment = ("This user is allowed to change video settings")
+' bdefval = TRUE
+' CASE "games"
+' sComment = ("This user is allowed to play restricted games")
+' bdefval = TRUE
+' CASE "adm"
+' sComment = ("Restricted administrator (backup)")
+' bdefval = FALSE
+' CASE "sys"
+' sComment = ("This user is a system administrator")
+' bdefval = FALSE
+' CASE "wheel"
+' sComment = ("Elite user")
+' bdefval = FALSE
+' CASE "plugdev"
+' sComment = ("Allow user to mount / un-mount Pendrive (USB Sticks)")
+' bdefval = TRUE
+' CASE "disk"
+' sComment = ("Allow user to mount / un-mount Removable HD Storage
Devices")
+' bdefval = TRUE
+' END SELECT
+' 'x = 4
+' ' ' ' IF htotal > FrmUserAdd.fGroupSel.Width * 0.75 THEN
+' ' ' ' x = 4
+' ' ' ' y = y + 25
+' ' ' ' htotal = x
+' ' ' ' END IF
+' 'y = 12
+' cb = NEW CheckBox(FrmUserAdd.fGroupSel)
+' WITH cb
+' .text = sLabel
+' .Value = bdefval
+' .Height = 21
+' .Width = MdlObjSizer.get_object_width(.text) + 24
+' '.Move(x, y)
+' .ToolTip = sComment
+' 'y = y + cb.Height
+' x = x + 128
+' htotal = htotal + x
+' END WITH
+' objGrps.Add(cb)
+' 'y = y + cb.Height + 4
+' NEXT
+'
+'
+' ' now move the objects to their places
+' x = 4
+' htotal = 4
+' y = 16
+' FOR EACH cb IN objGrps
+' cb.Move(x, y)
+' x = x + 116
+' htotal = x
+' IF htotal >= FrmUserAdd.fGroupSel.Width * 0.70 THEN
+' htotal = 4
+' x = 4
+' y = y + cb.Height + 4
+' END IF
+' NEXT
+'
+'
+'
+'
+' END
PUBLIC FUNCTION CREATE_USER_ON_A_SNAP() AS Boolean
DIM bcont AS Boolean
|