1.) changed source code in order to comply with the Python Style Guide (PEP-8, Version 56036), with exception of method names which are in mixedCase style at the moment.
2.) pages are now being built using fragments: <content page (e.g. agent.html)> |- header.html |- top.html |- navigation.html |- footer.html 3.) the job list is now implemented as a table, using hyperlinks to select a job 4.) hovering over a table row now displays a yellow bar that simplifies navigation inside the table git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1837 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
a9a1b23ea8
commit
e53124a7cb
7 changed files with 266 additions and 452 deletions
|
@ -1,4 +1,4 @@
|
|||
FileSysCont_1234;C:\Documents;*.doc;daily;transfer(http:loops.sampleserver.de)
|
||||
MailCrawl_2121;Outlook(Account_Root);daily;transfer(http:loops.sampleserver.de)
|
||||
MailCrawl_4040;Outlook(Subj:Update);20s;transfer(http:loops.sampleserver.de)
|
||||
FileSysCont_8797;C:\Tmp;size<100kByte;transfer(http:loops.sampleserver.de)
|
||||
FileSysCont_1234;Running;daily;*.doc;C:\Documents;size<100kByte;transfer(http:loops.sampleserver.de)
|
||||
MailCrawl_2121;Running;daily;Subject:Update;Outlook;Account=Account_Root;transfer(http:loops.sampleserver.de)
|
||||
MailCrawl_4040;Paused;20s;Subject:Update;Outlook;Account=Account_Root;transfer(http:loops.sampleserver.de)
|
||||
FileSysCont_8797;Stopped;10m;*.jpg;C:\Tmp;size<100kByte;transfer(http:loops.sampleserver.de)
|
|
@ -22,3 +22,7 @@ a {
|
|||
height: 75px;*/
|
||||
}
|
||||
|
||||
table.listing tr:hover {
|
||||
background-color: #FEFE82;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,74 +4,18 @@
|
|||
|
||||
<!-- StartPage for loops.agent UI Version: 0.1 //-->
|
||||
|
||||
<head>
|
||||
<title>loops</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/zope3_tablelayout.css");</style>
|
||||
|
||||
<style type="text/css" media="screen">@import url("/resources/base.css");</style>
|
||||
|
||||
<style type="text/css" media="print">@import url("/resources/print.css");</style>
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/loops.css");</style>
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/custom.css");</style>
|
||||
|
||||
|
||||
<script type="text/javascript"
|
||||
src="/resources/loops.js">
|
||||
</script>
|
||||
|
||||
<link rel="icon" type="image/png"
|
||||
href="/resources/favicon.png" />
|
||||
|
||||
<base href="AgentStart.html"/>
|
||||
</head>
|
||||
<nevow:invisible nevow:render="header_fragment" />
|
||||
|
||||
<body>
|
||||
<div class="body">
|
||||
<div id="global">
|
||||
<div class="top" style="padding: 5px">
|
||||
<img src="/resources/loops_logo.png" />
|
||||
</div>
|
||||
</div>
|
||||
<div nevow:render="top_fragment" >
|
||||
</div>
|
||||
|
||||
|
||||
<div id="menu">
|
||||
|
||||
<div class="box">
|
||||
<h4>Navigation</h4>
|
||||
<div class="body">
|
||||
|
||||
<div class="content even menu-1">
|
||||
<a href="http://localhost:8080" class="">Startpage</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-2">Agent configuration</div>
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/joboverview"
|
||||
class="">job overview</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/collectOutlookMails"
|
||||
class="">collect Outlook Mails</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/addjob"
|
||||
class="">add job</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/loggingoptions" class=""
|
||||
title="">logging options</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div nevow:render="navigation_fragment">
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
@ -83,9 +27,9 @@
|
|||
<p><div align="center"><a href="ChangeUserMode"><b>[Switch Mode]</b></a></div></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="content">
|
||||
<div></div>
|
||||
<div></div>
|
||||
|
@ -116,14 +60,7 @@
|
|||
<div id="sub-section" define-macro="sub-section">
|
||||
</div>
|
||||
|
||||
<div id="footer" class="footer" define-macro="footer">
|
||||
|
||||
© Copyright 2007, cyberconcepts IT-Consulting Dr. Helmut Merz
|
||||
(<a href="http://loops.cy55.de/impressum">Impressum</a>)<br />
|
||||
Powered by <b><a href="http://www.python.org">Python</a></b> ·
|
||||
<b><a href="http://wiki.zope.org/zope3">Zope 3</a></b> ·
|
||||
<b><a href="http://loops.cy55.de/projekte/loops">loops</a></b>.
|
||||
|
||||
<div nevow:render="footer_fragment">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -4,91 +4,29 @@
|
|||
|
||||
<!-- Detailed Job View Page for loops.agent UI Version: 0.1 //-->
|
||||
|
||||
<head>
|
||||
<title>loops</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/zope3_tablelayout.css");</style>
|
||||
|
||||
<style type="text/css" media="screen">@import url("/resources/base.css");</style>
|
||||
|
||||
<style type="text/css" media="print">@import url("/resources/print.css");</style>
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/loops.css");</style>
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/custom.css");</style>
|
||||
|
||||
|
||||
<script type="text/javascript"
|
||||
src="/resources/loops.js">
|
||||
</script>
|
||||
|
||||
<link rel="icon" type="image/png"
|
||||
href="/resources/favicon.png" />
|
||||
|
||||
<base href="AgentStart.html"/>
|
||||
</head>
|
||||
<nevow:invisible nevow:render="header_fragment" />
|
||||
|
||||
<body>
|
||||
<div class="body">
|
||||
<div id="global">
|
||||
<div class="top" style="padding: 5px">
|
||||
<img src="/resources/loops_logo.png" />
|
||||
</div>
|
||||
<div nevow:render="top_fragment">
|
||||
</div>
|
||||
|
||||
<div id="menu">
|
||||
|
||||
<div class="box">
|
||||
<h4>Navigation</h4>
|
||||
<div class="body">
|
||||
|
||||
<div class="content odd menu-1">
|
||||
<a href="http://localhost:8080" class="">Startpage</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-2">Agent configuration</div>
|
||||
|
||||
<div class="content even menu-3">
|
||||
<a href="http://localhost:8080/joboverview"
|
||||
class="">job overview</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/collectOutlookMails"
|
||||
class="">collect Outlook Mails</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/addjob"
|
||||
class="">add job</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/loggingoptions" class=""
|
||||
title="">logging options</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div nevow:render="navigation_fragment">
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div class="box">
|
||||
<h4>User Mode</h4>
|
||||
<div class="body">
|
||||
<b>Current Mode: </b><p nevow:render="getActiveUserMode"/>
|
||||
|
||||
<b>Current Mode: </b><p nevow:render="getActiveUserMode"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
|
||||
<div class="content-1" id="2.body" ondblclick="">
|
||||
<div class="line-block">
|
||||
|
@ -104,15 +42,26 @@
|
|||
<div class="section">
|
||||
<h3><a id="form-overview" name="form-overview">Overview</a></h3>
|
||||
<ul class="simple">
|
||||
<li><b>Job details</b><div nevow:render="data" nevow:data="displayViewForm"/></li>
|
||||
<li><b>Job details</b><div nevow:render="data" nevow:data="displayViewForm"/></li>
|
||||
<table class="listing">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Attribute
|
||||
</th>
|
||||
<th>
|
||||
Value
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<p nevow:render="displayJobDetails">
|
||||
</p>
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
<a href="joboverview" alt="back to Job Overview Page"><b>[back to Job Overview]</b></a>
|
||||
</ul>
|
||||
<div align="center">
|
||||
<table border="0" cellpadding="10">
|
||||
<p nevow:render="displayJobDetails">
|
||||
<tr nevow:pattern="jobDetails" nevow:render="data"/>
|
||||
</p>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -120,14 +69,7 @@
|
|||
<div id="sub-section" define-macro="sub-section">
|
||||
</div>
|
||||
|
||||
<div id="footer" class="footer" define-macro="footer">
|
||||
|
||||
© Copyright 2007, cyberconcepts IT-Consulting Dr. Helmut Merz
|
||||
(<a href="http://loops.cy55.de/impressum">Impressum</a>)<br />
|
||||
Powered by <b><a href="http://www.python.org">Python</a></b> ·
|
||||
<b><a href="http://wiki.zope.org/zope3">Zope 3</a></b> ·
|
||||
<b><a href="http://loops.cy55.de/projekte/loops">loops</a></b>.
|
||||
|
||||
<div nevow:render="footer_fragment">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -4,83 +4,24 @@
|
|||
|
||||
<!-- Job Overview Page for loops.agent UI Version: 0.1 //-->
|
||||
|
||||
<head>
|
||||
<title>loops</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<nevow:invisible nevow:render="header_fragment" />
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/zope3_tablelayout.css");</style>
|
||||
|
||||
<style type="text/css" media="screen">@import url("/resources/base.css");</style>
|
||||
|
||||
<style type="text/css" media="print">@import url("/resources/print.css");</style>
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/loops.css");</style>
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/custom.css");</style>
|
||||
|
||||
|
||||
<script type="text/javascript"
|
||||
src="/resources/loops.js">
|
||||
</script>
|
||||
|
||||
<link rel="icon" type="image/png"
|
||||
href="/resources/favicon.png" />
|
||||
|
||||
<base href="AgentStart.html"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="body">
|
||||
<div id="global">
|
||||
<div class="top" style="padding: 5px">
|
||||
<img src="/resources/loops_logo.png" />
|
||||
</div>
|
||||
<div nevow:render="top_fragment">
|
||||
</div>
|
||||
|
||||
<div id="menu">
|
||||
|
||||
<div class="box">
|
||||
<h4>Navigation</h4>
|
||||
<div class="body">
|
||||
|
||||
<div class="content odd menu-1">
|
||||
<a href="http://localhost:8080" class="">Startpage</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-2">Agent configuration</div>
|
||||
|
||||
<div class="content even menu-3">
|
||||
<a href="http://localhost:8080/joboverview"
|
||||
class="">job overview</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/collectOutlookMails"
|
||||
class="">collect Outlook Mails</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/addjob"
|
||||
class="">add job</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/loggingoptions" class=""
|
||||
title="">logging options</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div nevow:render="navigation_fragment">
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div class="box">
|
||||
<h4>User Mode</h4>
|
||||
<div class="body">
|
||||
<b>Current Mode: </b><p nevow:render="getActiveUserMode"/>
|
||||
|
||||
<b>Current Mode: </b><p nevow:render="getActiveUserMode"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -105,17 +46,32 @@
|
|||
<h3><a id="form-overview" name="form-overview">Overview</a></h3>
|
||||
<ul class="simple">
|
||||
<li><b>Current jobs </b><div nevow:render="data" nevow:data="displayViewForm"/></li>
|
||||
<table class="listing">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
PID
|
||||
</th>
|
||||
<th>
|
||||
State
|
||||
</th>
|
||||
<th>
|
||||
Interval
|
||||
</th>
|
||||
<th>
|
||||
Search Criteria
|
||||
</th>
|
||||
<th>
|
||||
Job Scope
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<p nevow:render="fillJobTable">
|
||||
</p>
|
||||
</tbody>
|
||||
</table>
|
||||
</ul>
|
||||
<div align="center">
|
||||
<form action="ViewJobDetails" method="POST">
|
||||
<select name="jobList" size="4">
|
||||
<p nevow:render="fillJobList">
|
||||
<option nevow:pattern="optionsJobList" nevow:render="data"/>
|
||||
</p>
|
||||
</select>
|
||||
<p><input type="submit" value="View details"/></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -123,14 +79,7 @@
|
|||
<div id="sub-section" define-macro="sub-section">
|
||||
</div>
|
||||
|
||||
<div id="footer" class="footer" define-macro="footer">
|
||||
|
||||
© Copyright 2007, cyberconcepts IT-Consulting Dr. Helmut Merz
|
||||
(<a href="http://loops.cy55.de/impressum">Impressum</a>)<br />
|
||||
Powered by <b><a href="http://www.python.org">Python</a></b> ·
|
||||
<b><a href="http://wiki.zope.org/zope3">Zope 3</a></b> ·
|
||||
<b><a href="http://loops.cy55.de/projekte/loops">loops</a></b>.
|
||||
|
||||
<div nevow:render="footer_fragment">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -4,74 +4,17 @@
|
|||
|
||||
<!-- Outlook Mails Page for loops.agent UI Version: 0.1 //-->
|
||||
|
||||
<head>
|
||||
<title>loops</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/zope3_tablelayout.css");</style>
|
||||
|
||||
<style type="text/css" media="screen">@import url("/resources/base.css");</style>
|
||||
|
||||
<style type="text/css" media="print">@import url("/resources/print.css");</style>
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/loops.css");</style>
|
||||
|
||||
<style type="text/css" media="all">@import url("/resources/custom.css");</style>
|
||||
|
||||
|
||||
<script type="text/javascript"
|
||||
src="/resources/loops.js">
|
||||
</script>
|
||||
|
||||
<link rel="icon" type="image/png"
|
||||
href="/resources/favicon.png" />
|
||||
|
||||
<base href="AgentStart.html"/>
|
||||
</head>
|
||||
<nevow:invisible nevow:render="header_fragment" />
|
||||
|
||||
<body>
|
||||
<div class="body">
|
||||
<div id="global">
|
||||
<div class="top" style="padding: 5px">
|
||||
<img src="/resources/loops_logo.png" />
|
||||
</div>
|
||||
<div nevow:render="top_fragment">
|
||||
</div>
|
||||
|
||||
<div id="menu">
|
||||
|
||||
<div class="box">
|
||||
<h4>Navigation</h4>
|
||||
<div class="body">
|
||||
|
||||
<div class="content odd menu-1">
|
||||
<a href="http://localhost:8080" class="">Startpage</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-2">Agent configuration</div>
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/joboverview"
|
||||
class="">job overview</a>
|
||||
</div>
|
||||
|
||||
<div class="content even menu-3">
|
||||
<a href="http://localhost:8080/collectOutlookMails"
|
||||
class="">collect Outlook Mails</a>
|
||||
</div>
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/addjob"
|
||||
class="">add job</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="content odd menu-3">
|
||||
<a href="http://localhost:8080/loggingoptions" class=""
|
||||
title="">logging options</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div nevow:render="navigation_fragment">
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
@ -120,14 +63,7 @@
|
|||
<div id="sub-section" define-macro="sub-section">
|
||||
</div>
|
||||
|
||||
<div id="footer" class="footer" define-macro="footer">
|
||||
|
||||
© Copyright 2007, cyberconcepts IT-Consulting Dr. Helmut Merz
|
||||
(<a href="http://loops.cy55.de/impressum">Impressum</a>)<br />
|
||||
Powered by <b><a href="http://www.python.org">Python</a></b> ·
|
||||
<b><a href="http://wiki.zope.org/zope3">Zope 3</a></b> ·
|
||||
<b><a href="http://loops.cy55.de/projekte/loops">loops</a></b>.
|
||||
|
||||
<div nevow:render="footer_fragment">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
332
agent/ui/web.py
332
agent/ui/web.py
|
@ -5,15 +5,8 @@
|
|||
# version: 0.1
|
||||
#------------------------------------------------------
|
||||
|
||||
# one possibility is to always stay in the same class by calling its object instance as
|
||||
# a return value when returning from a methodCall'. But this would require to change the current
|
||||
# __init__ procedure so that the changes concerning the ini file are always directly written
|
||||
# to the file or there is a routine which starts one time to initialize (maybe for example reading the
|
||||
# whole ini File into the self.IniDict if it is not already filled and for each setting just chnaging the
|
||||
# self.IniDict
|
||||
|
||||
import os
|
||||
from nevow import loaders, rend, static, url, inevow
|
||||
from nevow import loaders, rend, static, url, inevow, tags
|
||||
from nevow.inevow import IRequest
|
||||
from twisted.internet import defer
|
||||
|
||||
|
@ -22,7 +15,6 @@ Import could look like this:
|
|||
from loops.agent.crawl.MailCrawler import MailCrawler
|
||||
"""
|
||||
|
||||
|
||||
# ---- global definitions ---------------------------------
|
||||
# THIS SECTION IS USED FOR PROJECT INTERNAL DEBUG ONLY
|
||||
INIFILE = "usermode.ini"
|
||||
|
@ -35,254 +27,308 @@ templatesDirectory = 'templates'
|
|||
def template(fn):
|
||||
return loaders.xmlfile(os.path.join(templatesDirectory, fn))
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#---------------------------- AgentHome --------------------------------------------------
|
||||
# AgentHome
|
||||
# root page of the Agent UI
|
||||
# every method called on the agent ui has it s child
|
||||
# method inside here
|
||||
|
||||
class AgentHome(rend.Page):
|
||||
|
||||
|
||||
child_resources = static.File(resourcesDirectory)
|
||||
docFactory = template('agent.html')
|
||||
|
||||
|
||||
def __init__(self,IniDict={}):
|
||||
|
||||
def __init__(self,ini_dict={}):
|
||||
|
||||
#TODO: implement automatic reading of default ini file, or one passed via constructor
|
||||
#-------- ini settings ------------------------
|
||||
# THIS SECTION IS USED FOR PROJECT INTERNAL DEBUG ONLY
|
||||
self.iniFile = INIFILE
|
||||
self.IniDict = IniDict
|
||||
self.ini_file = INIFILE
|
||||
self.ini_dict = ini_dict
|
||||
#-----------------------------------------------
|
||||
|
||||
#-------- get ini settings from file --------
|
||||
# stores IniFile settings in self.IniDict
|
||||
|
||||
if self.IniDict == {}:
|
||||
|
||||
fPointer = open(self.iniFile,"r")
|
||||
IniSettings = fPointer.readlines()
|
||||
|
||||
for iniLine in IniSettings:
|
||||
elem = iniLine.split(":")
|
||||
self.IniDict[elem[0]] = elem[1]
|
||||
|
||||
fPointer.close()
|
||||
|
||||
print "[AgentHome] self.UserMode: ", self.IniDict["UserMode"]
|
||||
if self.ini_dict == {}:
|
||||
|
||||
file_pointer = open(self.ini_file,"r")
|
||||
ini_settings = file_pointer.readlines()
|
||||
for ini_line in ini_settings:
|
||||
elem = ini_line.split(":")
|
||||
self.ini_dict[elem[0]] = elem[1]
|
||||
file_pointer.close()
|
||||
print "[AgentHome] self.UserMode: ", self.ini_dict["UserMode"]
|
||||
|
||||
"""
|
||||
def locateChild(self, ctx, segments):
|
||||
return self, ()
|
||||
"""
|
||||
# see nevow.url.py ?
|
||||
|
||||
#///////////////////////////////////////////////////////////////////
|
||||
#----------AgentHome: CHILD PAGES SECTION--------------------------------------
|
||||
# this code section contains all child methods that load
|
||||
# a new (html-) page
|
||||
|
||||
"""
|
||||
|
||||
# child pages
|
||||
|
||||
def child_joboverview(self,context):
|
||||
""" User requested page from menue: 'job overview' """
|
||||
return JobOverView(self.ini_dict)
|
||||
|
||||
""" User requested page from menue: "job overview" """
|
||||
return JobOverView(self.IniDict)
|
||||
|
||||
#//////////////////////////////////////////////////////////////////
|
||||
#--------AgentHome: CHILD METHODS SECTION-------------------------------------
|
||||
# this code section contains all form methods invoked in AgentHome
|
||||
# including their callback methods
|
||||
|
||||
#---- page "Startpage" methods (class AgentHome) ----
|
||||
# "Startpage" methods (class AgentHome)
|
||||
|
||||
def child_ChangeUserMode(self,context):
|
||||
|
||||
"""User has klicked the Change User Mode button
|
||||
"""User has klicked the Change User Mode button, so
|
||||
change UserMode from Simple <-> Professional"""
|
||||
|
||||
print "[child_ChangeUserMode] UserMode: ", self.IniDict["UserMode"]
|
||||
print "[child_ChangeUserMode] UserMode: ", self.ini_dict["UserMode"]
|
||||
print "[child_ChangeUserMode] ----retrieving form values----"
|
||||
|
||||
form = IRequest(context).args
|
||||
|
||||
if form != {}:
|
||||
|
||||
for elem in form:
|
||||
print "[child_ChangeUserMode] ", form[elem]
|
||||
|
||||
if self.IniDict["UserMode"] == "Simple":
|
||||
self.IniDict["UserMode"] = "Advanced"
|
||||
|
||||
if self.ini_dict["UserMode"] == "Simple":
|
||||
self.ini_dict["UserMode"] = "Advanced"
|
||||
else:
|
||||
self.IniDict["UserMode"] = "Simple"
|
||||
print "[child_ChangeUserMode] : ", self.IniDict["UserMode"]
|
||||
|
||||
"""
|
||||
Write changed setting back to the iniFile ?
|
||||
filePointer = open(self.iniFile,"rw")
|
||||
"""
|
||||
|
||||
return AgentHome(self.IniDict)
|
||||
|
||||
self.ini_dict["UserMode"] = "Simple"
|
||||
print "[child_ChangeUserMode] : ", self.ini_dict["UserMode"]
|
||||
return AgentHome(self.ini_dict)
|
||||
|
||||
def child_collectOutlookMails(self,context):
|
||||
|
||||
"""User requested page from menue: "Collect Outlook Mails" """
|
||||
|
||||
"""
|
||||
deferred = MailCrawler.getOutlookMails()
|
||||
deferred.addCallback(self.defMailCrawl,context)
|
||||
deferred.addErrback(self.defMailCrawlError,context)
|
||||
|
||||
return deferred
|
||||
"""
|
||||
return AgentOutlookMailView(self.ini_dict)
|
||||
|
||||
return AgentOutlookMailView(self.IniDict)
|
||||
|
||||
|
||||
|
||||
def defMailCrawl(self,MailCollection,context):
|
||||
|
||||
def defMailCrawl(self,mail_collection,context):
|
||||
"""here the returned collection is forwared to the page
|
||||
that is displaying it"""
|
||||
|
||||
return AgentOutlookMailView(self.IniDict,MailCollection)
|
||||
|
||||
that is displaying it"""
|
||||
return AgentOutlookMailView(self.ini_dict,mail_collection)
|
||||
|
||||
def defMailCrawlError(self,ErrorMessage,context):
|
||||
|
||||
"""handles errors that ocurred in the MailCrawler"""
|
||||
return AgentHome(self.ini_dict)
|
||||
|
||||
return AgentHome(self.IniDict)
|
||||
|
||||
|
||||
#---- page "job overview" methods (class JobOverView)----
|
||||
# "job overview" methods (class JobOverView)
|
||||
|
||||
def child_ViewJobDetails(self,context):
|
||||
|
||||
form = IRequest(context).args
|
||||
selectedJob = form['jobList'][0]
|
||||
selected_job = ((IRequest(context).uri).split("?"))[1]
|
||||
file_pointer = open(JOBFILE,"r")
|
||||
job_details = ""
|
||||
job_list = file_pointer.readlines()
|
||||
for line in job_list:
|
||||
if line.startswith(selected_job):
|
||||
job_details = line
|
||||
break
|
||||
file_pointer.close()
|
||||
job_details = job_details.split(";")
|
||||
return JobOverViewDetails(self.ini_dict, job_details)
|
||||
|
||||
return JobOverViewDetails(self.IniDict, selectedJob)
|
||||
|
||||
|
||||
#////////////////////////////////////////////////////////////
|
||||
#-------------AgentHome: RENDER SECTION------------------------
|
||||
# this code section contains the Nevow Rendering Methods
|
||||
# for building the page element tree
|
||||
# rendering methods of Startpage
|
||||
|
||||
def render_getActiveUserMode(self,context,data):
|
||||
return self.IniDict["UserMode"]
|
||||
|
||||
return self.ini_dict["UserMode"]
|
||||
|
||||
def render_getAgentVersion(self,context,data):
|
||||
return "0.1 alpha"
|
||||
|
||||
def render_footer_fragment(self,context,data):
|
||||
return context.tag[FooterFragment(data)]
|
||||
|
||||
def render_navigation_fragment(self,context,data):
|
||||
return context.tag[NavigationFragment(data)]
|
||||
|
||||
def render_top_fragment(self,context,data):
|
||||
return context.tag[TopFragment(data)]
|
||||
|
||||
def render_header_fragment(self,context,data):
|
||||
return context.tag[HeaderFragment(data)]
|
||||
|
||||
|
||||
class FooterFragment(rend.Fragment):
|
||||
docFactory = template('footer.html')
|
||||
|
||||
|
||||
class NavigationFragment(rend.Fragment):
|
||||
docFactory = template('navigation.html')
|
||||
|
||||
#///////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#----------------- PAGES SECTION -------------------------------------------------------------------------
|
||||
# all classes in this section are pages called via the navigation menue of AgentHome
|
||||
|
||||
class TopFragment(rend.Fragment):
|
||||
docFactory = template('top.html')
|
||||
|
||||
|
||||
class HeaderFragment(rend.Fragment):
|
||||
docFactory = template('header.html')
|
||||
|
||||
|
||||
# subpages of AgentHome
|
||||
|
||||
class JobOverView(rend.Page):
|
||||
|
||||
docFactory = template('joblisting.html')
|
||||
|
||||
def __init__(self, IniDict):
|
||||
def __init__(self, ini_dict):
|
||||
|
||||
self.IniSettings = IniDict
|
||||
|
||||
#-------------RENDER SECTION---------------------------------
|
||||
# this code section contains the Nevow Rendering Methods
|
||||
# for building the page element tree
|
||||
self.ini_settings = ini_dict
|
||||
|
||||
# rendering methods of job overview
|
||||
|
||||
def data_displayViewForm(self,context,data):
|
||||
return "Overview of all running Crawling jobs"
|
||||
|
||||
def render_getActiveUserMode(self,context,data):
|
||||
return self.IniSettings["UserMode"]
|
||||
return self.ini_settings["UserMode"]
|
||||
|
||||
def render_fillJobList(self,ctx,data):
|
||||
def render_fillJobTable(self,ctx,data):
|
||||
|
||||
#---- get the registered jobs from the jobfile ----
|
||||
#
|
||||
fpJobFile = open(JOBFILE,"r")
|
||||
lines = fpJobFile.readlines()
|
||||
fpJobFile.close()
|
||||
patternList = []
|
||||
gen_pattern = inevow.IQ(ctx).patternGenerator('optionsJobList')
|
||||
|
||||
# might later be implemented by reading in a xml file or
|
||||
# requesting registered jobs from database
|
||||
file_jobfile = open(JOBFILE,"r")
|
||||
lines = file_jobfile.readlines()
|
||||
file_jobfile.close()
|
||||
joblist = []
|
||||
for elem in lines:
|
||||
patternList.append(gen_pattern(data=elem))
|
||||
joblist.append(elem.split(";"))
|
||||
job_table = [tags.tr
|
||||
[
|
||||
tags.td
|
||||
[
|
||||
tags.a(href="ViewJobDetails?%s" %(job_details[0],))
|
||||
[
|
||||
tags.b
|
||||
[
|
||||
"[" + job_details[0] +"]"
|
||||
]
|
||||
]
|
||||
],
|
||||
tags.td[job_details[1]],
|
||||
tags.td[job_details[2]],
|
||||
tags.td[job_details[3]],
|
||||
tags.td[job_details[4]]
|
||||
]
|
||||
for job_details in joblist
|
||||
]
|
||||
return job_table
|
||||
|
||||
return patternList
|
||||
def render_footer_fragment(self,context,data):
|
||||
return context.tag[FooterFragment(data)]
|
||||
|
||||
def render_navigation_fragment(self,context,data):
|
||||
return context.tag[NavigationFragment(data)]
|
||||
|
||||
def render_top_fragment(self,context,data):
|
||||
return context.tag[TopFragment(data)]
|
||||
|
||||
def render_header_fragment(self,context,data):
|
||||
return context.tag[HeaderFragment(data)]
|
||||
|
||||
|
||||
class JobOverViewDetails(rend.Page):
|
||||
|
||||
docFactory = template('jobdetail.html')
|
||||
|
||||
def __init__(self, IniDict={}, selectedJob=""):
|
||||
def __init__(self, ini_dict={}, selectedJob=[]):
|
||||
|
||||
self.IniSettings = IniDict
|
||||
self.ini_settings = ini_dict
|
||||
self.jobdetails = selectedJob
|
||||
|
||||
|
||||
#-------------RENDER SECTION---------------------------------
|
||||
# this code section contains the Nevow Rendering Methods
|
||||
# for building the page element tree
|
||||
# rendering methods of job view details
|
||||
|
||||
def data_displayViewForm(self,context,data):
|
||||
return "Detailed view of crawling job."
|
||||
|
||||
def render_getActiveUserMode(self,context,data):
|
||||
return self.IniSettings["UserMode"]
|
||||
return self.ini_settings["UserMode"]
|
||||
|
||||
def render_displayJobDetails(self,ctx,data):
|
||||
|
||||
print "*******************************************************"
|
||||
print "[render_displayJobDetails] received form: ", str(self.jobdetails)
|
||||
print "[render_displayJobDetails] received IniForm: ", str(self.IniSettings)
|
||||
print "[render_displayJobDetails] received IniForm: ", str(self.ini_settings)
|
||||
print "*******************************************************"
|
||||
job_detail = []
|
||||
job_detail = [tags.tr
|
||||
[
|
||||
tags.td["PID"],
|
||||
tags.td[self.jobdetails[0]]
|
||||
],
|
||||
tags.tr
|
||||
[
|
||||
tags.td["State"],
|
||||
tags.td[self.jobdetails[1]]
|
||||
],
|
||||
tags.tr
|
||||
[
|
||||
tags.td["Interval"],
|
||||
tags.td[self.jobdetails[2]]
|
||||
],
|
||||
tags.tr
|
||||
[
|
||||
tags.td["Search Criteria"],
|
||||
tags.td[self.jobdetails[3]]
|
||||
],
|
||||
tags.tr
|
||||
[
|
||||
tags.td["Job Scope"],
|
||||
tags.td[self.jobdetails[4]]
|
||||
],
|
||||
tags.tr
|
||||
[
|
||||
tags.td["Filter"],
|
||||
tags.td[self.jobdetails[5]]
|
||||
],
|
||||
tags.tr
|
||||
[
|
||||
tags.td["Follow Up Tasks"],
|
||||
tags.td[self.jobdetails[6]]
|
||||
]
|
||||
]
|
||||
return job_detail
|
||||
|
||||
patternList = []
|
||||
gen_pattern = inevow.IQ(ctx).patternGenerator('jobDetails')
|
||||
def render_footer_fragment(self,context,data):
|
||||
return context.tag[FooterFragment(data)]
|
||||
|
||||
for elem in self.jobdetails:
|
||||
patternList.append(gen_pattern(data=elem))
|
||||
def render_navigation_fragment(self,context,data):
|
||||
return context.tag[NavigationFragment(data)]
|
||||
|
||||
return patternList
|
||||
def render_top_fragment(self,context,data):
|
||||
return context.tag[TopFragment(data)]
|
||||
|
||||
def render_header_fragment(self,context,data):
|
||||
return context.tag[HeaderFragment(data)]
|
||||
|
||||
|
||||
class AgentOutlookMailView(rend.Page):
|
||||
|
||||
docFactory = template('mail.html')
|
||||
|
||||
def __init__(self, IniDict={}, MailCollection=[]):
|
||||
def __init__(self, ini_dict={}, mail_collection=[]):
|
||||
|
||||
self.IniDict = IniDict
|
||||
self.MailCollection = MailCollection
|
||||
self.ini_dict = ini_dict
|
||||
self.mail_collection = mail_collection
|
||||
|
||||
#-------------RENDER SECTION---------------------------------
|
||||
# this code section contains the Nevow Rendering Methods
|
||||
# for building the page element tree
|
||||
# rendering methods of Collect Outlook Mails
|
||||
|
||||
def data_displayViewForm(self,context,data):
|
||||
return "Detailed view of all collected Outlook Mails. [DEMO]"
|
||||
|
||||
def render_getActiveUserMode(self,context,data):
|
||||
return self.IniDict["UserMode"]
|
||||
return self.ini_dict["UserMode"]
|
||||
|
||||
def render_displayOutlookMails(self,ctx,data):
|
||||
|
||||
patternList = []
|
||||
pattern_list = []
|
||||
gen_pattern = inevow.IQ(ctx).patternGenerator('OutlookMails')
|
||||
for elem in self.mail_collection:
|
||||
pattern_list.append(gen_pattern(data=elem))
|
||||
return pattern_list
|
||||
|
||||
for elem in self.MailCollection:
|
||||
patternList.append(gen_pattern(data=elem))
|
||||
def render_footer_fragment(self,context,data):
|
||||
return context.tag[FooterFragment(data)]
|
||||
|
||||
return patternList
|
||||
def render_navigation_fragment(self,context,data):
|
||||
return context.tag[NavigationFragment(data)]
|
||||
|
||||
def render_top_fragment(self,context,data):
|
||||
return context.tag[TopFragment(data)]
|
||||
|
||||
def render_header_fragment(self,context,data):
|
||||
return context.tag[HeaderFragment(data)]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue