Author: mvidner
Date: Wed Aug 6 15:50:01 2008
New Revision: 49776
URL: http://svn.opensuse.org/viewcvs/yast?rev=49776&view=rev
Log:
Added a prototype of FATE#303700:
Admin's Log, producing a summary of what YaST did to the system
Added:
trunk/yast2/library/log/src/ALog.ycp (with props)
Modified:
trunk/yast2/library/log/src/Makefile.am
Added: trunk/yast2/library/log/src/ALog.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/log/src/ALog.ycp?rev=49776&view=auto
==============================================================================
--- trunk/yast2/library/log/src/ALog.ycp (added)
+++ trunk/yast2/library/log/src/ALog.ycp Wed Aug 6 15:50:01 2008
@@ -0,0 +1,83 @@
+/**
+ * File: modules/ALog.ycp
+ * Package: YaST2
+ * Summary: Admin's Log, producing a summary of what YaST did to the system
+ * Authors: Martin Vidner
+ *
+ * $Id$
+ * FATE#303700
+ * TODO stability tag.
+ *
+ * <pre>
+ * ALog::Item("/etc/ntp.conf: added 'server ntp.example.org'");
+ * ALog::Item("enabled /etd/init.d/ntp");
+ * ALog::Item("started /etd/init.d/ntp");
+ *
+ * ALog::CommitPopup();
+ * ALog::Note("set up ntp from local server");
+ * </pre>
+ */
+
+{
+module "ALog";
+textdomain "base";
+
+import "Label";
+
+void doLog(string type, string msg) {
+ // TODO make a separate log, this is just a prototype
+ y2internal("{%1} %2", type, msg);
+}
+
+/**
+ * Log a change to the system from the system point of view.
+ * msg should include the file being changed, and what changes are made
+ * (TODO: with all detail? or summary?)
+ * Example "/etc/ntp.conf: added 'server ntp.example.org'"
+ * @param msg message
+ */
+global void Item(string msg) {
+ doLog ("item", msg);
+}
+
+/**
+ * Log a change to the system from the human point of view.
+ * (It will appear slightly differently in the log)
+ * Example "get proper time from the corporate time server
+ * as requested in ticket bofh#327"
+ * @param msg message
+ */
+global void Note(string msg) {
+ doLog ("note", msg);
+}
+
+string uiInput(string label) {
+ // TODO more lines?
+ term d = `VBox(
+ `InputField (`id (`val), label, ""),
+ `PushButton (`id (`ok), `opt (`default, `key_F10), Label::OKButton ())
+ );
+ UI::OpenDialog (d);
+ any ui = nil;
+ do {
+ ui = UI::UserInput ();
+ } while (ui != `ok || ui != `cancel);
+
+ string val = nil;
+ if (ui == `ok) {
+ val = (string) UI::QueryWidget (`id (`val), `Value);
+ }
+ return val;
+}
+
+/**
+ * Prompt the user for a message to describe the changes
+ * that she did using YaST, logs it using @ref Note
+ */
+global void CommitPopup() {
+ string i = uiInput(_("Enter a log message to describe the changes that you did"));
+ string msg = (i == nil)? "*empty log message*": i;
+ Note(msg);
+}
+
+}
Modified: trunk/yast2/library/log/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/log/src/Makefile.am?rev=49776&r1=49775&r2=49776&view=diff
==============================================================================
--- trunk/yast2/library/log/src/Makefile.am (original)
+++ trunk/yast2/library/log/src/Makefile.am Wed Aug 6 15:50:01 2008
@@ -1,6 +1,7 @@
# Makefile.am for yast2/library/log/src
module_DATA = \
+ ALog.ycp \
LogView.ycp \
LogViewCore.ycp
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org