Forums : Template et RDF

Aller à la discussion :  Plus récente Plus ancienne

# probleme RDF

Envoyé par : jdar

Date : 26/04/2007 15:15

Bonjour , je suis debutant dans les applications mozilla et la j'ai un probleme avec un code source que j'ai recupéré et modifié un peu.

en fait j'ai enlevé une partie de l'interface graphique ,suppression de SideBar,toolbar... dont un <menulist> qui affichait la liste des identités.et depuis ca marche plus.

je voudrais recuperer la variable "wCurrentIdentity" mais pour l'instant ca marche pas quand je l'imprime a l'ecran ca donne "undefined".

voici une partie du code zap.js , qui est appelé dans zap.xul (l'interface graphique)

var wConfig = Config.instantiate();
var Config = makeClass("Config", PersistentRDFObject);
Config.rdfResourceAttrib("urn:mozilla:zap:identity","urn:mozilla:zap:initial_identity");
...
...
 wIdentitiesDS = wRDF.GetDataSourceBlocking(getProfileFileURL("identities.rdf"));
wIdentitiesContainer =
 Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);
wIdentitiesContainer.Init(wIdentitiesDS,wRDF.GetResource("urn:mozilla:zap:identities"));
// set the current identity:
var identitiesList = document.getElementById("identities_list_popup");
identitiesList.database.AddDataSource(wIdentitiesDS);
identitiesList.builder.rebuild();
// select correct identity in identities list:
document.getElementById("identities_list").selectedItem = document.getElementById(wConfig["urn:mozilla:zap:identity"]);
// make sure out stack is configured for this identity profile:
wCurrentIdentity = getIdentity(wConfig["urn:mozilla:zap:identity"]);
....
....
var wIdentities = {};
function getIdentity(resourceID) {
  var identity = wIdentities[resourceID];
  if (!identity) {
    identity = Identity.instantiate();
    identity.initWithResource(wRDF.GetResource(resourceID));
    wIdentities[resourceID] = identity;
  }
  return identity;
}

la methodes getProfileFileURL("identities.rdf") donné dans le bloc de code en haut rend ceci :

<?xml version="1.0"?>
<RDF:RDF xmlns:zap="urn:mozilla:zap:"
 xmlns:NC="http://home.netscape.com/NC-rdf#"
 xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Description RDF:about="urn:mozilla:zap:initial_identity"
		 NC:Name="sip:thisis@anonymous.invalid"
		  zap:chromepage="chrome://zap/content/identity.xul"
		 zap:nodetype="identity"
		 zap:display_name=""
		 zap:organization=""
		 zap:preference="0.1"
		 zap:automatic_registration="true"
		 zap:authentication_username=""
		 zap:service="urn:mozilla:zap:automatic_service"
		 zap:watch_contact_presence="true">
	<zap:sidebarparent  RDF:resource="urn:mozilla:zap:identities"/>
</RDF:Description>
<RDF:Seq RDF:about="urn:mozilla:zap:identities">
	<RDF:li RDF:resource="urn:mozilla:zap:initial_identity"/>
</RDF:Seq>
</RDF:RDF>

comme ca marchait pas, j'ai remis manuellement la partie des identités dans zap.xul

       <menulist id="identities_list" minwidth="100">
  <menupopup id="identities_list_popup">
	  <menuitem uri="urn:mozilla:zap:initial_identity" label="sip:thisis@anonymous.invalid"/>
  </menupopup>
       </menulist>

je ne comprends pas pourquoi il y a appel au .RDF 2 fois

la premiere via document.getElementById aprés avoir appliqué la template <rule><content>...

la 2eme via identitiesList.database.AddDataSource et getRDF....

merci

# Re: probleme RDF

Envoyé par : jdar

Date : 27/04/2007 16:48

Resolu

probleme ailleurs dans le code ;)

Il n'est plus possible de poster des messages dans ce forum.


Copyright © 2003-2013 association xulfr, 2013-2016 Laurent Jouanneau - Informations légales.

Mozilla® est une marque déposée de la fondation Mozilla.
Mozilla.org™, Firefox™, Thunderbird™, Mozilla Suite™ et XUL™ sont des marques de la fondation Mozilla.