Author: gs
Date: Tue Jul 29 11:30:51 2008
New Revision: 49478
URL: http://svn.opensuse.org/viewcvs/yast?rev=49478&view=rev
Log:
create initial dialogs for auditd.conf settings
Modified:
trunk/auditd/src/Auditd.ycp
trunk/auditd/src/auditd.ycp
trunk/auditd/src/complex.ycp
trunk/auditd/src/dialogs.ycp
trunk/auditd/src/helps.ycp
trunk/auditd/src/wizards.ycp
Modified: trunk/auditd/src/Auditd.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/auditd/src/Auditd.ycp?rev=49478&r1=49477&r2=49478&view=diff
==============================================================================
--- trunk/auditd/src/Auditd.ycp (original)
+++ trunk/auditd/src/Auditd.ycp Tue Jul 29 11:30:51 2008
@@ -39,6 +39,8 @@
import "Report";
import "Summary";
import "Message";
+import "Popup";
+import "Mode";
/**
* Prototypes
@@ -61,29 +63,11 @@
boolean write_only = false;
/**
- * Abort function
- * return boolean return true if abort
- */
-boolean() AbortFunction = Modified;
-
-/**
- * Abort function
- * @return boolean return true if abort
- */
-global define boolean Abort() ``{
- if(AbortFunction != nil)
- {
- return AbortFunction () == true;
- }
- return false;
-}
-
-/**
* Data was modified?
* @return true if modified
*/
global boolean Modified() {
- y2debug("modified=%1",modified);
+ y2milestone("modified=%1",modified);
return modified;
}
@@ -116,11 +100,29 @@
write_only = value;
}
-
-global void SetAbortFunction(boolean() function) {
- AbortFunction = function;
+/**
+ Returns a confirmation popup dialog whether user wants to really abort.
+ */
+global boolean Abort() {
+ return Popup::ReallyAbort(Modified());
}
+/**
+ * Checks whether an Abort button has been pressed.
+ * If so, calls function to confirm the abort call.
+ *
+ * @return boolean true if abort confirmed
+ */
+global boolean PollAbort() {
+ // Do not check UI when running in CommandLine mode
+ if (Mode::commandline())
+ return false;
+
+ if (UI::PollInput() == `abort)
+ return Abort();
+
+ return false;
+}
// Settings: Define all variables needed for configuration of auditd
// TODO FIXME: Define all the variables necessary to hold
@@ -147,7 +149,7 @@
string caption = _("Initializing auditd Configuration");
// Set the right number of stages
- integer steps = 3;
+ integer steps = 2;
integer sl = 500;
sleep(sl);
@@ -165,39 +167,33 @@
_("Reading the configuration..."),
/* Progress step 2/3 */
_("Reading the rules file..."),
- /* Progress step 3/3 */
- _("Finished")
+ Message::Finished()
],
""
);
// read database
- if(Abort()) return false;
+ if(PollAbort()) return false;
Progress::NextStage();
/* Error message */
if(false) Report::Error(_("Cannot read database1."));
sleep(sl);
// read another database
- if(Abort()) return false;
+ if(PollAbort()) return false;
Progress::NextStep();
/* Error message */
if(false) Report::Error(_("Cannot read database2."));
sleep(sl);
// read current settings
- if(Abort()) return false;
+ if(PollAbort()) return false;
Progress::NextStage();
/* Error message */
if(false) Report::Error(Message::CannotReadCurrentSettings());
sleep(sl);
- if(Abort()) return false;
- /* Progress finished */
- Progress::NextStage();
- sleep(sl);
-
- if(Abort()) return false;
+ if(PollAbort()) return false;
modified = false;
return true;
}
@@ -229,32 +225,30 @@
_("Writing the settings..."),
/* Progress step 2/2 */
_("Running SuSEconfig..."),
- /* Progress finished */
- _("Finished")
+ Message::Finished()
],
""
);
// write settings
- if(Abort()) return false;
+ if(PollAbort())
+ {
+ y2error( "ABORT" );
+ return false;
+ }
Progress::NextStage();
/* Error message */
if(false) Report::Error (_("Cannot write settings."));
sleep(sl);
// run SuSEconfig
- if(Abort()) return false;
+ if(PollAbort()) return false;
Progress::NextStage ();
/* Error message */
if(false) Report::Error (Message::SuSEConfigFailed());
sleep(sl);
- if(Abort()) return false;
- /* Progress finished */
- Progress::NextStage();
- sleep(sl);
-
- if(Abort()) return false;
+ if(PollAbort()) return false;
return true;
}
Modified: trunk/auditd/src/auditd.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/auditd/src/auditd.ycp?rev=49478&r1=49477&r2=49478&view=diff
==============================================================================
--- trunk/auditd/src/auditd.ycp (original)
+++ trunk/auditd/src/auditd.ycp Tue Jul 29 11:30:51 2008
@@ -46,6 +46,7 @@
import "Summary";
import "CommandLine";
+
include "auditd/wizards.ycp";
map cmdline_description = $[
Modified: trunk/auditd/src/complex.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/auditd/src/complex.ycp?rev=49478&r1=49477&r2=49478&view=diff
==============================================================================
--- trunk/auditd/src/complex.ycp (original)
+++ trunk/auditd/src/complex.ycp Tue Jul 29 11:30:51 2008
@@ -24,7 +24,6 @@
* Summary: Dialogs definitions
* Authors: Gabriele Mohr
*
- * $Id: complex.ycp 41350 2007-10-10 16:59:00Z dfiser $
*/
{
@@ -80,27 +79,145 @@
return ret ? `next : `abort;
}
+void InitLogfileSettingsDialog (string id) {
+
+ //UI::ChangeWidget( `id("MaxAuthTries"), `ValidChars, "0123456789");
+ //list <string> MaxAuthTries = Sshd::GetSSHDOption("MaxAuthTries");
+ //UI::ChangeWidget(`id("MaxAuthTries"), `Value, MaxAuthTries[0]:"0");
+
+ //foreach (string key, ["PrintMotd", "PermitRootLogin",
+ //"PasswordAuthentication", "RSAAuthentication", "PubkeyAuthentication"], {
+ //UI::ChangeWidget(`id(key), `Value, (Sshd::GetSSHDOption(key) == ["yes"]));
+ //});
+ y2milestone( "Init logfile settings");
+}
+
+boolean ReallyExit () {
+ // yes-no popup
+ return Popup::YesNo (_("Really exit?
+All changes will be lost."));
+}
+
+void StoreLogfileSettingsDialog (string id, map event) {
+
+ Auditd::SetModified( true );
+
+ // Stores all boolean values and turns them to the "yes"/"no" notation
+ //foreach (string key, ["AllowTcpForwarding", "X11Forwarding", "Compression"], {
+ //Sshd::SetSSHDOption(
+ //key,
+ //[ (((boolean) UI::QueryWidget(`id(key), `Value) == true) ? "yes":"no") ]
+ //);
+ //});
+ y2milestone( "Store logfile settings");
+
+}
+void InitDispatcherDialog (string id) {
+ y2milestone( "Init dispatcher" );
+}
+
+void StoreDispatcherDialog (string id, map event) {
+ y2milestone( "Store dispatcher" );
+}
+
+void InitDiskspaceSettingsDialog (string id) {
+ y2milestone( "Init dispatcher" );
+}
+
+void StoreDiskspaceSettingsDialog (string id, map event) {
+ y2milestone( "Store dispatcher" );
+}
+
+
+
+
+any RulesDialog() {
+
+ /* Boot dialog caption */
+ string caption = _("Auditd Rules Configuration");
+ string help = HELPS["boot"]:"";
+
+ /* Boot dialog contents */
+ term contents = `HVCenter(`HVSquash
+ (`HBox(
+ `HSpacing(5),
+ `VBox(
+ `VSpacing(2),
+ /* Frame label */
+ `MultiLineEdit( `id(`rules), _("File: audit.rules") ),
+ `VSpacing(2)
+ ),
+ `HSpacing(5)
+ )));
+
+ Wizard::SetContentsButtons(caption, contents, help,
+ Label::BackButton(), Label::FinishButton());
+
+ any ret = nil;
+ while(true) {
+ ret = UI::UserInput();
+
+ /* abort? */
+ if(ret == `abort || ret == `cancel) {
+ if(ReallyAbort()) break;
+ else continue;
+ }
+ else if(ret == `back || ret == `next) {
+ break;
+ }
+ else {
+ y2error("Unexpected return code: %1", ret);
+ continue;
+ }
+ }
+
+ return ret;
+}
+
+term DispatcherOptions() {
+
+ term contents = `VBox(
+ `InputField( "Dispatcher "),
+ `InputField( "disp_qos ")
+ );
+ return contents;
+}
+
/**
- * Summary dialog
+ * Config dialog
* @return dialog result
*/
-any SummaryDialog() {
+any ConfigDialog() {
/* Auditd summary dialog caption */
string caption = _("Auditd Configuration");
- /* FIXME */
- list summary = Auditd::Summary();
- list unconfigured = summary[1]:[];
- string configured = summary[0]:"";
-
- /* Frame label */
- term contents = Wizard_hw::DetectedContent(_("Auditd to Configure"),
- unconfigured, false, configured);
+ term contents = `VBox(
+ `DumbTab( [
+ `item(`id(`start ), "Start Options" ),
+ `item(`id(`misc ), "Misc" ),
+ `item(`id(`dispatcher ), "Dispatcher", true ) // true: selected
+ ],
+ `Left(
+ `Top(
+ `HVSquash(
+ `VBox(
+ `VSpacing(0.3),
+ `HBox(
+ `HSpacing(1),
+ `ReplacePoint(`id(`tabContents ), DispatcherOptions() )
+ )
+ )
+ )
+ )
+ )
+ ),
+ `VSpacing(1.0)
+ );
Wizard::SetContentsButtons(caption, contents, HELPS["summary"]:"",
- Label::BackButton(), Label::FinishButton());
-
+ Label::BackButton(), Label::NextButton());
+
any ret = nil;
while(true) {
@@ -140,66 +257,6 @@
return ret;
}
-/**
- * Overview dialog
- * @return dialog result
- */
-any OverviewDialog() {
-
- /* Auditd overview dialog caption */
- string caption = _("Auditd Overview");
-
- list overview = Auditd::Overview();
-
- /* FIXME table header */
- term contents = Wizard_hw::ConfiguredContent(
- /* Table header */
- `header(_("Number"), _("Auditd")),
- overview, nil, nil, nil, nil );
-
- contents = Wizard_hw::SpacingAround(contents, 1.5, 1.5, 1.0, 1.0);
-
- Wizard::SetContentsButtons(caption, contents, HELPS["overview"]:"",
- Label::BackButton(), Label::FinishButton());
-
- any ret = nil;
- while(true) {
-
- ret = UI::UserInput();
-
- /* abort? */
- if(ret == `abort || ret == `cancel) {
- if(ReallyAbort()) break;
- else continue;
- }
- /* add */
- else if(ret == `add_button) {
- /* FIXME */
- ret = `add;
- break;
- }
- /* edit */
- else if(ret == `edit_button) {
- /* FIXME */
- ret = `edit;
- break;
- }
- /* delete */
- else if(ret == `delete_button) {
- /* FIXME */
- continue;
- }
- else if(ret == `next || ret == `back) {
- break;
- }
- else {
- y2error("unexpected retcode: %1", ret);
- continue;
- }
- }
-
- return ret;
-}
/* EOF */
}
Modified: trunk/auditd/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/auditd/src/dialogs.ycp?rev=49478&r1=49477&r2=49478&view=diff
==============================================================================
--- trunk/auditd/src/dialogs.ycp (original)
+++ trunk/auditd/src/dialogs.ycp Tue Jul 29 11:30:51 2008
@@ -37,79 +37,84 @@
include "auditd/helps.ycp";
-/**
- * Configure1 dialog
- * @return dialog result
- */
-any Configure1Dialog () {
-
- /* Auditd configure1 dialog caption */
- string caption = _("Auditd Configuration");
-
- /* Auditd configure1 dialog contents */
- term contents = `Label (_("First part of configuration of auditd"));
-
- Wizard::SetContentsButtons(caption, contents, HELPS["c1"]:"",
- Label::BackButton(), Label::NextButton());
-
- any ret = nil;
- while(true) {
-
- ret = UI::UserInput();
-
- /* abort? */
- if(ret == `abort || ret == `cancel) {
- if(ReallyAbort()) break;
- else continue;
- }
- else if(ret == `next || ret == `back) {
- break;
- }
- else {
- y2error("unexpected retcode: %1", ret);
- continue;
- }
- }
+map current_ui_settings = UI::GetDisplayInfo();
- return ret;
+integer mbox_x = 1;
+integer mbox_y = 0.5;
+
+// Tabs have a different layout in textmode
+if (current_ui_settings["TextMode"]:false == true) {
+ mbox_x = 0;
+ mbox_y = 0;
}
-/**
- * Configure2 dialog
- * @return dialog result
- */
-any Configure2Dialog () {
-
- /* Auditd configure2 dialog caption */
- string caption = _("Auditd Configuration");
-
- /* Auditd configure2 dialog contents */
- term contents = `Label (_("Second part of configuration of auditd"));
-
- Wizard::SetContentsButtons(caption, contents, HELPS["c2"]:"",
- Label::BackButton(), Label::NextButton());
-
- any ret = nil;
- while(true) {
-
- ret = UI::UserInput();
-
- /* abort? */
- if(ret == `abort || ret == `cancel) {
- if(ReallyAbort()) break;
- else continue;
- }
- else if(ret == `next || ret == `back) {
- break;
- }
- else {
- y2error("unexpected retcode: %1", ret);
- continue;
- }
- }
+term LogfileSettingsDialogContent () {
+ return `MarginBox( mbox_x, mbox_y,
+ `VBox(
+ `Frame (
+ _("General Settings"),
+ `VBox (
+ /* A text entry */
+ `Left(`InputField(`id("log_file"), _("Logfile Name"))
+ ),
+ `Left(`ComboBox(`id("log_format"), _("Format"),
+ [
+ `item(`id(`raw), "RAW", true ),
+ `item(`id(`nolog), "NOLOG" )
+ ])
+ )
+ )
+ ),
+ `Frame (
+ _("Size and Action"),
+ `VBox (
+ /* A text entry */
+ `Left(`InputField(`id("max_log_file"), _("Ma&ximum File Size"))),
+ `Left(`InputField(`id("max_log_file_action"), _("Action ")))
+ )
+ ),
+ `VStretch()
+ )
+ );
+}
- return ret;
+term DispatcherDialogContent () {
+ return `MarginBox( mbox_x, mbox_y,
+ `VBox(
+ `VSpacing(1.0),
+ `Frame (
+ _(""),
+ `VBox (
+ /* A text entry */
+ `Left(`InputField(`id("dispatcher"), _("Dispatcher Name"))),
+
+ `Left(`InputField(`id("max_log_file_action"), _("Action ")))
+
+ )
+ ),
+ `VStretch()
+ )
+ );
}
-/* EOF */
+term DiskspaceSettingsDialogContent () {
+ return `MarginBox( mbox_x, mbox_y,
+ `VBox(
+ `VSpacing(1.0),
+ `Frame (
+ _("Size and Action"),
+ `VBox (
+ /* A text entry */
+ `Left(`InputField(`id("space_left"), _("Space left on disk"))),
+
+ `Left(`InputField(`id("space_left_action"), _("Action ")))
+
+ )
+ ),
+ `VStretch()
+ )
+ );
}
+
+} /* EOF */
+
Modified: trunk/auditd/src/helps.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/auditd/src/helps.ycp?rev=49478&r1=49477&r2=49478&view=diff
==============================================================================
--- trunk/auditd/src/helps.ycp (original)
+++ trunk/auditd/src/helps.ycp Tue Jul 29 11:30:51 2008
@@ -50,7 +50,7 @@
"write" : _("<p><b><big>Saving auditd Configuration</big></b><br>
Please wait...<br></p>
") +
-
+
/* Write dialog help 2/2 */
_("<p><b><big>Aborting Saving:</big></b><br>
Abort the save procedure by pressing <b>Abort</b>.
@@ -58,60 +58,19 @@
</p>
"),
- /* Summary dialog help 1/3 */
- "summary" : _("<p><b><big>Auditd Configuration</big></b><br>
-Configure auditd here.<br></p>
-") +
-
- /* Summary dialog help 2/3 */
- _("<p><b><big>Adding a auditd:</big></b><br>
-Choose an auditd from the list of detected auditds.
-If your auditd was not detected, use <b>Other (not detected)</b>.
-Then press <b>Configure</b>.</p>
-") +
-
- /* Summary dialog help 3/3 */
- _("<p><b><big>Editing or Deleting:</big></b><br>
-If you press <b>Edit</b>, an additional dialog in which to change
-the configuration opens.</p>
+ /* logfile_settings dialog help 1/3 */
+ "logfile_settings" : _("<p><b><big>Auditd Logfile Configuration</big></b><br>
+Configure logfile settings (auditd.conf) here.<br></p>
"),
- /* Ovreview dialog help 1/3 */
- "overview" : _("<p><b><big>Auditd Configuration Overview</big></b><br>
-Obtain an overview of installed auditds. Additionally
-edit their configurations.<br></p>
-") +
-
- /* Ovreview dialog help 2/3 */
-_("<p><b><big>Adding a auditd:</big></b><br>
-Press <b>Add</b> to configure a auditd.</p>") +
-
- /* Ovreview dialog help 3/3 */
-_("<p><b><big>Editing or Deleting:</big></b><br>
-Choose a auditd to change or remove.
-Then press <b>Edit</b> or <b>Delete</b> as desired.</p>
+ /* dispatcher dialog help 1/3 */
+ "dispatcher" : _("<p><b><big>Auditd Dispatcher Configuration</big></b><br>
+Configure dispatcher settings here.<br></p>
"),
- /* Configure1 dialog help 1/2 */
- "c1" : _("<p><b><big>Configuration Part One</big></b><br>
-Press <b>Next</b> to continue.
-<br></p>") +
-
- /* Configure1 dialog help 2/2 */
-_("<p><b><big>Selecting Something</big></b><br>
-It is not possible. You must code it first. :-)
-</p>"),
-
- /* Configure2 dialog help 1/2 */
- "c2" : _("<p><b><big>Configuration Part Two</big></b><br>
-Press <b>Next</b> to continue.
-<br></p>
-") +
-
- /* Configure2 dialog help 2/2 */
-_("<p><b><big>Selecting Something</big></b><br>
-It is not possible. You must code it first. :-)
-</p>"),
+ "diskspace_settings" : _("<p><b><big>Auditd Diskspace Configuration</big></b><br>
+Configure diskspace settings on log partition here..<br></p>
+")
];
Modified: trunk/auditd/src/wizards.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/auditd/src/wizards.ycp?rev=49478&r1=49477&r2=49478&view=diff
==============================================================================
--- trunk/auditd/src/wizards.ycp (original)
+++ trunk/auditd/src/wizards.ycp Tue Jul 29 11:30:51 2008
@@ -33,6 +33,8 @@
import "Sequencer";
import "Wizard";
+import "CWM";
+import "CWMTab";
include "auditd/complex.ycp";
include "auditd/dialogs.ycp";
@@ -43,30 +45,75 @@
* @return sequence result
*/
any MainSequence() {
-
- /* FIXME: adapt to your needs */
- map aliases = $[
- "summary" : ``( SummaryDialog() ),
- "overview" : ``( OverviewDialog() )
+ map > widgets = $[
+ "log" : $[
+ "widget" : `custom,
+ "help" : HELPS["logfile_settings"]:"",
+ "custom_widget" : LogfileSettingsDialogContent(),
+ "init" : InitLogfileSettingsDialog,
+ "store" : StoreLogfileSettingsDialog,
+ ],
+ "disp" : $[
+ "widget" : `custom,
+ "help" : HELPS["dispatcher"]:"",
+ "custom_widget" : DispatcherDialogContent(),
+ "init" : InitDispatcherDialog,
+ "store" : StoreDispatcherDialog,
+ ],
+ "disk" : $[
+ "widget" : `custom,
+ "help" : HELPS["diskspace_settings"]:"",
+ "custom_widget" : DiskspaceSettingsDialogContent(),
+ "init" : InitDiskspaceSettingsDialog,
+ "store" : StoreDiskspaceSettingsDialog,
+ ],
];
- /* FIXME: adapt to your needs */
- map sequence = $[
- "ws_start" : "summary",
- "summary" : $[
- `abort : `abort,
- `next : `next,
- `overview : "overview"
+ map tabs = $[
+ "logfile_settings" : $[
+ "header" : _("&Logfile"),
+ "widget_names" : ["log"],
+ "contents" : LogfileSettingsDialogContent(),
+ ],
+ "dispatcher" : $[
+ "header" : _("&Dispatcher"),
+ "widget_names" : ["disp"],
+ "contents" : DispatcherDialogContent(),
+ ],
+ "diskspace_settings" : $[
+ "header" : _("&Diskspace on Log Partion"),
+ "widget_names" : ["disk"],
+ "contents" : DiskspaceSettingsDialogContent(),
],
- "overview" : $[
- `abort : `abort,
- `next : `next
- ]
];
- any ret = Sequencer::Run(aliases, sequence);
+ map wd = $[
+ "tab" : CWMTab::CreateWidget ($[
+ "tab_order" : ["logfile_settings", "dispatcher", "diskspace_settings"],
+ "tabs" : tabs,
+ "widget_descr" : widgets,
+ "initial_tab" : "logfile_settings",
+ ])
+ ];
- return ret;
+ term contents = `VBox("tab");
+
+ list