Csharp forms dll

From OpenKM Documentation
Jump to: navigation, search

Contents


Nota clasica.png DLL have been compiled for net 2.0 that should ensure go with any upper .net version

OKMForm DLL library has general purpose forms to help work with OpenKM.

Available versions


Packages & classes & files documentation

Understanding the basics

  • TreeForm ( tree navigator across taxonomy, templates and personal folder)
  • SearchForm ( search form across taxonomy, tamplates and personal folder )
  • Explorerform ( tree navigator across taxonomy, template and personal folder with right table to display documents into selected folder )
  • ConfigurationForm ( form to display OpenKM configuration parameters ).

Nota clasica.png Some forms has method langRefresh. If dictionary is changed execute langRefresh() method change UI text labels.

TreeForm

TreeForm display navigator tree which can be switched between taxonomy, templates and personal context.


Okm user guide 511.png


Events:

  • Button cancel trigger treeButtonCancelled method in TreeHander.
  • Button accept trigger treeButtonAccepted method in TreeHander.

Nota clasica.png TreeForm needs DictionaryHelper for UI translatiosn take a look at Csharp_utils_dll#DictionaryHelper

Translations properties needed:

form.tree.title=Navigation tree
form.tree.context.root=Taxonomy
form.tree.context.templates=Templates
form.tree.context.personal=Personal
form.tree.context.mail=Mail
form.tree.contextmenu.newfolder=New folder
form.tree.contextmenu.renamefolder=Rename folder
form.tree.contextmenu.deletefolder=Delete folder
form.tree.button.accept=Sign
form.tree.input.title=Folder management
form.tree.button.refresh=Refresh
form.tree.button.search=Search
form.tree.button.cancel=Cancel
form.tree.msg.foldername.empty=Error, folder name is empty
form.tree.grouped=grouped

Example:

public class Example : TreeHandler {
  public Example(Dictionary dictionary, OKMWebservice webservice) {
    TreeForm treeForm = new TreeForm(this, dictionary, webservice);
  }
 
  // showTree
  public void showNavigatorTree() {
    try
    {
      treeForm.setFirstTime(true);
      treeForm.ShowDialog();
    }
    catch (Exception e)
    {
      Logger.Instance.error("treeForm", e);
    }
 
  }
 
  // treeButtonCancelled
  public void treeButtonCancelled()
  {
    // something to do here
  }
 
  //treeButtonAccepted
  public void treeButtonAccepted(String fldPath, String fldUuid)
  {
    // something to do here
  }
 
  //treeButtonAccepted ( use when mail view is enabled )
  public void treeButtonAccepted(String fldPath, String fldUuid, bool grouped)
  {
    // something to do here
  }
}

SearchForm

SearchForm display search form which can be switched between taxonomy, templates and personal context.


Okm user guide 512.png


Are needed at least tree characters to be able to do a search.


Events:

  • Button cancel trigger searchButtonCancelled method in SearchHander.
  • Button accept trigger searchSelectedFolder method in SearchHander when is looking for folders.
  • Button accept trigger searchSelectedDocument method in SearchHander when is looking for document.
  • Button accept trigger searchSelectedMail method in SearchHander when is looking for mail.
  • Button accept trigger searchSelectedRecord method in SearchHander when is looking for record.



Nota clasica.png SearchForm needs DictionaryHelper for UI translatiosn take a look at Csharp_utils_dll#DictionaryHelper

Translations properties needed:

form.search.title=Search
form.search.msg.min.char=At least you need to add tree characters
form.search.msg.empty=Search has return empty results
form.search.button.search=Search
form.search.button.cancel=Cancel

Exemple:

public class Example : SearchHandler {
  public Example(Dictionary dictionary, OKMWebservice webservice) {
    // Looking for folders
    SearchForm searchForm = new SearchForm(button.refresh=Refresh.TAXONOMY_FOLDER, OKMQueryParamsBean.FOLDER, this, dictionary, webservice);
  }
 
  // show Search
  public void showSearch() {
  try
	{
	  searchForm.ShowDialog();
	}
	catch (Exception ex)
	{
	  Logger.Instance.error("treeForm", e);
	}
  }
 
    // searchButtonCancelled
  public void searchButtonCancelled()
  {
    // Something to do here
  }
 
  // searchSelectedFolder
  public void searchSelectedFolder(String nodePath, String nodeUuid)
  {
	// Something to do here
  }
 
  // searchSelectedDocument
  public void searchSelectedDocument(String nodePath, String nodeUuid)
  {
    // Something to do here
  }
 
  // searchSelectedMail
  public void searchSelectedMail(String nodePath, String nodeUuid)
  {
    // Something to do here
  }
 
  // searchSelectedRecord
  public void searchSelectedRecord(String nodePath, String nodeUuid)
  {
    // Something to do here
  }
}

ExplorerForm

ExplorerForm display explorerform which can be switched between taxonomy, templates and personal context.

Okm user guide 542.png

Events:

  • Button cancel trigger explorerButtonCancelled method in ExplorerHandler.
  • Button accept trigger explorerButtonAccepted method in ExplorerHandler.

Nota clasica.png ExplorerForm needs DictionaryHelper for UI translatiosn take a look at Csharp_utils_dll#DictionaryHelper

Translations needed:

form.explorer.form.name=Documents editor 
form.explorer.context.taxonomia=Taxonomy
form.explorer.context.plantilla=Templates
form.explorer.context.usuario=Personal
form.explorer.button.edit=Edit
form.explorer.button.searchFolder=Search folder
form.explorer.button.searchDoc=Search document
form.explorer.button.exit=Exit
form.explorer.dataGrid.column.name=Name
form.explorer.dataGrid.column.author=Author
form.explorer.dataGrid.column.version=Version
form.explorer.dataGrid.column.date=Date

Example:

public class Example : ExplorerHandler {
  public Example(Dictionary dictionary, OKMWebservice webservice) {
    // Looking for explorer
    ExplorerForm explorerForm = new ExplorerForm(this, dictionary, AddinModule.okmWebservice);
  }
 
  // show Search
  public void showSearch() {
  try
	{
	  explorerForm.ShowDialog();
	}
	catch (Exception ex)
	{
	  Logger.Instance.error("explorerForm", e);
	}
  }
 
  // explorerButtonCancelled
  public void explorerButtonCancelled()
  {
	// Nothing to do here
  }
 
  // explorerButtonAccepted
  public void explorerButtonAccepted(string docPath, string docUuid) {
     // Something to do here
  }
}

ConfigurationForm

ConfigurationForm display OpenKM configuration parameters.


Okm user guide 513.png


Events:

  • Button cancel trigger configurationButtonCancelled method in ConfigurationHander.
  • Button accept trigger configurationButtonAcceptedmethod in ConfigurationHander.


Translations properties needed:

form.configuration.name=Configuration
form.configuration.language=Language
form.configuration.version=OpenKM Version
form.configuration.userName=User
form.configuration.password=Password
form.configuration.host=Host
form.configuration.error.msg=Field {0} can not be empty
form.configuration.button.accept=Accept
form.configuration.button.cancel=Cancel
form.configuration.button.test=Test
form.configuration.test.ok=Connection successfully established
form.configuration.test.error=Connection test failed!!!

Example:

public class Example : SearchHandler {
  public Example(Dictionary dictionary, OKMWebservice webservice) {
    Dictionary<String, String> languages = new Dictionary<string,string>();
    languages.Add("enGB", "English");
    languages.Add("esES", "Spanish");
    // here can also be used OKMWebServiceFactory.getVersions(); method
    Dictionary<int, String> versions = new Dictionary<int,string>();
    versions.Add(OKMWebServiceFactory.PROFESSIONAL_6_4, "6.4");
    versions.Add(OKMWebServiceFactory.PROFESSIONAL_6_2, "6.2");
    ConfigBean configBean = new ConfigBean();
    configBean.Host = "http://localhost:8080/OpenKM";
    configBean.User = "okmAdmin";
    configBean.Password = "admin";
    configBean.Version = OKMWebServiceFactory.PROFESSIONAL_6_2;
    configBean.Language = "enGB";
    configurationForm = new ConfigurationForm(this, dictionary, Program.okmWebservice, configBean, languages, versions);
  }
 
  // show configuration
  public void showConfiguration() {
    try
    {
      configurationForm.ShowDialog();
    }
    catch (Exception ex)
    {
      Logger.Instance.error("configuration", ex);
    }
  }
 
  // configurationButtonCancelled
  public void configurationButtonCancelled()
  {
    // Something to do here
  }
 
  // configurationButtonAccepted
  public void configurationButtonAccepted(ConfigBean configBean)
  {
    // Something to do here
  }
}