[CalendarServer-changes] [7959] CalendarServer/branches/users/glyph/imip-and-admin-html/ calendarserver/webadmin
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 11 21:51:09 PDT 2011
Revision: 7959
http://trac.macosforge.org/projects/calendarserver/changeset/7959
Author: glyph at apple.com
Date: 2011-08-11 21:51:09 -0700 (Thu, 11 Aug 2011)
Log Message:
-----------
stub proxy-search implementation
Modified Paths:
--------------
CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/resource.py
CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/template.html
Modified: CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/resource.py
===================================================================
--- CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/resource.py 2011-08-12 04:50:58 UTC (rev 7958)
+++ CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/resource.py 2011-08-12 04:51:09 UTC (rev 7959)
@@ -42,6 +42,7 @@
from twext.web2.http_headers import MimeType
from zope.interface.declarations import implements
from twext.web2.stream import MemoryStream
+from twisted.internet.defer import succeed
from twext.web2.dav import davxml
from twisted.web.iweb import ITemplateLoader
@@ -127,24 +128,7 @@
Renderer which renders resource search results.
"""
d = self.performSearch(request)
- def searchPerformed(results):
- for idx, record in enumerate(results):
- yield tag.clone().fillSlots(
- rowClass="even" if (idx % 2 == 0) else "odd",
- type=record.recordType,
- shortName=record.shortNames[0],
- name= record.fullName,
- typeStr={
- "users" : "User",
- "groups" : "Group",
- "locations" : "Place",
- "resources" : "Resource",
- }.get(record.recordType),
- shortNames=str(", ".join(record.shortNames)),
- authIds=str(", ".join(record.authIDs)),
- emails=str(", ".join(record.emailAddresses)),
- )
- return d.addCallback(searchPerformed)
+ return d.addCallback(searchToSlots, tag)
@renderer
@@ -166,7 +150,29 @@
return ""
+def searchToSlots(results, tag):
+ """
+ Convert the result of doing a search to an iterable of tags.
+ """
+ for idx, record in enumerate(results):
+ yield tag.clone().fillSlots(
+ rowClass="even" if (idx % 2 == 0) else "odd",
+ type=record.recordType,
+ shortName=record.shortNames[0],
+ name=record.fullName,
+ typeStr={
+ "users" : "User",
+ "groups" : "Group",
+ "locations" : "Place",
+ "resources" : "Resource",
+ }.get(record.recordType),
+ shortNames=str(", ".join(record.shortNames)),
+ authIds=str(", ".join(record.authIDs)),
+ emails=str(", ".join(record.emailAddresses)),
+ )
+
+
class stan(object):
"""
L{ITemplateLoader} wrapper for an existing tag, in the style of Nevow's
@@ -191,7 +197,9 @@
self.adminResource = adminResource
tag.fillSlots(resourceTitle=unicode(principalResource),
resourceId=resourceId,
- davPropertyName=davPropertyName)
+ davPropertyName=davPropertyName,
+ # FIXME implement
+ proxySearch="")
try:
namespace, name = davPropertyName.split("#")
except Exception:
@@ -299,7 +307,20 @@
returnValue(result)
+ def performProxySearch(self, request):
+ return succeed([])
+
+ @renderer
+ def proxySearchRows(self, request, tag):
+ """
+ Renderer which renders search results for the proxy form.
+ """
+ d = self.performProxySearch(request)
+ return d.addCallback(searchToSlots, tag)
+
+
+
class ProxyRow(Element):
def __init__(self, tag, index, readProxy, writeProxy):
Modified: CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/template.html
===================================================================
--- CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/template.html 2011-08-12 04:50:58 UTC (rev 7958)
+++ CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/template.html 2011-08-12 04:51:09 UTC (rev 7959)
@@ -177,7 +177,51 @@
</tr>
</table>
</form>
+
+ <!-- proxySearchHtml -->
+
+ <div style="margin-top:15px; border-bottom:1px #444444 dotted"></div>
+ <form id="frm_proxySearch" name="proxySearchForm" action="/admin/"
+ style="margin-top:15px; margin-bottom:0; padding-bottom:0">
+ Search to add proxies:
+ <input type="hidden" id="hdn_resourceId" name="resourceId"
+ ><t:attr name="value"><t:slot name="resourceId" /></t:attr></input>
+ <input type="text" id="txt_proxySearch" name="proxySearch" size="40"
+ ><t:attr name="value"><t:slot name="proxySearch" /></t:attr></input>
+ <input type="submit" value="Search"></input>
+ </form>
+
+ <form id="frm_proxyAdd" name="proxyAddForm" action="/admin/"
+ style="margin-top:2px; padding-top:0">
+ <input type="hidden" id="hdn_resourceId" name="resourceId"
+ ><t:attr name="value"><t:slot name="resourceId" /></t:attr></input>
+ <table cellspacing="0" cellpadding="3" border="1">
+ <tr class="odd">
+ <th>Full Name</th>
+ <th>Type</th>
+ <th>Short Names</th>
+ <th>Email Addresses</th>
+ <th></th>
+ </tr>
+ <tr t:render="proxySearchRows">
+ <t:attr name="class"><t:slot name="rowClass" /> </t:attr>
+ <td><t:slot name="name" /></td>
+ <td><t:slot name="typeStr" /></td>
+ <td><t:slot name="shortNames" /></td>
+ <td><t:slot name="emails" /></td>
+ <td>
+ <input type="submit" value="Make Read-Only Proxy"><t:attr
+ name="name">mkReadProxy|<t:slot name="type" />:<t:slot
+ name="shortName"/></t:attr></input>
+ <input type="submit" value="Make Read-Write Proxy"><t:attr
+ name="name">mkWriteProxy|<t:slot name="type" />:<t:slot
+ name="shortName"/></t:attr></input>
+ </td>
+ </tr>
+ </table>
+ </form>
</t:transparent>
</div>
+
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110811/8d756260/attachment.html>
More information about the calendarserver-changes
mailing list