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
6744cb66
Commit
6744cb66
authored
Jul 20, 2007
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up the cvsweb code that had bitrotted, and hook in the template
cvs repo from the template show page.
parent
e9f64cc2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
116 deletions
+61
-116
www/cvsweb/cvsweb.cgi
www/cvsweb/cvsweb.cgi
+2
-2
www/cvsweb/cvsweb.php3
www/cvsweb/cvsweb.php3
+24
-93
www/cvsweb/cvswebwrap.php3
www/cvsweb/cvswebwrap.php3
+21
-20
www/template_defs.php
www/template_defs.php
+10
-1
www/template_show.php
www/template_show.php
+3
-0
www/url_defs.php
www/url_defs.php
+1
-0
No files found.
www/cvsweb/cvsweb.cgi
View file @
6744cb66
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
# SUCH DAMAGE.
# SUCH DAMAGE.
#
#
# $FreeBSD: projects/cvsweb/cvsweb.cgi,v 1.119.2.6 2002/09/26 20:56:05 scop Exp $
# $FreeBSD: projects/cvsweb/cvsweb.cgi,v 1.119.2.6 2002/09/26 20:56:05 scop Exp $
# $Id: cvsweb.cgi,v 1.
9 2007-04-07 05:39:29 johnsond
Exp $
# $Id: cvsweb.cgi,v 1.
10 2007-07-20 18:52:07 stoller
Exp $
# $Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.84 2001/10/07 20:50:10 knu Exp $
# $Idaemons: /home/cvs/cvsweb/cvsweb.cgi,v 1.84 2001/10/07 20:50:10 knu Exp $
#
#
###
###
...
@@ -312,7 +312,7 @@ $maycompress =
...
@@ -312,7 +312,7 @@ $maycompress =
# their current value) to any link/query string
# their current value) to any link/query string
# you construct
# you construct
@stickyvars = qw(cvsroot hideattic sortby logsort f only_with_tag
@stickyvars = qw(cvsroot hideattic sortby logsort f only_with_tag
pid eid exptidx);
pid eid exptidx
guid version
);
@unsafevars = qw(logsort only_with_tag r1 r2 rev sortby tr1 tr2);
@unsafevars = qw(logsort only_with_tag r1 r2 rev sortby tr1 tr2);
if (-f $config) {
if (-f $config) {
...
...
www/cvsweb/cvsweb.php3
View file @
6744cb66
...
@@ -32,9 +32,7 @@ $use_viewvc = 0;
...
@@ -32,9 +32,7 @@ $use_viewvc = 0;
#
#
# Verify form arguments.
# Verify form arguments.
#
#
$optargs
=
OptionalPageArguments
(
"experiment"
,
PAGEARG_EXPERIMENT
,
$optargs
=
OptionalPageArguments
(
"template"
,
PAGEARG_TEMPLATE
,
"instance"
,
PAGEARG_INSTANCE
,
"template"
,
PAGEARG_TEMPLATE
,
"project"
,
PAGEARG_PROJECT
,
"project"
,
PAGEARG_PROJECT
,
"embedded"
,
PAGEARG_BOOLEAN
);
"embedded"
,
PAGEARG_BOOLEAN
);
if
(
!
isset
(
$embedded
))
{
if
(
!
isset
(
$embedded
))
{
...
@@ -57,111 +55,44 @@ if (isset($project)) {
...
@@ -57,111 +55,44 @@ if (isset($project)) {
header
(
"Location:
$url
"
);
header
(
"Location:
$url
"
);
return
;
return
;
}
}
if
(
isset
(
$experiment
))
{
#
#
# Authenticated access to the project repo.
# Wants access to the experiment archive, which is really a repo.
#
#
if
(
!
ISADMIN
()
&&
$pid
=
$experiment
->
pid
();
!
$project
->
AccessCheck
(
$this_user
,
$TB_PROJECT_READINFO
))
{
$eid
=
$experiment
->
eid
();
# Then check to see if the project cvs repo is public.
if
(
!
ISADMIN
()
&&
!
$experiment
->
AccessCheck
(
$this_user
,
$TB_EXPT_READINFO
))
{
USERERROR
(
"Not enough permission to view '
$pid
/
$eid
'"
,
1
);
}
# Get the repo index for the experiment.
$query_result
=
$query_result
=
DBQueryFatal
(
"select s.archive_idx from experiments as e "
.
DBQueryFatal
(
"select cvsrepo_public from projects "
.
"left join experiment_stats as s on s.exptidx=e.idx "
.
"where pid='
$pid
'"
);
"where e.pid='
$pid
' and e.eid='
$eid
'"
);
if
(
!
mysql_num_rows
(
$query_result
))
{
if
(
!
mysql_num_rows
(
$query_result
))
{
TBERROR
(
"Error getting
repo index for '
$pid
/
$eid
'
"
,
1
);
TBERROR
(
"Error getting
cvsrepo_public bit
"
,
1
);
}
}
$row
=
mysql_fetch_array
(
$query_result
);
$row
=
mysql_fetch_array
(
$query_result
);
if
(
!
isset
(
$row
[
0
]))
{
if
(
$row
[
0
]
==
0
)
{
TBERROR
(
"Error getting repo index for '
$pid
/
$eid
'"
,
1
);
USERERROR
(
"You are not a member of Project
$pid
."
,
1
);
}
$repoidx
=
$row
[
0
];
$repodir
=
"/usr/testbed/exparchive/
$repoidx
/repo/"
;
$use_viewvc
=
1
;
}
else
{
#
# Wants access to the project repo.
#
if
(
!
ISADMIN
()
&&
!
$project
->
AccessCheck
(
$this_user
,
$TB_PROJECT_READINFO
))
{
# Then check to see if the project cvs repo is public.
$query_result
=
DBQueryFatal
(
"select cvsrepo_public from projects "
.
"where pid='
$pid
'"
);
if
(
!
mysql_num_rows
(
$query_result
))
{
TBERROR
(
"Error getting cvsrepo_public bit"
,
1
);
}
$row
=
mysql_fetch_array
(
$query_result
);
if
(
$row
[
0
]
==
0
)
{
USERERROR
(
"You are not a member of Project
$pid
."
,
1
);
}
}
}
$repodir
=
"
$TBCVSREPO_DIR
/
$pid
"
;
}
}
$repodir
=
"
$TBCVSREPO_DIR
/
$pid
"
;
}
}
elseif
(
isset
(
$
experiment
)
||
isset
(
$instance
)
||
isset
(
$
template
))
{
elseif
(
isset
(
$template
))
{
if
(
!
$CVSSUPPORT
)
{
if
(
!
$CVSSUPPORT
)
{
USERERROR
(
"Project CVS support is not enabled!"
,
1
);
USERERROR
(
"Project CVS support is not enabled!"
,
1
);
}
}
# Must be logged in for this!
# Must be logged in for this!
if
(
$this_user
)
{
$this_user
=
CheckLoginOrDie
();
CheckLoginOrDie
();
}
if
(
isset
(
$template
))
{
$guid
=
$template
->
guid
();
$experiment
=
$template
->
GetExperiment
();
$vers
=
$template
->
vers
();
}
$pid
=
$template
->
pid
();
$project
=
$template
->
GetProject
();
if
(
isset
(
$instance
))
{
$pid
=
$instance
->
pid
();
$eid
=
$instance
->
eid
();
$idx
=
$instance
->
exptidx
();
$project
=
$instance
->
Project
();
}
else
{
$pid
=
$experiment
->
pid
();
$eid
=
$experiment
->
eid
();
$idx
=
$experiment
->
idx
();
$project
=
$experiment
->
Project
();
}
# Need the pid/eid/gid. Access the stats table since we want to provide
# cvs access to terminated experiments via the archive.
$query_result
=
DBQueryFatal
(
"select s.archive_idx,a.archived "
.
" from experiment_stats as s "
.
"left join archives as a on a.idx=s.archive_idx "
.
"where s.exptidx='
$idx
'"
);
if
(
!
mysql_num_rows
(
$query_result
))
{
USERERROR
(
"Experiment '
$idx
' is not a valid experiment"
,
1
);
}
$row
=
mysql_fetch_array
(
$query_result
);
$repoidx
=
$row
[
0
];
$archived
=
$row
[
1
];
# Lets do group level check since it might not be a current experiment.
if
(
!
ISADMIN
()
&&
if
(
!
$archived
)
{
!
$project
->
AccessCheck
(
$this_user
,
$TB_PROJECT_READINFO
))
{
if
(
!
ISADMIN
()
&&
USERERROR
(
"Not enough permission to view cvs repo for template"
,
1
);
!
$project
->
AccessCheck
(
$this_user
,
$TB_PROJECT_READINFO
))
{
USERERROR
(
"Not enough permission to view archive"
,
1
);
}
$repodir
=
"/usr/testbed/exparchive/
$repoidx
/repo/"
;
}
else
{
if
(
!
ISADMIN
())
{
USERERROR
(
"Must be administrator to view historical archives!"
,
1
);
}
$repodir
=
"/usr/testbed/exparchive/Archive/
$repoidx
/repo/"
;
}
}
$use_viewvc
=
1
;
# Repo for the entire template stored here per-template.
$repodir
=
"
$TBPROJ_DIR
/
$pid
/templates/
$guid
/cvsrepo/
$guid
"
;
}
}
else
{
else
{
$this_user
=
CheckLoginOrDie
();
$this_user
=
CheckLoginOrDie
();
...
...
www/cvsweb/cvswebwrap.php3
View file @
6744cb66
...
@@ -11,16 +11,21 @@
...
@@ -11,16 +11,21 @@
chdir
(
"../"
);
chdir
(
"../"
);
require
(
"defs.php3"
);
require
(
"defs.php3"
);
#
# Make sure that URL args are cleaned.
#
RequiredPageArguments
();
# Must be logged in.
# Must be logged in.
$this_user
=
CheckLoginOrDie
();
$this_user
=
CheckLoginOrDie
();
$uid
=
$this_user
->
uid
();
$uid
=
$this_user
->
uid
();
$isadmin
=
ISADMIN
();
$isadmin
=
ISADMIN
();
#
# Verify form arguments.
#
$optargs
=
OptionalPageArguments
(
"template"
,
PAGEARG_TEMPLATE
,
"project"
,
PAGEARG_PROJECT
,
"embedded"
,
PAGEARG_BOOLEAN
);
if
(
!
isset
(
$embedded
))
{
$embedded
=
0
;
}
#
#
# Form the real url.
# Form the real url.
#
#
...
@@ -32,24 +37,20 @@ $newurl = preg_replace("/php3/","php3/",$newurl);
...
@@ -32,24 +37,20 @@ $newurl = preg_replace("/php3/","php3/",$newurl);
#
#
PAGEHEADER
(
"Emulab CVS Repository"
);
PAGEHEADER
(
"Emulab CVS Repository"
);
?>
if
(
isset
(
$project
))
{
;
<head>
}
<style
type=
"text/css"
>
elseif
(
isset
(
$template
))
{
echo
$template
->
PageHeader
();
#cvsfr
{
width
:
100%
;
height
:
800px
;
}
}
</style>
echo
"<div><iframe src='
$newurl
' class='outputframe' "
.
</head>
"id='outputframe' name='outputframe'></iframe></div>
\n
"
;
echo
"</center><br>
\n
"
;
<div
id=
"cvscon"
>
<iframe
id=
"cvsfr"
scrolling=
yes
src=
"
<?php
echo
$newurl
?>
"
border=
0
></iframe>
</div>
<?php
echo
"<script type='text/javascript' language='javascript'>
\n
"
;
echo
"SetupOutputArea('outputframe', false);
\n
"
;
echo
"</script>
\n
"
;
#
#
# Standard Testbed Footer
# Standard Testbed Footer
...
...
www/template_defs.php
View file @
6744cb66
...
@@ -167,6 +167,15 @@ class Template
...
@@ -167,6 +167,15 @@ class Template
return
$this
->
experiment
;
return
$this
->
experiment
;
}
}
function
GetProject
()
{
$pid
=
$this
->
pid
();
if
(
!
(
$project
=
Project
::
Lookup
(
$pid
)))
{
TBERROR
(
"Could not lookup project
$pid
!"
,
1
);
}
return
$project
;
}
# Return the unixgid for operating on this template.
# Return the unixgid for operating on this template.
function
UnixGID
()
{
function
UnixGID
()
{
$experiment
=
$this
->
experiment
;
$experiment
=
$this
->
experiment
;
...
@@ -2282,7 +2291,7 @@ function MakeLink($which, $args, $text)
...
@@ -2282,7 +2291,7 @@ function MakeLink($which, $args, $text)
$page
=
"showuser.php3"
;
$page
=
"showuser.php3"
;
}
}
elseif
(
$which
==
"template"
)
{
elseif
(
$which
==
"template"
)
{
$page
=
"template_show.php"
;
$page
=
"
/
template_show.php"
;
}
}
elseif
(
$which
==
"metadata"
)
{
elseif
(
$which
==
"metadata"
)
{
$page
=
"template_metadata.php"
;
$page
=
"template_metadata.php"
;
...
...
www/template_show.php
View file @
6744cb66
...
@@ -323,6 +323,9 @@ if ($template->EventCount() > 0) {
...
@@ -323,6 +323,9 @@ if ($template->EventCount() > 0) {
WRITESUBMENUBUTTON
(
"Browse Datastore"
,
WRITESUBMENUBUTTON
(
"Browse Datastore"
,
CreateURL
(
"archive_view"
,
$template
));
CreateURL
(
"archive_view"
,
$template
));
WRITESUBMENUBUTTON
(
"Browse CVS Repository"
,
CreateURL
(
"cvswebwrap"
,
$template
));
WRITESUBMENUBUTTON
(
"View Records"
,
WRITESUBMENUBUTTON
(
"View Records"
,
CreateURL
(
"template_history"
,
$template
));
CreateURL
(
"template_history"
,
$template
));
...
...
www/url_defs.php
View file @
6744cb66
...
@@ -105,6 +105,7 @@ $url_mapping["spitreport"] = "spitreport.php";
...
@@ -105,6 +105,7 @@ $url_mapping["spitreport"] = "spitreport.php";
$url_mapping
[
"statechange"
]
=
"statechange.php"
;
$url_mapping
[
"statechange"
]
=
"statechange.php"
;
$url_mapping
[
"experimentrun_show"
]
=
"experimentrun_show.php"
;
$url_mapping
[
"experimentrun_show"
]
=
"experimentrun_show.php"
;
$url_mapping
[
"instance_show"
]
=
"instance_show.php"
;
$url_mapping
[
"instance_show"
]
=
"instance_show.php"
;
$url_mapping
[
"cvswebwrap"
]
=
"cvsweb/cvswebwrap.php3"
;
#
#
# The caller will pass in a page id, and a list of things. If the thing
# The caller will pass in a page id, and a list of things. If the thing
...
...
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