summaryrefslogtreecommitdiff
path: root/lab_migration.module
diff options
context:
space:
mode:
Diffstat (limited to 'lab_migration.module')
-rwxr-xr-xlab_migration.module293
1 files changed, 23 insertions, 270 deletions
diff --git a/lab_migration.module b/lab_migration.module
index 40327f4..fc7be3a 100755
--- a/lab_migration.module
+++ b/lab_migration.module
@@ -1,6 +1,8 @@
<?php
// $Id$
+require_once('general_deletion.inc');
+
/**
* Implementation of hook_menu().
*/
@@ -17,48 +19,7 @@ function lab_migration_menu()
'type' => MENU_NORMAL_ITEM,
'file' => 'proposal.inc',
);
-/*
- $items['lab_migration/experiment'] = array(
- 'title' => 'Lab Migration Experiment',
- 'description' => 'Lab Migration Experiment',
- 'page callback' => 'lab_migration_experiment_list',
- 'access arguments' => array('create proposal'),
- 'file' => 'experiment.inc',
- );
- $items['lab_migration/experiment/add'] = array(
- 'title' => 'Lab Migration Experiment',
- 'description' => 'Lab Migration Experiment',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('lab_migration_experiment_add_form'),
- 'access arguments' => array('create proposal'),
- 'file' => 'experiment.inc',
- );
- $items['lab_migration/experiment/edit'] = array(
- 'title' => 'Lab Migration Experiment',
- 'description' => 'Lab Migration Experiment',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('lab_migration_experiment_edit_form'),
- 'access arguments' => array('create proposal'),
- 'file' => 'experiment.inc',
- );
- $items['lab_migration/experiment/delete'] = array(
- 'title' => 'Lab Migration Experiment',
- 'description' => 'Lab Migration Experiment',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('lab_migration_experiment_delete_form'),
- 'access arguments' => array('create proposal'),
- 'file' => 'experiment.inc',
- ); */
- $items['lab_migration/labs'] = array(
- 'title' => 'Migrated Labs',
- 'description' => 'Migrated Labs',
- 'page callback' => 'migrated_labs',
- 'access arguments' => array('access content'),
- 'type' => MENU_NORMAL_ITEM,
- 'file' => 'migrated_labs.inc',
- );
-
/* for reviewers */
$items['lab_migration/manage_proposal'] = array(
'title' => 'Manage Lab Migration',
@@ -117,7 +78,6 @@ function lab_migration_menu()
'type' => MENU_CALLBACK,
'file' => 'manage_proposal.inc',
);
-
$items['lab_migration/manage_proposal/approve'] = array(
'title' => 'Approve Proposal',
'description' => 'Approve Proposal',
@@ -157,81 +117,33 @@ function lab_migration_menu()
'file' => 'settings.inc',
);
- return $items;
-
- $items['code_approval'] = array(
- 'title' => 'Manage Code Approval',
- 'description' => 'Manage Code Approval',
- 'page callback' => 'code_approval',
- 'access arguments' => array('approve code'),
- 'type' => MENU_NORMAL_ITEM,
- 'file' => 'code_approval.inc',
- );
- $items['code_approval/approve'] = array(
- 'title' => 'Code Approval',
- 'description' => 'Code Approval',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('code_approval_form'),
- 'access arguments' => array('approve code'),
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- 'weight' => 1,
- 'file' => 'code_approval.inc',
- );
- $items['code_approval/bulk'] = array(
- 'title' => 'Bulk Manage',
- 'description' => 'Bulk Mangage',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('bulk_approval_form'),
- 'access arguments' => array('bulk manage code'),
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 2,
- 'file' => 'code_approval.inc',
- );
- $items['code_approval/editcode'] = array(
- 'title' => 'Admin Edit Example',
- 'description' => 'Admin Edit Example',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('upload_examples_admin_edit_form'),
- 'access arguments' => array('approve code'),
- 'type' => MENU_CALLBACK,
- 'weight' => 3,
- 'file' => 'editcodeadmin.inc',
- );
- $items['code_approval/notes'] = array(
- 'title' => 'Notes for Reviewers',
- 'description' => 'Notes for Reviewers',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('book_notes_form'),
- 'access arguments' => array('bulk manage code'),
- 'type' => MENU_CALLBACK,
- 'weight' => 4,
- 'file' => 'notes.inc',
- );
-
+ /* CODE UPLOAD */
$items['lab_migration/code'] = array(
'title' => 'Code Submission',
'description' => 'Code Submission',
- 'page callback' => 'list_chapters',
+ 'page callback' => 'list_experiments',
'access callback' => 'user_access',
'access arguments' => array('upload code'),
- 'file' => 'general.inc',
+ 'file' => 'upload_code.inc',
);
- $items['lab_migration/code/list_chapters'] = array(
- 'title' => 'List Chapters',
- 'description' => 'List Chapters',
- 'page callback' => 'list_chapters',
+ $items['lab_migration/code/list_experiments'] = array(
+ 'title' => 'List Experiments',
+ 'description' => 'List Experiments',
+ 'page callback' => 'list_experiments',
'access arguments' => array('upload code'),
'type' => MENU_DEFAULT_LOCAL_TASK,
- 'file' => 'general.inc',
+ 'file' => 'upload_code.inc',
'weight' => 1,
);
$items['lab_migration/code/upload'] = array(
'title' => 'Code Submission',
'description' => 'Code Submission',
- 'page callback' => 'upload_examples',
+ //'page callback' => 'upload_examples',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('upload_code_form'),
'access arguments' => array('upload code'),
'type' => MENU_LOCAL_TASK,
- 'file' => 'code.inc',
+ 'file' => 'upload_code.inc',
'weight' => 2,
);
$items['lab_migration/code/upload_dep'] = array(
@@ -256,173 +168,10 @@ function lab_migration_menu()
$items['lab_migration/code/delete'] = array(
'title' => 'Delete Example',
'description' => 'Delete Example',
- 'page callback' => '_upload_examples_delete',
+ 'page callback' => 'upload_code_delete',
'access arguments' => array('upload code'),
'type' => MENU_CALLBACK,
- 'file' => 'code.inc',
- );
- $items['lab_migration/code/chapter/edit'] = array(
- 'title' => 'Edit Chapter Title',
- 'description' => 'Edit Chapter Title',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('edit_chapter_title_form'),
- 'access arguments' => array('upload code'),
- 'type' => MENU_CALLBACK,
- 'file' => 'editcode.inc',
- );
- $items['lab_migration/code/list_examples'] = array(
- 'title' => 'List Examples',
- 'description' => 'List Examples',
- 'page callback' => 'list_examples',
- 'access arguments' => array('upload code'),
- 'type' => MENU_CALLBACK,
- 'file' => 'general.inc',
- 'weight' => 3,
- );
-
- $items['textbook_search'] = array(
- 'title' => 'Book Search',
- 'description' => '',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('lab_migration_search_form'),
- 'access arguments' => array('access content'),
- 'type' => MENU_NORMAL_ITEM,
- 'file' => 'search.inc',
- );
- $items['textbook_search/search'] = array(
- 'title' => 'Book Search',
- 'description' => '',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('lab_migration_search_form'),
- 'access arguments' => array('access content'),
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- 'file' => 'search.inc',
- 'weight' => 1,
- );
- $items['textbook_search/book'] = array(
- 'title' => 'Browse By Title of the Book',
- 'description' => '',
- 'page callback' => 'lab_migration_browse_book',
- 'access arguments' => array('access content'),
- 'type' => MENU_LOCAL_TASK,
- 'file' => 'search.inc',
- 'weight' => 2,
- );
- $items['textbook_search/author'] = array(
- 'title' => 'Browse By Author Name',
- 'description' => '',
- 'page callback' => 'lab_migration_browse_author',
- 'access arguments' => array('access content'),
- 'type' => MENU_LOCAL_TASK,
- 'file' => 'search.inc',
- 'weight' => 3,
- );
-
- $items['textbook_run'] = array(
- 'title' => 'Download Codes',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('lab_migration_run_form'),
- 'access arguments' => array('access content'),
- 'type' => MENU_NORMAL_ITEM,
- 'file' => 'run.inc',
- );
-
- /* download callbacks */
- $items['download/file'] = array(
- 'title' => 'Code Download',
- 'description' => 'Code Download',
- 'page callback' => 'lab_migration_download_example_file',
- 'access arguments' => array('download code'),
- 'type' => MENU_CALLBACK,
- 'file' => 'download.inc',
- );
- $items['download/dependency'] = array(
- 'title' => 'Code Download',
- 'description' => 'Code Download',
- 'page callback' => 'lab_migration_download_dependency_file',
- 'access arguments' => array('download code'),
- 'type' => MENU_CALLBACK,
- 'file' => 'download.inc',
- );
- $items['download/example'] = array(
- 'title' => 'Code Download',
- 'description' => 'Code Download',
- 'page callback' => 'lab_migration_download_example',
- 'access arguments' => array('download code'),
- 'type' => MENU_CALLBACK,
- 'file' => 'download.inc',
- );
- $items['download/chapter'] = array(
- 'title' => 'Code Download',
- 'description' => 'Code Download',
- 'page callback' => 'lab_migration_download_chapter',
- 'access arguments' => array('download code'),
- 'type' => MENU_CALLBACK,
- 'file' => 'download.inc',
- );
- $items['download/book'] = array(
- 'title' => 'Code Download',
- 'description' => 'Code Download',
- 'page callback' => 'lab_migration_download_book',
- 'access arguments' => array('download code'),
- 'type' => MENU_CALLBACK,
- 'file' => 'download.inc',
- );
-
- /* reviewer download */
- $items['full_download/chapter'] = array(
- 'title' => 'Code Download',
- 'description' => 'Code Download',
- 'page callback' => 'lab_migration_download_full_chapter',
- 'access arguments' => array('approve code'),
- 'type' => MENU_CALLBACK,
- 'file' => 'full_download.inc',
- );
- $items['full_download/book'] = array(
- 'title' => 'Code Download',
- 'description' => 'Code Download',
- 'page callback' => 'lab_migration_download_full_book',
- 'access arguments' => array('approve code'),
- 'type' => MENU_CALLBACK,
- 'file' => 'full_download.inc',
- );
-
- /* latex script for book generation */
- $items['lab_migration/generate_book'] = array(
- 'title' => 'Generate Book',
- 'description' => 'Generate Book From Latex Script',
- 'page callback' => 'lab_migration_download_book',
- 'access arguments' => array('generate book'),
- 'type' => MENU_CALLBACK,
- 'file' => 'latex.inc',
- );
- $items['lab_migration/delete_book'] = array(
- 'title' => 'Delete Book PDF',
- 'description' => 'Delete Book PDF',
- 'page callback' => 'lab_migration_delete_book',
- 'access arguments' => array('approve code'),
- 'type' => MENU_CALLBACK,
- 'file' => 'latex.inc',
- );
-
- /* general purpose callbacks */
- $items['lab_migration/ajax'] = array(
- 'title' => 'Ajax',
- 'description' => 'Ajax',
- 'page callback' => 'lab_migration_ajax',
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK,
- );
-
- /* for admin */
- $items['admin/settings/book_companion'] = array(
- 'title' => 'Book Companion Settings',
- 'description' => 'Book Companion Settings',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('lab_migration_settings_form'),
- 'access arguments' => array('administer book companion'),
- 'type' => MENU_NORMAL_ITEM,
- 'file' => 'settings.inc',
+ 'file' => 'upload_code_delete.inc',
);
return $items;
@@ -1315,15 +1064,19 @@ function check_name($name = '') {
return TRUE;
}
-function check_chapter_number($name = '') {
- if (!preg_match('/^([0-9])+(\.([0-9a-zA-Z])+)+$/', $name))
+function check_code_number($number = '') {
+ if (!preg_match('/^[0-9]\.[0-9]$/', $number))
return FALSE;
else
return TRUE;
}
+function lab_migration_upload_path() {
+ return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'lab_migration/uploads/';
+}
+
function lab_migration_path() {
- return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'uploads/';
+ return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'lab_migration/uploads/';
}
/****************************** DELETION FUNCTIONS ****************************/