home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 8 / CDACTUAL8.iso / progs / ite / ite10d1.exe / DATA.Z / KBUPDATE.JFM < prev    next >
Encoding:
Text File  |  1996-09-07  |  15.3 KB  |  573 lines

  1. /****************************************************************************\
  2. *                                                                            *
  3. * KBUpdate.jfm  --  Knowledge Base Update Form                               *
  4. *                                                                            *
  5. * KBUpdate.jfm is part of the Knowledge Base solution application. It is     *
  6. * used to update the documents in the Knowledge Base. You can edit, add,     *
  7. * delete, query and filter the documents.                                    *
  8. *                                                                            *
  9. * Dependencies:  knowbs31.gif                                                *
  10. *                homepg31.gif                                                *
  11. *                paper_22.gif                                                *
  12. *                expinavh.gif                                                *
  13. *                expirowh.gif                                                *
  14. *                apps\shared\controls.cc                                     *
  15. *                                                                            *
  16. * Links to:      ibapps/index.htm                                            *
  17. *                svr/intrasrv.isv?apps/knowbase/kbsearch.jfm                 *
  18. *                                                                            *
  19. * Updated 8/29/96 by IntraBuilder Samples Group                              *
  20. * $Revision:   1.22  $                                                       *
  21. *                                                                            *
  22. * Copyright (c) 1996, Borland International, Inc. All rights reserved.       *
  23. *                                                                            *
  24. \****************************************************************************/
  25. #include "intra.h"
  26. #include "security.h"
  27. //
  28. // The code loads the security login form instead of the update form.
  29. // An object reference to the update form is stored as a property of
  30. // the login form. If the login is successful, the login form opens
  31. // this update form.
  32. // 
  33. // First create the update form, but don't open it.
  34. var f = new kbupdateForm();
  35. // then create a security object
  36. _sys.scripts.load(SM_CLASS_LOCATION + "security.js");
  37. f.security = new SecurityManager();
  38. // then create the login form
  39. _sys.scripts.load("kblogin.jfm");
  40. var login = new kbloginForm();
  41. // the login form requires two custom properties be set
  42. login.security = f.security;
  43. login.nextForm = f;
  44. // finally, open the login form
  45. login.open();
  46. return;
  47. // {End Header} Do not remove this comment//
  48. // Generated on 08/29/1996
  49. //
  50. var f = new kbupdateForm();
  51. f.open();
  52. class kbupdateForm extends Form {
  53.    _sys.scripts.load(_sys.env.home() + "APPS\\SHARED\\CONTROLS.CC")
  54.    with (this) {
  55.       color = "BtnFace";
  56.       height = 33.2353;
  57.       left = 1.6667;
  58.       top = 0.2353;
  59.       width = 74.6667;
  60.       title = "Knowledge Base Updates";
  61.       background = "filename PAPER_22.GIF";
  62.       onServerLoad = class::form_onServerLoad;
  63.    }
  64.  
  65.  
  66.    with (this.ibapps1 = new Database()){
  67.       left = 45;
  68.       top = 2;
  69.       databaseName = "IBAPPS";
  70.       active = true;
  71.    }
  72.  
  73.  
  74.    with (this.kbase1 = new Query()){
  75.       left = 52;
  76.       top = 2;
  77.       database = parent.ibapps1;
  78.       sql = "SELECT * FROM kbase";
  79.       active = true;
  80.    }
  81.  
  82.  
  83.    with (this.kbase1.rowset) {
  84.  
  85.       filterOptions = 3;
  86.       locateOptions = 3;
  87.       onNavigate = class::Rowset_onNavigate;
  88.    }
  89.  
  90.  
  91.    with (this.category1 = new Query()){
  92.       left = 64;
  93.       top = 2;
  94.       database = parent.ibapps1;
  95.       sql = "SELECT * FROM kbcat";
  96.       active = true;
  97.    }
  98.  
  99.  
  100.    with (this.category1.rowset) {
  101.    }
  102.  
  103.  
  104.    with (this.product1 = new Query()){
  105.       left = 58;
  106.       top = 2;
  107.       database = parent.ibapps1;
  108.       sql = "SELECT * FROM kbprod";
  109.       active = true;
  110.    }
  111.  
  112.  
  113.    with (this.product1.rowset) {
  114.    }
  115.  
  116.  
  117.    with (this.rule1 = new Rule(this)){
  118.       left = 1;
  119.       top = 6;
  120.       size = 2;
  121.       right = 70;
  122.       pageno = 0;
  123.    }
  124.  
  125.  
  126.    with (this.rule2 = new Rule(this)){
  127.       left = 1;
  128.       top = 37;
  129.       size = 2;
  130.       right = 70;
  131.       pageno = 0;
  132.    }
  133.  
  134.  
  135.    with (this.rule3 = new Rule(this)){
  136.       left = 1;
  137.       top = 25;
  138.       size = 2;
  139.       right = 70;
  140.       pageno = 0;
  141.    }
  142.  
  143.  
  144.    with (this.KnowledgeBaseLogo = new Image(this)){
  145.       height = 4.8235;
  146.       left = 1;
  147.       top = 0.2353;
  148.       width = 13.6667;
  149.       dataSource = "filename KNOWBS31.GIF";
  150.       alignment = 4;
  151.       pageno = 0;
  152.    }
  153.  
  154.  
  155.    with (this.HeadingHTML = new HTML(this)){
  156.       height = 2;
  157.       left = 18;
  158.       top = 0.2353;
  159.       width = 52;
  160.       color = "navy";
  161.       text = {||'<H1><FONT SIZE="+4"><FONT COLOR="maroon">K</FONT></FONT>nowledge <FONT SIZE="+4"><FONT COLOR="maroon">B</FONT></FONT>ase <FONT SIZE="+4"><FONT COLOR="maroon">U</FONT></FONT>pdate</H1>'};
  162.       pageno = 0;
  163.    }
  164.  
  165.  
  166.    with (this.DocumentIdHtml = new HTML(this)){
  167.       height = 1;
  168.       left = 1;
  169.       top = 7;
  170.       width = 15;
  171.       color = "black";
  172.       fontBold = false;
  173.       text = "Document ID";
  174.    }
  175.  
  176.  
  177.    with (this.DocumentIdFieldHTML = new HTML(this)){
  178.       height = 1;
  179.       left = 18;
  180.       top = 7;
  181.       width = 30;
  182.       color = "black";
  183.       text = {||this.parent.rowset.state==STATE_APPEND ? "(appending)" : (this.parent.rowset.endOfSet ? "(end of set)" : parseInt(this.parent.kbase1.rowset.fields["DocumentID"].value))};
  184.    }
  185.  
  186.  
  187.    with (this.TitleHTML = new HTML(this)){
  188.       height = 1;
  189.       left = 1;
  190.       top = 8;
  191.       width = 15;
  192.       color = "black";
  193.       fontBold = false;
  194.       text = "Title";
  195.       pageno = 0;
  196.    }
  197.  
  198.  
  199.    with (this.TitleText = new Text(this)){
  200.       left = 18;
  201.       top = 8;
  202.       width = 52;
  203.       dataLink = parent.kbase1.rowset.fields["Title"];
  204.       pageno = 0;
  205.    }
  206.  
  207.  
  208.    with (this.ProductHTML = new HTML(this)){
  209.       height = 1;
  210.       left = 1;
  211.       top = 9;
  212.       width = 15;
  213.       color = "black";
  214.       fontBold = false;
  215.       text = "Product";
  216.       pageno = 0;
  217.    }
  218.  
  219.  
  220.    with (this.ProductSelect = new FieldSelect(this)){
  221.       left = 18;
  222.       top = 9;
  223.       width = 52;
  224.       pageno = 0;
  225.       options = "array {'kbprod','ProdDescript'}";
  226.    }
  227.  
  228.  
  229.    with (this.CategoryHTML = new HTML(this)){
  230.       height = 1;
  231.       left = 1;
  232.       top = 10;
  233.       width = 15;
  234.       color = "black";
  235.       fontBold = false;
  236.       text = "Category";
  237.       pageno = 0;
  238.    }
  239.  
  240.  
  241.    with (this.CategorySelect = new FieldSelect(this)){
  242.       left = 18;
  243.       top = 10;
  244.       width = 52;
  245.       pageno = 0;
  246.       options = "array {'kbcat','CatDescript'}";
  247.    }
  248.  
  249.  
  250.    with (this.KeywordHTML = new HTML(this)){
  251.       height = 1;
  252.       left = 1;
  253.       top = 11;
  254.       width = 15;
  255.       color = "black";
  256.       fontBold = false;
  257.       text = "Keywords";
  258.       pageno = 0;
  259.    }
  260.  
  261.  
  262.    with (this.KeywordText = new Text(this)){
  263.       left = 18;
  264.       top = 11;
  265.       width = 52;
  266.       dataLink = parent.kbase1.rowset.fields["Keyword"];
  267.       pageno = 0;
  268.    }
  269.  
  270.  
  271.    with (this.DocumentHTML = new HTML(this)){
  272.       height = 1;
  273.       left = 1;
  274.       top = 12;
  275.       width = 15;
  276.       color = "black";
  277.       fontBold = false;
  278.       text = "Document";
  279.       pageno = 0;
  280.    }
  281.  
  282.  
  283.    with (this.ReformatCheck = new CheckBox(this)){
  284.       height = 1;
  285.       left = 18;
  286.       top = 12;
  287.       width = 52;
  288.       text = "Allow HTML formatting of this document";
  289.       dataLink = parent.kbase1.rowset.fields["Reformat"];
  290.       fontBold = false;
  291.    }
  292.  
  293.  
  294.    with (this.DocumentTextArea = new TextArea(this)){
  295.       height = 10;
  296.       left = 1;
  297.       top = 14;
  298.       width = 69;
  299.       dataLink = parent.kbase1.rowset.fields["Document"];
  300.       pageno = 0;
  301.       readOnly = false;
  302.    }
  303.  
  304.  
  305.    with (this.HomePageLinkImage = new Image(this)){
  306.       height = 4.8235;
  307.       left = 1;
  308.       top = 26;
  309.       width = 13.6667;
  310.       dataSource = "filename HOMEPG31.GIF";
  311.       alignment = 4;
  312.       pageno = 0;
  313.       onImageClick = class::link_to_home_page;
  314.    }
  315.  
  316.  
  317.    with (this.HomePageLinkHTML = new HTML(this)){
  318.       height = 1;
  319.       left = 18;
  320.       top = 26;
  321.       width = 28;
  322.       color = "black";
  323.       fontBold = false;
  324.       text = "<A HREF='/ibapps/index.htm'>Return to Home Page</A>";
  325.       pageno = 0;
  326.    }
  327.  
  328.  
  329.    with (this.SearchLinkImage = new Image(this)){
  330.       height = 4.8235;
  331.       left = 1;
  332.       top = 31;
  333.       width = 13.6667;
  334.       dataSource = "filename KNOWBS31.GIF";
  335.       alignment = 4;
  336.       pageno = 0;
  337.       onImageClick = class::link_to_search_page;
  338.    }
  339.  
  340.  
  341.    with (this.SearchLinkHTML = new HTML(this)){
  342.       height = 1;
  343.       left = 18;
  344.       top = 31;
  345.       width = 28;
  346.       color = "black";
  347.       fontBold = false;
  348.       text = "<A HREF='/svr/intrasrv.isv?apps/knowbase/kbsearch.jfm'>Start a new search</A>";
  349.       pageno = 0;
  350.    }
  351.  
  352.  
  353.    with (this.GeneratedHTML = new GeneratedHTML(this)){
  354.       height = 1;
  355.       left = 1;
  356.       top = 38;
  357.       width = 80;
  358.       pageno = 0;
  359.    }
  360.  
  361.  
  362.    with (this.FilterCriteriaHTML = new HTML(this)){
  363.       height = 1;
  364.       left = 1;
  365.       top = 7;
  366.       width = 69;
  367.       color = "maroon";
  368.       fontBold = false;
  369.       text = "<H2>Enter filter criteria below</H2>";
  370.       pageno = 2;
  371.    }
  372.  
  373.  
  374.    with (this.ApplyFilterButton = new Button(this)){
  375.       left = 18;
  376.       top = 4;
  377.       width = 15;
  378.       text = "Apply Filter";
  379.       pageno = 2;
  380.       onServerClick = class::ApplyFilterButton_onServerClick;
  381.    }
  382.  
  383.  
  384.    with (this.AbandonFilterButton = new Button(this)){
  385.       left = 40;
  386.       top = 4;
  387.       width = 18;
  388.       text = "Abandon Filter";
  389.       pageno = 2;
  390.       onServerClick = class::AbandonFilterButton_onServerClic;
  391.    }
  392.  
  393.  
  394.    with (this.QueryCriteriaHTML = new HTML(this)){
  395.       height = 1;
  396.       left = 1;
  397.       top = 7;
  398.       width = 69;
  399.       color = "maroon";
  400.       text = "<H2>Enter query criteria below</H2>";
  401.       pageno = 3;
  402.    }
  403.  
  404.  
  405.    with (this.ApplyQueryButton = new Button(this)){
  406.       left = 18;
  407.       top = 4;
  408.       width = 15;
  409.       text = "Apply Query";
  410.       pageno = 3;
  411.       onServerClick = class::ApplyQueryButton_onServerClick;
  412.    }
  413.  
  414.  
  415.    with (this.AbandonQueryButton = new Button(this)){
  416.       left = 40;
  417.       top = 4;
  418.       width = 19;
  419.       text = "Abandon Query";
  420.       pageno = 3;
  421.       onServerClick = class::AbandonQueryButton_onServerClick;
  422.    }
  423.  
  424.  
  425.    with (this.NavImage = new Image(this)){
  426.       height = 1.3529;
  427.       left = 18;
  428.       top = 4;
  429.       width = 17.3333;
  430.       dataSource = "filename EXPINAVH.GIF";
  431.       alignment = 4;
  432.       onImageServerClick = {|nLeft, nTop|;if (nLeft >= 26*0 && nLeft < 26*1){form.rowset.first()}else if (nLeft >= 26*1 && nLeft < 26*2){if (!form.rowset.next(-1)) form.rowset.next();}else if (nLeft >= 26*2 && nLeft < 26*3){if (!form.rowset.next()) form.rowset.next(-1);}else{form.rowset.last()}};
  433.    }
  434.  
  435.  
  436.    with (this.OtherImage = new Image(this)){
  437.       height = 1.3529;
  438.       left = 40;
  439.       top = 4;
  440.       width = 29;
  441.       dataSource = "filename EXPIROWH.GIF";
  442.       alignment = 4;
  443.       onImageServerClick = class::OtherImage_OnImageServerClick;
  444.    }
  445.  
  446.    this.rowset = this.kbase1.rowset;
  447.  
  448.    function form_onServerLoad()
  449.    {
  450.       // Make sure the logged in user has access to the kbupdate form
  451.       if (!this.security.hasAccessTo("KBUPDATE")) {
  452.          _sys.forms.run("kberror.jfm");
  453.          this.close();
  454.       }
  455.       //
  456.       // set the document id value
  457.       //
  458.       this.refreshID(this);
  459.       //
  460.       // set the field events for the product field
  461.       //
  462.       this.kbase1.rowset.fields["Product"].canChange = 
  463.          {| p |; var prod = this.parent.parent.parent.parent.product1 ;prod.rowset.applyLocate('ProdDescript = p') ;this.value = prod.rowset.fields["Product"].value; return false}
  464.       this.kbase1.rowset.fields["Product"].beforeGetValue = 
  465.          {; var prod = this.parent.parent.parent.parent.product1 ;prod.rowset.applyLocate('Product = ' + (this.value==null?0:this.value)) ;return (prod.rowset.endOfSet?"":prod.rowset.fields["ProdDescript"].value)};
  466.       this.ProductSelect.dataLink = this.kbase1.rowset.fields["Product"];
  467.       //
  468.       // set the field events for the category field
  469.       //
  470.       this.kbase1.rowset.fields["Category"].canChange = 
  471.          {| c |; var cat = this.parent.parent.parent.parent.category1 ;cat.rowset.applyLocate('CatDescript = c') ;this.value = cat.rowset.fields["Category"].value; return false}
  472.       this.kbase1.rowset.fields["Category"].beforeGetValue = 
  473.          {; var cat = this.parent.parent.parent.parent.category1 ;cat.rowset.applyLocate('Category = ' + (this.value==null?0:this.value)) ;return (cat.rowset.endOfSet?"":cat.rowset.fields["CatDescript"].value)};
  474.       this.CategorySelect.dataLink = this.kbase1.rowset.fields["Category"];
  475.   }
  476.  
  477.    function ApplyFilterButton_onServerClick()
  478.    {
  479.       if (this.form.rowset.state == STATE_FILTER) {
  480.          this.form.rowset.applyFilter();
  481.          this.form.rowset.first();
  482.       }
  483.       this.form.pageno = 1;
  484.    }
  485.  
  486.    function AbandonFilterButton_onServerClick()
  487.    {
  488.       this.form.rowset.abandon();
  489.       this.form.pageno = 1;
  490.    }
  491.  
  492.    function ApplyQueryButton_onServerClick()
  493.    {
  494.       if (this.form.rowset.state == STATE_LOCATE) {
  495.          if (!this.form.rowset.applyLocate())
  496.             this.form.rowset.first();
  497.       }
  498.       this.form.pageno = 1;
  499.    }
  500.  
  501.    function AbandonQueryButton_onServerClick()
  502.    {
  503.       this.form.rowset.abandon();
  504.       this.form.pageno = 1;
  505.    }
  506.  
  507.    function OtherImage_OnImageServerClick( nLeft, nTop )
  508.    {
  509.       if (nLeft >= 26*0 && nLeft < 26*1)
  510.          form.rowset.beginAppend();
  511.       else if (nLeft >= 26*1 && nLeft < 26*2) {
  512.          if (!form.rowset.endOfSet) {
  513.             form.rowset.delete();
  514.             if (form.rowset.endOfSet)
  515.                form.rowset.last();
  516.          }
  517.       }
  518.       else if (nLeft >= 26*2 && nLeft < 26*3) {
  519.          form.rowset.modified = true;
  520.          form.rowset.save();
  521.       }
  522.       else if (nLeft >= 26*3 && nLeft < 26*4) {
  523.          form.rowset.abandon();
  524.          if (form.rowset.endOfSet)
  525.             form.rowset.last();
  526.       }
  527.       else if (nLeft >= 26*4 && nLeft < 26*5)
  528.          form.rowset.beginEdit();
  529.       else if (nLeft >= 26*5 && nLeft < 26*6) { 
  530.          with(this) {
  531.             if (form.rowset.state==STATE_LOCATE) {
  532.                form.rowset.applyLocate();
  533.             } 
  534.             else {
  535.                form.rowset.beginLocate();
  536.                form.pageno = 3;
  537.             }
  538.          }
  539.       }
  540.       else {
  541.          with(this) {
  542.             if (form.rowset.state==STATE_FILTER) {
  543.                form.rowset.applyFilter();
  544.             } 
  545.             else {
  546.                form.rowset.beginFilter();
  547.                form.pageno = 2;
  548.             }
  549.          }
  550.       }
  551.       form.refreshID(form);
  552.    }
  553.  
  554.    function Rowset_onNavigate()
  555.    {
  556.       this.parent.parent.refreshID(this.parent.parent);
  557.    }
  558.  
  559.    function refreshID( frm ) {
  560.       frm.DocumentIdFieldHTML.text = frm.DocumentIdFieldHTML.text;
  561.    }
  562.  
  563.    function link_to_home_page()
  564.    {
  565.       location.href="/ibapps/index.htm";
  566.    }
  567.  
  568.    function link_to_search_page()
  569.    {
  570.       location.href="/svr/intrasrv.isv?apps/knowbase/kbsearch.jfm";
  571.    }
  572. }
  573.