From ff7f711104b19350f41313178f53ebfd022aba44 Mon Sep 17 00:00:00 2001 From: Karl Chen Date: Wed, 4 Feb 2004 01:21:51 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=2952 --- checkin_notes | 19 +++++ html/project.sample/project.inc | 72 +++++++++++++++++++ .../project.sample/project_specific_prefs.inc | 57 +++++++++++++++ py/Boinc/setup_project.py | 46 ++++++------ 4 files changed, 173 insertions(+), 21 deletions(-) create mode 100644 html/project.sample/project.inc create mode 100644 html/project.sample/project_specific_prefs.inc diff --git a/checkin_notes b/checkin_notes index 6f233d18a2..74b5ea1523 100755 --- a/checkin_notes +++ b/checkin_notes @@ -9696,3 +9696,22 @@ David Feb 3 2004 sched/ handle_request.C sched_config.C,h + +Karl 2004-02-03 + - updates for html directory structure change + + tools/ + make_project + + py/Boinc/ + setup_project.py + + html/ + project.sample/ (new directory) + project.inc (new) + project_specific_prefs.inc (new) + + html/ + user/ + project.inc.sample (removed) + project_specific_prefs.inc (removed) diff --git a/html/project.sample/project.inc b/html/project.sample/project.inc new file mode 100644 index 0000000000..75f478e9c8 --- /dev/null +++ b/html/project.sample/project.inc @@ -0,0 +1,72 @@ +

".PROJECT."

\n"); + if ($user) { + write_fd($fd, "Logged in as $user->name"); + } else { + write_fd($fd, "
"); + } + write_fd($fd, "
\n"); +} + +// NOTE: These functions appear here and not in profile.inc because they contain +// project-specific information that needs to be set by the project administrators. + +function show_profile_heading1() { + row1("Your personal background."); +} + +function show_profile_question1() { + rowify(" + Tell us about yourself. + You could tell us where you're from, your age, occupation, hobbies, + or anything else about yourself. + HTML formatting tags are allowed (other tags will be removed), + and responses are limited to 2000 characters. + "); +} + +function show_profile_heading2() { + row1("Your opinions about " . PROJECT); +} + +function show_profile_question2() { + rowify(" +Tell us your thoughts about " . PROJECT . "
    +
  1. Why do you run " . PROJECT . "? +
  2. What are your views about the project? +
  3. Any suggestions? +
+"); +} + +function project_news() { + echo "No news is good news\n"; +} + +?> diff --git a/html/project.sample/project_specific_prefs.inc b/html/project.sample/project_specific_prefs.inc new file mode 100644 index 0000000000..0c5ed8f253 --- /dev/null +++ b/html/project.sample/project_specific_prefs.inc @@ -0,0 +1,57 @@ +$name\n"; +} + +function project_specific_prefs_default() { + return "Tahiti Sunset\n"; +} + +// given struct, show form for editing +// +function project_specific_prefs_edit($prefs) { + $x = $prefs->color_scheme; + $y = " + "; + row2("Color scheme", $y); +} + +// Return XML version of project-specific prefs +// +function project_specific_prefs_parse_form() { + $color_scheme = $_GET["color_scheme"]; + return "$color_scheme\n"; +} + +// show non-editable version of prefs +// +function project_specific_prefs_show($prefs) { + if ($prefs->color_scheme) { + $x = $prefs->color_scheme; + } else { + $x = "None selected"; + } + row2("Color scheme", $x); +} + +// parse XML, fill in struct +// +function project_specific_prefs_parse($prefs_xml) { + $prefs->color_scheme = parse_element($prefs_xml, ""); + return $prefs; +} diff --git a/py/Boinc/setup_project.py b/py/Boinc/setup_project.py index d3a4f01caf..6dcd4da686 100644 --- a/py/Boinc/setup_project.py +++ b/py/Boinc/setup_project.py @@ -260,12 +260,14 @@ def install_boinc_files(dest_dir): def dir(*dirs): return apply(os.path.join,(dest_dir,)+dirs) - install_glob(srcdir('html_user/*.php'), dir('html_user/')) - install_glob(srcdir('html_user/*.inc'), dir('html_user/')) - install_glob(srcdir('html_user/class/*.inc'), dir('html_user/class/')) - install_glob(srcdir('html_user/include/*.inc'), dir('html_user/include/')) - install_glob(srcdir('html_ops/*.php'), dir('html_ops/')) - install_glob(srcdir('html_ops/*.inc'), dir('html_ops/')) + install_glob(srcdir('html/forum/*.php'), dir('html/forum/')) + install_glob(srcdir('html/inc/*.inc'), dir('html/inc/')) + install_glob(srcdir('html/ops/*.php'), dir('html/ops/')) + install_glob(srcdir('html/ops/*.inc'), dir('html/ops/')) + install_glob(srcdir('html/user/*.php'), dir('html/user/')) + install_glob(srcdir('html/user/*.inc'), dir('html/user/')) + install_glob(srcdir('html/user/*.css'), dir('html/user/')) + install_glob(srcdir('html/user/*.txt'), dir('html/user/')) # copy all the backend programs map(lambda (s): install(builddir('sched',s), dir('cgi-bin',s)), @@ -316,8 +318,8 @@ class Project: if production: config.one_result_per_user_per_wu = '1' self.scheduler_url = os.path.join(config.cgi_url , 'cgi') - self.project_php_file = srcdir('html_user/project.inc.sample') - self.project_specific_prefs_php_file = srcdir('html_user/project_specific_prefs.inc.sample') + self.project_php_file = srcdir('html/user/project.inc.sample') + self.project_specific_prefs_php_file = srcdir('html/user/project_specific_prefs.inc.sample') def dir(self, *dirs): @@ -359,8 +361,8 @@ class Project: # req/reply files somewhere else map(lambda dir: os.mkdir(self.dir(dir)), [ '', 'cgi-bin', 'bin', 'upload', 'download', 'apps', self.logdir(), - 'html_ops', 'html_user', 'html_user/project_specific', - 'html_user/class', 'html_user/include' + 'html', 'html/ops', 'html/user', 'html/project', + 'html/inc', 'html/stats', 'html/user_profile' ]) map(lambda dir: os.chmod(self.dir(dir), 0777), [ 'cgi-bin', 'upload', self.logdir() ]) @@ -378,13 +380,15 @@ class Project: install_boinc_files(self.dir()) - install_glob(srcdir('html_user/*.txt'), self.dir('html_user/')) install(self.project_php_file, - self.dir('html_user', 'project_specific', 'project.inc')) + self.dir('html', 'project', 'project.inc')) install(self.project_specific_prefs_php_file, - self.dir('html_user', 'project_specific', 'project_specific_prefs.inc')) + self.dir('html', 'project', 'project_specific_prefs.inc')) - my_symlink(self.config.config.download_dir, self.dir('html_user', 'download')) + my_symlink(self.config.config.download_dir, self.dir('html', 'user', 'download')) + my_symlink('../forum', self.dir('html/user/forum')) + my_symlink('../stats', self.dir('html/user/stats')) + my_symlink('../user_profile', self.dir('html/user/user_profile')) # Copy the sched server in the cgi directory with the cgi names given @@ -393,7 +397,7 @@ class Project: if scheduler_file: r = re.compile('([^<]+)', re.IGNORECASE) - f = open(self.dir('html_user', scheduler_file)) + f = open(self.dir('html/user', scheduler_file)) for line in f: # not sure if this is what the scheduler file is supposed to # mean @@ -405,7 +409,7 @@ class Project: f.close() else: scheduler_file = 'schedulers.txt' - f = open(self.dir('html_user', scheduler_file), 'w') + f = open(self.dir('html/user', scheduler_file), 'w') print >>f, "" + self.scheduler_url.strip(), "" f.close() @@ -426,13 +430,13 @@ class Project: if options.__dict__.get('cgi_dir'): force_symlink(self.dir('cgi-bin'), os.path.join(options.cgi_dir, self.short_name)) if options.__dict__.get('html_dir'): - force_symlink(self.dir('html_user'), os.path.join(options.html_dir, self.short_name)) - force_symlink(self.dir('html_ops'), os.path.join(options.html_dir, self.short_name+'_admin')) + force_symlink(self.dir('html/user'), os.path.join(options.html_dir, self.short_name)) + force_symlink(self.dir('html/ops'), os.path.join(options.html_dir, self.short_name+'_admin')) def http_password(self, user, password): - 'Adds http password protection to the html_ops directory' - passwd_file = self.dir('html_ops', '.htpassword') - f = open(self.dir('html_ops', '.htaccess'), 'w') + 'Adds http password protection to the html/ops directory' + passwd_file = self.dir('html/ops', '.htpassword') + f = open(self.dir('html/ops', '.htaccess'), 'w') print >>f, "AuthName '%s Administration'" % self.long_name print >>f, "AuthType Basic" print >>f, "AuthUserFile %s" % passwd_file