diff --git a/.env b/.env new file mode 100644 index 00000000..21ad9a69 --- /dev/null +++ b/.env @@ -0,0 +1,83 @@ +# In all environments, the following files are loaded if they exist, +# the latter taking precedence over the former: +# +# * .env contains default values for the environment variables needed by the app +# * .env.local uncommitted file with local overrides +# * .env.$APP_ENV committed environment-specific defaults +# * .env.$APP_ENV.local uncommitted environment-specific overrides +# +# Real environment variables win over .env files. +# +# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. +# https://symfony.com/doc/current/configuration/secrets.html +# +# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). +# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration + +# Saml Authentication +SAML_IDP_ENTITYID="https://idp.example.edu/abc123" +SAML_IDP_SINGLESIGNONSERVICE="https://idp.example.edu/abc123/saml2" +SAML_IDP_SINGLELOGOUTSERVICE="https://idp.example.edu/abc123/saml2" +SAML_IDP_X509CERT="MIIC...." + +# Catalog +CATALOG_BANNER_WEB_URL="" + +# Schedules +SCHEDULES_EMAIL_ENABLED=false +SCHEDULES_EMAIL_SEND_MAIL_AS_USER=false +SCHEDULES_EMAIL_SEND_MAIL_AS=noreply@example.edu +SCHEDULES_IMAGE_FONT_FILE=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf + +# Sync +SYNC_ERROR_MAIL_TO="admin@example.edu" +SYNC_ERROR_MAIL_FROM="noreply@example.edu" +# A JSON encoded array of Block Codes that should be exposed to users. +SYNC_ALLOWED_BLOCK_CODES='["CC"]' +# Sync destination (this application's database) +SYNC_DESTINATION_DSN="mysql:host=database;port=3306;dbname=symfony;charset=utf8mb4" +SYNC_DESTINATION_USERNAME=symfony +SYNC_DESTINATION_PASSWORD=symfony +# The sync strategy to use. One of the following: +# 'sync.strategy.oci' +# 'sync.strategy.oci_with_cache' +# 'sync.strategy.pdo_msyql' +# Depending on which strategy is chosen, different additional parameters (below) +# need to be configured. +SYNC_STRATEGY='sync.strategy.oci' +# Sync source (using an Oracle connection) for Oci & OciWithCache sync strategies. +SYNC_SOURCE_OCI_TNS="(DESCRIPTION = (ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = reporting-database-prod.ec.example.edu)(PORT = 8000))) (CONNECT_DATA = (SID = SNAPSHOT)))" +SYNC_SOURCE_OCI_USERNAME="" +SYNC_SOURCE_OCI_PASSWORD="" +# Temporary Mysql/Mariadb database if using (OciWithCache) sync strategy. +SYNC_TEMP_DSN="mysql:host=database;port=3306;dbname=catalog_temp;charset=utf8mb4" +SYNC_TEMP_USERNAME=symfony +SYNC_TEMP_PASSWORD=symfony +# The OciWithCache sync strategy copies into the live database with +# mysqldump & mysql commands. If these are at different paths/names, then +#customize them. +SYNC_MYSQL_COMMAND=mysql +SYNC_MYSQLDUMP_COMMAND=mysqldump +# The PdoMysql sync strategy reads from a Mysql/Mariadb connection. +SYNC_SOURCE_PDOMYSQL_DSN="mysql:host=database;port=3306;dbname=catalog_temp;charset=utf8mb4" +SYNC_SOURCE_PDOMYSQL_USERNAME=symfony +SYNC_SOURCE_PDOMYSQL_PASSWORD=symfony + +###> symfony/framework-bundle ### +APP_ENV=dev +APP_SECRET=af0c5e8cb62edd2dd690260da18618a2 +###< symfony/framework-bundle ### + +###> doctrine/doctrine-bundle ### +# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml +# +# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" +# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" +DATABASE_URL="mysql://symfony:symfony@database:3306/symfony?serverVersion=10.3.27-MariaDB&charset=utf8mb4" +# DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" +###< doctrine/doctrine-bundle ### + +###> symfony/mailer ### +MAILER_DSN=null://null +###< symfony/mailer ### diff --git a/.env.test b/.env.test new file mode 100644 index 00000000..dc836d8a --- /dev/null +++ b/.env.test @@ -0,0 +1,7 @@ +# define your env variables for the test env here +KERNEL_CLASS='App\Kernel' +APP_SECRET='$ecretf0rt3st' +SYMFONY_DEPRECATIONS_HELPER=999999 +PANTHER_APP_ENV=panther +PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots +SCHEDULES_EMAIL_ENABLED=true diff --git a/.gitignore b/.gitignore index 1ac4c29f..2977cd7a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,32 @@ progress.txt vendor/ .phpunit.result.cache .php-cs-fixer.cache + +###> symfony/framework-bundle ### +/.env.local +/.env.local.php +/.env.*.local +/config/secrets/prod/prod.decrypt.private.php +/public/bundles/ +/var/ +/vendor/ +###< symfony/framework-bundle ### + +###> symfony/phpunit-bridge ### +.phpunit.result.cache +/phpunit.xml +###< symfony/phpunit-bridge ### + +###> phpunit/phpunit ### +/phpunit.xml +.phpunit.result.cache +###< phpunit/phpunit ### + +###> symfony/asset-mapper ### +/public/assets/ +/assets/vendor/ +###< symfony/asset-mapper ### +###> friendsofphp/php-cs-fixer ### +/.php-cs-fixer.php +/.php-cs-fixer.cache +###< friendsofphp/php-cs-fixer ### diff --git a/.gitmodules b/.gitmodules index fae6a73a..d81d9832 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,10 +7,3 @@ [submodule "library/lazy_sessions"] path = library/lazy_sessions url = https://github.com/middlebury/lazy_sessions.git -[submodule "docroot/javascript/jquery-week-calendar"] - path = docroot/javascript/jquery-week-calendar - url = https://github.com/themouette/jquery-week-calendar.git -[submodule "library/jsdifflib"] - path = library/jsdifflib - url = https://github.com/cemerick/jsdifflib.git - branch = master diff --git a/.lando.yml b/.lando.yml new file mode 100644 index 00000000..51b08a35 --- /dev/null +++ b/.lando.yml @@ -0,0 +1,74 @@ +name: coursecatalog +recipe: symfony +config: + webroot: public + php: 8.1 + database: mariadb:10.11 +services: + appserver: + build_as_root: + - apt update + - mkdir /opt/oracle + - rm -Rf /opt/oracle/* + # Fetch binaries directly from Oracle: + # https://www.oracle.com/database/technologies/instant-client/downloads.html + - curl https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linux-arm64.zip > /opt/oracle/instantclient-basic.zip + - curl https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linux-arm64.zip > /opt/oracle/instantclient-sdk.zip + # Unzip + - unzip -o /opt/oracle/instantclient-basic.zip -d /opt/oracle + - unzip -o /opt/oracle/instantclient-sdk.zip -d /opt/oracle + # Add sqlplus command line Oracle client for debugging. + - curl https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linux-arm64.zip > /opt/oracle/instantclient-sqlplus.zip + - unzip -o /opt/oracle/instantclient-sqlplus.zip -d /opt/oracle + # Delete all of our downloads. + - rm /opt/oracle/*.zip + # Make a symlink to the versioned directory. + - ln -s /opt/oracle/instantclient_* /opt/oracle/instantclient + # Make OS aware of newly installed libraries + - echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf + - ldconfig -v + # Set the interpreter for the Oracle command-line tools. + # See: https://askubuntu.com/questions/1397724/no-such-file-or-directory-when-running-sqlplus-command + # This is not needed for the Oci8 PHP extension itself, but is needed to + # get sqlplus command-line Oracle client working for debugging. + - apt -y install patchelf + - patchelf --set-interpreter /lib/ld-linux-aarch64.so.1 /opt/oracle/instantclient/adrci + - patchelf --set-interpreter /lib/ld-linux-aarch64.so.1 /opt/oracle/instantclient/genezi + - patchelf --set-interpreter /lib/ld-linux-aarch64.so.1 /opt/oracle/instantclient/sqlplus + - patchelf --set-interpreter /lib/ld-linux-aarch64.so.1 /opt/oracle/instantclient/uidrvci + # Install libaio1 -- when missing was preventing the extension from loading. + - apt install libaio1 + # Install and enable OCI8 + - echo "instantclient,/opt/oracle/instantclient" | pecl install oci8-3.2.1 + - docker-php-ext-enable oci8 + overrides: + environment: + MAILER_DSN: smtp://mailpit:1025 + phpmyadmin: + type: phpmyadmin + hosts: + - database + mailpit: + scanner: false + api: 3 + type: lando + services: + image: axllent/mailpit + volumes: + - mailpit:/data + ports: + - 8025 # Web UI. + - 1025 # SMTP. + environment: + MP_MAX_MESSAGES: 5000 + MP_DATA_FILE: /data/mailpit.db + MP_SMTP_AUTH_ACCEPT_ANY: 1 + MP_SMTP_AUTH_ALLOW_INSECURE: 1 + command: '/mailpit' + volumes: + mailpit: +proxy: + mailpit: + - mail.coursecatalog.lndo.site:8025 + phpmyadmin: + - phpmyadmin.coursecatalog.lndo.site diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 15af8f2e..b8b7e5ae 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -5,6 +5,8 @@ ->notPath([ 'vendor', '#^library#', + '#^application/library/harmoni/Primitives/Collections-Text/SafeHTML/classes/HTMLSax3#', + '#^var#', ]) ; diff --git a/README.md b/README.md index 92005a27..12ae2a7c 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,10 @@ Examples Examples of the the Course-Catalog in action at Middlebury College: -* [Main Search UI](https://catalog.middlebury.edu/catalogs/view/catalog/catalog%2FMCUG) (catalog app) -* [Section Details Page](https://catalog.middlebury.edu/offerings/view/catalog/catalog%2FMCUG/offering/section%2F201090%2F91241) (catalog app) -* [Department "courses" RSS feed](https://catalog.middlebury.edu/courses/topicxml/catalog/catalog%2FMCUG/topic/topic%2Fdepartment%2FBIOL) (catalog app) -* [Departments listing to feed to the Drupal content type form](https://catalog.middlebury.edu/topics/listdepartmentstxt/catalog/catalog%2FMCUG/) (catalog app) +* [Main Search UI](https://catalog.middlebury.edu/catalogs/view/catalog/catalog.MCUG) (catalog app) +* [Section Details Page](https://catalog.middlebury.edu/offerings/view/catalog/catalog.MCUG/offering/section.201090.91241) (catalog app) +* [Department "courses" RSS feed](https://catalog.middlebury.edu/courses/topicxml/catalog/catalog.MCUG/topic/topic.department.BIOL) (catalog app) +* [Departments listing to feed to the Drupal content type form](https://catalog.middlebury.edu/topics/listdepartmentstxt/catalog/catalog.MCUG/) (catalog app) * [Department Course Listing](http://www.middlebury.edu/academics/bio/courses) (Drupal "courses" content-type displaying a feed from the catalog app) * [Department Section Listing](http://www.middlebury.edu/academics/bio/courses/offerings) (Drupal "courses" content-type displaying a feed from the catalog app) * [Faculty Profile](http://www.middlebury.edu/academics/bio/faculty/node/48111) (Drupal "profile" content-type displaying a feed from the catalog app) @@ -39,16 +39,40 @@ These instructions assume that you have a POSIX machine running Apache with PHP cd coursecatalog git-submodule update --init --recursive ``` -3. Make a symbolic link to the `coursecatalog/docroot/` directory in a web-accessible directory or add a virtualhost rooted in the `coursecatalog/docroot/` directory. -4. Create a MySQL database for the catalogs data and a cache of Banner data. -5. Make copies of the example config files at `configuration.plist`, `frontend_config.ini`, and `update_config.ini` and edit values to match your environment. -6. Create the database tables defined in `application/library/banner/course/sql/table_creation.sql` -7. Run the script at `bin/update-from-banner.php` to dump Banner data into the the MySQL database: +3. Install additional dependencies with Composer: + ``` + composer install + ``` +4. Make a symbolic link to the `coursecatalog/docroot/` directory in a web-accessible directory or add a virtualhost rooted in the `coursecatalog/docroot/` directory. +5. Create a MySQL database for the catalogs data and a cache of Banner data. +6. Make copies of the example config files at `configuration.plist`, `frontend_config.ini`, and `update_config.ini` and edit values to match your environment. +7. Create the database tables defined in `application/library/banner/course/sql/table_creation.sql` +8. Run the script at `bin/update-from-banner.php` to dump Banner data into the the MySQL database: ``` php bin/update-from-banner.php php bin/build_indices.php ``` +## Development environment setup + +### Lando +Install Docker and Lando to provide a local containerized environment + +In the code directory, start the local containers with `lando start` + +### Copying the production database +Dump the production database to a non version-controlled file path like `var/catalog_prod.sql`. + +Strip out any `DEFINER` statements that will break the import: +``` +sed -i '' 's/DEFINER=[^*]*\*/\*/g' var/catalog_prod.sql +``` + +Import the database into the local container: +``` +lando db-import var/catalog_prod.sql +``` + Unit Tests ---------- diff --git a/application/autoload.php b/application/autoload.php deleted file mode 100755 index 99564396..00000000 --- a/application/autoload.php +++ /dev/null @@ -1,27 +0,0 @@ -setFallbackAutoloader(true); - -require_once BASE_PATH.'/vendor/autoload.php'; diff --git a/application/controllers/AdminController.php b/application/controllers/AdminController.php deleted file mode 100755 index c76ba5a2..00000000 --- a/application/controllers/AdminController.php +++ /dev/null @@ -1,283 +0,0 @@ -view->csrf_key = $this->_helper->csrfKey(); - - if (!$this->_helper->auth()->isAuthenticated()) { - $this->_helper->auth()->login(); - } - - $config = Zend_Registry::getInstance()->config; - if (!isset($config->admin->administrator_ids)) { - throw new PermissionDeniedException('No admins are defined for this application.'); - } - $admins = explode(',', $config->admin->administrator_ids); - if (!in_array($this->_helper->auth()->getUserId(), $admins)) { - throw new PermissionDeniedException('You are not authorized to administer this application.'.$admins[1]); - } - } - - /** - * List Admin Screens. - * - * @return void - * - * @since 7/29/10 - */ - public function indexAction() - { - } - - /** - * Manage term visibility. - * - * @return void - * - * @since 7/29/10 - */ - public function termsAction() - { - $db = Zend_Registry::get('db'); - - if ($this->_getParam('change_visibility')) { - // Verify our CSRF key - if (!$this->_getParam('csrf_key') == $this->_helper->csrfKey()) { - throw new PermissionDeniedException('Invalid CSRF Key. Please log in again.'); - } - - // Verify that this is a valid term. - $catalog = $this->_getParam('catalog'); - $term = $this->_getParam('term'); - $verifyStmt = $db->prepare('SELECT COUNT(*) FROM STVTERM WHERE STVTERM_CODE = ?'); - $verifyStmt->execute([$term]); - $valid = (int) $verifyStmt->fetchColumn(); - $verifyStmt->closeCursor(); - if (!$valid) { - throw new InvalidArgumentException('Invalid term-code: '.$term); - } - - // Disable the term - if ('true' == $this->_getParam('disabled')) { - $visibilityStmt = $db->prepare('INSERT INTO catalog_term_inactive (catalog_id, term_code) VALUES (?, ?);'); - } - // Enable the term - else { - $visibilityStmt = $db->prepare('DELETE FROM catalog_term_inactive WHERE catalog_id = ? AND term_code = ?;'); - } - $visibilityStmt->execute([$catalog, $term]); - } - - $searches = $db->query('SELECT * FROM catalog_term_match')->fetchAll(); - - $catalogs = []; - $queries = []; - foreach ($searches as $search) { - $catalogs[] = $search['catalog_id']; - $queries[] = -" SELECT - '".$search['catalog_id']."' AS catalog, - STVTERM_CODE, - STVTERM_DESC - FROM - STVTERM - WHERE - STVTERM_CODE LIKE ('".$search['term_code_match']."')"; - } - $union = implode("\n\tUNION\n", $queries); - - $query = -"SELECT - t.*, - IF(i.term_code, 1, 0) AS manually_disabled, - count(SSBSECT_CRN) AS num_sections -FROM - (\n".$union."\n\t) AS t - LEFT JOIN catalog_term_inactive i ON (STVTERM_CODE = i.term_code AND i.catalog_id = ?) - LEFT JOIN course_catalog c ON i.catalog_id = c.catalog_id - LEFT JOIN ssbsect_scbcrse s ON (STVTERM_CODE = SSBSECT_TERM_CODE - AND SCBCRSE_COLL_CODE IN ( - SELECT coll_code - FROM course_catalog_college - WHERE catalog_id = ? - ) - AND SSBSECT_SSTS_CODE = 'A' - AND (c.prnt_ind_to_exclude IS NULL OR SSBSECT_PRNT_IND != c.prnt_ind_to_exclude) - ) -WHERE - catalog = ? -GROUP BY - STVTERM_CODE -ORDER BY - catalog ASC, STVTERM_CODE DESC"; - $stmt = $db->prepare($query); - - $this->view->catalogs = array_unique($catalogs); - - // print "
".$query."
"; - if ($this->_getParam('catalog') && in_array($this->_getParam('catalog'), $this->view->catalogs)) { - $catalog = $this->_getParam('catalog'); - } else { - $catalog = $this->view->catalogs[0]; - } - - $stmt->execute([$catalog, $catalog, $catalog]); - $this->view->catalog = $catalog; - $this->view->terms = $stmt->fetchAll(); - } - - public function markupAction() - { - if (isset($_POST['sample_text']) && strlen($_POST['sample_text'])) { - $this->view->sampleText = $_POST['sample_text']; - } else { - $this->view->sampleText = "This is some text. Shakespeare wrote /The Merchant of Venice/ as well as /Macbeth/. Words can have slashes in them such as AC/DC, but this does not indicate italics.\n\nSpaces around slashes such as this / don't cause italics either. Quotes may be /\"used inside slashes\",/ or \"/outside of them/\". *Bold Text* should have asterisk characters around it. Like slashes, * can be used surrounded by spaces, or surrounded by letters or numbers and not cause bold formatting: 4*5 = 20 or 4 * 5 = 20. Numbers as well as text can be bold *42* or italic /85/"; - } - $this->view->sampleText = htmlspecialchars($this->view->sampleText); - $this->view->output = banner_course_Course::convertDescription($this->view->sampleText); - } - - public function masqueradeAction() - { - $masqueradeAuth = $this->_helper->auth->getMasqueradeHelper(); - - if ($this->_getParam('masquerade')) { - // Verify our CSRF key - if (!$this->_getParam('csrf_key') == $this->_helper->csrfKey()) { - throw new PermissionDeniedException('Invalid CSRF Key. Please log in again.'); - } - - $masqueradeAuth->changeUser($this->_getParam('masquerade')); - $this->_redirect('/', ['prependBase' => true, 'exit' => true]); - } - - $this->view->userId = $this->_helper->auth()->getUserId(); - $this->view->userName = $this->_helper->auth()->getUserDisplayName(); - } - - /* Manage archive export configurations */ - public function exportAction() - { - $db = Zend_Registry::get('db'); - - $this->view->configs = $db->query('SELECT * FROM archive_configurations')->fetchAll(); - - $this->view->config = null; - if ($this->_getParam('config') && -1 != $this->_getParam('config')) { - foreach ($this->view->configs as $config) { - if ($config['id'] == $this->_getParam('config')) { - $this->view->config = $config; - } - } - } - - // If user has selected a configuration to modify, get the latest revision. - if (isset($this->view->config)) { - $catalogId = $this->_helper->osidId->fromString($this->view->config['catalog_id']); - $this->view->catalogId = $this->view->config['catalog_id']; - } - } - - /** - * Manage catalog archive scheduling. - * - * @return void - * - * @since 1/16/2018 - */ - public function scheduleAction() - { - } - - /** - * Manage antirequisites. - * - * @return void - * - * @since 12/6/2017 - */ - public function antirequisitesAction() - { - $db = Zend_Registry::get('db'); - - // Delete any requested item. - if ($this->_getParam('delete')) { - // Verify our CSRF key - if (!$this->_getParam('csrf_key') == $this->_helper->csrfKey()) { - throw new PermissionDeniedException('Invalid CSRF Key. Please log in again.'); - } - - // Verify that this is a valid term. - $deleteStmt = $db->prepare('DELETE FROM antirequisites WHERE subj_code = ? AND crse_numb = ? AND subj_code_eqiv = ? AND crse_numb_eqiv = ?'); - $deleteStmt->execute([ - $this->_getParam('subj_code'), - $this->_getParam('crse_numb'), - $this->_getParam('subj_code_eqiv'), - $this->_getParam('crse_numb_eqiv'), - ]); - } - - // Add any chosen items. - if ($this->_getParam('add')) { - // Verify our CSRF key - if (!$this->_getParam('csrf_key') == $this->_helper->csrfKey()) { - throw new PermissionDeniedException('Invalid CSRF Key. Please log in again.'); - } - - // Verify that this is a valid term. - $insertStmt = $db->prepare('INSERT INTO antirequisites (subj_code, crse_numb, subj_code_eqiv, crse_numb_eqiv, added_by, comments) VALUES (?, ?, ?, ?, ?, ?)'); - foreach ($this->_getParam('equivalents_to_add') as $toAdd) { - $params = explode('/', $toAdd); - $params[] = $this->view->getUserDisplayName(); - $params[] = $this->_getParam($toAdd.'-comments'); - $insertStmt->execute($params); - } - } - - // Select our already-created antirequisites - $this->view->antirequisites = $db->query('SELECT * FROM antirequisites ORDER BY subj_code, crse_numb, subj_code_eqiv, crse_numb_eqiv')->fetchAll(); - - // Supply search results. - $this->view->search_subj_code = $this->_getParam('search_subj_code'); - $this->view->search_crse_numb = $this->_getParam('search_crse_numb'); - if ($this->_getParam('search_subj_code') && $this->_getParam('search_crse_numb')) { - $searchStmt = $db->prepare( - 'SELECT - *, - subj_code IS NOT NULL AS antirequisite - FROM - SCREQIV - LEFT JOIN antirequisites - ON (SCREQIV_SUBJ_CODE = subj_code AND SCREQIV_CRSE_NUMB = crse_numb - AND SCREQIV_SUBJ_CODE_EQIV = subj_code_eqiv AND SCREQIV_CRSE_NUMB_EQIV = crse_numb_eqiv) - WHERE - (SCREQIV_SUBJ_CODE = ? AND SCREQIV_CRSE_NUMB = ?) - OR (SCREQIV_SUBJ_CODE_EQIV = ? AND SCREQIV_CRSE_NUMB_EQIV = ?) - GROUP BY - SCREQIV_SUBJ_CODE, SCREQIV_CRSE_NUMB, SCREQIV_SUBJ_CODE_EQIV, SCREQIV_CRSE_NUMB_EQIV - ORDER BY - SCREQIV_SUBJ_CODE, SCREQIV_CRSE_NUMB, SCREQIV_SUBJ_CODE_EQIV, SCREQIV_CRSE_NUMB_EQIV - '); - $searchStmt->execute([ - $this->_getParam('search_subj_code'), - $this->_getParam('search_crse_numb'), - $this->_getParam('search_subj_code'), - $this->_getParam('search_crse_numb'), - ]); - $this->view->searchResults = $searchStmt->fetchAll(PDO::FETCH_OBJ); - } - } -} diff --git a/application/controllers/ArchiveController.php b/application/controllers/ArchiveController.php index ddd0a8be..8fb1fbb0 100644 --- a/application/controllers/ArchiveController.php +++ b/application/controllers/ArchiveController.php @@ -831,9 +831,9 @@ protected function getCourseData(osid_course_Course $course) // Look for different Section Descriptions $offeringQuery = $this->offeringSearchSession->getCourseOfferingQuery(); $offeringQuery->matchCourseId($course->getId(), true); - $offeringQuery->matchGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/LCT'), true); - $offeringQuery->matchGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/SEM'), true); - $offeringQuery->matchGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/IND'), true); + $offeringQuery->matchGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.LCT'), true); + $offeringQuery->matchGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.SEM'), true); + $offeringQuery->matchGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.IND'), true); foreach ($this->selectedTerms as $termId) { $offeringQuery->matchTermId($termId, true); } @@ -856,7 +856,7 @@ protected function getCourseData(osid_course_Course $course) $instructorsType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors'); $identifiersType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:banner_identifiers'); $namesType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:person_names'); - $requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); + $requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement'); $enrollmentNumbersType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:enrollment_numbers'); while ($offerings->hasNext()) { $offering = $offerings->getNextCourseOffering(); @@ -1028,7 +1028,7 @@ protected function getCourseData(osid_course_Course $course) // Apply all course-level topics. $allTopics = $this->_helper->topics->topicListAsArray($course->getTopics()); $reqs = []; - $topicType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); + $topicType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement'); $topicTypeString = $this->_helper->osidType->toString($topicType); $topics = $this->_helper->topics->filterTopicsByType($allTopics, $topicType); foreach ($topics as $topic) { diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php deleted file mode 100755 index 3956b925..00000000 --- a/application/controllers/AuthController.php +++ /dev/null @@ -1,32 +0,0 @@ -loginAction(); - } - - public function loginAction() - { - if ($this->_helper->auth()->login($this->_getParam('return'))) { - if ($this->_getParam('return')) { - $this->_redirect($this->_getParam('return'), ['prependBase' => false, 'exit' => true]); - } else { - $this->_redirect('/', ['prependBase' => true, 'exit' => true]); - } - } - } - - public function logoutAction() - { - $this->_helper->auth()->logout($this->_getParam('return')); - - if ($this->_getParam('return')) { - $this->_redirect($this->_getParam('return'), ['prependBase' => false, 'exit' => true]); - } else { - $this->_redirect('/', ['prependBase' => true, 'exit' => true]); - } - } -} diff --git a/application/controllers/BookmarksController.php b/application/controllers/BookmarksController.php deleted file mode 100755 index 88ea1d44..00000000 --- a/application/controllers/BookmarksController.php +++ /dev/null @@ -1,76 +0,0 @@ -bookmarks = $this->_helper->bookmarks(); - - // Verify our CSRF key - if (!$this->_getParam('csrf_key') == $this->_helper->csrfKey()) { - throw new PermissionDeniedException('Invalid CSRF Key. Please log in again.'); - } - - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - $this->getResponse()->setHeader('Content-Type', 'text/xml'); - - echo ''; - } - - /** - * Bookmark a course. - * - * @return void - * - * @since 7/29/10 - */ - public function addAction() - { - $idString = $this->_getParam('course'); - if (!$idString) { - throw new InvalidArgumentException('No Course Id specified.'); - } - $id = $this->_helper->osidId->fromString($idString); - - $this->bookmarks->add($id); - - echo ''; - echo ''; - echo ''; - } - - /** - * Remove a course bookmark. - * - * @return void - * - * @since 7/29/10 - */ - public function removeAction() - { - $idString = $this->_getParam('course'); - if (!$idString) { - throw new InvalidArgumentException('No Course Id specified.'); - } - $id = $this->_helper->osidId->fromString($idString); - - $this->bookmarks->remove($id); - - echo ''; - echo ''; - echo ''; - } -} diff --git a/application/controllers/CatalogsController.php b/application/controllers/CatalogsController.php deleted file mode 100755 index 4d726bf6..00000000 --- a/application/controllers/CatalogsController.php +++ /dev/null @@ -1,103 +0,0 @@ -_forward('list'); - } - - /** - * Print out a list of all catalogs. - * - * @return void - * - * @since 4/21/09 - */ - public function listAction() - { - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseCatalogLookupSession(); - $this->view->catalogs = $lookupSession->getCourseCatalogs(); - - $this->view->title = 'Available Catalogs'; - $this->view->headTitle($this->view->title); - } - - /** - * Print out an XML list of all catalogs. - * - * @return void - */ - public function listxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->getResponse()->setHeader('Content-Type', 'text/xml'); - - $this->listAction(); - } - - /** - * View a catalog details. - * - * @return void - * - * @since 4/21/09 - */ - public function viewAction() - { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - if ($this->_getParam('term')) { - try { - // Verify that the term is valid in this catalog - $termLookup = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $termLookup->useFederatedCourseCatalogView(); - $termId = $termLookup->getTerm($this->_helper->osidId->fromString($this->_getParam('term')))->getId(); - } catch (osid_NotFoundException $e) { - } - } - if (!isset($termId)) { - $termId = $this->_helper->osidTerms->getNextOrLatestTermId($catalogId); - } - - $this->_forward('search', 'Offerings', null, [ - 'catalog' => $this->_helper->osidId->toString($catalogId), - 'term' => $this->_helper->osidId->toString($termId), - ]); - } - - /** - * Print out an XML listing of a catalog. - * - * @return void - */ - public function viewxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->getResponse()->setHeader('Content-Type', 'text/xml'); - - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseCatalogLookupSession(); - $catalog = $lookupSession->getCourseCatalog($catalogId); - $this->view->catalogs = new phpkit_course_ArrayCourseCatalogList([$catalog]); - - $this->view->title = 'Catalog Details'; - $this->view->headTitle($this->view->title); - - $this->render('catalogs/listxml', null, true); - } -} diff --git a/application/controllers/CoursesController.php b/application/controllers/CoursesController.php deleted file mode 100755 index 385863a9..00000000 --- a/application/controllers/CoursesController.php +++ /dev/null @@ -1,668 +0,0 @@ -alternateType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:alternates'); - - parent::init(); - } - - /** - * Print out a list of all courses. - * - * @return void - * - * @since 4/21/09 - */ - public function listAction() - { - if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseLookupSessionForCatalog($catalogId); - $this->view->title = 'Courses in '.$lookupSession->getCourseCatalog()->getDisplayName(); - } else { - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseLookupSession(); - $this->view->title = 'Courses in All Catalogs'; - } - $lookupSession->useFederatedCourseCatalogView(); - - $this->view->courses = $lookupSession->getCourses(); - - $this->setSelectedCatalogId($lookupSession->getCourseCatalogId()); - $this->view->headTitle($this->view->title); - - $this->view->menuIsCourses = true; - } - - /** - * View a catalog details. - * - * @return void - * - * @since 4/21/09 - */ - public function viewAction() - { - $id = $this->_helper->osidId->fromString($this->_getParam('course')); - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseLookupSession(); - $lookupSession->useFederatedCourseCatalogView(); - $this->view->course = $lookupSession->getCourse($id); - - // Load the topics into our view - $this->loadTopics($this->view->course->getTopics()); - - // Set the selected Catalog Id. - $catalogSession = $this->_helper->osid->getCourseManager()->getCourseCatalogSession(); - $catalogIds = $catalogSession->getCatalogIdsByCourse($id); - if ($catalogIds->hasNext()) { - $this->setSelectedCatalogId($catalogIds->getNextId()); - } - - // Set the title - $this->view->title = $this->view->course->getDisplayName(); - $this->view->headTitle($this->view->title); - - $this->view->menuIsCourses = true; - - // Alternates - if ($this->view->course->hasRecordType($this->alternateType)) { - $record = $this->view->course->getCourseRecord($this->alternateType); - if ($record->hasAlternates()) { - $this->view->alternates = $record->getAlternates(); - } - } - - // Term - if ($this->_getParam('term')) { - $termId = $this->_helper->osidId->fromString($this->_getParam('term')); - $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $termLookupSession->useFederatedCourseCatalogView(); - $this->view->term = $termLookupSession->getTerm($termId); - - $allParams = []; - $allParams['course'] = $this->_getParam('course'); - if ($this->getSelectedCatalogId()) { - $allParams['catalog'] = $this->_helper->osidId->toString($this->getSelectedCatalogId()); - } - $this->view->offeringsForAllTermsUrl = $this->_helper->url('view', 'courses', null, $allParams); - } else { - $this->view->linkTermId = $this->_helper->osidTerms->getNextOrLatestTermId($this->getSelectedCatalogId()); - } - - // Bookmarked Courses and Schedules - $this->view->bookmarks_CourseId = $this->view->course->getId(); - - // offerings - $this->view->offeringsTitle = 'Sections'; - $offeringLookupSession = $this->_helper->osid->getCourseManager()->getCourseOfferingLookupSession(); - $offeringLookupSession->useFederatedCourseCatalogView(); - if (isset($this->view->term)) { - $this->view->offerings = $offeringLookupSession->getCourseOfferingsByTermForCourse( - $this->view->term->getId(), - $id - ); - } else { - $this->view->offerings = $offeringLookupSession->getCourseOfferingsForCourse($id); - } - } - - /** - * Get an XML view of a course. - * - * @return void - */ - public function viewxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->getResponse()->setHeader('Content-Type', 'text/xml'); - - $this->viewAction(); - } - - /** - * Search for courses. - * - * @return void - * - * @since 6/15/09 - */ - public function searchxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - if (!$this->_getParam('catalog')) { - header('HTTP/1.1 400 Bad Request'); - echo 'A catalog must be specified.'; - exit; - } - try { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $searchSession = $this->_helper->osid->getCourseManager()->getCourseOfferingSearchSessionForCatalog($catalogId); - } catch (osid_InvalidArgumentException $e) { - header('HTTP/1.1 400 Bad Request'); - echo 'The catalog id specified was not of the correct format.'; - exit; - } catch (osid_NotFoundException $e) { - header('HTTP/1.1 404 Not Found'); - echo 'The catalog id specified was not found.'; - exit; - } - - $keywords = trim($this->_getParam('keywords')); - $searchUrl = $this->_helper->pathAsAbsoluteUrl($this->_helper->url('search', 'offerings', null, ['catalog' => $this->_getParam('catalog'), 'keywords' => $keywords, 'submit' => 'Search'])); - - header('Content-Type: text/xml'); - echo ' - - - Course Search: "'.htmlspecialchars($keywords).'" - '.$searchUrl.' - - '.date('r').' - Course Catalog - http://blogs.law.harvard.edu/tech/rss - -'; - $courses = []; - // Fetch courses - if (strlen($keywords)) { - // For now we will do an offering search and return courses - // only from it. If a course search session is available, it would - // be preferable to use that. - $query = $searchSession->getCourseOfferingQuery(); - $query->matchKeyword( - $keywords, - new phpkit_type_URNInetType('urn:inet:middlebury.edu:search:wildcard'), - true); - $offerings = $searchSession->getCourseOfferingsByQuery($query); - - while ($offerings->hasNext() && count($courses) <= 20) { - $offering = $offerings->getNextCourseOffering(); - $courseIdString = $this->_helper->osidId->toString($offering->getCourseId()); - if (!isset($courses[$courseIdString])) { - try { - $courses[$courseIdString] = $offering->getCourse(); - } catch (osid_OperationFailedException $e) { - // print "\nFailure on ".$offering->getDisplayName()."OfferingId:\n".print_r($offering->getId(), true)."\n\nCourseId:\n".print_r($offering->getCourseId(), true)."]]>"; - } - } - } - } - - // Print out courses as items. - foreach ($courses as $courseIdString => $course) { - echo "\n\t\t"; - - echo "\n\t\t\t"; - echo htmlspecialchars($course->getDisplayName().' - '.$course->getTitle()); - echo ''; - - echo "\n\t\t\t"; - echo $this->_helper->pathAsAbsoluteUrl($this->_helper->url('view', 'courses', null, ['catalog' => $this->_getParam('catalog'), 'course' => $courseIdString])); - echo ''; - - echo "\n\t\t\t"; - echo $this->_helper->pathAsAbsoluteUrl($this->_helper->url('view', 'courses', null, ['catalog' => $this->_getParam('catalog'), 'course' => $courseIdString])); - echo ''; - - echo "\n\t\t\tgetDescription(); - echo ']]>'; - echo "\n\t\t\t".$courseIdString.''; - - echo "\n\t\t"; - } - - echo ' - -'; - - exit; - } - - /** - * Search for courses. - * - * @return void - * - * @since 6/15/09 - */ - public function topicxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - if (!$this->_getParam('catalog')) { - header('HTTP/1.1 400 Bad Request'); - echo 'A catalog must be specified.'; - exit; - } - try { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $searchSession = $this->_helper->osid->getCourseManager()->getCourseSearchSessionForCatalog($catalogId); - - $this->termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); - } catch (osid_InvalidArgumentException $e) { - header('HTTP/1.1 400 Bad Request'); - echo 'The catalog id specified was not of the correct format.'; - exit; - } catch (osid_NotFoundException $e) { - header('HTTP/1.1 404 Not Found'); - echo 'The catalog id specified was not found.'; - exit; - } - - if (!$this->_getParam('topic')) { - header('HTTP/1.1 400 Bad Request'); - echo 'A topic must be specified.'; - exit; - } - - $topicsIds = []; - if (is_array($this->_getParam('topic'))) { - foreach ($this->_getParam('topic') as $idString) { - $topicIds[] = $this->_helper->osidId->fromString($idString); - } - } else { - $topicIds[] = $this->_helper->osidId->fromString($this->_getParam('topic')); - } - - $searchUrl = $this->_helper->pathAsAbsoluteUrl($this->_helper->url('search', 'offerings', null, [])); - - // Fetch courses - $query = $searchSession->getCourseQuery(); - - $topicRecord = $query->getCourseQueryRecord(new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:topic')); - foreach ($topicIds as $topicId) { - $topicRecord->matchTopicId($topicId, true); - } - - // Limit by location - $locationIds = []; - if (is_array($this->_getParam('location'))) { - foreach ($this->_getParam('location') as $idString) { - $locationIds[] = $this->_helper->osidId->fromString($idString); - } - } elseif ($this->_getParam('location')) { - $locationIds[] = $this->_helper->osidId->fromString($this->_getParam('location')); - } - $locationRecord = $query->getCourseQueryRecord(new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:location')); - foreach ($locationIds as $locationId) { - $locationRecord->matchLocationId($locationId, true); - } - - // Limit to just active courses - $query->matchGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:status-active'), true); - - $courses = $searchSession->getCoursesByQuery($query)->getCourses(); - - $topicLookup = $this->_helper->osid->getCourseManager()->getTopicLookupSession(); - $topicLookup->useFederatedCourseCatalogView(); - $topic = $topicLookup->getTopic($topicId); - - $recentCourses = new Helper_RecentCourses_Department($courses); - if ($this->_getParam('cutoff')) { - $recentCourses->setRecentInterval(new DateInterval($this->_getParam('cutoff'))); - } - $this->outputCourseFeed($recentCourses, htmlentities('Courses in '.$topic->getDisplayName()), $searchUrl); - } - - /** - * Search for courses. - * - * @return void - * - * @since 6/15/09 - */ - public function byidxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - if (!$this->_getParam('catalog')) { - header('HTTP/1.1 400 Bad Request'); - echo 'A catalog must be specified.'; - exit; - } - try { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseLookupSessionForCatalog($catalogId); - $this->termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); - } catch (osid_InvalidArgumentException $e) { - header('HTTP/1.1 400 Bad Request'); - echo 'The catalog id specified was not of the correct format.'; - exit; - } catch (osid_NotFoundException $e) { - header('HTTP/1.1 404 Not Found'); - echo 'The catalog id specified was not found.'; - exit; - } - - if (!$this->_getParam('id')) { - header('HTTP/1.1 400 Bad Request'); - echo "'id[]' must be specified."; - exit; - } - - $courseIds = []; - if (is_array($this->_getParam('id'))) { - foreach ($this->_getParam('id') as $idString) { - $courseIds[] = $this->_helper->osidId->fromString($idString); - } - } else { - $courseIds[] = $this->_helper->osidId->fromString($this->_getParam('id')); - } - - // Use Comparative view to include any found courses, ignoring missing ids. - $lookupSession->useComparativeCourseView(); - - $courses = $lookupSession->getCoursesByIds(new phpkit_id_ArrayIdList($courseIds)); - - $recentCourses = new Helper_RecentCourses_Department($courses); - if ($this->_getParam('cutoff')) { - $recentCourses->setRecentInterval(new DateInterval($this->_getParam('cutoff'))); - } - - $searchUrl = $this->_helper->pathAsAbsoluteUrl($this->_helper->url('byidxml', 'courses', null, [ - 'catalog' => $this->_getParam('catalog'), - 'id' => $this->_getParam('id'), - 'cuttoff' => $this->_getParam('cutoff'), - ])); - $this->outputCourseFeed($recentCourses, 'Courses by Id', $searchUrl); - } - - /** - * Build a list of courses associated with an instructor. - * - * The process is: - * 1. Find sections taught by the instructor in the time-frame (default is past 4 years). - * 3. For each section... - * a. Get the cross-listed sections from SSB_XLST - * b. Take the section plus its cross-listed sections, get their course - * entries and merge them into a single result. - * - * @return void - * - * @since 6/15/09 - */ - public function instructorxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - if (!$this->_getParam('catalog')) { - $offeringSearchSession = $this->_helper->osid->getCourseManager()->getCourseOfferingSearchSession(); - $offeringSearchSession->useFederatedCourseCatalogView(); - $courseLookupSession = $this->_helper->osid->getCourseManager()->getCourseLookupSession(); - $courseLookupSession->useFederatedCourseCatalogView(); - - // Allow term current/past to be limited to a certain catalog while courses are fetched from many - if ($this->_getParam('term_catalog')) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('term_catalog')); - $this->termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); - } - // fall back to terms from any catalog. - else { - $this->termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $this->termLookupSession->useFederatedCourseCatalogView(); - } - } else { - try { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $offeringSearchSession = $this->_helper->osid->getCourseManager()->getCourseOfferingSearchSessionForCatalog($catalogId); - $courseLookupSession = $this->_helper->osid->getCourseManager()->getCourseLookupSessionForCatalog($catalogId); - - $this->termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); - } catch (osid_InvalidArgumentException $e) { - throw new osid_InvalidArgumentException('The catalog id specified was not of the correct format.'); - } catch (osid_NotFoundException $e) { - throw new osid_NotFoundException('The catalog id specified was not found.'); - exit; - } - } - - $instructor = trim($this->_getParam('instructor')); - - if (!$instructor || !strlen($instructor)) { - // Make sure that this error response is cacheable. - $this->setCacheControlHeaders(); - $this->getResponse()->sendHeaders(); - - throw new InvalidArgumentException('An instructor must be specified.'); - } - - $instructorId = $this->_helper->osidId->fromString('resource/person/'.$instructor); - $searchUrl = $this->_helper->pathAsAbsoluteUrl($this->_helper->url('view', 'resources', null, ['catalog' => $this->_getParam('catalog'), 'resource' => 'resouce/person/'.$instructor])); - - $resourceLookup = $this->_helper->osid->getCourseManager()->getResourceManager()->getResourceLookupSession(); - try { - $instructorResource = $resourceLookup->getResource($instructorId); - } catch (osid_NotFoundException $e) { - // Make sure that this error response is cacheable. - $this->setCacheControlHeaders(); - $this->getResponse()->sendHeaders(); - - throw $e; - } - - // Fetch Offerings - $query = $offeringSearchSession->getCourseOfferingQuery(); - - $instructorRecord = $query->getCourseOfferingQueryRecord(new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors')); - $instructorRecord->matchInstructorId($instructorId, true); - - $order = $offeringSearchSession->getCourseOfferingSearchOrder(); - $order->orderByDisplayName(); - $search = $offeringSearchSession->getCourseOfferingSearch(); - $search->orderCourseOfferingResults($order); - - $courseOfferings = $offeringSearchSession->getCourseOfferingsBySearch($query, $search); - - $recentCourses = new Helper_RecentCourses_Instructor($courseOfferings, $courseLookupSession); - if ($this->_getParam('cutoff')) { - $recentCourses->setRecentInterval(new DateInterval($this->_getParam('cutoff'))); - } - $this->outputCourseFeed($recentCourses, 'Courses taught by '.$instructorResource->getDisplayName(), $searchUrl); - } - - /** - * Output an RSS feed of courses from results. - * - * @param Helper_RecentCourses_Abstract $recentCourses - * @param string $title - * @param string $url - * - * @return void - * - * @since 10/19/09 - */ - protected function outputCourseFeed(Helper_RecentCourses_Interface $recentCourses, $title, $url) - { - // Set our cache-control headers since we will be flushing content soon. - $this->setCacheControlHeaders(); - $this->getResponse()->sendHeaders(); - - $now = $this->DateTime_getTimestamp(new DateTime()); - - // Close the session before we send headers and content. - session_write_close(); - - header('Content-Type: text/xml'); - echo ' - - - '.htmlspecialchars($title).' - '.$url.' - - '.date('r').' - Course Catalog - http://blogs.law.harvard.edu/tech/rss - -'; - - while (ob_get_level()) { - ob_end_flush(); - } - flush(); - - // Set the next and previous terms - $currentTermId = $this->_helper->osidTerms->getCurrentTermId($this->termLookupSession->getCourseCatalogId()); - $currentTerm = $this->termLookupSession->getTerm($currentTermId); - $currentEndTime = $this->DateTime_getTimestamp($currentTerm->getEndTime()); - - // print "debug()); - // print "]]>"; - - $catalogSession = $this->_helper->osid->getCourseManager()->getCourseCatalogSession(); - $termsType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:terms'); - - // foreach ($groups as $key => $group) { - // print "\n$key"; - // foreach ($group as $course) { - // print "\n\t".$this->_helper->osidId->toString($course->getId()); - // } - // } - - foreach ($recentCourses->getPrimaryCourses() as $course) { - $courseIdString = $this->_helper->osidId->toString($course->getId()); - - echo "\n\t\t"; - - echo "\n\t\t\t"; - $alternates = $recentCourses->getAlternatesForCourse($course); - $name = $course->getDisplayName(); - foreach ($alternates as $alt) { - $name .= ' / '.$alt->getDisplayName(); - } - echo htmlspecialchars($name.' - '.$course->getTitle()); - echo ''; - - echo "\n\t\t\t"; - $catalog = $catalogSession->getCatalogIdsByCourse($course->getId()); - if ($catalog->hasNext()) { - $catalogIdString = $this->_helper->osidId->toString($catalog->getNextId()); - } else { - $catalogIdString = null; - } - echo $this->_helper->pathAsAbsoluteUrl($this->_helper->url('view', 'courses', null, ['catalog' => $catalogIdString, 'course' => $courseIdString])); - echo ''; - - echo "\n\t\t\t"; - echo $this->_helper->pathAsAbsoluteUrl($this->_helper->url('view', 'courses', null, ['catalog' => $catalogIdString, 'course' => $courseIdString])); - echo ''; - - echo "\n\t\t\tgetDescription(); - echo ']]>'; - echo "\n\t\t\t".$courseIdString.''; - echo "\n\t\t\t".htmlspecialchars($course->getDisplayName()).''; - echo "\n\t\t\t".htmlspecialchars($course->getTitle()).''; - - foreach ($alternates as $alt) { - echo "\n\t\t\t"; - echo "\n\t\t\t\t".$this->_helper->osidId->toString($alt->getId()).''; - echo "\n\t\t\t\t".htmlspecialchars($alt->getDisplayName()).''; - echo "\n\t\t\t\t".htmlspecialchars($alt->getTitle()).''; - echo "\n\t\t\t"; - } - - $recentTerms = $recentCourses->getTermsForCourse($course); - if (count($recentTerms)) { - $termStrings = []; - foreach ($recentTerms as $term) { - echo "\n\t\t\t_helper->osidId->toString($term->getId()).'"'; - if ($term->getId()->isEqual($currentTermId)) { - echo ' type="current"'; - } elseif ($currentEndTime < $this->DateTime_getTimestamp($term->getEndTime())) { - echo ' type="future"'; - } elseif ($now > $this->DateTime_getTimestamp($term->getStartTime()) && $now < $this->DateTime_getTimestamp($term->getEndTime())) { - echo ' type="current"'; - } else { - echo ' type="past"'; - } - echo '>'.$term->getDisplayName().''; - } - } - - $allTopics = $this->_helper->topics->topicListAsArray($course->getTopics()); - $topicType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $topicTypeString = $this->_helper->osidType->toString($topicType); - $topics = $this->_helper->topics->filterTopicsByType($allTopics, $topicType); - foreach ($topics as $topic) { - $topicParams['topic'] = $this->_helper->osidId->toString($topic->getId()); - echo "\n\t\t\t'; - echo $this->view->escape($topic->getDisplayName()); - echo ' '; - } - - $topicType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); - $topicTypeString = $this->_helper->osidType->toString($topicType); - $topics = $this->_helper->topics->filterTopicsByType($allTopics, $topicType); - foreach ($topics as $topic) { - $topicParams['topic'] = $this->_helper->osidId->toString($topic->getId()); - echo "\n\t\t\t'; - echo $this->view->escape($topic->getDisplayName()); - echo ' '; - } - - $topicType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/level'); - $topicTypeString = $this->_helper->osidType->toString($topicType); - $topics = $this->_helper->topics->filterTopicsByType($allTopics, $topicType); - foreach ($topics as $topic) { - $topicParams['topic'] = $this->_helper->osidId->toString($topic->getId()); - echo "\n\t\t\t'; - echo $this->view->escape($topic->getDisplayName()); - echo ' '; - } - - echo "\n\t\t"; - flush(); - } - - echo ' - -'; - exit; - } - - public function DateTime_getTimestamp($dt) - { - $dtz_original = $dt->getTimezone(); - $dtz_utc = new DateTimeZone('UTC'); - $dt->setTimezone($dtz_utc); - $year = (int) $dt->format('Y'); - $month = (int) $dt->format('n'); - $day = (int) $dt->format('j'); - $hour = (int) $dt->format('G'); - $minute = (int) $dt->format('i'); - $second = (int) $dt->format('s'); - $dt->setTimezone($dtz_original); - - return gmmktime($hour, $minute, $second, $month, $day, $year); - } -} diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php deleted file mode 100644 index dceab6e9..00000000 --- a/application/controllers/ErrorController.php +++ /dev/null @@ -1,8 +0,0 @@ -view->csrf_key = $this->_helper->csrfKey(); - - if (!$this->_helper->auth()->isAuthenticated()) { - $this->_helper->auth()->login(); - } - - $config = Zend_Registry::getInstance()->config; - if (!isset($config->admin->administrator_ids)) { - throw new PermissionDeniedException('No admins are defined for this application.'); - } - $admins = explode(',', $config->admin->administrator_ids); - if (!in_array($this->_helper->auth()->getUserId(), $admins)) { - throw new PermissionDeniedException('You are not authorized to administer this application.'.$admins[1]); - } - } - - /** - * Echo JSON data of latest revision for a particular archive configuration. - * - * @return void - * - * @since 1/23/18 - */ - public function latestrevisionAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - $db = Zend_Registry::get('db'); - $query = - 'SELECT - * - FROM archive_configuration_revisions a - INNER JOIN ( - SELECT - arch_conf_id, - MAX(last_saved) as latest - FROM archive_configuration_revisions - GROUP BY arch_conf_id - ) b ON a.arch_conf_id = b.arch_conf_id and a.last_saved = b.latest - WHERE a.arch_conf_id = ?'; - $stmt = $db->prepare($query); - $stmt->execute([filter_input(\INPUT_GET, 'configId', \FILTER_SANITIZE_SPECIAL_CHARS)]); - $latestRevision = $stmt->fetch(); - echo $latestRevision['json_data']; - - return $latestRevision['json_data']; - } - - /** - * Display revision history for a given archive configuration. - * - * @return void - * - * @since 1/24/18 - */ - public function revisionhistoryAction() - { - $request = $this->getRequest(); - if (!$request->getParam('config') || -1 === $request->getParam('config')) { - header('HTTP/1.1 400 Bad Request'); - echo 'A config ID must be specified.'; - exit; - } - $this->view->configId = filter_var($request->getParam('config'), \FILTER_SANITIZE_NUMBER_INT); - $db = Zend_Registry::get('db'); - $query = 'SELECT label FROM archive_configurations WHERE id = ?'; - $stmt = $db->prepare($query); - $stmt->execute([$this->view->configId]); - $this->view->configLabel = $stmt->fetch()['label']; - - $query = 'SELECT * FROM archive_configuration_revisions WHERE arch_conf_id = ? ORDER BY last_saved DESC'; - $stmt = $db->prepare($query); - $stmt->execute([$this->view->configId]); - $this->view->revisions = $stmt->fetchAll(); - } - - /** - * Display diff between two revisions. - * - * @return void - * - * @since 1/25/18 - */ - public function revisiondiffAction() - { - if (!$this->_getParam('rev1') || !$this->_getParam('rev2')) { - header('HTTP/1.1 400 Bad Request'); - echo 'This route requires two revision IDs'; - exit; - } else { - $db = Zend_Registry::get('db'); - $query = 'SELECT * FROM archive_configuration_revisions WHERE id = ?'; - $stmt = $db->prepare($query); - $stmt->execute([filter_var($this->_getParam('rev1'), \FILTER_SANITIZE_NUMBER_INT)]); - $this->rev1 = $stmt->fetch(); - $stmt = $db->prepare($query); - $stmt->execute([filter_var($this->_getParam('rev2'), \FILTER_SANITIZE_NUMBER_INT)]); - $this->rev2 = $stmt->fetch(); - - $this->view->text1 = $this->rev1['json_data']; - $this->view->text2 = $this->rev2['json_data']; - $this->view->time1 = $this->rev1['last_saved']; - $this->view->time2 = $this->rev2['last_saved']; - } - } - - /** - * Display revision JSON data. - * - * @return void - * - * @since 1/25/18 - */ - public function viewjsonAction() - { - $request = $this->getRequest(); - if (!$request->getParam('revision') || -1 === $request->getParam('revision')) { - header('HTTP/1.1 400 Bad Request'); - echo 'This route requires a revision ID'; - exit; - } - - $db = Zend_Registry::get('db'); - $query = 'SELECT * FROM archive_configuration_revisions WHERE id = ?'; - $stmt = $db->prepare($query); - $stmt->execute([filter_var($this->_getParam('revision'), \FILTER_SANITIZE_NUMBER_INT)]); - $this->view->revision = $stmt->fetch(); - } - - /** - * Provide interface for creating a new archive configuration. - * - * @return void - * - * @since 1/23/18 - */ - public function newconfigAction() - { - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseCatalogLookupSession(); - $this->view->catalogs = $lookupSession->getCourseCatalogs(); - } - - /** - * Delete an archive configuration. - * - * @return void - * - * @since 1/23/18 - */ - public function deleteconfigAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - // Delete revisions that depend on this config. - $db = Zend_Registry::get('db'); - $query = 'DELETE FROM archive_configuration_revisions WHERE arch_conf_id = ?'; - $stmt = $db->prepare($query); - $stmt->execute([filter_var($this->getRequest()->getPost('configId'), \FILTER_SANITIZE_NUMBER_INT)]); - - // Delete this config. - $query = 'DELETE FROM archive_configurations WHERE id = ?'; - $stmt = $db->prepare($query); - $stmt->execute([$this->getRequest()->getPost('configId')]); - } - - /** - * Insert a new archive configuration into the database. - * - * @return void - * - * @since 1/23/18 - */ - public function insertconfigAction() - { - if ($this->getRequest()->isPost()) { - $safeLabel = filter_input(\INPUT_POST, 'label', \FILTER_SANITIZE_SPECIAL_CHARS); - $safeCatalogId = filter_input(\INPUT_POST, 'catalog_id', \FILTER_SANITIZE_SPECIAL_CHARS); - - $db = Zend_Registry::get('db'); - $query = - 'INSERT INTO archive_configurations (id, label, catalog_id) - VALUES (NULL,:label,:catalogId)'; - $stmt = $db->prepare($query); - $stmt->execute([':label' => $safeLabel, ':catalogId' => $safeCatalogId]); - } - - $this->_helper->redirector('export', 'admin'); - } - - /** - * Echo JSON data of all archive export jobs. - * - * @return void - * - * @since 1/23/18 - */ - public function listjobsAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - $db = Zend_Registry::get('db'); - $configs = $db->query('SELECT * FROM archive_configurations')->fetchAll(); - $revisions = $db->query('SELECT `id`, `note`, `last_saved`, `arch_conf_id` FROM archive_configuration_revisions ORDER BY last_saved DESC')->fetchAll(); - $jobs = $db->query('SELECT * FROM archive_jobs ORDER BY terms DESC')->fetchAll(); - - $data = []; - $data[] = ['configs' => $configs]; - $data[] = ['revisions' => $revisions]; - $data[] = ['jobs' => $jobs]; - - echo json_encode($data); - } - - /** - * Provide an interface for creating a new archive export job. - * - * @return void - * - * @since 1/23/18 - */ - public function newjobAction() - { - $request = $this->getRequest(); - - $db = Zend_Registry::get('db'); - $this->view->configs = $db->query('SELECT * FROM archive_configurations')->fetchAll(); - - $this->view->config = null; - if ($request->getParam('config')) { - foreach ($this->view->configs as $config) { - if ($config['label'] === $request->getParam('config')) { - $this->view->config = $config; - } - } - } - } - - /** - * Delete an archive export job. - * - * @return void - * - * @since 1/23/18 - */ - public function deletejobAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - // Delete revisions that depend on this config. - $db = Zend_Registry::get('db'); - $query = 'DELETE FROM archive_jobs WHERE id = ?'; - $stmt = $db->prepare($query); - $stmt->execute([filter_var($this->getRequest()->getPost('jobId'), \FILTER_SANITIZE_NUMBER_INT)]); - } - - /** - * Insert a new archive export job into the DB. - * - * @return void - * - * @since 1/23/18 - */ - public function insertjobAction() - { - if ($this->getRequest()->isPost()) { - $safeConfigId = filter_input(\INPUT_POST, 'configId', \FILTER_SANITIZE_SPECIAL_CHARS); - $safeExportPath = filter_input(\INPUT_POST, 'export_path', \FILTER_SANITIZE_SPECIAL_CHARS); - $safeTerms = filter_input(\INPUT_POST, 'terms', \FILTER_SANITIZE_SPECIAL_CHARS); - - $db = Zend_Registry::get('db'); - $query = - 'INSERT INTO archive_jobs (id, active, export_path, config_id, revision_id, terms) - VALUES (NULL, 1, :export_path, :config_id, NULL, :terms)'; - $stmt = $db->prepare($query); - $stmt->execute([':export_path' => $safeExportPath, ':config_id' => $safeConfigId, ':terms' => $safeTerms]); - } - - $this->_helper->redirector('schedule', 'admin'); - } - - /** - * Update an existing archive export job. - * - * @return void - * - * @since 1/23/18 - */ - public function updatejobAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - if ($this->getRequest()->isPost()) { - $safeId = filter_input(\INPUT_POST, 'jobId', \FILTER_SANITIZE_SPECIAL_CHARS); - $safeActive = filter_input(\INPUT_POST, 'active', \FILTER_SANITIZE_SPECIAL_CHARS); - $safeExportPath = filter_input(\INPUT_POST, 'export_path', \FILTER_SANITIZE_SPECIAL_CHARS); - $safeConfigId = filter_input(\INPUT_POST, 'config_id', \FILTER_SANITIZE_SPECIAL_CHARS); - $safeRevisionId = filter_input(\INPUT_POST, 'revision_id', \FILTER_SANITIZE_SPECIAL_CHARS); - if ('latest' === $safeRevisionId) { - $safeRevisionId = null; - } - $safeTerms = filter_input(\INPUT_POST, 'terms', \FILTER_SANITIZE_SPECIAL_CHARS); - - $db = Zend_Registry::get('db'); - $query = - 'UPDATE archive_jobs - SET active = :active, export_path = :export_path, config_id = :config_id, revision_id = :revision_id, terms = :terms - WHERE id = :id'; - $stmt = $db->prepare($query); - $stmt->execute([':id' => $safeId, ':active' => $safeActive, ':export_path' => $safeExportPath, ':config_id' => $safeConfigId, ':revision_id' => $safeRevisionId, ':terms' => $safeTerms]); - } - } - - /** - * Echo JSON data of all archive configuration revisions. - * - * @return void - * - * @since 1/23/18 - */ - public function listrevisionsAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - $db = Zend_Registry::get('db'); - $revisions = $db->query('SELECT * FROM archive_configuration_revisions ORDER BY last_saved DESC')->fetchAll(); - - echo json_encode($revisions); - } - - /** - * Revert to an older revision by re-inserting it with new timestamp. - * - * @return void - * - * @since 1/25/18 - */ - public function reverttorevisionAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - $safeRevisionId = filter_input(\INPUT_POST, 'revId', \FILTER_SANITIZE_SPECIAL_CHARS); - - $db = Zend_Registry::get('db'); - $query = 'SELECT * FROM archive_configuration_revisions WHERE id=:id'; - $stmt = $db->prepare($query); - $stmt->execute([':id' => $safeRevisionId]); - $oldRevision = $stmt->fetch(); - $note = 'Revert to revision: '.$safeRevisionId.' from '.$oldRevision['last_saved']; - - $query = - 'INSERT INTO archive_configuration_revisions (`arch_conf_id`, `note`, `last_saved`, `user_id`, `user_disp_name`, `json_data`) - VALUES ( - :configId, - :note, - CURRENT_TIMESTAMP, - :userId, - :userDN, - :jsonData)'; - $stmt = $db->prepare($query); - $stmt->execute([':configId' => $oldRevision['arch_conf_id'], ':note' => $note, ':userId' => $this->_helper->auth()->getUserId(), ':userDN' => $this->_helper->auth()->getUserDisplayName(), ':jsonData' => $oldRevision['json_data']]); - } - - /** - * Insert new archive configuration revision to the DB. - * - * @return void - * - * @since 1/23/18 - */ - public function insertrevisionAction() - { - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - if (!$this->getRequest()->isPost()) { - echo 'This route requires a POST request'; - - return; - } - - $safeConfigId = filter_input(\INPUT_POST, 'configId', \FILTER_SANITIZE_SPECIAL_CHARS); - $safeNote = filter_input(\INPUT_POST, 'note', \FILTER_SANITIZE_SPECIAL_CHARS); - $jsonArray = json_decode($this->getRequest()->getPost('jsonData')); - foreach ($jsonArray as $key => $value) { - $value = filter_var($value, \FILTER_SANITIZE_SPECIAL_CHARS); - } - $safeJsonData = json_encode($jsonArray, \JSON_PRETTY_PRINT); - - $db = Zend_Registry::get('db'); - $query = - 'INSERT INTO archive_configuration_revisions (`arch_conf_id`, `note`, `last_saved`, `user_id`, `user_disp_name`, `json_data`) - VALUES ( - :configId, - :note, - CURRENT_TIMESTAMP, - :userId, - :userDN, - :jsonData)'; - $stmt = $db->prepare($query); - $stmt->execute([':configId' => $safeConfigId, ':note' => $safeNote, ':userId' => $this->_helper->auth()->getUserId(), ':userDN' => $this->_helper->auth()->getUserDisplayName(), ':jsonData' => $safeJsonData]); - - return $this->getRequest()->getPost(); - } - - /** - * Echo HTML for a course list dropdown menu based on an archive configuration ID. - * - * @return void - * - * @since 1/23/18 - */ - public function generatecourselistAction() - { - $request = $this->getRequest(); - - if ($request->getParam('catalogId')) { - $catalogId = $this->_helper->osidId->fromString($request->getParam('catalogId')); - $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - - $topicSearchSession = $this->_helper->osid->getCourseManager()->getTopicSearchSessionForCatalog($catalogId); - $topicQuery = $topicSearchSession->getTopicQuery(); - $topicQuery->matchGenusType($this->departmentType, true); - if (isset($termId) && $topicQuery->hasRecordType($this->termType)) { - $record = $topicQuery->getTopicQueryRecord($this->termType); - $record->matchTermId($termId, true); - } - $search = $topicSearchSession->getTopicSearch(); - $order = $topicSearchSession->getTopicSearchOrder(); - $order->orderByDisplayName(); - $search->orderTopicResults($order); - $searchResults = $topicSearchSession->getTopicsBySearch($topicQuery, $search); - $departments = $searchResults->getTopics(); - - $topicQuery = $topicSearchSession->getTopicQuery(); - $topicQuery->matchGenusType($this->subjectType, true); - if (isset($termId) && $topicQuery->hasRecordType($this->termType)) { - $record = $topicQuery->getTopicQueryRecord($this->termType); - $record->matchTermId($termId, true); - } - $search = $topicSearchSession->getTopicSearch(); - $order = $topicSearchSession->getTopicSearchOrder(); - $order->orderByDisplayName(); - $search->orderTopicResults($order); - $searchResults = $topicSearchSession->getTopicsBySearch($topicQuery, $search); - $subjects = $searchResults->getTopics(); - - $sectionInput = " - '; - - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - - echo $sectionInput; - } else { - echo 'Invalid request. Please provide a catalogId'; - } - } - - /** - * Echo whether a user-entered term ID is valid. - * - * @return void - * - * @since 1/23/18 - */ - // TODO - return instead of echo? - public function validtermAction() - { - $request = $this->getRequest(); - - if (!$request->getParam('catalogId')) { - echo 'No catalog specified!'; - exit; - } - if (!$request->getParam('term')) { - echo 'No term specified!'; - exit; - } - - $catalogId = $this->_helper->osidId->fromString($request->getParam('catalogId')); - $this->termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); - - try { - $termString = 'term/'.$request->getParam('term'); - $termId = $this->_helper->osidId->fromString($termString); - } catch (osid_InvalidArgumentException $e) { - header('HTTP/1.1 400 Bad Request'); - echo 'The term id specified was not of the correct format.'; - exit; - } catch (osid_NotFoundException $e) { - echo 'not valid'; - } - - if ($this->termLookupSession->getTerm($termId)) { - echo 'valid'; - } else { - echo 'not valid'; - } - - $this->_helper->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - } -} diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php deleted file mode 100755 index f2806ebb..00000000 --- a/application/controllers/IndexController.php +++ /dev/null @@ -1,10 +0,0 @@ -_forward('index', 'catalogs'); - } -} diff --git a/application/controllers/JsonController.php b/application/controllers/JsonController.php index c3efec99..fe035c7c 100644 --- a/application/controllers/JsonController.php +++ b/application/controllers/JsonController.php @@ -37,7 +37,7 @@ public function init() public function termsAction() { if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString('catalog/'.$this->_getParam('catalog')); + $catalogId = $this->_helper->osidId->fromString('catalog.'.$this->_getParam('catalog')); $lookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); $currentTermId = $this->_helper->osidTerms->getNextOrLatestTermId($catalogId); } else { @@ -52,7 +52,7 @@ public function termsAction() if ($currentTermId) { $term = $lookupSession->getTerm($currentTermId); $result['terms'][] = [ - 'code' => preg_replace('/^term\//', '', $term->getId()->getIdentifier()), + 'code' => preg_replace('/^term\./', '', $term->getId()->getIdentifier()), 'description' => $term->getDisplayName(), ]; } @@ -63,7 +63,7 @@ public function termsAction() continue; } $result['terms'][] = [ - 'code' => preg_replace('/^term\//', '', $term->getId()->getIdentifier()), + 'code' => preg_replace('/^term\./', '', $term->getId()->getIdentifier()), 'description' => $term->getDisplayName(), ]; } @@ -83,7 +83,7 @@ public function termsAction() public function areasAction() { if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString('catalog/'.$this->_getParam('catalog')); + $catalogId = $this->_helper->osidId->fromString('catalog.'.$this->_getParam('catalog')); $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); $topicSearchSession = $this->_helper->osid->getCourseManager()->getTopicSearchSessionForCatalog($catalogId); } else { @@ -97,10 +97,10 @@ public function areasAction() if (empty($code)) { throw new InvalidArgumentException('Missing the "code" parameter.'); } - $termId = $this->_helper->osidId->fromString('term/'.$code); + $termId = $this->_helper->osidId->fromString('term.'.$code); $term = $termLookupSession->getTerm($termId); - $genera = 'topic/subject'; + $genera = 'topic.subject'; $generaType = $this->_helper->osidType->fromString('genera:'.$genera); $termType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:terms'); @@ -121,7 +121,7 @@ public function areasAction() while ($topics->hasNext()) { $topic = $topics->getNextTopic(); $result['areas'][] = [ - 'area' => preg_replace('/^'.str_replace('/', '\/', $genera).'\//', '', $topic->getId()->getIdentifier()), + 'area' => preg_replace('/^'.str_replace('.', '\.', $genera).'\./', '', $topic->getId()->getIdentifier()), 'name' => $topic->getDisplayName(), ]; } @@ -141,7 +141,7 @@ public function areasAction() public function catalogAction() { if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString('catalog/'.$this->_getParam('catalog')); + $catalogId = $this->_helper->osidId->fromString('catalog.'.$this->_getParam('catalog')); $searchSession = $this->_helper->osid->getCourseManager()->getCourseSearchSessionForCatalog($catalogId); $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); $topicLookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSessionForCatalog($catalogId); @@ -158,18 +158,18 @@ public function catalogAction() $offeringLookupSession->useFederatedCourseCatalogView(); // Validate our arguments. - $genera = 'topic/subject'; + $genera = 'topic.subject'; $area = $this->_getParam('area'); if (empty($area)) { throw new InvalidArgumentException('Missing the "area" parameter.'); } - $topicId = $this->_helper->osidId->fromString($genera.'/'.$area); + $topicId = $this->_helper->osidId->fromString($genera.'.'.$area); $topic = $topicLookupSession->getTopic($topicId); $code = $this->_getParam('code'); if (empty($code)) { throw new InvalidArgumentException('Missing the "code" parameter.'); } - $termId = $this->_helper->osidId->fromString('term/'.$this->_getParam('code')); + $termId = $this->_helper->osidId->fromString('term.'.$this->_getParam('code')); $term = $termLookupSession->getTerm($termId); // Build the query. @@ -200,7 +200,7 @@ public function catalogAction() public function searchAction() { if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString('catalog/'.$this->_getParam('catalog')); + $catalogId = $this->_helper->osidId->fromString('catalog.'.$this->_getParam('catalog')); $searchSession = $this->_helper->osid->getCourseManager()->getCourseOfferingSearchSessionForCatalog($catalogId); $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); $topicLookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSessionForCatalog($catalogId); @@ -229,15 +229,15 @@ public function searchAction() if (empty($code)) { throw new InvalidArgumentException('Missing the "code" parameter.'); } - $termId = $this->_helper->osidId->fromString('term/'.$this->_getParam('code')); + $termId = $this->_helper->osidId->fromString('term.'.$this->_getParam('code')); $term = $termLookupSession->getTerm($termId); $query->matchTermId($termId, true); - $genera = 'topic/subject'; + $genera = 'topic.subject'; $area = $this->_getParam('area'); if (!empty($area)) { - $topicId = $this->_helper->osidId->fromString($genera.'/'.$area); + $topicId = $this->_helper->osidId->fromString($genera.'.'.$area); $topic = $topicLookupSession->getTopic($topicId); $query->matchTopicId($topicId, true); } diff --git a/application/controllers/OfferingsController.php b/application/controllers/OfferingsController.php deleted file mode 100755 index 5e91c9f4..00000000 --- a/application/controllers/OfferingsController.php +++ /dev/null @@ -1,700 +0,0 @@ -wildcardStringMatchType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:search:wildcard'); - $this->booleanStringMatchType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:search:boolean'); - $this->instructorType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors'); - $this->enrollmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:enrollment'); - $this->locationType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:location'); - $this->alternateType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:alternates'); - $this->weeklyScheduleType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:weekly_schedule'); - - parent::init(); - - $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division'); - $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); - $this->levelType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/level'); - $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/block'); - $this->instructionMethodType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/instruction_method'); - - $this->termType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:terms'); - - $this->campusType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/campus'); - } - - /** - * Print out a list of all courses. - * - * @return void - * - * @since 4/21/09 - */ - public function listAction() - { - if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseOfferingLookupSessionForCatalog($catalogId); - $this->view->title = $lookupSession->getCourseCatalog()->getDisplayName(); - } else { - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseOfferingLookupSession(); - $this->view->title = 'All Catalogs'; - } - $lookupSession->useFederatedCourseCatalogView(); - - // Add our parameters to the search query - if ($this->_getParam('term')) { - if ('CURRENT' == $this->_getParam('term')) { - $termId = $this->_helper->osidTerms->getNextOrLatestTermId(); - } else { - $termId = $this->_helper->osidId->fromString($this->_getParam('term')); - } - - $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $termLookupSession->useFederatedCourseCatalogView(); - - $this->view->term = $termLookupSession->getTerm($termId); - - $this->view->offerings = $lookupSession->getCourseOfferingsByTerm($this->view->term->getId()); - } else { - $this->view->offerings = $lookupSession->getCourseOfferings(); - } - - $this->setSelectedCatalogId($lookupSession->getCourseCatalogId()); - $this->view->headTitle($this->view->title); - - $this->view->menuIsOfferings = true; - - $this->view->offeringsTitle = 'Sections'; - - // Don't do the work to display instructors if we have a very large number of - // offerings. - if ($this->view->offerings->available() > 200) { - $this->view->hideOfferingInstructors = true; - } - - $this->render('offerings', null, true); - } - - /** - * Answer search results as an xml feed. - * - * @return void - * - * @since 10/21/09 - */ - public function searchxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->getResponse()->setHeader('Content-Type', 'text/xml'); - - $this->searchAction(); - $this->view->sections = $this->searchSession->getCourseOfferingsByQuery($this->query); - - // Set the next and previous terms - if (isset($this->view->term)) { - $terms = $this->termLookupSession->getTerms(); - while ($terms->hasNext()) { - $term = $terms->getNextTerm(); - if ($term->getId()->isEqual($this->view->term->getId())) { - if (isset($lastTerm)) { - $this->view->nextTerm = $lastTerm; - } - if ($terms->hasNext()) { - $this->view->previousTerm = $terms->getNextTerm(); - } - break; - } - $lastTerm = $term; - } - } - // Reset the terms list as due to caching, we will have just wiped out the statement above. - // - // It would be better to fix this in the banner_course_CachingPdoQueryList, but - // I haven't yet figured out how to determine if a result cursor - // has been closed or not. See: - // - // http://stackoverflow.com/questions/1608427/how-can-i-determine-if-a-pdo-statement-cursor-is-closed - $this->view->terms = $this->termLookupSession->getTerms(); - - $this->view->feedTitle = 'Course Offering Results'; - $this->view->feedLink = $this->_helper->pathAsAbsoluteUrl($this->view->url($this->view->searchParams)); - $this->postDispatch(); - } - - /** - * Display a search form and search results. - * - * @return void - * - * @since 6/1/09 - */ - public function searchAction() - { - if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $offeringSearchSession = $this->_helper->osid->getCourseManager()->getCourseOfferingSearchSessionForCatalog($catalogId); - $offeringLookupSession = $this->_helper->osid->getCourseManager()->getCourseOfferingLookupSessionForCatalog($catalogId); - $topicSearchSession = $this->_helper->osid->getCourseManager()->getTopicSearchSessionForCatalog($catalogId); - $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); - $resourceLookupSession = $this->_helper->osid->getCourseManager()->getResourceManager()->getResourceLookupSessionForBin($catalogId); - $this->view->title = 'Search in '.$offeringSearchSession->getCourseCatalog()->getDisplayName(); - } else { - $offeringSearchSession = $this->_helper->osid->getCourseManager()->getCourseOfferingSearchSession(); - $offeringLookupSession = $this->_helper->osid->getCourseManager()->getCourseOfferingLookupSession(); - $topicSearchSession = $this->_helper->osid->getCourseManager()->getTopicSearchSession(); - $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $resourceLookupSession = $this->_helper->osid->getCourseManager()->getResourceManager()->getResourceLookupSession(); - $this->view->title = 'Search in All Catalogs'; - } - $termLookupSession->useFederatedCourseCatalogView(); - $offeringSearchSession->useFederatedCourseCatalogView(); - - /********************************************************* - * Build option lists for the search form - *********************************************************/ - - // Term - if ('ANY' == $this->_getParam('term')) { - // Don't set a term - } elseif (!$this->_getParam('term') || 'CURRENT' == $this->_getParam('term')) { - // When accessing the "current" term via xml, use the term we are in. - // When displaying the search interface, use the next upcoming term. - if ('searchxml' == $this->_getParam('action')) { - $termId = $this->_helper->osidTerms->getCurrentTermId($offeringSearchSession->getCourseCatalogId()); - } else { - $termId = $this->_helper->osidTerms->getNextOrLatestTermId($offeringSearchSession->getCourseCatalogId()); - } - } else { - $termId = $this->_helper->osidId->fromString($this->_getParam('term')); - } - - // Topics - $topicQuery = $topicSearchSession->getTopicQuery(); - $topicQuery->matchGenusType($this->departmentType, true); - // if (isset($termId) && $topicQuery->hasRecordType($this->termType)) { - // $record = $topicQuery->getTopicQueryRecord($this->termType); - // $record->matchTermId($termId, true); - // } - $search = $topicSearchSession->getTopicSearch(); - $order = $topicSearchSession->getTopicSearchOrder(); - $order->orderByDisplayName(); - $search->orderTopicResults($order); - $searchResults = $topicSearchSession->getTopicsBySearch($topicQuery, $search); - $this->view->departments = $searchResults->getTopics(); - - $topicQuery = $topicSearchSession->getTopicQuery(); - $topicQuery->matchGenusType($this->subjectType, true); - // if (isset($termId) && $topicQuery->hasRecordType($this->termType)) { - // $record = $topicQuery->getTopicQueryRecord($this->termType); - // $record->matchTermId($termId, true); - // } - $search = $topicSearchSession->getTopicSearch(); - $order = $topicSearchSession->getTopicSearchOrder(); - $order->orderByDisplayName(); - $search->orderTopicResults($order); - $searchResults = $topicSearchSession->getTopicsBySearch($topicQuery, $search); - $this->view->subjects = $searchResults->getTopics(); - - $topicQuery = $topicSearchSession->getTopicQuery(); - $topicQuery->matchGenusType($this->divisionType, true); - if (isset($termId) && $topicQuery->hasRecordType($this->termType)) { - $record = $topicQuery->getTopicQueryRecord($this->termType); - $record->matchTermId($termId, true); - } - $this->view->divisions = $topicSearchSession->getTopicsByQuery($topicQuery); - - $topicQuery = $topicSearchSession->getTopicQuery(); - $topicQuery->matchGenusType($this->requirementType, true); - if (isset($termId) && $topicQuery->hasRecordType($this->termType)) { - $record = $topicQuery->getTopicQueryRecord($this->termType); - $record->matchTermId($termId, true); - } - $this->view->requirements = $topicSearchSession->getTopicsByQuery($topicQuery); - - $topicQuery = $topicSearchSession->getTopicQuery(); - $topicQuery->matchGenusType($this->levelType, true); - if (isset($termId) && $topicQuery->hasRecordType($this->termType)) { - $record = $topicQuery->getTopicQueryRecord($this->termType); - $record->matchTermId($termId, true); - } - $this->view->levels = $topicSearchSession->getTopicsByQuery($topicQuery); - - $topicQuery = $topicSearchSession->getTopicQuery(); - $topicQuery->matchGenusType($this->blockType, true); - if (isset($termId) && $topicQuery->hasRecordType($this->termType)) { - $record = $topicQuery->getTopicQueryRecord($this->termType); - $record->matchTermId($termId, true); - } - $this->view->blocks = $topicSearchSession->getTopicsByQuery($topicQuery); - - $topicQuery = $topicSearchSession->getTopicQuery(); - $topicQuery->matchGenusType($this->instructionMethodType, true); - if (isset($termId) && $topicQuery->hasRecordType($this->termType)) { - $record = $topicQuery->getTopicQueryRecord($this->termType); - $record->matchTermId($termId, true); - } - $this->view->instructionMethods = $topicSearchSession->getTopicsByQuery($topicQuery); - - $this->view->genusTypes = $offeringLookupSession->getCourseOfferingGenusTypes(); - - // Campuses -- only include if we have more than one. - $campuses = $resourceLookupSession->getResourcesByGenusType($this->campusType); - if ($campuses->hasNext() && $campuses->getNextResource() && $campuses->hasNext()) { - $this->view->campuses = $resourceLookupSession->getResourcesByGenusType($this->campusType); - } - - /********************************************************* - * Set up and run our search query. - *********************************************************/ - - $query = $offeringSearchSession->getCourseOfferingQuery(); - $search = $offeringSearchSession->getCourseOfferingSearch(); - $this->view->searchParams = []; - - // Make our session and query available to the XML version of this action. - $this->termLookupSession = $termLookupSession; - $this->view->terms = $termLookupSession->getTerms(); - - // Add our parameters to the search query - if ($this->_getParam('term')) { - $this->view->searchParams['term'] = $this->_getParam('term'); - - if (isset($termId)) { - $query->matchTermId($termId, true); - - $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $termLookupSession->useFederatedCourseCatalogView(); - $this->view->term = $termLookupSession->getTerm($termId); - $this->view->selectedTermId = $termId; - - $this->view->title .= ' '.$this->view->term->getDisplayName(); - } - } - - if ($this->_getParam('department')) { - if (is_array($this->_getParam('department'))) { - $departments = $this->_getParam('department'); - } else { - $departments = [$this->_getParam('department')]; - } - - if (count($departments)) { - foreach ($departments as $idString) { - $id = $this->_helper->osidId->fromString($idString); - $query->matchTopicId($id, true); - // set the first as the selected one if multiple. - if (!isset($this->view->selectedDepartmentId)) { - $this->view->selectedDepartmentId = $id; - } - } - $this->view->searchParams['department'] = $departments; - } - } - - if ($this->_getParam('subject')) { - if (is_array($this->_getParam('subject'))) { - $subjects = $this->_getParam('subject'); - } else { - $subjects = [$this->_getParam('subject')]; - } - - if (count($subjects)) { - foreach ($subjects as $idString) { - $id = $this->_helper->osidId->fromString($idString); - $query->matchTopicId($id, true); - // set the first as the selected one if multiple. - if (!isset($this->view->selectedSubjectId)) { - $this->view->selectedSubjectId = $id; - } - } - $this->view->searchParams['subject'] = $subjects; - } - } - - if ($this->_getParam('division')) { - if (is_array($this->_getParam('division'))) { - $divisions = $this->_getParam('division'); - } else { - $divisions = [$this->_getParam('division')]; - } - - if (count($divisions)) { - foreach ($divisions as $idString) { - $id = $this->_helper->osidId->fromString($idString); - $query->matchTopicId($id, true); - // set the first as the selected one if multiple. - if (!isset($this->view->selectedDivisionId)) { - $this->view->selectedDivisionId = $id; - } - } - $this->view->searchParams['division'] = $divisions; - } - } - - $this->view->selectedRequirementIds = []; - if ($this->_getParam('requirement')) { - if (is_array($this->_getParam('requirement'))) { - $requirements = $this->_getParam('requirement'); - } else { - $requirements = [$this->_getParam('requirement')]; - } - - if (count($requirements)) { - foreach ($requirements as $idString) { - $id = $this->_helper->osidId->fromString($idString); - $query->matchTopicId($id, true); - $this->view->selectedRequirementIds[] = $id; - } - $this->view->searchParams['requirement'] = $requirements; - } - } - - $this->view->selectedLevelIds = []; - if ($this->_getParam('level')) { - if (is_array($this->_getParam('level'))) { - $levels = $this->_getParam('level'); - } else { - $levels = [$this->_getParam('level')]; - } - - if (count($levels)) { - foreach ($levels as $idString) { - $id = $this->_helper->osidId->fromString($idString); - $query->matchTopicId($id, true); - $this->view->selectedLevelIds[] = $id; - } - $this->view->searchParams['level'] = $levels; - } - } - - $this->view->selectedBlockIds = []; - if ($this->_getParam('block')) { - if (is_array($this->_getParam('block'))) { - $blocks = $this->_getParam('block'); - } else { - $blocks = [$this->_getParam('block')]; - } - - if (count($blocks)) { - foreach ($blocks as $idString) { - $id = $this->_helper->osidId->fromString($idString); - $query->matchTopicId($id, true); - $this->view->selectedBlockIds[] = $id; - } - $this->view->searchParams['block'] = $blocks; - } - } - - $this->view->selectedInstructionMethodIds = []; - if ($this->_getParam('instruction_method')) { - if (is_array($this->_getParam('instruction_method'))) { - $instructionMethods = $this->_getParam('instruction_method'); - } else { - $instructionMethods = [$this->_getParam('instruction_method')]; - } - - if (count($instructionMethods)) { - foreach ($instructionMethods as $idString) { - $id = $this->_helper->osidId->fromString($idString); - $query->matchTopicId($id, true); - $this->view->selectedInstructionMethodIds[] = $id; - } - $this->view->searchParams['instruction_method'] = $instructionMethods; - } - } - - $this->view->selectedGenusTypes = []; - if ($this->_getParam('type')) { - if (is_array($this->_getParam('type'))) { - $genusTypes = $this->_getParam('type'); - } else { - $genusTypes = [$this->_getParam('type')]; - } - - if (count($genusTypes)) { - foreach ($genusTypes as $typeString) { - $genusType = $this->_helper->osidType->fromString($typeString); - $query->matchGenusType($genusType, true); - $this->view->selectedGenusTypes[] = $genusType; - } - $this->view->searchParams['type'] = $genusTypes; - } - } - - // Campuses - $this->view->selectedCampusIds = []; - if ($this->_getParam('location')) { - if (is_array($this->_getParam('location'))) { - $campuses = $this->_getParam('location'); - } else { - $campuses = [$this->_getParam('location')]; - } - - if (count($campuses)) { - foreach ($campuses as $idString) { - $id = $this->_helper->osidId->fromString($idString); - $query->matchLocationId($id, true); - $this->view->selectedCampusIds[] = $id; - } - $this->view->searchParams['location'] = $campuses; - } - } - - // Set the default selection to lecture/seminar if the is a new search - if (!$this->_getParam('search') && !count($this->view->selectedGenusTypes)) { - $this->view->selectedGenusTypes = $this->_helper->osidTypes->getDefaultGenusTypes(); - } - - if ($query->hasRecordType($this->weeklyScheduleType)) { - $queryRecord = $query->getCourseOfferingQueryRecord($this->weeklyScheduleType); - - if ($this->_getParam('days')) { - if (is_array($this->_getParam('days'))) { - $days = $this->_getParam('days'); - } else { - $days = [$this->_getParam('days')]; - } - - if (count($days)) { - if ('exclusive' == $this->_getParam('days_mode')) { - $this->view->searchParams['days_mode'] = 'exclusive'; - - if (!in_array('sunday', $days)) { - $queryRecord->matchMeetsSunday(false); - } - - if (!in_array('monday', $days)) { - $queryRecord->matchMeetsMonday(false); - } - - if (!in_array('tuesday', $days)) { - $queryRecord->matchMeetsTuesday(false); - } - - if (!in_array('wednesday', $days)) { - $queryRecord->matchMeetsWednesday(false); - } - - if (!in_array('thursday', $days)) { - $queryRecord->matchMeetsThursday(false); - } - - if (!in_array('friday', $days)) { - $queryRecord->matchMeetsFriday(false); - } - - if (!in_array('saturday', $days)) { - $queryRecord->matchMeetsSaturday(false); - } - } - // Inclusive search. - else { - $this->view->searchParams['days_mode'] = 'inclusive'; - - if (in_array('sunday', $days)) { - $queryRecord->matchMeetsSunday(true); - } - - if (in_array('monday', $days)) { - $queryRecord->matchMeetsMonday(true); - } - - if (in_array('tuesday', $days)) { - $queryRecord->matchMeetsTuesday(true); - } - - if (in_array('wednesday', $days)) { - $queryRecord->matchMeetsWednesday(true); - } - - if (in_array('thursday', $days)) { - $queryRecord->matchMeetsThursday(true); - } - - if (in_array('friday', $days)) { - $queryRecord->matchMeetsFriday(true); - } - - if (in_array('saturday', $days)) { - $queryRecord->matchMeetsSaturday(true); - } - } - - $this->view->searchParams['days'] = $days; - } - } else { - $this->view->searchParams['days'] = []; - } - - if ($this->_getParam('time_start') || $this->_getParam('time_end')) { - $start = (int) $this->_getParam('time_start'); - $end = (int) $this->_getParam('time_end'); - if (!$end) { - $end = 86400; - } - if ($start > 0 || $end < 86400) { - $queryRecord->matchMeetingTime($start, $end, true); - } - - $this->view->timeStart = $start; - $this->view->timeEnd = $end; - $this->view->searchParams['time_start'] = $start; - $this->view->searchParams['time_end'] = $end; - } else { - $this->view->timeStart = 0; - $this->view->timeEnd = 86400; - } - } - - if ($this->_getParam('keywords')) { - $query->matchKeyword($this->_getParam('keywords'), $this->booleanStringMatchType, true); - $this->view->keywords = $this->_getParam('keywords'); - $this->view->searchParams['keywords'] = $this->_getParam('keywords'); - } else { - $this->view->keywords = ''; - } - - if ($this->_getParam('instructor')) { - if ($query->hasRecordType($this->instructorType)) { - $queryRecord = $query->getCourseOfferingQueryRecord($this->instructorType); - $queryRecord->matchInstructorId($this->_helper->osidId->fromString($this->_getParam('instructor')), true); - } - $this->view->searchParams['instructor'] = $this->_getParam('instructor'); - } - - if ($this->_getParam('enrollable')) { - if ($query->hasRecordType($this->enrollmentType)) { - $queryRecord = $query->getCourseOfferingQueryRecord($this->enrollmentType); - $queryRecord->matchEnrollable(true); - } - $this->view->searchParams['enrollable'] = $this->_getParam('enrollable'); - } - - // Make our session and query available to the XML version of this action. - $this->searchSession = $offeringSearchSession; - $this->query = $query; - - // Run the query if submitted. - if ($this->_getParam('search')) { - $this->view->searchParams['search'] = $this->_getParam('search'); - $this->view->paginator = new Zend_Paginator(new Paginator_Adaptor_CourseOfferingSearch($offeringSearchSession, $query)); - $this->view->paginator->setCurrentPageNumber($this->_getParam('page')); - } - - /********************************************************* - * Options for output - *********************************************************/ - - $this->setSelectedCatalogId($offeringSearchSession->getCourseCatalogId()); - $this->view->headTitle($this->view->title); - - $this->view->menuIsSearch = true; - } - - /** - * View a catalog details. - * - * @return void - * - * @since 4/21/09 - */ - public function viewAction() - { - $this->viewBase(); - - // Bookmarked Courses and Schedules - $this->view->bookmarks_CourseId = $this->view->offering->getCourseId(); - - $this->view->menuIsOfferings = true; - - $this->render(); - $this->render('offerings', null, true); - } - - protected function viewBase() - { - $id = $this->_helper->osidId->fromString($this->_getParam('offering')); - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseOfferingLookupSession(); - $lookupSession->useFederatedCourseCatalogView(); - $this->view->offering = $lookupSession->getCourseOffering($id); - - // Load the topics into our view - $this->loadTopics($this->view->offering->getTopics()); - - // Set the selected Catalog Id. - $catalogSession = $this->_helper->osid->getCourseManager()->getCourseOfferingCatalogSession(); - $catalogIds = $catalogSession->getCatalogIdsByCourseOffering($id); - if ($catalogIds->hasNext()) { - $this->setSelectedCatalogId($catalogIds->getNextId()); - } - - // Set the title - $this->view->title = $this->view->offering->getDisplayName(); - $this->view->headTitle($this->view->title); - - // Term - $this->view->term = $this->view->offering->getTerm(); - - // Other offerings - $this->view->offeringsTitle = 'All Sections'; - $this->view->offerings = $lookupSession->getCourseOfferingsByTermForCourse( - $this->view->offering->getTermId(), - $this->view->offering->getCourseId() - ); - - // Alternates - if ($this->view->offering->hasRecordType($this->alternateType)) { - $record = $this->view->offering->getCourseOfferingRecord($this->alternateType); - if ($record->hasAlternates()) { - $this->view->alternates = $record->getAlternates(); - } - } - } - - /** - * Answer search results as an xml feed. - * - * @return void - * - * @since 10/21/09 - */ - public function viewxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setRender('searchxml'); - $this->getResponse()->setHeader('Content-Type', 'text/xml'); - - $this->viewBase(); - - $this->view->feedTitle = $this->view->title; - $this->view->feedLink = $this->_helper->pathAsAbsoluteUrl('/offerings/view/'.$this->_getParam('catalog').'/offering/'.$this->_getParam('offering')); - $this->view->sections = new phpkit_course_ArrayCourseOfferingList([$this->view->offering]); - $this->postDispatch(); - } -} diff --git a/application/controllers/ResourcesController.php b/application/controllers/ResourcesController.php deleted file mode 100755 index 6bb8f5f7..00000000 --- a/application/controllers/ResourcesController.php +++ /dev/null @@ -1,164 +0,0 @@ -instructorType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors'); - parent::init(); - } - - // /** - // * Print out a list of all topics - // * - // * @return void - // * @access public - // * @since 4/21/09 - // */ - // public function listAction () { - // if ($this->_getParam('catalog')) { - // $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - // $lookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSessionForCatalog($catalogId); - // $this->view->title = 'Topics in '.$lookupSession->getCourseCatalog()->getDisplayName(); - // } else { - // $lookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSession(); - // $this->view->title = 'Topics in All Catalogs'; - // } - // $lookupSession->useFederatedCourseCatalogView(); - // - // $this->loadTopics($lookupSession->getTopics()); - // - // $this->setSelectedCatalogId($lookupSession->getCourseCatalogId()); - // $this->view->headTitle($this->view->title); - // } - - /** - * View a catalog details. - * - * @return void - * - * @since 4/21/09 - */ - public function viewAction() - { - $id = $this->_helper->osidId->fromString($this->_getParam('resource')); - $lookupSession = $this->_helper->osid->getCourseManager()->getResourceManager()->getResourceLookupSession(); - $lookupSession->useFederatedBinView(); - $this->view->resource = $lookupSession->getResource($id); - - $offeringSearchSession = $this->_helper->osid->getCourseManager()->getCourseOfferingSearchSession(); - $offeringSearchSession->useFederatedCourseCatalogView(); - $query = $offeringSearchSession->getCourseOfferingQuery(); - - if ($this->_getParam('term')) { - $termId = $this->_helper->osidId->fromString($this->_getParam('term')); - - $query->matchTermId($termId, true); - - $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $termLookupSession->useFederatedCourseCatalogView(); - $this->view->term = $termLookupSession->getTerm($termId); - } - - // Match the instructor Id - if ($query->hasRecordType($this->instructorType)) { - $queryRecord = $query->getCourseOfferingQueryRecord($this->instructorType); - $queryRecord->matchInstructorId($id, true); - - $this->view->offerings = $offeringSearchSession->getCourseOfferingsByQuery($query); - - // Don't do the work to display instructors if we have a very large number of - // offerings. - if ($this->view->offerings->available() > 200) { - $this->view->hideOfferingInstructors = true; - } - - $this->view->offeringsTitle = 'Sections'; - - $allParams = []; - $allParams['resource'] = $this->_getParam('resource'); - if ($this->getSelectedCatalogId()) { - $allParams['catalog'] = $this->_helper->osidId->toString($this->getSelectedCatalogId()); - } - $this->view->offeringsForAllTermsUrl = $this->_helper->url('view', 'resources', null, $allParams); - - $this->render('offerings', null, true); - } else { - $this->view->hideOfferingInstructors = true; - } - - // Set the selected Catalog Id. - if ($this->_getParam('catalog')) { - $this->setSelectedCatalogId($this->_helper->osidId->fromString($this->_getParam('catalog'))); - } - - // Set the title - $this->view->title = $this->view->resource->getDisplayName(); - $this->view->headTitle($this->view->title); - } - - /** - * List all department topics as a text file with each line being Id|DisplayName. - * - * @return void - * - * @since 10/20/09 - */ - public function listcampusestxtAction() - { - $this->renderTextList(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/campus')); - } - - /** - * Render a text feed for a given topic type. - * - * @return void - * - * @since 11/17/09 - */ - private function renderTextList(osid_type_Type $genusType) - { - header('Content-Type: text/plain'); - - if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $lookupSession = $this->_helper->osid->getCourseManager()->getResourceManager()->getResourceLookupSessionForBin($catalogId); - $this->view->title = 'Resources in '.$lookupSession->getBin()->getDisplayName(); - } else { - $lookupSession = $this->_helper->osid->getCourseManager()->getResourceManager()->getResourceLookupSession(); - $this->view->title = 'Resources in All Bins'; - } - $lookupSession->useFederatedBinView(); - - $resources = $lookupSession->getResourcesByGenusType($genusType); - - while ($resources->hasNext()) { - $resource = $resources->getNextResource(); - echo $this->_helper->osidId->toString($resource->getId()).'|'.$this->_helper->osidId->toString($resource->getId()).' - '.$resource->getDisplayName()."\n"; - } - // var_dump($lookupSession); - // var_dump($resources); - exit; - } -} diff --git a/application/controllers/SchedulesController.php b/application/controllers/SchedulesController.php deleted file mode 100755 index 3ad025da..00000000 --- a/application/controllers/SchedulesController.php +++ /dev/null @@ -1,765 +0,0 @@ -_helper->auth->getHelper()->isAuthenticated()) { - $this->_redirect( - $this->view->url(['controller' => 'auth', 'action' => 'login', 'return' => $this->view->url()]), - ['exit' => true, 'prependBase' => false]); - } - } - - /** - * Initialize the catalog and term we are working with. - * - * Sets the following member properties: - * catalogId osid_id_Id or NULL - * termLookupSession osid_course_TermLookupSession - * termId osid_id_Id or NULL - * - * @return void - */ - protected function initializeCatalogAndTerm() - { - // Select the catalog. - if ($this->_getParam('catalog')) { - $this->catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $this->setSavedCatalogId($this->catalogId); - } else { - // Check for a saved catalog id. - $this->catalogId = $this->getSavedCatalogId(); - } - - // Load the termLookupSession - if ($this->catalogId) { - $this->termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($this->catalogId); - } else { - $this->termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $this->catalogId = $this->termLookupSession->getCourseCatalogId(); - } - - // Select the term - if ('ANY' == $this->_getParam('term')) { - // Don't set a term - $this->termId = null; - } elseif (!$this->_getParam('term') || 'CURRENT' == $this->_getParam('term')) { - $this->termId = $this->_helper->osidTerms->getNextOrLatestTermId($this->catalogId); - } else { - $this->termId = $this->_helper->osidId->fromString($this->_getParam('term')); - } - } - - /** - * Answer a saved catalog Id or null. - * - * @return osid_id_Id or NULL - */ - protected function getSavedCatalogId() - { - if (!isset($this->savedCatalogId)) { - $stmt = Zend_Registry::get('db')->prepare('SELECT * FROM user_catalog WHERE user_id = ?'); - $stmt->execute([$this->_helper->auth()->getUserId()]); - $row = $stmt->fetch(); - $stmt->closeCursor(); - if ($row) { - $this->savedCatalogId = new phpkit_id_Id($row['catalog_id_authority'], $row['catalog_id_namespace'], $row['catalog_id_keyword']); - } else { - $this->savedCatalogId = null; - } - } - - return $this->savedCatalogId; - } - - /** - * Set the saved catalog id. - * - * @return void - */ - protected function setSavedCatalogId(osid_id_Id $catalogId) - { - if (null !== $this->getSavedCatalogId() && $catalogId->isEqual($this->getSavedCatalogId())) { - return; - } - - $db = Zend_Registry::get('db'); - $insert = $db->prepare('INSERT INTO user_catalog (user_id, catalog_id_authority, catalog_id_namespace, catalog_id_keyword) VALUES (?, ?, ?, ?);'); - try { - $insert->execute([$this->_helper->auth()->getUserId(), $catalogId->getAuthority(), $catalogId->getIdentifierNamespace(), $catalogId->getIdentifier()]); - } catch (Zend_Db_Statement_Exception $e) { - // Already exists - if (23000 == $e->getCode()) { - $update = $db->prepare('UPDATE user_catalog SET catalog_id_authority = ?, catalog_id_namespace = ?, catalog_id_keyword = ? WHERE user_id = ?'); - $update->execute([$catalogId->getAuthority(), $catalogId->getIdentifierNamespace(), $catalogId->getIdentifier(), $this->_helper->auth()->getUserId()]); - } else { - throw $e; - } - } - - $this->savedCatalogId = $catalogId; - } - - public function indexAction() - { - $this->initializeCatalogAndTerm(); - - // Set up data for the menu rendering - $this->setSelectedCatalogId($this->catalogId); - - $this->view->emailEnabled = $this->emailEnabled(); - - // Catalogs - $catalogLookupSession = $this->_helper->osid->getCourseManager()->getCourseCatalogLookupSession(); - $this->view->catalogs = $catalogLookupSession->getCourseCatalogs(); - - // Load all terms for our selection control - $this->termLookupSession->useFederatedCourseCatalogView(); - $terms = $this->termLookupSession->getTerms(); - $termCatalogSession = $this->_helper->osid->getCourseManager()->getTermCatalogSession(); - $this->view->terms = []; - while ($terms->hasNext()) { - $term = $terms->getNextTerm(); - $termCatalogId = $this->catalogId; - $this->view->terms[] = [ - 'name' => $term->getDisplayName(), - 'url' => $this->view->url([ - 'catalog' => $this->_helper->osidId->toString($termCatalogId), - 'term' => $this->_helper->osidId->toString($term->getId()), - ]), - 'id' => $term->getId(), - ]; - } - // Set the selected term - if ($this->termId) { - $this->view->selectedTermId = $this->termId; - $this->view->termIdString = $this->_helper->osidId->toString($this->termId); - } - - // Load the bookmarks for the selected catalog/terms - $bookmarks = $this->_helper->bookmarks(); - if (isset($this->view->selectedTermId)) { - $this->view->bookmarked_courses = $bookmarks->getBookmarkedCoursesInCatalogForTerm($this->catalogId, $this->view->selectedTermId); - } else { - $this->view->bookmarked_courses = $bookmarks->getAllBookmarkedCourses(); - } - - // Load the Schedules for the selected catalog/terms - $schedules = new Schedules(Zend_Registry::get('db'), $this->_helper->auth->getHelper()->getUserId(), $this->_helper->osid->getCourseManager()); - if ($this->view->selectedTermId) { - $this->view->schedules = $schedules->getSchedulesByTerm($this->view->selectedTermId); - } else { - $this->view->schedules = $schedules->getSchedules(); - } - - $this->view->leftText = " -

Important: This tool is for planning purposes only. It does not register you for classes.

- -
Basic Usage: -
    -
  1. Search for courses in the catalog and save interesting ones.
  2. -
  3. Create one or more schedules in the Planner.
  4. -
  5. Add courses to schedules.
  6. -
  7. Print or email your schedules.
  8. -
- -

For more help see: go/catalog-help

-

Issues or Feedback? go/webbugs/Catalog/Planner

-
- "; - } - - /** - * Verify change actions. - * - * @return void - * - * @since 8/2/10 - */ - protected function verifyChangeRequest() - { - if (!$this->_request->isPost()) { - throw new PermissionDeniedException('Create Schedules must be submitted as a POST request.'); - } - $this->_request->setParamSources(['_POST']); - - // Verify our CSRF key - if (!$this->_getParam('csrf_key') == $this->_helper->csrfKey()) { - throw new PermissionDeniedException('Invalid CSRF Key. Please log in again.'); - } - } - - /** - * Return to the index action. - * - * @return void - * - * @since 8/2/10 - */ - protected function returnToIndex() - { - $catalogIdString = $this->_getParam('catalog'); - $termIdString = $this->_getParam('term'); - - // Forward us back to the listing. - $url = $this->view->url(['action' => 'index', 'controller' => 'schedules', 'catalog' => $catalogIdString, 'term' => $termIdString]); - $this->_redirect($url, ['exit' => true, 'prependBase' => false]); - } - - /** - * Create a new schedule. - * - * @return void - * - * @since 8/2/10 - */ - public function createAction() - { - $this->verifyChangeRequest(); - - $schedules = new Schedules(Zend_Registry::get('db'), $this->_helper->auth->getHelper()->getUserId(), $this->_helper->osid->getCourseManager()); - - $schedule = $schedules->createSchedule($this->_helper->osidId->fromString($this->_getParam('term'))); - - $this->returnToIndex(); - } - - /** - * Update a schedule. - * - * @return void - * - * @since 8/2/10 - */ - public function updateAction() - { - $this->verifyChangeRequest(); - - $schedules = new Schedules(Zend_Registry::get('db'), $this->_helper->auth->getHelper()->getUserId(), $this->_helper->osid->getCourseManager()); - - $schedule = $schedules->getSchedule($this->_getParam('schedule_id')); - $schedule->setName($this->_getParam('name')); - - $this->returnToIndex(); - } - - /** - * Delete a schedule. - * - * @return void - * - * @since 8/2/10 - */ - public function deleteAction() - { - $this->verifyChangeRequest(); - - $schedules = new Schedules(Zend_Registry::get('db'), $this->_helper->auth->getHelper()->getUserId(), $this->_helper->osid->getCourseManager()); - - $schedules->deleteSchedule($this->_getParam('schedule_id')); - - $this->returnToIndex(); - } - - /** - * Add sections to a schedule. - * - * @return void - * - * @since 8/2/10 - */ - public function addAction() - { - $this->verifyChangeRequest(); - - $schedules = new Schedules(Zend_Registry::get('db'), $this->_helper->auth->getHelper()->getUserId(), $this->_helper->osid->getCourseManager()); - - $schedule = $schedules->getSchedule($this->_getParam('schedule_id')); - - // Get our ids from the POST - $offeringIds = []; - foreach ($_POST as $key => $val) { - if (preg_match('/^section_group_[0-9]+$/', $key)) { - $offeringIds[] = $this->_helper->osidId->fromString($val); - } - } - if (!count($offeringIds)) { - throw new InvalidArgumentException('No Sections selected.'); - } - - /********************************************************* - * Validate the set of offerings chosen - *********************************************************/ - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseOfferingLookupSession(); - $lookupSession->useFederatedCourseCatalogView(); - $linkType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:link'); - - $offering = $lookupSession->getCourseOffering($offeringIds[0]); - $course = $offering->getCourse(); - $termId = $offering->getTermId(); - - $selectedLinkSet = $this->_helper->osidId->fromString($this->_getParam('section_set')); - $linkTypes = $course->getLinkTypeIdsForTermAndSet($termId, $selectedLinkSet); - $requiredLinkTypes = []; - while ($linkTypes->hasNext()) { - $requiredLinkTypes[] = [ - 'id' => $linkTypes->getNextId(), - 'found' => false, - ]; - } - - foreach ($offeringIds as $id) { - $offering = $lookupSession->getCourseOffering($id); - - // Verify that the offering is part of the selected link-set. - $linkRecord = $offering->getCourseOfferingRecord($linkType); - if (!$selectedLinkSet->isEqual($linkRecord->getLinkSetId())) { - throw new Exception('The offering chosen is not part of the link-set selected.'); - } - - // Check that we are adding a single section from each link-type. - $linkTypeId = $linkRecord->getLinkTypeId(); - $checked = false; - foreach ($requiredLinkTypes as $key => $info) { - if ($info['id']->isEqual($linkTypeId)) { - $checked = true; - if ($info['found']) { - throw new Exception('A second section from the same link-group is selected.'); - } else { - $requiredLinkTypes[$key]['found'] = true; - } - } - } - if (!$checked) { - throw new Exception("The link-group id of the offering '".$linkTypeId->getIdentifier()."' wasn't in the required list."); - } - - // Also check that the sections are from the same course and term. - if (!$offering->getTermId()->isEqual($termId)) { - throw new Exception('Trying to add offerings from multiple terms.'); - } - if (!$offering->getCourseId()->isEqual($course->getId())) { - throw new Exception('Trying to add offerings from multiple courses.'); - } - } - // Check that we are adding a section for each link-group. - foreach ($requiredLinkTypes as $info) { - if (!$info['found']) { - throw new Exception('No offering was added for the link-group '.$info['id']->getIdentifier().' when adding sections for '.$course->getDisplayName().'. POST: '.print_r($_POST, true)); - } - } - - /********************************************************* - * Remove any offerings for the course already added. - *********************************************************/ - foreach ($schedule->getOfferings() as $oldOffering) { - if ($oldOffering->getCourseId()->isEqual($course->getId())) { - $schedule->remove($oldOffering->getId()); - } - } - - /********************************************************* - * Add the offerings to the Schedule - *********************************************************/ - foreach ($offeringIds as $offeringId) { - try { - $schedule->add($offeringId); - } catch (Exception $e) { - if (23000 != $e->getCode()) { - throw $e; - } - } - } - - $this->returnToIndex(); - } - - /** - * Remove an offering from a schedule. - * - * @return void - * - * @since 8/4/10 - */ - public function removeAction() - { - $this->verifyChangeRequest(); - - $schedules = new Schedules(Zend_Registry::get('db'), $this->_helper->auth->getHelper()->getUserId(), $this->_helper->osid->getCourseManager()); - - $schedule = $schedules->getSchedule($this->_getParam('schedule_id')); - - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseOfferingLookupSession(); - $lookupSession->useFederatedCourseCatalogView(); - - $offering = $lookupSession->getCourseOffering($this->_helper->osidId->fromString($this->_getParam('offering'))); - $courseId = $offering->getCourseId(); - - // Remove the selected offering. - $schedule->remove($offering->getId()); - - // Remove all other offerings for the course. - foreach ($schedule->getOfferings() as $offering) { - if ($offering->getCourse()->getId()->isEqual($courseId)) { - $schedule->remove($offering->getId()); - } - } - - $this->returnToIndex(); - } - - /** - * Answer a JSON list of sections information for a course. - * - * @return void - * - * @since 8/3/10 - */ - public function sectionsforcourseAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - $this->getResponse()->setHeader('Content-Type', 'text/plain'); - - $offeringSearchSession = $this->_helper->osid->getCourseManager()->getCourseOfferingSearchSession(); - $offeringSearchSession->useFederatedCourseCatalogView(); - - $query = $offeringSearchSession->getCourseOfferingQuery(); - $query->matchCourseId($this->_helper->osidId->fromString($this->_getParam('course')), true); - $query->matchTermId($this->_helper->osidId->fromString($this->_getParam('term')), true); - - $results = $offeringSearchSession->getCourseOfferingsByQuery($query); - - $schedules = new Schedules(Zend_Registry::get('db'), $this->_helper->auth->getHelper()->getUserId(), $this->_helper->osid->getCourseManager()); - $schedule = $schedules->getSchedule($this->_getParam('schedule_id')); - - $sets = []; - $linkType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:link'); - $instructorType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors'); - while ($results->hasNext()) { - $offering = $results->getNextCourseOffering(); - - $instructors = $offering->getInstructors(); - $instructorString = ''; - while ($instructors->hasNext()) { - $instructorString .= $instructors->getNextResource()->getDisplayName().', '; - } - $instructorString = trim($instructorString, ', '); - - $conflicts = $schedule->conflicts($offering); - if ($conflicts) { - $conflictString = ''; - $conflictingNames = []; - foreach ($schedule->getConflictingEvents($offering) as $event) { - $conflictingNames[] = $event['name']; - } - $conflictString = 'Conflicts with: '.implode(', ', array_unique($conflictingNames)); - } else { - $conflictString = ''; - } - $info = [ - 'id' => $this->_helper->osidId->toString($offering->getId()), - 'name' => $offering->getDisplayName(), - 'type' => $offering->getGenusType()->getDisplayName(), - 'instructor' => $instructorString, - 'location' => $offering->getLocationInfo(), - 'availability' => $this->view->getAvailabilityLink($offering), - 'schedule' => $this->view->formatScheduleInfo($offering->getScheduleInfo()), - 'conflicts' => $conflicts, - 'conflictString' => $conflictString, - ]; - - // Get the link id and ensure that we have a set and type-group for it. - $linkRecord = $offering->getCourseOfferingRecord($linkType); - $linkSetIdString = $this->_helper->osidId->toString($linkRecord->getLinkSetId()); - $info['link_set'] = $linkSetIdString; - if (!isset($sets[$linkSetIdString])) { - $sets[$linkSetIdString] = []; - } - if (!isset($sets[$linkSetIdString]['types'])) { - $sets[$linkSetIdString]['types'] = []; - } - - $linkTypeIdString = $this->_helper->osidId->toString($linkRecord->getLinkTypeId()); - $info['link_type'] = $linkTypeIdString; - if (!isset($sets[$linkSetIdString]['types'][$linkTypeIdString])) { - $sets[$linkSetIdString]['types'][$linkTypeIdString] = []; - } - - // To start with, enable the first section in each group. - // Later, we may want to check if the target schedule already has - // this course added and select the already-added versions so that - // a second addition will update that course's sections rather than - // add them again. - if (!count($sets[$linkSetIdString]['types'][$linkTypeIdString])) { - $info['selected'] = true; - } - - if ($schedule->includes($offering->getId())) { - if (count($sets[$linkSetIdString]['types'][$linkTypeIdString])) { - $sets[$linkSetIdString]['types'][$linkTypeIdString][0]['selected'] = false; - } - $info['selected'] = true; - $sets[$linkSetIdString]['selected'] = true; - } - - // Add the info to the appropriate set. - $sets[$linkSetIdString]['types'][$linkTypeIdString][] = $info; - } - // Use indexted arrays. - // foreach ($sets as $key => $types) { - // $sets[$key] = array_values($types); - // } - // $sets = array_values($sets); - - echo json_encode($sets); - } - - /** - * Answer an array of events for the schedule in JSON format. - * - * @return void - * - * @since 8/5/10 - */ - public function eventsjsonAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - $this->getResponse()->setHeader('Content-Type', 'text/plain'); - - $schedules = new Schedules(Zend_Registry::get('db'), $this->_helper->auth->getHelper()->getUserId(), $this->_helper->osid->getCourseManager()); - $schedule = $schedules->getSchedule($this->_getParam('schedule_id')); - - $thisWeek = Week::current(); - - $events = $schedule->getWeeklyEvents(); - foreach ($events as $i => &$event) { - $event['title'] = $event['name']; - - if ($event['location']) { - $event['title'] .= '
'.$event['location']; - } - - if ($event['crn']) { - $event['title'] .= ' - CRN: '.$event['crn']; - } - - $day = $thisWeek->asDateAndTime(); - if ($event['dayOfWeek']) { - $day = $day->plus(Duration::withDays($event['dayOfWeek'])); - } - - $dateTime = $day->plus(Duration::withSeconds($event['startTime'])); - $event['start'] = $dateTime->ymdString().' '.$dateTime->hmsString(); - $dateTime = $day->plus(Duration::withSeconds($event['endTime'])); - $event['end'] = $dateTime->ymdString().' '.$dateTime->hmsString(); - - $event['id'] = $i; - } - - echo json_encode($events); - } - - /** - * Answer a PNG Image of the schedule. - * - * @return void - * - * @since 8/5/10 - */ - public function pngAction() - { - $this->_helper->layout->disableLayout(); - - $this->initializeScheduleImage(); - - $this->getResponse()->setHeader('Content-Type', 'image/png'); - } - - /** - * Intitialize our schedule with the ID passed. - * - * @return void - */ - protected function initializeSchedule() - { - if (!isset($this->view->schedule)) { - $schedules = new Schedules(Zend_Registry::get('db'), $this->_helper->auth->getHelper()->getUserId(), $this->_helper->osid->getCourseManager()); - $this->view->schedule = $schedules->getSchedule($this->_getParam('schedule_id')); - } - } - - /** - * Initialize a schedule image. - * - * @return void - */ - protected function initializeScheduleImage() - { - $this->initializeSchedule(); - - $config = Zend_Registry::getInstance()->config; - $this->view->fontFile = $config->schedules->image->font_file; - - $this->view->events = $this->view->schedule->getWeeklyEvents(); - - $this->view->minTime = $this->view->schedule->getEarliestTime(); - if ($this->view->schedule->getLatestTime()) { - $this->view->maxTime = $this->view->schedule->getLatestTime(); - } else { - $this->view->minTime = 9 * 3600; - $this->view->maxTime = 17 * 3600; - } - - $this->view->height = 600; - } - - /** - * Answer a print-view of the schedule. - * - * @return void - * - * @since 8/5/10 - */ - public function printAction() - { - $this->_helper->layout->disableLayout(); - - $this->initializeSchedule(); - } - - /** - * Answer true if sending email is enabled. - * - * @return bool - */ - protected function emailEnabled() - { - $config = Zend_Registry::getInstance()->config; - if (!isset($config->schedules->email->enabled) || !$config->schedules->email->enabled) { - return false; - } - - // Allow enabling email for only some users - if (!empty($config->schedules->email->allowed_groups)) { - $userGroups = $this->_helper->auth()->getUserGroups(); - foreach ($config->schedules->email->allowed_groups as $group) { - if (in_array($group, $userGroups)) { - return true; - } - } - - return false; - } - - return true; - } - - /** - * Answer the email address to send mail from. - * - * @return string - */ - protected function getFromEmail() - { - $config = Zend_Registry::getInstance()->config; - $name = $this->_helper->auth()->getUserDisplayName(); - - if (isset($config->schedules->email->send_mail_as_user) && $config->schedules->email->send_mail_as_user) { - return $name.' <'.$this->_helper->auth()->getUserEmail().'>'; - } elseif (isset($config->schedules->email->send_mail_as) && $config->schedules->email->send_mail_as) { - return $name.' - Catalog <'.$config->schedules->email->send_mail_as.'>'; - } else { - throw new Exception('schedules.email.send_mail_as_user is false, but schedules.email.send_mail_as is not set (in frontend_config.ini).'); - } - } - - /** - * Email a schedule to one or more addresses. - * - * @return void - */ - public function emailAction() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - $this->getResponse()->setHeader('Content-Type', 'text/plain'); - - try { - if (!$this->emailEnabled()) { - throw new Exception('Emailing of schedules is not enabled in frontend_config.ini.'); - } - $this->verifyChangeRequest(); - - $this->initializeSchedule(); - $this->view->messageBody = $this->_getParam('message'); - - // Generate the text version of the email. - $this->render('email-text'); - $text = $this->getResponse()->getBody(); - $this->getResponse()->setBody(''); - - // Generate the html version of the email. - $this->render('email-html'); - $html = $this->getResponse()->getBody(); - $this->getResponse()->setBody(''); - - // Generate the Schedule image. - $this->initializeScheduleImage(); - $this->render('generate-image'); - ob_start(); - imagepng($this->view->image, null, 5); - imagedestroy($this->view->image); - $imageData = ob_get_clean(); - - // To - $to = $this->_helper->auth()->getUserEmail(); - if (strlen(trim($this->_getParam('to'))) && trim($this->_getParam('to')) != $to) { - $to .= ', '.trim($this->_getParam('to')); - } - - // Build the email - $mime = new Mail_mime(); - $headers = [ - 'From' => $this->getFromEmail(), - 'Reply-To' => $this->_helper->auth()->getUserEmail(), - 'CC' => $this->_helper->auth()->getUserEmail(), - 'Subject' => preg_replace('/[^\w \'"&-_.,\/*%#$@!()=+:;<>?]/', '', $this->_getParam('subject')), - ]; - $mime->setTXTBody($text); - $mime->setHTMLBody($html); - $mime->addHTMLImage($imageData, 'image/png', 'schedule_image.png', false); - $mime->addAttachment($imageData, 'image/png', 'schedule_image.png', false); - - // Send the email - $body = $mime->get(); - $headers = $mime->headers($headers); - - $mail = Mail::factory('mail'); - $result = $mail->send($to, $headers, $body); - - if (true === $result) { - echo 'Email sent.'; - } else { - throw $result; - } - } catch (Exception $e) { - error_log($e->getMessage()); - - $this->getResponse()->setHttpResponseCode(500); - $this->getResponse()->setBody($e->getMessage()); - } - } -} diff --git a/application/controllers/TermsController.php b/application/controllers/TermsController.php deleted file mode 100755 index 55ed07e9..00000000 --- a/application/controllers/TermsController.php +++ /dev/null @@ -1,127 +0,0 @@ -_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $lookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); - $this->view->title = 'Terms in '.$lookupSession->getCourseCatalog()->getDisplayName(); - } else { - $lookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $this->view->title = 'Terms in All Catalogs'; - } - $lookupSession->useFederatedCourseCatalogView(); - - $this->view->terms = $lookupSession->getTerms(); - - $this->setSelectedCatalogId($lookupSession->getCourseCatalogId()); - $this->view->headTitle($this->view->title); - - $this->view->menuIsTerms = true; - } - - /** - * Print out an XML list of all terms. - * - * @return void - */ - public function listxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->getResponse()->setHeader('Content-Type', 'text/xml'); - - $this->listAction(); - } - - /** - * View a catalog details. - * - * @return void - * - * @since 4/21/09 - */ - public function viewAction() - { - $id = $this->_helper->osidId->fromString($this->_getParam('term')); - $lookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $lookupSession->useFederatedCourseCatalogView(); - $this->view->term = $lookupSession->getTerm($id); - - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseOfferingLookupSession(); - $lookupSession->useFederatedCourseCatalogView(); - $this->view->offerings = $lookupSession->getCourseOfferingsByTerm($id); - - // Set the selected Catalog Id. - $catalogSession = $this->_helper->osid->getCourseManager()->getTermCatalogSession(); - $catalogIds = $catalogSession->getCatalogIdsByTerm($id); - if ($catalogIds->hasNext()) { - $this->setSelectedCatalogId($catalogIds->getNextId()); - } - - // Set the title - $this->view->title = $this->view->term->getDisplayName(); - $this->view->headTitle($this->view->title); - - $this->view->menuIsTerms = true; - } - - /** - * View a catalog details. - * - * @return void - */ - public function detailsAction() - { - $id = $this->_helper->osidId->fromString($this->_getParam('term')); - $lookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $lookupSession->useFederatedCourseCatalogView(); - $this->view->term = $lookupSession->getTerm($id); - - // Set the selected Catalog Id. - $catalogSession = $this->_helper->osid->getCourseManager()->getTermCatalogSession(); - $catalogIds = $catalogSession->getCatalogIdsByTerm($id); - if ($catalogIds->hasNext()) { - $this->setSelectedCatalogId($catalogIds->getNextId()); - } - - // Set the title - $this->view->title = $this->view->term->getDisplayName(); - $this->view->headTitle($this->view->title); - - $this->view->menuIsTerms = true; - } - - /** - * View a catalog details. - * - * @return void - */ - public function detailsxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->detailsAction(); - } -} diff --git a/application/controllers/TopicsController.php b/application/controllers/TopicsController.php deleted file mode 100755 index 57bdbd5a..00000000 --- a/application/controllers/TopicsController.php +++ /dev/null @@ -1,337 +0,0 @@ -_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $lookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSessionForCatalog($catalogId); - $this->view->title = 'Topics in '.$lookupSession->getCourseCatalog()->getDisplayName(); - } else { - $lookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSession(); - $this->view->title = 'Topics in All Catalogs'; - } - $lookupSession->useFederatedCourseCatalogView(); - - if ($this->_getParam('type')) { - $genusType = $this->_helper->osidType->fromString($this->_getParam('type')); - $topics = $lookupSession->getTopicsByGenusType($genusType); - $this->view->title .= ' of type '.$this->_getParam('type'); - } else { - $topics = $lookupSession->getTopics(); - } - - $this->loadTopics($topics); - - $this->setSelectedCatalogId($lookupSession->getCourseCatalogId()); - $this->view->headTitle($this->view->title); - } - - /** - * Print out an XML list of all catalogs. - * - * @return void - */ - public function listxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->getResponse()->setHeader('Content-Type', 'text/xml'); - - $this->listAction(); - } - - /** - * Print out a list of all topics. - * - * @return void - * - * @since 4/21/09 - */ - public function recentAction() - { - if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $searchSession = $this->_helper->osid->getCourseManager()->getTopicSearchSessionForCatalog($catalogId); - $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSessionForCatalog($catalogId); - $this->view->title = 'Topics in '.$searchSession->getCourseCatalog()->getDisplayName(); - } else { - $searchSession = $this->_helper->osid->getCourseManager()->getTopicSearchSession(); - $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - - $this->view->title = 'Topics in All Catalogs'; - } - $searchSession->useFederatedCourseCatalogView(); - $query = $searchSession->getTopicQuery(); - - // Match recent terms - $terms = $termLookupSession->getTerms(); - // Define a cutoff date after which courses will be included in the feed. - // Currently set to 4 years. Would be good to have as a configurable time. - $now = new DateTime(); - $cutOff = $this->DateTime_getTimestamp($now) - (60 * 60 * 24 * 365 * 4); - while ($terms->hasNext()) { - $term = $terms->getNextTerm(); - if ($this->DateTime_getTimestamp($term->getEndTime()) > $cutOff) { - $query->matchTermId($term->getId(), true); - } - } - - if ($this->_getParam('type')) { - $genusType = $this->_helper->osidType->fromString($this->_getParam('type')); - $query->matchGenusType($genusType, true); - $this->view->title .= ' of type '.$this->_getParam('type'); - } - - $topics = $searchSession->getTopicsByQuery($query); - - $this->loadTopics($topics); - - $this->setSelectedCatalogId($searchSession->getCourseCatalogId()); - $this->view->headTitle($this->view->title); - - $this->_helper->viewRenderer->setRender('topics/list', null, true); - } - - public function DateTime_getTimestamp($dt) - { - $dtz_original = $dt->getTimezone(); - $dtz_utc = new DateTimeZone('UTC'); - $dt->setTimezone($dtz_utc); - $year = (int) $dt->format('Y'); - $month = (int) $dt->format('n'); - $day = (int) $dt->format('j'); - $hour = (int) $dt->format('G'); - $minute = (int) $dt->format('i'); - $second = (int) $dt->format('s'); - $dt->setTimezone($dtz_original); - - return gmmktime($hour, $minute, $second, $month, $day, $year); - } - - /** - * Print out an XML list of all catalogs. - * - * @return void - */ - public function recentxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->getResponse()->setHeader('Content-Type', 'text/xml'); - - $this->recentAction(); - $this->_helper->viewRenderer->setRender('topics/listxml', null, true); - } - - /** - * View a catalog details. - * - * @return void - * - * @since 4/21/09 - */ - public function viewAction() - { - $id = $this->_helper->osidId->fromString($this->_getParam('topic')); - $lookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSession(); - $lookupSession->useFederatedCourseCatalogView(); - $this->view->topic = $lookupSession->getTopic($id); - - $lookupSession = $this->_helper->osid->getCourseManager()->getCourseOfferingLookupSession(); - $lookupSession->useFederatedCourseCatalogView(); - if ($this->_getParam('term')) { - $termId = $this->_helper->osidId->fromString($this->_getParam('term')); - $this->view->offerings = $lookupSession->getCourseOfferingsByTermByTopic($termId, $id); - - $termLookupSession = $this->_helper->osid->getCourseManager()->getTermLookupSession(); - $termLookupSession->useFederatedCourseCatalogView(); - $this->view->term = $termLookupSession->getTerm($termId); - } else { - $this->view->offerings = $lookupSession->getCourseOfferingsByTopic($id); - } - - // Don't do the work to display instructors if we have a very large number of - // offerings. - if ($this->view->offerings->available() > 200) { - $this->view->hideOfferingInstructors = true; - } - - // Set the selected Catalog Id. - if ($this->_getParam('catalog')) { - $this->setSelectedCatalogId($this->_helper->osidId->fromString($this->_getParam('catalog'))); - } - - // Set the title - $this->view->title = $this->view->topic->getDisplayName(); - $this->view->headTitle($this->view->title); - - $this->view->offeringsTitle = 'Sections'; - - $allParams = []; - $allParams['topic'] = $this->_getParam('topic'); - if ($this->getSelectedCatalogId()) { - $allParams['catalog'] = $this->_helper->osidId->toString($this->getSelectedCatalogId()); - } - $this->view->offeringsForAllTermsUrl = $this->_helper->url('view', 'topics', null, $allParams); - - $this->render('offerings', null, true); - } - - /** - * Print out an XML listing of a topic. - * - * @return void - */ - public function viewxmlAction() - { - $this->_helper->layout->disableLayout(); - $this->getResponse()->setHeader('Content-Type', 'text/xml'); - - if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $lookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSessionForCatalog($catalogId); - $this->view->title = 'Topics in '.$lookupSession->getCourseCatalog()->getDisplayName(); - } else { - $lookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSession(); - $this->view->title = 'Topics in All Catalogs'; - } - $lookupSession->useFederatedCourseCatalogView(); - - $topicId = $this->_helper->osidId->fromString($this->_getParam('topic')); - - $topic = $lookupSession->getTopic($topicId); - $topics = new phpkit_course_ArrayTopicList([$topic]); - - $this->loadTopics($topics); - - $this->setSelectedCatalogId($lookupSession->getCourseCatalogId()); - $this->view->title = 'Catalog Details'; - $this->view->headTitle($this->view->title); - - $this->render('topics/listxml', null, true); - } - - /** - * List all department topics as a text file with each line being Id|DisplayName. - * - * @return void - * - * @since 10/20/09 - */ - public function listsubjectstxtAction() - { - $this->renderTextList(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject')); - } - - /** - * List all requirement topics as a text file with each line being Id|DisplayName. - * - * @return void - * - * @since 10/20/09 - */ - public function listrequirementstxtAction() - { - $this->renderTextList(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement')); - } - - /** - * List all level topics as a text file with each line being Id|DisplayName. - * - * @return void - * - * @since 1/15/10 - */ - public function listlevelstxtAction() - { - $this->renderTextList(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/level')); - } - - /** - * List all block topics as a text file with each line being Id|DisplayName. - * - * @return void - * - * @since 10/20/09 - */ - public function listblockstxtAction() - { - $this->renderTextList(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/block')); - } - - /** - * List all instruction-methods topics as a text file with each line being Id|DisplayName. - * - * @return void - * - * @since 10/20/09 - */ - public function listinstructionmethodstxtAction() - { - $this->renderTextList(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/instruction_method')); - } - - /** - * List all department topics as a text file with each line being Id|DisplayName. - * - * @return void - * - * @since 10/20/09 - */ - public function listdepartmentstxtAction() - { - $this->renderTextList(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department')); - } - - /** - * Render a text feed for a given topic type. - * - * @return void - * - * @since 11/17/09 - */ - private function renderTextList(osid_type_Type $genusType) - { - header('Content-Type: text/plain'); - - if ($this->_getParam('catalog')) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - $lookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSessionForCatalog($catalogId); - $this->view->title = 'Topics in '.$lookupSession->getCourseCatalog()->getDisplayName(); - } else { - $lookupSession = $this->_helper->osid->getCourseManager()->getTopicLookupSession(); - $this->view->title = 'Topics in All Catalogs'; - } - $lookupSession->useFederatedCourseCatalogView(); - - $topics = $lookupSession->getTopicsByGenusType($genusType); - - while ($topics->hasNext()) { - $topic = $topics->getNextTopic(); - echo $this->_helper->osidId->toString($topic->getId()).'|'.$this->_helper->osidId->toString($topic->getId()).' - '.$topic->getDisplayName()."\n"; - } - - exit; - } -} diff --git a/application/library/AbstractCatalogController.php b/application/library/AbstractCatalogController.php deleted file mode 100755 index 6ea1bb2b..00000000 --- a/application/library/AbstractCatalogController.php +++ /dev/null @@ -1,217 +0,0 @@ -view->menuCatalogs = $this->_helper->osid->getCourseManager()->getCourseCatalogLookupSession()->getCourseCatalogs(); - $this->view->catalogIdString = $this->_getParam('catalog'); - $this->view->termIdString = $this->_getParam('term'); - $this->view->addHelperPath(APPLICATION_PATH.'/views/helpers', 'Catalog_View_Helper'); - - $this->view->doctype('XHTML1_TRANSITIONAL'); - - $this->setLayout(); - } - - /** - * Configure the layout to use for the current action. - * - * @return void - */ - protected function setLayout() - { - if ($this->_getParam('catalog')) { - $config = Zend_Registry::getInstance()->config; - if (count($config->catalog->layouts)) { - $catalogId = $this->_helper->osidId->fromString($this->_getParam('catalog')); - foreach ($config->catalog->layouts as $layoutConfig) { - if ($catalogId->isEqual(new phpkit_id_URNInetId($layoutConfig->catalog_id))) { - $this->_helper->layout()->setLayout($layoutConfig->layout); - break; - } - } - } - } - } - - /** - * Set the selected catalog id. - * - * @return void - * - * @since 4/22/09 - */ - protected function setSelectedCatalogId(osid_id_Id $id) - { - $this->view->menuCatalogSelectedId = $id; - $this->view->menuCatalogSelected = $this->_helper->osid->getCourseManager()->getCourseCatalogLookupSession()->getCourseCatalog($id); - } - - /** - * Answer the selected catalog id. - * - * @return osid_id_Id - * - * @since 5/1/09 - */ - protected function getSelectedCatalogId() - { - return $this->view->menuCatalogSelectedId; - } - - /** - * Load topics into our view. - * - * @param osid_course_TopicList - * - * @return void - * - * @since 4/28/09 - */ - protected function loadTopics(osid_course_TopicList $topicList) - { - $topics = $this->_helper->topics->topicListAsArray($topicList); - - $this->view->subjectTopics = $this->_helper->topics->filterTopicsByType($topics, new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject')); - - $this->view->departmentTopics = $this->_helper->topics->filterTopicsByType($topics, new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department')); - - $this->view->divisionTopics = $this->_helper->topics->filterTopicsByType($topics, new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division')); - - $this->view->requirementTopics = $this->_helper->topics->filterTopicsByType($topics, new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement')); - - $this->view->levelTopics = $this->_helper->topics->filterTopicsByType($topics, new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/level')); - - $this->view->blockTopics = $this->_helper->topics->filterTopicsByType($topics, new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/block')); - - $this->view->instructionMethodTopics = $this->_helper->topics->filterTopicsByType($topics, new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/instruction_method')); - } - - private $startTime; - - /** - * Answer the execution time. - * - * @return float - * - * @since 4/30/09 - */ - private function getExecTime() - { - if (isset($GLOBALS['start_time'])) { - $start = $GLOBALS['start_time']; - } elseif (isset($this->startTime)) { - $start = $this->startTime; - } else { - return null; - } - - $end = microtime(); - - [$sm, $ss] = explode(' ', $start); - [$em, $es] = explode(' ', $end); - - $s = $ss + $sm; - $e = $es + $em; - - return round($e - $s, 6); - } - - /** - * Pre-dispatch routines. - * - * Called before action method. If using class with - * {@link Zend_Controller_Front}, it may modify the - * {@link $_request Request object} and reset its dispatched flag in order - * to skip processing the current action. - * - * @return void - */ - public function preDispatch() - { - $this->startTime = microtime(); - } - - /** - * Post-dispatch routines. - * - * Called after action method execution. If using class with - * {@link Zend_Controller_Front}, it may modify the - * {@link $_request Request object} and reset its dispatched flag in order - * to process an additional action. - * - * Common usages for postDispatch() include rendering content in a sitewide - * template, link url correction, setting headers, etc. - * - * @return void - */ - public function postDispatch() - { - $this->setCacheControlHeaders(); - - $response = $this->getResponse(); - // $db = $this->_helper->osid->getCourseManager()->getDB(); - // if (method_exists($db, 'getCounters')) { - // foreach ($db->getCounters() as $name => $num) { - // $response->setHeader('X-'.$name, $num); - // } - // } - $response->setHeader('X-Runtime', $this->getExecTime()); - } - - /** - * Set our cache control headers. - * - * @return void - * - * @since 6/4/10 - */ - protected function setCacheControlHeaders() - { - // Only allow caching if anonymous. This will ensure that users' - // browser caches will not cache pages if logged in. - // Ignore for command-line requests. - if ('cli' !== \PHP_SAPI && !$this->_helper->auth()->isAuthenticated() && !headers_sent()) { - // Set cache-control headers - $config = Zend_Registry::getInstance()->config; - $maxAge = (int) $config->cache_control->max_age; - $expirationOffset = (int) $config->cache_control->expiration_offset; - if (!$expirationOffset) { - $expirationOffset = $maxAge; - } - - if ($maxAge > 0 && !$this->getResponse()->isException()) { - $this->getResponse()->setHeader('Expires', gmdate('D, d M Y H:i:s', time() + $expirationOffset).' GMT', true); - $this->getResponse()->setHeader('Cache-Control', 'public', true); - $this->getResponse()->setHeader('Cache-Control', 'max-age='.$maxAge); - $this->getResponse()->setHeader('Pragma', '', true); - } - } - - $this->getResponse()->setHeader('Vary', 'Cookie,Accept-Encoding', true); - } -} diff --git a/application/library/Bookmarks.php b/application/library/Bookmarks.php deleted file mode 100755 index 5d36783e..00000000 --- a/application/library/Bookmarks.php +++ /dev/null @@ -1,179 +0,0 @@ -db = $db; - $this->userId = $userId; - $this->courseManager = $courseManager; - } - - private $db; - private $userId; - - /** - * Add a bookmark. - * - * @return void - * - * @since 7/29/10 - */ - public function add(osid_id_Id $courseId) - { - $stmt = $this->db->prepare('INSERT INTO user_savedcourses (user_id, course_id_keyword, course_id_authority, course_id_namespace) VALUES (?, ?, ?, ?);'); - try { - $stmt->execute([ - $this->userId, - $courseId->getIdentifier(), - $courseId->getAuthority(), - $courseId->getIdentifierNamespace(), - ]); - } catch (Zend_Db_Statement_Exception $e) { - if (23000 == $e->getCode()) { - throw new Exception('Bookmark already added.', 23000); - } else { - throw $e; - } - } - } - - /** - * Remove a bookmark. - * - * @return void - * - * @since 7/29/10 - */ - public function remove(osid_id_Id $courseId) - { - $stmt = $this->db->prepare('DELETE FROM user_savedcourses WHERE user_id = ? AND course_id_keyword = ? AND course_id_authority = ? AND course_id_namespace = ? LIMIT 1;'); - $stmt->execute([ - $this->userId, - $courseId->getIdentifier(), - $courseId->getAuthority(), - $courseId->getIdentifierNamespace(), - ]); - } - - /** - * Answer true if the course Id passed is bookmarked. - * - * @return bool - * - * @since 7/29/10 - */ - public function isBookmarked(osid_id_Id $courseId) - { - $stmt = $this->db->prepare('SELECT COUNT(*) as is_bookmarked FROM user_savedcourses WHERE user_id = ? AND course_id_keyword = ? AND course_id_authority = ? AND course_id_namespace = ?'); - $stmt->execute([ - $this->userId, - $courseId->getIdentifier(), - $courseId->getAuthority(), - $courseId->getIdentifierNamespace(), - ]); - $num = (int) $stmt->fetchColumn(); - - return $num > 0; - } - - /** - * Answer an array of all bookmarked courseIds. - * - * @return osid_id_IdList - * - * @since 7/30/10 - */ - public function getAllBookmarkedCourseIds() - { - $stmt = $this->db->prepare('SELECT * FROM user_savedcourses WHERE user_id = ?'); - $stmt->execute([ - $this->userId, - ]); - $ids = []; - foreach ($stmt->fetchAll() as $row) { - $ids[] = new phpkit_id_Id($row['course_id_authority'], $row['course_id_namespace'], $row['course_id_keyword']); - } - - return new phpkit_id_ArrayIdList($ids); - } - - /** - * Answer an array of all bookmarked courses. - * - * @return osid_course_CourseList - * - * @since 7/30/10 - */ - public function getAllBookmarkedCourses() - { - $courseIdList = $this->getAllBookmarkedCourseIds(); - if (!$courseIdList->hasNext()) { - return new phpkit_course_ArrayCourseList([]); - } - - $courseLookupSession = $this->courseManager->getCourseLookupSession(); - $courseLookupSession->useFederatedCourseCatalogView(); - - return $courseLookupSession->getCoursesByIds($courseIdList); - } - - /** - * Answer an array of all bookmarked courses that match a given catalog and term. - * - * @return osid_course_CourseList - * - * @since 7/30/10 - */ - public function getBookmarkedCoursesInCatalogForTerm(osid_id_Id $catalogId, osid_id_Id $termId) - { - $courseIdList = $this->getAllBookmarkedCourseIds(); - if (!$courseIdList->hasNext()) { - return new phpkit_course_ArrayCourseList([]); - } - - $searchSession = $this->courseManager->getCourseSearchSessionForCatalog($catalogId); - - $search = $searchSession->getCourseSearch(); - $search->searchAmongCourses($courseIdList); - - $query = $searchSession->getCourseQuery(); - $record = $query->getCourseQueryRecord(new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:term')); - $record->matchTermId($termId, true); - - // Limit to just active courses - $query->matchGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:status-active'), true); - - $results = $searchSession->getCoursesBySearch($query, $search); - - return $results->getCourses(); - } -} diff --git a/application/library/CatalogSync/Database/PdoAbstract.php b/application/library/CatalogSync/Database/PdoAbstract.php deleted file mode 100644 index 12f216e3..00000000 --- a/application/library/CatalogSync/Database/PdoAbstract.php +++ /dev/null @@ -1,134 +0,0 @@ -name = $name; - } - - /** - * Destructor. - */ - public function __destruct() - { - // Ensure that our connection is terminated. - $this->disconnect(); - } - - /** - * Configure this sync instance. - * - * @return void - */ - public function configure(Zend_Config $config) - { - $this->config = $this->validateConfig($config); - } - - /** - * Validate options for a PDO configuration. - * - * @return Zend_Config - */ - public function validateConfig(Zend_Config $config) - { - // Check our configuration - if (empty($config->type)) { - throw new Exception($this->name.'.type must be specified in the config.'); - } - if (empty($config->host)) { - throw new Exception($this->name.'.host must be specified in the config.'); - } - if (empty($config->database)) { - throw new Exception($this->name.'.database must be specified in the config.'); - } - if (empty($config->username)) { - throw new Exception($this->name.'.username must be specified in the config.'); - } - if (empty($config->password)) { - $config->password = ''; - } - - return $config; - } - - /** - * Set up connections to our source and destination. - * - * @return void - */ - public function connect() - { - $this->pdo = $this->createPdo($this->config); - } - - /** - * Answer a Pdo instance based on configuration parameters. - * - * @return PDO - */ - protected function createPdo(Zend_Config $config) - { - $dsn = $config->type.':host='.$config->host.';dbname='.$config->database.';charset=utf8mb4'; - - return new PDO($dsn, $config->username, $config->password, $this->getDatabaseOptions($config->type)); - } - - /** - * Answer some database options for our connection. - * - * @param string $type - * - * @return array - */ - protected function getDatabaseOptions($type) - { - $options = []; - $options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; - $options[PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = false; - // The libmysql driver needs to allocate a buffer bigger than the expected data - if (defined('PDO::MYSQL_ATTR_MAX_BUFFER_SIZE') && 'mysql' == $type) { - $options[PDO::MYSQL_ATTR_MAX_BUFFER_SIZE] = 1024 * 1024 * 100; - } - // The mysqlnd driver on the other hand allocates buffers as big as needed. - else { - // nothing needed. - } - - return $options; - } - - /** - * Disconnect from our databases. - * - * @return void - */ - public function disconnect() - { - $this->pdo = null; - } -} diff --git a/application/library/CatalogSync/Director.php b/application/library/CatalogSync/Director.php deleted file mode 100644 index 643db257..00000000 --- a/application/library/CatalogSync/Director.php +++ /dev/null @@ -1,175 +0,0 @@ -config = $this->validateConfig($config); - $sync_class = $this->config->sync_class; - $this->sync = new $sync_class(); - if (!$this->sync instanceof CatalogSync_Syncer) { - throw new Exception('sync_class '.$sync_class." doesn't implement the required CatalogSync_Syncer."); - } - $this->sync->configure($this->config); - } - - /** - * Run the synchronization. - * - * @return void - */ - public function sync() - { - try { - $this->sync->connect(); - $this->sync->preCopy(); - $this->sync->copy(); - $this->sync->postCopy(); - $this->sync->updateDerived(); - $this->sync->disconnect(); - if (!empty($this->sync->getNonFatalErrors())) { - $this->sendNonFatalErrorMessage($this->sync->getNonFatalErrors()); - } - } catch (Exception $e) { - $this->sync->rollback(); - if (!empty($this->sync->getNonFatalErrors())) { - $this->sendNonFatalErrorMessage($this->sync->getNonFatalErrors()); - } - $this->sendException($e); - throw $e; - } - } - - /** - * Only updated the derived tables with existing data. - * Sometimes useful for fixing interim data errors. - */ - public function updateDerived() - { - try { - $this->sync->connect(); - $this->sync->updateDerived(); - $this->sync->disconnect(); - } catch (Exception $e) { - $this->sync->rollback(); - $this->sendException($e); - throw $e; - } - } - - /** - * Validate our configuration. - * - * @return Zend_Config - */ - protected function validateConfig(Zend_Config $config) - { - // Validate that our sync_class is defined. - if (empty($config->sync_class)) { - throw new Exception('sync_class is missing from the CatalogSync configuration.'); - } - // Error mail-sending addresses -- Only needed if we have at least one To: address. - if (!empty($this->config->error_mail_to)) { - // To: - if (is_array($this->config->error_mail_to)) { - foreach ($this->config->error_mail_to as $email) { - if (!filter_var($email, \FILTER_VALIDATE_EMAIL)) { - throw new Exception("error_mail_to, '$email', is not a valid email address."); - } - } - } else { - if (!filter_var($this->config->error_mail_to, \FILTER_VALIDATE_EMAIL)) { - throw new Exception("error_mail_to, '".$this->config->error_mail_to."', is not a valid email address."); - } - } - // From: - if (!filter_var($this->config->error_mail_from, \FILTER_VALIDATE_EMAIL)) { - throw new Exception("error_mail_from, '".$this->config->error_mail_from."', is not a valid email address."); - } - } - - return $config; - } - - /** - * Send messages to administrators on fatal exceptions. - * - * @return null - */ - protected function sendException(Exception $e) - { - $host = trim(shell_exec('hostname')); - $subject = 'Synchonization Exception'; - $message = "The following errors occurred during database synchronization on $host:\n\n"; - $message .= $e->getMessage()."\n\n"; - $message .= $e->getTraceAsString()."\n\n"; - $this->sendAdminMessage($subject, $message); - } - - /** - * Send messages to administrators on non-fatal errors. - * - * @return null - */ - protected function sendNonFatalErrorMessage($errors) - { - $host = trim(shell_exec('hostname')); - $subject = 'Non-Fatal Errors During Synchonization'; - $message = "The following non-fatal errors occurred during database synchronization on $host:\n\n"; - $message .= implode("\n\n", $errors); - $message .= "\n\n"; - $this->sendAdminMessage($subject, $message); - } - - /** - * Send messages to administrators on errors. - * - * @param string $subject - * @param string $message - * - * @return null - */ - protected function sendAdminMessage($subject, $message) - { - if (empty($this->config->error_mail_to)) { - return; - } - if (is_string($this->config->error_mail_to)) { - $to = $this->config->error_mail_to; - } else { - $error_mail_to = []; - foreach ($this->config->error_mail_to as $email) { - $error_mail_to[] = $email; - } - $to = implode(', ', $error_mail_to); - } - $host = trim(shell_exec('hostname')); - $subject = "$host - COURSE CATALOG: $subject"; - - $headers = 'From: '.$this->config->error_mail_from."\r\n"; - mail($to, $subject, $message, $headers); - } -} diff --git a/application/library/ErrorPrinter.php b/application/library/ErrorPrinter.php deleted file mode 100755 index 9317c584..00000000 --- a/application/library/ErrorPrinter.php +++ /dev/null @@ -1,428 +0,0 @@ -userAgentFilters = []; - } - - /** - * Add a user agent string and an array of matching codes. If the user agent - * matches the string and the code or exception class is in the list, the exception - * will not be logged. This can be used to prevent misbehaving bots and web - * crawlers from filling the logs with repeated invalid requests. - * - * @param string $userAgent - * @param optional array $codesOrExceptionClasses If empty, no matches to the user agent will be logged - * - * @return void - * - * @since 2/26/08 - */ - public function addUserAgentFilter($userAgent, $codesOrExceptionClasses = []) - { - $userAgent = trim($userAgent); - // ArgumentValidator::validate($userAgent, NonzeroLengthStringValidatorRule::getRule()); - // ArgumentValidator::validate($codesOrExceptionClasses, - // ArrayValidatorRuleWithRule::getRule(OrValidatorRule::getRule( - // NonzeroLengthStringValidatorRule::getRule(), - // IntegerValidatorRule::getRule()))); - - $this->userAgentFilters[$userAgent] = $codesOrExceptionClasses; - } - - /** - * Answer true if the Exception should be logged. - * - * @param object Exception $e - * @param int $code - * - * @return bool - * - * @since 2/26/08 - */ - private function shouldLogException(Exception $e, $code) - { - if (isset($_SERVER['HTTP_USER_AGENT'])) { - $userAgent = trim($_SERVER['HTTP_USER_AGENT']); - if (array_key_exists($userAgent, $this->userAgentFilters)) { - if (!count($this->userAgentFilters[$userAgent])) { - return false; - } - if (in_array($code, $this->userAgentFilters[$userAgent])) { - return false; - } - if (in_array($e::class, $this->userAgentFilters[$userAgent])) { - return false; - } - } - } - - return true; - } - - /** - * Handle an Exception. - * - * @param object Exception $e - * - * @parma int $code The HTTP status code to use. - * - * @return void - * - * @since 2/26/08 - * - * @static - */ - public static function handleException(Exception $e, $code) - { - $printer = self::instance(); - $printer->handleAnException($e, $code); - } - - /** - * Handle an Exception. - * - * @param object Exception $e - * - * @parma int $code The HTTP status code to use. - * - * @return void - * - * @since 2/26/08 - */ - public function handleAnException(Exception $e, $code) - { - // ArgumentValidator::validate($code, IntegerValidatorRule::getRule()); - if (!headers_sent()) { - header('HTTP/1.1 '.$code.' '.self::getCodeString($code)); - } - $this->printException($e, $code); - if ($this->shouldLogException($e, $code)) { - error_log('PHP '.$e::class.': '.$e->getMessage().' in '.$e->getFile().' on line '.$e->getLine()); - } - } - - /** - * Handle an exception and the provide a redirect to another page. - * - * @param object Exception $e - * - * @parma int $code The HTTP status code to use. - * - * @param string $additionalHtml - * - * @return void - * - * @since 8/22/08 - */ - public function handExceptionWithRedirect(Exception $e, $code, $additionalHtml) - { - // ArgumentValidator::validate($code, IntegerValidatorRule::getRule()); - // ArgumentValidator::validate($additionalHtml, StringValidatorRule::getRule()); - - if (!headers_sent()) { - header('HTTP/1.1 '.$code.' '.self::getCodeString($code)); - } - - ob_start(); - echo "\n\t\t

".$additionalHtml.'

'; - $this->printException($e, $code, ob_get_clean()); - - if ($this->shouldLogException($e, $code)) { - error_log('PHP '.$e::class.': '.$e->getMessage().' in '.$e->getFile().' on line '.$e->getLine()); - } - } - - /** - * Print out a custom error page for an exception with the HTTP status code - * specified. - * - * @param object Exception $e - * @param int $code - * - * @return void - * - * @since 2/21/08 - */ - private function printException(Exception $e, $code, $additionalHtml = '') - { - // Debugging mode for development, rethrow the exception - if (ini_get('display_errors') && preg_match('/on|1/i', ini_get('display_errors'))) { - throw $e; - } - - // Normal production case - else { - $message = strip_tags($e->getMessage()); - $codeString = self::getCodeString($code); - $errorString = _('Error'); - if ($this->shouldLogException($e, $code)) { - $logMessage = _('This error has been logged.'); - } else { - $logMessage = ''; - } - echo <<< END - - - $code $codeString - - - -
-
Catalog
-
$errorString
-
-
-

$codeString

-

$message

-
-

$logMessage

- $additionalHtml - - - -END; - } - } - - /** - * Answer a string that matches the HTTP error code given. - * - * @param int $code - * - * @return string - * - * @since 2/21/08 - * - * @static - */ - public static function getCodeString($code) - { - switch ($code) { - case 400: - return _('Bad Request'); - case 401: - return _('Unauthorized'); - case 402: - return _('Payment Required'); - case 403: - return _('Forbidden'); - case 404: - return _('Not Found'); - case 405: - return _('Method Not Allowed'); - case 406: - return _('Not Acceptable'); - case 407: - return _('Proxy Authentication Required'); - case 408: - return _('Request Timeout'); - case 409: - return _('Conflict'); - case 410: - return _('Gone'); - case 411: - return _('Length Required'); - case 412: - return _('Precondition Failed'); - case 413: - return _('Request Entity Too Large'); - case 414: - return _('Request-URI Too Long'); - case 415: - return _('Unsupported Media Type'); - case 416: - return _('Requested Range Not Satisfiable'); - case 417: - return _('Expectation Failed'); - case $code > 400 && $code < 500: - return _('Client Error'); - - case 500: - return _('Internal Server Error'); - case 501: - return _('Not Implemented'); - case 502: - return _('Bad Gateway'); - case 503: - return _('Service Unavailable'); - case 505: - return _('Gateway Timeout'); - case 505: - return _('HTTP Version Not Supported'); - - case $code > 500 && $code < 600: - return _('Server Error'); - - default: - return _('Error'); - } - } -} - -/* - * For systems that don't have gettext installed, we want to define a "_" function - * so that harmoni will still operate, if only in English - */ -if (!function_exists('gettext')) { - /** - * Returns the passed string to emulate untranslated language support for - * systems on which gettext isn't availible. - * - * @param string $string - * - * @return string - * - * @since 11/16/04 - */ - function _($string) - { - return $string; - } - - /** - * Returns the passed string to emulate untranslated language support for - * systems on which gettext isn't availible. - * - * @param string $string - * - * @return string - * - * @since 11/16/04 - */ - function gettext($string) - { - return $string; - } - - /** - * Returns the passed string unchanged. - * - * @param string $domain - * @param string $string - * - * @return string - */ - function dgettext($domain, $string) - { - return $string; - } - - /** - * Does nothing. Here to emulate untranslated language support for - * systems on which gettext isn't availible. - * - * @param string $string - * - * @return string - * - * @since 11/16/04 - */ - function textdomain($string) - { - if ($string) { - $_SESSION['__fake_text_domain'] = $string; - } - - if (isset($_SESSION['__fake_text_domain'])) { - return $_SESSION['__fake_text_domain']; - } else { - return 'en_US'; - } - } -} diff --git a/application/library/Paginator/Adaptor/CourseOfferingSearch.php b/application/library/Paginator/Adaptor/CourseOfferingSearch.php deleted file mode 100755 index bc84f333..00000000 --- a/application/library/Paginator/Adaptor/CourseOfferingSearch.php +++ /dev/null @@ -1,79 +0,0 @@ -session = $session; - $this->query = $query; - - if (null === $search) { - $this->search = $this->session->getCourseOfferingSearch(); - } else { - $this->search = $search; - } - } - - /** - * Returns the total number of rows in the collection. - * - * @since 6/2/09 - */ - public function count(): int - { - if (!isset($this->results)) { - $this->getItems(0, 20); - } - - return $this->results->getResultSize(); - } - - /** - * Returns an collection of items for a page. - * - * @param int $offset Page offset - * @param int $itemCountPerPage Number of items per page - * - * @return array - */ - public function getItems($offset, $itemCountPerPage) - { - $start = $offset + 1; - $end = $offset + $itemCountPerPage; - - $this->search->limitResultSet($start, $end); - $this->results = $this->session->getCourseOfferingsBySearch($this->query, $this->search); - - $offerings = []; - $list = $this->results->getCourseOfferings(); - while ($list->hasNext()) { - $offerings[] = $list->getNextCourseOffering(); - } - - return $offerings; - } -} diff --git a/application/library/Schedules.php b/application/library/Schedules.php deleted file mode 100755 index bf468029..00000000 --- a/application/library/Schedules.php +++ /dev/null @@ -1,154 +0,0 @@ -db = $db; - $this->userId = $userId; - $this->courseManager = $courseManager; - } - - private $db; - private $userId; - private $courseManager; - - /** - * Create a schedule. - * - * @return Schedule - * - * @since 8/2/10 - */ - public function createSchedule(osid_id_Id $termId) - { - $stmt = $this->db->prepare('INSERT INTO user_schedules (user_id, term_id_keyword, term_id_authority, term_id_namespace, name) VALUES (?, ?, ?, ?, ?);'); - $name = 'Untitled Schedule'; - $stmt->execute([ - $this->userId, - $termId->getIdentifier(), - $termId->getAuthority(), - $termId->getIdentifierNamespace(), - $name, - ]); - $id = $this->db->lastInsertId(); - - return new Schedule($id, $this->db, $this->userId, $this->courseManager, $name, $termId); - } - - /** - * Delete a schedule. - * - * @param string $scheduleId - * - * @return void - * - * @since 7/29/10 - */ - public function deleteSchedule($scheduleId) - { - $stmt = $this->db->prepare('DELETE FROM user_schedules WHERE id = ? AND user_id = ? LIMIT 1;'); - $stmt->execute([ - $scheduleId, - $this->userId, - ]); - } - - /** - * Answer a schedule by Id. - * - * @param string $scheduleId - * - * @return Schedule - * - * @since 8/2/10 - */ - public function getSchedule($scheduleId) - { - $stmt = $this->db->prepare('SELECT * FROM user_schedules WHERE id = ? AND user_id = ? LIMIT 1;'); - $stmt->execute([ - $scheduleId, - $this->userId, - ]); - $rows = $stmt->fetchAll(); - if (!count($rows)) { - throw new InvalidArgumentException('Schedule was not found.'); - } - - return new Schedule($rows[0]['id'], $this->db, $this->userId, $this->courseManager, $rows[0]['name'], new phpkit_id_Id($rows[0]['term_id_authority'], $rows[0]['term_id_namespace'], $rows[0]['term_id_keyword'])); - } - - /** - * Answer all schedules for the current user. - * - * @return array of Schedule objects - * - * @since 8/2/10 - */ - public function getSchedules() - { - $stmt = $this->db->prepare('SELECT * FROM user_schedules WHERE user_id = ?;'); - $stmt->execute([ - $this->userId, - ]); - - $schedules = []; - foreach ($stmt->fetchAll() as $row) { - $schedules[] = new Schedule($row['id'], $this->db, $this->userId, $this->courseManager, $row['name'], new phpkit_id_Id($row['term_id_authority'], $row['term_id_namespace'], $row['term_id_keyword'])); - } - - return $schedules; - } - - /** - * Answer schedules for the current user for a given term. - * - * @return array of Schedule objects - * - * @since 8/2/10 - */ - public function getSchedulesByTerm(osid_id_Id $termId) - { - $stmt = $this->db->prepare('SELECT * FROM user_schedules WHERE user_id = ? AND term_id_keyword = ? AND term_id_authority = ? AND term_id_namespace = ?;'); - $stmt->execute([ - $this->userId, - $termId->getIdentifier(), - $termId->getAuthority(), - $termId->getIdentifierNamespace(), - ]); - - $schedules = []; - foreach ($stmt->fetchAll() as $row) { - $schedules[] = new Schedule($row['id'], $this->db, $this->userId, $this->courseManager, $row['name'], new phpkit_id_Id($row['term_id_authority'], $row['term_id_namespace'], $row['term_id_keyword'])); - } - - return $schedules; - } -} diff --git a/application/library/apc/course/CourseManager.php b/application/library/apc/course/CourseManager.php index 91ab29df..4544ac37 100755 --- a/application/library/apc/course/CourseManager.php +++ b/application/library/apc/course/CourseManager.php @@ -28,13 +28,24 @@ public function __construct() { parent::__construct(); - $this->setId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:id:implementations/apc_course')); + $this->setId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:id:implementations.apc_course')); $this->setDisplayName('APC Caching Course Manager'); $this->setDescription('This is a CourseManager implementation that provides read-only, unauthenticated, access to course information stored in an underlying course manager.'); } // The underlying course manager. private $manager; + /** + * Allow access to the underlying database for test setup/tear down. + * + * @return PDO + * The backing database + */ + public function getDB() + { + return $this->manager->getDB(); + } + /********************************************************* * From OsidManager *********************************************************/ @@ -74,7 +85,7 @@ public function initialize(osid_OsidRuntimeManager $runtime) try { $implClassName = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:apc_course/impl_class_name'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:apc_course.impl_class_name'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/String')); } catch (osid_NotFoundException $e) { throw new osid_ConfigurationErrorException($e->getMessage(), $e->getCode(), $e); diff --git a/application/library/banner/AbstractSession.php b/application/library/banner/AbstractSession.php index b70cd6c0..c800b4d0 100755 --- a/application/library/banner/AbstractSession.php +++ b/application/library/banner/AbstractSession.php @@ -145,11 +145,11 @@ protected function usesIsolatedView() public function getDatabaseIdString(osid_id_Id $id, $prefix = null) { if ('urn' != $id->getIdentifierNamespace()) { - throw new osid_NotFoundException('I only know about Ids in the urn namespace.'); + throw new osid_NotFoundException('I only know about Ids in the urn namespace, got: '.$id->getIdentifierNamespace()); } if ($id->getAuthority() != $this->manager->getIdAuthority()) { - throw new osid_NotFoundException('I only know about Ids under the '.$this->manager->getIdAuthority().' authority.'); + throw new osid_NotFoundException('I only know about Ids under the '.$this->manager->getIdAuthority().' authority, got: '.$id->getAuthority()); } if (null === $prefix) { @@ -159,7 +159,7 @@ public function getDatabaseIdString(osid_id_Id $id, $prefix = null) } if (!str_starts_with($id->getIdentifier(), $prefix)) { - throw new osid_NotFoundException('I only know about Ids with the '.$prefix.' prefix.'); + throw new osid_NotFoundException('I only know about Ids with the '.$prefix.' prefix, got: '.$id->getIdentifier()); } return substr($id->getIdentifier(), strlen($prefix)); @@ -195,7 +195,7 @@ public function getOsidIdFromString($databaseId, $prefix = null) */ public function getTermCodeFromTermId(osid_id_Id $id) { - $string = $this->getDatabaseIdString($id, 'term/'); + $string = $this->getDatabaseIdString($id, 'term.'); if (!preg_match('#^([0-9]{6})$#', $string)) { throw new osid_NotFoundException("String '$string' cannot be broken into a term-code"); } @@ -214,8 +214,8 @@ public function getTermCodeFromTermId(osid_id_Id $id) */ public function getTermCodeFromOfferingId(osid_id_Id $id) { - $string = $this->getDatabaseIdString($id, 'section/'); - if (!preg_match('#^([0-9]{6})/([0-9]{1,5})$#', $string, $matches)) { + $string = $this->getDatabaseIdString($id, 'section.'); + if (!preg_match('#^([0-9]{6})\.([0-9]{1,5})$#', $string, $matches)) { throw new osid_NotFoundException("String '$string' cannot be broken into a term-code and CRN."); } @@ -233,8 +233,8 @@ public function getTermCodeFromOfferingId(osid_id_Id $id) */ public function getCrnFromOfferingId(osid_id_Id $id) { - $string = $this->getDatabaseIdString($id, 'section/'); - if (!preg_match('#^([0-9]{6})/([0-9]{1,5})$#', $string, $matches)) { + $string = $this->getDatabaseIdString($id, 'section.'); + if (!preg_match('#^([0-9]{6})\.([0-9]{1,5})$#', $string, $matches)) { throw new osid_NotFoundException("String '$string' cannot be broken into a term-code and CRN."); } @@ -250,7 +250,7 @@ public function getCrnFromOfferingId(osid_id_Id $id) */ public function getSubjectFromCourseId(osid_id_Id $id) { - $string = $this->getDatabaseIdString($id, 'course/'); + $string = $this->getDatabaseIdString($id, 'course.'); if (!preg_match('#^([A-Z]{2,4})([A-Z0-9]{3,5})$#i', $string, $matches)) { throw new osid_NotFoundException("String '$string' cannot be broken into a subject-code and Number."); } @@ -267,7 +267,7 @@ public function getSubjectFromCourseId(osid_id_Id $id) */ public function getNumberFromCourseId(osid_id_Id $id) { - $string = $this->getDatabaseIdString($id, 'course/'); + $string = $this->getDatabaseIdString($id, 'course.'); if (!preg_match('#^([A-Z]{2,4})([A-Z0-9]{3,5})$#i', $string, $matches)) { throw new osid_NotFoundException("String '$string' cannot be broken into a subject-code and Number."); } diff --git a/application/library/banner/course/AbstractSession.php b/application/library/banner/course/AbstractSession.php index df804b2d..f5de7375 100755 --- a/application/library/banner/course/AbstractSession.php +++ b/application/library/banner/course/AbstractSession.php @@ -26,7 +26,7 @@ abstract class banner_course_AbstractSession extends banner_AbstractSession impl */ public function getCatalogDatabaseId(osid_id_Id $id) { - return $this->getDatabaseIdString($id, 'catalog/'); + return $this->getDatabaseIdString($id, 'catalog.'); } /** @@ -159,7 +159,7 @@ public function getOfferingIdFromTermCodeAndCrn($termCode, $crn) throw new osid_OperationFailedException('Both termCode and CRN must be specified.'); } - return $this->getOsidIdFromString($termCode.'/'.$crn, 'section/'); + return $this->getOsidIdFromString($termCode.'.'.$crn, 'section.'); } /** @@ -177,7 +177,7 @@ public function getCourseIdFromSubjectAndNumber($subjectCode, $number) throw new osid_OperationFailedException('Both subjectCode and number must be specified.'); } - return $this->getOsidIdFromString($subjectCode.$number, 'course/'); + return $this->getOsidIdFromString($subjectCode.$number, 'course.'); } /** @@ -189,8 +189,8 @@ public function getCourseIdFromSubjectAndNumber($subjectCode, $number) */ public function getTermCodeFromTermId(osid_id_Id $id) { - $string = $this->getDatabaseIdString($id, 'term/'); - if (!preg_match('#^([0-9]{6})(?:/(.{1,3}))?$#', $string, $matches)) { + $string = $this->getDatabaseIdString($id, 'term.'); + if (!preg_match('#^([0-9]{6})(?:\.(.{1,3}))?$#', $string, $matches)) { throw new osid_NotFoundException("String '$string' cannot be converted into a valid term code."); } @@ -206,8 +206,8 @@ public function getTermCodeFromTermId(osid_id_Id $id) */ public function getPartOfTermCodeFromTermId(osid_id_Id $id) { - $string = $this->getDatabaseIdString($id, 'term/'); - if (!preg_match('#^([0-9]{6})(?:/(.{1,3}))$#', $string, $matches)) { + $string = $this->getDatabaseIdString($id, 'term.'); + if (!preg_match('#^([0-9]{6})(?:\.(.{1,3}))$#', $string, $matches)) { throw new osid_NotFoundException("String '$string' cannot be converted into a valid part-of-term code."); } @@ -229,8 +229,8 @@ public function getScheduleCodeFromGenusType(osid_type_Type $genusType) throw new osid_NotFoundException("I only know about the '".$this->getIdAuthority()."' authority"); } - if (!preg_match('/^genera:offering\/([a-z]+)$/i', $genusType->getIdentifier(), $matches)) { - throw new osid_NotFoundException("I only know about identifiers beginning with 'genera:offering/'"); + if (!preg_match('/^genera:offering\.([a-z]+)$/i', $genusType->getIdentifier(), $matches)) { + throw new osid_NotFoundException("I only know about identifiers beginning with 'genera:offering.'"); } return $matches[1]; diff --git a/application/library/banner/course/Course.php b/application/library/banner/course/Course.php index 717d6d4b..e809754a 100755 --- a/application/library/banner/course/Course.php +++ b/application/library/banner/course/Course.php @@ -6,9 +6,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL) */ -include_once 'fsmparserclass.inc.php'; -include_once 'harmoni/Primitives/Collections-Text/HtmlString.class.php'; - /** *

A Course represents a canonical learning unit. A * Course is instantiated at a time and place through the creation of @@ -799,7 +796,7 @@ public function getLinkSetIdsForTerm(osid_id_Id $termId) } $linkSetIds = array_unique($linkSetIds); foreach ($linkSetIds as $key => $val) { - $linkSetIds[$key] = $this->session->getOsidIdFromString($val, 'link_set/'); + $linkSetIds[$key] = $this->session->getOsidIdFromString($val, 'link_set.'); } return new phpkit_id_ArrayIdList($linkSetIds); @@ -830,7 +827,7 @@ public function getLinkTypeIdsForTermAndSet(osid_id_Id $termId, osid_id_Id $link $setId = substr($linkIdString, 1, 1); // The type id is the first charactor. $typeId = substr($linkIdString, 0, 1); - if ($linkSetId->isEqual($this->session->getOsidIdFromString($setId, 'link_set/'))) { + if ($linkSetId->isEqual($this->session->getOsidIdFromString($setId, 'link_set.'))) { $linkTypeIds[] = $typeId; } } @@ -843,7 +840,7 @@ public function getLinkTypeIdsForTermAndSet(osid_id_Id $termId, osid_id_Id $link } foreach ($linkTypeIds as $key => $val) { - $linkTypeIds[$key] = $this->session->getOsidIdFromString($val, 'link_type/'); + $linkTypeIds[$key] = $this->session->getOsidIdFromString($val, 'link_type.'); } return new phpkit_id_ArrayIdList($linkTypeIds); diff --git a/application/library/banner/course/Course/AbstractList.php b/application/library/banner/course/Course/AbstractList.php index 7f2da7cf..dff50e14 100755 --- a/application/library/banner/course/Course/AbstractList.php +++ b/application/library/banner/course/Course/AbstractList.php @@ -250,19 +250,22 @@ protected function includeInactive() * Answer an object from a result row. * * @since 4/13/09 + * + * @return osid_course_Course + * The object from a row */ final protected function getObjectFromRow(array $row) { return new banner_course_Course( - $this->session->getOsidIdFromString($row['SCBCRSE_SUBJ_CODE'].$row['SCBCRSE_CRSE_NUMB'], 'course/'), + $this->session->getOsidIdFromString($row['SCBCRSE_SUBJ_CODE'].$row['SCBCRSE_CRSE_NUMB'], 'course.'), $row['SCBCRSE_SUBJ_CODE'].' '.$row['SCBCRSE_CRSE_NUMB'], (null === $row['SCBDESC_TEXT_NARRATIVE']) ? '' : $row['SCBDESC_TEXT_NARRATIVE'], // Description $row['SCBCRSE_TITLE'], $row['SCBCRSE_CREDIT_HR_HIGH'], [ - $this->session->getOsidIdFromString($row['SCBCRSE_SUBJ_CODE'], 'topic/subject/'), - $this->session->getOsidIdFromString($row['SCBCRSE_DEPT_CODE'], 'topic/department/'), - $this->session->getOsidIdFromString($row['SCBCRSE_DIVS_CODE'], 'topic/division/'), + $this->session->getOsidIdFromString($row['SCBCRSE_SUBJ_CODE'], 'topic.subject.'), + $this->session->getOsidIdFromString($row['SCBCRSE_DEPT_CODE'], 'topic.department.'), + $this->session->getOsidIdFromString($row['SCBCRSE_DIVS_CODE'], 'topic.division.'), ], $row['has_alternates'], $this->session); diff --git a/application/library/banner/course/Course/AbstractSession.php b/application/library/banner/course/Course/AbstractSession.php index ed5b6f30..0cac8fb1 100755 --- a/application/library/banner/course/Course/AbstractSession.php +++ b/application/library/banner/course/Course/AbstractSession.php @@ -49,7 +49,7 @@ public function getRequirementTopicIdsForCourse(osid_id_Id $courseId) self::$requirementTopics_stmt->execute($parameters); $topicIds = []; while ($row = self::$requirementTopics_stmt->fetch(PDO::FETCH_ASSOC)) { - $topicIds[] = $this->getOsidIdFromString($row['SCRATTR_ATTR_CODE'], 'topic/requirement/'); + $topicIds[] = $this->getOsidIdFromString($row['SCRATTR_ATTR_CODE'], 'topic.requirement.'); } self::$requirementTopics_stmt->closeCursor(); @@ -89,7 +89,7 @@ public function getLevelTopicIdsForCourse(osid_id_Id $courseId) self::$levelTopics_stmt->execute($parameters); $topicIds = []; while ($row = self::$levelTopics_stmt->fetch(PDO::FETCH_ASSOC)) { - $topicIds[] = $this->getOsidIdFromString($row['SCRLEVL_LEVL_CODE'], 'topic/level/'); + $topicIds[] = $this->getOsidIdFromString($row['SCRLEVL_LEVL_CODE'], 'topic.level.'); } self::$levelTopics_stmt->closeCursor(); diff --git a/application/library/banner/course/Course/Catalog/Session.php b/application/library/banner/course/Course/Catalog/Session.php index b27843ad..fafd9234 100755 --- a/application/library/banner/course/Course/Catalog/Session.php +++ b/application/library/banner/course/Course/Catalog/Session.php @@ -34,7 +34,7 @@ class banner_course_Course_Catalog_Session extends banner_course_Course_Abstract */ public function __construct(banner_course_CourseManagerInterface $manager) { - parent::__construct($manager, 'catalog/'); + parent::__construct($manager, 'catalog.'); } /** @@ -242,7 +242,7 @@ public function getCatalogIdsByCourse(osid_id_Id $courseId) $ids = []; while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { - $ids[] = $this->getOsidIdFromString($row['catalog_id'], 'catalog/'); + $ids[] = $this->getOsidIdFromString($row['catalog_id'], 'catalog.'); } $statement->closeCursor(); @@ -279,7 +279,7 @@ public function getCatalogsByCourse(osid_id_Id $courseId) $catalogs = []; while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $catalogs[] = new banner_course_CourseCatalog( - $this->getOsidIdFromString($row['catalog_id'], 'catalog/'), + $this->getOsidIdFromString($row['catalog_id'], 'catalog.'), $row['catalog_title']); } $statement->closeCursor(); diff --git a/application/library/banner/course/Course/Lookup/Session.php b/application/library/banner/course/Course/Lookup/Session.php index ceeff4a1..e4180adb 100755 --- a/application/library/banner/course/Course/Lookup/Session.php +++ b/application/library/banner/course/Course/Lookup/Session.php @@ -52,7 +52,7 @@ class banner_course_Course_Lookup_Session extends banner_course_Course_AbstractS */ public function __construct(banner_course_CourseManagerInterface $manager, osid_id_Id $catalogId) { - parent::__construct($manager, 'course/'); + parent::__construct($manager, 'course.'); $this->catalogId = $catalogId; } @@ -228,7 +228,7 @@ public function getCourse(osid_id_Id $courseId) self::$getCourse_stmts[$catalogWhere] = $this->manager->getDB()->prepare($query); } - $courseIdString = $this->getDatabaseIdString($courseId, 'course/'); + $courseIdString = $this->getDatabaseIdString($courseId, 'course.'); $parameters = array_merge( [ @@ -241,19 +241,19 @@ public function getCourse(osid_id_Id $courseId) self::$getCourse_stmts[$catalogWhere]->closeCursor(); if (!$row || !($row['SCBCRSE_SUBJ_CODE'] && $row['SCBCRSE_CRSE_NUMB'])) { - throw new osid_NotFoundException("Could not find a course matching the id-component '$courseIdString' for the catalog '".$this->getDatabaseIdString($this->getCourseCatalogId(), 'catalog/')."'."); + throw new osid_NotFoundException("Could not find a course matching the id-component '$courseIdString' for the catalog '".$this->getDatabaseIdString($this->getCourseCatalogId(), 'catalog.')."'."); } return new banner_course_Course( - $this->getOsidIdFromString($row['SCBCRSE_SUBJ_CODE'].$row['SCBCRSE_CRSE_NUMB'], 'course/'), + $this->getOsidIdFromString($row['SCBCRSE_SUBJ_CODE'].$row['SCBCRSE_CRSE_NUMB'], 'course.'), $row['SCBCRSE_SUBJ_CODE'].' '.$row['SCBCRSE_CRSE_NUMB'], (null === $row['SCBDESC_TEXT_NARRATIVE']) ? '' : $row['SCBDESC_TEXT_NARRATIVE'], // Description $row['SCBCRSE_TITLE'], $row['SCBCRSE_CREDIT_HR_HIGH'], [ - $this->getOsidIdFromString($row['SCBCRSE_SUBJ_CODE'], 'topic/subject/'), - $this->getOsidIdFromString($row['SCBCRSE_DEPT_CODE'], 'topic/department/'), - $this->getOsidIdFromString($row['SCBCRSE_DIVS_CODE'], 'topic/division/'), + $this->getOsidIdFromString($row['SCBCRSE_SUBJ_CODE'], 'topic.subject.'), + $this->getOsidIdFromString($row['SCBCRSE_DEPT_CODE'], 'topic.department.'), + $this->getOsidIdFromString($row['SCBCRSE_DIVS_CODE'], 'topic.division.'), ], $row['has_alternates'], $this); diff --git a/application/library/banner/course/Course/Search/Order.php b/application/library/banner/course/Course/Search/Order.php index 537cdfdf..8076997d 100755 --- a/application/library/banner/course/Course/Search/Order.php +++ b/application/library/banner/course/Course/Search/Order.php @@ -131,6 +131,6 @@ public function orderByPrereqInfo() */ public function getCourseSearchOrderRecord(osid_type_Type $courseRecordType) { - throw new osid_UnsupportedException(); + throw new osid_UnsupportedException('The CourseRecordType passed is not supported.'); } } diff --git a/application/library/banner/course/Course/Search/Query.php b/application/library/banner/course/Course/Search/Query.php index bb0a662a..dbf36aa3 100755 --- a/application/library/banner/course/Course/Search/Query.php +++ b/application/library/banner/course/Course/Search/Query.php @@ -575,7 +575,7 @@ public function matchCourseCatalogId(osid_id_Id $courseCatalogId, $match) course_catalog_college WHERE catalog_id = ?)', - [$this->session->getDatabaseIdString($courseCatalogId, 'catalog/')], + [$this->session->getDatabaseIdString($courseCatalogId, 'catalog.')], $match); } @@ -752,7 +752,7 @@ public function getTopicQuery() */ public function matchInstructorId(osid_id_Id $instructorId, $match) { - $this->addClause('instructor_id', 'WEB_ID = ?', [$this->session->getDatabaseIdString($instructorId, 'resource/person/')], $match); + $this->addClause('instructor_id', 'WEB_ID = ?', [$this->session->getDatabaseIdString($instructorId, 'resource.person.')], $match); $this->addTableJoin('LEFT JOIN SSBSECT ON (SCBCRSE_SUBJ_CODE = SSBSECT_SUBJ_CODE AND SCBCRSE_CRSE_NUMB = SSBSECT_CRSE_NUMB)'); $this->addTableJoin('LEFT JOIN SYVINST ON (SYVINST_TERM_CODE = SSBSECT_TERM_CODE AND SYVINST_CRN = SSBSECT_CRN)'); @@ -810,7 +810,7 @@ public function getInstructorQuery() */ public function matchTermId(osid_id_Id $termId, $match) { - $this->addClause('term_id', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term/')], $match); + $this->addClause('term_id', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term.')], $match); $this->addTableJoin('LEFT JOIN SSBSECT ON (SCBCRSE_SUBJ_CODE = SSBSECT_SUBJ_CODE AND SCBCRSE_CRSE_NUMB = SSBSECT_CRSE_NUMB)'); $this->addClause('active_sections', 'SSBSECT_SSTS_CODE = ? AND (course_catalog.prnt_ind_to_exclude IS NULL OR SSBSECT_PRNT_IND != course_catalog.prnt_ind_to_exclude)', ['A'], true); @@ -867,7 +867,7 @@ public function getTermQuery() */ public function matchLocationId(osid_id_Id $instructorId, $match) { - $this->addClause('location_id', 'SSBSECT_CAMP_CODE = ?', [$this->session->getDatabaseIdString($instructorId, 'resource/place/campus/')], $match); + $this->addClause('location_id', 'SSBSECT_CAMP_CODE = ?', [$this->session->getDatabaseIdString($instructorId, 'resource.place.campus.')], $match); $this->addTableJoin('LEFT JOIN SSBSECT ON (SCBCRSE_SUBJ_CODE = SSBSECT_SUBJ_CODE AND SCBCRSE_CRSE_NUMB = SSBSECT_CRSE_NUMB)'); $this->addClause('active_sections', 'SSBSECT_SSTS_CODE = ? AND (course_catalog.prnt_ind_to_exclude IS NULL OR SSBSECT_PRNT_IND != course_catalog.prnt_ind_to_exclude)', ['A'], true); diff --git a/application/library/banner/course/Course/Search/Search.php b/application/library/banner/course/Course/Search/Search.php index 5abdd0ad..837275ad 100755 --- a/application/library/banner/course/Course/Search/Search.php +++ b/application/library/banner/course/Course/Search/Search.php @@ -96,6 +96,6 @@ public function orderCourseResults(osid_course_CourseSearchOrder $courseSearchOr */ public function getCourseSearchRecord(osid_type_Type $courseSearchRecordType) { - throw new osid_UnsupportedException(); + throw new osid_UnsupportedException('The CourseSearchRecordType passed is not supported.'); } } diff --git a/application/library/banner/course/Course/Search/Session.php b/application/library/banner/course/Course/Search/Session.php index ffe6435d..0fbbb474 100755 --- a/application/library/banner/course/Course/Search/Session.php +++ b/application/library/banner/course/Course/Search/Session.php @@ -45,7 +45,7 @@ class banner_course_Course_Search_Session extends banner_course_Course_AbstractS */ public function __construct(banner_course_CourseManagerInterface $manager, osid_id_Id $catalogId) { - parent::__construct($manager, 'section/'); + parent::__construct($manager, 'section.'); $this->catalogId = $catalogId; } diff --git a/application/library/banner/course/CourseCatalog/Lookup/Session.php b/application/library/banner/course/CourseCatalog/Lookup/Session.php index 6ef0d69d..b0b09f6e 100755 --- a/application/library/banner/course/CourseCatalog/Lookup/Session.php +++ b/application/library/banner/course/CourseCatalog/Lookup/Session.php @@ -48,7 +48,7 @@ class banner_course_CourseCatalog_Lookup_Session extends banner_course_AbstractS */ public function __construct(banner_course_CourseManagerInterface $manager) { - parent::__construct($manager, 'catalog/'); + parent::__construct($manager, 'catalog.'); } /** diff --git a/application/library/banner/course/CourseManager.php b/application/library/banner/course/CourseManager.php index 7507cac2..d504a41f 100755 --- a/application/library/banner/course/CourseManager.php +++ b/application/library/banner/course/CourseManager.php @@ -35,7 +35,7 @@ public function __construct() { parent::__construct(); - $this->setId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:id:implementations/banner_course')); + $this->setId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:id:implementations.banner_course')); $this->setDisplayName('Banner Course Manager'); $this->setDescription('This is a CourseManager implementation that provides read-only, unauthenticated, access to course information stored in Banner database tables.'); } @@ -76,7 +76,7 @@ public function getIdAuthority() */ public function getCombinedCatalogId() { - return new phpkit_id_Id($this->getIdAuthority(), 'urn', 'catalog/all'); + return new phpkit_id_Id($this->getIdAuthority(), 'urn', 'catalog.all'); } /********************************************************* @@ -118,17 +118,17 @@ public function initialize(osid_OsidRuntimeManager $runtime) try { $dsn = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/pdo_dsn'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.pdo_dsn'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/String')); $username = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/pdo_username'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.pdo_username'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/String')); $password = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/pdo_password'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.pdo_password'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/String')); } catch (osid_NotFoundException $e) { throw new osid_ConfigurationErrorException($e->getMessage(), $e->getCode(), $e); @@ -137,7 +137,7 @@ public function initialize(osid_OsidRuntimeManager $runtime) try { $debug = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/pdo_count_queries'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.pdo_count_queries'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/Boolean')); } catch (osid_ConfigurationErrorException $e) { $debug = false; @@ -147,7 +147,7 @@ public function initialize(osid_OsidRuntimeManager $runtime) $driverOptions = []; $options = phpkit_configuration_ConfigUtil::getMultiValuedValueOfAnyType( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/pdo_driver_options')); + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.pdo_driver_options')); foreach ($options as $key => $value) { $option = constant($key); if (null === $option) { @@ -172,10 +172,10 @@ public function initialize(osid_OsidRuntimeManager $runtime) try { $this->idAuthority = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/id_authority'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.id_authority'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/String')); if (!strlen($this->idAuthority)) { - throw new osid_ConfigurationErrorException('urn:inet:middlebury.edu:config:banner_course/id_authority must be specified.'); + throw new osid_ConfigurationErrorException('urn:inet:middlebury.edu:config:banner_course.id_authority must be specified.'); } } catch (osid_NotFoundException $e) { throw new osid_ConfigurationErrorException($e->getMessage(), $e->getCode(), $e); @@ -213,7 +213,7 @@ public function shutdown() public function getCourseLookupSession() { return new banner_course_Course_Lookup_CombinedSession($this, - new phpkit_id_URNInetId('urn:inet:'.$this->idAuthority.':catalog/all')); + new phpkit_id_URNInetId('urn:inet:'.$this->idAuthority.':catalog.all')); } /** @@ -268,7 +268,7 @@ public function getCourseLookupSessionForCatalog(osid_id_Id $courseCatalogId) public function getCourseSearchSession() { return new banner_course_Course_Search_Session($this, - new phpkit_id_URNInetId('urn:inet:'.$this->idAuthority.':catalog/all')); + new phpkit_id_URNInetId('urn:inet:'.$this->idAuthority.':catalog.all')); } /** diff --git a/application/library/banner/course/CourseOffering.php b/application/library/banner/course/CourseOffering.php index 1d714f31..dc6ce2b8 100755 --- a/application/library/banner/course/CourseOffering.php +++ b/application/library/banner/course/CourseOffering.php @@ -117,7 +117,7 @@ public function __construct(array $row, banner_course_CourseOffering_SessionInte $this->setGenusType(new phpkit_type_Type( 'urn', // namespace $this->session->getIdAuthority(), // id authority - 'genera:offering/'.$row['STVSCHD_CODE'], // identifier + 'genera:offering.'.$row['STVSCHD_CODE'], // identifier 'Course Offerings', // domain trim($row['STVSCHD_DESC']), // display name trim($row['STVSCHD_CODE']) // display label @@ -350,10 +350,10 @@ public function getTermId() { $termCode = $this->row['SSBSECT_TERM_CODE']; if (!empty($this->row['SSBSECT_PTRM_CODE']) && 1 != $this->row['SSBSECT_PTRM_CODE']) { - $termCode .= '/'.$this->row['SSBSECT_PTRM_CODE']; + $termCode .= '.'.$this->row['SSBSECT_PTRM_CODE']; } - return $this->getOsidIdFromString($termCode, 'term/'); + return $this->getOsidIdFromString($termCode, 'term.'); } /** @@ -387,16 +387,16 @@ public function getTopicIds() if (!isset($this->topicIds)) { $this->topicIds = []; if ($this->row['SCBCRSE_DEPT_CODE']) { - $this->topicIds[] = $this->getOsidIdFromString($this->row['SCBCRSE_DEPT_CODE'], 'topic/department/'); + $this->topicIds[] = $this->getOsidIdFromString($this->row['SCBCRSE_DEPT_CODE'], 'topic.department.'); } if ($this->row['SSBSECT_SUBJ_CODE']) { - $this->topicIds[] = $this->getOsidIdFromString($this->row['SSBSECT_SUBJ_CODE'], 'topic/subject/'); + $this->topicIds[] = $this->getOsidIdFromString($this->row['SSBSECT_SUBJ_CODE'], 'topic.subject.'); } if ($this->row['SCBCRSE_DIVS_CODE']) { - $this->topicIds[] = $this->getOsidIdFromString($this->row['SCBCRSE_DIVS_CODE'], 'topic/division/'); + $this->topicIds[] = $this->getOsidIdFromString($this->row['SCBCRSE_DIVS_CODE'], 'topic.division.'); } if ($this->row['GTVINSM_CODE']) { - $this->topicIds[] = $this->getOsidIdFromString($this->row['GTVINSM_CODE'], 'topic/instruction_method/'); + $this->topicIds[] = $this->getOsidIdFromString($this->row['GTVINSM_CODE'], 'topic.instruction_method.'); } $this->topicIds = array_merge( @@ -484,8 +484,8 @@ public function hasLocation() public function getLocationId() { return $this->getOsidIdFromString( - $this->row['SSRMEET_BLDG_CODE'].'/'.$this->row['SSRMEET_ROOM_CODE'], - 'resource/place/room/'); + $this->row['SSRMEET_BLDG_CODE'].'.'.$this->row['SSRMEET_ROOM_CODE'], + 'resource.place.room.'); } /** @@ -633,8 +633,8 @@ public function getCalendarId() throw new osid_IllegalStateException('This version of the OSID does not support Learning Objectives'); return $this->getOsidIdFromString( - $this->row['SSBSECT_TERM_CODE'].'/'.$this->row['SSBSECT_CRN'], - 'CourseSchedule/'); + $this->row['SSBSECT_TERM_CODE'].'.'.$this->row['SSBSECT_CRN'], + 'CourseSchedule.'); } /** @@ -879,7 +879,7 @@ public function getLinkSetId() $linkId = substr($this->row['SSBSECT_LINK_IDENT'], 1, 1); } - return $this->getOsidIdFromString($linkId, 'link_set/'); + return $this->getOsidIdFromString($linkId, 'link_set.'); } /** @@ -907,7 +907,7 @@ public function getLinkTypeId() $linkId = substr($this->row['SSBSECT_LINK_IDENT'], 0, 1); } - return $this->getOsidIdFromString($linkId, 'link_type/'); + return $this->getOsidIdFromString($linkId, 'link_type.'); } /********************************************************* diff --git a/application/library/banner/course/CourseOffering/AbstractList.php b/application/library/banner/course/CourseOffering/AbstractList.php index f019e34e..ee507f06 100755 --- a/application/library/banner/course/CourseOffering/AbstractList.php +++ b/application/library/banner/course/CourseOffering/AbstractList.php @@ -329,6 +329,9 @@ protected function getHavingTerms() * Answer an object from a result row. * * @since 4/13/09 + * + * @return osid_course_CourseOffering + * The object from a row */ final protected function getObjectFromRow(array $row) { diff --git a/application/library/banner/course/CourseOffering/AbstractSession.php b/application/library/banner/course/CourseOffering/AbstractSession.php index 94422035..2cb3e26f 100755 --- a/application/library/banner/course/CourseOffering/AbstractSession.php +++ b/application/library/banner/course/CourseOffering/AbstractSession.php @@ -28,7 +28,7 @@ public function getInstructorIdsForOffering(osid_id_Id $offeringId) { $ids = []; foreach ($this->getInstructorDataForOffering($offeringId) as $row) { - $ids[] = $this->getOsidIdFromString($row['WEB_ID'], 'resource/person/'); + $ids[] = $this->getOsidIdFromString($row['WEB_ID'], 'resource.person.'); } return new phpkit_id_ArrayIdList($ids); @@ -46,7 +46,7 @@ public function getInstructorsForOffering(osid_id_Id $offeringId) $people = []; foreach ($this->getInstructorDataForOffering($offeringId) as $row) { $people[] = new banner_resource_Resource_Person( - $this->getOsidIdFromString($row['WEB_ID'], 'resource/person/'), + $this->getOsidIdFromString($row['WEB_ID'], 'resource.person.'), $row['SYVINST_LAST_NAME'], $row['SYVINST_FIRST_NAME'] ); @@ -190,7 +190,7 @@ public function getRequirementTopicIdsForCourseOffering(osid_id_Id $courseOfferi self::$requirementTopics_stmt->execute($parameters); $topicIds = []; while ($row = self::$requirementTopics_stmt->fetch(PDO::FETCH_ASSOC)) { - $topicIds[] = $this->getOsidIdFromString($row['SSRATTR_ATTR_CODE'], 'topic/requirement/'); + $topicIds[] = $this->getOsidIdFromString($row['SSRATTR_ATTR_CODE'], 'topic.requirement.'); } self::$requirementTopics_stmt->closeCursor(); @@ -231,7 +231,7 @@ public function getLevelTopicIdsForCourseOffering(osid_id_Id $courseOfferingId) self::$levelTopics_stmt->execute($parameters); $topicIds = []; while ($row = self::$levelTopics_stmt->fetch(PDO::FETCH_ASSOC)) { - $topicIds[] = $this->getOsidIdFromString($row['SCRLEVL_LEVL_CODE'], 'topic/level/'); + $topicIds[] = $this->getOsidIdFromString($row['SCRLEVL_LEVL_CODE'], 'topic.level.'); } self::$levelTopics_stmt->closeCursor(); @@ -271,7 +271,7 @@ public function getBlockTopicIdsForCourseOffering(osid_id_Id $courseOfferingId) self::$blockTopics_stmt->execute($parameters); $topicIds = []; while ($row = self::$blockTopics_stmt->fetch(PDO::FETCH_ASSOC)) { - $topicIds[] = $this->getOsidIdFromString($row['SSRBLCK_BLCK_CODE'], 'topic/block/'); + $topicIds[] = $this->getOsidIdFromString($row['SSRBLCK_BLCK_CODE'], 'topic.block.'); } self::$blockTopics_stmt->closeCursor(); diff --git a/application/library/banner/course/CourseOffering/Catalog/Session.php b/application/library/banner/course/CourseOffering/Catalog/Session.php index 51655bf7..a427fdf9 100755 --- a/application/library/banner/course/CourseOffering/Catalog/Session.php +++ b/application/library/banner/course/CourseOffering/Catalog/Session.php @@ -35,7 +35,7 @@ class banner_course_CourseOffering_Catalog_Session extends banner_course_CourseO */ public function __construct(banner_course_CourseManagerInterface $manager) { - parent::__construct($manager, 'catalog/'); + parent::__construct($manager, 'catalog.'); } /** @@ -245,7 +245,7 @@ public function getCatalogIdsByCourseOffering(osid_id_Id $courseOfferingId) $ids = []; while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { - $ids[] = $this->getOsidIdFromString($row['catalog_id'], 'catalog/'); + $ids[] = $this->getOsidIdFromString($row['catalog_id'], 'catalog.'); } $statement->closeCursor(); @@ -283,7 +283,7 @@ public function getCatalogsByCourseOffering(osid_id_Id $courseOfferingId) $catalogs = []; while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $catalogs[] = new banner_course_CourseCatalog( - $this->getOsidIdFromString($row['catalog_id'], 'catalog/'), + $this->getOsidIdFromString($row['catalog_id'], 'catalog.'), $row['catalog_title']); } $statement->closeCursor(); diff --git a/application/library/banner/course/CourseOffering/GenusTypeList.php b/application/library/banner/course/CourseOffering/GenusTypeList.php index 05644c3d..b766e7b0 100755 --- a/application/library/banner/course/CourseOffering/GenusTypeList.php +++ b/application/library/banner/course/CourseOffering/GenusTypeList.php @@ -115,13 +115,16 @@ private function getAllInputParameters() * Answer an object from a result row. * * @since 4/13/09 + * + * @return osid_type_Type + * An object for the row data */ protected function getObjectFromRow(array $row) { return new phpkit_type_Type( 'urn', // namespace $this->session->getIdAuthority(), // id authority - 'genera:offering/'.$row['STVSCHD_CODE'], // identifier + 'genera:offering.'.$row['STVSCHD_CODE'], // identifier 'Course Offerings', // domain $row['STVSCHD_DESC'], // display name $row['STVSCHD_CODE'] // display label diff --git a/application/library/banner/course/CourseOffering/Lookup/Session.php b/application/library/banner/course/CourseOffering/Lookup/Session.php index 10e34c1b..89497c39 100755 --- a/application/library/banner/course/CourseOffering/Lookup/Session.php +++ b/application/library/banner/course/CourseOffering/Lookup/Session.php @@ -47,7 +47,7 @@ class banner_course_CourseOffering_Lookup_Session extends banner_course_CourseOf */ public function __construct(banner_course_CourseManagerInterface $manager, osid_id_Id $catalogId) { - parent::__construct($manager, 'section/'); + parent::__construct($manager, 'section.'); $this->catalogId = $catalogId; } @@ -264,7 +264,7 @@ public function getCourseOffering(osid_id_Id $courseOfferingId) $row = self::$getOffering_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getOffering_stmts[$catalogWhere]->closeCursor(); - if (!$row['SSBSECT_CRN'] || !$row['SSBSECT_TERM_CODE']) { + if (!$row || !$row['SSBSECT_CRN'] || !$row['SSBSECT_TERM_CODE']) { throw new osid_NotFoundException('Could not find a course offering matching the term code '.$this->getTermCodeFromOfferingId($courseOfferingId).' and the crn '.$this->getCrnFromOfferingId($courseOfferingId).'.'); } diff --git a/application/library/banner/course/CourseOffering/Search/Query.php b/application/library/banner/course/CourseOffering/Search/Query.php index e6a6e20f..103b6ba7 100755 --- a/application/library/banner/course/CourseOffering/Search/Query.php +++ b/application/library/banner/course/CourseOffering/Search/Query.php @@ -256,7 +256,7 @@ private function getGenusTypeCode(osid_type_Type $genusType) return null; } - if (!preg_match('/^genera:offering\/([a-z]+)$/i', $genusType->getIdentifier(), $matches)) { + if (!preg_match('/^genera:offering\.([a-z]+)$/i', $genusType->getIdentifier(), $matches)) { return null; } @@ -895,8 +895,8 @@ public function matchLocationId(osid_id_Id $resourceId, $match) { // Try room locations try { - $locationString = $this->session->getDatabaseIdString($resourceId, 'resource/place/room/'); - $locationParts = explode('/', $locationString); + $locationString = $this->session->getDatabaseIdString($resourceId, 'resource.place.room.'); + $locationParts = explode('.', $locationString); $this->addClause( 'location', '(SSRMEET_BLDG_CODE = ? AND SSRMEET_ROOM_CODE = ?)', @@ -906,7 +906,7 @@ public function matchLocationId(osid_id_Id $resourceId, $match) // Try building locations catch (osid_NotFoundException $e) { try { - $building = $this->session->getDatabaseIdString($resourceId, 'resource/place/building/'); + $building = $this->session->getDatabaseIdString($resourceId, 'resource.place.building.'); $this->addClause( 'location', 'SSRMEET_BLDG_CODE = ?', @@ -915,7 +915,7 @@ public function matchLocationId(osid_id_Id $resourceId, $match) } // Try campus locations catch (osid_NotFoundException $e) { - $campus = $this->session->getDatabaseIdString($resourceId, 'resource/place/campus/'); + $campus = $this->session->getDatabaseIdString($resourceId, 'resource.place.campus.'); $this->addClause( 'location', 'SSBSECT_CAMP_CODE = ?', @@ -1178,8 +1178,8 @@ public function matchCourseCatalogId(osid_id_Id $courseCatalogId, $match) catalog_id = ? ))', [ - $this->session->getDatabaseIdString($courseCatalogId, 'catalog/'), - $this->session->getDatabaseIdString($courseCatalogId, 'catalog/'), + $this->session->getDatabaseIdString($courseCatalogId, 'catalog.'), + $this->session->getDatabaseIdString($courseCatalogId, 'catalog.'), ], $match); } @@ -1273,7 +1273,7 @@ public function matchAnyURL($match) */ public function matchInstructorId(osid_id_Id $instructorId, $match) { - $this->addClause('instructor_id', 'WEB_ID = ?', [$this->session->getDatabaseIdString($instructorId, 'resource/person/')], $match); + $this->addClause('instructor_id', 'WEB_ID = ?', [$this->session->getDatabaseIdString($instructorId, 'resource.person.')], $match); $this->addTableJoin('LEFT JOIN SYVINST ON (SYVINST_TERM_CODE = SSBSECT_TERM_CODE AND SYVINST_CRN = SSBSECT_CRN)'); } diff --git a/application/library/banner/course/CourseOffering/Search/Search.php b/application/library/banner/course/CourseOffering/Search/Search.php index f99063fb..58bb18b5 100755 --- a/application/library/banner/course/CourseOffering/Search/Search.php +++ b/application/library/banner/course/CourseOffering/Search/Search.php @@ -101,6 +101,6 @@ public function orderCourseOfferingResults(osid_course_CourseOfferingSearchOrder */ public function getCourseOfferingSearchRecord(osid_type_Type $courseOfferingSearchRecordType) { - throw new osid_UnsupportedException(); + throw new osid_UnsupportedException('The CourseOfferingSearchRecordType passed is not supported.'); } } diff --git a/application/library/banner/course/CourseOffering/Search/Session.php b/application/library/banner/course/CourseOffering/Search/Session.php index 3c645e4f..9073d072 100755 --- a/application/library/banner/course/CourseOffering/Search/Session.php +++ b/application/library/banner/course/CourseOffering/Search/Session.php @@ -47,7 +47,7 @@ class banner_course_CourseOffering_Search_Session extends banner_course_CourseOf */ public function __construct(banner_course_CourseManagerInterface $manager, osid_id_Id $catalogId) { - parent::__construct($manager, 'section/'); + parent::__construct($manager, 'section.'); $this->catalogId = $catalogId; } @@ -269,12 +269,12 @@ public function buildIndex($displayStatus = false) $offerings = $lookupSession->getCourseOfferings(); // Known topic types - $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division'); - $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); - $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/block'); - $this->instructionMethodType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/instruction_method'); + $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.subject'); + $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.department'); + $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.division'); + $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement'); + $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.block'); + $this->instructionMethodType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.instruction_method'); // Known record types $this->instructorsType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors'); @@ -296,7 +296,7 @@ public function buildIndex($displayStatus = false) if (!$insertStmt->execute([':term_code' => $termCode, ':crn' => $crn, ':text' => $text])) { $info = $insertStmt->errorInfo(); - throw new osid_OperationFailedException('FullText update failed with code '.$info[0].'/'.$info[1].' - '.$info[2]); + throw new osid_OperationFailedException('FullText update failed with code '.$info[0].'.'.$info[1].' - '.$info[2]); } } catch (Exception $e) { echo "\nError of type:\n\t".$e::class."\nwith message:\n\t".$e->getMessage()."\n"; diff --git a/application/library/banner/course/Term/Catalog/Session.php b/application/library/banner/course/Term/Catalog/Session.php index b9aba1fa..c1e7c2d5 100755 --- a/application/library/banner/course/Term/Catalog/Session.php +++ b/application/library/banner/course/Term/Catalog/Session.php @@ -34,7 +34,7 @@ class banner_course_Term_Catalog_Session extends banner_course_AbstractSession i */ public function __construct(banner_course_CourseManagerInterface $manager) { - parent::__construct($manager, 'catalog/'); + parent::__construct($manager, 'catalog.'); } /** @@ -232,14 +232,14 @@ public function getTermsByCatalogs(osid_id_IdList $courseCatalogIdList) public function getCatalogIdsByTerm(osid_id_Id $termId) { $parameters = [ - ':section_term_code' => $this->getDatabaseIdString($termId, 'term/'), + ':section_term_code' => $this->getDatabaseIdString($termId, 'term.'), ]; $statement = $this->getGetCatalogsStatement(); $statement->execute($parameters); $ids = []; while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { - $ids[] = $this->getOsidIdFromString($row['catalog_id'], 'catalog/'); + $ids[] = $this->getOsidIdFromString($row['catalog_id'], 'catalog.'); } $statement->closeCursor(); @@ -267,7 +267,7 @@ public function getCatalogIdsByTerm(osid_id_Id $termId) public function getCatalogsByTerm(osid_id_Id $termId) { $parameters = [ - ':section_term_code' => $this->getDatabaseIdString($termId, 'term/'), + ':section_term_code' => $this->getDatabaseIdString($termId, 'term.'), ]; $statement = $this->getGetCatalogsStatement(); $statement->execute($parameters); @@ -275,7 +275,7 @@ public function getCatalogsByTerm(osid_id_Id $termId) $catalogs = []; while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $catalogs[] = new banner_course_CourseCatalog( - $this->getOsidIdFromString($row['catalog_id'], 'catalog/'), + $this->getOsidIdFromString($row['catalog_id'], 'catalog.'), $row['catalog_title']); } $statement->closeCursor(); diff --git a/application/library/banner/course/Term/ForCourseList.php b/application/library/banner/course/Term/ForCourseList.php index 1c17f68d..839566bc 100755 --- a/application/library/banner/course/Term/ForCourseList.php +++ b/application/library/banner/course/Term/ForCourseList.php @@ -110,11 +110,14 @@ private function getAllInputParameters() * Answer an object from a result row. * * @since 4/13/09 + * + * @return osid_course_Term + * An object for the row data */ protected function getObjectFromRow(array $row) { return new banner_course_Term( - $this->session->getOsidIdFromString($row['STVTERM_CODE'], 'term/'), + $this->session->getOsidIdFromString($row['STVTERM_CODE'], 'term.'), $row['STVTERM_DESC'], $row['STVTERM_START_DATE'], $row['STVTERM_END_DATE']); diff --git a/application/library/banner/course/Term/Lookup/AllList.php b/application/library/banner/course/Term/Lookup/AllList.php index b74ee291..647e9564 100755 --- a/application/library/banner/course/Term/Lookup/AllList.php +++ b/application/library/banner/course/Term/Lookup/AllList.php @@ -91,11 +91,14 @@ private function getAllInputParameters() * Answer an object from a result row. * * @since 4/13/09 + * + * @return osid_course_Term + * An object for the row data */ protected function getObjectFromRow(array $row) { return new banner_course_Term( - $this->session->getOsidIdFromString($row['STVTERM_CODE'], 'term/'), + $this->session->getOsidIdFromString($row['STVTERM_CODE'], 'term.'), $row['STVTERM_DESC'], $row['STVTERM_START_DATE'], $row['STVTERM_END_DATE']); diff --git a/application/library/banner/course/Term/Lookup/Session.php b/application/library/banner/course/Term/Lookup/Session.php index ec9bcd18..8996155b 100755 --- a/application/library/banner/course/Term/Lookup/Session.php +++ b/application/library/banner/course/Term/Lookup/Session.php @@ -48,7 +48,7 @@ class banner_course_Term_Lookup_Session extends banner_course_AbstractSession im */ public function __construct(banner_course_CourseManagerInterface $manager, ?osid_id_Id $catalogId = null) { - parent::__construct($manager, 'term/'); + parent::__construct($manager, 'term.'); if (null === $catalogId) { $this->catalogId = $manager->getCombinedCatalogId(); @@ -187,8 +187,8 @@ public function useIsolatedCourseCatalogView() */ public function getTerm(osid_id_Id $termId) { - $idString = $this->getDatabaseIdString($termId, 'term/'); - if (!preg_match('/^([0-9]{6})(?:\/([a-z0-9]{1,3}))?$/i', $idString, $matches)) { + $idString = $this->getDatabaseIdString($termId, 'term.'); + if (!preg_match('/^([0-9]{6})(?:\.([a-z0-9]{1,3}))?$/i', $idString, $matches)) { throw new osid_NotFoundException('Term id component \''.$idString.'\' could not be converted to a term code.'); } @@ -250,12 +250,12 @@ protected function getBaseTerm($idString) $row = self::$getTerm_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getTerm_stmts[$catalogWhere]->closeCursor(); - if (!$row['STVTERM_CODE']) { + if (!$row || !$row['STVTERM_CODE']) { throw new osid_NotFoundException("Could not find a term matching the term code $idString."); } return new banner_course_Term( - $this->getOsidIdFromString($row['STVTERM_CODE'], 'term/'), + $this->getOsidIdFromString($row['STVTERM_CODE'], 'term.'), $row['STVTERM_DESC'], $row['STVTERM_START_DATE'], $row['STVTERM_END_DATE']); @@ -321,7 +321,7 @@ protected function getPartOfTerm($termCode, $pTermCode) $row = self::$getPartOfTerm_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getPartOfTerm_stmts[$catalogWhere]->closeCursor(); - if (!$row['STVTERM_CODE']) { + if (!$row || !$row['STVTERM_CODE']) { throw new osid_NotFoundException("Could not find a term matching the term code $termCode and part-of-term code $pTermCode."); } @@ -341,7 +341,7 @@ protected function getPartOfTerm($termCode, $pTermCode) } return new banner_course_Term( - $this->getOsidIdFromString($row['STVTERM_CODE'].'/'.$row['SOBPTRM_PTRM_CODE'], 'term/'), + $this->getOsidIdFromString($row['STVTERM_CODE'].'.'.$row['SOBPTRM_PTRM_CODE'], 'term.'), $desc, $startDate, $endDate); @@ -374,7 +374,7 @@ private function getCatalogParameters() { $params = []; if (null !== $this->catalogId && !$this->catalogId->isEqual($this->getCombinedCatalogId())) { - $params[':catalog_id'] = $this->getDatabaseIdString($this->catalogId, 'catalog/'); + $params[':catalog_id'] = $this->getDatabaseIdString($this->catalogId, 'catalog.'); } return $params; diff --git a/application/library/banner/course/Topic/AbstractList.php b/application/library/banner/course/Topic/AbstractList.php index bbd3bb52..c79e518c 100755 --- a/application/library/banner/course/Topic/AbstractList.php +++ b/application/library/banner/course/Topic/AbstractList.php @@ -562,14 +562,17 @@ abstract protected function includeSubjects(); * Answer an object from a result row. * * @since 4/13/09 + * + * @return osid_course_Topic + * An object for the row data */ final protected function getObjectFromRow(array $row) { return new banner_course_Topic( - $this->session->getOsidIdFromString($row['type'].'/'.$row['id'], 'topic/'), + $this->session->getOsidIdFromString($row['type'].'.'.$row['id'], 'topic.'), trim($row['display_name']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/'.$row['type']) + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.'.$row['type']) ); } diff --git a/application/library/banner/course/Topic/Lookup/Session.php b/application/library/banner/course/Topic/Lookup/Session.php index 8c9c5e3c..1243a96a 100755 --- a/application/library/banner/course/Topic/Lookup/Session.php +++ b/application/library/banner/course/Topic/Lookup/Session.php @@ -46,7 +46,7 @@ class banner_course_Topic_Lookup_Session extends banner_course_AbstractSession i */ public function __construct(banner_course_CourseManagerInterface $manager, osid_id_Id $catalogId) { - parent::__construct($manager, 'section/'); + parent::__construct($manager, 'section.'); $this->catalogId = $catalogId; } @@ -215,8 +215,8 @@ public function getTopic(osid_id_Id $topicId) */ public function getTopicType(osid_id_Id $topicId) { - $string = $this->getDatabaseIdString($topicId, 'topic/'); - if (!preg_match('#(subject|department|division|requirement|level|block|instruction_method)/.+#', $string, $matches)) { + $string = $this->getDatabaseIdString($topicId, 'topic.'); + if (!preg_match('#(subject|department|division|requirement|level|block|instruction_method)..+#', $string, $matches)) { throw new osid_NotFoundException('Could not turn "'.$string.'" into a topic type.'); } @@ -232,8 +232,8 @@ public function getTopicType(osid_id_Id $topicId) */ public function getTopicValue(osid_id_Id $topicId) { - $string = $this->getDatabaseIdString($topicId, 'topic/'); - if (!preg_match('#(subject|department|division|requirement|level|block|instruction_method)/(.+)#', $string, $matches)) { + $string = $this->getDatabaseIdString($topicId, 'topic.'); + if (!preg_match('#(subject|department|division|requirement|level|block|instruction_method).(.+)#', $string, $matches)) { throw new osid_NotFoundException('Could not turn "'.$string.'" into a topic type.'); } @@ -278,22 +278,22 @@ private function getSubjectTopic(osid_id_Id $topicId) $parameters = array_merge( [ - ':subject_code' => $this->getDatabaseIdString($topicId, 'topic/subject/'), + ':subject_code' => $this->getDatabaseIdString($topicId, 'topic.subject.'), ], $this->getCatalogParameters()); self::$getSubjectTopic_stmts[$catalogWhere]->execute($parameters); $row = self::$getSubjectTopic_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getSubjectTopic_stmts[$catalogWhere]->closeCursor(); - if (!$row['STVSUBJ_CODE']) { - throw new osid_NotFoundException('Could not find a topic matching the subject code '.$this->getDatabaseIdString($topicId, 'topic/subject/').'.'); + if (!$row || !$row['STVSUBJ_CODE']) { + throw new osid_NotFoundException('Could not find a topic matching the subject code '.$this->getDatabaseIdString($topicId, 'topic.subject.').'.'); } return new banner_course_Topic( - $this->getOsidIdFromString($row['STVSUBJ_CODE'], 'topic/subject/'), + $this->getOsidIdFromString($row['STVSUBJ_CODE'], 'topic.subject.'), trim($row['STVSUBJ_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.subject') ); } @@ -339,10 +339,10 @@ private function getSubjectTopics() $topics = []; while ($row = self::$getSubjectTopics_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC)) { $topics[] = new banner_course_Topic( - $this->getOsidIdFromString($row['STVSUBJ_CODE'], 'topic/subject/'), + $this->getOsidIdFromString($row['STVSUBJ_CODE'], 'topic.subject.'), trim($row['STVSUBJ_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.subject') ); } self::$getSubjectTopics_stmts[$catalogWhere]->closeCursor(); @@ -388,22 +388,22 @@ private function getDepartmentTopic(osid_id_Id $topicId) $parameters = array_merge( [ - ':department_code' => $this->getDatabaseIdString($topicId, 'topic/department/'), + ':department_code' => $this->getDatabaseIdString($topicId, 'topic.department.'), ], $this->getCatalogParameters()); self::$getDepartmentTopic_stmts[$catalogWhere]->execute($parameters); $row = self::$getDepartmentTopic_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getDepartmentTopic_stmts[$catalogWhere]->closeCursor(); - if (!$row['STVDEPT_CODE']) { - throw new osid_NotFoundException('Could not find a topic matching the department code '.$this->getDatabaseIdString($topicId, 'topic/department/').'.'); + if (empty($row) || !$row['STVDEPT_CODE']) { + throw new osid_NotFoundException('Could not find a topic matching the department code '.$this->getDatabaseIdString($topicId, 'topic.department.').'.'); } return new banner_course_Topic( - $this->getOsidIdFromString($row['STVDEPT_CODE'], 'topic/department/'), + $this->getOsidIdFromString($row['STVDEPT_CODE'], 'topic.department.'), trim($row['STVDEPT_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.department') ); } @@ -448,10 +448,10 @@ private function getDepartmentTopics() $topics = []; while ($row = self::$getDepartmentTopics_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC)) { $topics[] = new banner_course_Topic( - $this->getOsidIdFromString($row['STVDEPT_CODE'], 'topic/department/'), + $this->getOsidIdFromString($row['STVDEPT_CODE'], 'topic.department.'), trim($row['STVDEPT_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.department') ); } self::$getDepartmentTopics_stmts[$catalogWhere]->closeCursor(); @@ -497,22 +497,22 @@ private function getDivisionTopic(osid_id_Id $topicId) $parameters = array_merge( [ - ':division_code' => $this->getDatabaseIdString($topicId, 'topic/division/'), + ':division_code' => $this->getDatabaseIdString($topicId, 'topic.division.'), ], $this->getCatalogParameters()); self::$getDivisionTopic_stmts[$catalogWhere]->execute($parameters); $row = self::$getDivisionTopic_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getDivisionTopic_stmts[$catalogWhere]->closeCursor(); - if (!$row['STVDIVS_CODE']) { - throw new osid_NotFoundException('Could not find a topic matching the division code '.$this->getDatabaseIdString($topicId, 'topic/division/').'.'); + if (!$row || !$row['STVDIVS_CODE']) { + throw new osid_NotFoundException('Could not find a topic matching the division code '.$this->getDatabaseIdString($topicId, 'topic.division.').'.'); } return new banner_course_Topic( - $this->getOsidIdFromString($row['STVDIVS_CODE'], 'topic/division/'), + $this->getOsidIdFromString($row['STVDIVS_CODE'], 'topic.division.'), trim($row['STVDIVS_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.division') ); } @@ -557,10 +557,10 @@ private function getDivisionTopics() $topics = []; while ($row = self::$getDivisionTopics_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC)) { $topics[] = new banner_course_Topic( - $this->getOsidIdFromString($row['STVDIVS_CODE'], 'topic/division/'), + $this->getOsidIdFromString($row['STVDIVS_CODE'], 'topic.division.'), trim($row['STVDIVS_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.division') ); } self::$getDivisionTopics_stmts[$catalogWhere]->closeCursor(); @@ -626,29 +626,29 @@ private function getRequirementTopic(osid_id_Id $topicId) $parameters = array_merge( [ - ':requirement_code' => $this->getDatabaseIdString($topicId, 'topic/requirement/'), + ':requirement_code' => $this->getDatabaseIdString($topicId, 'topic.requirement.'), ], $this->getCatalogParameters()); self::$getRequirementTopic_stmts[$catalogWhere]->execute($parameters); $row = self::$getRequirementTopic_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getRequirementTopic_stmts[$catalogWhere]->closeCursor(); - if (!$row['STVATTR_CODE']) { + if (!$row || !$row['STVATTR_CODE']) { // Try the course-only requirements self::$getCourseRequirementTopic_stmts[$catalogWhere]->execute($parameters); $row = self::$getCourseRequirementTopic_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getCourseRequirementTopic_stmts[$catalogWhere]->closeCursor(); - if (!$row['STVATTR_CODE']) { - throw new osid_NotFoundException('Could not find a topic matching the requirement code '.$this->getDatabaseIdString($topicId, 'topic/requirement/').'.'); + if (!$row || !$row['STVATTR_CODE']) { + throw new osid_NotFoundException('Could not find a topic matching the requirement code '.$this->getDatabaseIdString($topicId, 'topic.requirement.').'.'); } } return new banner_course_Topic( - $this->getOsidIdFromString($row['STVATTR_CODE'], 'topic/requirement/'), + $this->getOsidIdFromString($row['STVATTR_CODE'], 'topic.requirement.'), trim($row['STVATTR_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement') ); } @@ -687,10 +687,10 @@ private function getRequirementTopics() $topics = []; while ($row = self::$getRequirementTopics_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC)) { $topics[] = new banner_course_Topic( - $this->getOsidIdFromString($row['STVATTR_CODE'], 'topic/requirement/'), + $this->getOsidIdFromString($row['STVATTR_CODE'], 'topic.requirement.'), trim($row['STVATTR_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement') ); } self::$getRequirementTopics_stmts[$catalogWhere]->closeCursor(); @@ -737,22 +737,22 @@ private function getLevelTopic(osid_id_Id $topicId) $parameters = array_merge( [ - ':level_code' => $this->getDatabaseIdString($topicId, 'topic/level/'), + ':level_code' => $this->getDatabaseIdString($topicId, 'topic.level.'), ], $this->getCatalogParameters()); self::$getLevelTopic_stmts[$catalogWhere]->execute($parameters); $row = self::$getLevelTopic_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getLevelTopic_stmts[$catalogWhere]->closeCursor(); - if (!$row['STVLEVL_CODE']) { - throw new osid_NotFoundException('Could not find a topic matching the level code '.$this->getDatabaseIdString($topicId, 'topic/level/').'.'); + if (!$row || !$row['STVLEVL_CODE']) { + throw new osid_NotFoundException('Could not find a topic matching the level code '.$this->getDatabaseIdString($topicId, 'topic.level.').'.'); } return new banner_course_Topic( - $this->getOsidIdFromString($row['STVLEVL_CODE'], 'topic/level/'), + $this->getOsidIdFromString($row['STVLEVL_CODE'], 'topic.level.'), trim($row['STVLEVL_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/level') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.level') ); } @@ -798,10 +798,10 @@ private function getLevelTopics() $topics = []; while ($row = self::$getLevelTopics_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC)) { $topics[] = new banner_course_Topic( - $this->getOsidIdFromString($row['STVLEVL_CODE'], 'topic/level/'), + $this->getOsidIdFromString($row['STVLEVL_CODE'], 'topic.level.'), trim($row['STVLEVL_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/level') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.level') ); } self::$getLevelTopics_stmts[$catalogWhere]->closeCursor(); @@ -841,22 +841,22 @@ private function getBlockTopic(osid_id_Id $topicId) $parameters = array_merge( [ - ':block_code' => $this->getDatabaseIdString($topicId, 'topic/block/'), + ':block_code' => $this->getDatabaseIdString($topicId, 'topic.block.'), ], $this->getCatalogParameters()); self::$getBlockTopic_stmts[$catalogWhere]->execute($parameters); $row = self::$getBlockTopic_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getBlockTopic_stmts[$catalogWhere]->closeCursor(); - if (!$row['STVBLCK_CODE']) { - throw new osid_NotFoundException('Could not find a topic matching the block code '.$this->getDatabaseIdString($topicId, 'topic/block/').'.'); + if (!$row || !$row['STVBLCK_CODE']) { + throw new osid_NotFoundException('Could not find a topic matching the block code '.$this->getDatabaseIdString($topicId, 'topic.block.').'.'); } return new banner_course_Topic( - $this->getOsidIdFromString($row['STVBLCK_CODE'], 'topic/block/'), + $this->getOsidIdFromString($row['STVBLCK_CODE'], 'topic.block.'), trim($row['STVBLCK_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/block') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.block') ); } @@ -895,10 +895,10 @@ private function getBlockTopics() $topics = []; while ($row = self::$getBlockTopics_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC)) { $topics[] = new banner_course_Topic( - $this->getOsidIdFromString($row['STVBLCK_CODE'], 'topic/block/'), + $this->getOsidIdFromString($row['STVBLCK_CODE'], 'topic.block.'), trim($row['STVBLCK_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/block') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.block') ); } self::$getBlockTopics_stmts[$catalogWhere]->closeCursor(); @@ -938,22 +938,22 @@ private function getInstructionMethodTopic(osid_id_Id $topicId) $parameters = array_merge( [ - ':insm_code' => $this->getDatabaseIdString($topicId, 'topic/instruction_method/'), + ':insm_code' => $this->getDatabaseIdString($topicId, 'topic.instruction_method.'), ], $this->getCatalogParameters()); self::$getInstructionMethodTopic_stmts[$catalogWhere]->execute($parameters); $row = self::$getInstructionMethodTopic_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC); self::$getInstructionMethodTopic_stmts[$catalogWhere]->closeCursor(); - if (!$row['GTVINSM_CODE']) { - throw new osid_NotFoundException('Could not find a topic matching the instruction_method code '.$this->getDatabaseIdString($topicId, 'topic/instruction_method/').'.'); + if (!$row || !$row['GTVINSM_CODE']) { + throw new osid_NotFoundException('Could not find a topic matching the instruction_method code '.$this->getDatabaseIdString($topicId, 'topic.instruction_method.').'.'); } return new banner_course_Topic( - $this->getOsidIdFromString($row['GTVINSM_CODE'], 'topic/instruction_method/'), + $this->getOsidIdFromString($row['GTVINSM_CODE'], 'topic.instruction_method.'), trim($row['GTVINSM_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/instruction_method') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.instruction_method') ); } @@ -992,10 +992,10 @@ private function getInstructionMethodTopics() $topics = []; while ($row = self::$getInstructionMethodTopics_stmts[$catalogWhere]->fetch(PDO::FETCH_ASSOC)) { $topics[] = new banner_course_Topic( - $this->getOsidIdFromString($row['GTVINSM_CODE'], 'topic/instruction_method/'), + $this->getOsidIdFromString($row['GTVINSM_CODE'], 'topic.instruction_method.'), trim($row['GTVINSM_DESC']), '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/instruction_method') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.instruction_method') ); } self::$getInstructionMethodTopics_stmts[$catalogWhere]->closeCursor(); @@ -1111,19 +1111,19 @@ public function getTopicsByGenusType(osid_type_Type $topicGenusType) return new phpkit_EmptyList('osid_course_TopicList'); } switch ($topicGenusType->getIdentifier()) { - case 'genera:topic/subject': + case 'genera:topic.subject': return $this->getSubjectTopics(); - case 'genera:topic/department': + case 'genera:topic.department': return $this->getDepartmentTopics(); - case 'genera:topic/division': + case 'genera:topic.division': return $this->getDivisionTopics(); - case 'genera:topic/requirement': + case 'genera:topic.requirement': return $this->getRequirementTopics(); - case 'genera:topic/level': + case 'genera:topic.level': return $this->getLevelTopics(); - case 'genera:topic/block': + case 'genera:topic.block': return $this->getBlockTopics(); - case 'genera:topic/instruction_method': + case 'genera:topic.instruction_method': return $this->getInstructionMethodTopics(); default: return new phpkit_EmptyList('osid_course_TopicList'); diff --git a/application/library/banner/course/Topic/Search/Query.php b/application/library/banner/course/Topic/Search/Query.php index b17c2f77..3ccff3c3 100755 --- a/application/library/banner/course/Topic/Search/Query.php +++ b/application/library/banner/course/Topic/Search/Query.php @@ -39,13 +39,13 @@ public function __construct(banner_course_SessionInterface $session) $this->termType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:terms'); - $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division'); - $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); - $this->levelType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/level'); - $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/block'); - $this->instructionMethodType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/instruction_method'); + $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.subject'); + $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.department'); + $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.division'); + $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement'); + $this->levelType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.level'); + $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.block'); + $this->instructionMethodType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.instruction_method'); $this->toInclude = []; } diff --git a/application/library/banner/course/Topic/Search/Query/Block.php b/application/library/banner/course/Topic/Search/Query/Block.php index 10c04d1b..0038fc65 100755 --- a/application/library/banner/course/Topic/Search/Query/Block.php +++ b/application/library/banner/course/Topic/Search/Query/Block.php @@ -379,6 +379,6 @@ public function getTopicQueryRecord(osid_type_Type $topicRecordType) */ public function matchTermId(osid_id_Id $termId, $match) { - $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term/')], $match); + $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term.')], $match); } } diff --git a/application/library/banner/course/Topic/Search/Query/Department.php b/application/library/banner/course/Topic/Search/Query/Department.php index 452c344a..e98ff86b 100755 --- a/application/library/banner/course/Topic/Search/Query/Department.php +++ b/application/library/banner/course/Topic/Search/Query/Department.php @@ -379,6 +379,6 @@ public function getTopicQueryRecord(osid_type_Type $topicRecordType) */ public function matchTermId(osid_id_Id $termId, $match) { - $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term/')], $match); + $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term.')], $match); } } diff --git a/application/library/banner/course/Topic/Search/Query/Division.php b/application/library/banner/course/Topic/Search/Query/Division.php index 390e735b..95f29e51 100755 --- a/application/library/banner/course/Topic/Search/Query/Division.php +++ b/application/library/banner/course/Topic/Search/Query/Division.php @@ -379,6 +379,6 @@ public function getTopicQueryRecord(osid_type_Type $topicRecordType) */ public function matchTermId(osid_id_Id $termId, $match) { - $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term/')], $match); + $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term.')], $match); } } diff --git a/application/library/banner/course/Topic/Search/Query/InstructionMethod.php b/application/library/banner/course/Topic/Search/Query/InstructionMethod.php index 154b90d1..6d816c30 100644 --- a/application/library/banner/course/Topic/Search/Query/InstructionMethod.php +++ b/application/library/banner/course/Topic/Search/Query/InstructionMethod.php @@ -375,6 +375,6 @@ public function getTopicQueryRecord(osid_type_Type $topicRecordType) */ public function matchTermId(osid_id_Id $termId, $match) { - $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term/')], $match); + $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term.')], $match); } } diff --git a/application/library/banner/course/Topic/Search/Query/Level.php b/application/library/banner/course/Topic/Search/Query/Level.php index 058bada9..8642814e 100755 --- a/application/library/banner/course/Topic/Search/Query/Level.php +++ b/application/library/banner/course/Topic/Search/Query/Level.php @@ -379,6 +379,6 @@ public function getTopicQueryRecord(osid_type_Type $topicRecordType) */ public function matchTermId(osid_id_Id $termId, $match) { - $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term/')], $match); + $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term.')], $match); } } diff --git a/application/library/banner/course/Topic/Search/Query/Requirement.php b/application/library/banner/course/Topic/Search/Query/Requirement.php index 2572290e..f9bf8237 100755 --- a/application/library/banner/course/Topic/Search/Query/Requirement.php +++ b/application/library/banner/course/Topic/Search/Query/Requirement.php @@ -379,6 +379,6 @@ public function getTopicQueryRecord(osid_type_Type $topicRecordType) */ public function matchTermId(osid_id_Id $termId, $match) { - $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term/')], $match); + $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term.')], $match); } } diff --git a/application/library/banner/course/Topic/Search/Query/Subject.php b/application/library/banner/course/Topic/Search/Query/Subject.php index d180982f..06f74654 100755 --- a/application/library/banner/course/Topic/Search/Query/Subject.php +++ b/application/library/banner/course/Topic/Search/Query/Subject.php @@ -379,6 +379,6 @@ public function getTopicQueryRecord(osid_type_Type $topicRecordType) */ public function matchTermId(osid_id_Id $termId, $match) { - $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term/')], $match); + $this->addClause('term', 'SSBSECT_TERM_CODE = ?', [$this->session->getDatabaseIdString($termId, 'term.')], $match); } } diff --git a/application/library/banner/course/Topic/Search/Search.php b/application/library/banner/course/Topic/Search/Search.php index c9bf90b8..17927735 100755 --- a/application/library/banner/course/Topic/Search/Search.php +++ b/application/library/banner/course/Topic/Search/Search.php @@ -143,6 +143,6 @@ public function orderTopicResults(osid_course_TopicSearchOrder $topicSearchOrder */ public function getTopicSearchRecord(osid_type_Type $topicSearchRecordType) { - throw new osid_UnsupportedException(); + throw new osid_UnsupportedException('The TopicSearchRecordType passed is not supported.'); } } diff --git a/application/library/banner/course/Topic/Search/Session.php b/application/library/banner/course/Topic/Search/Session.php index 4c0bc9f5..36c4fecf 100755 --- a/application/library/banner/course/Topic/Search/Session.php +++ b/application/library/banner/course/Topic/Search/Session.php @@ -45,7 +45,7 @@ class banner_course_Topic_Search_Session extends banner_course_AbstractSession i */ public function __construct(banner_course_CourseManagerInterface $manager, osid_id_Id $catalogId) { - parent::__construct($manager, 'section/'); + parent::__construct($manager, 'section.'); $this->catalogId = $catalogId; } diff --git a/application/library/banner/resource/Bin/Lookup/Session.php b/application/library/banner/resource/Bin/Lookup/Session.php index de76dc68..8d972c8e 100755 --- a/application/library/banner/resource/Bin/Lookup/Session.php +++ b/application/library/banner/resource/Bin/Lookup/Session.php @@ -40,7 +40,7 @@ class banner_resource_Bin_Lookup_Session extends banner_AbstractSession implemen */ public function __construct(banner_ManagerInterface $manager) { - parent::__construct($manager, 'catalog/'); + parent::__construct($manager, 'catalog.'); } /** diff --git a/application/library/banner/resource/Resource/Building.php b/application/library/banner/resource/Resource/Building.php index 3c467717..59d4ccd9 100644 --- a/application/library/banner/resource/Resource/Building.php +++ b/application/library/banner/resource/Resource/Building.php @@ -39,7 +39,7 @@ public function __construct(osid_id_Id $id, $displayName, $code) $this->setId($id); $this->setDisplayName($displayName); $this->setDescription($code); - $this->setGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/building')); + $this->setGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.building')); $this->buildingDisplayName = $displayName; $this->buildingCode = $code; diff --git a/application/library/banner/resource/Resource/Lookup/CombinedSession.php b/application/library/banner/resource/Resource/Lookup/CombinedSession.php index 08445eba..1cab735a 100755 --- a/application/library/banner/resource/Resource/Lookup/CombinedSession.php +++ b/application/library/banner/resource/Resource/Lookup/CombinedSession.php @@ -45,7 +45,7 @@ class banner_resource_Resource_Lookup_CombinedSession extends banner_AbstractSes */ public function __construct(banner_ManagerInterface $manager) { - parent::__construct($manager, 'resource/'); + parent::__construct($manager, 'resource.'); } /** @@ -181,11 +181,11 @@ public function getResource(osid_id_Id $resourceId) switch ($type) { case 'person': return $this->getPersonResource($resourceId); - case 'place/room': + case 'place.room': return $this->getRoomResource($resourceId); - case 'place/building': + case 'place.building': return $this->getBuildingResource($resourceId); - case 'place/campus': + case 'place.campus': return $this->getCampusResource($resourceId); default: throw new osid_NotFoundException('No resource found with category '.$type); @@ -201,8 +201,8 @@ public function getResource(osid_id_Id $resourceId) */ public function getResourceType(osid_id_Id $resourceId) { - $string = $this->getDatabaseIdString($resourceId, 'resource/'); - if (!preg_match('#(person|place/room|place/building|place/campus)/(.+)#', $string, $matches)) { + $string = $this->getDatabaseIdString($resourceId, 'resource.'); + if (!preg_match('#(person|place\.room|place\.building|place\.campus)\.(.+)#', $string, $matches)) { throw new osid_NotFoundException('Could not turn "'.$string.'" into a resource type.'); } @@ -218,8 +218,8 @@ public function getResourceType(osid_id_Id $resourceId) */ public function getResourceValue(osid_id_Id $resourceId) { - $string = $this->getDatabaseIdString($resourceId, 'resource/'); - if (!preg_match('#(person|place/room|place/building|place/campus)/(.+)#', $string, $matches)) { + $string = $this->getDatabaseIdString($resourceId, 'resource.'); + if (!preg_match('#(person|place\.room|place\.building|place\.campus)\.(.+)#', $string, $matches)) { throw new osid_NotFoundException('Could not turn "'.$string.'" into a resource type.'); } @@ -252,18 +252,18 @@ private function getPersonResource(osid_id_Id $resourceId) } $parameters = [ - ':webid' => $this->getDatabaseIdString($resourceId, 'resource/person/'), + ':webid' => $this->getDatabaseIdString($resourceId, 'resource.person.'), ]; self::$getPersonResource_stmt->execute($parameters); $row = self::$getPersonResource_stmt->fetch(PDO::FETCH_ASSOC); self::$getPersonResource_stmt->closeCursor(); - if (!$row['WEB_ID']) { - throw new osid_NotFoundException('Could not find a resource matching the person code '.$this->getDatabaseIdString($resourceId, 'resource/person/').'.'); + if (empty($row) || !$row['WEB_ID']) { + throw new osid_NotFoundException('Could not find a resource matching the person code '.$this->getDatabaseIdString($resourceId, 'resource.person.').'.'); } return new banner_resource_Resource_Person( - $this->getOsidIdFromString($row['WEB_ID'], 'resource/person/'), + $this->getOsidIdFromString($row['WEB_ID'], 'resource.person.'), $row['SYVINST_LAST_NAME'], $row['SYVINST_FIRST_NAME'] ); @@ -298,7 +298,7 @@ private function getPersonResources() $resources = []; while ($row = self::$getPersonResources_stmt->fetch(PDO::FETCH_ASSOC)) { $resources[] = new banner_resource_Resource_Person( - $this->getOsidIdFromString($row['WEB_ID'], 'resource/person/'), + $this->getOsidIdFromString($row['WEB_ID'], 'resource.person.'), $row['SYVINST_LAST_NAME'], $row['SYVINST_FIRST_NAME'] ); @@ -333,18 +333,18 @@ private function getBuildingResource(osid_id_Id $resourceId) } $parameters = [ - ':code' => $this->getDatabaseIdString($resourceId, 'resource/place/building/'), + ':code' => $this->getDatabaseIdString($resourceId, 'resource.place.building.'), ]; self::$getBuildingResource_stmt->execute($parameters); $row = self::$getBuildingResource_stmt->fetch(PDO::FETCH_ASSOC); self::$getBuildingResource_stmt->closeCursor(); - if (!$row['STVBLDG_CODE']) { - throw new osid_NotFoundException('Could not find a resource matching the building code '.$this->getDatabaseIdString($resourceId, 'resource/place/building/').'.'); + if (!$row || !$row['STVBLDG_CODE']) { + throw new osid_NotFoundException('Could not find a resource matching the building code '.$this->getDatabaseIdString($resourceId, 'resource.place.building.').'.'); } return new banner_resource_Resource_Building( - $this->getOsidIdFromString($row['STVBLDG_CODE'], 'resource/place/building/'), + $this->getOsidIdFromString($row['STVBLDG_CODE'], 'resource.place.building.'), $row['STVBLDG_DESC'], $row['STVBLDG_CODE'] ); @@ -377,7 +377,7 @@ private function getBuildingResources() $resources = []; while ($row = self::$getBuildingResources_stmt->fetch(PDO::FETCH_ASSOC)) { $resources[] = new banner_resource_Resource_Building( - $this->getOsidIdFromString($row['STVBLDG_CODE'], 'resource/place/building/'), + $this->getOsidIdFromString($row['STVBLDG_CODE'], 'resource.place.building.'), $row['STVBLDG_DESC'], $row['STVBLDG_CODE'] ); @@ -416,8 +416,8 @@ private function getRoomResource(osid_id_Id $resourceId) self::$getRoomResource_stmt = $this->manager->getDB()->prepare($query); } - $roomString = $this->getDatabaseIdString($resourceId, 'resource/place/room/'); - if (!preg_match('#^([a-z0-9_-]+)/(.+)$#i', $roomString, $matches)) { + $roomString = $this->getDatabaseIdString($resourceId, 'resource.place.room.'); + if (!preg_match('#^([a-z0-9_-]+)\.(.+)$#i', $roomString, $matches)) { throw new osid_NotFoundException("Room string '$roomString' doesn't match."); } @@ -429,12 +429,12 @@ private function getRoomResource(osid_id_Id $resourceId) $row = self::$getRoomResource_stmt->fetch(PDO::FETCH_ASSOC); self::$getRoomResource_stmt->closeCursor(); - if (!$row['STVBLDG_CODE']) { - throw new osid_NotFoundException('Could not find a resource matching the room code '.$this->getDatabaseIdString($resourceId, 'resource/place/room/').'.'); + if (!$row || !$row['STVBLDG_CODE']) { + throw new osid_NotFoundException('Could not find a resource matching the room code '.$this->getDatabaseIdString($resourceId, 'resource.place.room.').'.'); } return new banner_resource_Resource_Room( - $this->getOsidIdFromString($row['STVBLDG_CODE'].'/'.$row['SSRMEET_ROOM_CODE'], 'resource/place/room/'), + $this->getOsidIdFromString($row['STVBLDG_CODE'].'.'.$row['SSRMEET_ROOM_CODE'], 'resource.place.room.'), $row['STVBLDG_DESC'], $row['STVBLDG_CODE'], $row['SSRMEET_ROOM_CODE'] @@ -474,7 +474,7 @@ private function getRoomResources() $resources = []; while ($row = self::$getRoomResources_stmt->fetch(PDO::FETCH_ASSOC)) { $resources[] = new banner_resource_Resource_Room( - $this->getOsidIdFromString($row['STVBLDG_CODE'].'/'.$row['SSRMEET_ROOM_CODE'], 'resource/place/room/'), + $this->getOsidIdFromString($row['STVBLDG_CODE'].'.'.$row['SSRMEET_ROOM_CODE'], 'resource.place.room.'), $row['STVBLDG_DESC'], $row['STVBLDG_CODE'], $row['SSRMEET_ROOM_CODE'] @@ -510,21 +510,21 @@ private function getCampusResource(osid_id_Id $resourceId) } $parameters = [ - ':code' => $this->getDatabaseIdString($resourceId, 'resource/place/campus/'), + ':code' => $this->getDatabaseIdString($resourceId, 'resource.place.campus.'), ]; self::$getCampusResource_stmt->execute($parameters); $row = self::$getCampusResource_stmt->fetch(PDO::FETCH_ASSOC); self::$getCampusResource_stmt->closeCursor(); - if (!$row['STVCAMP_CODE']) { - throw new osid_NotFoundException('Could not find a resource matching the campus code '.$this->getDatabaseIdString($resourceId, 'resource/place/campus/').'.'); + if (!$row || !$row['STVCAMP_CODE']) { + throw new osid_NotFoundException('Could not find a resource matching the campus code '.$this->getDatabaseIdString($resourceId, 'resource.place.campus.').'.'); } return new banner_resource_Resource_Place( - $this->getOsidIdFromString($row['STVCAMP_CODE'], 'resource/place/campus/'), + $this->getOsidIdFromString($row['STVCAMP_CODE'], 'resource.place.campus.'), $row['STVCAMP_DESC'], '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/campus') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.campus') ); } @@ -555,10 +555,10 @@ private function getCampusResources() $resources = []; while ($row = self::$getCampusResources_stmt->fetch(PDO::FETCH_ASSOC)) { $resources[] = new banner_resource_Resource_Place( - $this->getOsidIdFromString($row['STVCAMP_CODE'], 'resource/place/campus/'), + $this->getOsidIdFromString($row['STVCAMP_CODE'], 'resource.place.campus.'), $row['STVCAMP_DESC'], '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/campus') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.campus') ); } self::$getCampusResources_stmt->closeCursor(); @@ -641,15 +641,15 @@ public function getResourcesByGenusType(osid_type_Type $resourceGenusType) return new phpkit_EmptyList('osid_resource_ResourceList'); } switch ($resourceGenusType->getIdentifier()) { - case 'genera:resource/person': + case 'genera:resource.person': return $this->getPersonResources(); - case 'genera:resource/place/campus': + case 'genera:resource.place.campus': return $this->getCampusResources(); - case 'genera:resource/place/building': + case 'genera:resource.place.building': return $this->getBuildingResources(); - case 'genera:resource/place/room': + case 'genera:resource.place.room': return $this->getRoomResources(); - // case 'genera:resource/place': + // case 'genera:resource.place': // return $this->getPlaceResources(); default: return new phpkit_EmptyList('osid_resource_ResourceList'); @@ -685,7 +685,7 @@ public function getResourcesByParentGenusType(osid_type_Type $resourceGenusType) return new phpkit_EmptyList('osid_resource_ResourceList'); } - if ('genera:resource/place' == $resourceGenusType->getIdentifier()) { + if ('genera:resource.place' == $resourceGenusType->getIdentifier()) { $resourceList = new phpkit_CombinedList('osid_resource_ResourceList'); $resourceList->addList($this->getCampusResources()); $resourceList->addList($this->getBuildingResources()); diff --git a/application/library/banner/resource/Resource/Lookup/PerCatalogSession.php b/application/library/banner/resource/Resource/Lookup/PerCatalogSession.php index 88de7ce4..84aa0022 100755 --- a/application/library/banner/resource/Resource/Lookup/PerCatalogSession.php +++ b/application/library/banner/resource/Resource/Lookup/PerCatalogSession.php @@ -45,7 +45,7 @@ class banner_resource_Resource_Lookup_PerCatalogSession extends banner_AbstractS */ public function __construct(banner_ManagerInterface $manager, osid_id_Id $binId) { - parent::__construct($manager, 'resource/'); + parent::__construct($manager, 'resource.'); $this->binId = $binId; } @@ -80,7 +80,7 @@ private function getCatalogParameters() { $params = []; if (null !== $this->binId && !$this->binId->isEqual($this->manager->getCombinedBinId())) { - $params[':catalog_id'] = $this->getDatabaseIdString($this->binId, 'catalog/'); + $params[':catalog_id'] = $this->getDatabaseIdString($this->binId, 'catalog.'); } return $params; @@ -225,11 +225,11 @@ public function getResource(osid_id_Id $resourceId) switch ($type) { case 'person': return $this->getPersonResource($resourceId); - case 'place/room': + case 'place.room': return $this->getRoomResource($resourceId); - case 'place/building': + case 'place.building': return $this->getBuildingResource($resourceId); - case 'place/campus': + case 'place.campus': return $this->getCampusResource($resourceId); default: throw new osid_NotFoundException('No resource found with category '.$type); @@ -245,8 +245,8 @@ public function getResource(osid_id_Id $resourceId) */ public function getResourceType(osid_id_Id $resourceId) { - $string = $this->getDatabaseIdString($resourceId, 'resource/'); - if (!preg_match('#(person|place/room|place/building|place/campus)/(.+)#', $string, $matches)) { + $string = $this->getDatabaseIdString($resourceId, 'resource.'); + if (!preg_match('#(person|place\.room|place\.building|place\.campus)\.(.+)#', $string, $matches)) { throw new osid_NotFoundException('Could not turn "'.$string.'" into a resource type.'); } @@ -262,8 +262,8 @@ public function getResourceType(osid_id_Id $resourceId) */ public function getResourceValue(osid_id_Id $resourceId) { - $string = $this->getDatabaseIdString($resourceId, 'resource/'); - if (!preg_match('#(person|place/room|place/building|place/campus)/(.+)#', $string, $matches)) { + $string = $this->getDatabaseIdString($resourceId, 'resource.'); + if (!preg_match('#(person|place\.room|place\.building|place\.campus)\.(.+)#', $string, $matches)) { throw new osid_NotFoundException('Could not turn "'.$string.'" into a resource type.'); } @@ -311,19 +311,19 @@ private function getPersonResource(osid_id_Id $resourceId) $parameters = array_merge( [ - ':webid' => $this->getDatabaseIdString($resourceId, 'resource/person/'), + ':webid' => $this->getDatabaseIdString($resourceId, 'resource.person.'), ], $this->getCatalogParameters()); self::$getPersonResource_stmt->execute($parameters); $row = self::$getPersonResource_stmt->fetch(PDO::FETCH_ASSOC); self::$getPersonResource_stmt->closeCursor(); - if (!$row['WEB_ID']) { - throw new osid_NotFoundException('Could not find a resource matching the person code '.$this->getDatabaseIdString($resourceId, 'resource/person/').'.'); + if (!$row || !$row['WEB_ID']) { + throw new osid_NotFoundException('Could not find a resource matching the person code '.$this->getDatabaseIdString($resourceId, 'resource.person.').'.'); } return new banner_resource_Resource_Person( - $this->getOsidIdFromString($row['WEB_ID'], 'resource/person/'), + $this->getOsidIdFromString($row['WEB_ID'], 'resource.person.'), $row['SYVINST_LAST_NAME'], $row['SYVINST_FIRST_NAME'] ); @@ -373,7 +373,7 @@ private function getPersonResources() $resources = []; while ($row = self::$getPersonResources_stmt->fetch(PDO::FETCH_ASSOC)) { $resources[] = new banner_resource_Resource_Person( - $this->getOsidIdFromString($row['WEB_ID'], 'resource/person/'), + $this->getOsidIdFromString($row['WEB_ID'], 'resource.person.'), $row['SYVINST_LAST_NAME'], $row['SYVINST_FIRST_NAME'] ); @@ -425,19 +425,19 @@ private function getBuildingResource(osid_id_Id $resourceId) $parameters = array_merge( [ - ':code' => $this->getDatabaseIdString($resourceId, 'resource/place/building/'), + ':code' => $this->getDatabaseIdString($resourceId, 'resource.place.building.'), ], $this->getCatalogParameters()); self::$getBuildingResource_stmt->execute($parameters); $row = self::$getBuildingResource_stmt->fetch(PDO::FETCH_ASSOC); self::$getBuildingResource_stmt->closeCursor(); - if (!$row['STVBLDG_CODE']) { - throw new osid_NotFoundException('Could not find a resource matching the building code '.$this->getDatabaseIdString($resourceId, 'resource/place/building/').'.'); + if (!$row || !$row['STVBLDG_CODE']) { + throw new osid_NotFoundException('Could not find a resource matching the building code '.$this->getDatabaseIdString($resourceId, 'resource.place.building.').'.'); } return new banner_resource_Resource_Building( - $this->getOsidIdFromString($row['STVBLDG_CODE'], 'resource/place/building/'), + $this->getOsidIdFromString($row['STVBLDG_CODE'], 'resource.place.building.'), $row['STVBLDG_DESC'], $row['STVBLDG_CODE'] ); @@ -486,7 +486,7 @@ private function getBuildingResources() $resources = []; while ($row = self::$getBuildingResources_stmt->fetch(PDO::FETCH_ASSOC)) { $resources[] = new banner_resource_Resource_Building( - $this->getOsidIdFromString($row['STVBLDG_CODE'], 'resource/place/building/'), + $this->getOsidIdFromString($row['STVBLDG_CODE'], 'resource.place.building.'), $row['STVBLDG_DESC'], $row['STVBLDG_CODE'] ); @@ -537,8 +537,8 @@ private function getRoomResource(osid_id_Id $resourceId) self::$getRoomResource_stmt = $this->manager->getDB()->prepare($query); } - $roomString = $this->getDatabaseIdString($resourceId, 'resource/place/room/'); - if (!preg_match('#^([a-z0-9_-]+)/(.+)$#i', $roomString, $matches)) { + $roomString = $this->getDatabaseIdString($resourceId, 'resource.place.room.'); + if (!preg_match('#^([a-z0-9_-]+)\.(.+)$#i', $roomString, $matches)) { throw new osid_NotFoundException("Room string '$roomString' doesn't match."); } @@ -552,12 +552,12 @@ private function getRoomResource(osid_id_Id $resourceId) $row = self::$getRoomResource_stmt->fetch(PDO::FETCH_ASSOC); self::$getRoomResource_stmt->closeCursor(); - if (!$row['STVBLDG_CODE']) { - throw new osid_NotFoundException('Could not find a resource matching the room code '.$this->getDatabaseIdString($resourceId, 'resource/place/room/').'.'); + if (!$row || !$row['STVBLDG_CODE']) { + throw new osid_NotFoundException('Could not find a resource matching the room code '.$this->getDatabaseIdString($resourceId, 'resource.place.room.').'.'); } return new banner_resource_Resource_Room( - $this->getOsidIdFromString($row['STVBLDG_CODE'].'/'.$row['SSRMEET_ROOM_CODE'], 'resource/place/room/'), + $this->getOsidIdFromString($row['STVBLDG_CODE'].'.'.$row['SSRMEET_ROOM_CODE'], 'resource.place.room.'), $row['STVBLDG_DESC'], $row['STVBLDG_CODE'], $row['SSRMEET_ROOM_CODE'] @@ -610,7 +610,7 @@ private function getRoomResources() $resources = []; while ($row = self::$getRoomResources_stmt->fetch(PDO::FETCH_ASSOC)) { $resources[] = new banner_resource_Resource_Room( - $this->getOsidIdFromString($row['STVBLDG_CODE'].'/'.$row['SSRMEET_ROOM_CODE'], 'resource/place/room/'), + $this->getOsidIdFromString($row['STVBLDG_CODE'].'.'.$row['SSRMEET_ROOM_CODE'], 'resource.place.room.'), $row['STVBLDG_DESC'], $row['STVBLDG_CODE'], $row['SSRMEET_ROOM_CODE'] @@ -649,22 +649,22 @@ private function getCampusResource(osid_id_Id $resourceId) $parameters = array_merge( [ - ':code' => $this->getDatabaseIdString($resourceId, 'resource/place/campus/'), + ':code' => $this->getDatabaseIdString($resourceId, 'resource.place.campus.'), ], $this->getCatalogParameters()); self::$getCampusResource_stmt->execute($parameters); $row = self::$getCampusResource_stmt->fetch(PDO::FETCH_ASSOC); self::$getCampusResource_stmt->closeCursor(); - if (!$row['STVCAMP_CODE']) { - throw new osid_NotFoundException('Could not find a resource matching the campus code '.$this->getDatabaseIdString($resourceId, 'resource/place/campus/').'.'); + if (!$row || !$row['STVCAMP_CODE']) { + throw new osid_NotFoundException('Could not find a resource matching the campus code '.$this->getDatabaseIdString($resourceId, 'resource.place.campus.').'.'); } return new banner_resource_Resource_Place( - $this->getOsidIdFromString($row['STVCAMP_CODE'], 'resource/place/campus/'), + $this->getOsidIdFromString($row['STVCAMP_CODE'], 'resource.place.campus.'), $row['STVCAMP_DESC'], '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/campus') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.campus') ); } @@ -697,10 +697,10 @@ private function getCampusResources() $resources = []; while ($row = self::$getCampusResources_stmt->fetch(PDO::FETCH_ASSOC)) { $resources[] = new banner_resource_Resource_Place( - $this->getOsidIdFromString($row['STVCAMP_CODE'], 'resource/place/campus/'), + $this->getOsidIdFromString($row['STVCAMP_CODE'], 'resource.place.campus.'), $row['STVCAMP_DESC'], '', - new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/campus') + new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.campus') ); } self::$getCampusResources_stmt->closeCursor(); @@ -783,15 +783,15 @@ public function getResourcesByGenusType(osid_type_Type $resourceGenusType) return new phpkit_EmptyList('osid_resource_ResourceList'); } switch ($resourceGenusType->getIdentifier()) { - case 'genera:resource/person': + case 'genera:resource.person': return $this->getPersonResources(); - case 'genera:resource/place/campus': + case 'genera:resource.place.campus': return $this->getCampusResources(); - case 'genera:resource/place/building': + case 'genera:resource.place.building': return $this->getBuildingResources(); - case 'genera:resource/place/room': + case 'genera:resource.place.room': return $this->getRoomResources(); - // case 'genera:resource/place': + // case 'genera:resource.place': // return $this->getPlaceResources(); default: return new phpkit_EmptyList('osid_resource_ResourceList'); @@ -827,7 +827,7 @@ public function getResourcesByParentGenusType(osid_type_Type $resourceGenusType) return new phpkit_EmptyList('osid_resource_ResourceList'); } - if ('genera:resource/place' == $resourceGenusType->getIdentifier()) { + if ('genera:resource.place' == $resourceGenusType->getIdentifier()) { $resourceList = new phpkit_CombinedList('osid_resource_ResourceList'); $resourceList->addList($this->getCampusResources()); $resourceList->addList($this->getBuildingResources()); diff --git a/application/library/banner/resource/Resource/Person.php b/application/library/banner/resource/Resource/Person.php index 017b5615..25770527 100755 --- a/application/library/banner/resource/Resource/Person.php +++ b/application/library/banner/resource/Resource/Person.php @@ -77,7 +77,7 @@ public function __construct(osid_id_Id $id, $surname, $givenName, $middleNames = $this->addRecordType($this->namesType); - $this->setGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/person')); + $this->setGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.person')); } /** diff --git a/application/library/banner/resource/Resource/Room.php b/application/library/banner/resource/Resource/Room.php index cd372449..0f7c259c 100644 --- a/application/library/banner/resource/Resource/Room.php +++ b/application/library/banner/resource/Resource/Room.php @@ -32,7 +32,7 @@ class banner_resource_Resource_Room extends banner_resource_Resource_Building public function __construct(osid_id_Id $id, $buildingDisplayName, $buildingCode, $room) { parent::__construct($id, $buildingDisplayName, $buildingCode); - $this->setGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/room')); + $this->setGenusType(new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.room')); $this->setDisplayName($buildingDisplayName.' '.$room); $this->setDescription($buildingCode.' '.$room); $this->room = $room; diff --git a/application/library/banner/resource/ResourceManager.php b/application/library/banner/resource/ResourceManager.php index 9ea7fa4e..3baf4f53 100755 --- a/application/library/banner/resource/ResourceManager.php +++ b/application/library/banner/resource/ResourceManager.php @@ -78,7 +78,7 @@ public function getIdAuthority() */ public function getCombinedBinId() { - return new phpkit_id_Id($this->getIdAuthority(), 'urn', 'resource/all'); + return new phpkit_id_Id($this->getIdAuthority(), 'urn', 'resource.all'); } /********************************************************* @@ -120,17 +120,17 @@ public function initialize(osid_OsidRuntimeManager $runtime) try { $dsn = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/pdo_dsn'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.pdo_dsn'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/String')); $username = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/pdo_username'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.pdo_username'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/String')); $password = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/pdo_password'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.pdo_password'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/String')); } catch (osid_NotFoundException $e) { throw new osid_ConfigurationErrorException($e->getMessage(), $e->getCode()); @@ -139,7 +139,7 @@ public function initialize(osid_OsidRuntimeManager $runtime) try { $debug = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/pdo_count_queries'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.pdo_count_queries'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/Boolean')); } catch (osid_ConfigurationErrorException $e) { $debug = false; @@ -158,10 +158,10 @@ public function initialize(osid_OsidRuntimeManager $runtime) try { $this->idAuthority = phpkit_configuration_ConfigUtil::getSingleValuedValue( $runtime->getConfiguration(), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course/id_authority'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:config:banner_course.id_authority'), new phpkit_type_Type('urn', 'middlebury.edu', 'Primitives/String')); if (!strlen($this->idAuthority)) { - throw new osid_ConfigurationErrorException('urn:inet:middlebury.edu:config:banner_course/id_authority must be specified.'); + throw new osid_ConfigurationErrorException('urn:inet:middlebury.edu:config:banner_course.id_authority must be specified.'); } } catch (osid_NotFoundException $e) { throw new osid_ConfigurationErrorException($e->getMessage(), $e->getCode()); diff --git a/application/resources/Auth/Action/Helper/Auth.php b/application/resources/Auth/Action/Helper/Auth.php deleted file mode 100755 index 13655d52..00000000 --- a/application/resources/Auth/Action/Helper/Auth.php +++ /dev/null @@ -1,124 +0,0 @@ -config; - if (!isset($config->authType) || !strlen(trim($config->authType))) { - $authType = 'NullAuth'; - } else { - $authType = $config->authType; - } - - try { - // Use a masquerade auth helper if enabled and in use. - try { - $masqueradeHelper = $this->getMasqueradeHelper(); - if ($masqueradeHelper->isAuthenticated()) { - $this->authHelper = $masqueradeHelper; - $this->initialized = true; - - return; - } - } catch (Exception $e) { - } - - // Use our standard Auth helper. - $this->authHelper = $this->getAuthHelperInstance($authType); - $this->initialized = true; - } catch (Zend_Controller_Action_Exception $e) { - throw new Exception("Can not use authentication type '".$authType."'. ".$e->getMessage()); - } - } - - /** - * Answer an instance of the AuthHelper for the authType specified. - * - * @param string $authType - * - * @return Auth_Action_Helper_AuthInterface - */ - private function getAuthHelperInstance($authType) - { - $authHelper = Zend_Controller_Action_HelperBroker::getStaticHelper($authType); - if (!($authHelper instanceof Auth_Action_Helper_AuthInterface)) { - $class = $authHelper::class; - throw new Exception("Auth helper for auth-type '$authType' has class '$class' which does not implement Auth_Action_Helper_AuthInterface."); - } - - return $authHelper; - } - - /** - * Answer the configured Authentication Helper. - * - * @return Zend_Controller_Action_Helper_Interface - * - * @since 6/14/10 - */ - public function getHelper() - { - if (!$this->initialized) { - $this->init(); - } - - if (null === $this->authHelper) { - throw new Exception("No authentication helper is available. Maybe one wasn't configured.", 450); - } - - return $this->authHelper; - } - - /** - * Answer the configured Authentication Helper. - * - * @return void - * - * @since 6/14/10 - */ - public function direct() - { - return $this->getHelper(); - } - - /** - * Answer the configured Masquerade helper if configured. - * - * Throws an exception if no masquerade helper is available. - * - * @return Auth_Action_Helper_MasqueradeInterface - */ - public function getMasqueradeHelper() - { - $config = Zend_Registry::getInstance()->config; - if (!empty($config->masquerade->enabled) && !empty($config->masquerade->type)) { - return $this->getAuthHelperInstance($config->masquerade->type); - } - throw new Exception('No masquerade auth helper enabled.'); - } -} diff --git a/application/resources/Auth/Action/Helper/AuthInterface.php b/application/resources/Auth/Action/Helper/AuthInterface.php deleted file mode 100755 index fa4d6cf7..00000000 --- a/application/resources/Auth/Action/Helper/AuthInterface.php +++ /dev/null @@ -1,82 +0,0 @@ -config; - - if ($config->cas->debug_file) { - phpCAS::setDebug($config->cas->debug_file); - } - - if (empty($config->cas->host)) { - throw new InvalidArgumentException('cas.host must be configured.'); - } - if (empty($config->cas->port)) { - throw new InvalidArgumentException('cas.port must be configured.'); - } - if (empty($config->cas->path)) { - throw new InvalidArgumentException('cas.path must be configured.'); - } - if (empty($config->cas->service_urls)) { - throw new InvalidArgumentException('cas.service_urls[] must be configured.'); - } - - phpCAS::client( - CAS_VERSION_2_0, - $config->cas->host, - (int) $config->cas->port, - $config->cas->path, - $config->cas->service_urls->toArray(), - false); - - if ($config->cas->server_cert) { - phpCAS::setCasServerCACert($config->cas->server_cert); - } else { - phpCAS::setNoCasServerValidation(); - } - - self::$phpcasInitialized = true; - } - } -} diff --git a/application/resources/Auth/Action/Helper/CasDirectory.php b/application/resources/Auth/Action/Helper/CasDirectory.php deleted file mode 100755 index d8388f52..00000000 --- a/application/resources/Auth/Action/Helper/CasDirectory.php +++ /dev/null @@ -1,231 +0,0 @@ -isAuthenticated()) { - throw new Exception('No user authenticated.'); - } - - return $_SESSION['masquerade.CasDirectory']['id']; - } - - /** - * Answer a name for the user if a user is currently authenticated or throw an Exception - * if isAuthenticated is false. - * - * @return string - */ - public function getUserDisplayName() - { - if (!$this->isAuthenticated()) { - throw new Exception('No user authenticated.'); - } - - return $_SESSION['masquerade.CasDirectory']['name']; - } - - /** - * Answer an email address for the user if a user is currently authenticated or throw an Exception - * if isAuthenticated is false. - * - * @return string - */ - public function getUserEmail() - { - if (!$this->isAuthenticated()) { - throw new Exception('No user authenticated.'); - } - - return $_SESSION['masquerade.CasDirectory']['email']; - } - - /** - * Answer an array of groups for the user if a user is currently authenticated or throw an Exception - * if isAuthenticated is false. - * - * @return array - */ - public function getUserGroups() - { - if (!$this->isAuthenticated()) { - throw new Exception('No user authenticated.'); - } - - return $_SESSION['masquerade.CasDirectory']['memberof']; - } - - /** - * Change to a different user account. Clients are responsible for checking that - * the current user is authorized before calling this method. Clients are also - * responsible for logging. - * - * Throws an exception if unsupported. - * - * @param string $userId - * - * @return void - */ - public function changeUser($userId) - { - $config = Zend_Registry::getInstance()->config; - if (empty($config->masquerade->CasDirectory->url)) { - throw new Exception('No masquerade.CasDirectory.url configured.'); - } - - $extraParams = []; - if (!empty($config->masquerade->CasDirectory->extra_params)) { - parse_str($config->masquerade->CasDirectory->extra_params, $extraParams); - } - - $params = array_merge([ - 'action' => 'get_user', - 'id' => $userId, - ], $extraParams); - $url = $config->masquerade->CasDirectory->url.'?'.http_build_query($params); - - $headers = ['User-Agent: Drupal CAS-MM-Sync']; - if (!empty($config->masquerade->CasDirectory->headers)) { - foreach ($config->masquerade->CasDirectory->headers as $header) { - if (!preg_match('/.+:.+/', $header)) { - throw new Exception('Each element of masquerade.CasDirectory.headers[] must be a "key: value" string.'); - } - $headers[] = $header; - } - } - foreach ($headers as $k => $v) { - $headers[$k] = rtrim($v)."\r\n"; - } - $opts = [ - 'http' => [ - 'header' => implode('', $headers), - ], - ]; - $context = stream_context_create($opts); - $xmlstring = file_get_contents($url, false, $context); - if (empty($xmlstring)) { - throw new Exception('Could not load user information.'); - } - $doc = new DOMDocument(); - if (!$doc->loadXML($xmlstring)) { - throw new Exception('Could not parse user information.'); - } - - $xpath = new DOMXPath($doc); - $xpath->registerNamespace('cas', 'http://www.yale.edu/tp/cas'); - - $id = $xpath->query('/cas:results/cas:entry/cas:user')->item(0)->nodeValue; - if ($id == $userId) { - $_SESSION['masquerade.CasDirectory'] = [ - 'id' => $userId, - ]; - } else { - throw new Exception("Id found didn't match query."); - } - - $name = ''; - $elements = $xpath->query('/cas:results/cas:entry/cas:attribute[@name="FirstName"]'); - if ($elements->length) { - $name .= $elements->item(0)->getAttribute('value'); - } - $name .= ' '; - $elements = $xpath->query('/cas:results/cas:entry/cas:attribute[@name="LastName"]'); - if ($elements->length) { - $name .= $elements->item(0)->getAttribute('value'); - } - if (strlen(trim($name))) { - $_SESSION['masquerade.CasDirectory']['name'] = $name; - } else { - $_SESSION['masquerade.CasDirectory']['name'] = 'name unknown'; - } - - $elements = $xpath->query('/cas:results/cas:entry/cas:attribute[@name="EMail"]'); - if ($elements->length) { - $_SESSION['masquerade.CasDirectory']['email'] = $elements->item(0)->getAttribute('value'); - } else { - $_SESSION['masquerade.CasDirectory']['email'] = ''; - } - - $elements = $xpath->query('/cas:results/cas:entry/cas:attribute[@name="MemberOf"]'); - $_SESSION['masquerade.CasDirectory']['memberof'] = []; - foreach ($elements as $element) { - $_SESSION['masquerade.CasDirectory']['memberof'][] = $element->getAttribute('value'); - } - } -} diff --git a/application/resources/Auth/Action/Helper/MasqueradeInterface.php b/application/resources/Auth/Action/Helper/MasqueradeInterface.php deleted file mode 100755 index 3c52b358..00000000 --- a/application/resources/Auth/Action/Helper/MasqueradeInterface.php +++ /dev/null @@ -1,31 +0,0 @@ -isAuthenticated()) { - throw new Exception('No user authenticated.'); - } - - return $_SESSION['masquerade.MicrosoftGraph']['id']; - } - - /** - * Answer a name for the user if a user is currently authenticated or throw an Exception - * if isAuthenticated is false. - * - * @return string - */ - public function getUserDisplayName() - { - if (!$this->isAuthenticated()) { - throw new Exception('No user authenticated.'); - } - - return $_SESSION['masquerade.MicrosoftGraph']['name']; - } - - /** - * Answer an email address for the user if a user is currently authenticated or throw an Exception - * if isAuthenticated is false. - * - * @return string - */ - public function getUserEmail() - { - if (!$this->isAuthenticated()) { - throw new Exception('No user authenticated.'); - } - - return $_SESSION['masquerade.MicrosoftGraph']['email']; - } - - /** - * Answer an array of groups for the user if a user is currently authenticated or throw an Exception - * if isAuthenticated is false. - * - * @return array - */ - public function getUserGroups() - { - if (!$this->isAuthenticated()) { - throw new Exception('No user authenticated.'); - } - - return $_SESSION['masquerade.MicrosoftGraph']['memberof']; - } - - /** - * Change to a different user account. Clients are responsible for checking that - * the current user is authorized before calling this method. Clients are also - * responsible for logging. - * - * Throws an exception if unsupported. - * - * @param string $userId - * - * @return void - */ - public function changeUser($userId) - { - $user = $this->fetchUserForLogin($userId); - - $properties = $this->extractUserInfo($user); - $_SESSION['masquerade.MicrosoftGraph'] = [ - 'id' => $properties['user_login'], - ]; - - $name = ''; - if (!empty($properties['first_name'])) { - $name .= $properties['first_name'].' '; - } - if (!empty($properties['last_name'])) { - $name .= $properties['last_name']; - } - if (strlen(trim($name))) { - $_SESSION['masquerade.MicrosoftGraph']['name'] = $name; - } else { - $_SESSION['masquerade.MicrosoftGraph']['name'] = 'name unknown'; - } - - if (!empty($properties['user_email'])) { - $_SESSION['masquerade.MicrosoftGraph']['email'] = $properties['user_email']; - } else { - $_SESSION['masquerade.MicrosoftGraph']['email'] = ''; - } - - $_SESSION['masquerade.MicrosoftGraph']['memberof'] = []; - } - - /** - * Answer our already-configured O365 API. - * - * @return Microsoft\Graph\Graph - * The Graph object - */ - protected function getGraph() - { - if (empty($this->graph)) { - $this->graph = new GraphServiceClient( - $this->getTokenRequestContext() - ); - } - - return $this->graph; - } - - /** - * Get an O365 Access token context. - */ - protected function getTokenRequestContext() - { - $config = Zend_Registry::getInstance()->config; - if (empty($config->masquerade->MicrosoftGraph->tenantId)) { - throw new Exception('No masquerade.MicrosoftGraph.tenantId configured.'); - } - if (empty($config->masquerade->MicrosoftGraph->appId)) { - throw new Exception('No masquerade.MicrosoftGraph.appId configured.'); - } - if (empty($config->masquerade->MicrosoftGraph->appSecret)) { - throw new Exception('No masquerade.MicrosoftGraph.appSecret configured.'); - } - - return new ClientCredentialContext( - $config->masquerade->MicrosoftGraph->tenantId, - $config->masquerade->MicrosoftGraph->appId, - $config->masquerade->MicrosoftGraph->appSecret, - ); - } - - /** - * Answer an MS Graph User object matching a login string. - * - * @param string $login - * - * @return User - */ - protected function fetchUserForLogin($login) - { - // First search by the primary unique ID. - try { - return $this->fetchUserByProperty($this->getPrimaryUniqueIdProperty(), $login); - } catch (Exception $e) { - // If we didn't find an account based on the primary id, try a secondary ID if configured. - if (404 == $e->getCode() && !empty($this->getSecondaryUniqueIdProperty())) { - return $this->fetchUserByProperty($this->getSecondaryUniqueIdProperty(), $login); - } else { - // If we don't support secondary ids or get another error, just throw it. - throw $e; - } - } - } - - /** - * Answer an MS Graph User object matching a login string. - * - * @param string $property - * The MSGraph property to match - * @param string $value - * The user-id value to match - * - * @return User - */ - protected function fetchUserByProperty($property, $value) - { - $requestConfig = new UsersRequestBuilderGetRequestConfiguration( - queryParameters: UsersRequestBuilderGetRequestConfiguration::createQueryParameters( - filter: $property." eq '".urlencode($value)."'", - select: $this->getUserGraphProperties(), - orderby: ['displayName'], - top: 10, - count: true - ), - headers: ['ConsistencyLevel' => 'eventual'] - ); - $result = $this->getGraph()->users()->get($requestConfig)->wait(); - $users = []; - foreach ($result->getValue() as $user) { - $users[] = $user; - } - if (count($users) < 1) { - throw new Exception('Could not get user. Expecting 1 entry, found '.count($users).' in AzureAD.', 404); - } elseif (1 === count($users)) { - return $users[0]; - } else { - return $this->getPrimaryAccountFromUserList($users); - } - } - - protected function getUserGraphProperties() - { - return [ - 'id', - 'displayName', - 'mail', - 'givenName', - 'surname', - 'userType', - $this->getPrimaryUniqueIdProperty(), - $this->getSecondaryUniqueIdProperty(), - ]; - } - - /** - * Filter a list of MS Graph User objects to find a single "primary" one. - * - * @param array $users - * The MSGraph User list - * - * @return User - * A single user if one can be determined to be "primary" - */ - protected function getPrimaryAccountFromUserList(array $users) - { - // Give priority to users with the type "Member" over "Guest" or other - // account types. - $memberUsers = []; - foreach ($users as $user) { - if ('member' == strtolower($user->getUserType())) { - $memberUsers[] = $user; - } - } - // If we only have a single user with type "Member", then return that user. - if (1 === count($memberUsers)) { - return $memberUsers[0]; - } - - // Not sure what to do if we have multiple "Member" accounts with the same - // ID or multiple "Guest" accounts with the same ID. - // Perhaps we could do some email filtering or other logic, but hopefully - // this case won't come up. - ob_start(); - foreach ($users as $user) { - $properties = $user->getProperties(); - echo "\n\t


"; - echo "\n\t\t
Primary ID property (".$this->getPrimaryUniqueIdProperty().'):
'.(empty($properties[$this->getPrimaryUniqueIdProperty()]) ? '' : $properties[$this->getPrimaryUniqueIdProperty()]).'
'; - echo "\n\t\t
Secondary ID property (".$this->getSecondaryUniqueIdProperty().'):
'.(empty($properties[$this->getSecondaryUniqueIdProperty()]) ? '' : $properties[$this->getSecondaryUniqueIdProperty()]).'
'; - echo "\n\t\t
User Type:
".$user->getUserType().'
'; - echo "\n\t\t
Mapped username in WordPress:
".$this->getLoginForGraphUser($user).'
'; - echo "\n\t\t
UserPrincipalName:
".$user->getUserPrincipalName().'
'; - echo "\n\t\t
Display Name:
".$user->getDisplayName().'
'; - echo "\n\t\t
Mail:
".$user->getMail().'
'; - echo "\n\t
"; - } - throw new Exception('Could not get single user for ID. Expecting 1 entry, found '.count($users)." users in AzureAD that share an ID and User Type:\n".ob_get_clean()); - } - - /** - * Answer the primary unique-id property key. - * - * @return string - * The property in MS Graph that holds the primary unique-id - */ - protected function getPrimaryUniqueIdProperty() - { - static $primaryUserIdProperty; - if (!isset($primaryUserIdProperty)) { - $config = Zend_Registry::getInstance()->config; - if (empty($config->masquerade->MicrosoftGraph->primaryUserIdProperty)) { - throw new Exception('No masquerade.MicrosoftGraph.primaryUserIdProperty configured.'); - } - $primaryUserIdProperty = $config->masquerade->MicrosoftGraph->primaryUserIdProperty; - } - - return $primaryUserIdProperty; - } - - /** - * Answer the secondary unique-id property key. - * - * @return string - * The property in MS Graph that holds a secondary/fall-back unique-id - */ - protected function getSecondaryUniqueIdProperty() - { - static $secondaryUserIdProperty; - if (!isset($secondaryUserIdProperty)) { - $config = Zend_Registry::getInstance()->config; - if (empty($config->masquerade->MicrosoftGraph->secondaryUserIdProperty)) { - throw new Exception('No masquerade.MicrosoftGraph.secondaryUserIdProperty configured.'); - } - $secondaryUserIdProperty = $config->masquerade->MicrosoftGraph->secondaryUserIdProperty; - } - - return $secondaryUserIdProperty; - } - - /** - * Answer the user info matching an MS Graph User object. - * - * @return array - */ - protected function extractUserInfo(User $user) - { - $info = []; - - $info['user_login'] = $this->getLoginForGraphUser($user); - $info['user_email'] = $user->getMail(); - - preg_match('/^(.+)@(.+)$/', $info['user_email'], $matches); - $emailUser = $matches[1]; - $emailDomain = $matches[2]; - - $info['user_nicename'] = $emailUser; - $info['nickname'] = $user->getGivenName(); - $info['first_name'] = $user->getGivenName(); - $info['last_name'] = $user->getSurname(); - $info['display_name'] = trim($user->getGivenName().' '.$user->getSurname()); - if (empty($info['display_name'])) { - $info['display_name'] = trim($user->getDisplayName()); - } - if (empty($info['display_name'])) { - $info['display_name'] = $emailUser; - } - if (empty($info['nickname'])) { - $info['nickname'] = $emailUser; - } - - return $info; - } - - /** - * Answer the user login matching an MS Graph User object. - * - * @return string - */ - protected function getLoginForGraphUser(User $user) - { - // Primary Unique ID. - $id = $this->getUserProperty($user, $this->getPrimaryUniqueIdProperty()); - if (!empty($id)) { - return $id; - } - // Secondary/Fallback unique ID. - else { - $id = $this->getUserProperty($user, $this->getSecondaryUniqueIdProperty()); - if (!empty($id)) { - return $id; - } else { - throw new Exception('No id could be extracted for user '.$user->getUserPrincipalName()); - } - } - } - - /** - * Answer a property from a User object. - * - * @param User $user - * The user object - * @param string $property - * The property name to fetch - * - * @return mixed - * The property or null - */ - protected function getUserProperty(User $user, $property) - { - $getterMethod = 'get'.ucfirst($property); - if (method_exists($user, $getterMethod)) { - return $user->$getterMethod(); - } else { - $additionalData = $user->getAdditionalData(); - if (!isset($additionalData[$property])) { - throw new Exception("No '$property' could be found for user ".$user->getUserPrincipalName().' in '.print_r($addtionalData, true)); - } - - return $additionalData[$property]; - } - } -} diff --git a/application/resources/Auth/Action/Helper/NullAuth.php b/application/resources/Auth/Action/Helper/NullAuth.php deleted file mode 100755 index fea60a64..00000000 --- a/application/resources/Auth/Action/Helper/NullAuth.php +++ /dev/null @@ -1,117 +0,0 @@ -auth)) { - require_once BASE_PATH.'/vendor/onelogin/php-saml/_toolkit_loader.php'; - $this->auth = new SamlAuth($this->getSamlConfig()); - } - } - - /** - * Answer the SAML configuration. - * - * @return array - */ - protected function getSamlConfig() - { - $config = Zend_Registry::getInstance()->config; - - return [ - // If 'strict' is True, then the PHP Toolkit will reject unsigned - // or unencrypted messages if it expects them to be signed or encrypted. - // Also it will reject the messages if the SAML standard is not strictly - // followed: Destination, NameId, Conditions ... are validated too. - 'strict' => true, - - // Enable debug mode (to print errors). - 'debug' => true, - - // Set a BaseURL to be used instead of try to guess - // the BaseURL of the view that process the SAML Message. - // Ex http://sp.example.com/ - // http://example.com/sp/ - // 'baseurl' => rtrim($this->getAbsoluteUrl(), '/'), - - // Service Provider Data that we are deploying. - 'sp' => [ - // Identifier of the SP entity (must be a URI) - 'entityId' => $this->getAbsoluteUrl(), - // Specifies info about where and how the message MUST be - // returned to the requester, in this case our SP. - 'assertionConsumerService' => [ - // URL Location where the from the IdP will be returned - 'url' => $this->getAbsoluteUrl('/auth/login'), - // SAML protocol binding to be used when returning the - // message. SAML Toolkit supports this endpoint for the - // HTTP-POST binding only. - 'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', - ], - // Specifies info about where and how the message MUST be - // returned to the requester, in this case our SP. - 'singleLogoutService' => [ - // URL Location where the from the IdP will be returned - 'url' => $this->getAbsoluteUrl('/auth/logout'), - // SAML protocol binding to be used when returning the - // message. SAML Toolkit supports the HTTP-Redirect binding - // only for this endpoint. - 'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', - ], - /* - * Key rollover - * If you plan to update the SP x509cert and privateKey - * you can define here the new x509cert and it will be - * published on the SP metadata so Identity Providers can - * read them and get ready for rollover. - */ - // 'x509certNew' => '', - ], - - // Identity Provider Data that we want connected with our SP. - 'idp' => [ - // Identifier of the IdP entity (must be a URI) - 'entityId' => $config->saml->idp->entityId, - // SSO endpoint info of the IdP. (Authentication Request protocol) - 'singleSignOnService' => [ - // URL Target of the IdP where the Authentication Request Message - // will be sent. - 'url' => $config->saml->idp->singleSignOnService->url, - // SAML protocol binding to be used when returning the - // message. SAML Toolkit supports the HTTP-Redirect binding - // only for this endpoint. - 'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', - ], - // SLO endpoint info of the IdP. - 'singleLogoutService' => [ - // URL Location of the IdP where SLO Request will be sent. - 'url' => $config->saml->idp->singleLogoutService->url, - // URL location of the IdP where the SP will send the SLO Response (ResponseLocation) - // if not set, url for the SLO Request will be used - 'responseUrl' => '', - // SAML protocol binding to be used when returning the - // message. SAML Toolkit supports the HTTP-Redirect binding - // only for this endpoint. - 'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', - ], - // Public x509 certificate of the IdP - 'x509cert' => $config->saml->idp->x509cert, - /* - * Instead of use the whole x509cert you can use a fingerprint in order to - * validate a SAMLResponse, but we don't recommend to use that - * method on production since is exploitable by a collision attack. - * (openssl x509 -noout -fingerprint -in "idp.crt" to generate it, - * or add for example the -sha256 , -sha384 or -sha512 parameter) - * - * If a fingerprint is provided, then the certFingerprintAlgorithm is required in order to - * let the toolkit know which algorithm was used. Possible values: sha1, sha256, sha384 or sha512 - * 'sha1' is the default value. - * - * Notice that if you want to validate any SAML Message sent by the HTTP-Redirect binding, you - * will need to provide the whole x509cert. - */ - // 'certFingerprint' => '', - // 'certFingerprintAlgorithm' => 'sha1', - - /* In some scenarios the IdP uses different certificates for - * signing/encryption, or is under key rollover phase and - * more than one certificate is published on IdP metadata. - * In order to handle that the toolkit offers that parameter. - * (when used, 'x509cert' and 'certFingerprint' values are - * ignored). - */ - // 'x509certMulti' => [ - // 'signing' => [ - // 0 => '', - // ], - // 'encryption' => [ - // 0 => '', - // ], - ], - - // Security settings - 'security' => [ - // Authentication context. - // Set to false and no AuthContext will be sent in the AuthNRequest. - // Set true or don't present this parameter and you will get an AuthContext 'exact' 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'. - // Set an array with the possible auth context values: array('urn:oasis:names:tc:SAML:2.0:ac:classes:Password', 'urn:oasis:names:tc:SAML:2.0:ac:classes:X509'). - 'requestedAuthnContext' => false, - ], - ]; - } - - protected function getAbsoluteUrl($path = '/') - { - return 'https://'.$_SERVER['HTTP_HOST'].rtrim($this->getFrontController()->getBaseUrl(), '/').'/'.ltrim($path, '/'); - } - - /** - * Answer true if this authentication method allows login. - * - * @return bool - */ - public function isAuthenticationEnabled() - { - return true; - } - - /** - * Log in. Throw an exception if isAuthenticationEnabled is false. - * - * @param optional string $returnUrl A url to return to after successful login - * - * @return bool TRUE on successful login - */ - public function login($returnUrl = null) - { - $this->init(); - - // Trigger SSO login. - if ('POST' != $_SERVER['REQUEST_METHOD']) { - $this->auth->login($returnUrl); - - return true; - } - // Process SSO response. - else { - if (isset($_SESSION) && isset($_SESSION['AuthNRequestID'])) { - $requestID = $_SESSION['AuthNRequestID']; - } else { - $requestID = null; - } - - $this->auth->processResponse($requestID); - unset($_SESSION['AuthNRequestID']); - - $errors = $this->auth->getErrors(); - if (!empty($errors)) { - throw new Exception('Authentication failed with these errors: '.implode(', ', $errors)); - } - - if (!$this->auth->isAuthenticated()) { - throw new Exception('Authentication failed.'); - } - - $_SESSION['SAML_AUTH_NAMEID'] = $this->auth->getNameId(); - $_SESSION['SAML_AUTH_ATTRIBUTES'] = $this->auth->getAttributes(); - // Redirect to the page we started the Login flow from. - if (isset($_REQUEST['RelayState'])) { - $this->auth->redirectTo(); - } - - return true; - } - } - - /** - * Log out. Throw an exception if isAuthenticationEnabled is false. - * - * @param optional string $returnUrl A url to return to after successful logout - * - * @return void - */ - public function logout($returnUrl = null) - { - unset($_SESSION['SAML_AUTH_NAMEID']); - unset($_SESSION['SAML_AUTH_ATTRIBUTES']); - $this->init(); - $this->auth->logout($returnUrl); - } - - /** - * Answer true if a user is currently authenticated. - * - * @return bool - */ - public function isAuthenticated() - { - if (!empty($_SESSION['SAML_AUTH_NAMEID'])) { - return true; - } - - $this->init(); - - return $this->auth->isAuthenticated(); - } - - /** - * Answer the user id if a user is currently authenticated or throw an Exception - * if isAuthenticated is false. - * - * @return string - */ - public function getUserId() - { - if (!empty($_SESSION['SAML_AUTH_NAMEID'])) { - return $_SESSION['SAML_AUTH_NAMEID']; - } - - if ($this->isAuthenticated()) { - return $this->auth->getNameId(); - } else { - throw new Exception('No user is authenticated, cannot provide a user id.'); - } - } - - /** - * Answer a name for the user if a user is currently authenticated or throw an Exception - * if isAuthenticated is false. - * - * @return string - */ - public function getUserDisplayName() - { - return trim($this->getAttribute('http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname')).' '. - trim($this->getAttribute('http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname')); - } - - /** - * Answer an email address for the user if a user is currently authenticated or throw an Exception - * if isAuthenticated is false. - * - * @return string - */ - public function getUserEmail() - { - return trim($this->getAttribute('http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress')); - } - - /** - * Answer an array of groups for the user if a user is currently authenticated or throw an Exception - * if isAuthenticated is false. - * - * @return array - */ - public function getUserGroups() - { - return $this->getAttribute('http://schemas.microsoft.com/ws/2008/06/identity/claims/groups', false); - } - - /** - * Answer an attribute from the SAML response. - * - * @param string $name - * The attribute name - * @param bool $singleValue - * Return a single value from the attribute array rather than multiple - * - * @return string|array|null - * The attribute value - */ - protected function getAttribute($name, $singleValue = true) - { - // Prefer attributes stored in the session already. - if (!empty($_SESSION['SAML_AUTH_ATTRIBUTES'])) { - if (empty($_SESSION['SAML_AUTH_ATTRIBUTES'][$name])) { - return null; - } else { - if ($singleValue) { - if (isset($_SESSION['SAML_AUTH_ATTRIBUTES'][$name][0])) { - return $_SESSION['SAML_AUTH_ATTRIBUTES'][$name][0]; - } else { - return null; - } - } else { - return $_SESSION['SAML_AUTH_ATTRIBUTES'][$name]; - } - } - } - // Get the attributes from the current authentication response if - // available. - else { - if ($this->isAuthenticated()) { - return $this->auth->getAttribute($name); - } else { - throw new Exception("No user is authenticated, cannot provide a $name attribute."); - } - } - } -} diff --git a/application/resources/Catalog/Action/Helper/AbstractOsidIdentifier.php b/application/resources/Catalog/Action/Helper/AbstractOsidIdentifier.php deleted file mode 100755 index 5e25f935..00000000 --- a/application/resources/Catalog/Action/Helper/AbstractOsidIdentifier.php +++ /dev/null @@ -1,36 +0,0 @@ -config; - $authority = (string) $config->catalog->shorten_ids_for_authority; - if (strlen($authority)) { - self::$idAuthorityToShorten = $authority; - } else { - self::$idAuthorityToShorten = false; - } - } - - return self::$idAuthorityToShorten; - } -} diff --git a/application/resources/Catalog/Action/Helper/Bookmarks.php b/application/resources/Catalog/Action/Helper/Bookmarks.php deleted file mode 100755 index 3a7d3415..00000000 --- a/application/resources/Catalog/Action/Helper/Bookmarks.php +++ /dev/null @@ -1,38 +0,0 @@ -getHelper(); - $courseManager = Zend_Controller_Action_HelperBroker::getStaticHelper('Osid')->getCourseManager(); - - // Initialize our Model - if (!$auth->isAuthenticated()) { - throw new Exception('You must be logged in to perform this action.'); - } - - self::$bookmarks = new Bookmarks(Zend_Registry::get('db'), $auth->getUserId(), $courseManager); - } - - return self::$bookmarks; - } -} diff --git a/application/resources/Catalog/Action/Helper/Osid.php b/application/resources/Catalog/Action/Helper/Osid.php deleted file mode 100755 index c7f728a4..00000000 --- a/application/resources/Catalog/Action/Helper/Osid.php +++ /dev/null @@ -1,91 +0,0 @@ -getRuntimeManager(); - - $config = Zend_Registry::getInstance()->config; - if (!isset($config->osid->course_impl) || !strlen(trim($config->osid->course_impl))) { - $implClass = 'banner_course_CourseManager'; - } else { - $implClass = $config->osid->course_impl; - } - - self::$courseManager = $runtimeManager->getManager(osid_OSID::COURSE(), $implClass, '3.0.0'); - } - - return self::$courseManager; - } - - /** - * Answer the Runtime Manager. - * - * @return osid_OsidRuntimeManager - * - * @since 4/20/09 - */ - public function getRuntimeManager() - { - if (!isset(self::$runtimeManager)) { - self::$runtimeManager = new phpkit_AutoloadOsidRuntimeManager($this->getConfigPath()); - } - - return self::$runtimeManager; - } -} diff --git a/application/resources/Catalog/Action/Helper/OsidId.php b/application/resources/Catalog/Action/Helper/OsidId.php deleted file mode 100755 index 17f225f0..00000000 --- a/application/resources/Catalog/Action/Helper/OsidId.php +++ /dev/null @@ -1,52 +0,0 @@ -getIdAuthorityToShorten()) { - return new phpkit_id_Id($this->getIdAuthorityToShorten(), 'urn', $idString); - } else { - throw $e; - } - } - } - - /** - * Answer a string representation of an OSID id object. - * - * @return string - * - * @since 4/21/09 - */ - public function toString(osid_id_Id $id) - { - if ($this->getIdAuthorityToShorten() - && 'urn' == strtolower($id->getIdentifierNamespace()) - && strtolower($id->getAuthority()) == $this->getIdAuthorityToShorten()) { - return $id->getIdentifier(); - } else { - return phpkit_id_URNInetId::getInetURNString($id); - } - } -} diff --git a/application/resources/Catalog/Action/Helper/Topics.php b/application/resources/Catalog/Action/Helper/Topics.php deleted file mode 100755 index fe4a7394..00000000 --- a/application/resources/Catalog/Action/Helper/Topics.php +++ /dev/null @@ -1,50 +0,0 @@ -hasNext()) { - $topics[] = $topicList->getNextTopic(); - } - - return $topics; - } - - /** - * Return an array of topics matching a type. - * - * @return array - * - * @since 4/28/09 - * - * @static - */ - public static function filterTopicsByType(array $topics, osid_type_Type $type) - { - $matching = []; - foreach ($topics as $topic) { - if ($topic->getGenusType()->isEqual($type)) { - $matching[] = $topic; - } - } - - return $matching; - } -} diff --git a/application/resources/General/Action/Helper/CsrfKey.php b/application/resources/General/Action/Helper/CsrfKey.php deleted file mode 100755 index 9dff9076..00000000 --- a/application/resources/General/Action/Helper/CsrfKey.php +++ /dev/null @@ -1,35 +0,0 @@ -osidHelper = new Catalog_Action_Helper_Osid(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper); - $this->osidIdHelper = new Catalog_Action_Helper_OsidId(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidIdHelper); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown(): void - { - } - - public function testGetOsidIdFromString() - { - $id = new phpkit_id_Id('example.edu', 'urn', '123456789/abcd'); - $idString = $this->osidIdHelper->toString($id); - - $newId = $this->osidIdHelper->fromString($idString); - $this->assertInstanceOf('osid_id_Id', $newId); - $this->assertTrue($id->isEqual($newId)); - } - - public function testGetStringFromOsidId() - { - $id = new phpkit_id_Id('example.edu', 'urn', '123456789/abcd'); - $idString = $this->osidIdHelper->toString($id); - $this->assertIsString($idString); - - $newId = $this->osidIdHelper->fromString($idString); - $this->assertEquals($idString, $this->osidIdHelper->toString($newId)); - } -} diff --git a/application/test/Catalog/Action/Helper/OsidTermsTest.php b/application/test/Catalog/Action/Helper/OsidTermsTest.php deleted file mode 100755 index ed01aa98..00000000 --- a/application/test/Catalog/Action/Helper/OsidTermsTest.php +++ /dev/null @@ -1,80 +0,0 @@ -osidHelper = new Catalog_Action_Helper_Osid(); - $this->osidHelper->setConfigPath($this->getTestConfigPath()); - Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper); - $this->osidIdHelper = new Catalog_Action_Helper_OsidId(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidIdHelper); - $this->osidTermsHelper = new Catalog_Action_Helper_OsidTerms(); - $this->osidHelper->setConfigPath($this->getTestConfigPath()); - Zend_Controller_Action_HelperBroker::addHelper($this->osidTermsHelper); - - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->spring2009TermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200920'); - $this->fall2009TermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200990'); - $this->fall2008TermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200890'); - - $this->termLookup = $this->osidHelper->getCourseManager()->getTermLookupSessionForCatalog($this->mcugId); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown(): void - { - } - - public function testGetCurrentTermId() - { - $this->assertInstanceOf('osid_id_Id', $this->osidTermsHelper->getCurrentTermId($this->mcugId)); - } - - public function testFindClosestTermId() - { - $testDate = new DateTime('2009-09-30'); - $terms = $this->termLookup->getTerms(); - $closestTermId = $this->osidTermsHelper->findClosestTermId($terms, $testDate); - $this->assertTrue($closestTermId->isEqual($this->fall2009TermId)); - } - - public function testFindlosestNonOverlappingTermIdA() - { - $testDate = new DateTime('2009-08-15'); - $terms = $this->termLookup->getTerms(); - $closestTermId = $this->osidTermsHelper->findClosestTermId($terms, $testDate); - $this->assertTrue($closestTermId->isEqual($this->fall2009TermId)); - } - - public function testFindClosestNonOverlappingTermIdB() - { - $testDate = new DateTime('2009-06-15'); - $terms = $this->termLookup->getTerms(); - $closestTermId = $this->osidTermsHelper->findClosestTermId($terms, $testDate); - $this->assertTrue($closestTermId->isEqual($this->spring2009TermId)); - } - - public function testFindClosestTermIdBeyondRange() - { - $testDate = new DateTime('2020-01-01'); - $terms = $this->termLookup->getTerms(); - $closestTermId = $this->osidTermsHelper->findClosestTermId($terms, $testDate); - $this->assertTrue($closestTermId->isEqual($this->fall2009TermId)); - } -} diff --git a/application/test/Catalog/Action/Helper/OsidTest.php b/application/test/Catalog/Action/Helper/OsidTest.php deleted file mode 100755 index c5dd67e5..00000000 --- a/application/test/Catalog/Action/Helper/OsidTest.php +++ /dev/null @@ -1,40 +0,0 @@ -osidHelper = new Catalog_Action_Helper_Osid(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown(): void - { - } - - public function testGetCourseManager() - { - $this->assertInstanceOf('osid_course_CourseManager', $this->osidHelper->getCourseManager()); - } - - public function testGetRuntimeManager() - { - $this->assertInstanceOf('osid_OsidRuntimeManager', $this->osidHelper->getRuntimeManager()); - } -} diff --git a/application/test/Catalog/Action/Helper/OsidTopicTest.php b/application/test/Catalog/Action/Helper/OsidTopicTest.php deleted file mode 100755 index 8b13a9ed..00000000 --- a/application/test/Catalog/Action/Helper/OsidTopicTest.php +++ /dev/null @@ -1,64 +0,0 @@ -osidHelper = new Catalog_Action_Helper_Osid(); - $this->osidHelper->setConfigPath($this->getTestConfigPath()); - Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper); - $this->osidIdHelper = new Catalog_Action_Helper_OsidId(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidIdHelper); - $this->osidTopicHelper = new Catalog_Action_Helper_Topics(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidTopicHelper); - - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - - $this->topicLookup = $this->osidHelper->getCourseManager()->getTopicLookupSessionForCatalog($this->mcugId); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown(): void - { - } - - public function testTopicListAsArray() - { - $topics = $this->topicLookup->getTopics(); - $numTopics = $topics->available(); - $topicArray = $this->osidTopicHelper->topicListAsArray($topics); - $this->assertIsArray($topicArray); - $this->assertCount($numTopics, $topicArray); - $this->assertInstanceOf('osid_course_Topic', $topicArray[0]); - } - - public function testFilterTopicsByType() - { - $topics = $this->topicLookup->getTopics(); - $numTopics = $topics->available(); - $topicArray = $this->osidTopicHelper->topicListAsArray($topics); - - $subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - - $filteredTopics = $this->osidTopicHelper->filterTopicsByType($topicArray, $subjectType); - $this->assertIsArray($filteredTopics); - $this->assertLessThan($numTopics, count($filteredTopics)); - $this->assertCount(4, $filteredTopics); - $this->assertInstanceOf('osid_course_Topic', $filteredTopics[0]); - } -} diff --git a/application/test/Catalog/Action/Helper/OsidTypeTest.php b/application/test/Catalog/Action/Helper/OsidTypeTest.php deleted file mode 100755 index 5cf3bd0b..00000000 --- a/application/test/Catalog/Action/Helper/OsidTypeTest.php +++ /dev/null @@ -1,54 +0,0 @@ -osidHelper = new Catalog_Action_Helper_Osid(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper); - $this->osidIdHelper = new Catalog_Action_Helper_OsidId(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidIdHelper); - $this->osidTypeHelper = new Catalog_Action_Helper_OsidType(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidIdHelper); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown(): void - { - } - - public function testGetOsidTypeFromString() - { - $type = new phpkit_type_Type('urn', 'example.edu', '123456789/abcd'); - $typeString = $this->osidTypeHelper->toString($type); - - $newType = $this->osidTypeHelper->fromString($typeString); - $this->assertInstanceOf('osid_type_Type', $newType); - $this->assertTrue($type->isEqual($newType)); - } - - public function testGetStringFromOsidType() - { - $type = new phpkit_type_Type('urn', 'example.edu', '123456789/abcd'); - $typeString = $this->osidTypeHelper->toString($type); - $this->assertIsString($typeString); - - $newType = $this->osidTypeHelper->fromString($typeString); - $this->assertEquals($typeString, $this->osidTypeHelper->toString($newType)); - } -} diff --git a/application/test/Catalog/Action/Helper/OsidTypesTest.php b/application/test/Catalog/Action/Helper/OsidTypesTest.php deleted file mode 100755 index f6f1dc8f..00000000 --- a/application/test/Catalog/Action/Helper/OsidTypesTest.php +++ /dev/null @@ -1,42 +0,0 @@ -osidHelper = new Catalog_Action_Helper_Osid(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidHelper); - $this->osidIdHelper = new Catalog_Action_Helper_OsidId(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidIdHelper); - $this->osidTypesHelper = new Catalog_Action_Helper_OsidTypes(); - Zend_Controller_Action_HelperBroker::addHelper($this->osidTypesHelper); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown(): void - { - } - - public function testGetDefaultGenusTypes() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/application/test/Catalog/ApplicationTestTrait.php b/application/test/Catalog/ApplicationTestTrait.php deleted file mode 100644 index d2cd1b6f..00000000 --- a/application/test/Catalog/ApplicationTestTrait.php +++ /dev/null @@ -1,26 +0,0 @@ -config = new Zend_Config_Ini(__DIR__.'/frontend_config.ini', 'development'); - } - - /** - * Answer the configuration path to be used when running tests. - */ - public function getTestConfigPath() - { - return __DIR__.'/../apc/configuration.plist'; - } -} diff --git a/application/test/Catalog/View/Helper/GetTimeStringHelperTest.php b/application/test/Catalog/View/Helper/GetTimeStringHelperTest.php deleted file mode 100755 index 83738ebe..00000000 --- a/application/test/Catalog/View/Helper/GetTimeStringHelperTest.php +++ /dev/null @@ -1,38 +0,0 @@ -helper = new Catalog_View_Helper_GetTimeString(); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown(): void - { - } - - public function testGetTimeString() - { - $this->assertEquals('12:00 am', $this->helper->getTimeString(0)); - $this->assertEquals('8:33 am', $this->helper->getTimeString(30780)); - $this->assertEquals('6:21 pm', $this->helper->getTimeString(66060)); - $this->assertEquals('12:00 am', $this->helper->getTimeString(86400)); - } -} diff --git a/application/test/Catalog/frontend_config.ini b/application/test/Catalog/frontend_config.ini deleted file mode 100755 index 53aff9ab..00000000 --- a/application/test/Catalog/frontend_config.ini +++ /dev/null @@ -1,152 +0,0 @@ -[production] -phpSettings.display_startup_errors = 0 -phpSettings.display_errors = 0 - -# Select the authentication type to use, 'cas' or 'none' -authType = none - -cas.host = login.middlebury.edu -cas.port = 443 -cas.path = /cas -cas.server_cert = - -# Number of seconds, for the Cache-Control header. -cache_control.max_age = 3600 -# Number of seconds, for the Expires header, may be positive or negative -cache_control.expiration_offset = 3600 - - -# Default course offering types to select in the search UI. -catalog.default_offering_genus_types_to_search[] = "urn:inet:middlebury.edu:genera:offering/LCT" -catalog.default_offering_genus_types_to_search[] = "urn:inet:middlebury.edu:genera:offering/SEM" - -# The Id authority to shorten for prettier URLs. -catalog.shorten_ids_for_authority = "middlebury.edu" - -# A map of topics to external URLs. This allows linking out to external sites for -# departments or programs. -catalog.topic_map.ALAC.id = "topic/department/ALAC" -catalog.topic_map.ALAC.url = "http://go.middlebury.edu/ALAC" -catalog.topic_map.AMCV.id = "topic/department/AMCV" -catalog.topic_map.AMCV.url = "http://go.middlebury.edu/AMCV" -catalog.topic_map.AMLT.id = "topic/department/AMLT" -catalog.topic_map.AMLT.url = "http://go.middlebury.edu/AMLT" -catalog.topic_map.AMST.id = "topic/department/AMST" -catalog.topic_map.AMST.url = "http://go.middlebury.edu/AMST" -catalog.topic_map.ARBC.id = "topic/department/ARBC" -catalog.topic_map.ARBC.url = "http://go.middlebury.edu/ARBC" -catalog.topic_map.ARDV.id = "topic/department/ARDV" -catalog.topic_map.ARDV.url = "http://go.middlebury.edu/ARDV" -catalog.topic_map.ART.id = "topic/department/ART" -catalog.topic_map.ART.url = "http://go.middlebury.edu/ART" -catalog.topic_map.BIOL.id = "topic/department/BIOL" -catalog.topic_map.BIOL.url = "http://go.middlebury.edu/BIOL" -catalog.topic_map.CHEM.id = "topic/department/CHEM" -catalog.topic_map.CHEM.url = "http://go.middlebury.edu/CHEM" -catalog.topic_map.CHNS.id = "topic/department/CHNS" -catalog.topic_map.CHNS.url = "http://go.middlebury.edu/CHNS" -catalog.topic_map.CLAS.id = "topic/department/CLAS" -catalog.topic_map.CLAS.url = "http://go.middlebury.edu/CLAS" -catalog.topic_map.CSCI.id = "topic/department/CSCI" -catalog.topic_map.CSCI.url = "http://go.middlebury.edu/CSCI" -catalog.topic_map.DANC.id = "topic/department/DANC" -catalog.topic_map.DANC.url = "http://go.middlebury.edu/DANC" -catalog.topic_map.ECON.id = "topic/department/ECON" -catalog.topic_map.ECON.url = "http://go.middlebury.edu/ECON" -catalog.topic_map.EDST.id = "topic/department/EDST" -catalog.topic_map.EDST.url = "http://go.middlebury.edu/EDST" -catalog.topic_map.ENAM.id = "topic/department/ENAM" -catalog.topic_map.ENAM.url = "http://go.middlebury.edu/ENAM" -catalog.topic_map.ENGL.id = "topic/department/ENGL" -catalog.topic_map.ENGL.url = "http://go.middlebury.edu/ENGL" -catalog.topic_map.ENVS.id = "topic/department/ENVS" -catalog.topic_map.ENVS.url = "http://go.middlebury.edu/ENVS" -catalog.topic_map.FMMC.id = "topic/department/FMMC" -catalog.topic_map.FMMC.url = "http://go.middlebury.edu/FMMC" -catalog.topic_map.FREN.id = "topic/department/FREN" -catalog.topic_map.FREN.url = "http://go.middlebury.edu/FREN" -catalog.topic_map.FYSE.id = "topic/department/FYSE" -catalog.topic_map.FYSE.url = "http://go.middlebury.edu/FYSE" -catalog.topic_map.GEOG.id = "topic/department/GEOG" -catalog.topic_map.GEOG.url = "http://go.middlebury.edu/GEOG" -catalog.topic_map.GEOL.id = "topic/department/GEOL" -catalog.topic_map.GEOL.url = "http://go.middlebury.edu/GEOL" -catalog.topic_map.GRMN.id = "topic/department/GRMN" -catalog.topic_map.GRMN.url = "http://go.middlebury.edu/GRMN" -catalog.topic_map.HARC.id = "topic/department/HARC" -catalog.topic_map.HARC.url = "http://go.middlebury.edu/HARC" -catalog.topic_map.HIST.id = "topic/department/HIST" -catalog.topic_map.HIST.url = "http://go.middlebury.edu/HIST" -catalog.topic_map.HUDV.id = "topic/department/HUDV" -catalog.topic_map.HUDV.url = "http://go.middlebury.edu/HUDV" -catalog.topic_map.INDE.id = "topic/department/INDE" -catalog.topic_map.INDE.url = "http://go.middlebury.edu/INDE" -catalog.topic_map.INTD.id = "topic/department/INTD" -catalog.topic_map.INTD.url = "http://go.middlebury.edu/INTD" -catalog.topic_map.INTL.id = "topic/department/INTL" -catalog.topic_map.INTL.url = "http://go.middlebury.edu/INTL" -catalog.topic_map.IPEC.id = "topic/department/IPEC" -catalog.topic_map.IPEC.url = "http://go.middlebury.edu/IPEC" -catalog.topic_map.ISEA.id = "topic/department/ISEA" -catalog.topic_map.ISEA.url = "http://go.middlebury.edu/ISEA" -catalog.topic_map.ISRU.id = "topic/department/ISRU" -catalog.topic_map.ISRU.url = "http://go.middlebury.edu/ISRU" -catalog.topic_map.ITAL.id = "topic/department/ITAL" -catalog.topic_map.ITAL.url = "http://go.middlebury.edu/ITAL" -catalog.topic_map.JAPN.id = "topic/department/JAPN" -catalog.topic_map.JAPN.url = "http://go.middlebury.edu/JAPN" -catalog.topic_map.LITP.id = "topic/department/LITP" -catalog.topic_map.LITP.url = "http://go.middlebury.edu/LITP" -catalog.topic_map.LITS.id = "topic/department/LITS" -catalog.topic_map.LITS.url = "http://go.middlebury.edu/LITS" -catalog.topic_map.MATH.id = "topic/department/MATH" -catalog.topic_map.MATH.url = "http://go.middlebury.edu/MATH" -catalog.topic_map.MBBC.id = "topic/department/MBBC" -catalog.topic_map.MBBC.url = "http://go.middlebury.edu/MBBC" -catalog.topic_map.MUSC.id = "topic/department/MUSC" -catalog.topic_map.MUSC.url = "http://go.middlebury.edu/MUSC" -catalog.topic_map.NSCI.id = "topic/department/NSCI" -catalog.topic_map.NSCI.url = "http://go.middlebury.edu/NSCI" -catalog.topic_map.PGSE.id = "topic/department/PGSE" -catalog.topic_map.PGSE.url = "http://go.middlebury.edu/PGSE" -catalog.topic_map.PHED.id = "topic/department/PHED" -catalog.topic_map.PHED.url = "http://go.middlebury.edu/PHED" -catalog.topic_map.PHIL.id = "topic/department/PHIL" -catalog.topic_map.PHIL.url = "http://go.middlebury.edu/PHIL" -catalog.topic_map.PHYS.id = "topic/department/PHYS" -catalog.topic_map.PHYS.url = "http://go.middlebury.edu/PHYS" -catalog.topic_map.PSCI.id = "topic/department/PSCI" -catalog.topic_map.PSCI.url = "http://go.middlebury.edu/PSCI" -catalog.topic_map.PSYC.id = "topic/department/PSYC" -catalog.topic_map.PSYC.url = "http://go.middlebury.edu/PSYC" -catalog.topic_map.RELI.id = "topic/department/RELI" -catalog.topic_map.RELI.url = "http://go.middlebury.edu/RELI" -catalog.topic_map.RUSS.id = "topic/department/RUSS" -catalog.topic_map.RUSS.url = "http://go.middlebury.edu/RUSS" -catalog.topic_map.SISP.id = "topic/department/SISP" -catalog.topic_map.SISP.url = "http://go.middlebury.edu/SISP" -catalog.topic_map.SOAN.id = "topic/department/SOAN" -catalog.topic_map.SOAN.url = "http://go.middlebury.edu/SOAN" -catalog.topic_map.SPAN.id = "topic/department/SPAN" -catalog.topic_map.SPAN.url = "http://go.middlebury.edu/SPAN" -catalog.topic_map.STLD.id = "topic/department/STLD" -catalog.topic_map.STLD.url = "http://go.middlebury.edu/STLD" -catalog.topic_map.TEDU.id = "topic/department/TEDU" -catalog.topic_map.TEDU.url = "http://go.middlebury.edu/TEDU" -catalog.topic_map.THEA.id = "topic/department/THEA" -catalog.topic_map.THEA.url = "http://go.middlebury.edu/THEA" -catalog.topic_map.WAGS.id = "topic/department/WAGS" -catalog.topic_map.WAGS.url = "http://go.middlebury.edu/WAGS" -catalog.topic_map.WRPR.id = "topic/department/WRPR" -catalog.topic_map.WRPR.url = "http://go.middlebury.edu/WRPR" - - -[staging : production] - -[testing : production] -phpSettings.display_startup_errors = 1 -phpSettings.display_errors = 1 - -[development : production] -phpSettings.display_startup_errors = 1 -phpSettings.display_errors = 1 diff --git a/application/test/apc/configuration.plist b/application/test/apc/configuration.plist index 81e4df0b..bc1fe3f1 100755 --- a/application/test/apc/configuration.plist +++ b/application/test/apc/configuration.plist @@ -2,18 +2,18 @@ - urn:inet:middlebury.edu:config:banner_course/id_authority + urn:inet:middlebury.edu:config:banner_course.id_authority middlebury.edu - urn:inet:middlebury.edu:config:banner_course/pdo_count_queries + urn:inet:middlebury.edu:config:banner_course.pdo_count_queries - urn:inet:middlebury.edu:config:banner_course/pdo_dsn - mysql:dbname=afranco_catalog_test;host=localhost - urn:inet:middlebury.edu:config:banner_course/pdo_password - testpassword - urn:inet:middlebury.edu:config:banner_course/pdo_username - testuser + urn:inet:middlebury.edu:config:banner_course.pdo_dsn + mysql:dbname=symfony_test;host=database + urn:inet:middlebury.edu:config:banner_course.pdo_password + symfony + urn:inet:middlebury.edu:config:banner_course.pdo_username + symfony - urn:inet:middlebury.edu:config:apc_course/impl_class_name + urn:inet:middlebury.edu:config:apc_course.impl_class_name banner_course_CourseManager diff --git a/application/test/apc/course/CourseManagerTest.php b/application/test/apc/course/CourseManagerTest.php index 737b2298..f46f0f7e 100755 --- a/application/test/apc/course/CourseManagerTest.php +++ b/application/test/apc/course/CourseManagerTest.php @@ -12,7 +12,7 @@ class apc_course_CourseManagerTest extends banner_course_CourseManagerTest */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); $this->manager = self::$runtimeManager->getManager(osid_OSID::COURSE(), 'apc_course_CourseManager', '3.0.0'); } } diff --git a/application/test/banner/DatabaseTestTrait.php b/application/test/banner/DatabaseTestTrait.php index 50ea408f..5e82159c 100644 --- a/application/test/banner/DatabaseTestTrait.php +++ b/application/test/banner/DatabaseTestTrait.php @@ -4,6 +4,7 @@ trait banner_DatabaseTestTrait { public static $runtimeManager; public static $courseManager; + public static $db; public static function setUpBeforeClass(): void { @@ -37,6 +38,17 @@ public static function tearDownDatabase(): void self::resetMemoryLimit(); } + public static function getDB() + { + if (empty(self::$db)) { + self::$runtimeManager = new phpkit_AutoloadOsidRuntimeManager(__DIR__.'/configuration.plist'); + self::$courseManager = self::$runtimeManager->getManager(osid_OSID::COURSE(), 'banner_course_CourseManager', '3.0.0'); + self::$db = self::$courseManager->getDB(); + } + + return self::$db; + } + /** * Load the banner testing database. * @@ -44,10 +56,9 @@ public static function tearDownDatabase(): void */ public static function loadBannerDb() { + // Initialize our testing database self::$runtimeManager = new phpkit_AutoloadOsidRuntimeManager(__DIR__.'/configuration.plist'); self::$courseManager = self::$runtimeManager->getManager(osid_OSID::COURSE(), 'banner_course_CourseManager', '3.0.0'); - - // Initialize our testing database $db = self::$courseManager->getDB(); harmoni_SQLUtils::runSQLfile(__DIR__.'/sql/drop_tables.sql', $db); harmoni_SQLUtils::runSQLfile(APPLICATION_PATH.'/library/banner/sql/table_creation.sql', $db); @@ -73,7 +84,7 @@ public static function loadBannerDb() public static function emptyBannerDbAndClose() { // Remove our testing database - $db = self::$courseManager->getDB(); + $db = self::getDB(); if (method_exists($db, 'getCounters')) { $maxName = 0; $maxNum = 0; diff --git a/application/test/banner/configuration.plist b/application/test/banner/configuration.plist index 81e4df0b..bc1fe3f1 100755 --- a/application/test/banner/configuration.plist +++ b/application/test/banner/configuration.plist @@ -2,18 +2,18 @@ - urn:inet:middlebury.edu:config:banner_course/id_authority + urn:inet:middlebury.edu:config:banner_course.id_authority middlebury.edu - urn:inet:middlebury.edu:config:banner_course/pdo_count_queries + urn:inet:middlebury.edu:config:banner_course.pdo_count_queries - urn:inet:middlebury.edu:config:banner_course/pdo_dsn - mysql:dbname=afranco_catalog_test;host=localhost - urn:inet:middlebury.edu:config:banner_course/pdo_password - testpassword - urn:inet:middlebury.edu:config:banner_course/pdo_username - testuser + urn:inet:middlebury.edu:config:banner_course.pdo_dsn + mysql:dbname=symfony_test;host=database + urn:inet:middlebury.edu:config:banner_course.pdo_password + symfony + urn:inet:middlebury.edu:config:banner_course.pdo_username + symfony - urn:inet:middlebury.edu:config:apc_course/impl_class_name + urn:inet:middlebury.edu:config:apc_course.impl_class_name banner_course_CourseManager diff --git a/application/test/banner/course/Course/Catalog/SessionTest.php b/application/test/banner/course/Course/Catalog/SessionTest.php index 1f515200..982ecd99 100755 --- a/application/test/banner/course/Course/Catalog/SessionTest.php +++ b/application/test/banner/course/Course/Catalog/SessionTest.php @@ -36,11 +36,11 @@ protected function setUp(): void { $this->session = self::$courseManager->getCourseCatalogSession(); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); - $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/CHEM0104'); + $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.CHEM0104'); } /** diff --git a/application/test/banner/course/Course/Lookup/CombinedSessionTest.php b/application/test/banner/course/Course/Lookup/CombinedSessionTest.php index 7c9df7e3..15ec2786 100755 --- a/application/test/banner/course/Course/Lookup/CombinedSessionTest.php +++ b/application/test/banner/course/Course/Lookup/CombinedSessionTest.php @@ -34,22 +34,22 @@ protected function getSession() */ protected function setUp(): void { - $this->allId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/all'); + $this->allId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.all'); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getCourseLookupSession(); $this->session->useFederatedCourseCatalogView(); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/GEOL0250'); - $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/XXXX0101'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.GEOL0250'); + $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.XXXX0101'); - $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); - $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/NSCI'); + $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); + $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.NSCI'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); diff --git a/application/test/banner/course/Course/Lookup/SessionTest.php b/application/test/banner/course/Course/Lookup/SessionTest.php index ed765c8d..e0e3f480 100755 --- a/application/test/banner/course/Course/Lookup/SessionTest.php +++ b/application/test/banner/course/Course/Lookup/SessionTest.php @@ -34,19 +34,19 @@ protected function getSession() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getCourseLookupSessionForCatalog($this->mcugId); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/GEOL0250'); - $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/XXXX0101'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.GEOL0250'); + $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.XXXX0101'); - $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); - $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/NSCI'); + $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); + $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.NSCI'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); diff --git a/application/test/banner/course/Course/Search/OrderTest.php b/application/test/banner/course/Course/Search/OrderTest.php index d2196884..9c6a15f5 100755 --- a/application/test/banner/course/Course/Search/OrderTest.php +++ b/application/test/banner/course/Course/Search/OrderTest.php @@ -21,8 +21,8 @@ class banner_course_Course_Search_OrderTest extends TestCase */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getCourseSearchSessionForCatalog($this->mcugId); @@ -36,13 +36,13 @@ protected function setUp(): void $this->object = $this->session->getCourseSearchOrder(); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/GEOL0250'); - $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/XXXX0101'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.GEOL0250'); + $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.XXXX0101'); - $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); - $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/NSCI'); + $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); + $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.NSCI'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); diff --git a/application/test/banner/course/Course/Search/QueryTest.php b/application/test/banner/course/Course/Search/QueryTest.php index ba4519c0..a5b7a869 100755 --- a/application/test/banner/course/Course/Search/QueryTest.php +++ b/application/test/banner/course/Course/Search/QueryTest.php @@ -21,8 +21,8 @@ class banner_course_Course_Search_QueryTest extends TestCase */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getCourseSearchSessionForCatalog($this->mcugId); @@ -33,19 +33,19 @@ protected function setUp(): void $this->search = $this->session->getCourseSearch(); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/GEOL0250'); - $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/CHEM0104'); - $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/XXXX0101'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.GEOL0250'); + $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.CHEM0104'); + $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.XXXX0101'); - $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/90143'); - $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20663'); - $this->chemOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20073'); + $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.90143'); + $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20663'); + $this->chemOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20073'); - $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); - $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/NSCI'); - $this->levelTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/level/UG'); + $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); + $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.NSCI'); + $this->levelTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.level.UG'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); @@ -58,12 +58,12 @@ protected function setUp(): void $this->topicQueryRecordType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:topic'); $this->otherType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:other'); - $this->barryId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/person/WEBID1000002'); - $this->dudleyId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/person/WEBID1000004'); - $this->calvinId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/person/WEBID1000003'); + $this->barryId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.person.WEBID1000002'); + $this->dudleyId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.person.WEBID1000004'); + $this->calvinId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.person.WEBID1000003'); - $this->mainCampusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/campus/M'); - $this->breadloafCampusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/campus/BL'); + $this->mainCampusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.campus.M'); + $this->breadloafCampusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.campus.BL'); } /** diff --git a/application/test/banner/course/Course/Search/SearchTest.php b/application/test/banner/course/Course/Search/SearchTest.php index be3999e4..e5d1fbf1 100755 --- a/application/test/banner/course/Course/Search/SearchTest.php +++ b/application/test/banner/course/Course/Search/SearchTest.php @@ -21,8 +21,8 @@ class banner_course_Course_Search_SearchTest extends TestCase */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getCourseSearchSessionForCatalog($this->mcugId); @@ -34,14 +34,14 @@ protected function setUp(): void $this->object = $this->session->getCourseSearch(); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/GEOL0250'); - $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/CHEM0104'); - $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/XXXX0101'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.GEOL0250'); + $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.CHEM0104'); + $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.XXXX0101'); - $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); - $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/NSCI'); + $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); + $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.NSCI'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); diff --git a/application/test/banner/course/Course/Search/SessionTest.php b/application/test/banner/course/Course/Search/SessionTest.php index 3fba2251..3703dae2 100755 --- a/application/test/banner/course/Course/Search/SessionTest.php +++ b/application/test/banner/course/Course/Search/SessionTest.php @@ -34,19 +34,19 @@ protected function getSession() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getCourseSearchSessionForCatalog($this->mcugId); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/GEOL0250'); - $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/XXXX0101'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.GEOL0250'); + $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.XXXX0101'); - $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); - $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/NSCI'); + $this->deptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->subjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); + $this->divTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.NSCI'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); diff --git a/application/test/banner/course/CourseCatalog/Lookup/SessionTest.php b/application/test/banner/course/CourseCatalog/Lookup/SessionTest.php index f369a4db..94709803 100755 --- a/application/test/banner/course/CourseCatalog/Lookup/SessionTest.php +++ b/application/test/banner/course/CourseCatalog/Lookup/SessionTest.php @@ -36,8 +36,8 @@ protected function setUp(): void { $this->session = self::$courseManager->getCourseCatalogLookupSession(); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); diff --git a/application/test/banner/course/CourseCatalogTest.php b/application/test/banner/course/CourseCatalogTest.php index c141efbe..5f69a35c 100755 --- a/application/test/banner/course/CourseCatalogTest.php +++ b/application/test/banner/course/CourseCatalogTest.php @@ -39,17 +39,17 @@ protected function getObject() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getCourseLookupSessionForCatalog($this->mcugId); $this->object = $this->session->getCourseCatalog($this->mcugId); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->mathId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/MATH0300'); - $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/XXXX0101'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->mathId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.MATH0300'); + $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.XXXX0101'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); diff --git a/application/test/banner/course/CourseManagerTest.php b/application/test/banner/course/CourseManagerTest.php index 8b9af891..4e80b6ad 100755 --- a/application/test/banner/course/CourseManagerTest.php +++ b/application/test/banner/course/CourseManagerTest.php @@ -31,7 +31,7 @@ protected function getManager() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); $this->manager = self::$runtimeManager->getManager(osid_OSID::COURSE(), 'banner_course_CourseManager', '3.0.0'); } diff --git a/application/test/banner/course/CourseOffering/Catalog/SessionTest.php b/application/test/banner/course/CourseOffering/Catalog/SessionTest.php index 474e6509..c26fd4db 100755 --- a/application/test/banner/course/CourseOffering/Catalog/SessionTest.php +++ b/application/test/banner/course/CourseOffering/Catalog/SessionTest.php @@ -36,11 +36,11 @@ protected function setUp(): void { $this->session = self::$courseManager->getCourseOfferingCatalogSession(); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); - $this->sectionId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/92418'); + $this->sectionId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.92418'); } /** diff --git a/application/test/banner/course/CourseOffering/Lookup/CombinedSessionTest.php b/application/test/banner/course/CourseOffering/Lookup/CombinedSessionTest.php index 660b80a8..79c2746e 100755 --- a/application/test/banner/course/CourseOffering/Lookup/CombinedSessionTest.php +++ b/application/test/banner/course/CourseOffering/Lookup/CombinedSessionTest.php @@ -31,30 +31,30 @@ protected function getSession() */ protected function setUp(): void { - $this->allId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/all'); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->allId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.all'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getCourseOfferingLookupSession(); $this->session->useFederatedCourseCatalogView(); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->mathId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/MATH0300'); - $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/CHEM0104'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->mathId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.MATH0300'); + $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.CHEM0104'); - $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/90143'); - $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20663'); - $this->unknownOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/178293/2101'); + $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.90143'); + $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20663'); + $this->unknownOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.178293.2101'); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200890'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200890'); - $this->physDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->chemDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/CHEM'); - $this->physSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/PHYS'); - $this->chemSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); - $this->dedReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/DED'); - $this->sciReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/SCI'); + $this->physDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->chemDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.CHEM'); + $this->physSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.PHYS'); + $this->chemSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); + $this->dedReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.DED'); + $this->sciReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.SCI'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); @@ -62,9 +62,9 @@ protected function setUp(): void $this->secondaryType = new phpkit_type_URNInetType('urn:inet:osid.org:genera:secondary'); $this->undergraduateType = new phpkit_type_URNInetType('urn:inet:osid.org:genera:undergraduate'); - $this->lectureType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/LCT'); - $this->labType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/LAB'); - $this->discussionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/DSC'); + $this->lectureType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.LCT'); + $this->labType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.LAB'); + $this->discussionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.DSC'); } /** diff --git a/application/test/banner/course/CourseOffering/Lookup/SessionTest.php b/application/test/banner/course/CourseOffering/Lookup/SessionTest.php index 2fe8df09..d2b3d8e9 100755 --- a/application/test/banner/course/CourseOffering/Lookup/SessionTest.php +++ b/application/test/banner/course/CourseOffering/Lookup/SessionTest.php @@ -31,29 +31,29 @@ protected function getSession() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getCourseOfferingLookupSessionForCatalog($this->mcugId); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->mathId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/MATH0300'); - $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/CHEM0104'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->mathId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.MATH0300'); + $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.CHEM0104'); - $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/90143'); - $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20663'); - $this->unknownOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/178293/2101'); + $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.90143'); + $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20663'); + $this->unknownOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.178293.2101'); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200890'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200890'); - $this->physDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->chemDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/CHEM'); - $this->physSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/PHYS'); - $this->chemSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); - $this->dedReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/DED'); - $this->sciReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/SCI'); - $this->ugLevelTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/level/UG'); + $this->physDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->chemDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.CHEM'); + $this->physSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.PHYS'); + $this->chemSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); + $this->dedReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.DED'); + $this->sciReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.SCI'); + $this->ugLevelTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.level.UG'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); @@ -61,9 +61,9 @@ protected function setUp(): void $this->secondaryType = new phpkit_type_URNInetType('urn:inet:osid.org:genera:secondary'); $this->undergraduateType = new phpkit_type_URNInetType('urn:inet:osid.org:genera:undergraduate'); - $this->lectureType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/LCT'); - $this->labType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/LAB'); - $this->discussionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/DSC'); + $this->lectureType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.LCT'); + $this->labType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.LAB'); + $this->discussionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.DSC'); } /** diff --git a/application/test/banner/course/CourseOffering/Search/OrderTest.php b/application/test/banner/course/CourseOffering/Search/OrderTest.php index 2eec3d7b..812afaec 100755 --- a/application/test/banner/course/CourseOffering/Search/OrderTest.php +++ b/application/test/banner/course/CourseOffering/Search/OrderTest.php @@ -23,21 +23,21 @@ protected function setUp(): void { $this->wildcardStringMatchType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:search:wildcard'); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); $this->session = self::$courseManager->getCourseOfferingSearchSessionForCatalog($this->mcugId); $this->object = $this->session->getCourseOfferingSearchOrder(); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200420'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200420'); $this->query = $this->session->getCourseOfferingQuery(); $this->query->matchTermId($this->termId, true); $this->search = $this->session->getCourseOfferingSearch(); - $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/90143'); - $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20663'); - $this->chemOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20073'); + $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.90143'); + $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20663'); + $this->chemOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20073'); $this->instructorsType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors'); $this->otherType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:other'); diff --git a/application/test/banner/course/CourseOffering/Search/QueryTest.php b/application/test/banner/course/CourseOffering/Search/QueryTest.php index 04aba49c..cf72c017 100755 --- a/application/test/banner/course/CourseOffering/Search/QueryTest.php +++ b/application/test/banner/course/CourseOffering/Search/QueryTest.php @@ -23,44 +23,44 @@ protected function setUp(): void { $this->wildcardStringMatchType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:search:wildcard'); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->session = self::$courseManager->getCourseOfferingSearchSessionForCatalog($this->mcugId); $this->object = $this->session->getCourseOfferingQuery(); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/CHEM0104'); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200890'); - $this->termId2 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200790'); - - $this->physDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->chemDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/CHEM'); - $this->physSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/PHYS'); - $this->geolSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/GEOL'); - $this->chemSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); - $this->dedReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/DED'); - $this->sciReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/SCI'); - $this->natsciDivTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/NSCI'); - $this->ugLevelTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/level/UG'); - $this->ccBlockTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/block/CC'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.CHEM0104'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200890'); + $this->termId2 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200790'); + + $this->physDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->chemDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.CHEM'); + $this->physSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.PHYS'); + $this->geolSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.GEOL'); + $this->chemSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); + $this->dedReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.DED'); + $this->sciReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.SCI'); + $this->natsciDivTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.NSCI'); + $this->ugLevelTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.level.UG'); + $this->ccBlockTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.block.CC'); $this->instructorsType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors'); $this->weeklyScheduleType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:weekly_schedule'); $this->enrollmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:enrollment'); $this->otherType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:other'); - $this->lectureType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/LCT'); - $this->labType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/LAB'); - $this->discussionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering/DSC'); + $this->lectureType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.LCT'); + $this->labType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.LAB'); + $this->discussionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:offering.DSC'); - $this->barryId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/person/WEBID1000002'); - $this->calvinId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/person/WEBID1000003'); + $this->barryId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.person.WEBID1000002'); + $this->calvinId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.person.WEBID1000003'); - $this->mbh216Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/room/MBH/216'); - $this->mbh560Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/room/MBH/560'); - $this->mainCampusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/campus/M'); - $this->breadloafCampusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/campus/BL'); + $this->mbh216Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.room.MBH.216'); + $this->mbh560Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.room.MBH.560'); + $this->mainCampusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.campus.M'); + $this->breadloafCampusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.campus.BL'); } /** diff --git a/application/test/banner/course/CourseOffering/Search/SearchTest.php b/application/test/banner/course/CourseOffering/Search/SearchTest.php index 5f1db8f5..d51078a5 100755 --- a/application/test/banner/course/CourseOffering/Search/SearchTest.php +++ b/application/test/banner/course/CourseOffering/Search/SearchTest.php @@ -23,18 +23,18 @@ protected function setUp(): void { $this->wildcardStringMatchType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:search:wildcard'); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); $this->session = self::$courseManager->getCourseOfferingSearchSessionForCatalog($this->mcugId); $this->object = $this->session->getCourseOfferingSearch(); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200420'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200420'); $this->query = $this->session->getCourseOfferingQuery(); $this->query->matchTermId($this->termId, true); - $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/90143'); - $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20663'); - $this->chemOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20073'); + $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.90143'); + $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20663'); + $this->chemOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20073'); $this->instructorsType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors'); $this->otherType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:other'); diff --git a/application/test/banner/course/CourseOffering/Search/SessionTest.php b/application/test/banner/course/CourseOffering/Search/SessionTest.php index 9d8f54f3..5644da2c 100755 --- a/application/test/banner/course/CourseOffering/Search/SessionTest.php +++ b/application/test/banner/course/CourseOffering/Search/SessionTest.php @@ -31,28 +31,28 @@ protected function getSession() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getCourseOfferingSearchSessionForCatalog($this->mcugId); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->mathId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/MATH0300'); - $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/CHEM0104'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->mathId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.MATH0300'); + $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.CHEM0104'); - $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/90143'); - $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20663'); - $this->unknownOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/178293/2101'); + $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.90143'); + $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20663'); + $this->unknownOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.178293.2101'); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200890'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200890'); - $this->physDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->chemDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/CHEM'); - $this->physSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/PHYS'); - $this->chemSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); - $this->dedReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/DED'); - $this->sciReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/SCI'); + $this->physDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->chemDeptTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.CHEM'); + $this->physSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.PHYS'); + $this->chemSubjTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); + $this->dedReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.DED'); + $this->sciReqTopicId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.SCI'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); diff --git a/application/test/banner/course/CourseOfferingTest.php b/application/test/banner/course/CourseOfferingTest.php index 066f1fb6..74b75d8b 100755 --- a/application/test/banner/course/CourseOfferingTest.php +++ b/application/test/banner/course/CourseOfferingTest.php @@ -31,12 +31,12 @@ protected function getObject() */ protected function setUp(): void { - $this->mcugCatalogId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->physCourseId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/90143'); - $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/92418'); - $this->geogOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/92443'); - $this->chemOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200520/20022'); + $this->mcugCatalogId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->physCourseId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.90143'); + $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.92418'); + $this->geogOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.92443'); + $this->chemOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200520.20022'); $this->session = self::$courseManager->getCourseOfferingLookupSessionForCatalog($this->mcugCatalogId); $this->object = $this->session->getCourseOffering($this->physOfferingId); @@ -64,7 +64,7 @@ public function testGenusType() { $type = $this->object->getGenusType(); $this->assertInstanceOf('osid_type_Type', $type); - $this->assertEquals('genera:offering/LCT', $type->getIdentifier()); + $this->assertEquals('genera:offering.LCT', $type->getIdentifier()); $this->assertEquals('Lecture', trim($type->getDisplayName())); } @@ -81,13 +81,13 @@ public function testGetTitle() */ public function testEffectiveDateTitle() { - $chem200390 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200390/90085'); - $chem200420 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20073'); - $chem200490 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200490/90066'); - $chem200520 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200520/20019'); - $chem200590 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200590/90056'); - $chem200620 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200620/20017'); - $chem200890 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/90040'); + $chem200390 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200390.90085'); + $chem200420 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20073'); + $chem200490 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200490.90066'); + $chem200520 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200520.20019'); + $chem200590 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200590.90056'); + $chem200620 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200620.20017'); + $chem200890 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.90040'); $this->assertEquals('Fundamentals of Chemistry II', $this->session->getCourseOffering($chem200390)->getTitle()); $this->assertEquals('Fundamentals of Chemistry II', $this->session->getCourseOffering($chem200420)->getTitle()); @@ -109,13 +109,13 @@ public function testGetPhysDescription() */ public function testEffectiveDateDescription() { - $chem200390 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200390/90085'); - $chem200420 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20073'); - $chem200490 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200490/90066'); - $chem200520 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200520/20019'); - $chem200590 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200590/90056'); - $chem200620 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200620/20017'); - $chem200890 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200890/90040'); + $chem200390 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200390.90085'); + $chem200420 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20073'); + $chem200490 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200490.90066'); + $chem200520 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200520.20019'); + $chem200590 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200590.90056'); + $chem200620 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200620.20017'); + $chem200890 = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200890.90040'); $description = 'Major topics include chemical kinetics, chemical equilibrium, acid-base equilibria, chemical thermodynamics, electrochemistry, descriptive inorganic chemistry, and coordination chemistry. Lab work includes inorganic synthesis, qualitative analysis, and quantitative analysis in kinetics, acid-base and redox chemistry. (CHEM 0103 or by waiver) 3 hrs. lect., 3 hrs. lab, 1 hr. disc.'; @@ -192,12 +192,12 @@ public function testTopicIds() { $list = $this->object->getTopicIds(); $identifiers = [ - 'topic/subject/PHYS', - 'topic/department/PHYS', - 'topic/division/NSCI', - 'topic/requirement/DED', - 'topic/requirement/SCI', - 'topic/level/UG', + 'topic.subject.PHYS', + 'topic.department.PHYS', + 'topic.division.NSCI', + 'topic.requirement.DED', + 'topic.requirement.SCI', + 'topic.level.UG', ]; $found = []; $this->assertTrue($list->hasNext()); @@ -226,13 +226,13 @@ public function testGeolTopicIds() $list = $offering->getTopicIds(); $this->assertEquals(7, $list->available()); $identifiers = [ - 'topic/subject/GEOL', - 'topic/department/GEOL', - 'topic/division/NSCI', - 'topic/requirement/DED', - 'topic/requirement/SCI', - 'topic/level/UG', - 'topic/block/CC', + 'topic.subject.GEOL', + 'topic.department.GEOL', + 'topic.division.NSCI', + 'topic.requirement.DED', + 'topic.requirement.SCI', + 'topic.level.UG', + 'topic.block.CC', ]; $found = []; while ($list->hasNext()) { diff --git a/application/test/banner/course/CourseTest.php b/application/test/banner/course/CourseTest.php index 6d8851cb..a12a73bd 100755 --- a/application/test/banner/course/CourseTest.php +++ b/application/test/banner/course/CourseTest.php @@ -31,11 +31,11 @@ protected function getObject() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/GEOL0250'); - $this->geogId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/GEOG0250'); - $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/CHEM0104'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.GEOL0250'); + $this->geogId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.GEOG0250'); + $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.CHEM0104'); $this->session = self::$courseManager->getCourseLookupSessionForCatalog($this->mcugId); $this->object = $this->session->getCourse($this->physId); @@ -120,10 +120,10 @@ public function testTopicIds() { $list = $this->object->getTopicIds(); $identifiers = [ - 'topic/subject/PHYS', - 'topic/department/PHYS', - 'topic/division/NSCI', - 'topic/level/UG', + 'topic.subject.PHYS', + 'topic.department.PHYS', + 'topic.division.NSCI', + 'topic.level.UG', ]; $found = []; $this->assertTrue($list->hasNext()); diff --git a/application/test/banner/course/PartOfTermCourseOfferingTest.php b/application/test/banner/course/PartOfTermCourseOfferingTest.php index 70328a61..19f284c2 100644 --- a/application/test/banner/course/PartOfTermCourseOfferingTest.php +++ b/application/test/banner/course/PartOfTermCourseOfferingTest.php @@ -31,13 +31,13 @@ protected function getObject() */ protected function setUp(): void { - $this->mclsCatalogId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCLS'); - $this->hebmCourseId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/HEBM5642'); - $this->hebmOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/201690/92587'); - $this->mcugCatalogId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->physCourseId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200390/90260'); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); + $this->mclsCatalogId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCLS'); + $this->hebmCourseId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.HEBM5642'); + $this->hebmOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.201690.92587'); + $this->mcugCatalogId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->physCourseId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200390.90260'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); $this->session = self::$courseManager->getCourseOfferingLookupSessionForCatalog($this->mclsCatalogId); $this->searchSession = self::$courseManager->getCourseOfferingSearchSessionForCatalog($this->mclsCatalogId); @@ -61,14 +61,14 @@ protected function tearDown(): void public function testGetTermId() { $this->assertInstanceOf('osid_id_Id', $this->object->getTermId()); - $this->assertEquals('term/201690/HBM', $this->object->getTermId()->getIdentifier()); + $this->assertEquals('term.201690.HBM', $this->object->getTermId()->getIdentifier()); } public function testGetTerm() { $term = $this->object->getTerm(); $this->assertInstanceOf('osid_course_Term', $term); - $this->assertEquals('term/201690/HBM', $term->getId()->getIdentifier()); + $this->assertEquals('term.201690.HBM', $term->getId()->getIdentifier()); } public function testTermStartDate() @@ -88,7 +88,7 @@ public function testTermEndDate() */ public function testOfferingFoundInBaseTerm() { - $offerings = $this->session->getCourseOfferingsByTermForCourse(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/201690'), $this->hebmCourseId); + $offerings = $this->session->getCourseOfferingsByTermForCourse(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.201690'), $this->hebmCourseId); $this->assertTrue($offerings->hasNext()); $offering = $offerings->getNextCourseOffering(); $this->assertTrue($this->hebmOfferingId->isEqual($offering->getId())); @@ -99,7 +99,7 @@ public function testOfferingFoundInBaseTerm() */ public function testOfferingFoundInPartOfTerm() { - $offerings = $this->session->getCourseOfferingsByTermForCourse(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/201690/HBM'), $this->hebmCourseId); + $offerings = $this->session->getCourseOfferingsByTermForCourse(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.201690.HBM'), $this->hebmCourseId); $this->assertTrue($offerings->hasNext()); $offering = $offerings->getNextCourseOffering(); $this->assertTrue($this->hebmOfferingId->isEqual($offering->getId())); @@ -111,7 +111,7 @@ public function testOfferingFoundInPartOfTerm() public function testOfferingSearchBaseTerm() { $query = $this->searchSession->getCourseOfferingQuery(); - $query->matchTermId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/201690'), true); + $query->matchTermId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.201690'), true); $offerings = $this->searchSession->getCourseOfferingsByQuery($query); $this->assertTrue($offerings->hasNext()); $offering = $offerings->getNextCourseOffering(); @@ -124,7 +124,7 @@ public function testOfferingSearchBaseTerm() public function testOfferingSearchPartOfTerm() { $query = $this->searchSession->getCourseOfferingQuery(); - $query->matchTermId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/201690/HBM'), true); + $query->matchTermId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.201690.HBM'), true); $offerings = $this->searchSession->getCourseOfferingsByQuery($query); $this->assertTrue($offerings->hasNext()); $offering = $offerings->getNextCourseOffering(); @@ -139,7 +139,7 @@ public function testOfferingSearchBaseTermUg() $this->searchSession = self::$courseManager->getCourseOfferingSearchSessionForCatalog($this->mcugCatalogId); $query = $this->searchSession->getCourseOfferingQuery(); - $query->matchTermId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200390'), true); + $query->matchTermId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200390'), true); $query->matchCourseId($this->physId, true); $offerings = $this->searchSession->getCourseOfferingsByQuery($query); $this->assertTrue($offerings->hasNext()); @@ -154,7 +154,7 @@ public function testOfferingSearchPartOfTermUg1() { $this->searchSession = self::$courseManager->getCourseOfferingSearchSessionForCatalog($this->mcugCatalogId); $query = $this->searchSession->getCourseOfferingQuery(); - $query->matchTermId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200390/1'), true); + $query->matchTermId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200390.1'), true); $query->matchCourseId($this->physId, true); $offerings = $this->searchSession->getCourseOfferingsByQuery($query); $this->assertTrue($offerings->hasNext()); @@ -169,7 +169,7 @@ public function testOfferingSearchPartOfTermUgHbm() { $this->searchSession = self::$courseManager->getCourseOfferingSearchSessionForCatalog($this->mcugCatalogId); $query = $this->searchSession->getCourseOfferingQuery(); - $query->matchTermId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200390/HBM'), true); + $query->matchTermId(new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200390.HBM'), true); $query->matchCourseId($this->physId, true); $offerings = $this->searchSession->getCourseOfferingsByQuery($query); $this->assertFalse($offerings->hasNext()); diff --git a/application/test/banner/course/Term/Catalog/SessionTest.php b/application/test/banner/course/Term/Catalog/SessionTest.php index b168e9b6..de2143df 100755 --- a/application/test/banner/course/Term/Catalog/SessionTest.php +++ b/application/test/banner/course/Term/Catalog/SessionTest.php @@ -38,11 +38,11 @@ protected function setUp(): void { $this->session = self::$courseManager->getTermCatalogSession(); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200890'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200890'); } /** diff --git a/application/test/banner/course/Term/Lookup/CombinedSessionTest.php b/application/test/banner/course/Term/Lookup/CombinedSessionTest.php index e4b01d44..4c1a8b15 100755 --- a/application/test/banner/course/Term/Lookup/CombinedSessionTest.php +++ b/application/test/banner/course/Term/Lookup/CombinedSessionTest.php @@ -31,11 +31,11 @@ protected function getSession() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200890'); - $this->springTermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200920'); - $this->badTermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200866'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200890'); + $this->springTermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200920'); + $this->badTermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200866'); $this->session = self::$courseManager->getTermLookupSession(); $this->session->useComparativeView(); @@ -196,7 +196,7 @@ public function testGetTerms() { $terms = $this->session->getTerms(); $this->assertInstanceOf('osid_course_TermList', $terms); - $this->assertEquals(14, $terms->available()); + $this->assertEquals(16, $terms->available()); $this->assertInstanceOf('osid_course_Term', $terms->getNextTerm()); $this->assertInstanceOf('osid_course_Term', $terms->getNextTerm()); } diff --git a/application/test/banner/course/Term/Lookup/SessionTest.php b/application/test/banner/course/Term/Lookup/SessionTest.php index 18061b9b..29ea475f 100755 --- a/application/test/banner/course/Term/Lookup/SessionTest.php +++ b/application/test/banner/course/Term/Lookup/SessionTest.php @@ -31,11 +31,11 @@ protected function getSession() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200890'); - $this->springTermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200920'); - $this->badTermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200866'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200890'); + $this->springTermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200920'); + $this->badTermId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200866'); $this->session = self::$courseManager->getTermLookupSessionForCatalog($this->mcugId); diff --git a/application/test/banner/course/TermTest.php b/application/test/banner/course/TermTest.php index cf947632..9538fade 100755 --- a/application/test/banner/course/TermTest.php +++ b/application/test/banner/course/TermTest.php @@ -31,9 +31,9 @@ protected function getObject() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200890'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200890'); $this->session = self::$courseManager->getTermLookupSessionForCatalog($this->mcugId); $this->object = $this->session->getTerm($this->termId); diff --git a/application/test/banner/course/Topic/Lookup/CombinedSessionTest.php b/application/test/banner/course/Topic/Lookup/CombinedSessionTest.php index 1ee6c798..6061ba8f 100755 --- a/application/test/banner/course/Topic/Lookup/CombinedSessionTest.php +++ b/application/test/banner/course/Topic/Lookup/CombinedSessionTest.php @@ -33,45 +33,45 @@ protected function getSession() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getTopicLookupSession(); $this->session->useComparativeView(); $this->session->useFederatedCourseCatalogView(); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/GEOL0300'); - $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/CHEM0104'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.GEOL0300'); + $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.CHEM0104'); - $this->physSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/PHYS'); - $this->geolSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/GEOL'); - $this->chemSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); + $this->physSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.PHYS'); + $this->geolSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.GEOL'); + $this->chemSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); - $this->physDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->geolDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/GEOL'); - $this->chemDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/CHEM'); + $this->physDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->geolDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.GEOL'); + $this->chemDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.CHEM'); - $this->dedReqId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/DED'); - $this->sciReqId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/SCI'); + $this->dedReqId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.DED'); + $this->sciReqId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.SCI'); - $this->ccBlockId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/block/CC'); + $this->ccBlockId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.block.CC'); - $this->nsciDivId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/NSCI'); - $this->artsDivId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/ARTS'); + $this->nsciDivId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.NSCI'); + $this->artsDivId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.ARTS'); - $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division'); - $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); - $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/block'); + $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.subject'); + $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.department'); + $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.division'); + $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement'); + $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.block'); - $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200893/90143'); - $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20663'); - $this->unknownOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/178293/2101'); + $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200893.90143'); + $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20663'); + $this->unknownOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.178293.2101'); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200893'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200893'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); @@ -341,7 +341,7 @@ public function testGetTopics() $topics = $this->session->getTopics(); $this->assertInstanceOf('osid_course_TopicList', $topics); $this->assertTrue($topics->hasNext()); - $this->assertEquals(17, $topics->available()); + $this->assertEquals(18, $topics->available()); $this->assertInstanceOf('osid_course_Topic', $topics->getNextTopic()); $this->assertInstanceOf('osid_course_Topic', $topics->getNextTopic()); } diff --git a/application/test/banner/course/Topic/Lookup/SessionTest.php b/application/test/banner/course/Topic/Lookup/SessionTest.php index 922aefdf..f120d5b6 100755 --- a/application/test/banner/course/Topic/Lookup/SessionTest.php +++ b/application/test/banner/course/Topic/Lookup/SessionTest.php @@ -33,46 +33,46 @@ protected function getSession() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->session = self::$courseManager->getTopicLookupSessionForCatalog($this->mcugId); - $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/PHYS0201'); - $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/GEOL0300'); - $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course/CHEM0104'); + $this->physId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.PHYS0201'); + $this->geolId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.GEOL0300'); + $this->chemId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:course.CHEM0104'); - $this->physSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/PHYS'); - $this->geolSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/GEOL'); - $this->chemSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/subject/CHEM'); + $this->physSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.PHYS'); + $this->geolSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.GEOL'); + $this->chemSubjId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.subject.CHEM'); - $this->physDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/PHYS'); - $this->geolDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/GEOL'); - $this->chemDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/department/CHEM'); + $this->physDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.PHYS'); + $this->geolDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.GEOL'); + $this->chemDeptId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.department.CHEM'); - $this->dedReqId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/DED'); - $this->sciReqId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/SCI'); + $this->dedReqId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.DED'); + $this->sciReqId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.SCI'); - $this->ugLevelId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/level/UG'); + $this->ugLevelId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.level.UG'); - $this->ccBlockId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/block/CC'); + $this->ccBlockId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.block.CC'); - $this->nsciDivId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/NSCI'); - $this->artsDivId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/division/ARTS'); + $this->nsciDivId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.NSCI'); + $this->artsDivId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.division.ARTS'); - $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division'); - $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); - $this->levelType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/level'); - $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/block'); + $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.subject'); + $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.department'); + $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.division'); + $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement'); + $this->levelType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.level'); + $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.block'); - $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200893/90143'); - $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/200420/20663'); - $this->unknownOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section/178293/2101'); + $this->physOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200893.90143'); + $this->geolOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.200420.20663'); + $this->unknownOfferingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:section.178293.2101'); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200893'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200893'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); diff --git a/application/test/banner/course/Topic/Search/OrderTest.php b/application/test/banner/course/Topic/Search/OrderTest.php index 7492f920..c499a11e 100755 --- a/application/test/banner/course/Topic/Search/OrderTest.php +++ b/application/test/banner/course/Topic/Search/OrderTest.php @@ -23,20 +23,20 @@ protected function setUp(): void { $this->wildcardStringMatchType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:search:wildcard'); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->session = self::$courseManager->getTopicSearchSessionForCatalog($this->mcugId); $this->object = $this->session->getTopicSearchOrder(); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200820'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200820'); $this->termType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:terms'); - $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division'); - $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); + $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.subject'); + $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.department'); + $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.division'); + $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement'); } /** diff --git a/application/test/banner/course/Topic/Search/QueryTest.php b/application/test/banner/course/Topic/Search/QueryTest.php index 6203ce5e..4208a6c4 100755 --- a/application/test/banner/course/Topic/Search/QueryTest.php +++ b/application/test/banner/course/Topic/Search/QueryTest.php @@ -23,22 +23,22 @@ protected function setUp(): void { $this->wildcardStringMatchType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:search:wildcard'); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->session = self::$courseManager->getTopicSearchSessionForCatalog($this->mcugId); $this->object = $this->session->getTopicQuery(); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200820'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200820'); $this->termType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:terms'); - $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division'); - $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); - $this->levelType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/level'); - $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/block'); + $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.subject'); + $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.department'); + $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.division'); + $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement'); + $this->levelType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.level'); + $this->blockType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.block'); } /** diff --git a/application/test/banner/course/Topic/Search/SearchTest.php b/application/test/banner/course/Topic/Search/SearchTest.php index 7428639f..5bbffdcf 100755 --- a/application/test/banner/course/Topic/Search/SearchTest.php +++ b/application/test/banner/course/Topic/Search/SearchTest.php @@ -23,20 +23,20 @@ protected function setUp(): void { $this->wildcardStringMatchType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:search:wildcard'); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->session = self::$courseManager->getTopicSearchSessionForCatalog($this->mcugId); $this->object = $this->session->getTopicSearch(); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200820'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200820'); $this->termType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:terms'); - $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division'); - $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); + $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.subject'); + $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.department'); + $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.division'); + $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement'); } /** @@ -68,8 +68,8 @@ public function testSearchWithinTopicResults() public function testSearchAmongTopics() { $topicList = new phpkit_id_ArrayIdList([ - new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/DED'), - new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic/requirement/SCI'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.DED'), + new phpkit_id_URNInetId('urn:inet:middlebury.edu:topic.requirement.SCI'), ]); $this->object->searchAmongTopics($topicList); diff --git a/application/test/banner/course/Topic/Search/SessionTest.php b/application/test/banner/course/Topic/Search/SessionTest.php index 1cfe2518..4a17f2fe 100755 --- a/application/test/banner/course/Topic/Search/SessionTest.php +++ b/application/test/banner/course/Topic/Search/SessionTest.php @@ -23,19 +23,19 @@ protected function setUp(): void { $this->wildcardStringMatchType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:search:wildcard'); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->session = self::$courseManager->getTopicSearchSessionForCatalog($this->mcugId); - $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term/200820'); + $this->termId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:term.200820'); $this->termType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:terms'); - $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/subject'); - $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/department'); - $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/division'); - $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic/requirement'); + $this->subjectType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.subject'); + $this->departmentType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.department'); + $this->divisionType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.division'); + $this->requirementType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:topic.requirement'); } /** diff --git a/application/test/banner/resource/Bin/Lookup/SessionTest.php b/application/test/banner/resource/Bin/Lookup/SessionTest.php index c548617b..97e3e4ad 100755 --- a/application/test/banner/resource/Bin/Lookup/SessionTest.php +++ b/application/test/banner/resource/Bin/Lookup/SessionTest.php @@ -37,8 +37,8 @@ protected function setUp(): void $this->manager = self::$courseManager->getResourceManager(); $this->session = $this->manager->getBinLookupSession(); - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); diff --git a/application/test/banner/resource/Resource/Lookup/PerCatalogSessionTest.php b/application/test/banner/resource/Resource/Lookup/PerCatalogSessionTest.php index 5a8d3f25..8b51fb73 100755 --- a/application/test/banner/resource/Resource/Lookup/PerCatalogSessionTest.php +++ b/application/test/banner/resource/Resource/Lookup/PerCatalogSessionTest.php @@ -31,24 +31,24 @@ protected function getSession() */ protected function setUp(): void { - $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MCUG'); - $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog/MIIS'); + $this->mcugId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MCUG'); + $this->miisId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:catalog.MIIS'); - $this->allBinId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/all'); + $this->allBinId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.all'); $this->manager = self::$courseManager->getResourceManager(); $this->session = $this->manager->getResourceLookupSessionForBin($this->mcugId); - $this->personType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/person'); - $this->roomType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/room'); - $this->buildingType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/building'); - $this->campusType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/campus'); - $this->placeType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place'); + $this->personType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.person'); + $this->roomType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.room'); + $this->buildingType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.building'); + $this->campusType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.campus'); + $this->placeType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place'); - $this->person1Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/person/WEBID1000002'); - $this->person2Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/person/WEBID1000007'); - $this->campusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/campus/M'); - $this->buildingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/building/MBH'); - $this->roomId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/room/MBH/538'); + $this->person1Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.person.WEBID1000002'); + $this->person2Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.person.WEBID1000007'); + $this->campusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.campus.M'); + $this->buildingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.building.MBH'); + $this->roomId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.room.MBH.538'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); @@ -146,7 +146,7 @@ public function testGetResourcesByPersonGenusType() $this->assertEquals(14, $resources->available()); $this->assertInstanceOf('osid_resource_Resource', $resources->getNextResource()); $resourceGenusType = $resources->getNextResource()->getGenusType(); - $this->assertEquals('genera:resource/person', $resourceGenusType->getIdentifier()); + $this->assertEquals('genera:resource.person', $resourceGenusType->getIdentifier()); $this->assertTrue($resourceGenusType->isEqual($this->personType)); } @@ -194,7 +194,7 @@ public function testGetResourcesByParentPersonGenusType() $this->assertEquals(14, $resources->available()); $this->assertInstanceOf('osid_resource_Resource', $resources->getNextResource()); $resourceGenusType = $resources->getNextResource()->getGenusType(); - $this->assertEquals('genera:resource/person', $resourceGenusType->getIdentifier()); + $this->assertEquals('genera:resource.person', $resourceGenusType->getIdentifier()); $this->assertTrue($resourceGenusType->isEqual($this->personType)); } diff --git a/application/test/banner/resource/Resource/Lookup/SessionTest.php b/application/test/banner/resource/Resource/Lookup/SessionTest.php index 8e28ae93..2c997561 100755 --- a/application/test/banner/resource/Resource/Lookup/SessionTest.php +++ b/application/test/banner/resource/Resource/Lookup/SessionTest.php @@ -31,21 +31,21 @@ protected function getSession() */ protected function setUp(): void { - $this->allBinId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/all'); + $this->allBinId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.all'); $this->manager = self::$courseManager->getResourceManager(); $this->session = $this->manager->getResourceLookupSession(); - $this->personType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/person'); - $this->roomType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/room'); - $this->buildingType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/building'); - $this->campusType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place/campus'); - $this->placeType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/place'); + $this->personType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.person'); + $this->roomType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.room'); + $this->buildingType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.building'); + $this->campusType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place.campus'); + $this->placeType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.place'); - $this->person1Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/person/WEBID1000002'); - $this->person2Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/person/WEBID1000007'); - $this->campusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/campus/M'); - $this->buildingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/building/MBH'); - $this->roomId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/place/room/MBH/538'); + $this->person1Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.person.WEBID1000002'); + $this->person2Id = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.person.WEBID1000007'); + $this->campusId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.campus.M'); + $this->buildingId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.building.MBH'); + $this->roomId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.place.room.MBH.538'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:osid.org:unknown_type'); $this->unknownId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:unknown_id'); @@ -143,7 +143,7 @@ public function testGetResourcesByPersonGenusType() $this->assertEquals(14, $resources->available()); $this->assertInstanceOf('osid_resource_Resource', $resources->getNextResource()); $resourceGenusType = $resources->getNextResource()->getGenusType(); - $this->assertEquals('genera:resource/person', $resourceGenusType->getIdentifier()); + $this->assertEquals('genera:resource.person', $resourceGenusType->getIdentifier()); $this->assertTrue($resourceGenusType->isEqual($this->personType)); } @@ -191,7 +191,7 @@ public function testGetResourcesByParentPersonGenusType() $this->assertEquals(14, $resources->available()); $this->assertInstanceOf('osid_resource_Resource', $resources->getNextResource()); $resourceGenusType = $resources->getNextResource()->getGenusType(); - $this->assertEquals('genera:resource/person', $resourceGenusType->getIdentifier()); + $this->assertEquals('genera:resource.person', $resourceGenusType->getIdentifier()); $this->assertTrue($resourceGenusType->isEqual($this->personType)); } diff --git a/application/test/banner/resource/Resource/PersonTest.php b/application/test/banner/resource/Resource/PersonTest.php index 6de1b632..edd35b18 100755 --- a/application/test/banner/resource/Resource/PersonTest.php +++ b/application/test/banner/resource/Resource/PersonTest.php @@ -36,10 +36,10 @@ protected function setUp(): void { $this->namesType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:person_names'); $this->unknownType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:unknown'); - $this->personType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource/person'); + $this->personType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:genera:resource.person'); $this->object = new banner_resource_Resource_Person( - new phpkit_id_Id('urn', 'middlebury.edu', 'person/12345'), + new phpkit_id_Id('urn', 'middlebury.edu', 'person.12345'), "O'Brien", 'Thaddeus', 'Peter Michael', @@ -50,7 +50,7 @@ protected function setUp(): void $this->names = $this->object->getResourceRecord($this->namesType); $this->object2 = new banner_resource_Resource_Person( - new phpkit_id_Id('urn', 'middlebury.edu', 'person/54321'), + new phpkit_id_Id('urn', 'middlebury.edu', 'person.54321'), 'Jones', 'Howard' ); @@ -147,7 +147,7 @@ public function testGetGenusType() $this->assertInstanceOf('osid_type_Type', $type); $this->assertEquals('urn', $type->getIdentifierNamespace()); $this->assertEquals('middlebury.edu', $type->getAuthority()); - $this->assertEquals('genera:resource/person', $type->getIdentifier()); + $this->assertEquals('genera:resource.person', $type->getIdentifier()); $this->assertTrue($type->isEqual($this->personType)); } } diff --git a/application/test/banner/resource/ResourceManagerTest.php b/application/test/banner/resource/ResourceManagerTest.php index cc255905..8e1ac4f4 100755 --- a/application/test/banner/resource/ResourceManagerTest.php +++ b/application/test/banner/resource/ResourceManagerTest.php @@ -31,7 +31,7 @@ protected function getManager() */ protected function setUp(): void { - $this->allBinId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource/all'); + $this->allBinId = new phpkit_id_URNInetId('urn:inet:middlebury.edu:resource.all'); $this->manager = self::$courseManager->getResourceManager(); } diff --git a/application/test/banner/sql/test_data.sql b/application/test/banner/sql/test_data.sql index 64633d33..86ba1d8f 100755 --- a/application/test/banner/sql/test_data.sql +++ b/application/test/banner/sql/test_data.sql @@ -18,6 +18,8 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- INSERT INTO `catalog_term` (`catalog_id`, `term_code`, `term_display_label`) VALUES +('BLSE', '200970', 'L'), +('BLSE', '201070', 'L'), ('MCUG', '200390', 'F'), ('MCUG', '200420', 'S'), ('MCUG', '200490', 'F'), @@ -101,6 +103,23 @@ INSERT INTO `catalog_term_match` (`catalog_id`, `term_code_match`, `term_display -- Dumping data for table `GTVINSM` -- +INSERT INTO `GTVINSM` (`GTVINSM_CODE`, `GTVINSM_DESC`, `GTVINSM_ACTIVITY_DATE`, `GTVINSM_USER_ID`, `GTVINSM_VR_MSG_NO`) VALUES +('BL', 'Blended', '2020-07-08', 'JENTHOMPSON', NULL), +('EJ', 'Japan SA mainly in English', '2010-10-11', 'KWEISS', NULL), +('ENGL', 'Japan SA in English', '2010-10-11', 'KWEISS', NULL), +('FON', 'Flexible Online', '2020-07-08', 'JENTHOMPSON', NULL), +('HX', 'Hyflex', '2020-07-08', 'JENTHOMPSON', NULL), +('HYB', 'Hybrid', '2014-09-12', 'KWEISS', NULL), +('JAPNS', 'Japan SA in language', '2010-10-11', 'KWEISS', NULL), +('JE', 'Japan SA mainly in Japanese', '2010-10-11', 'KWEISS', NULL), +('MM', 'Multimodal', '2020-07-08', 'JENTHOMPSON', NULL), +('ONASY', 'Asynchronous Online', '2022-07-27', 'JENTHOMPSON', NULL), +('ONL', 'Online', '2009-06-17', 'LEROYG', '8'), +('ONL5', 'Online, Half-Credit', '2023-01-03', 'JENTHOMPSON', NULL), +('PERS', 'In-Person', '2020-07-08', 'JENTHOMPSON', NULL), +('PERS5', 'In-Person, Half-Credit', '2022-03-30', 'JENTHOMPSON', NULL), +('SON', 'Scheduled Online', '2020-07-08', 'JENTHOMPSON', NULL), +('WAIVE', 'MIIS Course Waiver', '2010-10-11', 'KWEISS', '8'); -- -- Dumping data for table `GTVINTP` @@ -1414,8 +1433,10 @@ INSERT INTO `STVTERM` (`STVTERM_CODE`, `STVTERM_DESC`, `STVTERM_START_DATE`, `ST ('200923', 'Spring 09 Round 1-Check Status', '2009-02-09', '2009-05-19', '0809', '2008-10-29', '3', '2', '5', '2009', '0000-00-00', '0000-00-00', NULL, 'S'), ('200924', 'First Year Seminar Choices', '2009-02-09', '2009-05-19', '0809', '2008-12-15', '3', '2', '5', '2009', '0000-00-00', '0000-00-00', NULL, 'S'), ('200925', 'FY Preferences,ADVISING ONLY', '2009-02-09', '2009-05-19', '0809', '2008-12-15', '3', '2', '5', '2009', '0000-00-00', '0000-00-00', NULL, 'S'), +('200970', 'Summer 2009', '2009-06-10', '2009-08-08', '0910', '2008-12-19', '5', '7', '8', '2010', '2009-06-10', '2009-08-08', NULL, 'M'), ('200990', 'Fall 2009', '2009-09-07', '2009-12-15', '0910', '2009-04-01', '1', '9', '12', '2010', '0000-00-00', '0000-00-00', NULL, 'S'), ('200993', 'Fall 09: Round 1 -Check Status', '2009-09-07', '2009-12-15', '0910', '2009-04-01', '1', '9', '12', '2010', '0000-00-00', '0000-00-00', NULL, 'S'), +('201070', 'Summer 2010', '2010-06-16', '2010-08-06', '1011', '2009-12-11', '5', '7', '8', '2011', '2010-06-16', '2010-08-06', NULL, 'M'), ('201690', 'Fall 2016', '2016-09-07', '2016-12-15', '0910', '2016-04-01', '1', '9', '12', '2017', '0000-00-00', '0000-00-00', NULL, 'S'); -- diff --git a/application/test/bootstrap.php b/application/test/bootstrap.php deleted file mode 100644 index 59c83142..00000000 --- a/application/test/bootstrap.php +++ /dev/null @@ -1,6 +0,0 @@ -direct(); - } -} diff --git a/application/views/helpers/CsrfKey.php b/application/views/helpers/CsrfKey.php deleted file mode 100755 index 268c2c42..00000000 --- a/application/views/helpers/CsrfKey.php +++ /dev/null @@ -1,30 +0,0 @@ -direct(); - } -} diff --git a/application/views/helpers/FilterTopicsByType.php b/application/views/helpers/FilterTopicsByType.php deleted file mode 100755 index 3dd7686f..00000000 --- a/application/views/helpers/FilterTopicsByType.php +++ /dev/null @@ -1,26 +0,0 @@ -filterTopicsByType($topics, $type); - } -} diff --git a/application/views/helpers/FormatScheduleInfo.php b/application/views/helpers/FormatScheduleInfo.php deleted file mode 100755 index cb60d856..00000000 --- a/application/views/helpers/FormatScheduleInfo.php +++ /dev/null @@ -1,24 +0,0 @@ -view->escape($scheduleInfo)); - $scheduleInfo = preg_replace('/\([^\)]+\)/', '$0', $scheduleInfo); - - return $scheduleInfo; - } -} diff --git a/application/views/helpers/GetAvailabilityLink.php b/application/views/helpers/GetAvailabilityLink.php deleted file mode 100755 index a8e7a2f2..00000000 --- a/application/views/helpers/GetAvailabilityLink.php +++ /dev/null @@ -1,27 +0,0 @@ -config; - $bannerIdRecordType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:banner_identifiers'); - if (!empty($config->catalog->banner_web_url) && $courseOffering->hasRecordType($bannerIdRecordType)) { - $bannerIdRecord = $courseOffering->getCourseOfferingRecord($bannerIdRecordType); - - return 'View availability, prerequisites, and other requirements."; - } - - return null; - } -} diff --git a/application/views/helpers/GetOsidIdFromString.php b/application/views/helpers/GetOsidIdFromString.php deleted file mode 100755 index c77404be..00000000 --- a/application/views/helpers/GetOsidIdFromString.php +++ /dev/null @@ -1,26 +0,0 @@ -fromString($idString); - } -} diff --git a/application/views/helpers/GetStringFromOsidId.php b/application/views/helpers/GetStringFromOsidId.php deleted file mode 100755 index 667bc8f6..00000000 --- a/application/views/helpers/GetStringFromOsidId.php +++ /dev/null @@ -1,24 +0,0 @@ -toString($id); - } -} diff --git a/application/views/helpers/GetStringFromOsidType.php b/application/views/helpers/GetStringFromOsidType.php deleted file mode 100755 index cf2d17a6..00000000 --- a/application/views/helpers/GetStringFromOsidType.php +++ /dev/null @@ -1,24 +0,0 @@ -toString($type); - } -} diff --git a/application/views/helpers/GetUserDisplayName.php b/application/views/helpers/GetUserDisplayName.php deleted file mode 100755 index 2a91f0fa..00000000 --- a/application/views/helpers/GetUserDisplayName.php +++ /dev/null @@ -1,24 +0,0 @@ -getHelper()->getUserDisplayName(); - } -} diff --git a/application/views/helpers/GetUserEmail.php b/application/views/helpers/GetUserEmail.php deleted file mode 100755 index a27e1ebf..00000000 --- a/application/views/helpers/GetUserEmail.php +++ /dev/null @@ -1,24 +0,0 @@ -getHelper()->getUserEmail(); - } -} diff --git a/application/views/helpers/GetUserId.php b/application/views/helpers/GetUserId.php deleted file mode 100755 index ee39a6ae..00000000 --- a/application/views/helpers/GetUserId.php +++ /dev/null @@ -1,24 +0,0 @@ -getHelper()->getUserId(); - } -} diff --git a/application/views/helpers/IsAuthenticated.php b/application/views/helpers/IsAuthenticated.php deleted file mode 100755 index e30af684..00000000 --- a/application/views/helpers/IsAuthenticated.php +++ /dev/null @@ -1,32 +0,0 @@ -getHelper()->isAuthenticated(); - } catch (Exception $e) { - if (450 == $e->getCode()) { - return false; - } else { - throw $e; - } - } - } -} diff --git a/application/views/helpers/IsAuthenticationEnabled.php b/application/views/helpers/IsAuthenticationEnabled.php deleted file mode 100755 index d18c0906..00000000 --- a/application/views/helpers/IsAuthenticationEnabled.php +++ /dev/null @@ -1,32 +0,0 @@ -getHelper()->isAuthenticationEnabled(); - } catch (Exception $e) { - if (450 == $e->getCode()) { - return false; - } else { - throw $e; - } - } - } -} diff --git a/application/views/helpers/PathAsAbsoluteUrl.php b/application/views/helpers/PathAsAbsoluteUrl.php deleted file mode 100755 index 01f391ed..00000000 --- a/application/views/helpers/PathAsAbsoluteUrl.php +++ /dev/null @@ -1,35 +0,0 @@ -topicListAsArray($topicList); - } -} diff --git a/application/views/scripts/ItemPaginationControl.phtml b/application/views/scripts/ItemPaginationControl.phtml deleted file mode 100755 index d96c5739..00000000 --- a/application/views/scripts/ItemPaginationControl.phtml +++ /dev/null @@ -1,49 +0,0 @@ - - -pageCount): ?> -
-firstItemNumber; ?> - lastItemNumber; ?> - of totalItemCount; ?> - - -previous)): ?> - - First - | - - First | - - - -previous)): ?> - - < Previous - | - - < Previous | - - - -next)): ?> - - Next > - | - - Next > | - - - -next)): ?> - - Last - - - Last - - -
- diff --git a/application/views/scripts/SearchPaginationControl.phtml b/application/views/scripts/SearchPaginationControl.phtml deleted file mode 100755 index 3fe466e1..00000000 --- a/application/views/scripts/SearchPaginationControl.phtml +++ /dev/null @@ -1,38 +0,0 @@ - - -pageCount): ?> -
- -previous)): ?> - - < Previous - | - - < Previous | - - - -pagesInRange as $page): ?> - current): ?> - - - | - - | - - - - -next)): ?> - - Next > - - - Next > - -
- diff --git a/application/views/scripts/admin/antirequisites.phtml b/application/views/scripts/admin/antirequisites.phtml deleted file mode 100644 index 23e2cd63..00000000 --- a/application/views/scripts/admin/antirequisites.phtml +++ /dev/null @@ -1,132 +0,0 @@ -

Manage Anti-Requisites

-

« Back to Administration

- -

Anti-requisites are course-equivalency entries that indicate that a course can't be taken if another already has been. This is in contrast to most usage of equivalency which indicates that courses are the same thing. Anti-requisites listed below will be filtered out of cross-list entries for courses.

-

Please Note: Any changes made here will affect views for authenticated users immediately, but will not affect catalog archives or anonymous views until the next nightly sync.

- - - - - - - - - - - - - - - - - - -antirequisites as $antirequisite) { - print "\n\t"; - print "\n\t\t"; - print "\n\t\t"; - print "\n\t\t"; - print "\n\t\t"; - print "\n\t\t"; - print "\n\t\t"; - print "\n\t\t"; - - print "\n\t\t"; - print "\n\t"; -} -?> - -
Subject CodeCourse NumberSubject Code EquivalentCourse Number EquivalentDate AddedAdded ByCommentsActions
".$antirequisite['subj_code']."".$antirequisite['crse_numb']."".$antirequisite['subj_code_eqiv']."".$antirequisite['crse_numb_eqiv']."".$antirequisite['added_date']."".$antirequisite['added_by']."".$antirequisite['comments'].""; - print "\n\t\t\t
"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "'; - print "\n\t\t\t
"; - print "\n\t\t
- - -

Add a new anti-requisite

- -

Search for a subject code and course number to find related equivalencies.

-
- - - -
- -searchResults)): ?> -
- - - - - - - - - - - - - - - searchResults); - foreach ($this->searchResults as $eqiv) { - print "\n\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t"; - } - ?> - -
Add?Subject CodeCourse NumberSubject Code EquivalentCourse Number EquivalentDate AddedAdded ByComments
"; - if ($eqiv->antirequisite) { - print ""; - } else { - print ""; - } - print "\n\t\t\t"; - print $eqiv->SCREQIV_SUBJ_CODE; - print "\n\t\t\t"; - print $eqiv->SCREQIV_CRSE_NUMB; - print "\n\t\t\t"; - print $eqiv->SCREQIV_SUBJ_CODE_EQIV; - print "\n\t\t\t"; - print $eqiv->SCREQIV_CRSE_NUMB_EQIV; - print "\n\t\t\t"; - if ($eqiv->antirequisite) { - print $eqiv->added_date; - } - print "\n\t\t\t"; - if ($eqiv->antirequisite) { - print $eqiv->added_by; - } - print "\n\t\t\t"; - if ($eqiv->antirequisite) { - print $this->escape($eqiv->comments); - } else { - print ""; - } - print "\n\t\t\t
- - - - -
- diff --git a/application/views/scripts/admin/export.phtml b/application/views/scripts/admin/export.phtml deleted file mode 100644 index 1c823f67..00000000 --- a/application/views/scripts/admin/export.phtml +++ /dev/null @@ -1,54 +0,0 @@ -headLink(array('rel' => 'stylesheet', 'href' => $this->baseUrl('/StyleSheets/midd/Export.css'), 'media' => 'all')); - $this->headScript()->appendFile($this->baseUrl('javascript/export.js')); - $this->headScript()->appendFile($this->baseUrl('javascript/jquery-ui-1.12.1/jquery-ui.min.js')); -?> - -

Manage Catalog Export Configurations

- - -
-
- -
-

- or - Create a new configuration

-
- -"; - - if($this->catalogId) { - print ""; - print ""; - - print "
Error:
"; - - // Top nav - print ""; - print ""; - print ""; - print ""; - print "Revision history"; - - // Content - print "
"; - print "
    "; - print "
    Error:
    "; - - // Bottom nav - print ""; - print ""; - print ""; - print ""; - print "Revision history"; - } - - print ""; -?> diff --git a/application/views/scripts/admin/index.phtml b/application/views/scripts/admin/index.phtml deleted file mode 100755 index cffff662..00000000 --- a/application/views/scripts/admin/index.phtml +++ /dev/null @@ -1,9 +0,0 @@ -

    Course Catalog Administration

    - diff --git a/application/views/scripts/admin/masquerade.phtml b/application/views/scripts/admin/masquerade.phtml deleted file mode 100755 index 9a3ab0bf..00000000 --- a/application/views/scripts/admin/masquerade.phtml +++ /dev/null @@ -1,13 +0,0 @@ -

    Masquerade as another user

    - - -

     

    - -

    Current User: userName; ?> - -

    Enter the id of another user to act as them.

    -
    - - - -
    diff --git a/application/views/scripts/admin/terms.phtml b/application/views/scripts/admin/terms.phtml deleted file mode 100755 index e423d1a3..00000000 --- a/application/views/scripts/admin/terms.phtml +++ /dev/null @@ -1,69 +0,0 @@ -

    Manage Term Visibility

    - - -
    - -
    - -

    Please Note: Any changes made here will take effect during the next synchronization with Banner

    - - - - - - - - - - - - - -terms as $term) { - $numSections = intval($term['num_sections']); - $manuallyDisabled = intval($term['manually_disabled']); - $active = ($numSections && !$manuallyDisabled); - print "\n\t"; - print "\n\t\t"; - print "\n\t\t"; - print "\n\t\t"; - - print "\n\t\t"; - - print "\n\t\t"; - - print "\n\t"; -} -?> - -
    Term CodeDescriptionSectionsManual OverrideActive?
    ".$term['STVTERM_CODE']."".$term['STVTERM_DESC']."".$numSections.""; - print "\n\t\t\t
    "; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t"; - print "\n\t\t\t
    "; - print "\n\t\t
    "; - if ($active) { - print "Yes"; - } else { - print "No: "; - if ($manuallyDisabled) - print "Manually disabled. "; - if (!$numSections) - print "Zero sections. "; - } - print "\n\t\t
    diff --git a/application/views/scripts/catalogs/list.phtml b/application/views/scripts/catalogs/list.phtml deleted file mode 100755 index e65604fb..00000000 --- a/application/views/scripts/catalogs/list.phtml +++ /dev/null @@ -1,10 +0,0 @@ - 'catalogs', - 'action' => 'view'); - -while ($this->catalogs->hasNext()) { - $catalog = $this->catalogs->getNextCourseCatalog(); - $params['catalog'] = $this->getStringFromOsidId($catalog->getId()); - print "\n\t

    ".$catalog->getDisplayName()."

    "; - print "\n\t
    ".$catalog->getDescription()."
    "; -} diff --git a/application/views/scripts/catalogs/listxml.phtml b/application/views/scripts/catalogs/listxml.phtml deleted file mode 100755 index 2ecc04ed..00000000 --- a/application/views/scripts/catalogs/listxml.phtml +++ /dev/null @@ -1,32 +0,0 @@ - - - - '.$this->title.' - '.$this->pathAsAbsoluteUrl($this->url()).' - - '.date('r').' - Course Catalog - http://blogs.law.harvard.edu/tech/rss -'; - -$params = array( 'controller' => 'catalogs', - 'action' => 'view'); - -while ($this->catalogs->hasNext()) { - $catalog = $this->catalogs->getNextCourseCatalog(); - print "\n\t\t"; - print "\n\t\t\t".$this->escape($catalog->getDisplayName()).""; - $params['catalog'] = $this->getStringFromOsidId($catalog->getId()); - print "\n\t\t\t".$this->pathAsAbsoluteUrl($this->url($params)).""; - print "\n\t\t\tgetDescription()."]]>"; - print "\n\t\t\t".$this->getStringFromOsidId($catalog->getId()).""; - print "\n\t\t"; -} - - -?> - - - diff --git a/application/views/scripts/catalogs/view.phtml b/application/views/scripts/catalogs/view.phtml deleted file mode 100755 index 783bb834..00000000 --- a/application/views/scripts/catalogs/view.phtml +++ /dev/null @@ -1,29 +0,0 @@ -url(array( - 'controller' => 'offerings', - 'action' => 'search', - 'catalog' => $this->getStringFromOsidId($this->catalog->getId()) - )); - -$termUrl = $this->url(array( - 'controller' => 'terms', - 'action' => 'list', - 'catalog' => $this->getStringFromOsidId($this->catalog->getId()) - )); -$courseUrl = $this->url(array( - 'controller' => 'courses', - 'action' => 'list', - 'catalog' => $this->getStringFromOsidId($this->catalog->getId()) - )); -$offeringUrl = $this->url(array( - 'controller' => 'offerings', - 'action' => 'list', - 'catalog' => $this->getStringFromOsidId($this->catalog->getId()) - )); - -print "\n\t
    ".$this->escape($this->catalog->getDescription())."
    "; - -print "\n\t"; -print "\n\t"; -print "\n\t"; -print "\n\t"; diff --git a/application/views/scripts/courses/list.phtml b/application/views/scripts/courses/list.phtml deleted file mode 100755 index d333a5dd..00000000 --- a/application/views/scripts/courses/list.phtml +++ /dev/null @@ -1,10 +0,0 @@ - 'view' - ); - -while ($this->courses->hasNext()) { - $course = $this->courses->getNextCourse(); - $params['course'] = $this->getStringFromOsidId($course->getId()); - print "\n\t

    ".$course->getDisplayName()."

    "; - print "\n\t
    ".$course->getDescription()."
    "; -} diff --git a/application/views/scripts/courses/view.phtml b/application/views/scripts/courses/view.phtml deleted file mode 100755 index c9c8967e..00000000 --- a/application/views/scripts/courses/view.phtml +++ /dev/null @@ -1,90 +0,0 @@ -render('schedules/bookmark_control.phtml'); - -// print "\n\t
    ".$this->escape($this->course->getDisplayName())."
    "; -print "\n\t

    ".$this->escape($this->course->getTitle())."

    "; -if ($this->course->getDescription()) - print "\n\t
    ".$this->course->getDescription()."
    "; - -print "\n\t
    "; -// Topics -$topicParams = array( - 'controller' => 'topics', - 'action' => 'view', - 'offering' => null - ); -if (isset($this->term)) { - $topicParams['term'] = $this->getStringFromOsidId($this->term->getId()); -} else if (isset($this->linkTermId)) { - $topicParams['term'] = $this->getStringFromOsidId($this->linkTermId); -} - -print "\n\t
    Subject:
    "; -print "\n\t\t
    "; -foreach ($this->subjectTopics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "url($topicParams)."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} -print "
    "; - -print "\n\t\t
    Department:
    "; -print "\n\t\t
    "; -foreach ($this->departmentTopics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "url($topicParams)."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} -print "
    "; - -print "\n\t\t
    Division:
    "; -print "\n\t\t
    "; -foreach ($this->divisionTopics as $topic) { -// $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); -// print "url($topicParams)."\">"; - print $this->escape($topic->getDisplayName()); -// print " "; -} -print "
    "; - -print "\n\t\t
    Requirements Fulfilled:
    "; -print "\n\t\t
    "; -foreach ($this->requirementTopics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "url($topicParams)."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} -print "
    "; - -if (isset($this->alternates)) { - $alternateType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:alternates'); - - print "\n\t\t
    Equivalent Courses:
    "; - print "\n\t\t
    "; - while ($this->alternates->hasNext()) { - try { - $alternate = $this->alternates->getNextCourse(); - $altParams['course'] = $this->getStringFromOsidId($alternate->getId()); - print "url($altParams)."\">"; - print $this->escape($alternate->getDisplayName()); - print ""; - if ($alternate->hasRecordType($alternateType)) { - $alternateRecord = $alternate->getCourseRecord($alternateType); - if ($alternateRecord->isPrimary()) { - print " * "; - } - } - print "
    \n\t\t"; - } catch(osid_NotFoundException $e) { - } - } - print "
    "; -} - -print "\n\t
    "; - -print $this->render('offerings.phtml'); diff --git a/application/views/scripts/courses/viewxml.phtml b/application/views/scripts/courses/viewxml.phtml deleted file mode 100755 index d49df5f5..00000000 --- a/application/views/scripts/courses/viewxml.phtml +++ /dev/null @@ -1,93 +0,0 @@ - - - - '.$this->escape($this->title).' - '.$this->pathAsAbsoluteUrl($this->url()).' - - '.date('r').' - Course Catalog - http://blogs.law.harvard.edu/tech/rss -'; - -$courseIdString = $this->getStringFromOsidId($this->course->getId()); -$catalogIdString = $this->getStringFromOsidId($this->menuCatalogSelectedId); -print "\n\t\t"; - -print "\n\t\t\t".$this->escape($this->course->getTitle()).""; - - -$viewUrl = $this->pathAsAbsoluteUrl($this->url(array('controller' => 'courses', 'action' => 'view', 'catalog' => $catalogIdString, 'course' => $courseIdString))); -print "\n\t\t\t".$viewUrl.""; -print "\n\t\t\t".$viewUrl.""; - -print "\n\t\t\tcourse->getDescription(); -print "]]>"; - -$topicParams = array( - 'controller' => 'topics', - 'action' => 'view', - 'catalog' => $catalogIdString, -); -foreach ($this->subjectTopics as $topic) { - $topicIdString = $this->getStringFromOsidId($topic->getId()); - $topicTypeString = $this->getStringFromOsidType($topic->getGenusType()); - $topicParams['topic'] = $topicIdString; - print "\n\t\t\tpathAsAbsoluteUrl($this->url($topicParams))."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} -foreach ($this->departmentTopics as $topic) { - $topicIdString = $this->getStringFromOsidId($topic->getId()); - $topicTypeString = $this->getStringFromOsidType($topic->getGenusType()); - $topicParams['topic'] = $topicIdString; - print "\n\t\t\tpathAsAbsoluteUrl($this->url($topicParams))."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} -foreach ($this->requirementTopics as $topic) { - $topicIdString = $this->getStringFromOsidId($topic->getId()); - $topicTypeString = $this->getStringFromOsidType($topic->getGenusType()); - $topicParams['topic'] = $topicIdString; - print "\n\t\t\tpathAsAbsoluteUrl($this->url($topicParams))."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} - -if (isset($this->alternates)) { - $alternateType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:alternates'); - while ($this->alternates->hasNext()) { - try { - $alternate = $this->alternates->getNextCourse(); - $alternateIdString = $this->getStringFromOsidId($alternate->getId()); - $altParams['course'] = $alternateIdString; - print "\n\t\t\thasRecordType($alternateType)) { - $alternateRecord = $alternate->getCourseRecord($alternateType); - if ($alternateRecord->isPrimary()) { - print ' is_primary="true"'; - } else { - print ' is_primary="false"'; - } - } - print '>'; - print $this->escape($alternate->getDisplayName()); - print ""; - } catch(osid_NotFoundException $e) { - } - } -} - -print $this->render('offeringsxml.phtml'); - -print "\n\t\t"; - - -?> - - - diff --git a/application/views/scripts/error/error.phtml b/application/views/scripts/error/error.phtml deleted file mode 100644 index 0f73c2d7..00000000 --- a/application/views/scripts/error/error.phtml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Error - - -

    An error occurred

    -

    An error occurred; please try again later.

    - - diff --git a/application/views/scripts/export/newconfig.phtml b/application/views/scripts/export/newconfig.phtml deleted file mode 100644 index 9b691150..00000000 --- a/application/views/scripts/export/newconfig.phtml +++ /dev/null @@ -1,21 +0,0 @@ -headLink(array('rel' => 'stylesheet', 'href' => $this->baseUrl('/StyleSheets/midd/Export.css'), 'media' => 'all')); - $this->headScript()->appendFile($this->baseUrl('javascript/export.js')); -?> - -

    Create New Catalog Export Configuration

    - - -
    -
    - - - -
    diff --git a/application/views/scripts/export/revisiondiff.phtml b/application/views/scripts/export/revisiondiff.phtml deleted file mode 100644 index 9ee1653d..00000000 --- a/application/views/scripts/export/revisiondiff.phtml +++ /dev/null @@ -1,33 +0,0 @@ -headLink(array('rel' => 'stylesheet', 'href' => $this->baseUrl('javascript/jsdifflib/diffview.css'), 'media' => 'all')); - $this->headScript()->appendFile($this->baseUrl('javascript/jsdifflib/difflib.js')); - $this->headScript()->appendFile($this->baseUrl('javascript/jsdifflib/diffview.js')); -?> - -
    - - diff --git a/application/views/scripts/export/revisionhistory.phtml b/application/views/scripts/export/revisionhistory.phtml deleted file mode 100644 index 232d1e30..00000000 --- a/application/views/scripts/export/revisionhistory.phtml +++ /dev/null @@ -1,34 +0,0 @@ -headLink(array('rel' => 'stylesheet', 'href' => $this->baseUrl('/StyleSheets/midd/Export.css'), 'media' => 'all')); - $this->headScript()->appendFile($this->baseUrl('javascript/jsdifflib/difflib.js')); - $this->headScript()->appendFile($this->baseUrl('javascript/revision_history.js')); -?> - -

    Revision history for configLabel; ?>

    - - -
    - -
    - -test; - if ($this->revisions) { - print ""; - print ""; - foreach($this->revisions as $revision) { - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - } - print "
    CompareDateAuthorNoteJSONActions
    " . $revision['last_saved'] . "" . $revision['user_disp_name'] . "" . $revision['note'] . " $revision['id']), 'export_viewjson') . "' target=_blank>View JSON
    "; - } - else { - print "No revisions in history for config: " . $this->configLabel; - } -?> diff --git a/application/views/scripts/export/viewjson.phtml b/application/views/scripts/export/viewjson.phtml deleted file mode 100644 index 826112fd..00000000 --- a/application/views/scripts/export/viewjson.phtml +++ /dev/null @@ -1,10 +0,0 @@ -headLink(array('rel' => 'stylesheet', 'href' => $this->baseUrl('/StyleSheets/midd/Export.css'), 'media' => 'all')); -?> - -revision) { - print "

    Viewing revision: " . $this->revision['last_saved'] . "

    "; - print "
    " . $this->revision['json_data'] . "
    "; - } - ?> diff --git a/application/views/scripts/index/index.phtml b/application/views/scripts/index/index.phtml deleted file mode 100644 index 3f06f315..00000000 --- a/application/views/scripts/index/index.phtml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - My first Zend Framework App - - -

    Hello, World!

    - - diff --git a/application/views/scripts/offerings.phtml b/application/views/scripts/offerings.phtml deleted file mode 100755 index fa0af3bd..00000000 --- a/application/views/scripts/offerings.phtml +++ /dev/null @@ -1,63 +0,0 @@ -"; -if (isset($this->term)) { - print "\n\t

    ".$this->offeringsTitle." in ".$this->term->getDisplayName()."

    "; - if (isset($this->offeringsForAllTermsUrl)) { - print "\n\t"; - } -} else { - print "\n\t

    ".$this->offeringsTitle."

    "; -} - -$offeringParams = array( - 'controller' => 'offerings', - 'action' => 'view', - 'course' => null, - 'topic' => null, - 'resource' => null - ); -while ($this->offerings->hasNext()) { - $offering = $this->offerings->getNextCourseOffering(); - if (!isset($currentTerm) || $currentTerm->getId() != $offering->getTermId()) { - $currentTerm = $offering->getTerm(); - print "\n

    ".$currentTerm->getDisplayName()."

    "; - } - - $offeringParams['offering'] = $this->getStringFromOsidId($offering->getId()); - - if (isset($this->offering) && $offering->getId()->isEqual($this->offering->getId())) - print "\n\t
    "; - else - print "\n\t
    "; - - print "".$this->escape($offering->getDisplayName()).""; - print " ".$this->escape($offering->getGenusType()->getDisplayName()).""; - - if (!isset($this->hideOfferingInstructors) || !$this->hideOfferingInstructors) { - if ($offering->hasRecordType($instructorsType)) { - $instructorsRecord = $offering->getCourseOfferingRecord($instructorsType); - $instructors = $instructorsRecord->getInstructors(); - if ($instructors->hasNext()) { - $instNames = array(); - while ($instructors->hasNext()) { - $instructor = $instructors->getNextResource(); - if ($instructor->hasRecordType($namesType)) { - $namesRecord = $instructor->getResourceRecord($namesType); - $instNames[] = $this->escape($namesRecord->getSurname()); - } else { - $instNames[] = $this->escape($instructor->getDisplayName()); - } - } - print " ("; - print implode(', ', $instNames); - print ")"; - } - } - } - print "
    "; -} -print "\n\t
    "; diff --git a/application/views/scripts/offerings/list.phtml b/application/views/scripts/offerings/list.phtml deleted file mode 100755 index b3d9bbc7..00000000 --- a/application/views/scripts/offerings/list.phtml +++ /dev/null @@ -1 +0,0 @@ -headScript()->appendFile( - $this->url(array(), null, true).'javascript/jquery.expander.js', - 'text/javascript' -); -$this->headScript()->appendScript( - " - $('document').ready(function() { - $('div.description').expander({ - slicePoint: 140, // default is 100 - expandPrefix: '... ', // text to come before the expand link - expandText: 'read more', // default is 'read more...' - userCollapseText: '[collapse]' // default is '[collapse expanded text]' - }); - }); - ", - 'text/javascript' -); - - $formParams = array( - 'controller' => 'offerings', - 'action' => 'search', - 'term' => null, - 'department' => null, - 'subject' => null, - 'division' => null, - 'requirement' => null, - 'level' => null, - 'days' => null, - 'time_start' => null, - 'time_end' => null, - 'keywords' => null, - 'page' => null, - 'submit' => null - ); -?> - -
    - - - - - - - - - - - - - - -requirements->hasNext()) { ?> - - - - - - - - - - -searchParams['days'])) { ?> - - - - - - - - - - - - - - - -blocks->hasNext()) { ?> - - - - - - -instructionMethods->hasNext()) { ?> - - - - - - - - - - - -campuses) && $this->campuses->hasNext()) { -?> - - - - - - - - - - - - -
    By Term: - -
    By Subject/Department: - -
    Satisfies Requirements: -
    (Leave all blank for no preference)
    -
    -requirements->hasNext()) { - if (!($i % 5)) - print "\n\t\t\t
    \n\t\t\t
    "; - - $topic = $this->requirements->getNextTopic(); - print "\n\t\t\t\tselectedRequirementIds as $selectedId) { - if ($topic->getId()->isEqual($selectedId)) { - print " checked='checked'"; - break; - } - } - print "/>
    "; - - $i++; -} -?> -
    -
    Keywords: - -
    By default results only have to match one of the supplied keywords. Use a plus (+) before a word to require it or a minus (-) to exclude it. Use an asterisk (*) as a wildcard.
    -
    Days of the week: - - - - - - - - -
    Leave all unchecked if no preference.
    -
    - -
    - -
    Time: - - - -
    Type: -
    (Leave all blank for no preference)
    -
    -genusTypes->hasNext()) { - if (!($i % 5)) - print "\n\t\t\t
    \n\t\t\t
    "; - - $type = $this->genusTypes->getNextType(); - print "\n\t\t\t\tselectedGenusTypes as $selectedType) { - if ($type->isEqual($selectedType)) { - print " checked='checked'"; - break; - } - } - print "/>
    "; - - $i++; -} -?> -
    -
    Additional Details: -
    (Leave all blank for no preference)
    -
    -blocks->hasNext()) { - if (!($i % 5)) - print "\n\t\t\t
    \n\t\t\t
    "; - - $topic = $this->blocks->getNextTopic(); - print "\n\t\t\t\tselectedBlockIds as $selectedId) { - if ($topic->getId()->isEqual($selectedId)) { - print " checked='checked'"; - break; - } - } - print "/>
    "; - - $i++; -} -?> -
    -
    Course Modality: -
    (Leave all blank for no preference)
    -
    -instructionMethods->hasNext()) { - if (!($i % 5)) - print "\n\t\t\t
    \n\t\t\t
    "; - - $topic = $this->instructionMethods->getNextTopic(); - print "\n\t\t\t\tselectedInstructionMethodIds as $selectedId) { - if ($topic->getId()->isEqual($selectedId)) { - print " checked='checked'"; - break; - } - } - print "/>
    "; - - $i++; -} -?> -
    -
    Level: -
    (Leave all blank for no preference)
    -
    -levels->hasNext()) { - if (!($i % 5)) - print "\n\t\t\t
    \n\t\t\t
    "; - - $topic = $this->levels->getNextTopic(); - print "\n\t\t\t\tselectedLevelIds as $selectedId) { - if ($topic->getId()->isEqual($selectedId)) { - print " checked='checked'"; - break; - } - } - print "/>
    "; - - $i++; -} -?> -
    -
    Campus: -
    (Leave all blank for no preference)
    -
    -campuses->hasNext()) { - if (!($i % 5)) - print "\n\t\t\t
    \n\t\t\t
    "; - - $campus = $this->campuses->getNextResource(); - print "\n\t\t\t\tselectedCampusIds as $selectedId) { - if ($campus->getId()->isEqual($selectedId)) { - print " checked='checked'"; - break; - } - } - print "/>
    "; - - $i++; -} -?> -
    -
    -
    - -paginator)) { - -?> -

    Results

    - -paginator)) { - print "
    No Matches
    "; -} - -print $this->paginationControl($this->paginator, 'Sliding', 'ItemPaginationControl.phtml', array('search_params' => $this->searchParams)); ?> - - - -paginator as $section) { - $offeringParams = array( - 'controller' => 'offerings', - 'action' => 'view', - 'offering' => $this->getStringFromOsidId($section->getId()) - ); - $resourceParams = array( - 'controller' => 'resources', - 'action' => 'view', - 'term' => $this->getStringFromOsidId($term->getId()), - 'offering' => null - ); - - $term = $section->getTerm(); - $termUrl = $this->url(array( - 'controller' => 'terms', - 'action' => 'view', - 'term' => $this->getStringFromOsidId($term->getId()), - 'offering' => null - )); - $topicParams = array( - 'controller' => 'topics', - 'action' => 'view', - 'offering' => null, - 'term' => $this->getStringFromOsidId($term->getId()) - ); - - // Topics - $allTopics = $this->topicListAsArray($section->getTopics()); -?> - - - - - - -
    - escape($section->getDisplayName()); ?> -hasRecordType($alternateType)) { - $record = $section->getCourseOfferingRecord($alternateType); - if ($record->hasAlternates()) { - if ($record->isPrimary()) { - print " * "; - } - - $alternates = $record->getAlternates(); - print "\n\t\t\t\t
    Cross-Listed As:"; - while ($alternates->hasNext()) { - print "\n\t\t\t\t
    "; - $alternate = $alternates->getNextCourseOffering(); - $offeringParams['offering'] = $this->getStringFromOsidId($alternate->getId()); - print "url($offeringParams)."\">"; - print $this->escape($alternate->getDisplayName()); - print " "; - if ($alternate->hasRecordType($alternateType)) { - $alternateRecord = $alternate->getCourseOfferingRecord($alternateType); - if ($alternateRecord->isPrimary()) { - print " * "; - } - } - } - } -} - -print "\n\t
    "; - -print "\n\t\t
    Type:
    "; -print "\n\t\t
    ".$this->escape($section->getGenusType()->getDisplayName())."
    "; - -$topics = $this->filterTopicsByType($allTopics, new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/instruction_method")); -if (!empty($topics)) { - print "\n\t\t
    Course Modality:
    "; - print "\n\t\t
    "; - foreach ($topics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "url($topicParams)."\">"; - print $this->escape($topic->getDisplayName()); - print " "; - } - print "
    "; -} - -print "\n\t\t
    Term:
    "; -+print "\n\t\t
    "; -+// print "\n\t\t\t"; -+print $this->escape($term->getDisplayName()); -+// print ""; -+print "\n\t\t
    "; -print "\n\t\t
    Department:
    "; -print "\n\t\t
    "; -$topics = $this->filterTopicsByType($allTopics, new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/department")); -foreach ($topics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "url($topicParams)."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} -print "
    "; - -print "\n\t\t
    Requirements Fulfilled:
    "; -print "\n\t\t
    "; -$topics = $this->filterTopicsByType($allTopics, new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/requirement")); -foreach ($topics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "url($topicParams)."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} -print "
    "; - -print "\n\t
    "; - -$topics = $this->filterTopicsByType($allTopics, new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/block")); -if (!empty($topics)) { - print "\n\t\t
    Additional Details:
    "; - print "\n\t\t
    "; - foreach ($topics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "url($topicParams)."\">"; - print $this->escape($topic->getDisplayName()); - print " "; - } - print "
    "; -} - -?> - - -
    - bookmarks_CourseId = $section->getCourseId(); - $this->bookmarks_IsCourseSaved = false; - print $this->render('schedules/bookmark_control.phtml'); - ?> -
    escape($section->getTitle())); ?>
    -
    getDescription(); ?>
    -"; - -$instructorsType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors'); -if ($section->hasRecordType($instructorsType)) { - $instructorsRecord = $section->getCourseOfferingRecord($instructorsType); - print "\n\t\t
    Instructors:
    "; - print "\n\t\t
    "; - $instructors = $instructorsRecord->getInstructors(); - while ($instructors->hasNext()) { - $instructor = $instructors->getNextResource(); - $resourceParams['resource'] = $this->getStringFromOsidId($instructor->getId()); - print "url($resourceParams)."\">"; - print $this->escape($instructor->getDisplayName()); - print " "; - } - print "
    "; -} - -if ($section->hasLocation()) { - print "\n\t\t
    Location:
    "; - try { - $locationResource = $section->getLocation(); - print "\n\t\t
    "; -// $resourceParams['resource'] = $this->getStringFromOsidId($locationResource->getId()); -// print "url($resourceParams)."\">"; - print $this->escape($locationResource->getDisplayName()); -// print " "; - if ($locationResource->getDescription()) - print " (".$this->escape($locationResource->getDescription()).")"; - print "\n\t\t
    "; - } catch (osid_OperationFailedException $e) { - print "\n\t\t
    ".$this->escape($section->getLocationInfo())."
    "; - } -} else if ($section->getLocationInfo()) { - print "\n\t\t
    Location:
    "; - print "\n\t\t
    ".$this->escape($section->getLocationInfo())."
    "; -} - -$scheduleInfo = $section->getScheduleInfo(); -if (!empty($scheduleInfo)) { - print "\n\t\t
    Schedule:
    "; - print "\n\t\t
    ".$this->formatScheduleInfo($scheduleInfo)."
    "; -} - -$availabilityLink = $this->getAvailabilityLink($section); -if (!empty($availabilityLink)) { - print "\n\t\t
    Availability:
    "; - print "\n\t\t
    "; - print $availabilityLink; - print "\n\t\t
    "; -} - -// print "\n\t
    Subject:
    "; -// print "\n\t\t
    "; -// $topics = $this->filterTopicsByType($allTopics, new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/subject")); -// foreach ($topics as $topic) { -// $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); -// print "url($topicParams)."\">"; -// print $this->escape($topic->getDisplayName()); -// print " "; -// } -// print "
    "; - -// print "\n\t\t
    Division:
    "; -// print "\n\t\t
    "; -// $topics = $this->filterTopicsByType($allTopics, new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/division")); -// foreach ($topics as $topic) { -// $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); -// print "url($topicParams)."\">"; -// print $this->escape($topic->getDisplayName()); -// print " "; -// } -// print "
    "; - -print "\n\t"; - - -?> -
    - -paginationControl($this->paginator, 'Sliding', 'SearchPaginationControl.phtml', array('search_params' => $this->searchParams)); ?> - - diff --git a/application/views/scripts/offerings/searchxml.phtml b/application/views/scripts/offerings/searchxml.phtml deleted file mode 100755 index 14792cce..00000000 --- a/application/views/scripts/offerings/searchxml.phtml +++ /dev/null @@ -1,220 +0,0 @@ -pathAsAbsoluteUrl($view->url(array( - 'controller' => 'terms', - 'action' => 'view', - 'term' => $view->getStringFromOsidId($term->getId()), - 'offering' => null - ))); - - $start_date = $term->getStartTime()->format('Y-m-d'); - $end_date = $term->getEndTime()->format('Y-m-d'); - // PHP >= 5.3 -// $span = $term->getEndTime()->diff($term->getStartTime()); -// $weeks = ceil($span->days / 7); - // PHP < 5.3 - $weeks = ceil(abs($term->getEndTime()->format('U') - $term->getStartTime()->format('U'))/60/60/24/7); - - print "\n".$tabs."getStringFromOsidId($term->getId())."\" href=\"".$termUrl."\" start_date=\"".$start_date."\" end_date=\"".$end_date."\" weeks=\"".$weeks."\">"; - print $view->escape($term->getDisplayName()); - print " "; -} - -print ' - - - '.$this->feedTitle.' - '.$this->feedLink.' - - '.date('r').' - Course Catalog - http://blogs.law.harvard.edu/tech/rss -'; - -if (isset($this->previousTerm)) - printTerm($this, $this->previousTerm, 'previous_term', "\t\t"); -if (isset($this->term)) - printTerm($this, $this->term, 'chosen_term', "\t\t"); -if (isset($this->nextTerm)) - printTerm($this, $this->nextTerm, 'next_term', "\t\t"); - - -if (isset($this->terms)) { - print "\n\t\t"; - while ($this->terms->hasNext()) { - printTerm($this, $this->terms->getNextTerm()); - } - print "\n\t\t"; -} - -print "\n"; - -$alternateType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:alternates'); -while ($this->sections->hasNext()) { - $section = $this->sections->getNextCourseOffering(); - - $offeringParams = array( - 'controller' => 'offerings', - 'action' => 'view', - 'offering' => $this->getStringFromOsidId($section->getId()) - ); - $resourceParams = array( - 'controller' => 'resources', - 'action' => 'view', - 'offering' => null - ); - - $term = $section->getTerm(); - $topicParams = array( - 'controller' => 'topics', - 'action' => 'view', - 'offering' => null, - 'term' => $this->getStringFromOsidId($term->getId()) - ); - - // Topics - $allTopics = $this->topicListAsArray($section->getTopics()); -?> - - - <?php print $this->escape($section->getDisplayName()); ?> - pathAsAbsoluteUrl($this->url($offeringParams)); ?> - getDescription(); ?>]]> - escape($section->getTitle()); ?> - escape($this->getStringFromOsidId($section->getId())); ?> -hasRecordType($alternateType)) { - $record = $section->getCourseOfferingRecord($alternateType); - print "\n\t\t\t"; - print $record->isPrimary()?"true":"false"; - print " "; - if ($record->hasAlternates()) { - $alternates = $record->getAlternates(); - while ($alternates->hasNext()) { - $alternate = $alternates->getNextCourseOffering(); - $offeringParams['offering'] = $this->getStringFromOsidId($alternate->getId()); - print "\n\t\t\tgetStringFromOsidId($alternate->getId())."\" href=\"".$this->pathAsAbsoluteUrl($this->url($offeringParams))."\">"; - print $this->escape($alternate->getDisplayName()); - print " "; - } - } -} - -print "\n\t\t\tgetStringFromOsidType($section->getGenusType())."\" "; -print "href=\"".$this->pathAsAbsoluteUrl($this->url($offeringParams))."\">"; -print $this->escape($section->getGenusType()->getDisplayName()); -print " "; - -printTerm($this, $term); - -$topicType = new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/subject"); -$topicTypeString = $this->getStringFromOsidType($topicType); -$topics = $this->filterTopicsByType($allTopics, $topicType); -foreach ($topics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "\n\t\t\tgetStringFromOsidId($topic->getId())."\" href=\"".$this->pathAsAbsoluteUrl($this->url($topicParams))."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} - -$topicType = new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/department"); -$topicTypeString = $this->getStringFromOsidType($topicType); -$topics = $this->filterTopicsByType($allTopics, $topicType); -foreach ($topics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "\n\t\t\tgetStringFromOsidId($topic->getId())."\" href=\"".$this->pathAsAbsoluteUrl($this->url($topicParams))."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} - -$topicType = new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/requirement"); -$topicTypeString = $this->getStringFromOsidType($topicType); -$topics = $this->filterTopicsByType($allTopics, $topicType); -foreach ($topics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "\n\t\t\tgetStringFromOsidId($topic->getId())."\" href=\"".$this->pathAsAbsoluteUrl($this->url($topicParams))."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} - -$topicType = new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/level"); -$topicTypeString = $this->getStringFromOsidType($topicType); -$topics = $this->filterTopicsByType($allTopics, $topicType); -foreach ($topics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "\n\t\t\tgetStringFromOsidId($topic->getId())."\" href=\"".$this->pathAsAbsoluteUrl($this->url($topicParams))."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} - -$topicType = new phpkit_type_URNInetType("urn:inet:middlebury.edu:genera:topic/block"); -$topicTypeString = $this->getStringFromOsidType($topicType); -$topics = $this->filterTopicsByType($allTopics, $topicType); -foreach ($topics as $topic) { - $topicParams['topic'] = $this->getStringFromOsidId($topic->getId()); - print "\n\t\t\tgetStringFromOsidId($topic->getId())."\" href=\"".$this->pathAsAbsoluteUrl($this->url($topicParams))."\">"; - print $this->escape($topic->getDisplayName()); - print " "; -} - - -$instructorsType = new phpkit_type_URNInetType('urn:inet:middlebury.edu:record:instructors'); -if ($section->hasRecordType($instructorsType)) { - $instructorsRecord = $section->getCourseOfferingRecord($instructorsType); - $instructors = $instructorsRecord->getInstructors(); - while ($instructors->hasNext()) { - $instructor = $instructors->getNextResource(); - $resourceParams['resource'] = $this->getStringFromOsidId($instructor->getId()); - print "\n\t\t\tgetStringFromOsidId($instructor->getId())."\" href=\"".$this->pathAsAbsoluteUrl($this->url($resourceParams))."\">"; - print $this->escape($instructor->getDisplayName()); - print " "; - } -} - -if ($section->hasLocation()) { - try { - $locationResource = $section->getLocation(); - $resourceParams['resource'] = $this->getStringFromOsidId($locationResource->getId()); - print "\n\t\t\tgetStringFromOsidId($locationResource->getId())."\" href=\"".$this->pathAsAbsoluteUrl($this->url($resourceParams))."\">"; - print $this->escape($locationResource->getDisplayName()); - print " "; -// if ($locationResource->getDescription()) -// print "(".$this->escape($locationResource->getDescription()).")"; -// print "\n\t\t"; - } catch (osid_OperationFailedException $e) { - print "\n\t\t\t".$this->escape($section->getLocationInfo()).""; - } -} else if ($section->getLocationInfo()) { - print "\n\t\t\t".$this->escape($section->getLocationInfo()).""; -} -print "\n\t\t\thasRecordType($weeklyScheduleType)) { - $scheduleRecord = $section->getCourseOfferingRecord($weeklyScheduleType); - if ($scheduleRecord->hasMeetingStartDate()) { - print ' meeting_start_date="' . $scheduleRecord->getMeetingStartDate()->format('Y-m-d') . '"'; - } - if ($scheduleRecord->hasMeetingEndDate()) { - print ' meeting_end_date="' . $scheduleRecord->getMeetingEndDate()->format('Y-m-d') . '"'; - } -} -print ">".$this->escape($section->getScheduleInfo()).""; - -$properties = $section->getProperties(); -while ($properties->hasNext()) { - $property = $properties->getNextProperty(); - print "\n\t\t\t"; - print "\n\t\t\t\t".$property->getDisplayName().""; - print "\n\t\t\t\t".$property->getDisplayLabel().""; - print "\n\t\t\t\tgetDescription()."]]>"; - print "\n\t\t\t\tgetValue()."]]>"; - print "\n\t\t\t"; -} -?> - - - - - diff --git a/application/views/scripts/offerings/view.phtml b/application/views/scripts/offerings/view.phtml deleted file mode 100755 index 03be6099..00000000 --- a/application/views/scripts/offerings/view.phtml +++ /dev/null @@ -1,226 +0,0 @@ -render('schedules/bookmark_control.phtml'); - -// print "\n\t
    ".$this->escape($this->offering->getDisplayName())."
    "; -print "\n\t

    ".nl2br($this->escape($this->offering->getTitle()))."

    "; -if ($this->offering->getDescription()) - print "\n\t
    ".$this->offering->getDescription()."
    "; - -$term = $this->offering->getTerm(); - -$resourceParams = array( - 'controller' => 'resources', - 'action' => 'view', - 'offering' => null, - 'term' => $this->getStringFromOsidId($term->getId()), - ); - -$termUrl = $this->url(array( - 'controller' => 'terms', - 'action' => 'view', - 'term' => $this->getStringFromOsidId($term->getId()), - 'offering' => null - )); -$offeringParams = array( - 'controller' => 'offerings', - 'action' => 'view', - 'course' => null - ); - -print "\n\t"; - - -print "\n\t
    "; -$properties = $this->offering->getProperties(); -while ($properties->hasNext()) { - $property = $properties->getNextProperty(); - print "\n\t\t
    "; - print $property->getDisplayName(); - if ($property->getDisplayName() != $property->getDisplayLabel()) - print " (".$property->getDisplayLabel().")"; - print ":
    "; - print "\n\t\t
    ".$property->getValue()."
    "; -} -print "\n\t
    "; - -print "\n
    "; - -$course = $this->offering->getCourse(); -$courseParams = array( - 'controller' => 'courses', - 'action' => 'view', - 'course' => $this->getStringFromOsidId($course->getId()), - 'offering' => null - ); -print "\n\t

    Course

    "; -print "\n\t"; - - -if (isset($this->parentOffering)) { - $offeringParams['offering'] = $this->getStringFromOsidId($this->parentOffering->getId()); - print "\n\t

    Offering

    "; -print "\n\t\t"; -} diff --git a/application/views/scripts/offeringsxml.phtml b/application/views/scripts/offeringsxml.phtml deleted file mode 100755 index d8dced08..00000000 --- a/application/views/scripts/offeringsxml.phtml +++ /dev/null @@ -1,64 +0,0 @@ -"; -$offeringParams = array( - 'controller' => 'offerings', - 'action' => 'view', - 'course' => null, - 'topic' => null, - 'resource' => null - ); -while ($this->offerings->hasNext()) { - $offering = $this->offerings->getNextCourseOffering(); - $offeringIdString =$this->getStringFromOsidId($offering->getId()); - if (!isset($currentTerm) || $currentTerm->getId() != $offering->getTermId()) { - if (isset($currentTerm)) - print "\n\t\t\t\t"; - - $currentTerm = $offering->getTerm(); - print "\n\t\t\t\tgetStringFromOsidId($currentTerm->getId())."\" name=\"".$this->escape($currentTerm->getDisplayName())."\">"; - } - - $offeringParams['offering'] = $offeringIdString; - - print "\n\t\t\t\t\t"; - print "\n\t\t\t\t\t\t".$this->escape($offering->getDisplayName()).""; - print "\n\t\t\t\t\t\t".$this->escape($offering->getTitle()).""; - print "\n\t\t\t\t\t\tgetDescription()."]]>"; - $type = $offering->getGenusType(); - print "\n\t\t\t\t\t\tgetStringFromOsidType($type)."\">".$this->escape($type->getDisplayName()).""; - $term = $offering->getTerm(); - print "\n\t\t\t\t\t\tgetStringFromOsidId($term->getId())."\">".$this->escape($term->getDisplayName()).""; - print "\n\t\t\t\t\t\tgetStringFromOsidId($offering->getLocationId())."\">".$this->escape($offering->getLocationInfo()).""; - print "\n\t\t\t\t\t\t".$this->escape($offering->getScheduleInfo()).""; - - if (!isset($this->hideOfferingInstructors) || !$this->hideOfferingInstructors) { - if ($offering->hasRecordType($instructorsType)) { - $instructorsRecord = $offering->getCourseOfferingRecord($instructorsType); - $instructors = $instructorsRecord->getInstructors(); - if ($instructors->hasNext()) { - $instNames = array(); - while ($instructors->hasNext()) { - $instructor = $instructors->getNextResource(); - print "\n\t\t\t\t\t\tgetStringFromOsidId($instructor->getId())."\">"; - if ($instructor->hasRecordType($namesType)) { - $namesRecord = $instructor->getResourceRecord($namesType); - print "\n\t\t\t\t\t\t\t".$this->escape($namesRecord->getGivenName()).""; print "\n\t\t\t\t\t\t\t".$this->escape($namesRecord->getSurname()).""; - } - print "\n\t\t\t\t\t\t\t".$this->escape($instructor->getDisplayName()).""; - - print "\n\t\t\t\t\t\t"; - } - } - } - } - print "\n\t\t\t\t\t"; -} -print "\n\t\t\t\t"; -print "\n\t\t\t"; diff --git a/application/views/scripts/resources/view.phtml b/application/views/scripts/resources/view.phtml deleted file mode 100755 index 307a75d3..00000000 --- a/application/views/scripts/resources/view.phtml +++ /dev/null @@ -1,3 +0,0 @@ -resource->getDescription()) - print "\n\t
    ".$this->escape($this->resource->getDescription())."
    "; diff --git a/application/views/scripts/schedules/bookmark_control.phtml b/application/views/scripts/schedules/bookmark_control.phtml deleted file mode 100755 index dead22af..00000000 --- a/application/views/scripts/schedules/bookmark_control.phtml +++ /dev/null @@ -1,87 +0,0 @@ -isAuthenticationEnabled()) { ?> - -
    - -isAuthenticated()) { - /********************************************************* - * Bookmark - *********************************************************/ -// print "\n\t\t

    Bookmark this course

    "; - print "\n\t"; -} else { - $return = $this->pathAsAbsoluteUrl($this->url()); - if (count($_GET)) - $return .= '?'.http_build_query($_GET); - - print ' Log-in to save'; -} - -if (!defined('BOOKMARK_CONTROLS_SCRIPT_ADDED')) { - $this->headScript()->captureStart(); -?> - -$(function() { // on DOM ready - - $('.save_course a').click(function () { - var clickedAnchor = $(this); - var courseId = $(this).siblings('input[name=course_id]').val(); - - $.ajax({ - url: clickedAnchor.attr('href'), - success: function () { - if (clickedAnchor.hasClass('save')) { - bookmarks_show_forget(courseId); - } else { - bookmarks_show_save(courseId); - } - } - - }); - return false; - }); - -}); - -function bookmarks_show_save(courseId) { - $('.save_course input[name=course_id][value="' + courseId + '"]').siblings('a.save').show(); - $('.save_course input[name=course_id][value="' + courseId + '"]').siblings('a.forget').hide(); -} -function bookmarks_show_forget(courseId) { - $('.save_course input[name=course_id][value="' + courseId + '"]').siblings('a.save').hide(); - $('.save_course input[name=course_id][value="' + courseId + '"]').siblings('a.forget').show(); -} - -function bookmark_controls_show_forget(courseId) { - -} - -headScript()->captureEnd(); - define('BOOKMARK_CONTROLS_SCRIPT_ADDED', true); -} - -?> - -
    - - diff --git a/application/views/scripts/schedules/bookmarks.phtml b/application/views/scripts/schedules/bookmarks.phtml deleted file mode 100755 index 46fe146f..00000000 --- a/application/views/scripts/schedules/bookmarks.phtml +++ /dev/null @@ -1,199 +0,0 @@ -bookmarked_courses->hasNext()) { - print "\n\t

    You have no starred courses for this term. Please url(array('controller' => 'offerings', 'action' => 'search', 'catalog' => $this->catalogIdString, 'term' => $this->termIdString), null, true)."\">search for courses and star interesting ones first.

    "; -} -?> - - - - - $(function() { // on DOM ready - - $("a.remove_course").click(function () { - if (confirm('Do you want to remove the bookmark for this course?')) { - var li = $(this).parents('li.bookmarked_course'); - $.ajax({ - url: $(this).attr('href'), - success: function () { - li.remove(); - } - }); - } - return false; - }); - - - /********************************************************* - * Set up the add-sections dialog controls - *********************************************************/ - - $(".add_section_dialog").each(function () { - var form = $(this).siblings("form.add_to_schedule_form"); - var addDialog = $(this).dialog({ - autoOpen: false, - width: 600, - modal: true, - close: function(event, ui) { - $(this).find("select.section_set").empty(); - } - }); - - form.data("addDialog", addDialog); - }); - - $("form.add_to_schedule_form select").change(function () { - var form = $(this).parent("form"); - var addDialog = form.data("addDialog"); - var scheduleId = $(this).val(); - $(this).val(""); - - addDialog.find("select.section_set").empty(); - getSectionSets(addDialog, scheduleId); - addDialog.dialog("open"); - }); - - }); - - function getSectionSets (dialog, scheduleId) { - var lookupUrl = dialog.children("input[name=section_lookup_url]").val(); - var courseId = dialog.children("input[name=course_id]").val(); - - dialog.find("input[name=schedule_id]").val(scheduleId); - - $.getJSON(lookupUrl, {course: courseId, schedule_id: scheduleId}, function (data, textStatus) { - populateSectionSetSelect(dialog, scheduleId, data); - populateSectionTypes(dialog, scheduleId, dialog.find("select.section_set").val(), data); - }); - } - - function populateSectionSetSelect(dialog, scheduleId, data) { - var selectList = dialog.find("select.section_set"); - selectList.empty(); - var i = 0; - for (var linkSetId in data) { - i++; - var option = $(''); - if (data[linkSetId].selected) { - option.attr('selected', 'selected'); - } - selectList.append(option); - } - if (i > 1) { - dialog.find("div.section_set").show(); - } else { - dialog.find("div.section_set").hide(); - } - - selectList.data('section_data', data); - selectList.data('dialog', dialog); - selectList.data('scheduleId', scheduleId); - selectList.change(function() { - populateSectionTypes($(this).data('dialog'), $(this).data('scheduleId'), $(this).val(), $(this).data('section_data')); - }); - } - - function populateSectionTypes (dialog, scheduleId, linkSetId, data) { - - var typesList = dialog.find("ul.section_types"); - typesList.empty(); - var i = 0; - for (var linkTypeId in data[linkSetId]['types']) { - var sectionType = data[linkSetId]['types'][linkTypeId]; - - var typeListItem = $('
  • '); - typesList.append(typeListItem); - var typeList = $('
      '); - typeListItem.append(typeList); - - for (var j = 0; j < sectionType.length; j++) { - var section = sectionType[j]; - - var item = $('
    • '); - typeList.append(item); - var radio = $(''); - item.append(radio); - if (section.selected) { - radio.attr('checked', 'checked'); - } - item.append(' '); - item.append(section.name); - item.append(' '); - item.append(''); - if (section.conflicts) { - var conflictsClass = ' conflicting'; - var conflictNames = '
          ' + section.conflictString; - } else { - var conflictsClass = ''; - var conflictNames = ''; - } - item.append(''); - item.append(''); - if (section.availability) { - item.append(''); - } - } - - i++; - } - } - -headScript()->appendScript(ob_get_clean()); diff --git a/application/views/scripts/schedules/catalog_select.phtml b/application/views/scripts/schedules/catalog_select.phtml deleted file mode 100755 index b6a9aa83..00000000 --- a/application/views/scripts/schedules/catalog_select.phtml +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/application/views/scripts/schedules/email-dialog.phtml b/application/views/scripts/schedules/email-dialog.phtml deleted file mode 100755 index c36cc8dd..00000000 --- a/application/views/scripts/schedules/email-dialog.phtml +++ /dev/null @@ -1,174 +0,0 @@ -emailEnabled) { - return; -} -?> - - - - - - - $(function() { // on DOM ready - - /********************************************************* - * Email controls - *********************************************************/ - $(".email_dialog").each(function() { - var button = $(this).siblings(".email_button"); - var emailDialog = $(this).dialog({ - autoOpen: false, - width: 700, - modal: true, - position: 'top' - }); - - button.data("emailDialog", emailDialog); - }); - $(".email_button").click(function(){ - var emailDialog = $(this).data('emailDialog'); - emailDialog.dialog("open"); - - // Store the original subject. - var field = emailDialog.find('input[name=subject]'); - if (!field.data('orig')) { - field.data('orig', field.val()); - } - - // Store the original message. - var field = emailDialog.find('textarea[name=message]'); - if (!field.data('orig')) { - field.data('orig', field.val()); - } - - return false; - }); - - $(".email_dialog form").submit(function() { - var to = $(this).find("input[name=to]").val(); - to = to.replace(/^\s*/, '').replace(/\s*$/, ''); - - if (!to.length) { - if (!confirm("You didn't specify a recipient.\n\nClick 'Cancel' to add one or 'Ok' to send only to yourself.")) { - return false; - } - } - if (to.length && !validateEmail(to)) { - alert("It doesn't look like you specified a valid email address in the 'To:' field."); - return false; - } - - // Submit the form asynchronously, clear the to & body, then close. - var form = $(this); - var emailDialog = form.parents('.email_dialog'); - - $.ajax({ - type: "POST", - url: form.attr('action'), - data: form.serialize(), - success: function (data, textStatus, req) { - if (data.length) { - alert(data); - } - - // Clear the form. - form.find('input[name=to]').val(''); - - var field = form.find('input[name=subject]'); - field.val(field.data('orig')); - - var field = form.find('textarea[name=message]'); - field.val(field.data('orig')); - }, - error: function(req, textStatus, errorThrown) { - emailDialog.dialog('open'); - alert("Couldn't send email.\n\n" + req.responseText); - } - }); - - // Close the dialog. - emailDialog.dialog('close'); - return false; - }); - - }); - - /** - * Validate the email field - * - * @param string emailString - * @return boolean - */ - function validateEmail (emailString) { - var addresses = emailString.split(","); - for (var i = 0; i < addresses.length; i++) { - var address = addresses[i].replace(/^\s*/, '').replace(/\s*$/, ''); - if (!validateEmailAddress(address)) { - return false; - } - } - return true; - } - - /** - * Validate an email address. - * By "sectrean" at http://stackoverflow.com/questions/46155/validate-email-address-in-javascript/46181#46181 - * - * @param string email - * @return boolean - */ - function validateEmailAddress (email) { - var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - return email.match(re); - } - - -headScript()->appendScript(ob_get_clean()); - define('EMAIL_DIALOG_JS_ADDED', true); -} diff --git a/application/views/scripts/schedules/email-html.phtml b/application/views/scripts/schedules/email-html.phtml deleted file mode 100755 index 77671e6a..00000000 --- a/application/views/scripts/schedules/email-html.phtml +++ /dev/null @@ -1,8 +0,0 @@ - - -

      escape($this->messageBody)); ?>

      -
      - Weekly Schedule Image - render('schedules/email-offering-list.phtml'); ?> - - diff --git a/application/views/scripts/schedules/email-offering-list.phtml b/application/views/scripts/schedules/email-offering-list.phtml deleted file mode 100755 index cdf84e7a..00000000 --- a/application/views/scripts/schedules/email-offering-list.phtml +++ /dev/null @@ -1,32 +0,0 @@ -schedule->getOfferings(); - -if (!count($offerings)) { - return; -} -print "\n\t\t"; -foreach ($offerings as $offering) { - print "\n\t\t\t"; - - print "\n\t\t"; - - print "\n\t\t"; - - print "\n\t\t"; - print "\n\t\t"; - - print "\n\t\t\t"; -} -print "\n\t\t
      "; - print "\n\t\t\t 'offerings', 'action' => 'view', 'offering' => $this->getStringFromOsidId($offering->getId())))."' target='_blank'>"; - print $this->escape($offering->getDisplayName()); - print "
      CRN: ".$this->escape($offering->getCourseReferenceNumber()); - print "\n\t\t
      "; - print "\n\t\t\t 'offerings', 'action' => 'view', 'offering' => $this->getStringFromOsidId($offering->getId())))."' target='_blank'>"; - print nl2br($this->escape($offering->getTitle())); - print ""; - print "\n\t\t".$this->formatScheduleInfo($offering->getScheduleInfo())."".nl2br($this->escape($offering->getLocationInfo()))."
      "; diff --git a/application/views/scripts/schedules/email-preview.phtml b/application/views/scripts/schedules/email-preview.phtml deleted file mode 100755 index 6b0791d5..00000000 --- a/application/views/scripts/schedules/email-preview.phtml +++ /dev/null @@ -1,5 +0,0 @@ -url(array('action' => 'png', 'schedule_id' => $this->schedule->getId()))."' alt='Weekly Schedule Image'/>"; - -print $this->render('schedules/email-offering-list.phtml'); diff --git a/application/views/scripts/schedules/email-text.phtml b/application/views/scripts/schedules/email-text.phtml deleted file mode 100755 index f4575db0..00000000 --- a/application/views/scripts/schedules/email-text.phtml +++ /dev/null @@ -1,21 +0,0 @@ -messageBody; ?> - - --------------------------------------------------------- -schedule->getOfferings(); - -foreach ($offerings as $offering) { - $nameAndSeparator = $offering->getDisplayName()." - "; - $paddingString = str_repeat(' ', strlen($nameAndSeparator)); - print "\n".$nameAndSeparator; - print str_replace("\n", "\n".$paddingString, $offering->getTitle()); - - if ($this->schedule->hasCollisions($offering->getId())) - print "\n\t** conflicting **"; - - print "\n\t".str_replace("\n", "\n\t", $offering->getScheduleInfo()); - print "\n\t".str_replace("\n", "\n\t", $offering->getLocationInfo()); - - print "\n"; -} diff --git a/application/views/scripts/schedules/generate-image.phtml b/application/views/scripts/schedules/generate-image.phtml deleted file mode 100755 index eb0f5395..00000000 --- a/application/views/scripts/schedules/generate-image.phtml +++ /dev/null @@ -1,208 +0,0 @@ -events as $event) { - if ($event['dayOfWeek'] == 0) - $hasSunday = true; - if ($event['dayOfWeek'] == 6) - $hasSaturday = true; -} -$numDays = 7; -$startDay = 0; -$endDay = 6; -if (!$hasSunday) { - $numDays--; - $startDay = 1; -} -if (!$hasSaturday) { - $numDays--; - $endDay = 5; -} - - -/********************************************************* - * Set up our image. - *********************************************************/ - -$width = 910; -if ($this->width) - $width = $this->width; -$height = 800; -if ($this->height) - $height = $this->height; - -if (empty($this->fontFile)) { - throw new Exception("No font-file configured."); -} -if (!file_exists($this->fontFile)) { - throw new Exception("Font-file missing, not found at ".$this->fontFile); -} - -$im = ImageCreateTrueColor($width, $height); - -// Set colors -$black = ImageColorAllocate($im, 0, 0, 0); -$white = ImageColorAllocate($im, 255, 255, 255); -$orange = ImageColorAllocate($im, 255, 200, 0); -$yellow = ImageColorAllocate($im, 255, 255, 0); -$tan = ImageColorAllocate($im, 255, 255, 190); -$ltgrey = ImageColorAllocate($im, 235, 235, 235); -$grey = ImageColorAllocate($im, 200, 200, 200); -$dkgrey = ImageColorAllocate($im, 140, 140, 140); -$blue = ImageColorAllocate($im, 0, 90, 207); -$red = ImageColorAllocate($im, 255, 50, 50); -$darkred = ImageColorAllocate($im, 0, 0, 0); -$ltblue = ImageColorAllocate($im, 175, 210, 255); - - -// Background color -imagefilledrectangle($im, 0, 0, $width, $height, $white); - -$timeWidth = 97; -$gridWidth = $width - $timeWidth; -$dayWidth = floor($gridWidth / $numDays); - -$firstHour = floor($this->minTime/3600); -$gridStartTime = $firstHour * 3600; -$hoursToShow = ceil(($this->maxTime - $this->minTime)/3600); - -$headerHeight = 48; -$gridHeight = $height - $headerHeight; -$hourHeight = floor($gridHeight / $hoursToShow); - -// header row & time column -imagefilledrectangle($im, 1, 1, $width - 2, $headerHeight - 1, $ltgrey); -imagefilledrectangle($im, 1, 1, $timeWidth - 1, $height - 2, $ltgrey); - -// Hours -for ($h = 0; $h < $hoursToShow; $h++) { - $top = $headerHeight + ($hourHeight * $h); - $bottom = $top + $hourHeight; - imagerectangle($im, 0, $top, $width, $bottom, $grey); -} - -// Days -for ($d = $startDay; $d < $numDays; $d++) { - $left = $timeWidth + ($dayWidth * $d); - $right = $left + $dayWidth; - imagerectangle($im, $left, 0, $right, $height, $black); -} - -// Day Labels -$days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); -for ($d = $startDay; $d <= $endDay; $d++) { - $label = $days[$d]; - - $dayPosition = $d - $startDay; - $left = $timeWidth + ($dayWidth * $dayPosition); - $size = 24; - $bb = imagettfbbox($size, 0, $this->fontFile, $label); - $textWidth = $bb[2] - $bb[0]; - ImageTTFText($im, $size, 0, round($left + (($dayWidth - $textWidth)/2)), $headerHeight - 5, $black, $this->fontFile, $label); -} - -// Hour Labels -for($i = 0; $i < $hoursToShow; $i++) { - $hour = $firstHour + $i; - if ($hour < 12) - $hourString = $hour.':00 am'; - else if ($hour == 12) - $hourString = '12:00 pm'; - else - $hourString = ($hour - 12).':00 pm'; - - $size = 12; - $bb = imagettfbbox($size, 0, $this->fontFile, $hourString); - $textWidth = $bb[2] - $bb[0]; - $textHeight = $bb[1] - $bb[5]; - $top = $headerHeight + ($hourHeight * $i) + $textHeight + intval(($hourHeight - $textHeight)/2); - $left = $timeWidth - $textWidth - 10; - ImageTTFText($im, $size, 0, $left, $top, $black, $this->fontFile, $hourString); -} - -/********************************************************* - * Events - *********************************************************/ - -foreach ($this->events as $event) { - if ($event['collisions']) { - $eventColor = $red; - $eventBorderColor = $darkred; - } else { - $eventColor = $ltblue; - $eventBorderColor = $blue; - } - $dayPosition = $event['dayOfWeek'] - $startDay; - $left = $timeWidth + ($dayWidth * $dayPosition) + 1; // 1px margin - $right = $left + $dayWidth - 2; // 1px margin - - $top = timePosition($gridStartTime, $hourHeight, $event['startTime']) + $headerHeight; - $bottom = timePosition($gridStartTime, $hourHeight, $event['endTime']) + $headerHeight; - - imagefilledrectangle($im, $left, $top, $right, $bottom, $eventColor); - imagerectangle($im, $left, $top, $right, $bottom, $eventBorderColor); - - $start = Time::withSeconds($event['startTime']); - $end = Time::withSeconds($event['endTime']); - $string = $start->hour12().':'.str_pad($start->minute(), 2, '0', STR_PAD_LEFT).'-'.$end->hour12().':'.str_pad($end->minute(), 2, '0', STR_PAD_LEFT); - $size = 10; - $bb = imagettfbbox($size, 0, $this->fontFile, $string); - $textWidth = $bb[2] - $bb[0]; - $textHeight = $bb[1] - $bb[5]; - $textTop = $top + $textHeight + 3; - $textLeft = $left + round(($dayWidth - $textWidth)/2); - ImageTTFText($im, $size, 0, $textLeft, $textTop, $black, $this->fontFile, $string); - - $size = 10; - $bb = imagettfbbox($size, 0, $this->fontFile, $event['name']); - $textWidth = $bb[2] - $bb[0]; - $textHeight = $bb[1] - $bb[5]; - $textTop = $top + $textHeight + 16; - $textLeft = $left + round(($dayWidth - $textWidth)/2); - ImageTTFText($im, $size, 0, $textLeft, $textTop, $black, $this->fontFile, $event['name']); - - $size = 10; - $bb = imagettfbbox($size, 0, $this->fontFile, $event['location']); - $textWidth = $bb[2] - $bb[0]; - $textHeight = $bb[1] - $bb[5]; - $textTop = $top + $textHeight +$textHeight + 22; - $textLeft = $left + round(($dayWidth - $textWidth)/2); - ImageTTFText($im, $size, 0, $textLeft, $textTop, $black, $this->fontFile, $event['location']); - - $size = 10; - $bb = imagettfbbox($size, 0, $this->fontFile, $event['crn']); - $textWidth = $bb[2] - $bb[0]; - $textHeight = $bb[1] - $bb[5]; - //$textTop = $top + $textHeight +$textHeight + 34; - $textTop += 14; - $textLeft = $left + round(($dayWidth - $textWidth)/3); - ImageTTFText($im, $size, 0, $textLeft, $textTop, $black, $this->fontFile, "CRN: ".$event['crn']); - -} - -function timePosition($gridStartTime, $hourHeight, $time) { - $diff = $time - $gridStartTime; - $hours = $diff/3600; - return round($hours * $hourHeight); -} - - -/********************************************************* - * Final Outlines. - *********************************************************/ - -// Background Outline -imagerectangle($im, 0, 0, $width - 1, $height - 1, $black); -// Header & time outlines -imagerectangle($im, 0, 0, $width, $headerHeight, $black); -imagerectangle($im, 0, 0, $timeWidth, $height, $black); - - -/********************************************************* - * Save the image for output by another view. - *********************************************************/ -$this->image = $im; diff --git a/application/views/scripts/schedules/index.phtml b/application/views/scripts/schedules/index.phtml deleted file mode 100755 index cda689ed..00000000 --- a/application/views/scripts/schedules/index.phtml +++ /dev/null @@ -1,39 +0,0 @@ -headScript()->appendScript(" - $(function() { // on DOM ready - - $('#schedules_term_choice select').change(function () { - window.location = $(this).val(); - }); - - }); -"); -$this->headTitle('Schedule Planner'); -?> - - - - - - - - - - - - - - - - - -
      -
      - render('schedules/catalog_select.phtml'); ?> - render('schedules/term_select.phtml'); ?> -
      -
      Saved Courses in render('schedules/selected_term_name.phtml'); ?>Schedules for render('schedules/selected_term_name.phtml'); ?>
      - render('schedules/bookmarks.phtml'); ?> - - render('schedules/schedules.phtml'); ?> -
      diff --git a/application/views/scripts/schedules/png.phtml b/application/views/scripts/schedules/png.phtml deleted file mode 100755 index acce8583..00000000 --- a/application/views/scripts/schedules/png.phtml +++ /dev/null @@ -1,6 +0,0 @@ -render('schedules/generate-image.phtml'); - -imagepng($this->image, null, 5); -imagedestroy($this->image); diff --git a/application/views/scripts/schedules/print.phtml b/application/views/scripts/schedules/print.phtml deleted file mode 100755 index 28755a7c..00000000 --- a/application/views/scripts/schedules/print.phtml +++ /dev/null @@ -1,146 +0,0 @@ - - - - <?php print $this->escape($this->schedule->getName()); ?> - - - - - - - - - - - - - - - - - - - - - -schedule->getOfferings(); - -$numHours = $this->schedule->getLatestHour() - $this->schedule->getEarliestHour() + 1; -$numOfferings = count($offerings); -$hourHeight = $numHours * 13 * 4; -$offeringHeight = $numOfferings * 40; - -?> - - -
      - -

      escape($this->schedule->getName()); ?>

      - - -
      - - - - - -
      - - 630) { - print " style='page-break-before: always;'"; -} -print ">"; - -if (!count($offerings)) { - print "\n\t\t\t
    •  
    • "; -} -foreach ($offerings as $offering) { - print "\n\t\t\t
    • "; - - print "\n\t\t"; - - print "\n\t\t
      -
      "; - - print "\n\t\t"; - - print "\n\t\t
      CRN: ".$this->escape($offering->getCourseReferenceNumber())."
      "; - - print "\n\t\t
      ".$this->formatScheduleInfo($offering->getScheduleInfo())."
      "; - print "\n\t\t
      ".nl2br($this->escape($offering->getLocationInfo()))."
      "; - - print "\n\t\t\t
    • "; -} -print "\n\t\t"; - -?> -
      - - - diff --git a/application/views/scripts/schedules/remove_offering_dialog.phtml b/application/views/scripts/schedules/remove_offering_dialog.phtml deleted file mode 100755 index 9db038ad..00000000 --- a/application/views/scripts/schedules/remove_offering_dialog.phtml +++ /dev/null @@ -1,117 +0,0 @@ -"; -print "

      What do you want to do?

      "; - -// Change form -$scheduleTermIdString = $this->getStringFromOsidId($this->schedule->getTermId()); -?> - - - -url(array('action' => 'remove'))."' method='post'>"; -print "\n\t\t\t"; -print "\n\t\t\t"; -print "\n\t\t\t"; -print "\n\t\t\t"; -print "\n\t\t"; - -// Cancel -print "\n\t\t"; - -print "\n\t\t"; - -// Remove/Change Button. -print "\n\t\t"; - - - -if (!defined('REMOVE_OFFERING_DIALOG_JS_ADDED')) { - ob_start(); -?> - - $(function() { // on DOM ready - - /********************************************************* - * Remove dialog controls - *********************************************************/ - $(".remove_dialog").each(function() { - var button = $(this).siblings(".remove_button"); - var removeDialog = $(this).dialog({ - autoOpen: false, - width: 600, - modal: true, - position: 'top' - }); - - button.data("removeDialog", removeDialog); - }); - - $(".remove_button").click(function(){ - var removeDialog = $(this).data('removeDialog'); - removeDialog.dialog("open"); - }); - - $(".remove_dialog .cancel").click(function() { - $(this).parent().dialog('close'); - }); - - $(".change_section_dialog").each(function () { - var button = $(this).siblings(".change_sections_button"); - var addDialog = $(this).dialog({ - autoOpen: false, - width: 600, - modal: true, - close: function(event, ui) { - $(this).find("ul.section_sets").empty(); - } - }); - - button.data("addDialog", addDialog); - }); - - $(".change_sections_button").click(function () { - var removeDialog = $(this).parent(); - removeDialog.dialog("close"); - - var addDialog = $(this).data("addDialog"); - var scheduleId = addDialog.find("input[name=schedule_id]").val(); - - addDialog.find("ul.section_sets").empty(); - getSectionSets(addDialog, scheduleId); - addDialog.dialog("open"); - }); - - }); - - -headScript()->appendScript(ob_get_clean()); - define('REMOVE_OFFERING_DIALOG_JS_ADDED', true); -} diff --git a/application/views/scripts/schedules/schedule_calendar_dialog.phtml b/application/views/scripts/schedules/schedule_calendar_dialog.phtml deleted file mode 100755 index 6dac15bb..00000000 --- a/application/views/scripts/schedules/schedule_calendar_dialog.phtml +++ /dev/null @@ -1,68 +0,0 @@ -url(array('action' => 'eventsjson', 'schedule_id' => $this->schedule->getId()))."' title='Click to zoom'>"; -print "\n\t 'png', 'schedule_id' => $this->schedule->getId()))."' alt='Weekly Schedule Image'/>"; -print "\n\t\t"; - -print "\n\t"; - - -if (!defined('CALENDAR_DIALOG_JS_ADDED')) { - ob_start(); -?> - - $(function() { // on DOM ready - - /********************************************************* - * Calendar controls - *********************************************************/ - headLink()->appendStylesheet($this->url(array(), null, true).'javascript/jquery-week-calendar/jquery.weekcalendar.css'); - $this->headStyle()->appendStyle(' - div.wc-toolbar {display: none;} - .wc-time-slots .wc-today { background-color: #FFF; } - .wc-header .wc-today { font-weight: normal; } - '); - $this->headScript()->appendFile($this->url(array(), null, true).'javascript/jquery-week-calendar/libs/date.js'); - $this->headScript()->appendFile($this->url(array(), null, true).'javascript/jquery-week-calendar/jquery.weekcalendar.js'); - $this->headScript()->appendFile($this->url(array(), null, true).'javascript/schedule.js'); - - ?> - - $(".calendar").each(function() { - var button = $(this).siblings(".calendar_button"); - var calendar = $(this).dialog({ - autoOpen: false, - width: 900, - modal: true, - position: 'top' - }); - - button.data("calendar", calendar); - }); - $(".calendar_button").click(function(){ - var jsonUrl = $(this).attr('href'); - var calendar = $(this).data('calendar'); - calendar.dialog("open"); - - if (!calendar.data('initialized')) { - renderSchedule(calendar, jsonUrl); - calendar.data('initialized', true); - } - - return false; - }); - - }); - - -headScript()->appendScript(ob_get_clean()); - define('CALENDAR_DIALOG_JS_ADDED', true); -} diff --git a/application/views/scripts/schedules/schedules.phtml b/application/views/scripts/schedules/schedules.phtml deleted file mode 100755 index ddfbe843..00000000 --- a/application/views/scripts/schedules/schedules.phtml +++ /dev/null @@ -1,112 +0,0 @@ -schedules as $schedule) { - print "\n
      "; - - // Print the Term the schedule is for if we don't have a term selected. - if (!$this->selectedTermId) { - print "\n\t
      "; - print $schedule->getTermName(); - print "
      "; - } - - // Delete Button - print "\n\t
      'delete'))."' method='post'>"; - print "\n\t\t"; - print "\n\t\t"; - print "\n\t\t"; - print "\n\t
      "; - - // Schedule name - print "\n\t
      'update'))."' method='post'>"; - print "\n\t\tescape($schedule->getName())."\"/>"; - print "\n\t\t"; - print "\n\t\t"; - print "\n\t\t"; - print "\n\t
      "; - - // Print view. - print "\n\t 'print', 'schedule_id' => $schedule->getId()))."' title='Click for print view.' target='print_view'>"; - print "\n\t"; - print "\n\t\t"; - - $this->schedule = $schedule; - - // Email view. - print $this->render('schedules/email-dialog.phtml'); - - // Calendar - print $this->render('schedules/schedule_calendar_dialog.phtml'); - - - - print "\n\t\t"; - - print "\n
      "; -} - -?> - -
      - for - render('schedules/terms.phtml'); ?> - - - -
      - - - - $(function() { // on DOM ready - - $('form.delete_schedule').submit(function () { - return confirm('Are you sure you want to delete this schedule?'); - }); - - $('a.print_button').click(function() { - var printView = window.open(this.href, this.target, "menubar=1,resizable=1,height=600,width=800,scrollbars=1"); - printView.focus(); - return false; - }); - - }); - - -headScript()->appendScript(ob_get_clean()); diff --git a/application/views/scripts/schedules/selected_term_name.phtml b/application/views/scripts/schedules/selected_term_name.phtml deleted file mode 100755 index bf4f06db..00000000 --- a/application/views/scripts/schedules/selected_term_name.phtml +++ /dev/null @@ -1,16 +0,0 @@ -selectedTermId)) { - print "All Terms"; - return; -} - -$found = false; -foreach($this->terms as $termInfo) { - if ($termInfo['id']->isEqual($this->selectedTermId)) { - print $termInfo['name']; - $found = true; - } -} -if (!$found) - if (isset($this->selectedTermId)); diff --git a/application/views/scripts/schedules/term_select.phtml b/application/views/scripts/schedules/term_select.phtml deleted file mode 100755 index 06d47700..00000000 --- a/application/views/scripts/schedules/term_select.phtml +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/application/views/scripts/schedules/terms.phtml b/application/views/scripts/schedules/terms.phtml deleted file mode 100755 index 0e201aaa..00000000 --- a/application/views/scripts/schedules/terms.phtml +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/application/views/scripts/terms/details.phtml b/application/views/scripts/terms/details.phtml deleted file mode 100755 index 6c269196..00000000 --- a/application/views/scripts/terms/details.phtml +++ /dev/null @@ -1,26 +0,0 @@ -"; - -print "\n\t
      Name
      "; -print "\n\t
      "; -print $this->term->getDisplayName(); -print "
      "; - -print "\n\t
      Start Date
      "; -print "\n\t
      "; -print $this->term->getStartTime()->format('Y-m-d'); -print "
      "; - -print "\n\t
      End Date
      "; -print "\n\t
      "; -print $this->term->getEndTime()->format('Y-m-d'); -print "
      "; - -print "\n\t
      Weeks (including exams)
      "; -print "\n\t
      "; -$span = $this->term->getEndTime()->diff($this->term->getStartTime()); -print ceil($span->days / 7); -print "
      "; - -print "\n"; diff --git a/application/views/scripts/terms/detailsxml.phtml b/application/views/scripts/terms/detailsxml.phtml deleted file mode 100755 index 32902616..00000000 --- a/application/views/scripts/terms/detailsxml.phtml +++ /dev/null @@ -1,28 +0,0 @@ -'; - -print "\n"; - -print "\n\t"; -print $this->escape($this->getStringFromOsidId($this->term->getId())); -print ""; - -print "\n\t"; -print $this->term->getDisplayName(); -print ""; - -print "\n\t"; -print $this->term->getStartTime()->format('Y-m-d'); -print ""; - -print "\n\t"; -print $this->term->getEndTime()->format('Y-m-d'); -print ""; - -print "\n\t"; -$span = $this->term->getEndTime()->diff($this->term->getStartTime()); -print ceil($span->days / 7); -print ""; - -print "\n"; diff --git a/application/views/scripts/terms/list.phtml b/application/views/scripts/terms/list.phtml deleted file mode 100755 index f3139649..00000000 --- a/application/views/scripts/terms/list.phtml +++ /dev/null @@ -1,10 +0,0 @@ - 'view' - ); - -while ($this->terms->hasNext()) { - $term = $this->terms->getNextTerm(); - $params['term'] = $this->getStringFromOsidId($term->getId()); - print "\n\t

      ".$term->getDisplayName()."

      "; - print "\n\t
      ".$term->getDescription()."
      "; -} diff --git a/application/views/scripts/terms/listxml.phtml b/application/views/scripts/terms/listxml.phtml deleted file mode 100755 index 5066d48b..00000000 --- a/application/views/scripts/terms/listxml.phtml +++ /dev/null @@ -1,32 +0,0 @@ - - - - '.$this->title.' - '.$this->pathAsAbsoluteUrl($this->url()).' - '.date('r').' - Course Catalog - http://blogs.law.harvard.edu/tech/rss -'; - -$params = array( 'controller' => 'terms', - 'action' => 'view'); - -while ($this->terms->hasNext()) { - $term = $this->terms->getNextTerm(); - print "\n\t\t"; - print "\n\t\t\t".$this->escape($term->getDisplayName()).""; - $params['term'] = $this->getStringFromOsidId($term->getId()); - print "\n\t\t\t".$this->pathAsAbsoluteUrl($this->url($params)).""; - print "\n\t\t\tgetDescription()."]]>"; - print "\n\t\t\t".$this->getStringFromOsidId($term->getId()).""; - print "\n\t\t\t".$term->getStartTime()->format('Y-m-d').""; - print "\n\t\t\t".$term->getEndTime()->format('Y-m-d').""; - print "\n\t\t\t".ceil(abs($term->getEndTime()->format('U') - $term->getStartTime()->format('U'))/60/60/24/7).""; - print "\n\t\t"; -} -?> - - - diff --git a/application/views/scripts/terms/view.phtml b/application/views/scripts/terms/view.phtml deleted file mode 100755 index 853aa21d..00000000 --- a/application/views/scripts/terms/view.phtml +++ /dev/null @@ -1,16 +0,0 @@ -Sections"; -$offeringParams = array( - 'controller' => 'offerings', - 'action' => 'view' - ); -while ($this->offerings->hasNext()) { - $offering = $this->offerings->getNextCourseOffering(); - $offeringParams['offering'] = $this->getStringFromOsidId($offering->getId()); - print "\n\t
      "; - print "".$this->escape($offering->getDisplayName()).""; - print " \"".$this->escape($offering->getTitle())."\" - "; - print " ".$this->escape($offering->getGenusType()->getDisplayName()).""; - print "
      "; -} diff --git a/application/views/scripts/topics/list.phtml b/application/views/scripts/topics/list.phtml deleted file mode 100755 index 5d5025c1..00000000 --- a/application/views/scripts/topics/list.phtml +++ /dev/null @@ -1,54 +0,0 @@ - 'topics', - 'action' => 'view', - ); -print "\n\t

      Subjects:

      "; -print "\n\t\t"; - -print "\n\t\t

      Departments:

      "; -print "\n\t\t"; - -print "\n\t\t

      Divisions:

      "; -print "\n\t\t"; - -print "\n\t\t

      Requirements Fulfilled:

      "; -print "\n\t\t"; diff --git a/application/views/scripts/topics/listxml.phtml b/application/views/scripts/topics/listxml.phtml deleted file mode 100755 index af22e78a..00000000 --- a/application/views/scripts/topics/listxml.phtml +++ /dev/null @@ -1,35 +0,0 @@ - - - - '.$this->escape($this->title).' - '.$this->pathAsAbsoluteUrl($this->url(array('action' => 'list'))).' - - '.date('r').' - Course Catalog - http://blogs.law.harvard.edu/tech/rss -'; - -$params = array( 'controller' => 'topics', - 'action' => 'view', - 'catalog' => $this->getStringFromOsidId($this->menuCatalogSelectedId) - ); - -$topics = array_merge($this->subjectTopics, $this->departmentTopics, $this->divisionTopics, $this->requirementTopics); -foreach ($topics as $topic) { - print "\n\t\t"; - print "\n\t\t\t".$this->escape($topic->getDisplayName()).""; - $params['topic'] = $this->getStringFromOsidId($topic->getId()); - print "\n\t\t\t".$this->pathAsAbsoluteUrl($this->url($params)).""; - print "\n\t\t\tgetDescription()."]]>"; - print "\n\t\t\t".$this->getStringFromOsidId($topic->getId()).""; - print "\n\t\t\t".$this->getStringFromOsidType($topic->getGenusType()).""; - print "\n\t\t"; -} - - -?> - - - diff --git a/application/views/scripts/topics/view.phtml b/application/views/scripts/topics/view.phtml deleted file mode 100755 index 041f535a..00000000 --- a/application/views/scripts/topics/view.phtml +++ /dev/null @@ -1,17 +0,0 @@ -Sections"; -$offeringParams = array( - 'controller' => 'offerings', - 'action' => 'view', - 'topic' => null - ); -while ($this->offerings->hasNext()) { - $offering = $this->offerings->getNextCourseOffering(); - $offeringParams['offering'] = $this->getStringFromOsidId($offering->getId()); - print "\n\t
      "; - print "".$this->escape($offering->getDisplayName()).""; - print " \"".$this->escape($offering->getTitle())."\" - "; - print " ".$this->escape($offering->getGenusType()->getDisplayName()).""; - print "
      "; -} diff --git a/assets/app.js b/assets/app.js new file mode 100644 index 00000000..b9400336 --- /dev/null +++ b/assets/app.js @@ -0,0 +1,8 @@ +/* + * Welcome to your app's main JavaScript file! + * + * This file will be included onto the page via the importmap() Twig function, + * which should already be in your base.html.twig. + */ +import "./styles/app.css"; +import "bookmarks"; diff --git a/assets/bookmarks.js b/assets/bookmarks.js new file mode 100644 index 00000000..a4d4a3ca --- /dev/null +++ b/assets/bookmarks.js @@ -0,0 +1,40 @@ +import "./styles/bookmarks.css"; +import $ from "jquery"; + +$(function () { + // on DOM ready + + $(".save_course a").click(function () { + var clickedAnchor = $(this); + var courseId = $(this).siblings("input[name=course_id]").val(); + + $.ajax({ + url: clickedAnchor.attr("href"), + success: function () { + if (clickedAnchor.hasClass("save")) { + bookmarks_show_forget(courseId); + } else { + bookmarks_show_save(courseId); + } + }, + }); + return false; + }); +}); + +function bookmarks_show_save(courseId) { + $('.save_course input[name=course_id][value="' + courseId + '"]') + .siblings("a.save") + .show(); + $('.save_course input[name=course_id][value="' + courseId + '"]') + .siblings("a.forget") + .hide(); +} +function bookmarks_show_forget(courseId) { + $('.save_course input[name=course_id][value="' + courseId + '"]') + .siblings("a.save") + .hide(); + $('.save_course input[name=course_id][value="' + courseId + '"]') + .siblings("a.forget") + .show(); +} diff --git a/assets/email_controls.js b/assets/email_controls.js new file mode 100644 index 00000000..bd5cc11d --- /dev/null +++ b/assets/email_controls.js @@ -0,0 +1,117 @@ +import $ from "jquery"; + +$("document").ready(function () { + /********************************************************* + * Email controls + *********************************************************/ + $(".email_dialog").each(function () { + var button = $(this).siblings(".email_button"); + var emailDialog = $(this).dialog({ + autoOpen: false, + width: 700, + modal: true, + }); + + button.data("emailDialog", emailDialog); + }); + $(".email_button").click(function () { + var emailDialog = $(this).data("emailDialog"); + emailDialog.dialog("open"); + + // Store the original subject. + var field = emailDialog.find("input[name=subject]"); + if (!field.data("orig")) { + field.data("orig", field.val()); + } + + // Store the original message. + var field = emailDialog.find("textarea[name=message]"); + if (!field.data("orig")) { + field.data("orig", field.val()); + } + + return false; + }); + + $(".email_dialog form").submit(function () { + var to = $(this).find("input[name=to]").val(); + to = to.replace(/^\s*/, "").replace(/\s*$/, ""); + + if (!to.length) { + if ( + !confirm( + "You didn't specify a recipient.\n\nClick 'Cancel' to add one or 'Ok' to send only to yourself." + ) + ) { + return false; + } + } + if (to.length && !validateEmail(to)) { + alert( + "It doesn't look like you specified a valid email address in the 'To:' field." + ); + return false; + } + + // Submit the form asynchronously, clear the to & body, then close. + var form = $(this); + var emailDialog = form.parents(".email_dialog"); + + $.ajax({ + type: "POST", + url: form.attr("action"), + data: form.serialize(), + success: function (data, textStatus, req) { + if (data.length) { + alert(data); + } + + // Clear the form. + form.find("input[name=to]").val(""); + + var field = form.find("input[name=subject]"); + field.val(field.data("orig")); + + var field = form.find("textarea[name=message]"); + field.val(field.data("orig")); + }, + error: function (req, textStatus, errorThrown) { + emailDialog.dialog("open"); + alert("Couldn't send email.\n\n" + req.responseText); + }, + }); + + // Close the dialog. + emailDialog.dialog("close"); + return false; + }); +}); + +/** + * Validate the email field + * + * @param string emailString + * @return boolean + */ +function validateEmail(emailString) { + var addresses = emailString.split(","); + for (var i = 0; i < addresses.length; i++) { + var address = addresses[i].replace(/^\s*/, "").replace(/\s*$/, ""); + if (!validateEmailAddress(address)) { + return false; + } + } + return true; +} + +/** + * Validate an email address. + * By "sectrean" at http://stackoverflow.com/questions/46155/validate-email-address-in-javascript/46181#46181 + * + * @param string email + * @return boolean + */ +function validateEmailAddress(email) { + var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + return email.match(re); +} diff --git a/assets/export.js b/assets/export.js new file mode 100644 index 00000000..594ccabb --- /dev/null +++ b/assets/export.js @@ -0,0 +1,759 @@ +import "./styles/export.css"; +import $ from "jquery"; +import "jquery-ui"; + +var loading = false; + +/* Helper functions for catalog export configuration */ + +function selectConfig(url) { + var config = $("#config-selector").find("select").val(); + window.location.href = url + "/" + config; +} + +// ------ GENERATORS ------ // +function generateSection(id, type, input) { + return ( + "
    • " + + generateSectionHTML(type, input) + ); +} + +function generateSectionHTML(type, input) { + return ( + "
      Type: " + + type + + "" + + input + + "" + ); +} + +// Cache of courselist data for reuse. +// We will fetch the lists asynchronously, but want to only do a single fetch. +let courselist_data = {}; +let courselists_to_populate = []; +let loading_courselist = false; + +function generateInputTag(type, value, callback) { + switch (type) { + case "h1": + case "h2": + if (value.indexOf(";") !== -1) { + var toc = value.substring(value.indexOf(";") + 1); + value = value.substring(0, value.indexOf(";")); + } else { + var toc = ""; + } + callback( + "" + ); + break; + case "page_content": + callback( + "" + ); + break; + case "custom_text": + callback( + "" + ); + break; + case "course_list": + // We only want to perform a single fetch of data for the course lists to + // not fire of dozens of requests for the same data, so we'll fire off the + // first request and then queue up addtional inputs to render that we'll + // go through when the result comes back. + + // If we've already loaded the data, just use it. + if (courselist_data[$("#catalogId").val()]) { + setCourseListInputForData( + courselist_data[$("#catalogId").val()], + value, + callback + ); + } else { + // If we don't have data yet, add our element to the queue to be rendered. + courselists_to_populate.push({ + catalog: $("#catalogId").val(), + value: value, + callback: callback, + }); + // Kick off a load of the data if we aren't loading yet. + if (!loading_courselist) { + // Set up an overlay to prevent working with or saving the form until + // population is finished. + loading_courselist = true; + $("body").append( + "

      Loading course list options...

      " + ); + $(".loading-overlay").css("height", $(window).height()); + $(window).resize(function () { + $(".loading-overlay").css("height", $(window).height()); + }); + + // Run the request and work through our queue when we get the result back. + $.ajax({ + url: $("#config-body").data("courselist-url"), + type: "GET", + error: function (error) { + throw error; + }, + success: function (data) { + courselist_data[$("#catalogId").val()] = data; + var l; + while ((l = courselists_to_populate.pop())) { + setCourseListInputForData( + courselist_data[l["catalog"]], + l["value"], + l["callback"] + ); + } + loading_courselist = false; + $(".loading-overlay").hide(); + }, + }); + } + } + break; + default: + throw "Invalid input tag type: " + type; + } +} + +function setCourseListInputForData(data, value, callback) { + if (value === "") value = "unselected"; + // Course filters. + if (value.indexOf(",") !== -1) { + var selection = value.substring(0, value.indexOf(",")); + var filters = value.substring(value.indexOf(",") + 1); + var filterHTML = + "
      Course #'s to exclude: "; + } else { + var selection = value; + var filterHTML = + "
      Course #'s to exclude: "; + } + var sectionInput = data; + sectionInput = sectionInput.replace( + "" + ); + sectionInput = sectionInput.replace( + "
    • " + + title + + "
      show/hide
      • " + ); + } else { + return ( + "
      • " + + title + + "
        show/hide
        • " + ); + } +} + +// ----- INIT ------ // + +function buildList(jsonData, callback) { + if (!jsonData || JSON.stringify(jsonData) === "{}") { + newGroup(); + callback(); + } else { + /* + * The count variable is used to ensure that this whole block flows synchronously. + * Otherwise, callback will fire early or multiple times. + * This is a hacky way to do this and if you have a better idea, please feel free + * to implement. + */ + var count = 0; + $.each(jsonData, function (key, value) { + $.each(value, function (sectionKey, sectionValue) { + count++; + }); + }); + // Subtract group names from count. + count -= Object.keys(jsonData).length; + $.each(jsonData, function (key, value) { + var groupName = "no-group"; + if (key.indexOf("group") !== -1) { + groupName = "#" + key; + $("#sections-list").append( + generateGroup(key, "Unnamed Group", false) + ); + $.each(value, function (sectionKey, sectionValue) { + if (sectionKey === "title") { + giveGroupTitle(groupName, sectionValue); + } else { + generateInputTag( + sectionValue.type, + sectionValue.value, + function (result) { + var li = generateSection( + sectionKey, + sectionValue.type, + result + ); + $(groupName).find(".section-group").append(li); + reorderSectionsBasedOnIds(groupName); + if (!--count) { + callback(); + } + } + ); + } + }); + } else { + throw "Invalid JSON: " + jsonData; + } + }); + } +} + +function populate() { + $("#config-selector").change(function () { + window.location = this.value; + }); + if (!$("#configId").val()) { + return; + } + $("#save-export-config-button").on("click", function () { + saveJSON(); + }); + $("#reset-export-config-button").on("click", function () { + reset(); + }); + $("#delete-export-config-button").on("click", function () { + deleteConfig(); + }); + $("#show-hide-export-config-groups-button").on("click", function () { + showHide(); + }); + + loading = true; + $.ajax({ + url: $("#config-body").data("latest-url"), + type: "GET", + dataType: "JSON", + success: function (data) { + buildList(data, function () { + renameGroups(); + resetEventListeners(); + loading = false; + $(".error-message").removeClass("error"); + $(".error-message").addClass("hidden"); + }); + }, + }); + + // hide error message. + $(".error-message").addClass("hidden"); +} + +// ----- HELPERS ------- // + +function reorderSectionsBasedOnIds(groupId) { + var sections = $(groupId).find(".section").toArray(); + sections.sort(function (a, b) { + var aId = parseInt(a["id"].substring(7)); + var bId = parseInt(b["id"].substring(7)); + return aId - bId; + }); + $(groupId).find(".section-group").empty().append(sections); +} + +function reset() { + $("#sections-list").html(""); + populate(); + $(".error-message").removeClass("success error"); + $(".error-message").addClass("hidden"); +} + +function hasTOC(input) { + return $($(input).parent().children(".toc")[0]).val() !== ""; +} + +function isTOC(input) { + return $(input).hasClass("toc"); +} + +function resetEventListeners() { + $("#sections-list").sortable({ + stop: function (event, ui) {}, + }); + $("#sections-list .group") + .find(".section-group") + .sortable({ + stop: function (event, ui) {}, + }); + + // Add event listeners for value changes. + // I will never understand why javascript doesn't do this for us. + $(".section-input").change(function () { + $(this).attr("value", $(this).val()); + if ($(this).parent().parent().html().indexOf("Type: h1") !== -1) { + $("#sections-list .new").removeClass("new"); + if ((!isTOC(this) && !hasTOC(this)) || isTOC(this)) { + giveGroupTitle(this, $(this).val()); + renameGroups(); + } + } + }); + $(".filter-input").change(function () { + $(this).attr("value", $(this).val()); + }); + $(".section-dropdown").change(function () { + $(this).attr("value", $(this).val()); + }); + $("#sections-list").on("sortstop", function (event, ui) { + // TODO - is there really any reason to rename groups and sections? As long + // as their ids are unique do they really need to be in order? + renameGroups(); + renameSections(); + }); + $("#sections-list .group").on("sortstop", function (event, ui) { + // TODO - is there really any reason to rename groups and sections? As long + // as their ids are unique do they really need to be in order? + renameGroups(); + renameSections(); + }); + + // Attach handlers to buttons based on class. + $(".group-toggle-description") + .unbind("click") + .on("click", function () { + toggleGroup(this); + }); + $(".add-group-below") + .unbind("click") + .on("click", function () { + newGroup(this); + }); + $(".button-section-add") + .unbind("click") + .on("click", function () { + newSection(this); + }); + $(".button-delete-section") + .unbind("click") + .on("click", function () { + deleteSection(this); + }); + $(".button-delete-group") + .unbind("click") + .on("click", function () { + deleteGroup(this); + }); + $(".button-confirm-delete") + .unbind("click") + .on("click", function () { + confirmDelete($(this).data("config-id")); + }); + $(".button-cancel-delete") + .unbind("click") + .on("click", function () { + cancelDelete(); + }); + $(".select-section-type") + .unbind("click") + .on("click", function () { + defineSection(this); + }); +} + +function showHide() { + var groups = $("#sections-list .group").toArray(); + var visible = true; + groups.forEach(function (element, index) { + if (index === 0) { + visible = $(element).find(".section-group").hasClass("visible"); + } + + if (!visible) { + $(element).find(".section-group").addClass("visible"); + $(element).find(".group-controls").removeClass("hidden"); + } else { + $(element).find(".section-group").removeClass("visible"); + $(element).find(".group-controls").addClass("hidden"); + } + }); +} + +function validateInput(id, type, value, callback) { + // Strip ""s around value. + value = value.substring(1, value.length - 1); + switch (type) { + case "h1": + case "h2": + callback(); + // var validCharacters = /^[\/*.?!,;:()&" 0-9a-zA-Z]+$/; + // if (validCharacters.test(value)) { + // callback(); + // } else { + // callback("Headers may only contain letters, numbers, .,?!\&;:(), and double quotes (\"\").", id); + //} + break; + case "page_content": + var validURL = /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/; + if (validURL.test(value)) { + callback(); + } else { + callback( + "Please enter a valid URL. Example: http://catalog.middlebury.edu/spanish", + id + ); + } + break; + case "custom_text": + callback(); + break; + case "course_list": + if (value === "unselected") { + callback("Please select a course from the course list", id); + } else { + callback(); + } + break; + default: + callback( + "Invalid input type. I have no idea how you accomplished this.", + id + ); + } +} + +// ------ SAVE -------- // + +function saveJSON() { + if (loading) { + $(".error-message").html("

          Still loading data... Please wait.

          "); + $(".error-message").removeClass("hidden success"); + $(".error-message").addClass("error"); + return; + } + var completelyValid = true; + var JSONString = "{"; + + var groups = $("#sections-list .group").toArray(); + groups.forEach(function (element, index) { + var groupId = element["id"]; + JSONString += '"' + groupId + '":{'; + + var groupTitle = $(element).find(".group-title")[0].innerHTML; + JSONString += '"title":"' + groupTitle + '",'; + + var sections = $(element).find(".section").toArray(); + sections.forEach(function (element, index) { + if (!completelyValid) return; + + var sectionId = element["id"]; + var section = $(element); + var sectionType = section + .find(".section-type")[0] + .innerHTML.substring( + section.find(".section-type")[0].innerHTML.indexOf(": ") + 2 + ); + var sectionValue = ""; + switch (sectionType) { + case "h1": + case "h2": + sectionValue = $( + $($(element).find(".section-value")[0]).find("input")[0] + ).val(); + var toc = $( + $($(element).find(".section-value")[0]).find("input")[1] + ).val(); + if (toc) { + sectionValue += ";" + toc; + } + break; + case "custom_text": + sectionValue = $( + $($(element).find(".section-value")[0]).find( + "textarea" + )[0] + ).val(); + sectionValue = sectionValue.replace( + /(?:\r\n|\r|\n)/g, + "\\n" + ); + sectionValue = sectionValue.replace(/\"/g, """); + break; + case "course_list": + sectionValue = $( + $($(element).find(".section-value")[0]).find( + "select" + )[0] + ).val(); + if ($(element).find(".filter-input").val()) { + var filters = $(element).find(".filter-input").val(); + // Remove trailing " + //sectionValue = sectionValue.substring(0, sectionValue.length - 1); + sectionValue += "," + filters; + } + break; + default: + sectionValue = $( + $($(element).find(".section-value")[0]).find("input")[0] + ).val(); + break; + } + + sectionValue = '"' + sectionValue + '"'; + + validateInput(sectionId, sectionType, sectionValue, function ( + error, + sectionId + ) { + if (error) { + $(".error-message").html("

          Error: " + error + "

          "); + $(".error-message").addClass("error"); + $(".error-message").removeClass("hidden success"); + $("#" + sectionId).css("background", "#f95757"); + completelyValid = false; + } else { + $(".error-message").addClass("hidden"); + JSONString += + '"section' + + eval(index + 1) + + '":{"type":"' + + sectionType + + '","value":' + + sectionValue + + "},"; + completelyValid = true; + } + }); + }); + + // Remove trailing , + JSONString = JSONString.substring(0, JSONString.length - 1); + + JSONString += "},"; + }); + + if (completelyValid) { + $(".section").css("background", "#b5c5dd"); + + // Remove trailing , + JSONString = JSONString.substring(0, JSONString.length - 1); + JSONString += "}"; + + // Ensure valid JSON if no sections are present. + if (JSONString === "}") JSONString = "{}"; + + $.ajax({ + url: $("#config-body").data("insert-revision-url"), + type: "POST", + dataType: "json", + data: { + csrf_key: $('#csrf-key-config-modify').val(), + note: $("#note").val(), + jsonData: JSONString, + }, + error: function (error) { + console.log(error); + }, + success: function (data) { + $(".error-message").html("

          Saved successfully

          "); + $(".error-message").removeClass("hidden error"); + $(".error-message").addClass("success"); + setTimeout(function () { + $(".error-message").addClass("hidden"); + $(".error-message").removeClass("success"); + }, 5000); + }, + }); + } +} + +// ------ CONFIGS ------- // + +function deleteConfig() { + if ($("#warning-box").length) return; + $("#config-body").append( + "

          Are you sure you want to delete this configuration? This cannot be undone. All related revisions will be gone as well.

          " + ); + resetEventListeners(); +} + +function confirmDelete() { + $.ajax({ + url: $("#config-body").data("delete-url"), + type: "POST", + data: { + csrf_key: $('#csrf-key-config-modify').val(), + }, + error: function (error) { + console.log(error); + }, + success: function (data) { + location.reload(true); + }, + }); +} + +function cancelDelete() { + $("#warning-box").remove(); +} + +// ------ GROUPS ------- // + +function giveGroupTitle(selector, value) { + $(selector) + .closest("#sections-list .group") + .find(".group-title")[0].innerHTML = value; +} + +function renameGroups() { + $("#sections-list .group") + .toArray() + .forEach(function (element, index) { + $(element).attr("id", "group" + eval(index + 1)); + }); +} + +function toggleGroup(button) { + $(button) + .closest("#sections-list .group") + .find(".section-group") + .toggleClass("visible"); + $(button) + .closest("#sections-list .group") + .find(".group-controls") + .toggleClass("hidden"); +} + +function newGroup(thisButton) { + // Only allow user to create one group at a time. + if ($("#sections-list .new").length) return; + + var newgenerateGroup = generateGroup( + "temp", + "Please fill out an h1 section to give this group a name", + true + ); + + if (!thisButton) { + if ($("#begin-message")) { + $("#begin-message").remove(); + } + $("#sections-list").append(newgenerateGroup); + } else { + var li = $(thisButton).parent().parent(); + $(newgenerateGroup).insertAfter(li); + } + + $("#temp").addClass("new"); + + // Create h1 section. + newGroupFirstSection(); +} + +function deleteGroup(thisButton) { + $(thisButton).closest("#sections-list .group").remove(); + if ($("#sections-list").find(".group").length === 0) { + newGroup(); + } + + renameGroups(); +} + +// ------ SECTIONS ----- // + +function renameSections() { + $(".section") + .toArray() + .forEach(function (element, index) { + $(element).attr("id", "section" + eval(index + 1)); + }); +} + +function newGroupFirstSection() { + generateInputTag("h1", "", function (input) { + var newSectionHTML = + "
        • " + + generateSectionHTML("h1", input) + + "
        • "; + $("#sections-list .new").children("ul").append(newSectionHTML); + resetEventListeners(); + }); +} + +function newSection(thisButton) { + var newSectionHTML = + "
        • "; + if (!thisButton) { + if ($("#begin-message")) { + $("#begin-message").remove(); + } + $("#sections-list").append(newSectionHTML); + } else { + var li = $(thisButton).parent().parent(); + $(newSectionHTML).insertAfter(li); + } + resetEventListeners(); + renameSections(); +} + +function defineSection(select) { + var sectionType = $(select).val(); + var li = $(select).parent(); + + generateInputTag(sectionType, "", function (result) { + $(li).html(generateSectionHTML(sectionType, result)); + + resetEventListeners(); + }); +} + +function deleteSection(thisButton) { + if ( + $(thisButton).closest("#sections-list .group").find(".section") + .length === 1 + ) { + deleteGroup(thisButton); + } else { + $(thisButton).closest(".section").remove(); + } + renameSections(); +} + +$(document).ready(function () { + populate(); + resetEventListeners(); +}); diff --git a/assets/export_revision_diff.js b/assets/export_revision_diff.js new file mode 100644 index 00000000..911cf984 --- /dev/null +++ b/assets/export_revision_diff.js @@ -0,0 +1,54 @@ +import "diff2html/bundles/css/diff2html.min.css"; +import "./styles/export.css"; +import $ from "jquery"; +import "jquery-ui"; +// import { Diff2Html } from 'diff2html'; +import Diff2HtmlUI from "diff2html/bundles/js/diff2html-ui.min.js"; +import * as Diff from "diff"; + +function buildDiffView(text1, text2, label1, label2) { + var changes = Diff.diffLines(text1, text2); + if (changes.length > 1) { + const diff = Diff.createPatch("", text1, text2, label1, label2, { + options: { context: 5 }, + }); + const configuration = { + drawFileList: true, + matching: "lines", + outputFormat: "side-by-side", + fileListToggle: false, + fileListStartVisible: false, + fileContentToggle: false, + container: document.createElement("div"), + diff2htmlUi: null, + highlight: true, + }; + var diff2htmlUi = new Diff2HtmlUI.Diff2HtmlUI( + $("#diff").get(0), + diff, + configuration + ); + diff2htmlUi.draw(); + } else { + $("#diff").append( + "

          No difference in JSON data between these revisions

          " + ); + } +} + +$(document).ready(function () { + buildDiffView( + $("#rev1").val(), + $("#rev2").val(), + "Revision #" + + $("#rev1").data("rev-id") + + " (" + + $("#rev1").data("rev-date") + + ")", + "Revision #" + + $("#rev2").data("rev-id") + + " (" + + $("#rev2").data("rev-date") + + ")" + ); +}); diff --git a/assets/export_revision_history.js b/assets/export_revision_history.js new file mode 100644 index 00000000..155f4279 --- /dev/null +++ b/assets/export_revision_history.js @@ -0,0 +1,88 @@ +import "./styles/export.css"; +import $ from "jquery"; +import "jquery-ui"; + +var selected = []; + +function sortSelected() { + selected.sort(function (a, b) { + // if a timestamp later than b timestamp + var dateA = new Date( + $("#" + a) + .parents("tr") + .find(".timestamp")[0].innerText + ); + var dateB = new Date( + $("#" + b) + .parents("tr") + .find(".timestamp")[0].innerText + ); + if (dateA < dateB) { + return -1; + } else if (dateA === dateB) { + return 0; + } else { + return 1; + } + }); +} + +function compare(url) { + sortSelected(); + var rev1 = $( + $("#" + selected[0]) + .parents("tr") + .find(".revId")[0] + ).val(); + var rev2 = $( + $("#" + selected[1]) + .parents("tr") + .find(".revId")[0] + ).val(); + if (!rev1 || !rev2) return; + var win = window.open( + url.replace(/-rev1-/, rev1).replace(/-rev2-/, rev2), + "_blank" + ); + win.focus(); +} + +function renderSelected() { + $("input[type=radio]").prop("checked", false); + selected.forEach(function (element) { + $("#" + element).prop("checked", true); + }); +} + +function revertTo(url, revId) { + $.ajax({ + url: url, + type: "POST", + data: { + revId: revId, + csrf_key: $('#csrf-key-config-revert').val(), + }, + success: function (data) { + location.reload(); + }, + error: function (error) { + throw error; + }, + }); +} + +$(document).ready(function () { + $("input[type=radio]").change(function () { + selected.push(this.id); + if (selected.length > 2) selected.shift(); + renderSelected(); + }); + + $(".compare-revisions-button").on("click", function () { + compare($(this).data("url")); + }); + + $(".revert-button").on("click", function () { + revertTo($(this).data("url"), $(this).data("rev-id")); + }); +}); diff --git a/assets/favicon.ico b/assets/favicon.ico new file mode 100644 index 00000000..01fae417 Binary files /dev/null and b/assets/favicon.ico differ diff --git a/docroot/images/Crystal_Clear/Crystal_Clear_action_bookmark.png b/assets/images/Crystal_Clear/Crystal_Clear_action_bookmark.png similarity index 100% rename from docroot/images/Crystal_Clear/Crystal_Clear_action_bookmark.png rename to assets/images/Crystal_Clear/Crystal_Clear_action_bookmark.png diff --git a/docroot/images/Crystal_Clear/Crystal_Clear_action_bookmark_Silver.png b/assets/images/Crystal_Clear/Crystal_Clear_action_bookmark_Silver.png similarity index 100% rename from docroot/images/Crystal_Clear/Crystal_Clear_action_bookmark_Silver.png rename to assets/images/Crystal_Clear/Crystal_Clear_action_bookmark_Silver.png diff --git a/docroot/images/Crystal_Clear/README.txt b/assets/images/Crystal_Clear/README.txt similarity index 100% rename from docroot/images/Crystal_Clear/README.txt rename to assets/images/Crystal_Clear/README.txt diff --git a/docroot/images/arrow_cross.png b/assets/images/arrow_cross.png similarity index 100% rename from docroot/images/arrow_cross.png rename to assets/images/arrow_cross.png diff --git a/docroot/images/catalog_header.jpg b/assets/images/catalog_header.jpg similarity index 100% rename from docroot/images/catalog_header.jpg rename to assets/images/catalog_header.jpg diff --git a/docroot/images/catalog_header_plain.jpg b/assets/images/catalog_header_plain.jpg similarity index 100% rename from docroot/images/catalog_header_plain.jpg rename to assets/images/catalog_header_plain.jpg diff --git a/assets/jquery-ui/images/ui-icons_444444_256x240.png b/assets/jquery-ui/images/ui-icons_444444_256x240.png new file mode 100644 index 00000000..f6e5294b Binary files /dev/null and b/assets/jquery-ui/images/ui-icons_444444_256x240.png differ diff --git a/assets/jquery-ui/images/ui-icons_555555_256x240.png b/assets/jquery-ui/images/ui-icons_555555_256x240.png new file mode 100644 index 00000000..dae06ac5 Binary files /dev/null and b/assets/jquery-ui/images/ui-icons_555555_256x240.png differ diff --git a/assets/jquery-ui/images/ui-icons_777620_256x240.png b/assets/jquery-ui/images/ui-icons_777620_256x240.png new file mode 100644 index 00000000..0fe07d29 Binary files /dev/null and b/assets/jquery-ui/images/ui-icons_777620_256x240.png differ diff --git a/assets/jquery-ui/images/ui-icons_777777_256x240.png b/assets/jquery-ui/images/ui-icons_777777_256x240.png new file mode 100644 index 00000000..a4c77463 Binary files /dev/null and b/assets/jquery-ui/images/ui-icons_777777_256x240.png differ diff --git a/assets/jquery-ui/images/ui-icons_cc0000_256x240.png b/assets/jquery-ui/images/ui-icons_cc0000_256x240.png new file mode 100644 index 00000000..555c694b Binary files /dev/null and b/assets/jquery-ui/images/ui-icons_cc0000_256x240.png differ diff --git a/assets/jquery-ui/images/ui-icons_ffffff_256x240.png b/assets/jquery-ui/images/ui-icons_ffffff_256x240.png new file mode 100644 index 00000000..0de53bff Binary files /dev/null and b/assets/jquery-ui/images/ui-icons_ffffff_256x240.png differ diff --git a/assets/jquery-ui/jquery-ui.css b/assets/jquery-ui/jquery-ui.css new file mode 100644 index 00000000..8c64a07a --- /dev/null +++ b/assets/jquery-ui/jquery-ui.css @@ -0,0 +1,1285 @@ +/*! jQuery UI - v1.14.1 - 2024-11-14 +* https://jqueryui.com +* Includes: draggable.css, core.css, resizable.css, selectable.css, sortable.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, progressbar.css, selectmenu.css, slider.css, spinner.css, tabs.css, tooltip.css, theme.css +* To view and modify this theme, visit https://jqueryui.com/themeroller/?ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&fwDefault=normal&cornerRadius=3px&bgColorHeader=e9e9e9&bgTextureHeader=flat&borderColorHeader=dddddd&fcHeader=333333&iconColorHeader=444444&bgColorContent=ffffff&bgTextureContent=flat&borderColorContent=dddddd&fcContent=333333&iconColorContent=444444&bgColorDefault=f6f6f6&bgTextureDefault=flat&borderColorDefault=c5c5c5&fcDefault=454545&iconColorDefault=777777&bgColorHover=ededed&bgTextureHover=flat&borderColorHover=cccccc&fcHover=2b2b2b&iconColorHover=555555&bgColorActive=007fff&bgTextureActive=flat&borderColorActive=003eff&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=fffa90&bgTextureHighlight=flat&borderColorHighlight=dad55e&fcHighlight=777620&iconColorHighlight=777620&bgColorError=fddfdf&bgTextureError=flat&borderColorError=f1a899&fcError=5f3f3f&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=666666&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=5px&offsetTopShadow=0px&offsetLeftShadow=0px&cornerRadiusShadow=8px +* Copyright OpenJS Foundation and other contributors; Licensed MIT */ + +.ui-draggable-handle { + touch-action: none; +} +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { + display: none; +} +.ui-helper-hidden-accessible { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} +.ui-helper-reset { + margin: 0; + padding: 0; + border: 0; + outline: 0; + line-height: 1.3; + text-decoration: none; + font-size: 100%; + list-style: none; +} +.ui-helper-clearfix:before, +.ui-helper-clearfix:after { + content: ""; + display: table; + border-collapse: collapse; +} +.ui-helper-clearfix:after { + clear: both; +} +.ui-helper-zfix { + width: 100%; + height: 100%; + top: 0; + left: 0; + position: absolute; + opacity: 0; +} + +.ui-front { + z-index: 100; +} + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { + cursor: default !important; + pointer-events: none; +} + + +/* Icons +----------------------------------*/ +.ui-icon { + display: inline-block; + vertical-align: middle; + margin-top: -.25em; + position: relative; + text-indent: -99999px; + overflow: hidden; + background-repeat: no-repeat; +} + +.ui-widget-icon-block { + left: 50%; + margin-left: -8px; + display: block; +} + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; +} +.ui-resizable { + position: relative; +} +.ui-resizable-handle { + position: absolute; + font-size: 0.1px; + display: block; + touch-action: none; +} +.ui-resizable-disabled .ui-resizable-handle, +.ui-resizable-autohide .ui-resizable-handle { + display: none; +} +.ui-resizable-n { + cursor: n-resize; + height: 7px; + width: 100%; + top: -5px; + left: 0; +} +.ui-resizable-s { + cursor: s-resize; + height: 7px; + width: 100%; + bottom: -5px; + left: 0; +} +.ui-resizable-e { + cursor: e-resize; + width: 7px; + right: -5px; + top: 0; + height: 100%; +} +.ui-resizable-w { + cursor: w-resize; + width: 7px; + left: -5px; + top: 0; + height: 100%; +} +.ui-resizable-se { + cursor: se-resize; + width: 12px; + height: 12px; + right: 1px; + bottom: 1px; +} +.ui-resizable-sw { + cursor: sw-resize; + width: 9px; + height: 9px; + left: -5px; + bottom: -5px; +} +.ui-resizable-nw { + cursor: nw-resize; + width: 9px; + height: 9px; + left: -5px; + top: -5px; +} +.ui-resizable-ne { + cursor: ne-resize; + width: 9px; + height: 9px; + right: -5px; + top: -5px; +} +.ui-selectable { + touch-action: none; +} +.ui-selectable-helper { + position: absolute; + z-index: 100; + border: 1px dotted black; +} +.ui-sortable-handle { + touch-action: none; +} +.ui-accordion .ui-accordion-header { + display: block; + cursor: pointer; + position: relative; + margin: 2px 0 0 0; + padding: .5em .5em .5em .7em; + font-size: 100%; +} +.ui-accordion .ui-accordion-content { + padding: 1em 2.2em; + border-top: 0; + overflow: auto; +} +.ui-autocomplete { + position: absolute; + top: 0; + left: 0; + cursor: default; +} +.ui-menu { + list-style: none; + padding: 0; + margin: 0; + display: block; + outline: 0; +} +.ui-menu .ui-menu { + position: absolute; +} +.ui-menu .ui-menu-item { + margin: 0; + cursor: pointer; +} +.ui-menu .ui-menu-item-wrapper { + position: relative; + padding: 3px 1em 3px .4em; +} +.ui-menu .ui-menu-divider { + margin: 5px 0; + height: 0; + font-size: 0; + line-height: 0; + border-width: 1px 0 0 0; +} +.ui-menu .ui-state-focus, +.ui-menu .ui-state-active { + margin: -1px; +} + +/* icon support */ +.ui-menu-icons { + position: relative; +} +.ui-menu-icons .ui-menu-item-wrapper { + padding-left: 2em; +} + +/* left-aligned */ +.ui-menu .ui-icon { + position: absolute; + top: 0; + bottom: 0; + left: .2em; + margin: auto 0; +} + +/* right-aligned */ +.ui-menu .ui-menu-icon { + left: auto; + right: 0; +} +.ui-button { + padding: .4em 1em; + display: inline-block; + position: relative; + line-height: normal; + margin-right: .1em; + cursor: pointer; + vertical-align: middle; + text-align: center; + -webkit-user-select: none; + user-select: none; +} + +.ui-button, +.ui-button:link, +.ui-button:visited, +.ui-button:hover, +.ui-button:active { + text-decoration: none; +} + +/* to make room for the icon, a width needs to be set here */ +.ui-button-icon-only { + width: 2em; + box-sizing: border-box; + text-indent: -9999px; + white-space: nowrap; +} + +/* no icon support for input elements */ +input.ui-button.ui-button-icon-only { + text-indent: 0; +} + +/* button icon element(s) */ +.ui-button-icon-only .ui-icon { + position: absolute; + top: 50%; + left: 50%; + margin-top: -8px; + margin-left: -8px; +} + +.ui-button.ui-icon-notext .ui-icon { + padding: 0; + width: 2.1em; + height: 2.1em; + text-indent: -9999px; + white-space: nowrap; + +} + +input.ui-button.ui-icon-notext .ui-icon { + width: auto; + height: auto; + text-indent: 0; + white-space: normal; + padding: .4em 1em; +} + +/* workarounds */ +/* Support: Firefox 5 - 125+ */ +input.ui-button::-moz-focus-inner, +button.ui-button::-moz-focus-inner { + border: 0; + padding: 0; +} +.ui-controlgroup { + vertical-align: middle; + display: inline-block; +} +.ui-controlgroup > .ui-controlgroup-item { + float: left; + margin-left: 0; + margin-right: 0; +} +.ui-controlgroup > .ui-controlgroup-item:focus, +.ui-controlgroup > .ui-controlgroup-item.ui-visual-focus { + z-index: 9999; +} +.ui-controlgroup-vertical > .ui-controlgroup-item { + display: block; + float: none; + width: 100%; + margin-top: 0; + margin-bottom: 0; + text-align: left; +} +.ui-controlgroup-vertical .ui-controlgroup-item { + box-sizing: border-box; +} +.ui-controlgroup .ui-controlgroup-label { + padding: .4em 1em; +} +.ui-controlgroup .ui-controlgroup-label span { + font-size: 80%; +} +.ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item { + border-left: none; +} +.ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item { + border-top: none; +} +.ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content { + border-right: none; +} +.ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content { + border-bottom: none; +} + +/* Spinner specific style fixes */ +.ui-controlgroup-vertical .ui-spinner-input { + width: calc( 100% - 2.4em ); +} +.ui-controlgroup-vertical .ui-spinner .ui-spinner-up { + border-top-style: solid; +} + +.ui-checkboxradio-label .ui-icon-background { + box-shadow: inset 1px 1px 1px #ccc; + border-radius: .12em; + border: none; +} +.ui-checkboxradio-radio-label .ui-icon-background { + width: 16px; + height: 16px; + border-radius: 1em; + overflow: visible; + border: none; +} +.ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon, +.ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon { + background-image: none; + width: 8px; + height: 8px; + border-width: 4px; + border-style: solid; +} +.ui-checkboxradio-disabled { + pointer-events: none; +} +.ui-datepicker { + width: 17em; + padding: .2em .2em 0; + display: none; +} +.ui-datepicker .ui-datepicker-header { + position: relative; + padding: .2em 0; +} +.ui-datepicker .ui-datepicker-prev, +.ui-datepicker .ui-datepicker-next { + position: absolute; + top: 2px; + width: 1.8em; + height: 1.8em; +} +.ui-datepicker .ui-datepicker-prev-hover, +.ui-datepicker .ui-datepicker-next-hover { + top: 1px; +} +.ui-datepicker .ui-datepicker-prev { + left: 2px; +} +.ui-datepicker .ui-datepicker-next { + right: 2px; +} +.ui-datepicker .ui-datepicker-prev-hover { + left: 1px; +} +.ui-datepicker .ui-datepicker-next-hover { + right: 1px; +} +.ui-datepicker .ui-datepicker-prev span, +.ui-datepicker .ui-datepicker-next span { + display: block; + position: absolute; + left: 50%; + margin-left: -8px; + top: 50%; + margin-top: -8px; +} +.ui-datepicker .ui-datepicker-title { + margin: 0 2.3em; + line-height: 1.8em; + text-align: center; +} +.ui-datepicker .ui-datepicker-title select { + font-size: 1em; + margin: 1px 0; +} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { + width: 45%; +} +.ui-datepicker table { + width: 100%; + font-size: .9em; + border-collapse: collapse; + margin: 0 0 .4em; +} +.ui-datepicker th { + padding: .7em .3em; + text-align: center; + font-weight: bold; + border: 0; +} +.ui-datepicker td { + border: 0; + padding: 1px; +} +.ui-datepicker td span, +.ui-datepicker td a { + display: block; + padding: .2em; + text-align: right; + text-decoration: none; +} +.ui-datepicker .ui-datepicker-buttonpane { + background-image: none; + margin: .7em 0 0 0; + padding: 0 .2em; + border-left: 0; + border-right: 0; + border-bottom: 0; +} +.ui-datepicker .ui-datepicker-buttonpane button { + float: right; + margin: .5em .2em .4em; + cursor: pointer; + padding: .2em .6em .3em .6em; + width: auto; + overflow: visible; +} +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { + float: left; +} + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { + width: auto; +} +.ui-datepicker-multi .ui-datepicker-group { + float: left; +} +.ui-datepicker-multi .ui-datepicker-group table { + width: 95%; + margin: 0 auto .4em; +} +.ui-datepicker-multi-2 .ui-datepicker-group { + width: 50%; +} +.ui-datepicker-multi-3 .ui-datepicker-group { + width: 33.3%; +} +.ui-datepicker-multi-4 .ui-datepicker-group { + width: 25%; +} +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { + border-left-width: 0; +} +.ui-datepicker-multi .ui-datepicker-buttonpane { + clear: left; +} +.ui-datepicker-row-break { + clear: both; + width: 100%; + font-size: 0; +} + +/* RTL support */ +.ui-datepicker-rtl { + direction: rtl; +} +.ui-datepicker-rtl .ui-datepicker-prev { + right: 2px; + left: auto; +} +.ui-datepicker-rtl .ui-datepicker-next { + left: 2px; + right: auto; +} +.ui-datepicker-rtl .ui-datepicker-prev:hover { + right: 1px; + left: auto; +} +.ui-datepicker-rtl .ui-datepicker-next:hover { + left: 1px; + right: auto; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane { + clear: right; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane button { + float: left; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, +.ui-datepicker-rtl .ui-datepicker-group { + float: right; +} +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { + border-right-width: 0; + border-left-width: 1px; +} + +/* Icons */ +.ui-datepicker .ui-icon { + display: block; + text-indent: -99999px; + overflow: hidden; + background-repeat: no-repeat; + left: .5em; + top: .3em; +} +.ui-dialog { + position: absolute; + top: 0; + left: 0; + padding: .2em; + outline: 0; +} +.ui-dialog .ui-dialog-titlebar { + padding: .4em 1em; + position: relative; +} +.ui-dialog .ui-dialog-title { + float: left; + margin: .1em 0; + white-space: nowrap; + width: 90%; + overflow: hidden; + text-overflow: ellipsis; +} +.ui-dialog .ui-dialog-titlebar-close { + position: absolute; + right: .3em; + top: 50%; + width: 20px; + margin: -10px 0 0 0; + padding: 1px; + height: 20px; +} +.ui-dialog .ui-dialog-content { + position: relative; + border: 0; + padding: .5em 1em; + background: none; + overflow: auto; +} +.ui-dialog .ui-dialog-buttonpane { + text-align: left; + border-width: 1px 0 0 0; + background-image: none; + margin-top: .5em; + padding: .3em 1em .5em .4em; +} +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { + float: right; +} +.ui-dialog .ui-dialog-buttonpane button { + margin: .5em .4em .5em 0; + cursor: pointer; +} +.ui-dialog .ui-resizable-n { + height: 2px; + top: 0; +} +.ui-dialog .ui-resizable-e { + width: 2px; + right: 0; +} +.ui-dialog .ui-resizable-s { + height: 2px; + bottom: 0; +} +.ui-dialog .ui-resizable-w { + width: 2px; + left: 0; +} +.ui-dialog .ui-resizable-se, +.ui-dialog .ui-resizable-sw, +.ui-dialog .ui-resizable-ne, +.ui-dialog .ui-resizable-nw { + width: 7px; + height: 7px; +} +.ui-dialog .ui-resizable-se { + right: 0; + bottom: 0; +} +.ui-dialog .ui-resizable-sw { + left: 0; + bottom: 0; +} +.ui-dialog .ui-resizable-ne { + right: 0; + top: 0; +} +.ui-dialog .ui-resizable-nw { + left: 0; + top: 0; +} +.ui-draggable .ui-dialog-titlebar { + cursor: move; +} +.ui-progressbar { + height: 2em; + text-align: left; + overflow: hidden; +} +.ui-progressbar .ui-progressbar-value { + margin: -1px; + height: 100%; +} +.ui-progressbar .ui-progressbar-overlay { + background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw=="); + height: 100%; + opacity: 0.25; +} +.ui-progressbar-indeterminate .ui-progressbar-value { + background-image: none; +} +.ui-selectmenu-menu { + padding: 0; + margin: 0; + position: absolute; + top: 0; + left: 0; + display: none; +} +.ui-selectmenu-menu .ui-menu { + overflow: auto; + overflow-x: hidden; + padding-bottom: 1px; +} +.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup { + font-size: 1em; + font-weight: bold; + line-height: 1.5; + padding: 2px 0.4em; + margin: 0.5em 0 0 0; + height: auto; + border: 0; +} +.ui-selectmenu-open { + display: block; +} +.ui-selectmenu-text { + display: block; + margin-right: 20px; + overflow: hidden; + text-overflow: ellipsis; +} +.ui-selectmenu-button.ui-button { + text-align: left; + white-space: nowrap; + width: 14em; +} +.ui-selectmenu-icon.ui-icon { + float: right; + margin-top: 0; +} +.ui-slider { + position: relative; + text-align: left; +} +.ui-slider .ui-slider-handle { + position: absolute; + z-index: 2; + width: 1.2em; + height: 1.2em; + cursor: pointer; + touch-action: none; +} +.ui-slider .ui-slider-range { + position: absolute; + z-index: 1; + font-size: .7em; + display: block; + border: 0; + background-position: 0 0; +} + +.ui-slider-horizontal { + height: .8em; +} +.ui-slider-horizontal .ui-slider-handle { + top: -.3em; + margin-left: -.6em; +} +.ui-slider-horizontal .ui-slider-range { + top: 0; + height: 100%; +} +.ui-slider-horizontal .ui-slider-range-min { + left: 0; +} +.ui-slider-horizontal .ui-slider-range-max { + right: 0; +} + +.ui-slider-vertical { + width: .8em; + height: 100px; +} +.ui-slider-vertical .ui-slider-handle { + left: -.3em; + margin-left: 0; + margin-bottom: -.6em; +} +.ui-slider-vertical .ui-slider-range { + left: 0; + width: 100%; +} +.ui-slider-vertical .ui-slider-range-min { + bottom: 0; +} +.ui-slider-vertical .ui-slider-range-max { + top: 0; +} +.ui-spinner { + position: relative; + display: inline-block; + overflow: hidden; + padding: 0; + vertical-align: middle; +} +.ui-spinner-input { + border: none; + background: none; + color: inherit; + padding: .222em 0; + margin: .2em 0; + vertical-align: middle; + margin-left: .4em; + margin-right: 2em; +} +.ui-spinner-button { + width: 1.6em; + height: 50%; + font-size: .5em; + padding: 0; + margin: 0; + text-align: center; + position: absolute; + cursor: default; + display: block; + overflow: hidden; + right: 0; +} +/* more specificity required here to override default borders */ +.ui-spinner a.ui-spinner-button { + border-top-style: none; + border-bottom-style: none; + border-right-style: none; +} +.ui-spinner-up { + top: 0; +} +.ui-spinner-down { + bottom: 0; +} +.ui-tabs { + position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ + padding: .2em; +} +.ui-tabs .ui-tabs-nav { + margin: 0; + padding: .2em .2em 0; +} +.ui-tabs .ui-tabs-nav li { + list-style: none; + float: left; + position: relative; + top: 0; + margin: 1px .2em 0 0; + border-bottom-width: 0; + padding: 0; + white-space: nowrap; +} +.ui-tabs .ui-tabs-nav .ui-tabs-anchor { + float: left; + padding: .5em 1em; + text-decoration: none; +} +.ui-tabs .ui-tabs-nav li.ui-tabs-active { + margin-bottom: -1px; + padding-bottom: 1px; +} +.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor, +.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor, +.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor { + cursor: text; +} +.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor { + cursor: pointer; +} +.ui-tabs .ui-tabs-panel { + display: block; + border-width: 0; + padding: 1em 1.4em; + background: none; +} +.ui-tooltip { + padding: 8px; + position: absolute; + z-index: 9999; + max-width: 300px; +} +body .ui-tooltip { + border-width: 2px; +} + +/* Component containers +----------------------------------*/ +.ui-widget { + font-family: Arial,Helvetica,sans-serif; + font-size: 1em; +} +.ui-widget .ui-widget { + font-size: 1em; +} +.ui-widget input, +.ui-widget select, +.ui-widget textarea, +.ui-widget button { + font-family: Arial,Helvetica,sans-serif; + font-size: 1em; +} +.ui-widget.ui-widget-content { + border: 1px solid #c5c5c5; +} +.ui-widget-content { + border: 1px solid #dddddd; + background: #ffffff; + color: #333333; +} +.ui-widget-content a { + color: #333333; +} +.ui-widget-header { + border: 1px solid #dddddd; + background: #e9e9e9; + color: #333333; + font-weight: bold; +} +.ui-widget-header a { + color: #333333; +} + +/* Interaction states +----------------------------------*/ +.ui-state-default, +.ui-widget-content .ui-state-default, +.ui-widget-header .ui-state-default, +.ui-button, + +/* We use html here because we need a greater specificity to make sure disabled +works properly when clicked or hovered */ +html .ui-button.ui-state-disabled:hover, +html .ui-button.ui-state-disabled:active { + border: 1px solid #c5c5c5; + background: #f6f6f6; + font-weight: normal; + color: #454545; +} +.ui-state-default a, +.ui-state-default a:link, +.ui-state-default a:visited, +a.ui-button, +a:link.ui-button, +a:visited.ui-button, +.ui-button { + color: #454545; + text-decoration: none; +} +.ui-state-hover, +.ui-widget-content .ui-state-hover, +.ui-widget-header .ui-state-hover, +.ui-state-focus, +.ui-widget-content .ui-state-focus, +.ui-widget-header .ui-state-focus, +.ui-button:hover, +.ui-button:focus { + border: 1px solid #cccccc; + background: #ededed; + font-weight: normal; + color: #2b2b2b; +} +.ui-state-hover a, +.ui-state-hover a:hover, +.ui-state-hover a:link, +.ui-state-hover a:visited, +.ui-state-focus a, +.ui-state-focus a:hover, +.ui-state-focus a:link, +.ui-state-focus a:visited, +a.ui-button:hover, +a.ui-button:focus { + color: #2b2b2b; + text-decoration: none; +} + +.ui-visual-focus { + box-shadow: 0 0 3px 1px rgb(94, 158, 214); +} +.ui-state-active, +.ui-widget-content .ui-state-active, +.ui-widget-header .ui-state-active, +a.ui-button:active, +.ui-button:active, +.ui-button.ui-state-active:hover { + border: 1px solid #003eff; + background: #007fff; + font-weight: normal; + color: #ffffff; +} +.ui-icon-background, +.ui-state-active .ui-icon-background { + border: #003eff; + background-color: #ffffff; +} +.ui-state-active a, +.ui-state-active a:link, +.ui-state-active a:visited { + color: #ffffff; + text-decoration: none; +} + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, +.ui-widget-content .ui-state-highlight, +.ui-widget-header .ui-state-highlight { + border: 1px solid #dad55e; + background: #fffa90; + color: #777620; +} +.ui-state-checked { + border: 1px solid #dad55e; + background: #fffa90; +} +.ui-state-highlight a, +.ui-widget-content .ui-state-highlight a, +.ui-widget-header .ui-state-highlight a { + color: #777620; +} +.ui-state-error, +.ui-widget-content .ui-state-error, +.ui-widget-header .ui-state-error { + border: 1px solid #f1a899; + background: #fddfdf; + color: #5f3f3f; +} +.ui-state-error a, +.ui-widget-content .ui-state-error a, +.ui-widget-header .ui-state-error a { + color: #5f3f3f; +} +.ui-state-error-text, +.ui-widget-content .ui-state-error-text, +.ui-widget-header .ui-state-error-text { + color: #5f3f3f; +} +.ui-priority-primary, +.ui-widget-content .ui-priority-primary, +.ui-widget-header .ui-priority-primary { + font-weight: bold; +} +.ui-priority-secondary, +.ui-widget-content .ui-priority-secondary, +.ui-widget-header .ui-priority-secondary { + opacity: .7; + font-weight: normal; +} +.ui-state-disabled, +.ui-widget-content .ui-state-disabled, +.ui-widget-header .ui-state-disabled { + opacity: .35; + background-image: none; +} + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { + width: 16px; + height: 16px; +} +.ui-icon, +.ui-widget-content .ui-icon { + background-image: url("images/ui-icons_444444_256x240.png"); +} +.ui-widget-header .ui-icon { + background-image: url("images/ui-icons_444444_256x240.png"); +} +.ui-state-hover .ui-icon, +.ui-state-focus .ui-icon, +.ui-button:hover .ui-icon, +.ui-button:focus .ui-icon { + background-image: url("images/ui-icons_555555_256x240.png"); +} +.ui-state-active .ui-icon, +.ui-button:active .ui-icon { + background-image: url("images/ui-icons_ffffff_256x240.png"); +} +.ui-state-highlight .ui-icon, +.ui-button .ui-state-highlight.ui-icon { + background-image: url("images/ui-icons_777620_256x240.png"); +} +.ui-state-error .ui-icon, +.ui-state-error-text .ui-icon { + background-image: url("images/ui-icons_cc0000_256x240.png"); +} +.ui-button .ui-icon { + background-image: url("images/ui-icons_777777_256x240.png"); +} + +/* positioning */ +/* Three classes needed to override `.ui-button:hover .ui-icon` */ +.ui-icon-blank.ui-icon-blank.ui-icon-blank { + background-image: none; +} +.ui-icon-caret-1-n { background-position: 0 0; } +.ui-icon-caret-1-ne { background-position: -16px 0; } +.ui-icon-caret-1-e { background-position: -32px 0; } +.ui-icon-caret-1-se { background-position: -48px 0; } +.ui-icon-caret-1-s { background-position: -65px 0; } +.ui-icon-caret-1-sw { background-position: -80px 0; } +.ui-icon-caret-1-w { background-position: -96px 0; } +.ui-icon-caret-1-nw { background-position: -112px 0; } +.ui-icon-caret-2-n-s { background-position: -128px 0; } +.ui-icon-caret-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -65px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -65px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 1px -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-on { background-position: -96px -144px; } +.ui-icon-radio-off { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-all, +.ui-corner-top, +.ui-corner-left, +.ui-corner-tl { + border-top-left-radius: 3px; +} +.ui-corner-all, +.ui-corner-top, +.ui-corner-right, +.ui-corner-tr { + border-top-right-radius: 3px; +} +.ui-corner-all, +.ui-corner-bottom, +.ui-corner-left, +.ui-corner-bl { + border-bottom-left-radius: 3px; +} +.ui-corner-all, +.ui-corner-bottom, +.ui-corner-right, +.ui-corner-br { + border-bottom-right-radius: 3px; +} + +/* Overlays */ +.ui-widget-overlay { + background: #aaaaaa; + opacity: .3; +} +.ui-widget-shadow { + box-shadow: 0px 0px 5px #666666; +} diff --git a/assets/jquery-ui/jquery-ui.js b/assets/jquery-ui/jquery-ui.js new file mode 100644 index 00000000..258e16d6 --- /dev/null +++ b/assets/jquery-ui/jquery-ui.js @@ -0,0 +1,18812 @@ +// Import jQuery so it can be found. +import jQuery from 'jquery'; + +/*! jQuery UI - v1.14.1 - 2024-11-14 +* https://jqueryui.com +* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/droppable.js, widgets/resizable.js, widgets/selectable.js, widgets/sortable.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/selectmenu.js, widgets/slider.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js +* Copyright OpenJS Foundation and other contributors; Licensed MIT */ + +( function( factory ) { + "use strict"; + + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define( [ "jquery" ], factory ); + } else { + + // Browser globals + factory( jQuery ); + } +} )( function( $ ) { +"use strict"; + +$.ui = $.ui || {}; + +var version = $.ui.version = "1.14.1"; + + +/*! + * jQuery UI Widget 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Widget +//>>group: Core +//>>description: Provides a factory for creating stateful widgets with a common API. +//>>docs: https://api.jqueryui.com/jQuery.widget/ +//>>demos: https://jqueryui.com/widget/ + + +var widgetUuid = 0; +var widgetHasOwnProperty = Array.prototype.hasOwnProperty; +var widgetSlice = Array.prototype.slice; + +$.cleanData = ( function( orig ) { + return function( elems ) { + var events, elem, i; + for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { + + // Only trigger remove when necessary to save time + events = $._data( elem, "events" ); + if ( events && events.remove ) { + $( elem ).triggerHandler( "remove" ); + } + } + orig( elems ); + }; +} )( $.cleanData ); + +$.widget = function( name, base, prototype ) { + var existingConstructor, constructor, basePrototype; + + // ProxiedPrototype allows the provided prototype to remain unmodified + // so that it can be used as a mixin for multiple widgets (#8876) + var proxiedPrototype = {}; + + var namespace = name.split( "." )[ 0 ]; + name = name.split( "." )[ 1 ]; + if ( name === "__proto__" || name === "constructor" ) { + return $.error( "Invalid widget name: " + name ); + } + var fullName = namespace + "-" + name; + + if ( !prototype ) { + prototype = base; + base = $.Widget; + } + + if ( Array.isArray( prototype ) ) { + prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); + } + + // Create selector for plugin + $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { + return !!$.data( elem, fullName ); + }; + + $[ namespace ] = $[ namespace ] || {}; + existingConstructor = $[ namespace ][ name ]; + constructor = $[ namespace ][ name ] = function( options, element ) { + + // Allow instantiation without "new" keyword + if ( !this || !this._createWidget ) { + return new constructor( options, element ); + } + + // Allow instantiation without initializing for simple inheritance + // must use "new" keyword (the code above always passes args) + if ( arguments.length ) { + this._createWidget( options, element ); + } + }; + + // Extend with the existing constructor to carry over any static properties + $.extend( constructor, existingConstructor, { + version: prototype.version, + + // Copy the object used to create the prototype in case we need to + // redefine the widget later + _proto: $.extend( {}, prototype ), + + // Track widgets that inherit from this widget in case this widget is + // redefined after a widget inherits from it + _childConstructors: [] + } ); + + basePrototype = new base(); + + // We need to make the options hash a property directly on the new instance + // otherwise we'll modify the options hash on the prototype that we're + // inheriting from + basePrototype.options = $.widget.extend( {}, basePrototype.options ); + $.each( prototype, function( prop, value ) { + if ( typeof value !== "function" ) { + proxiedPrototype[ prop ] = value; + return; + } + proxiedPrototype[ prop ] = ( function() { + function _super() { + return base.prototype[ prop ].apply( this, arguments ); + } + + function _superApply( args ) { + return base.prototype[ prop ].apply( this, args ); + } + + return function() { + var __super = this._super; + var __superApply = this._superApply; + var returnValue; + + this._super = _super; + this._superApply = _superApply; + + returnValue = value.apply( this, arguments ); + + this._super = __super; + this._superApply = __superApply; + + return returnValue; + }; + } )(); + } ); + constructor.prototype = $.widget.extend( basePrototype, { + + // TODO: remove support for widgetEventPrefix + // always use the name + a colon as the prefix, e.g., draggable:start + // don't prefix for widgets that aren't DOM-based + widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name + }, proxiedPrototype, { + constructor: constructor, + namespace: namespace, + widgetName: name, + widgetFullName: fullName + } ); + + // If this widget is being redefined then we need to find all widgets that + // are inheriting from it and redefine all of them so that they inherit from + // the new version of this widget. We're essentially trying to replace one + // level in the prototype chain. + if ( existingConstructor ) { + $.each( existingConstructor._childConstructors, function( i, child ) { + var childPrototype = child.prototype; + + // Redefine the child widget using the same prototype that was + // originally used, but inherit from the new version of the base + $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, + child._proto ); + } ); + + // Remove the list of existing child constructors from the old constructor + // so the old child constructors can be garbage collected + delete existingConstructor._childConstructors; + } else { + base._childConstructors.push( constructor ); + } + + $.widget.bridge( name, constructor ); + + return constructor; +}; + +$.widget.extend = function( target ) { + var input = widgetSlice.call( arguments, 1 ); + var inputIndex = 0; + var inputLength = input.length; + var key; + var value; + + for ( ; inputIndex < inputLength; inputIndex++ ) { + for ( key in input[ inputIndex ] ) { + value = input[ inputIndex ][ key ]; + if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { + + // Clone objects + if ( $.isPlainObject( value ) ) { + target[ key ] = $.isPlainObject( target[ key ] ) ? + $.widget.extend( {}, target[ key ], value ) : + + // Don't extend strings, arrays, etc. with objects + $.widget.extend( {}, value ); + + // Copy everything else by reference + } else { + target[ key ] = value; + } + } + } + } + return target; +}; + +$.widget.bridge = function( name, object ) { + var fullName = object.prototype.widgetFullName || name; + $.fn[ name ] = function( options ) { + var isMethodCall = typeof options === "string"; + var args = widgetSlice.call( arguments, 1 ); + var returnValue = this; + + if ( isMethodCall ) { + + // If this is an empty collection, we need to have the instance method + // return undefined instead of the jQuery instance + if ( !this.length && options === "instance" ) { + returnValue = undefined; + } else { + this.each( function() { + var methodValue; + var instance = $.data( this, fullName ); + + if ( options === "instance" ) { + returnValue = instance; + return false; + } + + if ( !instance ) { + return $.error( "cannot call methods on " + name + + " prior to initialization; " + + "attempted to call method '" + options + "'" ); + } + + if ( typeof instance[ options ] !== "function" || + options.charAt( 0 ) === "_" ) { + return $.error( "no such method '" + options + "' for " + name + + " widget instance" ); + } + + methodValue = instance[ options ].apply( instance, args ); + + if ( methodValue !== instance && methodValue !== undefined ) { + returnValue = methodValue && methodValue.jquery ? + returnValue.pushStack( methodValue.get() ) : + methodValue; + return false; + } + } ); + } + } else { + + // Allow multiple hashes to be passed on init + if ( args.length ) { + options = $.widget.extend.apply( null, [ options ].concat( args ) ); + } + + this.each( function() { + var instance = $.data( this, fullName ); + if ( instance ) { + instance.option( options || {} ); + if ( instance._init ) { + instance._init(); + } + } else { + $.data( this, fullName, new object( options, this ) ); + } + } ); + } + + return returnValue; + }; +}; + +$.Widget = function( /* options, element */ ) {}; +$.Widget._childConstructors = []; + +$.Widget.prototype = { + widgetName: "widget", + widgetEventPrefix: "", + defaultElement: "
          ", + + options: { + classes: {}, + disabled: false, + + // Callbacks + create: null + }, + + _createWidget: function( options, element ) { + element = $( element || this.defaultElement || this )[ 0 ]; + this.element = $( element ); + this.uuid = widgetUuid++; + this.eventNamespace = "." + this.widgetName + this.uuid; + + this.bindings = $(); + this.hoverable = $(); + this.focusable = $(); + this.classesElementLookup = {}; + + if ( element !== this ) { + $.data( element, this.widgetFullName, this ); + this._on( true, this.element, { + remove: function( event ) { + if ( event.target === element ) { + this.destroy(); + } + } + } ); + this.document = $( element.style ? + + // Element within the document + element.ownerDocument : + + // Element is window or document + element.document || element ); + this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); + } + + this.options = $.widget.extend( {}, + this.options, + this._getCreateOptions(), + options ); + + this._create(); + + if ( this.options.disabled ) { + this._setOptionDisabled( this.options.disabled ); + } + + this._trigger( "create", null, this._getCreateEventData() ); + this._init(); + }, + + _getCreateOptions: function() { + return {}; + }, + + _getCreateEventData: $.noop, + + _create: $.noop, + + _init: $.noop, + + destroy: function() { + var that = this; + + this._destroy(); + $.each( this.classesElementLookup, function( key, value ) { + that._removeClass( value, key ); + } ); + + // We can probably remove the unbind calls in 2.0 + // all event bindings should go through this._on() + this.element + .off( this.eventNamespace ) + .removeData( this.widgetFullName ); + this.widget() + .off( this.eventNamespace ) + .removeAttr( "aria-disabled" ); + + // Clean up events and states + this.bindings.off( this.eventNamespace ); + }, + + _destroy: $.noop, + + widget: function() { + return this.element; + }, + + option: function( key, value ) { + var options = key; + var parts; + var curOption; + var i; + + if ( arguments.length === 0 ) { + + // Don't return a reference to the internal hash + return $.widget.extend( {}, this.options ); + } + + if ( typeof key === "string" ) { + + // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } + options = {}; + parts = key.split( "." ); + key = parts.shift(); + if ( parts.length ) { + curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); + for ( i = 0; i < parts.length - 1; i++ ) { + curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; + curOption = curOption[ parts[ i ] ]; + } + key = parts.pop(); + if ( arguments.length === 1 ) { + return curOption[ key ] === undefined ? null : curOption[ key ]; + } + curOption[ key ] = value; + } else { + if ( arguments.length === 1 ) { + return this.options[ key ] === undefined ? null : this.options[ key ]; + } + options[ key ] = value; + } + } + + this._setOptions( options ); + + return this; + }, + + _setOptions: function( options ) { + var key; + + for ( key in options ) { + this._setOption( key, options[ key ] ); + } + + return this; + }, + + _setOption: function( key, value ) { + if ( key === "classes" ) { + this._setOptionClasses( value ); + } + + this.options[ key ] = value; + + if ( key === "disabled" ) { + this._setOptionDisabled( value ); + } + + return this; + }, + + _setOptionClasses: function( value ) { + var classKey, elements, currentElements; + + for ( classKey in value ) { + currentElements = this.classesElementLookup[ classKey ]; + if ( value[ classKey ] === this.options.classes[ classKey ] || + !currentElements || + !currentElements.length ) { + continue; + } + + // We are doing this to create a new jQuery object because the _removeClass() call + // on the next line is going to destroy the reference to the current elements being + // tracked. We need to save a copy of this collection so that we can add the new classes + // below. + elements = $( currentElements.get() ); + this._removeClass( currentElements, classKey ); + + // We don't use _addClass() here, because that uses this.options.classes + // for generating the string of classes. We want to use the value passed in from + // _setOption(), this is the new value of the classes option which was passed to + // _setOption(). We pass this value directly to _classes(). + elements.addClass( this._classes( { + element: elements, + keys: classKey, + classes: value, + add: true + } ) ); + } + }, + + _setOptionDisabled: function( value ) { + this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); + + // If the widget is becoming disabled, then nothing is interactive + if ( value ) { + this._removeClass( this.hoverable, null, "ui-state-hover" ); + this._removeClass( this.focusable, null, "ui-state-focus" ); + } + }, + + enable: function() { + return this._setOptions( { disabled: false } ); + }, + + disable: function() { + return this._setOptions( { disabled: true } ); + }, + + _classes: function( options ) { + var full = []; + var that = this; + + options = $.extend( { + element: this.element, + classes: this.options.classes || {} + }, options ); + + function bindRemoveEvent() { + var nodesToBind = []; + + options.element.each( function( _, element ) { + var isTracked = $.map( that.classesElementLookup, function( elements ) { + return elements; + } ) + .some( function( elements ) { + return elements.is( element ); + } ); + + if ( !isTracked ) { + nodesToBind.push( element ); + } + } ); + + that._on( $( nodesToBind ), { + remove: "_untrackClassesElement" + } ); + } + + function processClassString( classes, checkOption ) { + var current, i; + for ( i = 0; i < classes.length; i++ ) { + current = that.classesElementLookup[ classes[ i ] ] || $(); + if ( options.add ) { + bindRemoveEvent(); + current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); + } else { + current = $( current.not( options.element ).get() ); + } + that.classesElementLookup[ classes[ i ] ] = current; + full.push( classes[ i ] ); + if ( checkOption && options.classes[ classes[ i ] ] ) { + full.push( options.classes[ classes[ i ] ] ); + } + } + } + + if ( options.keys ) { + processClassString( options.keys.match( /\S+/g ) || [], true ); + } + if ( options.extra ) { + processClassString( options.extra.match( /\S+/g ) || [] ); + } + + return full.join( " " ); + }, + + _untrackClassesElement: function( event ) { + var that = this; + $.each( that.classesElementLookup, function( key, value ) { + if ( $.inArray( event.target, value ) !== -1 ) { + that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); + } + } ); + + this._off( $( event.target ) ); + }, + + _removeClass: function( element, keys, extra ) { + return this._toggleClass( element, keys, extra, false ); + }, + + _addClass: function( element, keys, extra ) { + return this._toggleClass( element, keys, extra, true ); + }, + + _toggleClass: function( element, keys, extra, add ) { + add = ( typeof add === "boolean" ) ? add : extra; + var shift = ( typeof element === "string" || element === null ), + options = { + extra: shift ? keys : extra, + keys: shift ? element : keys, + element: shift ? this.element : element, + add: add + }; + options.element.toggleClass( this._classes( options ), add ); + return this; + }, + + _on: function( suppressDisabledCheck, element, handlers ) { + var delegateElement; + var instance = this; + + // No suppressDisabledCheck flag, shuffle arguments + if ( typeof suppressDisabledCheck !== "boolean" ) { + handlers = element; + element = suppressDisabledCheck; + suppressDisabledCheck = false; + } + + // No element argument, shuffle and use this.element + if ( !handlers ) { + handlers = element; + element = this.element; + delegateElement = this.widget(); + } else { + element = delegateElement = $( element ); + this.bindings = this.bindings.add( element ); + } + + $.each( handlers, function( event, handler ) { + function handlerProxy() { + + // Allow widgets to customize the disabled handling + // - disabled as an array instead of boolean + // - disabled class as method for disabling individual parts + if ( !suppressDisabledCheck && + ( instance.options.disabled === true || + $( this ).hasClass( "ui-state-disabled" ) ) ) { + return; + } + return ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + } + + // Copy the guid so direct unbinding works + if ( typeof handler !== "string" ) { + handlerProxy.guid = handler.guid = + handler.guid || handlerProxy.guid || $.guid++; + } + + var match = event.match( /^([\w:-]*)\s*(.*)$/ ); + var eventName = match[ 1 ] + instance.eventNamespace; + var selector = match[ 2 ]; + + if ( selector ) { + delegateElement.on( eventName, selector, handlerProxy ); + } else { + element.on( eventName, handlerProxy ); + } + } ); + }, + + _off: function( element, eventName ) { + eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + + this.eventNamespace; + element.off( eventName ); + + // Clear the stack to avoid memory leaks (#10056) + this.bindings = $( this.bindings.not( element ).get() ); + this.focusable = $( this.focusable.not( element ).get() ); + this.hoverable = $( this.hoverable.not( element ).get() ); + }, + + _delay: function( handler, delay ) { + function handlerProxy() { + return ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + } + var instance = this; + return setTimeout( handlerProxy, delay || 0 ); + }, + + _hoverable: function( element ) { + this.hoverable = this.hoverable.add( element ); + this._on( element, { + mouseenter: function( event ) { + this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); + }, + mouseleave: function( event ) { + this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); + } + } ); + }, + + _focusable: function( element ) { + this.focusable = this.focusable.add( element ); + this._on( element, { + focusin: function( event ) { + this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); + }, + focusout: function( event ) { + this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); + } + } ); + }, + + _trigger: function( type, event, data ) { + var prop, orig; + var callback = this.options[ type ]; + + data = data || {}; + event = $.Event( event ); + event.type = ( type === this.widgetEventPrefix ? + type : + this.widgetEventPrefix + type ).toLowerCase(); + + // The original event may come from any element + // so we need to reset the target on the new event + event.target = this.element[ 0 ]; + + // Copy original event properties over to the new event + orig = event.originalEvent; + if ( orig ) { + for ( prop in orig ) { + if ( !( prop in event ) ) { + event[ prop ] = orig[ prop ]; + } + } + } + + this.element.trigger( event, data ); + return !( typeof callback === "function" && + callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || + event.isDefaultPrevented() ); + } +}; + +$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { + $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { + if ( typeof options === "string" ) { + options = { effect: options }; + } + + var hasOptions; + var effectName = !options ? + method : + options === true || typeof options === "number" ? + defaultEffect : + options.effect || defaultEffect; + + options = options || {}; + if ( typeof options === "number" ) { + options = { duration: options }; + } else if ( options === true ) { + options = {}; + } + + hasOptions = !$.isEmptyObject( options ); + options.complete = callback; + + if ( options.delay ) { + element.delay( options.delay ); + } + + if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { + element[ method ]( options ); + } else if ( effectName !== method && element[ effectName ] ) { + element[ effectName ]( options.duration, options.easing, callback ); + } else { + element.queue( function( next ) { + $( this )[ method ](); + if ( callback ) { + callback.call( element[ 0 ] ); + } + next(); + } ); + } + }; +} ); + +var widget = $.widget; + + +/*! + * jQuery UI Position 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + * + * https://api.jqueryui.com/position/ + */ + +//>>label: Position +//>>group: Core +//>>description: Positions elements relative to other elements. +//>>docs: https://api.jqueryui.com/position/ +//>>demos: https://jqueryui.com/position/ + + +( function() { +var cachedScrollbarWidth, + max = Math.max, + abs = Math.abs, + rhorizontal = /left|center|right/, + rvertical = /top|center|bottom/, + roffset = /[\+\-]\d+(\.[\d]+)?%?/, + rposition = /^\w+/, + rpercent = /%$/, + _position = $.fn.position; + +function getOffsets( offsets, width, height ) { + return [ + parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), + parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) + ]; +} + +function parseCss( element, property ) { + return parseInt( $.css( element, property ), 10 ) || 0; +} + +function isWindow( obj ) { + return obj != null && obj === obj.window; +} + +function getDimensions( elem ) { + var raw = elem[ 0 ]; + if ( raw.nodeType === 9 ) { + return { + width: elem.width(), + height: elem.height(), + offset: { top: 0, left: 0 } + }; + } + if ( isWindow( raw ) ) { + return { + width: elem.width(), + height: elem.height(), + offset: { top: elem.scrollTop(), left: elem.scrollLeft() } + }; + } + if ( raw.preventDefault ) { + return { + width: 0, + height: 0, + offset: { top: raw.pageY, left: raw.pageX } + }; + } + return { + width: elem.outerWidth(), + height: elem.outerHeight(), + offset: elem.offset() + }; +} + +$.position = { + scrollbarWidth: function() { + if ( cachedScrollbarWidth !== undefined ) { + return cachedScrollbarWidth; + } + var w1, w2, + div = $( "
          " + + "
          " ), + innerDiv = div.children()[ 0 ]; + + $( "body" ).append( div ); + w1 = innerDiv.offsetWidth; + div.css( "overflow", "scroll" ); + + w2 = innerDiv.offsetWidth; + + if ( w1 === w2 ) { + w2 = div[ 0 ].clientWidth; + } + + div.remove(); + + return ( cachedScrollbarWidth = w1 - w2 ); + }, + getScrollInfo: function( within ) { + var overflowX = within.isWindow || within.isDocument ? "" : + within.element.css( "overflow-x" ), + overflowY = within.isWindow || within.isDocument ? "" : + within.element.css( "overflow-y" ), + hasOverflowX = overflowX === "scroll" || + ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ), + hasOverflowY = overflowY === "scroll" || + ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight ); + return { + width: hasOverflowY ? $.position.scrollbarWidth() : 0, + height: hasOverflowX ? $.position.scrollbarWidth() : 0 + }; + }, + getWithinInfo: function( element ) { + var withinElement = $( element || window ), + isElemWindow = isWindow( withinElement[ 0 ] ), + isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, + hasOffset = !isElemWindow && !isDocument; + return { + element: withinElement, + isWindow: isElemWindow, + isDocument: isDocument, + offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, + scrollLeft: withinElement.scrollLeft(), + scrollTop: withinElement.scrollTop(), + width: withinElement.outerWidth(), + height: withinElement.outerHeight() + }; + } +}; + +$.fn.position = function( options ) { + if ( !options || !options.of ) { + return _position.apply( this, arguments ); + } + + // Make a copy, we don't want to modify arguments + options = $.extend( {}, options ); + + var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, + + // Make sure string options are treated as CSS selectors + target = typeof options.of === "string" ? + $( document ).find( options.of ) : + $( options.of ), + + within = $.position.getWithinInfo( options.within ), + scrollInfo = $.position.getScrollInfo( within ), + collision = ( options.collision || "flip" ).split( " " ), + offsets = {}; + + dimensions = getDimensions( target ); + if ( target[ 0 ].preventDefault ) { + + // Force left top to allow flipping + options.at = "left top"; + } + targetWidth = dimensions.width; + targetHeight = dimensions.height; + targetOffset = dimensions.offset; + + // Clone to reuse original targetOffset later + basePosition = $.extend( {}, targetOffset ); + + // Force my and at to have valid horizontal and vertical positions + // if a value is missing or invalid, it will be converted to center + $.each( [ "my", "at" ], function() { + var pos = ( options[ this ] || "" ).split( " " ), + horizontalOffset, + verticalOffset; + + if ( pos.length === 1 ) { + pos = rhorizontal.test( pos[ 0 ] ) ? + pos.concat( [ "center" ] ) : + rvertical.test( pos[ 0 ] ) ? + [ "center" ].concat( pos ) : + [ "center", "center" ]; + } + pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; + pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; + + // Calculate offsets + horizontalOffset = roffset.exec( pos[ 0 ] ); + verticalOffset = roffset.exec( pos[ 1 ] ); + offsets[ this ] = [ + horizontalOffset ? horizontalOffset[ 0 ] : 0, + verticalOffset ? verticalOffset[ 0 ] : 0 + ]; + + // Reduce to just the positions without the offsets + options[ this ] = [ + rposition.exec( pos[ 0 ] )[ 0 ], + rposition.exec( pos[ 1 ] )[ 0 ] + ]; + } ); + + // Normalize collision option + if ( collision.length === 1 ) { + collision[ 1 ] = collision[ 0 ]; + } + + if ( options.at[ 0 ] === "right" ) { + basePosition.left += targetWidth; + } else if ( options.at[ 0 ] === "center" ) { + basePosition.left += targetWidth / 2; + } + + if ( options.at[ 1 ] === "bottom" ) { + basePosition.top += targetHeight; + } else if ( options.at[ 1 ] === "center" ) { + basePosition.top += targetHeight / 2; + } + + atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); + basePosition.left += atOffset[ 0 ]; + basePosition.top += atOffset[ 1 ]; + + return this.each( function() { + var collisionPosition, using, + elem = $( this ), + elemWidth = elem.outerWidth(), + elemHeight = elem.outerHeight(), + marginLeft = parseCss( this, "marginLeft" ), + marginTop = parseCss( this, "marginTop" ), + collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + + scrollInfo.width, + collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + + scrollInfo.height, + position = $.extend( {}, basePosition ), + myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); + + if ( options.my[ 0 ] === "right" ) { + position.left -= elemWidth; + } else if ( options.my[ 0 ] === "center" ) { + position.left -= elemWidth / 2; + } + + if ( options.my[ 1 ] === "bottom" ) { + position.top -= elemHeight; + } else if ( options.my[ 1 ] === "center" ) { + position.top -= elemHeight / 2; + } + + position.left += myOffset[ 0 ]; + position.top += myOffset[ 1 ]; + + collisionPosition = { + marginLeft: marginLeft, + marginTop: marginTop + }; + + $.each( [ "left", "top" ], function( i, dir ) { + if ( $.ui.position[ collision[ i ] ] ) { + $.ui.position[ collision[ i ] ][ dir ]( position, { + targetWidth: targetWidth, + targetHeight: targetHeight, + elemWidth: elemWidth, + elemHeight: elemHeight, + collisionPosition: collisionPosition, + collisionWidth: collisionWidth, + collisionHeight: collisionHeight, + offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], + my: options.my, + at: options.at, + within: within, + elem: elem + } ); + } + } ); + + if ( options.using ) { + + // Adds feedback as second argument to using callback, if present + using = function( props ) { + var left = targetOffset.left - position.left, + right = left + targetWidth - elemWidth, + top = targetOffset.top - position.top, + bottom = top + targetHeight - elemHeight, + feedback = { + target: { + element: target, + left: targetOffset.left, + top: targetOffset.top, + width: targetWidth, + height: targetHeight + }, + element: { + element: elem, + left: position.left, + top: position.top, + width: elemWidth, + height: elemHeight + }, + horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", + vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" + }; + if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { + feedback.horizontal = "center"; + } + if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { + feedback.vertical = "middle"; + } + if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { + feedback.important = "horizontal"; + } else { + feedback.important = "vertical"; + } + options.using.call( this, props, feedback ); + }; + } + + elem.offset( $.extend( position, { using: using } ) ); + } ); +}; + +$.ui.position = { + fit: { + left: function( position, data ) { + var within = data.within, + withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, + outerWidth = within.width, + collisionPosLeft = position.left - data.collisionPosition.marginLeft, + overLeft = withinOffset - collisionPosLeft, + overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, + newOverRight; + + // Element is wider than within + if ( data.collisionWidth > outerWidth ) { + + // Element is initially over the left side of within + if ( overLeft > 0 && overRight <= 0 ) { + newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - + withinOffset; + position.left += overLeft - newOverRight; + + // Element is initially over right side of within + } else if ( overRight > 0 && overLeft <= 0 ) { + position.left = withinOffset; + + // Element is initially over both left and right sides of within + } else { + if ( overLeft > overRight ) { + position.left = withinOffset + outerWidth - data.collisionWidth; + } else { + position.left = withinOffset; + } + } + + // Too far left -> align with left edge + } else if ( overLeft > 0 ) { + position.left += overLeft; + + // Too far right -> align with right edge + } else if ( overRight > 0 ) { + position.left -= overRight; + + // Adjust based on position and margin + } else { + position.left = max( position.left - collisionPosLeft, position.left ); + } + }, + top: function( position, data ) { + var within = data.within, + withinOffset = within.isWindow ? within.scrollTop : within.offset.top, + outerHeight = data.within.height, + collisionPosTop = position.top - data.collisionPosition.marginTop, + overTop = withinOffset - collisionPosTop, + overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, + newOverBottom; + + // Element is taller than within + if ( data.collisionHeight > outerHeight ) { + + // Element is initially over the top of within + if ( overTop > 0 && overBottom <= 0 ) { + newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - + withinOffset; + position.top += overTop - newOverBottom; + + // Element is initially over bottom of within + } else if ( overBottom > 0 && overTop <= 0 ) { + position.top = withinOffset; + + // Element is initially over both top and bottom of within + } else { + if ( overTop > overBottom ) { + position.top = withinOffset + outerHeight - data.collisionHeight; + } else { + position.top = withinOffset; + } + } + + // Too far up -> align with top + } else if ( overTop > 0 ) { + position.top += overTop; + + // Too far down -> align with bottom edge + } else if ( overBottom > 0 ) { + position.top -= overBottom; + + // Adjust based on position and margin + } else { + position.top = max( position.top - collisionPosTop, position.top ); + } + } + }, + flip: { + left: function( position, data ) { + var within = data.within, + withinOffset = within.offset.left + within.scrollLeft, + outerWidth = within.width, + offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, + collisionPosLeft = position.left - data.collisionPosition.marginLeft, + overLeft = collisionPosLeft - offsetLeft, + overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, + myOffset = data.my[ 0 ] === "left" ? + -data.elemWidth : + data.my[ 0 ] === "right" ? + data.elemWidth : + 0, + atOffset = data.at[ 0 ] === "left" ? + data.targetWidth : + data.at[ 0 ] === "right" ? + -data.targetWidth : + 0, + offset = -2 * data.offset[ 0 ], + newOverRight, + newOverLeft; + + if ( overLeft < 0 ) { + newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - + outerWidth - withinOffset; + if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { + position.left += myOffset + atOffset + offset; + } + } else if ( overRight > 0 ) { + newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + + atOffset + offset - offsetLeft; + if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { + position.left += myOffset + atOffset + offset; + } + } + }, + top: function( position, data ) { + var within = data.within, + withinOffset = within.offset.top + within.scrollTop, + outerHeight = within.height, + offsetTop = within.isWindow ? within.scrollTop : within.offset.top, + collisionPosTop = position.top - data.collisionPosition.marginTop, + overTop = collisionPosTop - offsetTop, + overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, + top = data.my[ 1 ] === "top", + myOffset = top ? + -data.elemHeight : + data.my[ 1 ] === "bottom" ? + data.elemHeight : + 0, + atOffset = data.at[ 1 ] === "top" ? + data.targetHeight : + data.at[ 1 ] === "bottom" ? + -data.targetHeight : + 0, + offset = -2 * data.offset[ 1 ], + newOverTop, + newOverBottom; + if ( overTop < 0 ) { + newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - + outerHeight - withinOffset; + if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { + position.top += myOffset + atOffset + offset; + } + } else if ( overBottom > 0 ) { + newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + + offset - offsetTop; + if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { + position.top += myOffset + atOffset + offset; + } + } + } + }, + flipfit: { + left: function() { + $.ui.position.flip.left.apply( this, arguments ); + $.ui.position.fit.left.apply( this, arguments ); + }, + top: function() { + $.ui.position.flip.top.apply( this, arguments ); + $.ui.position.fit.top.apply( this, arguments ); + } + } +}; + +} )(); + +var position = $.ui.position; + + +/*! + * jQuery UI :data 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: :data Selector +//>>group: Core +//>>description: Selects elements which have data stored under the specified key. +//>>docs: https://api.jqueryui.com/data-selector/ + + +var data = $.extend( $.expr.pseudos, { + data: $.expr.createPseudo( function( dataName ) { + return function( elem ) { + return !!$.data( elem, dataName ); + }; + } ) +} ); + +/*! + * jQuery UI Disable Selection 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: disableSelection +//>>group: Core +//>>description: Disable selection of text content within the set of matched elements. +//>>docs: https://api.jqueryui.com/disableSelection/ + +// This file is deprecated + +var disableSelection = $.fn.extend( { + disableSelection: ( function() { + var eventType = "onselectstart" in document.createElement( "div" ) ? + "selectstart" : + "mousedown"; + + return function() { + return this.on( eventType + ".ui-disableSelection", function( event ) { + event.preventDefault(); + } ); + }; + } )(), + + enableSelection: function() { + return this.off( ".ui-disableSelection" ); + } +} ); + + +/*! + * jQuery UI Focusable 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: :focusable Selector +//>>group: Core +//>>description: Selects elements which can be focused. +//>>docs: https://api.jqueryui.com/focusable-selector/ + + +// Selectors +$.ui.focusable = function( element, hasTabindex ) { + var map, mapName, img, focusableIfVisible, fieldset, + nodeName = element.nodeName.toLowerCase(); + + if ( "area" === nodeName ) { + map = element.parentNode; + mapName = map.name; + if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { + return false; + } + img = $( "img[usemap='#" + mapName + "']" ); + return img.length > 0 && img.is( ":visible" ); + } + + if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) { + focusableIfVisible = !element.disabled; + + if ( focusableIfVisible ) { + + // Form controls within a disabled fieldset are disabled. + // However, controls within the fieldset's legend do not get disabled. + // Since controls generally aren't placed inside legends, we skip + // this portion of the check. + fieldset = $( element ).closest( "fieldset" )[ 0 ]; + if ( fieldset ) { + focusableIfVisible = !fieldset.disabled; + } + } + } else if ( "a" === nodeName ) { + focusableIfVisible = element.href || hasTabindex; + } else { + focusableIfVisible = hasTabindex; + } + + return focusableIfVisible && $( element ).is( ":visible" ) && + $( element ).css( "visibility" ) === "visible"; +}; + +$.extend( $.expr.pseudos, { + focusable: function( element ) { + return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); + } +} ); + +var focusable = $.ui.focusable; + + +/*! + * jQuery UI Form Reset Mixin 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Form Reset Mixin +//>>group: Core +//>>description: Refresh input widgets when their form is reset +//>>docs: https://api.jqueryui.com/form-reset-mixin/ + + +var formResetMixin = $.ui.formResetMixin = { + _formResetHandler: function() { + var form = $( this ); + + // Wait for the form reset to actually happen before refreshing + setTimeout( function() { + var instances = form.data( "ui-form-reset-instances" ); + $.each( instances, function() { + this.refresh(); + } ); + } ); + }, + + _bindFormResetHandler: function() { + this.form = $( this.element.prop( "form" ) ); + if ( !this.form.length ) { + return; + } + + var instances = this.form.data( "ui-form-reset-instances" ) || []; + if ( !instances.length ) { + + // We don't use _on() here because we use a single event handler per form + this.form.on( "reset.ui-form-reset", this._formResetHandler ); + } + instances.push( this ); + this.form.data( "ui-form-reset-instances", instances ); + }, + + _unbindFormResetHandler: function() { + if ( !this.form.length ) { + return; + } + + var instances = this.form.data( "ui-form-reset-instances" ); + instances.splice( $.inArray( this, instances ), 1 ); + if ( instances.length ) { + this.form.data( "ui-form-reset-instances", instances ); + } else { + this.form + .removeData( "ui-form-reset-instances" ) + .off( "reset.ui-form-reset" ); + } + } +}; + + +/*! + * jQuery UI Legacy jQuery Core patches 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + * + */ + +//>>label: Legacy jQuery Core patches +//>>group: Core +//>>description: Backport `.even()`, `.odd()` and `$.escapeSelector` to older jQuery Core versions (deprecated) + + +// Support: jQuery 2.2.x or older. +// This method has been defined in jQuery 3.0.0. +// Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js +if ( !$.escapeSelector ) { + $.escapeSelector = function( id ) { + return CSS.escape( id + "" ); + }; +} + +// Support: jQuery 3.4.x or older +// These methods have been defined in jQuery 3.5.0. +if ( !$.fn.even || !$.fn.odd ) { + $.fn.extend( { + even: function() { + return this.filter( function( i ) { + return i % 2 === 0; + } ); + }, + odd: function() { + return this.filter( function( i ) { + return i % 2 === 1; + } ); + } + } ); +} + +; +/*! + * jQuery UI Keycode 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Keycode +//>>group: Core +//>>description: Provide keycodes as keynames +//>>docs: https://api.jqueryui.com/jQuery.ui.keyCode/ + + +var keycode = $.ui.keyCode = { + BACKSPACE: 8, + COMMA: 188, + DELETE: 46, + DOWN: 40, + END: 35, + ENTER: 13, + ESCAPE: 27, + HOME: 36, + LEFT: 37, + PAGE_DOWN: 34, + PAGE_UP: 33, + PERIOD: 190, + RIGHT: 39, + SPACE: 32, + TAB: 9, + UP: 38 +}; + + +/*! + * jQuery UI Labels 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: labels +//>>group: Core +//>>description: Find all the labels associated with a given input +//>>docs: https://api.jqueryui.com/labels/ + + +var labels = $.fn.labels = function() { + var ancestor, selector, id, labels, ancestors; + + if ( !this.length ) { + return this.pushStack( [] ); + } + + // Check control.labels first + if ( this[ 0 ].labels && this[ 0 ].labels.length ) { + return this.pushStack( this[ 0 ].labels ); + } + + // If `control.labels` is empty - e.g. inside of document fragments - find + // the labels manually + labels = this.eq( 0 ).parents( "label" ); + + // Look for the label based on the id + id = this.attr( "id" ); + if ( id ) { + + // We don't search against the document in case the element + // is disconnected from the DOM + ancestor = this.eq( 0 ).parents().last(); + + // Get a full set of top level ancestors + ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); + + // Create a selector for the label based on the id + selector = "label[for='" + CSS.escape( id ) + "']"; + + labels = labels.add( ancestors.find( selector ).addBack( selector ) ); + + } + + // Return whatever we have found for labels + return this.pushStack( labels ); +}; + + +/*! + * jQuery UI Scroll Parent 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: scrollParent +//>>group: Core +//>>description: Get the closest ancestor element that is scrollable. +//>>docs: https://api.jqueryui.com/scrollParent/ + + +var scrollParent = $.fn.scrollParent = function( includeHidden ) { + var position = this.css( "position" ), + excludeStaticParent = position === "absolute", + overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, + scrollParent = this.parents().filter( function() { + var parent = $( this ); + if ( excludeStaticParent && parent.css( "position" ) === "static" ) { + return false; + } + return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + + parent.css( "overflow-x" ) ); + } ).eq( 0 ); + + return position === "fixed" || !scrollParent.length ? + $( this[ 0 ].ownerDocument || document ) : + scrollParent; +}; + + +/*! + * jQuery UI Tabbable 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: :tabbable Selector +//>>group: Core +//>>description: Selects elements which can be tabbed to. +//>>docs: https://api.jqueryui.com/tabbable-selector/ + + +var tabbable = $.extend( $.expr.pseudos, { + tabbable: function( element ) { + var tabIndex = $.attr( element, "tabindex" ), + hasTabindex = tabIndex != null; + return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); + } +} ); + + +/*! + * jQuery UI Unique ID 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: uniqueId +//>>group: Core +//>>description: Functions to generate and remove uniqueId's +//>>docs: https://api.jqueryui.com/uniqueId/ + + +var uniqueId = $.fn.extend( { + uniqueId: ( function() { + var uuid = 0; + + return function() { + return this.each( function() { + if ( !this.id ) { + this.id = "ui-id-" + ( ++uuid ); + } + } ); + }; + } )(), + + removeUniqueId: function() { + return this.each( function() { + if ( /^ui-id-\d+$/.test( this.id ) ) { + $( this ).removeAttr( "id" ); + } + } ); + } +} ); + + +/*! + * jQuery UI Mouse 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Mouse +//>>group: Widgets +//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. +//>>docs: https://api.jqueryui.com/mouse/ + + +var mouseHandled = false; +$( document ).on( "mouseup", function() { + mouseHandled = false; +} ); + +var widgetsMouse = $.widget( "ui.mouse", { + version: "1.14.1", + options: { + cancel: "input, textarea, button, select, option", + distance: 1, + delay: 0 + }, + _mouseInit: function() { + var that = this; + + this.element + .on( "mousedown." + this.widgetName, function( event ) { + return that._mouseDown( event ); + } ) + .on( "click." + this.widgetName, function( event ) { + if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { + $.removeData( event.target, that.widgetName + ".preventClickEvent" ); + event.stopImmediatePropagation(); + return false; + } + } ); + + this.started = false; + }, + + // TODO: make sure destroying one instance of mouse doesn't mess with + // other instances of mouse + _mouseDestroy: function() { + this.element.off( "." + this.widgetName ); + if ( this._mouseMoveDelegate ) { + this.document + .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) + .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); + } + }, + + _mouseDown: function( event ) { + + // don't let more than one widget handle mouseStart + if ( mouseHandled ) { + return; + } + + this._mouseMoved = false; + + // We may have missed mouseup (out of window) + if ( this._mouseStarted ) { + this._mouseUp( event ); + } + + this._mouseDownEvent = event; + + var that = this, + btnIsLeft = event.which === 1, + elIsCancel = typeof this.options.cancel === "string" ? + $( event.target ).closest( this.options.cancel ).length : + false; + if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { + return true; + } + + this.mouseDelayMet = !this.options.delay; + if ( !this.mouseDelayMet ) { + this._mouseDelayTimer = setTimeout( function() { + that.mouseDelayMet = true; + }, this.options.delay ); + } + + if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { + this._mouseStarted = ( this._mouseStart( event ) !== false ); + if ( !this._mouseStarted ) { + event.preventDefault(); + return true; + } + } + + // Click event may never have fired (Gecko & Opera) + if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { + $.removeData( event.target, this.widgetName + ".preventClickEvent" ); + } + + // These delegates are required to keep context + this._mouseMoveDelegate = function( event ) { + return that._mouseMove( event ); + }; + this._mouseUpDelegate = function( event ) { + return that._mouseUp( event ); + }; + + this.document + .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) + .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); + + event.preventDefault(); + + mouseHandled = true; + return true; + }, + + _mouseMove: function( event ) { + + // Only check for mouseups outside the document if you've moved inside the document + // at least once. + if ( this._mouseMoved && !event.which ) { + + // Support: Safari <=8 - 9 + // Safari sets which to 0 if you press any of the following keys + // during a drag (#14461) + if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || + event.originalEvent.metaKey || event.originalEvent.shiftKey ) { + this.ignoreMissingWhich = true; + } else if ( !this.ignoreMissingWhich ) { + return this._mouseUp( event ); + } + } + + if ( event.which || event.button ) { + this._mouseMoved = true; + } + + if ( this._mouseStarted ) { + this._mouseDrag( event ); + return event.preventDefault(); + } + + if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { + this._mouseStarted = + ( this._mouseStart( this._mouseDownEvent, event ) !== false ); + if ( this._mouseStarted ) { + this._mouseDrag( event ); + } else { + this._mouseUp( event ); + } + } + + return !this._mouseStarted; + }, + + _mouseUp: function( event ) { + this.document + .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) + .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); + + if ( this._mouseStarted ) { + this._mouseStarted = false; + + if ( event.target === this._mouseDownEvent.target ) { + $.data( event.target, this.widgetName + ".preventClickEvent", true ); + } + + this._mouseStop( event ); + } + + if ( this._mouseDelayTimer ) { + clearTimeout( this._mouseDelayTimer ); + delete this._mouseDelayTimer; + } + + this.ignoreMissingWhich = false; + mouseHandled = false; + event.preventDefault(); + }, + + _mouseDistanceMet: function( event ) { + return ( Math.max( + Math.abs( this._mouseDownEvent.pageX - event.pageX ), + Math.abs( this._mouseDownEvent.pageY - event.pageY ) + ) >= this.options.distance + ); + }, + + _mouseDelayMet: function( /* event */ ) { + return this.mouseDelayMet; + }, + + // These are placeholder methods, to be overriden by extending plugin + _mouseStart: function( /* event */ ) {}, + _mouseDrag: function( /* event */ ) {}, + _mouseStop: function( /* event */ ) {}, + _mouseCapture: function( /* event */ ) { + return true; + } +} ); + + + +// $.ui.plugin is deprecated. Use $.widget() extensions instead. +var plugin = $.ui.plugin = { + add: function( module, option, set ) { + var i, + proto = $.ui[ module ].prototype; + for ( i in set ) { + proto.plugins[ i ] = proto.plugins[ i ] || []; + proto.plugins[ i ].push( [ option, set[ i ] ] ); + } + }, + call: function( instance, name, args, allowDisconnected ) { + var i, + set = instance.plugins[ name ]; + + if ( !set ) { + return; + } + + if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || + instance.element[ 0 ].parentNode.nodeType === 11 ) ) { + return; + } + + for ( i = 0; i < set.length; i++ ) { + if ( instance.options[ set[ i ][ 0 ] ] ) { + set[ i ][ 1 ].apply( instance.element, args ); + } + } + } +}; + + +/*! + * jQuery UI Draggable 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Draggable +//>>group: Interactions +//>>description: Enables dragging functionality for any element. +//>>docs: https://api.jqueryui.com/draggable/ +//>>demos: https://jqueryui.com/draggable/ +//>>css.structure: ../../themes/base/draggable.css + + +$.widget( "ui.draggable", $.ui.mouse, { + version: "1.14.1", + widgetEventPrefix: "drag", + options: { + addClasses: true, + appendTo: "parent", + axis: false, + connectToSortable: false, + containment: false, + cursor: "auto", + cursorAt: false, + grid: false, + handle: false, + helper: "original", + iframeFix: false, + opacity: false, + refreshPositions: false, + revert: false, + revertDuration: 500, + scope: "default", + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + snap: false, + snapMode: "both", + snapTolerance: 20, + stack: false, + zIndex: false, + + // Callbacks + drag: null, + start: null, + stop: null + }, + _create: function() { + + if ( this.options.helper === "original" ) { + this._setPositionRelative(); + } + if ( this.options.addClasses ) { + this._addClass( "ui-draggable" ); + } + this._setHandleClassName(); + + this._mouseInit(); + }, + + _setOption: function( key, value ) { + this._super( key, value ); + if ( key === "handle" ) { + this._removeHandleClassName(); + this._setHandleClassName(); + } + }, + + _destroy: function() { + if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { + this.destroyOnClear = true; + return; + } + this._removeHandleClassName(); + this._mouseDestroy(); + }, + + _mouseCapture: function( event ) { + var o = this.options; + + // Among others, prevent a drag on a resizable-handle + if ( this.helper || o.disabled || + $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { + return false; + } + + //Quit if we're not on a valid handle + this.handle = this._getHandle( event ); + if ( !this.handle ) { + return false; + } + + this._blurActiveElement( event ); + + this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); + + return true; + + }, + + _blockFrames: function( selector ) { + this.iframeBlocks = this.document.find( selector ).map( function() { + var iframe = $( this ); + + return $( "
          " ) + .css( "position", "absolute" ) + .appendTo( iframe.parent() ) + .outerWidth( iframe.outerWidth() ) + .outerHeight( iframe.outerHeight() ) + .offset( iframe.offset() )[ 0 ]; + } ); + }, + + _unblockFrames: function() { + if ( this.iframeBlocks ) { + this.iframeBlocks.remove(); + delete this.iframeBlocks; + } + }, + + _blurActiveElement: function( event ) { + var activeElement = this.document[ 0 ].activeElement, + target = $( event.target ); + + // Don't blur if the event occurred on an element that is within + // the currently focused element + // See #10527, #12472 + if ( target.closest( activeElement ).length ) { + return; + } + + // Blur any element that currently has focus, see #4261 + $( activeElement ).trigger( "blur" ); + }, + + _mouseStart: function( event ) { + + var o = this.options; + + //Create and append the visible helper + this.helper = this._createHelper( event ); + + this._addClass( this.helper, "ui-draggable-dragging" ); + + //Cache the helper size + this._cacheHelperProportions(); + + //If ddmanager is used for droppables, set the global draggable + if ( $.ui.ddmanager ) { + $.ui.ddmanager.current = this; + } + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //Store the helper's css position + this.cssPosition = this.helper.css( "position" ); + this.scrollParent = this.helper.scrollParent( true ); + this.offsetParent = this.helper.offsetParent(); + this.hasFixedAncestor = this.helper.parents().filter( function() { + return $( this ).css( "position" ) === "fixed"; + } ).length > 0; + + //The element's absolute position on the page minus margins + this.positionAbs = this.element.offset(); + this._refreshOffsets( event ); + + //Generate the original position + this.originalPosition = this.position = this._generatePosition( event, false ); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + + //Adjust the mouse offset relative to the helper if "cursorAt" is supplied + if ( o.cursorAt ) { + this._adjustOffsetFromHelper( o.cursorAt ); + } + + //Set a containment if given in the options + this._setContainment(); + + //Trigger event + callbacks + if ( this._trigger( "start", event ) === false ) { + this._clear(); + return false; + } + + //Recache the helper size + this._cacheHelperProportions(); + + //Prepare the droppable offsets + if ( $.ui.ddmanager && !o.dropBehaviour ) { + $.ui.ddmanager.prepareOffsets( this, event ); + } + + // Execute the drag once - this causes the helper not to be visible before getting its + // correct position + this._mouseDrag( event, true ); + + // If the ddmanager is used for droppables, inform the manager that dragging has started + // (see #5003) + if ( $.ui.ddmanager ) { + $.ui.ddmanager.dragStart( this, event ); + } + + return true; + }, + + _refreshOffsets: function( event ) { + this.offset = { + top: this.positionAbs.top - this.margins.top, + left: this.positionAbs.left - this.margins.left, + scroll: false, + parent: this._getParentOffset(), + relative: this._getRelativeOffset() + }; + + this.offset.click = { + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }; + }, + + _mouseDrag: function( event, noPropagation ) { + + // reset any necessary cached properties (see #5009) + if ( this.hasFixedAncestor ) { + this.offset.parent = this._getParentOffset(); + } + + //Compute the helpers position + this.position = this._generatePosition( event, true ); + this.positionAbs = this._convertPositionTo( "absolute" ); + + //Call plugins and callbacks and use the resulting position if something is returned + if ( !noPropagation ) { + var ui = this._uiHash(); + if ( this._trigger( "drag", event, ui ) === false ) { + this._mouseUp( new $.Event( "mouseup", event ) ); + return false; + } + this.position = ui.position; + } + + this.helper[ 0 ].style.left = this.position.left + "px"; + this.helper[ 0 ].style.top = this.position.top + "px"; + + if ( $.ui.ddmanager ) { + $.ui.ddmanager.drag( this, event ); + } + + return false; + }, + + _mouseStop: function( event ) { + + //If we are using droppables, inform the manager about the drop + var that = this, + dropped = false; + if ( $.ui.ddmanager && !this.options.dropBehaviour ) { + dropped = $.ui.ddmanager.drop( this, event ); + } + + //if a drop comes from outside (a sortable) + if ( this.dropped ) { + dropped = this.dropped; + this.dropped = false; + } + + if ( ( this.options.revert === "invalid" && !dropped ) || + ( this.options.revert === "valid" && dropped ) || + this.options.revert === true || ( typeof this.options.revert === "function" && + this.options.revert.call( this.element, dropped ) ) + ) { + $( this.helper ).animate( + this.originalPosition, + parseInt( this.options.revertDuration, 10 ), + function() { + if ( that._trigger( "stop", event ) !== false ) { + that._clear(); + } + } + ); + } else { + if ( this._trigger( "stop", event ) !== false ) { + this._clear(); + } + } + + return false; + }, + + _mouseUp: function( event ) { + this._unblockFrames(); + + // If the ddmanager is used for droppables, inform the manager that dragging has stopped + // (see #5003) + if ( $.ui.ddmanager ) { + $.ui.ddmanager.dragStop( this, event ); + } + + // Only need to focus if the event occurred on the draggable itself, see #10527 + if ( this.handleElement.is( event.target ) ) { + + // The interaction is over; whether or not the click resulted in a drag, + // focus the element + this.element.trigger( "focus" ); + } + + return $.ui.mouse.prototype._mouseUp.call( this, event ); + }, + + cancel: function() { + + if ( this.helper.is( ".ui-draggable-dragging" ) ) { + this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); + } else { + this._clear(); + } + + return this; + + }, + + _getHandle: function( event ) { + return this.options.handle ? + !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : + true; + }, + + _setHandleClassName: function() { + this.handleElement = this.options.handle ? + this.element.find( this.options.handle ) : this.element; + this._addClass( this.handleElement, "ui-draggable-handle" ); + }, + + _removeHandleClassName: function() { + this._removeClass( this.handleElement, "ui-draggable-handle" ); + }, + + _createHelper: function( event ) { + + var o = this.options, + helperIsFunction = typeof o.helper === "function", + helper = helperIsFunction ? + $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : + ( o.helper === "clone" ? + this.element.clone().removeAttr( "id" ) : + this.element ); + + if ( !helper.parents( "body" ).length ) { + helper.appendTo( ( o.appendTo === "parent" ? + this.element[ 0 ].parentNode : + o.appendTo ) ); + } + + // https://bugs.jqueryui.com/ticket/9446 + // a helper function can return the original element + // which wouldn't have been set to relative in _create + if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { + this._setPositionRelative(); + } + + if ( helper[ 0 ] !== this.element[ 0 ] && + !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { + helper.css( "position", "absolute" ); + } + + return helper; + + }, + + _setPositionRelative: function() { + if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { + this.element[ 0 ].style.position = "relative"; + } + }, + + _adjustOffsetFromHelper: function( obj ) { + if ( typeof obj === "string" ) { + obj = obj.split( " " ); + } + if ( Array.isArray( obj ) ) { + obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; + } + if ( "left" in obj ) { + this.offset.click.left = obj.left + this.margins.left; + } + if ( "right" in obj ) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ( "top" in obj ) { + this.offset.click.top = obj.top + this.margins.top; + } + if ( "bottom" in obj ) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _isRootNode: function( element ) { + return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; + }, + + _getParentOffset: function() { + + //Get the offsetParent and cache its position + var po = this.offsetParent.offset(), + document = this.document[ 0 ]; + + // This is a special case where we need to modify a offset calculated on start, since the + // following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the + // next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't + // the document, which means that the scroll is included in the initial calculation of the + // offset of the parent, and never recalculated upon drag + if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && + $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { + po = { top: 0, left: 0 }; + } + + return { + top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), + left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) + }; + + }, + + _getRelativeOffset: function() { + if ( this.cssPosition !== "relative" ) { + return { top: 0, left: 0 }; + } + + var p = this.element.position(), + scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); + + return { + top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), + left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) + }; + + }, + + _cacheMargins: function() { + this.margins = { + left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), + top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), + right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), + bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) + }; + }, + + _cacheHelperProportions: function() { + this.helperProportions = { + width: this.helper.outerWidth(), + height: this.helper.outerHeight() + }; + }, + + _setContainment: function() { + + var isUserScrollable, c, ce, + o = this.options, + document = this.document[ 0 ]; + + this.relativeContainer = null; + + if ( !o.containment ) { + this.containment = null; + return; + } + + if ( o.containment === "window" ) { + this.containment = [ + $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, + $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, + $( window ).scrollLeft() + $( window ).width() - + this.helperProportions.width - this.margins.left, + $( window ).scrollTop() + + ( $( window ).height() || document.body.parentNode.scrollHeight ) - + this.helperProportions.height - this.margins.top + ]; + return; + } + + if ( o.containment === "document" ) { + this.containment = [ + 0, + 0, + $( document ).width() - this.helperProportions.width - this.margins.left, + ( $( document ).height() || document.body.parentNode.scrollHeight ) - + this.helperProportions.height - this.margins.top + ]; + return; + } + + if ( o.containment.constructor === Array ) { + this.containment = o.containment; + return; + } + + if ( o.containment === "parent" ) { + o.containment = this.helper[ 0 ].parentNode; + } + + c = $( o.containment ); + ce = c[ 0 ]; + + if ( !ce ) { + return; + } + + isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); + + this.containment = [ + ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), + ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), + ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - + ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - + ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - + this.helperProportions.width - + this.margins.left - + this.margins.right, + ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - + ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - + ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - + this.helperProportions.height - + this.margins.top - + this.margins.bottom + ]; + this.relativeContainer = c; + }, + + _convertPositionTo: function( d, pos ) { + + if ( !pos ) { + pos = this.position; + } + + var mod = d === "absolute" ? 1 : -1, + scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); + + return { + top: ( + + // The absolute mouse position + pos.top + + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.top * mod + + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.top * mod - + ( ( this.cssPosition === "fixed" ? + -this.offset.scroll.top : + ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) + ), + left: ( + + // The absolute mouse position + pos.left + + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.left * mod + + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.left * mod - + ( ( this.cssPosition === "fixed" ? + -this.offset.scroll.left : + ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) + ) + }; + + }, + + _generatePosition: function( event, constrainPosition ) { + + var containment, co, top, left, + o = this.options, + scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), + pageX = event.pageX, + pageY = event.pageY; + + // Cache the scroll + if ( !scrollIsRootNode || !this.offset.scroll ) { + this.offset.scroll = { + top: this.scrollParent.scrollTop(), + left: this.scrollParent.scrollLeft() + }; + } + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + // If we are not dragging yet, we won't check for options + if ( constrainPosition ) { + if ( this.containment ) { + if ( this.relativeContainer ) { + co = this.relativeContainer.offset(); + containment = [ + this.containment[ 0 ] + co.left, + this.containment[ 1 ] + co.top, + this.containment[ 2 ] + co.left, + this.containment[ 3 ] + co.top + ]; + } else { + containment = this.containment; + } + + if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { + pageX = containment[ 0 ] + this.offset.click.left; + } + if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { + pageY = containment[ 1 ] + this.offset.click.top; + } + if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { + pageX = containment[ 2 ] + this.offset.click.left; + } + if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { + pageY = containment[ 3 ] + this.offset.click.top; + } + } + + if ( o.grid ) { + + //Check for grid elements set to 0 to prevent divide by 0 error causing invalid + // argument errors in IE (see ticket #6950) + top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - + this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; + pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || + top - this.offset.click.top > containment[ 3 ] ) ? + top : + ( ( top - this.offset.click.top >= containment[ 1 ] ) ? + top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; + + left = o.grid[ 0 ] ? this.originalPageX + + Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : + this.originalPageX; + pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || + left - this.offset.click.left > containment[ 2 ] ) ? + left : + ( ( left - this.offset.click.left >= containment[ 0 ] ) ? + left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; + } + + if ( o.axis === "y" ) { + pageX = this.originalPageX; + } + + if ( o.axis === "x" ) { + pageY = this.originalPageY; + } + } + + return { + top: ( + + // The absolute mouse position + pageY - + + // Click offset (relative to the element) + this.offset.click.top - + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.top - + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.top + + ( this.cssPosition === "fixed" ? + -this.offset.scroll.top : + ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) + ), + left: ( + + // The absolute mouse position + pageX - + + // Click offset (relative to the element) + this.offset.click.left - + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.left - + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.left + + ( this.cssPosition === "fixed" ? + -this.offset.scroll.left : + ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) + ) + }; + + }, + + _clear: function() { + this._removeClass( this.helper, "ui-draggable-dragging" ); + if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { + this.helper.remove(); + } + this.helper = null; + this.cancelHelperRemoval = false; + if ( this.destroyOnClear ) { + this.destroy(); + } + }, + + // From now on bulk stuff - mainly helpers + + _trigger: function( type, event, ui ) { + ui = ui || this._uiHash(); + $.ui.plugin.call( this, type, [ event, ui, this ], true ); + + // Absolute position and offset (see #6884 ) have to be recalculated after plugins + if ( /^(drag|start|stop)/.test( type ) ) { + this.positionAbs = this._convertPositionTo( "absolute" ); + ui.offset = this.positionAbs; + } + return $.Widget.prototype._trigger.call( this, type, event, ui ); + }, + + plugins: {}, + + _uiHash: function() { + return { + helper: this.helper, + position: this.position, + originalPosition: this.originalPosition, + offset: this.positionAbs + }; + } + +} ); + +$.ui.plugin.add( "draggable", "connectToSortable", { + start: function( event, ui, draggable ) { + var uiSortable = $.extend( {}, ui, { + item: draggable.element + } ); + + draggable.sortables = []; + $( draggable.options.connectToSortable ).each( function() { + var sortable = $( this ).sortable( "instance" ); + + if ( sortable && !sortable.options.disabled ) { + draggable.sortables.push( sortable ); + + // RefreshPositions is called at drag start to refresh the containerCache + // which is used in drag. This ensures it's initialized and synchronized + // with any changes that might have happened on the page since initialization. + sortable.refreshPositions(); + sortable._trigger( "activate", event, uiSortable ); + } + } ); + }, + stop: function( event, ui, draggable ) { + var uiSortable = $.extend( {}, ui, { + item: draggable.element + } ); + + draggable.cancelHelperRemoval = false; + + $.each( draggable.sortables, function() { + var sortable = this; + + if ( sortable.isOver ) { + sortable.isOver = 0; + + // Allow this sortable to handle removing the helper + draggable.cancelHelperRemoval = true; + sortable.cancelHelperRemoval = false; + + // Use _storedCSS To restore properties in the sortable, + // as this also handles revert (#9675) since the draggable + // may have modified them in unexpected ways (#8809) + sortable._storedCSS = { + position: sortable.placeholder.css( "position" ), + top: sortable.placeholder.css( "top" ), + left: sortable.placeholder.css( "left" ) + }; + + sortable._mouseStop( event ); + + // Once drag has ended, the sortable should return to using + // its original helper, not the shared helper from draggable + sortable.options.helper = sortable.options._helper; + } else { + + // Prevent this Sortable from removing the helper. + // However, don't set the draggable to remove the helper + // either as another connected Sortable may yet handle the removal. + sortable.cancelHelperRemoval = true; + + sortable._trigger( "deactivate", event, uiSortable ); + } + } ); + }, + drag: function( event, ui, draggable ) { + $.each( draggable.sortables, function() { + var innermostIntersecting = false, + sortable = this; + + // Copy over variables that sortable's _intersectsWith uses + sortable.positionAbs = draggable.positionAbs; + sortable.helperProportions = draggable.helperProportions; + sortable.offset.click = draggable.offset.click; + + if ( sortable._intersectsWith( sortable.containerCache ) ) { + innermostIntersecting = true; + + $.each( draggable.sortables, function() { + + // Copy over variables that sortable's _intersectsWith uses + this.positionAbs = draggable.positionAbs; + this.helperProportions = draggable.helperProportions; + this.offset.click = draggable.offset.click; + + if ( this !== sortable && + this._intersectsWith( this.containerCache ) && + $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { + innermostIntersecting = false; + } + + return innermostIntersecting; + } ); + } + + if ( innermostIntersecting ) { + + // If it intersects, we use a little isOver variable and set it once, + // so that the move-in stuff gets fired only once. + if ( !sortable.isOver ) { + sortable.isOver = 1; + + // Store draggable's parent in case we need to reappend to it later. + draggable._parent = ui.helper.parent(); + + sortable.currentItem = ui.helper + .appendTo( sortable.element ) + .data( "ui-sortable-item", true ); + + // Store helper option to later restore it + sortable.options._helper = sortable.options.helper; + + sortable.options.helper = function() { + return ui.helper[ 0 ]; + }; + + // Fire the start events of the sortable with our passed browser event, + // and our own helper (so it doesn't create a new one) + event.target = sortable.currentItem[ 0 ]; + sortable._mouseCapture( event, true ); + sortable._mouseStart( event, true, true ); + + // Because the browser event is way off the new appended portlet, + // modify necessary variables to reflect the changes + sortable.offset.click.top = draggable.offset.click.top; + sortable.offset.click.left = draggable.offset.click.left; + sortable.offset.parent.left -= draggable.offset.parent.left - + sortable.offset.parent.left; + sortable.offset.parent.top -= draggable.offset.parent.top - + sortable.offset.parent.top; + + draggable._trigger( "toSortable", event ); + + // Inform draggable that the helper is in a valid drop zone, + // used solely in the revert option to handle "valid/invalid". + draggable.dropped = sortable.element; + + // Need to refreshPositions of all sortables in the case that + // adding to one sortable changes the location of the other sortables (#9675) + $.each( draggable.sortables, function() { + this.refreshPositions(); + } ); + + // Hack so receive/update callbacks work (mostly) + draggable.currentItem = draggable.element; + sortable.fromOutside = draggable; + } + + if ( sortable.currentItem ) { + sortable._mouseDrag( event ); + + // Copy the sortable's position because the draggable's can potentially reflect + // a relative position, while sortable is always absolute, which the dragged + // element has now become. (#8809) + ui.position = sortable.position; + } + } else { + + // If it doesn't intersect with the sortable, and it intersected before, + // we fake the drag stop of the sortable, but make sure it doesn't remove + // the helper by using cancelHelperRemoval. + if ( sortable.isOver ) { + + sortable.isOver = 0; + sortable.cancelHelperRemoval = true; + + // Calling sortable's mouseStop would trigger a revert, + // so revert must be temporarily false until after mouseStop is called. + sortable.options._revert = sortable.options.revert; + sortable.options.revert = false; + + sortable._trigger( "out", event, sortable._uiHash( sortable ) ); + sortable._mouseStop( event, true ); + + // Restore sortable behaviors that were modfied + // when the draggable entered the sortable area (#9481) + sortable.options.revert = sortable.options._revert; + sortable.options.helper = sortable.options._helper; + + if ( sortable.placeholder ) { + sortable.placeholder.remove(); + } + + // Restore and recalculate the draggable's offset considering the sortable + // may have modified them in unexpected ways. (#8809, #10669) + ui.helper.appendTo( draggable._parent ); + draggable._refreshOffsets( event ); + ui.position = draggable._generatePosition( event, true ); + + draggable._trigger( "fromSortable", event ); + + // Inform draggable that the helper is no longer in a valid drop zone + draggable.dropped = false; + + // Need to refreshPositions of all sortables just in case removing + // from one sortable changes the location of other sortables (#9675) + $.each( draggable.sortables, function() { + this.refreshPositions(); + } ); + } + } + } ); + } +} ); + +$.ui.plugin.add( "draggable", "cursor", { + start: function( event, ui, instance ) { + var t = $( "body" ), + o = instance.options; + + if ( t.css( "cursor" ) ) { + o._cursor = t.css( "cursor" ); + } + t.css( "cursor", o.cursor ); + }, + stop: function( event, ui, instance ) { + var o = instance.options; + if ( o._cursor ) { + $( "body" ).css( "cursor", o._cursor ); + } + } +} ); + +$.ui.plugin.add( "draggable", "opacity", { + start: function( event, ui, instance ) { + var t = $( ui.helper ), + o = instance.options; + if ( t.css( "opacity" ) ) { + o._opacity = t.css( "opacity" ); + } + t.css( "opacity", o.opacity ); + }, + stop: function( event, ui, instance ) { + var o = instance.options; + if ( o._opacity ) { + $( ui.helper ).css( "opacity", o._opacity ); + } + } +} ); + +$.ui.plugin.add( "draggable", "scroll", { + start: function( event, ui, i ) { + if ( !i.scrollParentNotHidden ) { + i.scrollParentNotHidden = i.helper.scrollParent( false ); + } + + if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && + i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { + i.overflowOffset = i.scrollParentNotHidden.offset(); + } + }, + drag: function( event, ui, i ) { + + var o = i.options, + scrolled = false, + scrollParent = i.scrollParentNotHidden[ 0 ], + document = i.document[ 0 ]; + + if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { + if ( !o.axis || o.axis !== "x" ) { + if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < + o.scrollSensitivity ) { + scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; + } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { + scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; + } + } + + if ( !o.axis || o.axis !== "y" ) { + if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < + o.scrollSensitivity ) { + scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; + } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { + scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; + } + } + + } else { + + if ( !o.axis || o.axis !== "x" ) { + if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { + scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); + } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < + o.scrollSensitivity ) { + scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); + } + } + + if ( !o.axis || o.axis !== "y" ) { + if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { + scrolled = $( document ).scrollLeft( + $( document ).scrollLeft() - o.scrollSpeed + ); + } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < + o.scrollSensitivity ) { + scrolled = $( document ).scrollLeft( + $( document ).scrollLeft() + o.scrollSpeed + ); + } + } + + } + + if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { + $.ui.ddmanager.prepareOffsets( i, event ); + } + + } +} ); + +$.ui.plugin.add( "draggable", "snap", { + start: function( event, ui, i ) { + + var o = i.options; + + i.snapElements = []; + + $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) + .each( function() { + var $t = $( this ), + $o = $t.offset(); + if ( this !== i.element[ 0 ] ) { + i.snapElements.push( { + item: this, + width: $t.outerWidth(), height: $t.outerHeight(), + top: $o.top, left: $o.left + } ); + } + } ); + + }, + drag: function( event, ui, inst ) { + + var ts, bs, ls, rs, l, r, t, b, i, first, + o = inst.options, + d = o.snapTolerance, + x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, + y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; + + for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { + + l = inst.snapElements[ i ].left - inst.margins.left; + r = l + inst.snapElements[ i ].width; + t = inst.snapElements[ i ].top - inst.margins.top; + b = t + inst.snapElements[ i ].height; + + if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || + !$.contains( inst.snapElements[ i ].item.ownerDocument, + inst.snapElements[ i ].item ) ) { + if ( inst.snapElements[ i ].snapping ) { + if ( inst.options.snap.release ) { + inst.options.snap.release.call( + inst.element, + event, + $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) + ); + } + } + inst.snapElements[ i ].snapping = false; + continue; + } + + if ( o.snapMode !== "inner" ) { + ts = Math.abs( t - y2 ) <= d; + bs = Math.abs( b - y1 ) <= d; + ls = Math.abs( l - x2 ) <= d; + rs = Math.abs( r - x1 ) <= d; + if ( ts ) { + ui.position.top = inst._convertPositionTo( "relative", { + top: t - inst.helperProportions.height, + left: 0 + } ).top; + } + if ( bs ) { + ui.position.top = inst._convertPositionTo( "relative", { + top: b, + left: 0 + } ).top; + } + if ( ls ) { + ui.position.left = inst._convertPositionTo( "relative", { + top: 0, + left: l - inst.helperProportions.width + } ).left; + } + if ( rs ) { + ui.position.left = inst._convertPositionTo( "relative", { + top: 0, + left: r + } ).left; + } + } + + first = ( ts || bs || ls || rs ); + + if ( o.snapMode !== "outer" ) { + ts = Math.abs( t - y1 ) <= d; + bs = Math.abs( b - y2 ) <= d; + ls = Math.abs( l - x1 ) <= d; + rs = Math.abs( r - x2 ) <= d; + if ( ts ) { + ui.position.top = inst._convertPositionTo( "relative", { + top: t, + left: 0 + } ).top; + } + if ( bs ) { + ui.position.top = inst._convertPositionTo( "relative", { + top: b - inst.helperProportions.height, + left: 0 + } ).top; + } + if ( ls ) { + ui.position.left = inst._convertPositionTo( "relative", { + top: 0, + left: l + } ).left; + } + if ( rs ) { + ui.position.left = inst._convertPositionTo( "relative", { + top: 0, + left: r - inst.helperProportions.width + } ).left; + } + } + + if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { + if ( inst.options.snap.snap ) { + inst.options.snap.snap.call( + inst.element, + event, + $.extend( inst._uiHash(), { + snapItem: inst.snapElements[ i ].item + } ) ); + } + } + inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); + + } + + } +} ); + +$.ui.plugin.add( "draggable", "stack", { + start: function( event, ui, instance ) { + var min, + o = instance.options, + group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { + return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - + ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); + } ); + + if ( !group.length ) { + return; + } + + min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; + $( group ).each( function( i ) { + $( this ).css( "zIndex", min + i ); + } ); + this.css( "zIndex", ( min + group.length ) ); + } +} ); + +$.ui.plugin.add( "draggable", "zIndex", { + start: function( event, ui, instance ) { + var t = $( ui.helper ), + o = instance.options; + + if ( t.css( "zIndex" ) ) { + o._zIndex = t.css( "zIndex" ); + } + t.css( "zIndex", o.zIndex ); + }, + stop: function( event, ui, instance ) { + var o = instance.options; + + if ( o._zIndex ) { + $( ui.helper ).css( "zIndex", o._zIndex ); + } + } +} ); + +var widgetsDraggable = $.ui.draggable; + + +/*! + * jQuery UI Droppable 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Droppable +//>>group: Interactions +//>>description: Enables drop targets for draggable elements. +//>>docs: https://api.jqueryui.com/droppable/ +//>>demos: https://jqueryui.com/droppable/ + + +$.widget( "ui.droppable", { + version: "1.14.1", + widgetEventPrefix: "drop", + options: { + accept: "*", + addClasses: true, + greedy: false, + scope: "default", + tolerance: "intersect", + + // Callbacks + activate: null, + deactivate: null, + drop: null, + out: null, + over: null + }, + _create: function() { + + var proportions, + o = this.options, + accept = o.accept; + + this.isover = false; + this.isout = true; + + this.accept = typeof accept === "function" ? accept : function( d ) { + return d.is( accept ); + }; + + this.proportions = function( /* valueToWrite */ ) { + if ( arguments.length ) { + + // Store the droppable's proportions + proportions = arguments[ 0 ]; + } else { + + // Retrieve or derive the droppable's proportions + return proportions ? + proportions : + proportions = { + width: this.element[ 0 ].offsetWidth, + height: this.element[ 0 ].offsetHeight + }; + } + }; + + this._addToManager( o.scope ); + + if ( o.addClasses ) { + this._addClass( "ui-droppable" ); + } + + }, + + _addToManager: function( scope ) { + + // Add the reference and positions to the manager + $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || []; + $.ui.ddmanager.droppables[ scope ].push( this ); + }, + + _splice: function( drop ) { + var i = 0; + for ( ; i < drop.length; i++ ) { + if ( drop[ i ] === this ) { + drop.splice( i, 1 ); + } + } + }, + + _destroy: function() { + var drop = $.ui.ddmanager.droppables[ this.options.scope ]; + + this._splice( drop ); + }, + + _setOption: function( key, value ) { + + if ( key === "accept" ) { + this.accept = typeof value === "function" ? value : function( d ) { + return d.is( value ); + }; + } else if ( key === "scope" ) { + var drop = $.ui.ddmanager.droppables[ this.options.scope ]; + + this._splice( drop ); + this._addToManager( value ); + } + + this._super( key, value ); + }, + + _activate: function( event ) { + var draggable = $.ui.ddmanager.current; + + this._addActiveClass(); + if ( draggable ) { + this._trigger( "activate", event, this.ui( draggable ) ); + } + }, + + _deactivate: function( event ) { + var draggable = $.ui.ddmanager.current; + + this._removeActiveClass(); + if ( draggable ) { + this._trigger( "deactivate", event, this.ui( draggable ) ); + } + }, + + _over: function( event ) { + + var draggable = $.ui.ddmanager.current; + + // Bail if draggable and droppable are same element + if ( !draggable || ( draggable.currentItem || + draggable.element )[ 0 ] === this.element[ 0 ] ) { + return; + } + + if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || + draggable.element ) ) ) { + this._addHoverClass(); + this._trigger( "over", event, this.ui( draggable ) ); + } + + }, + + _out: function( event ) { + + var draggable = $.ui.ddmanager.current; + + // Bail if draggable and droppable are same element + if ( !draggable || ( draggable.currentItem || + draggable.element )[ 0 ] === this.element[ 0 ] ) { + return; + } + + if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || + draggable.element ) ) ) { + this._removeHoverClass(); + this._trigger( "out", event, this.ui( draggable ) ); + } + + }, + + _drop: function( event, custom ) { + + var draggable = custom || $.ui.ddmanager.current, + childrenIntersection = false; + + // Bail if draggable and droppable are same element + if ( !draggable || ( draggable.currentItem || + draggable.element )[ 0 ] === this.element[ 0 ] ) { + return false; + } + + this.element + .find( ":data(ui-droppable)" ) + .not( ".ui-draggable-dragging" ) + .each( function() { + var inst = $( this ).droppable( "instance" ); + if ( + inst.options.greedy && + !inst.options.disabled && + inst.options.scope === draggable.options.scope && + inst.accept.call( + inst.element[ 0 ], ( draggable.currentItem || draggable.element ) + ) && + $.ui.intersect( + draggable, + $.extend( inst, { offset: inst.element.offset() } ), + inst.options.tolerance, event + ) + ) { + childrenIntersection = true; + return false; + } + } ); + if ( childrenIntersection ) { + return false; + } + + if ( this.accept.call( this.element[ 0 ], + ( draggable.currentItem || draggable.element ) ) ) { + this._removeActiveClass(); + this._removeHoverClass(); + + this._trigger( "drop", event, this.ui( draggable ) ); + return this.element; + } + + return false; + + }, + + ui: function( c ) { + return { + draggable: ( c.currentItem || c.element ), + helper: c.helper, + position: c.position, + offset: c.positionAbs + }; + }, + + // Extension points just to make backcompat sane and avoid duplicating logic + // TODO: Remove in 1.14 along with call to it below + _addHoverClass: function() { + this._addClass( "ui-droppable-hover" ); + }, + + _removeHoverClass: function() { + this._removeClass( "ui-droppable-hover" ); + }, + + _addActiveClass: function() { + this._addClass( "ui-droppable-active" ); + }, + + _removeActiveClass: function() { + this._removeClass( "ui-droppable-active" ); + } +} ); + +$.ui.intersect = ( function() { + function isOverAxis( x, reference, size ) { + return ( x >= reference ) && ( x < ( reference + size ) ); + } + + return function( draggable, droppable, toleranceMode, event ) { + + if ( !droppable.offset ) { + return false; + } + + var x1 = ( draggable.positionAbs || + draggable.position.absolute ).left + draggable.margins.left, + y1 = ( draggable.positionAbs || + draggable.position.absolute ).top + draggable.margins.top, + x2 = x1 + draggable.helperProportions.width, + y2 = y1 + draggable.helperProportions.height, + l = droppable.offset.left, + t = droppable.offset.top, + r = l + droppable.proportions().width, + b = t + droppable.proportions().height; + + switch ( toleranceMode ) { + case "fit": + return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b ); + case "intersect": + return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half + x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half + t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half + y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half + case "pointer": + return isOverAxis( event.pageY, t, droppable.proportions().height ) && + isOverAxis( event.pageX, l, droppable.proportions().width ); + case "touch": + return ( + ( y1 >= t && y1 <= b ) || // Top edge touching + ( y2 >= t && y2 <= b ) || // Bottom edge touching + ( y1 < t && y2 > b ) // Surrounded vertically + ) && ( + ( x1 >= l && x1 <= r ) || // Left edge touching + ( x2 >= l && x2 <= r ) || // Right edge touching + ( x1 < l && x2 > r ) // Surrounded horizontally + ); + default: + return false; + } + }; +} )(); + +/* + This manager tracks offsets of draggables and droppables +*/ +$.ui.ddmanager = { + current: null, + droppables: { "default": [] }, + prepareOffsets: function( t, event ) { + + var i, j, + m = $.ui.ddmanager.droppables[ t.options.scope ] || [], + type = event ? event.type : null, // workaround for #2317 + list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack(); + + droppablesLoop: for ( i = 0; i < m.length; i++ ) { + + // No disabled and non-accepted + if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], + ( t.currentItem || t.element ) ) ) ) { + continue; + } + + // Filter out elements in the current dragged item + for ( j = 0; j < list.length; j++ ) { + if ( list[ j ] === m[ i ].element[ 0 ] ) { + m[ i ].proportions().height = 0; + continue droppablesLoop; + } + } + + m[ i ].visible = m[ i ].element.css( "display" ) !== "none"; + if ( !m[ i ].visible ) { + continue; + } + + // Activate the droppable if used directly from draggables + if ( type === "mousedown" ) { + m[ i ]._activate.call( m[ i ], event ); + } + + m[ i ].offset = m[ i ].element.offset(); + m[ i ].proportions( { + width: m[ i ].element[ 0 ].offsetWidth, + height: m[ i ].element[ 0 ].offsetHeight + } ); + + } + + }, + drop: function( draggable, event ) { + + var dropped = false; + + // Create a copy of the droppables in case the list changes during the drop (#9116) + $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() { + + if ( !this.options ) { + return; + } + if ( !this.options.disabled && this.visible && + $.ui.intersect( draggable, this, this.options.tolerance, event ) ) { + dropped = this._drop.call( this, event ) || dropped; + } + + if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], + ( draggable.currentItem || draggable.element ) ) ) { + this.isout = true; + this.isover = false; + this._deactivate.call( this, event ); + } + + } ); + return dropped; + + }, + dragStart: function( draggable, event ) { + + // Listen for scrolling so that if the dragging causes scrolling the position of the + // droppables can be recalculated (see #5003) + draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() { + if ( !draggable.options.refreshPositions ) { + $.ui.ddmanager.prepareOffsets( draggable, event ); + } + } ); + }, + drag: function( draggable, event ) { + + // If you have a highly dynamic page, you might try this option. It renders positions + // every time you move the mouse. + if ( draggable.options.refreshPositions ) { + $.ui.ddmanager.prepareOffsets( draggable, event ); + } + + // Run through all droppables and check their positions based on specific tolerance options + $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() { + + if ( this.options.disabled || this.greedyChild || !this.visible ) { + return; + } + + var parentInstance, scope, parent, + intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ), + c = !intersects && this.isover ? + "isout" : + ( intersects && !this.isover ? "isover" : null ); + if ( !c ) { + return; + } + + if ( this.options.greedy ) { + + // find droppable parents with same scope + scope = this.options.scope; + parent = this.element.parents( ":data(ui-droppable)" ).filter( function() { + return $( this ).droppable( "instance" ).options.scope === scope; + } ); + + if ( parent.length ) { + parentInstance = $( parent[ 0 ] ).droppable( "instance" ); + parentInstance.greedyChild = ( c === "isover" ); + } + } + + // We just moved into a greedy child + if ( parentInstance && c === "isover" ) { + parentInstance.isover = false; + parentInstance.isout = true; + parentInstance._out.call( parentInstance, event ); + } + + this[ c ] = true; + this[ c === "isout" ? "isover" : "isout" ] = false; + this[ c === "isover" ? "_over" : "_out" ].call( this, event ); + + // We just moved out of a greedy child + if ( parentInstance && c === "isout" ) { + parentInstance.isout = false; + parentInstance.isover = true; + parentInstance._over.call( parentInstance, event ); + } + } ); + + }, + dragStop: function( draggable, event ) { + draggable.element.parentsUntil( "body" ).off( "scroll.droppable" ); + + // Call prepareOffsets one final time since IE does not fire return scroll events when + // overflow was caused by drag (see #5003) + if ( !draggable.options.refreshPositions ) { + $.ui.ddmanager.prepareOffsets( draggable, event ); + } + } +}; + +// DEPRECATED +// TODO: switch return back to widget declaration at top of file when this is removed +if ( $.uiBackCompat === true ) { + + // Backcompat for activeClass and hoverClass options + $.widget( "ui.droppable", $.ui.droppable, { + options: { + hoverClass: false, + activeClass: false + }, + _addActiveClass: function() { + this._super(); + if ( this.options.activeClass ) { + this.element.addClass( this.options.activeClass ); + } + }, + _removeActiveClass: function() { + this._super(); + if ( this.options.activeClass ) { + this.element.removeClass( this.options.activeClass ); + } + }, + _addHoverClass: function() { + this._super(); + if ( this.options.hoverClass ) { + this.element.addClass( this.options.hoverClass ); + } + }, + _removeHoverClass: function() { + this._super(); + if ( this.options.hoverClass ) { + this.element.removeClass( this.options.hoverClass ); + } + } + } ); +} + +var widgetsDroppable = $.ui.droppable; + + +/*! + * jQuery UI Resizable 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Resizable +//>>group: Interactions +//>>description: Enables resize functionality for any element. +//>>docs: https://api.jqueryui.com/resizable/ +//>>demos: https://jqueryui.com/resizable/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/resizable.css +//>>css.theme: ../../themes/base/theme.css + + +$.widget( "ui.resizable", $.ui.mouse, { + version: "1.14.1", + widgetEventPrefix: "resize", + options: { + alsoResize: false, + animate: false, + animateDuration: "slow", + animateEasing: "swing", + aspectRatio: false, + autoHide: false, + classes: { + "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" + }, + containment: false, + ghost: false, + grid: false, + handles: "e,s,se", + helper: false, + maxHeight: null, + maxWidth: null, + minHeight: 10, + minWidth: 10, + + // See #7960 + zIndex: 90, + + // Callbacks + resize: null, + start: null, + stop: null + }, + + _num: function( value ) { + return parseFloat( value ) || 0; + }, + + _isNumber: function( value ) { + return !isNaN( parseFloat( value ) ); + }, + + _hasScroll: function( el, a ) { + + var scroll, + has = false, + overflow = $( el ).css( "overflow" ); + + if ( overflow === "hidden" ) { + return false; + } + if ( overflow === "scroll" ) { + return true; + } + + scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop"; + + if ( el[ scroll ] > 0 ) { + return true; + } + + // TODO: determine which cases actually cause this to happen + // if the element doesn't have the scroll set, see if it's possible to + // set the scroll + try { + el[ scroll ] = 1; + has = ( el[ scroll ] > 0 ); + el[ scroll ] = 0; + } catch ( e ) { + + // `el` might be a string, then setting `scroll` will throw + // an error in strict mode; ignore it. + } + return has; + }, + + _create: function() { + + var margins, + o = this.options, + that = this; + this._addClass( "ui-resizable" ); + + $.extend( this, { + _aspectRatio: !!( o.aspectRatio ), + aspectRatio: o.aspectRatio, + originalElement: this.element, + _proportionallyResizeElements: [], + _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null + } ); + + // Wrap the element if it cannot hold child nodes + if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { + + this.element.wrap( + $( "
          " ).css( { + overflow: "hidden", + position: this.element.css( "position" ), + width: this.element.outerWidth(), + height: this.element.outerHeight(), + top: this.element.css( "top" ), + left: this.element.css( "left" ) + } ) + ); + + this.element = this.element.parent().data( + "ui-resizable", this.element.resizable( "instance" ) + ); + + this.elementIsWrapper = true; + + margins = { + marginTop: this.originalElement.css( "marginTop" ), + marginRight: this.originalElement.css( "marginRight" ), + marginBottom: this.originalElement.css( "marginBottom" ), + marginLeft: this.originalElement.css( "marginLeft" ) + }; + + this.element.css( margins ); + + // Support: Safari + // Prevent Safari textarea resize + this.originalResizeStyle = this.originalElement.css( "resize" ); + this.originalElement.css( "resize", "none" ); + + this._proportionallyResizeElements.push( this.originalElement.css( { + position: "static", + zoom: 1, + display: "block" + } ) ); + + this._proportionallyResize(); + } + + this._setupHandles(); + + if ( o.autoHide ) { + $( this.element ) + .on( "mouseenter", function() { + if ( o.disabled ) { + return; + } + that._removeClass( "ui-resizable-autohide" ); + that._handles.show(); + } ) + .on( "mouseleave", function() { + if ( o.disabled ) { + return; + } + if ( !that.resizing ) { + that._addClass( "ui-resizable-autohide" ); + that._handles.hide(); + } + } ); + } + + this._mouseInit(); + }, + + _destroy: function() { + + this._mouseDestroy(); + this._addedHandles.remove(); + + var wrapper, + _destroy = function( exp ) { + $( exp ) + .removeData( "resizable" ) + .removeData( "ui-resizable" ) + .off( ".resizable" ); + }; + + // TODO: Unwrap at same DOM position + if ( this.elementIsWrapper ) { + _destroy( this.element ); + wrapper = this.element; + this.originalElement.css( { + position: wrapper.css( "position" ), + width: wrapper.outerWidth(), + height: wrapper.outerHeight(), + top: wrapper.css( "top" ), + left: wrapper.css( "left" ) + } ).insertAfter( wrapper ); + wrapper.remove(); + } + + this.originalElement.css( "resize", this.originalResizeStyle ); + _destroy( this.originalElement ); + + return this; + }, + + _setOption: function( key, value ) { + this._super( key, value ); + + switch ( key ) { + case "handles": + this._removeHandles(); + this._setupHandles(); + break; + case "aspectRatio": + this._aspectRatio = !!value; + break; + default: + break; + } + }, + + _setupHandles: function() { + var o = this.options, handle, i, n, hname, axis, that = this; + this.handles = o.handles || + ( !$( ".ui-resizable-handle", this.element ).length ? + "e,s,se" : { + n: ".ui-resizable-n", + e: ".ui-resizable-e", + s: ".ui-resizable-s", + w: ".ui-resizable-w", + se: ".ui-resizable-se", + sw: ".ui-resizable-sw", + ne: ".ui-resizable-ne", + nw: ".ui-resizable-nw" + } ); + + this._handles = $(); + this._addedHandles = $(); + if ( this.handles.constructor === String ) { + + if ( this.handles === "all" ) { + this.handles = "n,e,s,w,se,sw,ne,nw"; + } + + n = this.handles.split( "," ); + this.handles = {}; + + for ( i = 0; i < n.length; i++ ) { + + handle = String.prototype.trim.call( n[ i ] ); + hname = "ui-resizable-" + handle; + axis = $( "
          " ); + this._addClass( axis, "ui-resizable-handle " + hname ); + + axis.css( { zIndex: o.zIndex } ); + + this.handles[ handle ] = ".ui-resizable-" + handle; + if ( !this.element.children( this.handles[ handle ] ).length ) { + this.element.append( axis ); + this._addedHandles = this._addedHandles.add( axis ); + } + } + + } + + this._renderAxis = function( target ) { + + var i, axis, padPos, padWrapper; + + target = target || this.element; + + for ( i in this.handles ) { + + if ( this.handles[ i ].constructor === String ) { + this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); + } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { + this.handles[ i ] = $( this.handles[ i ] ); + this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); + } + + if ( this.elementIsWrapper && + this.originalElement[ 0 ] + .nodeName + .match( /^(textarea|input|select|button)$/i ) ) { + axis = $( this.handles[ i ], this.element ); + + padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? + axis.outerHeight() : + axis.outerWidth(); + + padPos = [ "padding", + /ne|nw|n/.test( i ) ? "Top" : + /se|sw|s/.test( i ) ? "Bottom" : + /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); + + target.css( padPos, padWrapper ); + + this._proportionallyResize(); + } + + this._handles = this._handles.add( this.handles[ i ] ); + } + }; + + // TODO: make renderAxis a prototype function + this._renderAxis( this.element ); + + this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); + this._handles.disableSelection(); + + this._handles.on( "mouseover", function() { + if ( !that.resizing ) { + if ( this.className ) { + axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); + } + that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; + } + } ); + + if ( o.autoHide ) { + this._handles.hide(); + this._addClass( "ui-resizable-autohide" ); + } + }, + + _removeHandles: function() { + this._addedHandles.remove(); + }, + + _mouseCapture: function( event ) { + var i, handle, + capture = false; + + for ( i in this.handles ) { + handle = $( this.handles[ i ] )[ 0 ]; + if ( handle === event.target || $.contains( handle, event.target ) ) { + capture = true; + } + } + + return !this.options.disabled && capture; + }, + + _mouseStart: function( event ) { + + var curleft, curtop, cursor, calculatedSize, + o = this.options, + el = this.element; + + this.resizing = true; + + this._renderProxy(); + + curleft = this._num( this.helper.css( "left" ) ); + curtop = this._num( this.helper.css( "top" ) ); + + if ( o.containment ) { + curleft += $( o.containment ).scrollLeft() || 0; + curtop += $( o.containment ).scrollTop() || 0; + } + + this.offset = this.helper.offset(); + this.position = { left: curleft, top: curtop }; + + if ( !this._helper ) { + calculatedSize = this._calculateAdjustedElementDimensions( el ); + } + + this.size = this._helper ? { + width: this.helper.width(), + height: this.helper.height() + } : { + width: calculatedSize.width, + height: calculatedSize.height + }; + + this.originalSize = this._helper ? { + width: el.outerWidth(), + height: el.outerHeight() + } : { + width: calculatedSize.width, + height: calculatedSize.height + }; + + this.sizeDiff = { + width: el.outerWidth() - el.width(), + height: el.outerHeight() - el.height() + }; + + this.originalPosition = { left: curleft, top: curtop }; + this.originalMousePosition = { left: event.pageX, top: event.pageY }; + + this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? + o.aspectRatio : + ( ( this.originalSize.width / this.originalSize.height ) || 1 ); + + cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); + $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); + + this._addClass( "ui-resizable-resizing" ); + this._propagate( "start", event ); + return true; + }, + + _mouseDrag: function( event ) { + + var data, props, + smp = this.originalMousePosition, + a = this.axis, + dx = ( event.pageX - smp.left ) || 0, + dy = ( event.pageY - smp.top ) || 0, + trigger = this._change[ a ]; + + this._updatePrevProperties(); + + if ( !trigger ) { + return false; + } + + data = trigger.apply( this, [ event, dx, dy ] ); + + this._updateVirtualBoundaries( event.shiftKey ); + if ( this._aspectRatio || event.shiftKey ) { + data = this._updateRatio( data, event ); + } + + data = this._respectSize( data, event ); + + this._updateCache( data ); + + this._propagate( "resize", event ); + + props = this._applyChanges(); + + if ( !this._helper && this._proportionallyResizeElements.length ) { + this._proportionallyResize(); + } + + if ( !$.isEmptyObject( props ) ) { + this._updatePrevProperties(); + this._trigger( "resize", event, this.ui() ); + this._applyChanges(); + } + + return false; + }, + + _mouseStop: function( event ) { + + this.resizing = false; + var pr, ista, soffseth, soffsetw, s, left, top, + o = this.options, that = this; + + if ( this._helper ) { + + pr = this._proportionallyResizeElements; + ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); + soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; + soffsetw = ista ? 0 : that.sizeDiff.width; + + s = { + width: ( that.helper.width() - soffsetw ), + height: ( that.helper.height() - soffseth ) + }; + left = ( parseFloat( that.element.css( "left" ) ) + + ( that.position.left - that.originalPosition.left ) ) || null; + top = ( parseFloat( that.element.css( "top" ) ) + + ( that.position.top - that.originalPosition.top ) ) || null; + + if ( !o.animate ) { + this.element.css( $.extend( s, { top: top, left: left } ) ); + } + + that.helper.height( that.size.height ); + that.helper.width( that.size.width ); + + if ( this._helper && !o.animate ) { + this._proportionallyResize(); + } + } + + $( "body" ).css( "cursor", "auto" ); + + this._removeClass( "ui-resizable-resizing" ); + + this._propagate( "stop", event ); + + if ( this._helper ) { + this.helper.remove(); + } + + return false; + + }, + + _updatePrevProperties: function() { + this.prevPosition = { + top: this.position.top, + left: this.position.left + }; + this.prevSize = { + width: this.size.width, + height: this.size.height + }; + }, + + _applyChanges: function() { + var props = {}; + + if ( this.position.top !== this.prevPosition.top ) { + props.top = this.position.top + "px"; + } + if ( this.position.left !== this.prevPosition.left ) { + props.left = this.position.left + "px"; + } + + this.helper.css( props ); + + if ( this.size.width !== this.prevSize.width ) { + props.width = this.size.width + "px"; + this.helper.width( props.width ); + } + if ( this.size.height !== this.prevSize.height ) { + props.height = this.size.height + "px"; + this.helper.height( props.height ); + } + + return props; + }, + + _updateVirtualBoundaries: function( forceAspectRatio ) { + var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, + o = this.options; + + b = { + minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, + maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, + minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, + maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity + }; + + if ( this._aspectRatio || forceAspectRatio ) { + pMinWidth = b.minHeight * this.aspectRatio; + pMinHeight = b.minWidth / this.aspectRatio; + pMaxWidth = b.maxHeight * this.aspectRatio; + pMaxHeight = b.maxWidth / this.aspectRatio; + + if ( pMinWidth > b.minWidth ) { + b.minWidth = pMinWidth; + } + if ( pMinHeight > b.minHeight ) { + b.minHeight = pMinHeight; + } + if ( pMaxWidth < b.maxWidth ) { + b.maxWidth = pMaxWidth; + } + if ( pMaxHeight < b.maxHeight ) { + b.maxHeight = pMaxHeight; + } + } + this._vBoundaries = b; + }, + + _updateCache: function( data ) { + this.offset = this.helper.offset(); + if ( this._isNumber( data.left ) ) { + this.position.left = data.left; + } + if ( this._isNumber( data.top ) ) { + this.position.top = data.top; + } + if ( this._isNumber( data.height ) ) { + this.size.height = data.height; + } + if ( this._isNumber( data.width ) ) { + this.size.width = data.width; + } + }, + + _updateRatio: function( data ) { + + var cpos = this.position, + csize = this.size, + a = this.axis; + + if ( this._isNumber( data.height ) ) { + data.width = ( data.height * this.aspectRatio ); + } else if ( this._isNumber( data.width ) ) { + data.height = ( data.width / this.aspectRatio ); + } + + if ( a === "sw" ) { + data.left = cpos.left + ( csize.width - data.width ); + data.top = null; + } + if ( a === "nw" ) { + data.top = cpos.top + ( csize.height - data.height ); + data.left = cpos.left + ( csize.width - data.width ); + } + + return data; + }, + + _respectSize: function( data ) { + + var o = this._vBoundaries, + a = this.axis, + ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), + ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), + isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), + isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), + dw = this.originalPosition.left + this.originalSize.width, + dh = this.originalPosition.top + this.originalSize.height, + cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); + if ( isminw ) { + data.width = o.minWidth; + } + if ( isminh ) { + data.height = o.minHeight; + } + if ( ismaxw ) { + data.width = o.maxWidth; + } + if ( ismaxh ) { + data.height = o.maxHeight; + } + + if ( isminw && cw ) { + data.left = dw - o.minWidth; + } + if ( ismaxw && cw ) { + data.left = dw - o.maxWidth; + } + if ( isminh && ch ) { + data.top = dh - o.minHeight; + } + if ( ismaxh && ch ) { + data.top = dh - o.maxHeight; + } + + // Fixing jump error on top/left - bug #2330 + if ( !data.width && !data.height && !data.left && data.top ) { + data.top = null; + } else if ( !data.width && !data.height && !data.top && data.left ) { + data.left = null; + } + + return data; + }, + + _getPaddingPlusBorderDimensions: function( element ) { + var i = 0, + widths = [], + borders = [ + element.css( "borderTopWidth" ), + element.css( "borderRightWidth" ), + element.css( "borderBottomWidth" ), + element.css( "borderLeftWidth" ) + ], + paddings = [ + element.css( "paddingTop" ), + element.css( "paddingRight" ), + element.css( "paddingBottom" ), + element.css( "paddingLeft" ) + ]; + + for ( ; i < 4; i++ ) { + widths[ i ] = ( parseFloat( borders[ i ] ) || 0 ); + widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 ); + } + + return { + height: widths[ 0 ] + widths[ 2 ], + width: widths[ 1 ] + widths[ 3 ] + }; + }, + + _calculateAdjustedElementDimensions: function( element ) { + var elWidth, elHeight, paddingBorder, + ce = element.get( 0 ); + + if ( element.css( "box-sizing" ) !== "content-box" || + ( !this._hasScroll( ce ) && !this._hasScroll( ce, "left" ) ) ) { + return { + height: parseFloat( element.css( "height" ) ), + width: parseFloat( element.css( "width" ) ) + }; + } + + // Check if CSS inline styles are set and use those (usually from previous resizes) + elWidth = parseFloat( ce.style.width ); + elHeight = parseFloat( ce.style.height ); + + paddingBorder = this._getPaddingPlusBorderDimensions( element ); + elWidth = isNaN( elWidth ) ? + this._getElementTheoreticalSize( element, paddingBorder, "width" ) : + elWidth; + elHeight = isNaN( elHeight ) ? + this._getElementTheoreticalSize( element, paddingBorder, "height" ) : + elHeight; + + return { + height: elHeight, + width: elWidth + }; + }, + + _getElementTheoreticalSize: function( element, extraSize, dimension ) { + + // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border + var size = Math.max( 0, Math.ceil( + element.get( 0 )[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - + extraSize[ dimension ] - + 0.5 + + // If offsetWidth/offsetHeight is unknown, then we can't determine theoretical size. + // Use an explicit zero to avoid NaN. + // See https://github.com/jquery/jquery/issues/3964 + ) ) || 0; + + return size; + }, + + _proportionallyResize: function() { + + if ( !this._proportionallyResizeElements.length ) { + return; + } + + var prel, + i = 0, + element = this.helper || this.element; + + for ( ; i < this._proportionallyResizeElements.length; i++ ) { + + prel = this._proportionallyResizeElements[ i ]; + + // TODO: Seems like a bug to cache this.outerDimensions + // considering that we are in a loop. + if ( !this.outerDimensions ) { + this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); + } + + prel.css( { + height: ( element.height() - this.outerDimensions.height ) || 0, + width: ( element.width() - this.outerDimensions.width ) || 0 + } ); + + } + + }, + + _renderProxy: function() { + + var el = this.element, o = this.options; + this.elementOffset = el.offset(); + + if ( this._helper ) { + + this.helper = this.helper || $( "
          " ).css( { overflow: "hidden" } ); + + this._addClass( this.helper, this._helper ); + this.helper.css( { + width: this.element.outerWidth(), + height: this.element.outerHeight(), + position: "absolute", + left: this.elementOffset.left + "px", + top: this.elementOffset.top + "px", + zIndex: ++o.zIndex //TODO: Don't modify option + } ); + + this.helper + .appendTo( "body" ) + .disableSelection(); + + } else { + this.helper = this.element; + } + + }, + + _change: { + e: function( event, dx ) { + return { width: this.originalSize.width + dx }; + }, + w: function( event, dx ) { + var cs = this.originalSize, sp = this.originalPosition; + return { left: sp.left + dx, width: cs.width - dx }; + }, + n: function( event, dx, dy ) { + var cs = this.originalSize, sp = this.originalPosition; + return { top: sp.top + dy, height: cs.height - dy }; + }, + s: function( event, dx, dy ) { + return { height: this.originalSize.height + dy }; + }, + se: function( event, dx, dy ) { + return $.extend( this._change.s.apply( this, arguments ), + this._change.e.apply( this, [ event, dx, dy ] ) ); + }, + sw: function( event, dx, dy ) { + return $.extend( this._change.s.apply( this, arguments ), + this._change.w.apply( this, [ event, dx, dy ] ) ); + }, + ne: function( event, dx, dy ) { + return $.extend( this._change.n.apply( this, arguments ), + this._change.e.apply( this, [ event, dx, dy ] ) ); + }, + nw: function( event, dx, dy ) { + return $.extend( this._change.n.apply( this, arguments ), + this._change.w.apply( this, [ event, dx, dy ] ) ); + } + }, + + _propagate: function( n, event ) { + $.ui.plugin.call( this, n, [ event, this.ui() ] ); + if ( n !== "resize" ) { + this._trigger( n, event, this.ui() ); + } + }, + + plugins: {}, + + ui: function() { + return { + originalElement: this.originalElement, + element: this.element, + helper: this.helper, + position: this.position, + size: this.size, + originalSize: this.originalSize, + originalPosition: this.originalPosition + }; + } + +} ); + +/* + * Resizable Extensions + */ + +$.ui.plugin.add( "resizable", "animate", { + + stop: function( event ) { + var that = $( this ).resizable( "instance" ), + o = that.options, + pr = that._proportionallyResizeElements, + ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ), + soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height, + soffsetw = ista ? 0 : that.sizeDiff.width, + style = { + width: ( that.size.width - soffsetw ), + height: ( that.size.height - soffseth ) + }, + left = ( parseFloat( that.element.css( "left" ) ) + + ( that.position.left - that.originalPosition.left ) ) || null, + top = ( parseFloat( that.element.css( "top" ) ) + + ( that.position.top - that.originalPosition.top ) ) || null; + + that.element.animate( + $.extend( style, top && left ? { top: top, left: left } : {} ), { + duration: o.animateDuration, + easing: o.animateEasing, + step: function() { + + var data = { + width: parseFloat( that.element.css( "width" ) ), + height: parseFloat( that.element.css( "height" ) ), + top: parseFloat( that.element.css( "top" ) ), + left: parseFloat( that.element.css( "left" ) ) + }; + + if ( pr && pr.length ) { + $( pr[ 0 ] ).css( { width: data.width, height: data.height } ); + } + + // Propagating resize, and updating values for each animation step + that._updateCache( data ); + that._propagate( "resize", event ); + + } + } + ); + } + +} ); + +$.ui.plugin.add( "resizable", "containment", { + + start: function() { + var element, p, co, ch, cw, width, height, + that = $( this ).resizable( "instance" ), + o = that.options, + el = that.element, + oc = o.containment, + ce = ( oc instanceof $ ) ? + oc.get( 0 ) : + ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; + + if ( !ce ) { + return; + } + + that.containerElement = $( ce ); + + if ( /document/.test( oc ) || oc === document ) { + that.containerOffset = { + left: 0, + top: 0 + }; + that.containerPosition = { + left: 0, + top: 0 + }; + + that.parentData = { + element: $( document ), + left: 0, + top: 0, + width: $( document ).width(), + height: $( document ).height() || document.body.parentNode.scrollHeight + }; + } else { + element = $( ce ); + p = []; + $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) { + p[ i ] = that._num( element.css( "padding" + name ) ); + } ); + + that.containerOffset = element.offset(); + that.containerPosition = element.position(); + that.containerSize = { + height: ( element.innerHeight() - p[ 3 ] ), + width: ( element.innerWidth() - p[ 1 ] ) + }; + + co = that.containerOffset; + ch = that.containerSize.height; + cw = that.containerSize.width; + width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw ); + height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch ); + + that.parentData = { + element: ce, + left: co.left, + top: co.top, + width: width, + height: height + }; + } + }, + + resize: function( event ) { + var woset, hoset, isParent, isOffsetRelative, + that = $( this ).resizable( "instance" ), + o = that.options, + co = that.containerOffset, + cp = that.position, + pRatio = that._aspectRatio || event.shiftKey, + cop = { + top: 0, + left: 0 + }, + ce = that.containerElement, + continueResize = true; + + if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { + cop = co; + } + + if ( cp.left < ( that._helper ? co.left : 0 ) ) { + that.size.width = that.size.width + + ( that._helper ? + ( that.position.left - co.left ) : + ( that.position.left - cop.left ) ); + + if ( pRatio ) { + that.size.height = that.size.width / that.aspectRatio; + continueResize = false; + } + that.position.left = o.helper ? co.left : 0; + } + + if ( cp.top < ( that._helper ? co.top : 0 ) ) { + that.size.height = that.size.height + + ( that._helper ? + ( that.position.top - co.top ) : + that.position.top ); + + if ( pRatio ) { + that.size.width = that.size.height * that.aspectRatio; + continueResize = false; + } + that.position.top = that._helper ? co.top : 0; + } + + isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); + isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); + + if ( isParent && isOffsetRelative ) { + that.offset.left = that.parentData.left + that.position.left; + that.offset.top = that.parentData.top + that.position.top; + } else { + that.offset.left = that.element.offset().left; + that.offset.top = that.element.offset().top; + } + + woset = Math.abs( that.sizeDiff.width + + ( that._helper ? + that.offset.left - cop.left : + ( that.offset.left - co.left ) ) ); + + hoset = Math.abs( that.sizeDiff.height + + ( that._helper ? + that.offset.top - cop.top : + ( that.offset.top - co.top ) ) ); + + if ( woset + that.size.width >= that.parentData.width ) { + that.size.width = that.parentData.width - woset; + if ( pRatio ) { + that.size.height = that.size.width / that.aspectRatio; + continueResize = false; + } + } + + if ( hoset + that.size.height >= that.parentData.height ) { + that.size.height = that.parentData.height - hoset; + if ( pRatio ) { + that.size.width = that.size.height * that.aspectRatio; + continueResize = false; + } + } + + if ( !continueResize ) { + that.position.left = that.prevPosition.left; + that.position.top = that.prevPosition.top; + that.size.width = that.prevSize.width; + that.size.height = that.prevSize.height; + } + }, + + stop: function() { + var that = $( this ).resizable( "instance" ), + o = that.options, + co = that.containerOffset, + cop = that.containerPosition, + ce = that.containerElement, + helper = $( that.helper ), + ho = helper.offset(), + w = helper.outerWidth() - that.sizeDiff.width, + h = helper.outerHeight() - that.sizeDiff.height; + + if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { + $( this ).css( { + left: ho.left - cop.left - co.left, + width: w, + height: h + } ); + } + + if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { + $( this ).css( { + left: ho.left - cop.left - co.left, + width: w, + height: h + } ); + } + } +} ); + +$.ui.plugin.add( "resizable", "alsoResize", { + + start: function() { + var that = $( this ).resizable( "instance" ), + o = that.options; + + $( o.alsoResize ).each( function() { + var el = $( this ), + elSize = that._calculateAdjustedElementDimensions( el ); + + el.data( "ui-resizable-alsoresize", { + width: elSize.width, height: elSize.height, + left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) + } ); + } ); + }, + + resize: function( event, ui ) { + var that = $( this ).resizable( "instance" ), + o = that.options, + os = that.originalSize, + op = that.originalPosition, + delta = { + height: ( that.size.height - os.height ) || 0, + width: ( that.size.width - os.width ) || 0, + top: ( that.position.top - op.top ) || 0, + left: ( that.position.left - op.left ) || 0 + }; + + $( o.alsoResize ).each( function() { + var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {}, + css = el.parents( ui.originalElement[ 0 ] ).length ? + [ "width", "height" ] : + [ "width", "height", "top", "left" ]; + + $.each( css, function( i, prop ) { + var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 ); + if ( sum && sum >= 0 ) { + style[ prop ] = sum || null; + } + } ); + + el.css( style ); + } ); + }, + + stop: function() { + $( this ).removeData( "ui-resizable-alsoresize" ); + } +} ); + +$.ui.plugin.add( "resizable", "ghost", { + + start: function() { + + var that = $( this ).resizable( "instance" ), cs = that.size; + + that.ghost = that.originalElement.clone(); + that.ghost.css( { + opacity: 0.25, + display: "block", + position: "relative", + height: cs.height, + width: cs.width, + margin: 0, + left: 0, + top: 0 + } ); + + that._addClass( that.ghost, "ui-resizable-ghost" ); + + // DEPRECATED + // TODO: remove after 1.12 + if ( $.uiBackCompat === true && typeof that.options.ghost === "string" ) { + + // Ghost option + that.ghost.addClass( this.options.ghost ); + } + + that.ghost.appendTo( that.helper ); + + }, + + resize: function() { + var that = $( this ).resizable( "instance" ); + if ( that.ghost ) { + that.ghost.css( { + position: "relative", + height: that.size.height, + width: that.size.width + } ); + } + }, + + stop: function() { + var that = $( this ).resizable( "instance" ); + if ( that.ghost && that.helper ) { + that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) ); + } + } + +} ); + +$.ui.plugin.add( "resizable", "grid", { + + resize: function() { + var outerDimensions, + that = $( this ).resizable( "instance" ), + o = that.options, + cs = that.size, + os = that.originalSize, + op = that.originalPosition, + a = that.axis, + grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, + gridX = ( grid[ 0 ] || 1 ), + gridY = ( grid[ 1 ] || 1 ), + ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX, + oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY, + newWidth = os.width + ox, + newHeight = os.height + oy, + isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ), + isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ), + isMinWidth = o.minWidth && ( o.minWidth > newWidth ), + isMinHeight = o.minHeight && ( o.minHeight > newHeight ); + + o.grid = grid; + + if ( isMinWidth ) { + newWidth += gridX; + } + if ( isMinHeight ) { + newHeight += gridY; + } + if ( isMaxWidth ) { + newWidth -= gridX; + } + if ( isMaxHeight ) { + newHeight -= gridY; + } + + if ( /^(se|s|e)$/.test( a ) ) { + that.size.width = newWidth; + that.size.height = newHeight; + } else if ( /^(ne)$/.test( a ) ) { + that.size.width = newWidth; + that.size.height = newHeight; + that.position.top = op.top - oy; + } else if ( /^(sw)$/.test( a ) ) { + that.size.width = newWidth; + that.size.height = newHeight; + that.position.left = op.left - ox; + } else { + if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) { + outerDimensions = that._getPaddingPlusBorderDimensions( this ); + } + + if ( newHeight - gridY > 0 ) { + that.size.height = newHeight; + that.position.top = op.top - oy; + } else { + newHeight = gridY - outerDimensions.height; + that.size.height = newHeight; + that.position.top = op.top + os.height - newHeight; + } + if ( newWidth - gridX > 0 ) { + that.size.width = newWidth; + that.position.left = op.left - ox; + } else { + newWidth = gridX - outerDimensions.width; + that.size.width = newWidth; + that.position.left = op.left + os.width - newWidth; + } + } + } + +} ); + +var widgetsResizable = $.ui.resizable; + + +/*! + * jQuery UI Selectable 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Selectable +//>>group: Interactions +//>>description: Allows groups of elements to be selected with the mouse. +//>>docs: https://api.jqueryui.com/selectable/ +//>>demos: https://jqueryui.com/selectable/ +//>>css.structure: ../../themes/base/selectable.css + + +var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, { + version: "1.14.1", + options: { + appendTo: "body", + autoRefresh: true, + distance: 0, + filter: "*", + tolerance: "touch", + + // Callbacks + selected: null, + selecting: null, + start: null, + stop: null, + unselected: null, + unselecting: null + }, + _create: function() { + var that = this; + + this._addClass( "ui-selectable" ); + + this.dragged = false; + + // Cache selectee children based on filter + this.refresh = function() { + that.elementPos = $( that.element[ 0 ] ).offset(); + that.selectees = $( that.options.filter, that.element[ 0 ] ); + that._addClass( that.selectees, "ui-selectee" ); + that.selectees.each( function() { + var $this = $( this ), + selecteeOffset = $this.offset(), + pos = { + left: selecteeOffset.left - that.elementPos.left, + top: selecteeOffset.top - that.elementPos.top + }; + $.data( this, "selectable-item", { + element: this, + $element: $this, + left: pos.left, + top: pos.top, + right: pos.left + $this.outerWidth(), + bottom: pos.top + $this.outerHeight(), + startselected: false, + selected: $this.hasClass( "ui-selected" ), + selecting: $this.hasClass( "ui-selecting" ), + unselecting: $this.hasClass( "ui-unselecting" ) + } ); + } ); + }; + this.refresh(); + + this._mouseInit(); + + this.helper = $( "
          " ); + this._addClass( this.helper, "ui-selectable-helper" ); + }, + + _destroy: function() { + this.selectees.removeData( "selectable-item" ); + this._mouseDestroy(); + }, + + _mouseStart: function( event ) { + var that = this, + options = this.options; + + this.opos = [ event.pageX, event.pageY ]; + this.elementPos = $( this.element[ 0 ] ).offset(); + + if ( this.options.disabled ) { + return; + } + + this.selectees = $( options.filter, this.element[ 0 ] ); + + this._trigger( "start", event ); + + $( options.appendTo ).append( this.helper ); + + // position helper (lasso) + this.helper.css( { + "left": event.pageX, + "top": event.pageY, + "width": 0, + "height": 0 + } ); + + if ( options.autoRefresh ) { + this.refresh(); + } + + this.selectees.filter( ".ui-selected" ).each( function() { + var selectee = $.data( this, "selectable-item" ); + selectee.startselected = true; + if ( !event.metaKey && !event.ctrlKey ) { + that._removeClass( selectee.$element, "ui-selected" ); + selectee.selected = false; + that._addClass( selectee.$element, "ui-unselecting" ); + selectee.unselecting = true; + + // selectable UNSELECTING callback + that._trigger( "unselecting", event, { + unselecting: selectee.element + } ); + } + } ); + + $( event.target ).parents().addBack().each( function() { + var doSelect, + selectee = $.data( this, "selectable-item" ); + if ( selectee ) { + doSelect = ( !event.metaKey && !event.ctrlKey ) || + !selectee.$element.hasClass( "ui-selected" ); + that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" ) + ._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" ); + selectee.unselecting = !doSelect; + selectee.selecting = doSelect; + selectee.selected = doSelect; + + // selectable (UN)SELECTING callback + if ( doSelect ) { + that._trigger( "selecting", event, { + selecting: selectee.element + } ); + } else { + that._trigger( "unselecting", event, { + unselecting: selectee.element + } ); + } + return false; + } + } ); + + }, + + _mouseDrag: function( event ) { + + this.dragged = true; + + if ( this.options.disabled ) { + return; + } + + var tmp, + that = this, + options = this.options, + x1 = this.opos[ 0 ], + y1 = this.opos[ 1 ], + x2 = event.pageX, + y2 = event.pageY; + + if ( x1 > x2 ) { + tmp = x2; x2 = x1; x1 = tmp; + } + if ( y1 > y2 ) { + tmp = y2; y2 = y1; y1 = tmp; + } + this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } ); + + this.selectees.each( function() { + var selectee = $.data( this, "selectable-item" ), + hit = false, + offset = {}; + + //prevent helper from being selected if appendTo: selectable + if ( !selectee || selectee.element === that.element[ 0 ] ) { + return; + } + + offset.left = selectee.left + that.elementPos.left; + offset.right = selectee.right + that.elementPos.left; + offset.top = selectee.top + that.elementPos.top; + offset.bottom = selectee.bottom + that.elementPos.top; + + if ( options.tolerance === "touch" ) { + hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 || + offset.bottom < y1 ) ); + } else if ( options.tolerance === "fit" ) { + hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 && + offset.bottom < y2 ); + } + + if ( hit ) { + + // SELECT + if ( selectee.selected ) { + that._removeClass( selectee.$element, "ui-selected" ); + selectee.selected = false; + } + if ( selectee.unselecting ) { + that._removeClass( selectee.$element, "ui-unselecting" ); + selectee.unselecting = false; + } + if ( !selectee.selecting ) { + that._addClass( selectee.$element, "ui-selecting" ); + selectee.selecting = true; + + // selectable SELECTING callback + that._trigger( "selecting", event, { + selecting: selectee.element + } ); + } + } else { + + // UNSELECT + if ( selectee.selecting ) { + if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) { + that._removeClass( selectee.$element, "ui-selecting" ); + selectee.selecting = false; + that._addClass( selectee.$element, "ui-selected" ); + selectee.selected = true; + } else { + that._removeClass( selectee.$element, "ui-selecting" ); + selectee.selecting = false; + if ( selectee.startselected ) { + that._addClass( selectee.$element, "ui-unselecting" ); + selectee.unselecting = true; + } + + // selectable UNSELECTING callback + that._trigger( "unselecting", event, { + unselecting: selectee.element + } ); + } + } + if ( selectee.selected ) { + if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) { + that._removeClass( selectee.$element, "ui-selected" ); + selectee.selected = false; + + that._addClass( selectee.$element, "ui-unselecting" ); + selectee.unselecting = true; + + // selectable UNSELECTING callback + that._trigger( "unselecting", event, { + unselecting: selectee.element + } ); + } + } + } + } ); + + return false; + }, + + _mouseStop: function( event ) { + var that = this; + + this.dragged = false; + + $( ".ui-unselecting", this.element[ 0 ] ).each( function() { + var selectee = $.data( this, "selectable-item" ); + that._removeClass( selectee.$element, "ui-unselecting" ); + selectee.unselecting = false; + selectee.startselected = false; + that._trigger( "unselected", event, { + unselected: selectee.element + } ); + } ); + $( ".ui-selecting", this.element[ 0 ] ).each( function() { + var selectee = $.data( this, "selectable-item" ); + that._removeClass( selectee.$element, "ui-selecting" ) + ._addClass( selectee.$element, "ui-selected" ); + selectee.selecting = false; + selectee.selected = true; + selectee.startselected = true; + that._trigger( "selected", event, { + selected: selectee.element + } ); + } ); + this._trigger( "stop", event ); + + this.helper.remove(); + + return false; + } + +} ); + + +/*! + * jQuery UI Sortable 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Sortable +//>>group: Interactions +//>>description: Enables items in a list to be sorted using the mouse. +//>>docs: https://api.jqueryui.com/sortable/ +//>>demos: https://jqueryui.com/sortable/ +//>>css.structure: ../../themes/base/sortable.css + + +var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, { + version: "1.14.1", + widgetEventPrefix: "sort", + ready: false, + options: { + appendTo: "parent", + axis: false, + connectWith: false, + containment: false, + cursor: "auto", + cursorAt: false, + dropOnEmpty: true, + forcePlaceholderSize: false, + forceHelperSize: false, + grid: false, + handle: false, + helper: "original", + items: "> *", + opacity: false, + placeholder: false, + revert: false, + scroll: true, + scrollSensitivity: 20, + scrollSpeed: 20, + scope: "default", + tolerance: "intersect", + zIndex: 1000, + + // Callbacks + activate: null, + beforeStop: null, + change: null, + deactivate: null, + out: null, + over: null, + receive: null, + remove: null, + sort: null, + start: null, + stop: null, + update: null + }, + + _isOverAxis: function( x, reference, size ) { + return ( x >= reference ) && ( x < ( reference + size ) ); + }, + + _isFloating: function( item ) { + return ( /left|right/ ).test( item.css( "float" ) ) || + ( /inline|table-cell/ ).test( item.css( "display" ) ); + }, + + _create: function() { + this.containerCache = {}; + this._addClass( "ui-sortable" ); + + //Get the items + this.refresh(); + + //Let's determine the parent's offset + this.offset = this.element.offset(); + + //Initialize mouse events for interaction + this._mouseInit(); + + this._setHandleClassName(); + + //We're ready to go + this.ready = true; + + }, + + _setOption: function( key, value ) { + this._super( key, value ); + + if ( key === "handle" ) { + this._setHandleClassName(); + } + }, + + _setHandleClassName: function() { + var that = this; + this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" ); + $.each( this.items, function() { + that._addClass( + this.instance.options.handle ? + this.item.find( this.instance.options.handle ) : + this.item, + "ui-sortable-handle" + ); + } ); + }, + + _destroy: function() { + this._mouseDestroy(); + + for ( var i = this.items.length - 1; i >= 0; i-- ) { + this.items[ i ].item.removeData( this.widgetName + "-item" ); + } + + return this; + }, + + _mouseCapture: function( event, overrideHandle ) { + var currentItem = null, + validHandle = false, + that = this; + + if ( this.reverting ) { + return false; + } + + if ( this.options.disabled || this.options.type === "static" ) { + return false; + } + + //We have to refresh the items data once first + this._refreshItems( event ); + + //Find out if the clicked node (or one of its parents) is a actual item in this.items + $( event.target ).parents().each( function() { + if ( $.data( this, that.widgetName + "-item" ) === that ) { + currentItem = $( this ); + return false; + } + } ); + if ( $.data( event.target, that.widgetName + "-item" ) === that ) { + currentItem = $( event.target ); + } + + if ( !currentItem ) { + return false; + } + if ( this.options.handle && !overrideHandle ) { + $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() { + if ( this === event.target ) { + validHandle = true; + } + } ); + if ( !validHandle ) { + return false; + } + } + + this.currentItem = currentItem; + this._removeCurrentsFromItems(); + return true; + + }, + + _mouseStart: function( event, overrideHandle, noActivation ) { + + var i, body, + o = this.options; + + this.currentContainer = this; + + //We only need to call refreshPositions, because the refreshItems call has been moved to + // mouseCapture + this.refreshPositions(); + + //Prepare the dragged items parent + this.appendTo = $( o.appendTo !== "parent" ? + o.appendTo : + this.currentItem.parent() ); + + //Create and append the visible helper + this.helper = this._createHelper( event ); + + //Cache the helper size + this._cacheHelperProportions(); + + /* + * - Position generation - + * This block generates everything position related - it's the core of draggables. + */ + + //Cache the margins of the original element + this._cacheMargins(); + + //The element's absolute position on the page minus margins + this.offset = this.currentItem.offset(); + this.offset = { + top: this.offset.top - this.margins.top, + left: this.offset.left - this.margins.left + }; + + $.extend( this.offset, { + click: { //Where the click happened, relative to the element + left: event.pageX - this.offset.left, + top: event.pageY - this.offset.top + }, + + // This is a relative to absolute position minus the actual position calculation - + // only used for relative positioned helper + relative: this._getRelativeOffset() + } ); + + // After we get the helper offset, but before we get the parent offset we can + // change the helper's position to absolute + // TODO: Still need to figure out a way to make relative sorting possible + this.helper.css( "position", "absolute" ); + this.cssPosition = this.helper.css( "position" ); + + //Adjust the mouse offset relative to the helper if "cursorAt" is supplied + if ( o.cursorAt ) { + this._adjustOffsetFromHelper( o.cursorAt ); + } + + //Cache the former DOM position + this.domPosition = { + prev: this.currentItem.prev()[ 0 ], + parent: this.currentItem.parent()[ 0 ] + }; + + // If the helper is not the original, hide the original so it's not playing any role during + // the drag, won't cause anything bad this way + if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { + this.currentItem.hide(); + } + + //Create the placeholder + this._createPlaceholder(); + + //Get the next scrolling parent + this.scrollParent = this.placeholder.scrollParent(); + + $.extend( this.offset, { + parent: this._getParentOffset() + } ); + + //Set a containment if given in the options + if ( o.containment ) { + this._setContainment(); + } + + if ( o.cursor && o.cursor !== "auto" ) { // cursor option + body = this.document.find( "body" ); + + this._storedStylesheet = + $( "" ).appendTo( body ); + } + + // We need to make sure to grab the zIndex before setting the + // opacity, because setting the opacity to anything lower than 1 + // causes the zIndex to change from "auto" to 0. + if ( o.zIndex ) { // zIndex option + if ( this.helper.css( "zIndex" ) ) { + this._storedZIndex = this.helper.css( "zIndex" ); + } + this.helper.css( "zIndex", o.zIndex ); + } + + if ( o.opacity ) { // opacity option + if ( this.helper.css( "opacity" ) ) { + this._storedOpacity = this.helper.css( "opacity" ); + } + this.helper.css( "opacity", o.opacity ); + } + + //Prepare scrolling + if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && + this.scrollParent[ 0 ].tagName !== "HTML" ) { + this.overflowOffset = this.scrollParent.offset(); + } + + //Call callbacks + this._trigger( "start", event, this._uiHash() ); + + //Recache the helper size + if ( !this._preserveHelperProportions ) { + this._cacheHelperProportions(); + } + + //Post "activate" events to possible containers + if ( !noActivation ) { + for ( i = this.containers.length - 1; i >= 0; i-- ) { + this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); + } + } + + //Prepare possible droppables + if ( $.ui.ddmanager ) { + $.ui.ddmanager.current = this; + } + + if ( $.ui.ddmanager && !o.dropBehaviour ) { + $.ui.ddmanager.prepareOffsets( this, event ); + } + + this.dragging = true; + + this._addClass( this.helper, "ui-sortable-helper" ); + + //Move the helper, if needed + if ( !this.helper.parent().is( this.appendTo ) ) { + this.helper.detach().appendTo( this.appendTo ); + + //Update position + this.offset.parent = this._getParentOffset(); + } + + //Generate the original position + this.position = this.originalPosition = this._generatePosition( event ); + this.originalPageX = event.pageX; + this.originalPageY = event.pageY; + this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" ); + + this._mouseDrag( event ); + + return true; + + }, + + _scroll: function( event ) { + var o = this.options, + scrolled = false; + + if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && + this.scrollParent[ 0 ].tagName !== "HTML" ) { + + if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) - + event.pageY < o.scrollSensitivity ) { + this.scrollParent[ 0 ].scrollTop = + scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed; + } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) { + this.scrollParent[ 0 ].scrollTop = + scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed; + } + + if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) - + event.pageX < o.scrollSensitivity ) { + this.scrollParent[ 0 ].scrollLeft = scrolled = + this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed; + } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) { + this.scrollParent[ 0 ].scrollLeft = scrolled = + this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed; + } + + } else { + + if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) { + scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed ); + } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) < + o.scrollSensitivity ) { + scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed ); + } + + if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) { + scrolled = this.document.scrollLeft( + this.document.scrollLeft() - o.scrollSpeed + ); + } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) < + o.scrollSensitivity ) { + scrolled = this.document.scrollLeft( + this.document.scrollLeft() + o.scrollSpeed + ); + } + + } + + return scrolled; + }, + + _mouseDrag: function( event ) { + var i, item, itemElement, intersection, + o = this.options; + + //Compute the helpers position + this.position = this._generatePosition( event ); + this.positionAbs = this._convertPositionTo( "absolute" ); + + //Set the helper position + if ( !this.options.axis || this.options.axis !== "y" ) { + this.helper[ 0 ].style.left = this.position.left + "px"; + } + if ( !this.options.axis || this.options.axis !== "x" ) { + this.helper[ 0 ].style.top = this.position.top + "px"; + } + + //Do scrolling + if ( o.scroll ) { + if ( this._scroll( event ) !== false ) { + + //Update item positions used in position checks + this._refreshItemPositions( true ); + + if ( $.ui.ddmanager && !o.dropBehaviour ) { + $.ui.ddmanager.prepareOffsets( this, event ); + } + } + } + + this.dragDirection = { + vertical: this._getDragVerticalDirection(), + horizontal: this._getDragHorizontalDirection() + }; + + //Rearrange + for ( i = this.items.length - 1; i >= 0; i-- ) { + + //Cache variables and intersection, continue if no intersection + item = this.items[ i ]; + itemElement = item.item[ 0 ]; + intersection = this._intersectsWithPointer( item ); + if ( !intersection ) { + continue; + } + + // Only put the placeholder inside the current Container, skip all + // items from other containers. This works because when moving + // an item from one container to another the + // currentContainer is switched before the placeholder is moved. + // + // Without this, moving items in "sub-sortables" can cause + // the placeholder to jitter between the outer and inner container. + if ( item.instance !== this.currentContainer ) { + continue; + } + + // Cannot intersect with itself + // no useless actions that have been done before + // no action if the item moved is the parent of the item checked + if ( itemElement !== this.currentItem[ 0 ] && + this.placeholder[ intersection === 1 ? + "next" : "prev" ]()[ 0 ] !== itemElement && + !$.contains( this.placeholder[ 0 ], itemElement ) && + ( this.options.type === "semi-dynamic" ? + !$.contains( this.element[ 0 ], itemElement ) : + true + ) + ) { + + this.direction = intersection === 1 ? "down" : "up"; + + if ( this.options.tolerance === "pointer" || + this._intersectsWithSides( item ) ) { + this._rearrange( event, item ); + } else { + break; + } + + this._trigger( "change", event, this._uiHash() ); + break; + } + } + + //Post events to containers + this._contactContainers( event ); + + //Interconnect with droppables + if ( $.ui.ddmanager ) { + $.ui.ddmanager.drag( this, event ); + } + + //Call callbacks + this._trigger( "sort", event, this._uiHash() ); + + this.lastPositionAbs = this.positionAbs; + return false; + + }, + + _mouseStop: function( event, noPropagation ) { + + if ( !event ) { + return; + } + + //If we are using droppables, inform the manager about the drop + if ( $.ui.ddmanager && !this.options.dropBehaviour ) { + $.ui.ddmanager.drop( this, event ); + } + + if ( this.options.revert ) { + var that = this, + cur = this.placeholder.offset(), + axis = this.options.axis, + animation = {}; + + if ( !axis || axis === "x" ) { + animation.left = cur.left - this.offset.parent.left - this.margins.left + + ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? + 0 : + this.offsetParent[ 0 ].scrollLeft + ); + } + if ( !axis || axis === "y" ) { + animation.top = cur.top - this.offset.parent.top - this.margins.top + + ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? + 0 : + this.offsetParent[ 0 ].scrollTop + ); + } + this.reverting = true; + $( this.helper ).animate( + animation, + parseInt( this.options.revert, 10 ) || 500, + function() { + that._clear( event ); + } + ); + } else { + this._clear( event, noPropagation ); + } + + return false; + + }, + + cancel: function() { + + if ( this.dragging ) { + + this._mouseUp( new $.Event( "mouseup", { target: null } ) ); + + if ( this.options.helper === "original" ) { + this.currentItem.css( this._storedCSS ); + this._removeClass( this.currentItem, "ui-sortable-helper" ); + } else { + this.currentItem.show(); + } + + //Post deactivating events to containers + for ( var i = this.containers.length - 1; i >= 0; i-- ) { + this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) ); + if ( this.containers[ i ].containerCache.over ) { + this.containers[ i ]._trigger( "out", null, this._uiHash( this ) ); + this.containers[ i ].containerCache.over = 0; + } + } + + } + + if ( this.placeholder ) { + + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, + // it unbinds ALL events from the original node! + if ( this.placeholder[ 0 ].parentNode ) { + this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); + } + if ( this.options.helper !== "original" && this.helper && + this.helper[ 0 ].parentNode ) { + this.helper.remove(); + } + + $.extend( this, { + helper: null, + dragging: false, + reverting: false, + _noFinalSort: null + } ); + + if ( this.domPosition.prev ) { + $( this.domPosition.prev ).after( this.currentItem ); + } else { + $( this.domPosition.parent ).prepend( this.currentItem ); + } + } + + return this; + + }, + + serialize: function( o ) { + + var items = this._getItemsAsjQuery( o && o.connected ), + str = []; + o = o || {}; + + $( items ).each( function() { + var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" ) + .match( o.expression || ( /(.+)[\-=_](.+)/ ) ); + if ( res ) { + str.push( + ( o.key || res[ 1 ] + "[]" ) + + "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) ); + } + } ); + + if ( !str.length && o.key ) { + str.push( o.key + "=" ); + } + + return str.join( "&" ); + + }, + + toArray: function( o ) { + + var items = this._getItemsAsjQuery( o && o.connected ), + ret = []; + + o = o || {}; + + items.each( function() { + ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" ); + } ); + return ret; + + }, + + /* Be careful with the following core functions */ + _intersectsWith: function( item ) { + + var x1 = this.positionAbs.left, + x2 = x1 + this.helperProportions.width, + y1 = this.positionAbs.top, + y2 = y1 + this.helperProportions.height, + l = item.left, + r = l + item.width, + t = item.top, + b = t + item.height, + dyClick = this.offset.click.top, + dxClick = this.offset.click.left, + isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && + ( y1 + dyClick ) < b ), + isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && + ( x1 + dxClick ) < r ), + isOverElement = isOverElementHeight && isOverElementWidth; + + if ( this.options.tolerance === "pointer" || + this.options.forcePointerForContainers || + ( this.options.tolerance !== "pointer" && + this.helperProportions[ this.floating ? "width" : "height" ] > + item[ this.floating ? "width" : "height" ] ) + ) { + return isOverElement; + } else { + + return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half + x2 - ( this.helperProportions.width / 2 ) < r && // Left Half + t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half + y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half + + } + }, + + _intersectsWithPointer: function( item ) { + var verticalDirection, horizontalDirection, + isOverElementHeight = ( this.options.axis === "x" ) || + this._isOverAxis( + this.positionAbs.top + this.offset.click.top, item.top, item.height ), + isOverElementWidth = ( this.options.axis === "y" ) || + this._isOverAxis( + this.positionAbs.left + this.offset.click.left, item.left, item.width ), + isOverElement = isOverElementHeight && isOverElementWidth; + + if ( !isOverElement ) { + return false; + } + + verticalDirection = this.dragDirection.vertical; + horizontalDirection = this.dragDirection.horizontal; + + return this.floating ? + ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) : + ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); + + }, + + _intersectsWithSides: function( item ) { + + var isOverBottomHalf = this._isOverAxis( this.positionAbs.top + + this.offset.click.top, item.top + ( item.height / 2 ), item.height ), + isOverRightHalf = this._isOverAxis( this.positionAbs.left + + this.offset.click.left, item.left + ( item.width / 2 ), item.width ), + verticalDirection = this.dragDirection.vertical, + horizontalDirection = this.dragDirection.horizontal; + + if ( this.floating && horizontalDirection ) { + return ( ( horizontalDirection === "right" && isOverRightHalf ) || + ( horizontalDirection === "left" && !isOverRightHalf ) ); + } else { + return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) || + ( verticalDirection === "up" && !isOverBottomHalf ) ); + } + + }, + + _getDragVerticalDirection: function() { + var delta = this.positionAbs.top - this.lastPositionAbs.top; + return delta !== 0 && ( delta > 0 ? "down" : "up" ); + }, + + _getDragHorizontalDirection: function() { + var delta = this.positionAbs.left - this.lastPositionAbs.left; + return delta !== 0 && ( delta > 0 ? "right" : "left" ); + }, + + refresh: function( event ) { + this._refreshItems( event ); + this._setHandleClassName(); + this.refreshPositions(); + return this; + }, + + _connectWith: function() { + var options = this.options; + return options.connectWith.constructor === String ? + [ options.connectWith ] : + options.connectWith; + }, + + _getItemsAsjQuery: function( connected ) { + + var i, j, cur, inst, + items = [], + queries = [], + connectWith = this._connectWith(); + + if ( connectWith && connected ) { + for ( i = connectWith.length - 1; i >= 0; i-- ) { + cur = $( connectWith[ i ], this.document[ 0 ] ); + for ( j = cur.length - 1; j >= 0; j-- ) { + inst = $.data( cur[ j ], this.widgetFullName ); + if ( inst && inst !== this && !inst.options.disabled ) { + queries.push( [ typeof inst.options.items === "function" ? + inst.options.items.call( inst.element ) : + $( inst.options.items, inst.element ) + .not( ".ui-sortable-helper" ) + .not( ".ui-sortable-placeholder" ), inst ] ); + } + } + } + } + + queries.push( [ typeof this.options.items === "function" ? + this.options.items + .call( this.element, null, { options: this.options, item: this.currentItem } ) : + $( this.options.items, this.element ) + .not( ".ui-sortable-helper" ) + .not( ".ui-sortable-placeholder" ), this ] ); + + function addItems() { + items.push( this ); + } + for ( i = queries.length - 1; i >= 0; i-- ) { + queries[ i ][ 0 ].each( addItems ); + } + + return $( items ); + + }, + + _removeCurrentsFromItems: function() { + + var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" ); + + this.items = $.grep( this.items, function( item ) { + for ( var j = 0; j < list.length; j++ ) { + if ( list[ j ] === item.item[ 0 ] ) { + return false; + } + } + return true; + } ); + + }, + + _refreshItems: function( event ) { + + this.items = []; + this.containers = [ this ]; + + var i, j, cur, inst, targetData, _queries, item, queriesLength, + items = this.items, + queries = [ [ typeof this.options.items === "function" ? + this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) : + $( this.options.items, this.element ), this ] ], + connectWith = this._connectWith(); + + //Shouldn't be run the first time through due to massive slow-down + if ( connectWith && this.ready ) { + for ( i = connectWith.length - 1; i >= 0; i-- ) { + cur = $( connectWith[ i ], this.document[ 0 ] ); + for ( j = cur.length - 1; j >= 0; j-- ) { + inst = $.data( cur[ j ], this.widgetFullName ); + if ( inst && inst !== this && !inst.options.disabled ) { + queries.push( [ typeof inst.options.items === "function" ? + inst.options.items + .call( inst.element[ 0 ], event, { item: this.currentItem } ) : + $( inst.options.items, inst.element ), inst ] ); + this.containers.push( inst ); + } + } + } + } + + for ( i = queries.length - 1; i >= 0; i-- ) { + targetData = queries[ i ][ 1 ]; + _queries = queries[ i ][ 0 ]; + + for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) { + item = $( _queries[ j ] ); + + // Data for target checking (mouse manager) + item.data( this.widgetName + "-item", targetData ); + + items.push( { + item: item, + instance: targetData, + width: 0, height: 0, + left: 0, top: 0 + } ); + } + } + + }, + + _refreshItemPositions: function( fast ) { + var i, item, t, p; + + for ( i = this.items.length - 1; i >= 0; i-- ) { + item = this.items[ i ]; + + //We ignore calculating positions of all connected containers when we're not over them + if ( this.currentContainer && item.instance !== this.currentContainer && + item.item[ 0 ] !== this.currentItem[ 0 ] ) { + continue; + } + + t = this.options.toleranceElement ? + $( this.options.toleranceElement, item.item ) : + item.item; + + if ( !fast ) { + item.width = t.outerWidth(); + item.height = t.outerHeight(); + } + + p = t.offset(); + item.left = p.left; + item.top = p.top; + } + }, + + refreshPositions: function( fast ) { + + // Determine whether items are being displayed horizontally + this.floating = this.items.length ? + this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : + false; + + // This has to be redone because due to the item being moved out/into the offsetParent, + // the offsetParent's position will change + if ( this.offsetParent && this.helper ) { + this.offset.parent = this._getParentOffset(); + } + + this._refreshItemPositions( fast ); + + var i, p; + + if ( this.options.custom && this.options.custom.refreshContainers ) { + this.options.custom.refreshContainers.call( this ); + } else { + for ( i = this.containers.length - 1; i >= 0; i-- ) { + p = this.containers[ i ].element.offset(); + this.containers[ i ].containerCache.left = p.left; + this.containers[ i ].containerCache.top = p.top; + this.containers[ i ].containerCache.width = + this.containers[ i ].element.outerWidth(); + this.containers[ i ].containerCache.height = + this.containers[ i ].element.outerHeight(); + } + } + + return this; + }, + + _createPlaceholder: function( that ) { + that = that || this; + var className, nodeName, + o = that.options; + + if ( !o.placeholder || o.placeholder.constructor === String ) { + className = o.placeholder; + nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(); + o.placeholder = { + element: function() { + + var element = $( "<" + nodeName + ">", that.document[ 0 ] ); + + that._addClass( element, "ui-sortable-placeholder", + className || that.currentItem[ 0 ].className ) + ._removeClass( element, "ui-sortable-helper" ); + + if ( nodeName === "tbody" ) { + that._createTrPlaceholder( + that.currentItem.find( "tr" ).eq( 0 ), + $( "", that.document[ 0 ] ).appendTo( element ) + ); + } else if ( nodeName === "tr" ) { + that._createTrPlaceholder( that.currentItem, element ); + } else if ( nodeName === "img" ) { + element.attr( "src", that.currentItem.attr( "src" ) ); + } + + if ( !className ) { + element.css( "visibility", "hidden" ); + } + + return element; + }, + update: function( container, p ) { + + // 1. If a className is set as 'placeholder option, we don't force sizes - + // the class is responsible for that + // 2. The option 'forcePlaceholderSize can be enabled to force it even if a + // class name is specified + if ( className && !o.forcePlaceholderSize ) { + return; + } + + // If the element doesn't have a actual height or width by itself (without + // styles coming from a stylesheet), it receives the inline height and width + // from the dragged item. Or, if it's a tbody or tr, it's going to have a height + // anyway since we're populating them with s above, but they're unlikely to + // be the correct height on their own if the row heights are dynamic, so we'll + // always assign the height of the dragged item given forcePlaceholderSize + // is true. + if ( !p.height() || ( o.forcePlaceholderSize && + ( nodeName === "tbody" || nodeName === "tr" ) ) ) { + p.height( + that.currentItem.innerHeight() - + parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) - + parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) ); + } + if ( !p.width() ) { + p.width( + that.currentItem.innerWidth() - + parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) - + parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) ); + } + } + }; + } + + //Create the placeholder + that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) ); + + //Append it after the actual current item + that.currentItem.after( that.placeholder ); + + //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) + o.placeholder.update( that, that.placeholder ); + + }, + + _createTrPlaceholder: function( sourceTr, targetTr ) { + var that = this; + + sourceTr.children().each( function() { + $( " ", that.document[ 0 ] ) + .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) + .appendTo( targetTr ); + } ); + }, + + _contactContainers: function( event ) { + var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, + floating, axis, + innermostContainer = null, + innermostIndex = null; + + // Get innermost container that intersects with item + for ( i = this.containers.length - 1; i >= 0; i-- ) { + + // Never consider a container that's located within the item itself + if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) { + continue; + } + + if ( this._intersectsWith( this.containers[ i ].containerCache ) ) { + + // If we've already found a container and it's more "inner" than this, then continue + if ( innermostContainer && + $.contains( + this.containers[ i ].element[ 0 ], + innermostContainer.element[ 0 ] ) ) { + continue; + } + + innermostContainer = this.containers[ i ]; + innermostIndex = i; + + } else { + + // container doesn't intersect. trigger "out" event if necessary + if ( this.containers[ i ].containerCache.over ) { + this.containers[ i ]._trigger( "out", event, this._uiHash( this ) ); + this.containers[ i ].containerCache.over = 0; + } + } + + } + + // If no intersecting containers found, return + if ( !innermostContainer ) { + return; + } + + // Move the item into the container if it's not there already + if ( this.containers.length === 1 ) { + if ( !this.containers[ innermostIndex ].containerCache.over ) { + this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); + this.containers[ innermostIndex ].containerCache.over = 1; + } + } else { + + // When entering a new container, we will find the item with the least distance and + // append our item near it + dist = 10000; + itemWithLeastDistance = null; + floating = innermostContainer.floating || this._isFloating( this.currentItem ); + posProperty = floating ? "left" : "top"; + sizeProperty = floating ? "width" : "height"; + axis = floating ? "pageX" : "pageY"; + + for ( j = this.items.length - 1; j >= 0; j-- ) { + if ( !$.contains( + this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) + ) { + continue; + } + if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) { + continue; + } + + cur = this.items[ j ].item.offset()[ posProperty ]; + nearBottom = false; + if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { + nearBottom = true; + } + + if ( Math.abs( event[ axis ] - cur ) < dist ) { + dist = Math.abs( event[ axis ] - cur ); + itemWithLeastDistance = this.items[ j ]; + this.direction = nearBottom ? "up" : "down"; + } + } + + //Check if dropOnEmpty is enabled + if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) { + return; + } + + if ( this.currentContainer === this.containers[ innermostIndex ] ) { + if ( !this.currentContainer.containerCache.over ) { + this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); + this.currentContainer.containerCache.over = 1; + } + return; + } + + if ( itemWithLeastDistance ) { + this._rearrange( event, itemWithLeastDistance, null, true ); + } else { + this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); + } + this._trigger( "change", event, this._uiHash() ); + this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); + this.currentContainer = this.containers[ innermostIndex ]; + + //Update the placeholder + this.options.placeholder.update( this.currentContainer, this.placeholder ); + + //Update scrollParent + this.scrollParent = this.placeholder.scrollParent(); + + //Update overflowOffset + if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && + this.scrollParent[ 0 ].tagName !== "HTML" ) { + this.overflowOffset = this.scrollParent.offset(); + } + + this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); + this.containers[ innermostIndex ].containerCache.over = 1; + } + + }, + + _createHelper: function( event ) { + + var o = this.options, + helper = typeof o.helper === "function" ? + $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) : + ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem ); + + //Add the helper to the DOM if that didn't happen already + if ( !helper.parents( "body" ).length ) { + this.appendTo[ 0 ].appendChild( helper[ 0 ] ); + } + + if ( helper[ 0 ] === this.currentItem[ 0 ] ) { + this._storedCSS = { + width: this.currentItem[ 0 ].style.width, + height: this.currentItem[ 0 ].style.height, + position: this.currentItem.css( "position" ), + top: this.currentItem.css( "top" ), + left: this.currentItem.css( "left" ) + }; + } + + if ( !helper[ 0 ].style.width || o.forceHelperSize ) { + helper.width( this.currentItem.width() ); + } + if ( !helper[ 0 ].style.height || o.forceHelperSize ) { + helper.height( this.currentItem.height() ); + } + + return helper; + + }, + + _adjustOffsetFromHelper: function( obj ) { + if ( typeof obj === "string" ) { + obj = obj.split( " " ); + } + if ( Array.isArray( obj ) ) { + obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; + } + if ( "left" in obj ) { + this.offset.click.left = obj.left + this.margins.left; + } + if ( "right" in obj ) { + this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; + } + if ( "top" in obj ) { + this.offset.click.top = obj.top + this.margins.top; + } + if ( "bottom" in obj ) { + this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; + } + }, + + _getParentOffset: function() { + + //Get the offsetParent and cache its position + this.offsetParent = this.helper.offsetParent(); + var po = this.offsetParent.offset(); + + // This is a special case where we need to modify a offset calculated on start, since the + // following happened: + // 1. The position of the helper is absolute, so it's position is calculated based on the + // next positioned parent + // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't + // the document, which means that the scroll is included in the initial calculation of the + // offset of the parent, and never recalculated upon drag + if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] && + $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { + po.left += this.scrollParent.scrollLeft(); + po.top += this.scrollParent.scrollTop(); + } + + // This needs to be actually done for all browsers, since pageX/pageY includes + // this information. + if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ) { + po = { top: 0, left: 0 }; + } + + return { + top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), + left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) + }; + + }, + + _getRelativeOffset: function() { + + if ( this.cssPosition === "relative" ) { + var p = this.currentItem.position(); + return { + top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + + this.scrollParent.scrollTop(), + left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + + this.scrollParent.scrollLeft() + }; + } else { + return { top: 0, left: 0 }; + } + + }, + + _cacheMargins: function() { + this.margins = { + left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ), + top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 ) + }; + }, + + _cacheHelperProportions: function() { + this.helperProportions = { + width: this.helper.outerWidth(), + height: this.helper.outerHeight() + }; + }, + + _setContainment: function() { + + var ce, co, over, + o = this.options; + if ( o.containment === "parent" ) { + o.containment = this.helper[ 0 ].parentNode; + } + if ( o.containment === "document" || o.containment === "window" ) { + this.containment = [ + 0 - this.offset.relative.left - this.offset.parent.left, + 0 - this.offset.relative.top - this.offset.parent.top, + o.containment === "document" ? + this.document.width() : + this.window.width() - this.helperProportions.width - this.margins.left, + ( o.containment === "document" ? + ( this.document.height() || document.body.parentNode.scrollHeight ) : + this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight + ) - this.helperProportions.height - this.margins.top + ]; + } + + if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) { + ce = $( o.containment )[ 0 ]; + co = $( o.containment ).offset(); + over = ( $( ce ).css( "overflow" ) !== "hidden" ); + + this.containment = [ + co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) + + ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left, + co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) + + ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top, + co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) - + ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) - + this.helperProportions.width - this.margins.left, + co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) - + ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) - + this.helperProportions.height - this.margins.top + ]; + } + + }, + + _convertPositionTo: function( d, pos ) { + + if ( !pos ) { + pos = this.position; + } + var mod = d === "absolute" ? 1 : -1, + scroll = this.cssPosition === "absolute" && + !( this.scrollParent[ 0 ] !== this.document[ 0 ] && + $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? + this.offsetParent : + this.scrollParent, + scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); + + return { + top: ( + + // The absolute mouse position + pos.top + + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.top * mod + + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.top * mod - + ( ( this.cssPosition === "fixed" ? + -this.scrollParent.scrollTop() : + ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod ) + ), + left: ( + + // The absolute mouse position + pos.left + + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.left * mod + + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.left * mod - + ( ( this.cssPosition === "fixed" ? + -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : + scroll.scrollLeft() ) * mod ) + ) + }; + + }, + + _generatePosition: function( event ) { + + var top, left, + o = this.options, + pageX = event.pageX, + pageY = event.pageY, + scroll = this.cssPosition === "absolute" && + !( this.scrollParent[ 0 ] !== this.document[ 0 ] && + $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? + this.offsetParent : + this.scrollParent, + scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); + + // This is another very weird special case that only happens for relative elements: + // 1. If the css position is relative + // 2. and the scroll parent is the document or similar to the offset parent + // we have to refresh the relative offset during the scroll so there are no jumps + if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] && + this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) { + this.offset.relative = this._getRelativeOffset(); + } + + /* + * - Position constraining - + * Constrain the position to a mix of grid, containment. + */ + + if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options + + if ( this.containment ) { + if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) { + pageX = this.containment[ 0 ] + this.offset.click.left; + } + if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) { + pageY = this.containment[ 1 ] + this.offset.click.top; + } + if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) { + pageX = this.containment[ 2 ] + this.offset.click.left; + } + if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) { + pageY = this.containment[ 3 ] + this.offset.click.top; + } + } + + if ( o.grid ) { + top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) / + o.grid[ 1 ] ) * o.grid[ 1 ]; + pageY = this.containment ? + ( ( top - this.offset.click.top >= this.containment[ 1 ] && + top - this.offset.click.top <= this.containment[ 3 ] ) ? + top : + ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ? + top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : + top; + + left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) / + o.grid[ 0 ] ) * o.grid[ 0 ]; + pageX = this.containment ? + ( ( left - this.offset.click.left >= this.containment[ 0 ] && + left - this.offset.click.left <= this.containment[ 2 ] ) ? + left : + ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ? + left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : + left; + } + + } + + return { + top: ( + + // The absolute mouse position + pageY - + + // Click offset (relative to the element) + this.offset.click.top - + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.top - + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.top + + ( ( this.cssPosition === "fixed" ? + -this.scrollParent.scrollTop() : + ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) ) + ), + left: ( + + // The absolute mouse position + pageX - + + // Click offset (relative to the element) + this.offset.click.left - + + // Only for relative positioned nodes: Relative offset from element to offset parent + this.offset.relative.left - + + // The offsetParent's offset without borders (offset + border) + this.offset.parent.left + + ( ( this.cssPosition === "fixed" ? + -this.scrollParent.scrollLeft() : + scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) + ) + }; + + }, + + _rearrange: function( event, i, a, hardRefresh ) { + + if ( a ) { + a[ 0 ].appendChild( this.placeholder[ 0 ] ); + } else { + i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], + ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); + } + + //Various things done here to improve the performance: + // 1. we create a setTimeout, that calls refreshPositions + // 2. on the instance, we have a counter variable, that get's higher after every append + // 3. on the local scope, we copy the counter variable, and check in the timeout, + // if it's still the same + // 4. this lets only the last addition to the timeout stack through + this.counter = this.counter ? ++this.counter : 1; + var counter = this.counter; + + this._delay( function() { + if ( counter === this.counter ) { + + //Precompute after each DOM insertion, NOT on mousemove + this.refreshPositions( !hardRefresh ); + } + } ); + + }, + + _clear: function( event, noPropagation ) { + + this.reverting = false; + + // We delay all events that have to be triggered to after the point where the placeholder + // has been removed and everything else normalized again + var i, + delayedTriggers = []; + + // We first have to update the dom position of the actual currentItem + // Note: don't do it if the current item is already removed (by a user), or it gets + // reappended (see #4088) + if ( !this._noFinalSort && this.currentItem.parent().length ) { + this.placeholder.before( this.currentItem ); + } + this._noFinalSort = null; + + if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) { + for ( i in this._storedCSS ) { + if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) { + this._storedCSS[ i ] = ""; + } + } + this.currentItem.css( this._storedCSS ); + this._removeClass( this.currentItem, "ui-sortable-helper" ); + } else { + this.currentItem.show(); + } + + if ( this.fromOutside && !noPropagation ) { + delayedTriggers.push( function( event ) { + this._trigger( "receive", event, this._uiHash( this.fromOutside ) ); + } ); + } + if ( ( this.fromOutside || + this.domPosition.prev !== + this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] || + this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) { + + // Trigger update callback if the DOM position has changed + delayedTriggers.push( function( event ) { + this._trigger( "update", event, this._uiHash() ); + } ); + } + + // Check if the items Container has Changed and trigger appropriate + // events. + if ( this !== this.currentContainer ) { + if ( !noPropagation ) { + delayedTriggers.push( function( event ) { + this._trigger( "remove", event, this._uiHash() ); + } ); + delayedTriggers.push( ( function( c ) { + return function( event ) { + c._trigger( "receive", event, this._uiHash( this ) ); + }; + } ).call( this, this.currentContainer ) ); + delayedTriggers.push( ( function( c ) { + return function( event ) { + c._trigger( "update", event, this._uiHash( this ) ); + }; + } ).call( this, this.currentContainer ) ); + } + } + + //Post events to containers + function delayEvent( type, instance, container ) { + return function( event ) { + container._trigger( type, event, instance._uiHash( instance ) ); + }; + } + for ( i = this.containers.length - 1; i >= 0; i-- ) { + if ( !noPropagation ) { + delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); + } + if ( this.containers[ i ].containerCache.over ) { + delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); + this.containers[ i ].containerCache.over = 0; + } + } + + //Do what was originally in plugins + if ( this._storedStylesheet ) { + this._storedStylesheet.remove(); + this._storedStylesheet = null; + } + if ( this._storedOpacity ) { + this.helper.css( "opacity", this._storedOpacity ); + } + if ( this._storedZIndex ) { + this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex ); + } + + this.dragging = false; + + if ( !noPropagation ) { + this._trigger( "beforeStop", event, this._uiHash() ); + } + + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, + // it unbinds ALL events from the original node! + this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); + + if ( !this.cancelHelperRemoval ) { + if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { + this.helper.remove(); + } + this.helper = null; + } + + if ( !noPropagation ) { + for ( i = 0; i < delayedTriggers.length; i++ ) { + + // Trigger all delayed events + delayedTriggers[ i ].call( this, event ); + } + this._trigger( "stop", event, this._uiHash() ); + } + + this.fromOutside = false; + return !this.cancelHelperRemoval; + + }, + + _trigger: function() { + if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) { + this.cancel(); + } + }, + + _uiHash: function( _inst ) { + var inst = _inst || this; + return { + helper: inst.helper, + placeholder: inst.placeholder || $( [] ), + position: inst.position, + originalPosition: inst.originalPosition, + offset: inst.positionAbs, + item: inst.currentItem, + sender: _inst ? _inst.element : null + }; + } + +} ); + + +/*! + * jQuery UI Accordion 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Accordion +//>>group: Widgets +/* eslint-disable max-len */ +//>>description: Displays collapsible content panels for presenting information in a limited amount of space. +/* eslint-enable max-len */ +//>>docs: https://api.jqueryui.com/accordion/ +//>>demos: https://jqueryui.com/accordion/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/accordion.css +//>>css.theme: ../../themes/base/theme.css + + +var widgetsAccordion = $.widget( "ui.accordion", { + version: "1.14.1", + options: { + active: 0, + animate: {}, + classes: { + "ui-accordion-header": "ui-corner-top", + "ui-accordion-header-collapsed": "ui-corner-all", + "ui-accordion-content": "ui-corner-bottom" + }, + collapsible: false, + event: "click", + header: function( elem ) { + return elem + .find( "> li > :first-child" ) + .add( + elem.find( "> :not(li)" ) + + // Support: jQuery <3.5 only + // We could use `.even()` but that's unavailable in older jQuery. + .filter( function( i ) { + return i % 2 === 0; + } ) + ); + }, + heightStyle: "auto", + icons: { + activeHeader: "ui-icon-triangle-1-s", + header: "ui-icon-triangle-1-e" + }, + + // Callbacks + activate: null, + beforeActivate: null + }, + + hideProps: { + borderTopWidth: "hide", + borderBottomWidth: "hide", + paddingTop: "hide", + paddingBottom: "hide", + height: "hide" + }, + + showProps: { + borderTopWidth: "show", + borderBottomWidth: "show", + paddingTop: "show", + paddingBottom: "show", + height: "show" + }, + + _create: function() { + var options = this.options; + + this.prevShow = this.prevHide = $(); + this._addClass( "ui-accordion", "ui-widget ui-helper-reset" ); + this.element.attr( "role", "tablist" ); + + // Don't allow collapsible: false and active: false / null + if ( !options.collapsible && ( options.active === false || options.active == null ) ) { + options.active = 0; + } + + this._processPanels(); + + // handle negative values + if ( options.active < 0 ) { + options.active += this.headers.length; + } + this._refresh(); + }, + + _getCreateEventData: function() { + return { + header: this.active, + panel: !this.active.length ? $() : this.active.next() + }; + }, + + _createIcons: function() { + var icon, children, + icons = this.options.icons; + + if ( icons ) { + icon = $( "" ); + this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header ); + icon.prependTo( this.headers ); + children = this.active.children( ".ui-accordion-header-icon" ); + this._removeClass( children, icons.header ) + ._addClass( children, null, icons.activeHeader ) + ._addClass( this.headers, "ui-accordion-icons" ); + } + }, + + _destroyIcons: function() { + this._removeClass( this.headers, "ui-accordion-icons" ); + this.headers.children( ".ui-accordion-header-icon" ).remove(); + }, + + _destroy: function() { + var contents; + + // Clean up main element + this.element.removeAttr( "role" ); + + // Clean up headers + this.headers + .removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" ) + .removeUniqueId(); + + this._destroyIcons(); + + // Clean up content panels + contents = this.headers.next() + .css( "display", "" ) + .removeAttr( "role aria-hidden aria-labelledby" ) + .removeUniqueId(); + + if ( this.options.heightStyle !== "content" ) { + contents.css( "height", "" ); + } + }, + + _setOption: function( key, value ) { + if ( key === "active" ) { + + // _activate() will handle invalid values and update this.options + this._activate( value ); + return; + } + + if ( key === "event" ) { + if ( this.options.event ) { + this._off( this.headers, this.options.event ); + } + this._setupEvents( value ); + } + + this._super( key, value ); + + // Setting collapsible: false while collapsed; open first panel + if ( key === "collapsible" && !value && this.options.active === false ) { + this._activate( 0 ); + } + + if ( key === "icons" ) { + this._destroyIcons(); + if ( value ) { + this._createIcons(); + } + } + }, + + _setOptionDisabled: function( value ) { + this._super( value ); + + this.element.attr( "aria-disabled", value ); + this._toggleClass( null, "ui-state-disabled", !!value ); + }, + + _keydown: function( event ) { + if ( event.altKey || event.ctrlKey ) { + return; + } + + var keyCode = $.ui.keyCode, + length = this.headers.length, + currentIndex = this.headers.index( event.target ), + toFocus = false; + + switch ( event.keyCode ) { + case keyCode.RIGHT: + case keyCode.DOWN: + toFocus = this.headers[ ( currentIndex + 1 ) % length ]; + break; + case keyCode.LEFT: + case keyCode.UP: + toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; + break; + case keyCode.SPACE: + case keyCode.ENTER: + this._eventHandler( event ); + break; + case keyCode.HOME: + toFocus = this.headers[ 0 ]; + break; + case keyCode.END: + toFocus = this.headers[ length - 1 ]; + break; + } + + if ( toFocus ) { + $( event.target ).attr( "tabIndex", -1 ); + $( toFocus ).attr( "tabIndex", 0 ); + $( toFocus ).trigger( "focus" ); + event.preventDefault(); + } + }, + + _panelKeyDown: function( event ) { + if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { + $( event.currentTarget ).prev().trigger( "focus" ); + } + }, + + refresh: function() { + var options = this.options; + this._processPanels(); + + // Was collapsed or no panel + if ( ( options.active === false && options.collapsible === true ) || + !this.headers.length ) { + options.active = false; + this.active = $(); + + // active false only when collapsible is true + } else if ( options.active === false ) { + this._activate( 0 ); + + // was active, but active panel is gone + } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { + + // all remaining panel are disabled + if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) { + options.active = false; + this.active = $(); + + // activate previous panel + } else { + this._activate( Math.max( 0, options.active - 1 ) ); + } + + // was active, active panel still exists + } else { + + // make sure active index is correct + options.active = this.headers.index( this.active ); + } + + this._destroyIcons(); + + this._refresh(); + }, + + _processPanels: function() { + var prevHeaders = this.headers, + prevPanels = this.panels; + + if ( typeof this.options.header === "function" ) { + this.headers = this.options.header( this.element ); + } else { + this.headers = this.element.find( this.options.header ); + } + this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed", + "ui-state-default" ); + + this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide(); + this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" ); + + // Avoid memory leaks (#10056) + if ( prevPanels ) { + this._off( prevHeaders.not( this.headers ) ); + this._off( prevPanels.not( this.panels ) ); + } + }, + + _refresh: function() { + var maxHeight, + options = this.options, + heightStyle = options.heightStyle, + parent = this.element.parent(); + + this.active = this._findActive( options.active ); + this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" ) + ._removeClass( this.active, "ui-accordion-header-collapsed" ); + this._addClass( this.active.next(), "ui-accordion-content-active" ); + this.active.next().show(); + + this.headers + .attr( "role", "tab" ) + .each( function() { + var header = $( this ), + headerId = header.uniqueId().attr( "id" ), + panel = header.next(), + panelId = panel.uniqueId().attr( "id" ); + header.attr( "aria-controls", panelId ); + panel.attr( "aria-labelledby", headerId ); + } ) + .next() + .attr( "role", "tabpanel" ); + + this.headers + .not( this.active ) + .attr( { + "aria-selected": "false", + "aria-expanded": "false", + tabIndex: -1 + } ) + .next() + .attr( { + "aria-hidden": "true" + } ) + .hide(); + + // Make sure at least one header is in the tab order + if ( !this.active.length ) { + this.headers.eq( 0 ).attr( "tabIndex", 0 ); + } else { + this.active.attr( { + "aria-selected": "true", + "aria-expanded": "true", + tabIndex: 0 + } ) + .next() + .attr( { + "aria-hidden": "false" + } ); + } + + this._createIcons(); + + this._setupEvents( options.event ); + + if ( heightStyle === "fill" ) { + maxHeight = parent.height(); + this.element.siblings( ":visible" ).each( function() { + var elem = $( this ), + position = elem.css( "position" ); + + if ( position === "absolute" || position === "fixed" ) { + return; + } + maxHeight -= elem.outerHeight( true ); + } ); + + this.headers.each( function() { + maxHeight -= $( this ).outerHeight( true ); + } ); + + this.headers.next() + .each( function() { + $( this ).height( Math.max( 0, maxHeight - + $( this ).innerHeight() + $( this ).height() ) ); + } ) + .css( "overflow", "auto" ); + } else if ( heightStyle === "auto" ) { + maxHeight = 0; + this.headers.next() + .each( function() { + var isVisible = $( this ).is( ":visible" ); + if ( !isVisible ) { + $( this ).show(); + } + maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); + if ( !isVisible ) { + $( this ).hide(); + } + } ) + .height( maxHeight ); + } + }, + + _activate: function( index ) { + var active = this._findActive( index )[ 0 ]; + + // Trying to activate the already active panel + if ( active === this.active[ 0 ] ) { + return; + } + + // Trying to collapse, simulate a click on the currently active header + active = active || this.active[ 0 ]; + + this._eventHandler( { + target: active, + currentTarget: active, + preventDefault: $.noop + } ); + }, + + _findActive: function( selector ) { + return typeof selector === "number" ? this.headers.eq( selector ) : $(); + }, + + _setupEvents: function( event ) { + var events = { + keydown: "_keydown" + }; + if ( event ) { + $.each( event.split( " " ), function( index, eventName ) { + events[ eventName ] = "_eventHandler"; + } ); + } + + this._off( this.headers.add( this.headers.next() ) ); + this._on( this.headers, events ); + this._on( this.headers.next(), { keydown: "_panelKeyDown" } ); + this._hoverable( this.headers ); + this._focusable( this.headers ); + }, + + _eventHandler: function( event ) { + var activeChildren, clickedChildren, + options = this.options, + active = this.active, + clicked = $( event.currentTarget ), + clickedIsActive = clicked[ 0 ] === active[ 0 ], + collapsing = clickedIsActive && options.collapsible, + toShow = collapsing ? $() : clicked.next(), + toHide = active.next(), + eventData = { + oldHeader: active, + oldPanel: toHide, + newHeader: collapsing ? $() : clicked, + newPanel: toShow + }; + + event.preventDefault(); + + if ( + + // click on active header, but not collapsible + ( clickedIsActive && !options.collapsible ) || + + // allow canceling activation + ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { + return; + } + + options.active = collapsing ? false : this.headers.index( clicked ); + + // When the call to ._toggle() comes after the class changes + // it causes a very odd bug in IE 8 (see #6720) + this.active = clickedIsActive ? $() : clicked; + this._toggle( eventData ); + + // Switch classes + // corner classes on the previously active header stay after the animation + this._removeClass( active, "ui-accordion-header-active", "ui-state-active" ); + if ( options.icons ) { + activeChildren = active.children( ".ui-accordion-header-icon" ); + this._removeClass( activeChildren, null, options.icons.activeHeader ) + ._addClass( activeChildren, null, options.icons.header ); + } + + if ( !clickedIsActive ) { + this._removeClass( clicked, "ui-accordion-header-collapsed" ) + ._addClass( clicked, "ui-accordion-header-active", "ui-state-active" ); + if ( options.icons ) { + clickedChildren = clicked.children( ".ui-accordion-header-icon" ); + this._removeClass( clickedChildren, null, options.icons.header ) + ._addClass( clickedChildren, null, options.icons.activeHeader ); + } + + this._addClass( clicked.next(), "ui-accordion-content-active" ); + } + }, + + _toggle: function( data ) { + var toShow = data.newPanel, + toHide = this.prevShow.length ? this.prevShow : data.oldPanel; + + // Handle activating a panel during the animation for another activation + this.prevShow.add( this.prevHide ).stop( true, true ); + this.prevShow = toShow; + this.prevHide = toHide; + + if ( this.options.animate ) { + this._animate( toShow, toHide, data ); + } else { + toHide.hide(); + toShow.show(); + this._toggleComplete( data ); + } + + toHide.attr( { + "aria-hidden": "true" + } ); + toHide.prev().attr( { + "aria-selected": "false", + "aria-expanded": "false" + } ); + + // if we're switching panels, remove the old header from the tab order + // if we're opening from collapsed state, remove the previous header from the tab order + // if we're collapsing, then keep the collapsing header in the tab order + if ( toShow.length && toHide.length ) { + toHide.prev().attr( { + "tabIndex": -1, + "aria-expanded": "false" + } ); + } else if ( toShow.length ) { + this.headers.filter( function() { + return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0; + } ) + .attr( "tabIndex", -1 ); + } + + toShow + .attr( "aria-hidden", "false" ) + .prev() + .attr( { + "aria-selected": "true", + "aria-expanded": "true", + tabIndex: 0 + } ); + }, + + _animate: function( toShow, toHide, data ) { + var total, easing, duration, + that = this, + adjust = 0, + boxSizing = toShow.css( "box-sizing" ), + down = toShow.length && + ( !toHide.length || ( toShow.index() < toHide.index() ) ), + animate = this.options.animate || {}, + options = down && animate.down || animate, + complete = function() { + that._toggleComplete( data ); + }; + + if ( typeof options === "number" ) { + duration = options; + } + if ( typeof options === "string" ) { + easing = options; + } + + // fall back from options to animation in case of partial down settings + easing = easing || options.easing || animate.easing; + duration = duration || options.duration || animate.duration; + + if ( !toHide.length ) { + return toShow.animate( this.showProps, duration, easing, complete ); + } + if ( !toShow.length ) { + return toHide.animate( this.hideProps, duration, easing, complete ); + } + + total = toShow.show().outerHeight(); + toHide.animate( this.hideProps, { + duration: duration, + easing: easing, + step: function( now, fx ) { + fx.now = Math.round( now ); + } + } ); + toShow + .hide() + .animate( this.showProps, { + duration: duration, + easing: easing, + complete: complete, + step: function( now, fx ) { + fx.now = Math.round( now ); + if ( fx.prop !== "height" ) { + if ( boxSizing === "content-box" ) { + adjust += fx.now; + } + } else if ( that.options.heightStyle !== "content" ) { + fx.now = Math.round( total - toHide.outerHeight() - adjust ); + adjust = 0; + } + } + } ); + }, + + _toggleComplete: function( data ) { + var toHide = data.oldPanel, + prev = toHide.prev(); + + this._removeClass( toHide, "ui-accordion-content-active" ); + this._removeClass( prev, "ui-accordion-header-active" ) + ._addClass( prev, "ui-accordion-header-collapsed" ); + + this._trigger( "activate", null, data ); + } +} ); + + +/*! + * jQuery UI Menu 1.14.1 + * https://jqueryui.com + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license. + * https://jquery.org/license + */ + +//>>label: Menu +//>>group: Widgets +//>>description: Creates nestable menus. +//>>docs: https://api.jqueryui.com/menu/ +//>>demos: https://jqueryui.com/menu/ +//>>css.structure: ../../themes/base/core.css +//>>css.structure: ../../themes/base/menu.css +//>>css.theme: ../../themes/base/theme.css + + +var widgetsMenu = $.widget( "ui.menu", { + version: "1.14.1", + defaultElement: "