Add registration status and register/unregister buttons to identity form.

git-svn-id: svn://10.0.0.236/branches/ZAP_20050610_BRANCH@189373 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alex%croczilla.com
2006-02-07 23:52:11 +00:00
parent 2eb515f649
commit 0079554ee2
2 changed files with 83 additions and 0 deletions

View File

@@ -59,6 +59,7 @@
initIdentityForm();
wIdentity = parent.getIdentity(parent.getSelectedSidebarResource().Value);
wIdentity.fillDocument(document);
wIdentity.initXULTemplate(document.getElementById("identity-template-1"), true);
}
function del() {
@@ -95,6 +96,14 @@
wIdentity.fillDocument(document);
}
function registerNow() {
parent.registerIdentity(wIdentity);
}
function unregisterNow() {
parent.unregisterIdentity(wIdentity);
}
]]>
</script>
@@ -104,6 +113,73 @@
<spacer flex="1"/>
<button label="Delete this identity" oncommand="del()"/>
</box>
<vbox id="identity-template-1"
containment="urn:mozilla:zap:current-identity"
datasources="rdf:null"
flags="dont-buid-content"
ref="urn:mozilla:zap:root">
<template>
<rule><!-- NON-REGISTERED IDENTITY -->
<conditions>
<content uri="?dummy"/>
<member container="?dummy" child="?node"/>
<triple subject="?node"
predicate="urn:mozilla:zap:registration_status"
object=""/>
</conditions>
<action>
<groupbox flex="1" uri="?node">
<caption><label value="Status"/></caption>
<hbox flex="1">
<label value="Not registered"/>
<spacer flex="1"/>
<button label="Register now" oncommand="registerNow()"/>
</hbox>
</groupbox>
</action>
</rule>
<rule><!-- REGISTERED IDENTITY -->
<conditions>
<content uri="?dummy"/>
<member container="?dummy" child="?node"/>
<triple subject="?node"
predicate="urn:mozilla:zap:registration_status"
object="registered"/>
</conditions>
<action>
<groupbox flex="1" uri="?node">
<caption><label value="Status"/></caption>
<hbox flex="1">
<label value="Registered"/>
<spacer flex="1"/>
<button label="Unregister now" oncommand="unregisterNow()"/>
</hbox>
</groupbox>
</action>
</rule>
<rule><!-- REGISTERING IDENTITY -->
<conditions>
<content uri="?dummy"/>
<member container="?dummy" child="?node"/>
<triple subject="?node"
predicate="urn:mozilla:zap:registration_status"
object="registering"/>
</conditions>
<action>
<groupbox flex="1" uri="?node">
<caption><label value="Status"/></caption>
<hbox flex="1">
<label value="Registering..."/>
<spacer flex="1"/>
<button label="Stop registering" oncommand="unregisterNow()"/>
</hbox>
</groupbox>
</action>
</rule>
</template>
</vbox>
<vbox id="zap_identity_form"/>
</vbox>
<hbox style="display:none" class="zap-form-buttonbar">

View File

@@ -524,6 +524,7 @@ Identity.addInterfaces(Components.interfaces.zapISipCredentialsProvider);
Identity.prototype.datasources["default"] = wIdentitiesDS;
Identity.prototype.datasources["global-ephemeral"] = wGlobalEphemeralDS;
Identity.addInMemoryDS("ephemeral");
Identity.rdfResourceAttrib("urn:mozilla:zap:sidebarparent",
"urn:mozilla:zap:identities");
@@ -541,6 +542,12 @@ Identity.rdfLiteralAttrib("urn:mozilla:zap:service",
// registration_status: "registered"|"registering"|""
Identity.rdfLiteralAttrib("urn:mozilla:zap:registration_status",
"", "global-ephemeral");
// This is to provide an entrypoint for template recursion. see
// e.g. calls.xul for usage and comments in
// RDFUtils.js::rdfPointerAttrib:
Identity.rdfPointerAttrib("urn:mozilla:zap:root",
"urn:mozilla:zap:current-identity",
"ephemeral");
// make sure that we re-resolve the service when certain attributes change:
Identity.rdfAttribTrigger(