Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-stable
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
emulab
emulab-stable
Commits
0c087d31
Commit
0c087d31
authored
Oct 28, 2014
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Delete(). Add GenerateID() for passing to the backend. Some
helper code to get values out of the data array.
parent
507aabeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
www/webtask.php
www/webtask.php
+24
-0
No files found.
www/webtask.php
View file @
0c087d31
...
...
@@ -24,6 +24,7 @@
#
class
WebTask
{
var
$webtask
;
var
$decoded
=
null
;
#
# Constructor by lookup on unique ID
...
...
@@ -72,6 +73,13 @@ class WebTask {
return
WebTask
::
Lookup
(
$idx
);
}
# We delete from the web interface.
function
Delete
()
{
$task_id
=
$this
->
task_id
();
DBQueryWarn
(
"delete from web_tasks where task_id='
$task_id
'"
);
return
0
;
}
# accessors
function
field
(
$name
)
{
return
(
is_null
(
$this
->
webtask
)
?
-
1
:
$this
->
webtask
[
$name
]);
...
...
@@ -96,6 +104,18 @@ class WebTask {
return
array
();
}
}
# Return a specific value from the data.
function
TaskValue
(
$key
)
{
if
(
$this
->
task_data
())
{
if
(
!
$this
->
decoded
)
{
$this
->
decoded
=
json_decode
(
$this
->
task_data
(),
true
);
}
if
(
array_key_exists
(
$key
,
$this
->
decoded
))
{
return
$this
->
decoded
[
$key
];
}
}
return
null
;
}
function
ValidTaskID
(
$id
)
{
if
(
preg_match
(
"/^[-\w]+$/"
,
$id
))
{
...
...
@@ -103,5 +123,9 @@ class WebTask {
}
return
FALSE
;
}
function
GenerateID
()
{
return
md5
(
uniqid
(
rand
(),
1
));
}
}
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment