home *** CD-ROM | disk | FTP | other *** search
- /**
- * File: installation/general/inst_relase_notes.ycp
- * Module: Installation
- * Summary: Display release notes
- * Authors: Arvin Schnell <arvin@suse.de>
- * Jens Daniel Schmidt <jdsn@suse.de>
- *
- * Display release notes.
- *
- * $Id: inst_release_notes.ycp 33271 2006-10-09 11:28:31Z locilka $
- */
-
- {
- textdomain "installation";
-
- import "Wizard";
- import "Popup";
- import "GetInstArgs";
- import "CustomDialogs";
- import "Directory";
- import "Language";
- import "Mode";
-
- map argmap = GetInstArgs::argmap();
-
- list<string> relnotesproducts = [];
- list<string> readproducts = [];
- map<string, string> relnotesmap = $[];
- list<string> default_patterns = ["RELEASE-NOTES.%1.rtf"];
- list<string> patterns = argmap["patterns"]:default_patterns;
- string basedirectory = argmap["directory"]:"/usr/share/doc/release-notes";
- string directory="";
- integer prodnamelen=0;
-
- if (argmap["directory"]:"" != "")
- basedirectory = Directory::custom_workflow_dir + basedirectory;
-
- readproducts = (list<string>) SCR::Read(.target.dir, basedirectory);
-
- foreach ( string product, readproducts ,
- {
- // beautify product string
- string cleanproduct = mergestring(splitstring(product, "_"), " ");
- relnotesproducts = add (relnotesproducts, cleanproduct );
- prodnamelen=prodnamelen + size(cleanproduct);
-
- // read release notes
- string directory = basedirectory + "/" + product;
- map relnotes = CustomDialogs::load_file_locale(patterns, directory, Language::language);
-
- // add release notes to map
- relnotesmap[cleanproduct] = (string) relnotes["text"]:"";
-
- /* filename of release notes */
- //string file = relnotes["file"]:"";
- /* release notes */
- // string text = relnotes["text"]:"";
- });
-
- /* caption for dialog "Release Notes" */
- string caption = _("Release Notes");
-
- term relnoteslayout=nil;
- term relnotesrichtext=`RichText(`id(`relnotescontent),
- relnotesmap[relnotesproducts[0]:""]:"Select product" );
-
- // use DumpTab or ComboBox layout
- if ( UI::HasSpecialWidget(`DumbTab ) && (
- ( size(relnotesproducts)<4 && prodnamelen<90 ) ||
- ( size(relnotesproducts)>3 && prodnamelen<70 ) )
- )
- {
- relnoteslayout= `DumbTab ( relnotesproducts , relnotesrichtext );
- }
- else
- {
- relnoteslayout=`VBox( `Left( `ComboBox(`id(`productsel), `opt(`notify), _("&Product"), relnotesproducts)),
- relnotesrichtext );
- }
-
- term contents = `VBox ( `VSpacing (0.5), relnoteslayout, `VSpacing (0.5));
-
- /* help text for dialog "Release Notes" */
- string help = _("<p>Here are the <b>release notes</b> for the installed
- Linux system. They provide a brief summary of new features and changes.</p>");
-
- // in normal mode no BackAbortNext-button layout
- if (Mode::normal()) Wizard::OpenAcceptDialog();
-
- Wizard::SetContents (caption, contents, help, GetInstArgs::enable_back(),
- GetInstArgs::enable_next());
- Wizard::SetTitleIcon("yast-release-notes");
-
- // FIXME: richtext eats return key, but only in NCurses and we want to
- // make users read release notes (and make PgDn work). For Next, F10 is
- // availbale
- UI::SetFocus (`id (`relnotescontent));
-
- // for debugging
- // UI::DumpWidgetTree();
-
- any ret = nil;
-
- repeat {
-
- ret = Wizard::UserInput();
-
- if (ret == `abort)
- {
- if (Mode::normal()) break;
- if (Popup::ConfirmAbort (`incomplete))
- break;
- }
- else if (ret == `help)
- {
- Wizard::ShowHelp (help);
- }
- else if ( ret == `productsel )
- {
- UI::ChangeWidget(`relnotescontent, `Value, relnotesmap[ (string) UI::QueryWidget(`id(`productsel), `Value) ]:"" );
- UI::SetFocus (`id (`relnotescontent));
- }
- else if ( is( ret, string ) )
- {
- UI::ChangeWidget(`relnotescontent, `Value, relnotesmap[(string) ret]:"");
- UI::SetFocus (`id (`relnotescontent));
- }
-
- } until ( ret == `next || ret == `back );
- if (Mode::normal()) Wizard::CloseDialog();
-
- return ret;
- }
-