Project

General

Profile

autoupdate.full.withcheckbox.diff

full copy of the patch against the svn version with the check box added - prmarino1-gmail-com -, 07/07/2007 01:15 AM

Download (7.64 KB)

View differences:

prewikka/htdocs/js/functions.js 2007-07-06 17:42:17.000000000 -0400
58 58
 		}
59 59
 	}
60 60
}
61
var secondcounter="0"
62

  
63
function autoapplytime(){
64
	if (document.viewfilter && document.viewfilter.auto_apply.value){
65
		var rawtime=document.viewfilter.auto_apply.value;
66
	}
67
	else{
68
		var rawtime="0:00";
69
	}
70
	if (document.images){
71
		var parselimit=rawtime.split(":");
72
		if (parselimit[0] && parselimit[1] &&parselimit[2]){
73
			secondcounter=parselimit[0]*3600+parselimit[1]*60+parselimit[2]*1;
74
		}
75
		else if (parselimit[0] && parselimit[1]){
76
			secondcounter=parselimit[0]*60+parselimit[1]*1;
77
		}
78
		else{
79
			secondcounter=rawtime
80
		}
81
	}
82
}
83

  
84
function autoapplycounter(){
85
	if (!document.images)
86
		return;
87
	if (secondcounter==0)
88
		return;
89
	if (eval("document.viewfilter.auto_apply_enable_check.checked") == false){
90
		curmin=Math.floor(secondcounter/60)
91
		cursec=secondcounter%60
92
		if (curmin!=0)
93
			curtime="Paused Auto Update with  "+curmin+" minutes and "+cursec+" seconds remaining on the timer!"
94
		else
95
			curtime="Paused Auto Update with "+cursec+" seconds remaining on the timer!"
96
			window.status=curtime
97
			setTimeout("autoapplycounter()",1000)
98
		return;
99
	    
100
	}
101
	else if (secondcounter==1){
102
		var yaxis = "0";
103
		if (window.pageYOffset){
104
			yaxis = window.pageYOffset;
105
		}
106
		else if (window.documentElement && window.documentElement.scrollTop){
107
			yaxis = window.documentElement.scrollTop;
108
		}
109
		else if (document.body.scrollTop){
110
			yaxis = window.body.scrollTop;
111
		}
112
		//alert("yaxis "+ yaxis);
113
		document.viewfilter.yaxis.value=yaxis;
114
		//alert("yaxis is set to" + document.viewfilter.yaxis.value );
115
		document.viewfilter.submit("Apply")
116
	}
117
	else{ 
118
		secondcounter-=1
119
		curmin=Math.floor(secondcounter/60)
120
		cursec=secondcounter%60
121
		if (curmin!=0)
122
			curtime="This Page will Auto Update in "+curmin+" minutes and "+cursec+" seconds!"
123
		else
124
			curtime="This Page will Auto Update in "+cursec+" seconds!"
125
			window.status=curtime
126
			setTimeout("autoapplycounter()",1000)
127
	}
128
}
129

  
130

  
131
function setscrollbar(){
132
	//beginautoapply();
133
	if (document.viewfilter.yaxis.value){
134
		//alert("yaxis detecting last known scroll " + document.viewfilter.yaxis.value);
135
		var setyaxis=document.viewfilter.yaxis.value;
136
		window.scrollTo('0',setyaxis) ;
137
		document.viewfilter.yaxis.value="0";
138
		return
139
	}
140
	else{
141
		//alert("no yaxis")
142
		return
143
	}
144

  
145
}
146
function beginautoapply(){
147
	if (document.viewfilter){
148
		setscrollbar()
149
		autoapplytime()
150
		autoapplycounter()
151
	}
152

  
153
}
154

  
prewikka/prewikka/templates/MessageListing.tmpl 2007-07-06 18:57:42.000000000 -0400
2 2
#extends prewikka.templates.ClassicLayout
3 3

  
4 4
#def layout_start_hook
5
<form method="post" action="?">
5
<script type="text/javascript">
6

  
7
<!--
8
 function settimer(){
9
    if (eval("document.viewfilter.auto_apply_enable_check.checked") == true){
10
	document.viewfilter.auto_apply_enable.value="checked"
11
    }
12
    else{
13
	document.viewfilter.auto_apply_enable.value="paused"
14
    }
15
 }
16

  
17
//--></script> 
18
<form name="viewfilter" method="post" action="?">
6 19
#for $name, $value in $hidden_parameters
7 20
  <input type="hidden" name="$name" value="$value"/>
8 21
#end for
......
98 111
    <input id="timeline_limit_value" type="text" size="2" name="limit" value="$limit"/>
99 112
   </td>
100 113
  </tr>
114
  
115
  <tr>
116
    <th id="auto_apply_label">$_("Auto Update Time")</th>
101 117

  
118
    <td colspan="2">
119
     <input id="autoapply_value" type="text" size="2" name="auto_apply" value="$auto_apply"/>
120
    </td>
121
    <th id="auto_apply_enabled_label">$_("Enabled")</th>
122
    <td colspan="2">
123
    #if $auto_apply_enable == "checked"
124
	#set $enabled="checked=checked"
125
    #else:
126
	#set $enabled=""
127
    #end if
128
     <input class="checkbox" type="checkbox" id="autoapply_enable_check_value" name="auto_apply_enable_check" "$enabled" onclick=settimer() />
129
    </td>
130
  </tr>
131
 
102 132
  <tr style="text-align: center;">
103 133
      <td colspan=3><input type="submit" name="apply" value="$_("Apply")" />
104 134
      <input type="submit" name="_save" value="$_("Save")" /></td>
prewikka/prewikka/templates/TopLayout.tmpl 2007-07-06 17:39:38.000000000 -0400
4 4
#end def
5 5

  
6 6
#block body
7
<body class="$body_class">
7
<body class="$body_class" onload="beginautoapply()"
8 8
	<div id="top_view">
9 9
		<div id="top_view_header">
10 10
			<div id="top_view_header_software">$prewikka.software</div>
prewikka/prewikka/views/alertlisting.py 2007-07-05 20:53:45.000000000 -0400
1097 1097
        self.dataset["nav.from"] = self.parameters["offset"] + 1
1098 1098
        self.dataset["nav.to"] = self.parameters["offset"] + len(self.dataset["messages"])
1099 1099
        self.dataset["limit"] = self.parameters["limit"]
1100
	self.dataset["auto_apply"] = self.parameters["auto_apply"]
1101
	self.dataset["auto_apply_enable"] = self.parameters["auto_apply_enable"]
1100 1102
        self.dataset["total"] = total
1101 1103
        self.dataset["correlation_alert_view"] = False
1102 1104

  
prewikka/prewikka/views/messagelisting.py 2007-07-06 19:07:37.000000000 -0400
108 108
        self.optional("timezone", str, "frontend_localtime", save=True)
109 109
        self.optional("delete", list, [ ])
110 110
        self.optional("apply", str)
111
	self.optional("auto_apply", str,default="0:00", save=True)
112
	self.optional("auto_apply_enable",str, default="checked", save=True)
111 113
        
112 114
        # submit with an image passes the x and y coordinate values
113 115
        # where the image was clicked
......
215 217
        self.dataset["hidden_parameters"] = [ [ "view", self.view_name ] ]
216 218
        if self.parameters.has_key("timeline_end"):
217 219
            self.dataset["hidden_parameters"].append(("timeline_end", self.parameters["timeline_end"]))
220
	if self.parameters.has_key("yaxis"):
221
	    self.dataset["hidden_parameters"].append(("yaxis", self.parameters["yaxis"]))
222
	else:
223
	    self.dataset["hidden_parameters"].append(("yaxis", 0))
224
	if self.parameters.has_key("auto_apply_enable"):
225
	    self.dataset["hidden_parameters"].append(("auto_apply_enable", self.parameters["auto_apply_enable"]))
226
	else:
227
	    self.dataset["hidden_parameters"].append(("auto_apply_enable", "checked"))
228

  
229
    def _autoapply(self):
230
	if self.parameters.has_key("autoapply"):
231
	    self.dataset["auto.apply"] = [ [ "auto_apply", self.parameters["auto_apply"] ] ]
232
	else:
233
	    self.dataset["auto.apply"] = [ [ "auto_apply", "0:00" ] ]
218 234

  
219 235
    def _setTimelineNext(self, next):
220 236
        parameters = self.parameters - [ "offset" ] + { "timeline_end": int(next) }
......
223 239
    def _setTimelinePrev(self, prev):
224 240
        parameters = self.parameters - [ "offset" ] + { "timeline_end": int(prev) }
225 241
        self.dataset["timeline.prev"] = utils.create_link(self.view_name, parameters)
226
        
242

  
227 243
    def _getTimelineRange(self):
228 244
        if self.parameters.has_key("timeline_start"):  
229 245
            start = _MyTime(self.parameters["timeline_start"])