diff --git a/LangCodes.php b/LangCodes.php new file mode 100644 index 0000000..b583e00 --- /dev/null +++ b/LangCodes.php @@ -0,0 +1,29 @@ +'fr_FR', + 'en_US'=>'en_US'//, + //'zh_CN'=>'zh_CN', + //'zh_TW'=>'zh_TW', + //'de_DE'=>'de_DE' + ); + return $all_lang[$code]; + } + public function getNameLang($code_lang){ + $name_lang=array( + 'fr_FR'=>'Français', + 'en_US'=>'English'//, + //'zh_CN'=>'中文 (中国)', + //'zh_TW'=>'中文 (台灣)', + //'de_DE'=>'Deutsch' + ); + return $name_lang[$code_lang]; + } +} +?> \ No newline at end of file diff --git a/admin.php b/admin.php index b298854..98991ea 100644 --- a/admin.php +++ b/admin.php @@ -19,7 +19,7 @@ include_once 'directory.php'; -$pageTitle='Administration'; +$pageTitle=_('Administration'); include 'templates/header.php'; //set referring page @@ -32,11 +32,11 @@
-Users   -
add new user +   +


-Loading... +
@@ -49,11 +49,11 @@
-Document Types   -
add new document type +   +


-Loading... +
@@ -63,11 +63,11 @@
-Expression Types   -
add new expression type +   +


-Loading... +
@@ -76,11 +76,11 @@
-Qualifiers   -
add new qualifier +   +


-Loading... +
@@ -90,11 +90,11 @@
-Signature Types   -
add new signature type +   +


-Loading... +
@@ -105,11 +105,11 @@
-License Statuses   -
add new license status +   +


-Loading... +
@@ -126,10 +126,10 @@
-Calendar Settings   +  

-Loading... +
@@ -146,11 +146,11 @@
- Consortia   -
add new consortium +    +


- Loading... +
@@ -160,11 +160,11 @@
- Providers   -
add new provider +    +


- Loading... +
@@ -177,7 +177,7 @@ error = mysqli_error($this->db)) { - throw new Exception("There was a problem with the database: " . $this->error); + throw new Exception(_("There was a problem with the database: ") . $this->error); } } @@ -48,6 +48,7 @@ protected function connect() { $databaseName = $this->config->database->name; $this->db = mysqli_connect($host, $username, $password, $databaseName); $this->checkForError(); + mysqli_set_charset($this->db, 'utf8'); } protected function disconnect() { diff --git a/admin/classes/common/Object.php b/admin/classes/common/Object.php index 3ebdbf8..948b3bb 100644 --- a/admin/classes/common/Object.php +++ b/admin/classes/common/Object.php @@ -1,89 +1,89 @@ -. -** -************************************************************************************************************************** -*/ - - -class Object { - - public function __construct(NamedArguments $arguments = NULL) { - if (method_exists($this, 'init')) { - if (!is_a($arguments, 'NamedArguments')) { - $arguments = new NamedArguments(array()); - } - $this->init($arguments); - } - } - - // An optional initializer to use instead of |__construct()|. - protected function init(NamedArguments $arguments) { - - } - - public function __destruct() { - if (method_exists($this, 'dealloc')) { - $this->dealloc(); - } - } - - // An optional method called on deconstruction instead of |__deconstruct()|. - protected function dealloc() { - - } - - // Setters are functions called |$instance->setPropertyName($value)|. - public function __set($name, $value) { - $methodName = 'set' . ucfirst($name); - $this->$methodName($value); - } - - // Getters are functions called |$instance->propertyName()|. - public function __get($name) { - return $this->$name(); - } - - // Default setter uses declared properties. - protected function setValueForKey($key, $value) { - if (property_exists($this, $key)) { - $this->$key = $value; - } else { - throw new Exception("Cannot set value for undefined key ($key)."); - } - } - - // Default getter uses declared properties. - protected function valueForKey($key) { - if (property_exists($this, $key)) { - return $this->$key; - } else { - throw new Exception("Cannot get value for undefined key ($key)."); - } - } - - // Call |valueForKey| and |setValueForKey| as default setter and getter. - public function __call($name, $arguments) { - if (preg_match('/^set[A-Z]/', $name)) { - $key = preg_replace('/^set/', '\1', $name); - $key = lcfirst($key); - $this->setValueForKey($key, $arguments[0]); - } else { - return $this->valueForKey($name); - } - } - -} - +. +** +************************************************************************************************************************** +*/ + + +class Object { + + public function __construct(NamedArguments $arguments = NULL) { + if (method_exists($this, 'init')) { + if (!is_a($arguments, 'NamedArguments')) { + $arguments = new NamedArguments(array()); + } + $this->init($arguments); + } + } + + // An optional initializer to use instead of |__construct()|. + protected function init(NamedArguments $arguments) { + + } + + public function __destruct() { + if (method_exists($this, 'dealloc')) { + $this->dealloc(); + } + } + + // An optional method called on deconstruction instead of |__deconstruct()|. + protected function dealloc() { + + } + + // Setters are functions called |$instance->setPropertyName($value)|. + public function __set($name, $value) { + $methodName = 'set' . ucfirst($name); + $this->$methodName($value); + } + + // Getters are functions called |$instance->propertyName()|. + public function __get($name) { + return $this->$name(); + } + + // Default setter uses declared properties. + protected function setValueForKey($key, $value) { + if (property_exists($this, $key)) { + $this->$key = $value; + } else { + throw new Exception("Cannot set value for undefined key ($key)."); + } + } + + // Default getter uses declared properties. + protected function valueForKey($key) { + if (property_exists($this, $key)) { + return $this->$key; + } else { + throw new Exception(_("Cannot get value for undefined key (").$key.")."); + } + } + + // Call |valueForKey| and |setValueForKey| as default setter and getter. + public function __call($name, $arguments) { + if (preg_match('/^set[A-Z]/', $name)) { + $key = preg_replace('/^set/', '\1', $name); + $key = lcfirst($key); + $this->setValueForKey($key, $arguments[0]); + } else { + return $this->valueForKey($name); + } + } + +} + ?> \ No newline at end of file diff --git a/admin/classes/common/Utility.php b/admin/classes/common/Utility.php index 16cf994..3514ea7 100644 --- a/admin/classes/common/Utility.php +++ b/admin/classes/common/Utility.php @@ -84,6 +84,10 @@ public function getOrganizationURL(){ return $this->getCORALURL() . "organizations/orgDetail.php?organizationID="; } + public function getResourceURL(){ + return $this->getCORALURL() . "resources/resource.php?resourceID="; + } + @@ -100,10 +104,12 @@ public function fixLicenseFormEnter($editLicenseID){ if ($result['max_licenseID']){ header('Location: license.php?licenseID=' . $result['max_licenseID']); + exit; //PREVENT SECURITY HOLE } }else{ header('Location: license.php?licenseID=' . $editLicenseID); + exit; //PREVENT SECURITY HOLE } } diff --git a/admin/classes/domain/License.php b/admin/classes/domain/License.php index 2d188b4..c688c5f 100644 --- a/admin/classes/domain/License.php +++ b/admin/classes/domain/License.php @@ -1,682 +1,711 @@ -. -** -************************************************************************************************************************** -*/ - - -class License extends DatabaseObject { - - protected function defineRelationships() {} - - protected function overridePrimaryKeyName() {} - - - - //returns array of Document objects - used by forms to get dropdowns of available documents - public function getDocuments(){ - - $query = "SELECT D.* - FROM Document D - LEFT JOIN Signature S ON (S.documentID = D.documentID) - LEFT JOIN DocumentType DT ON (DT.documentTypeID = D.documentTypeID) - WHERE licenseID = '" . $this->licenseID . "' - AND (D.expirationDate is null OR D.expirationDate = '0000-00-00') - GROUP BY D.documentID - ORDER BY D.shortName;"; - - $result = $this->db->processQuery($query, 'assoc'); - - $objects = array(); - - //need to do this since it could be that there's only one request and this is how the dbservice returns result - if (isset($result['documentID'])){ - $object = new Document(new NamedArguments(array('primaryKey' => $result['documentID']))); - array_push($objects, $object); - }else{ - foreach ($result as $row) { - $object = new Document(new NamedArguments(array('primaryKey' => $row['documentID']))); - array_push($objects, $object); - } - } - - return $objects; - } - - - //returns array of Document objects (parent documents) - used for document display on license record - public function getDocumentsWithoutParents($orderBy){ - - $query = "SELECT D.* - FROM Document D - LEFT JOIN Signature S ON (S.documentID = D.documentID) - LEFT JOIN DocumentType DT ON (DT.documentTypeID = D.documentTypeID) - WHERE licenseID = '" . $this->licenseID . "' - AND (D.expirationDate is null OR D.expirationDate = '0000-00-00') - AND (D.parentDocumentID is null OR D.parentDocumentID=0) - GROUP BY D.documentID - ORDER BY " . $orderBy . ";"; - - $result = $this->db->processQuery($query, 'assoc'); - - $objects = array(); - - //need to do this since it could be that there's only one request and this is how the dbservice returns result - if (isset($result['documentID'])){ - $object = new Document(new NamedArguments(array('primaryKey' => $result['documentID']))); - array_push($objects, $object); - }else{ - foreach ($result as $row) { - $object = new Document(new NamedArguments(array('primaryKey' => $row['documentID']))); - array_push($objects, $object); - } - } - - return $objects; - } - - - - //returns array of Document objects that are archived - used by forms to get dropdowns of available documents - public function getArchivedDocuments(){ - - $query = "SELECT D.* FROM Document D - LEFT JOIN Signature S ON (S.documentID = D.documentID) - LEFT JOIN DocumentType DT ON (DT.documentTypeID = D.documentTypeID) - WHERE D.documentTypeID = DT.documentTypeID - AND licenseID = '" . $this->licenseID . "' - AND (D.expirationDate is not null AND D.expirationDate != '0000-00-00') - GROUP BY D.documentID - ORDER BY D.shortName asc;"; - - $result = $this->db->processQuery($query, 'assoc'); - - $objects = array(); - - //need to do this since it could be that there's only one request and this is how the dbservice returns result - if (isset($result['documentID'])){ - $object = new Document(new NamedArguments(array('primaryKey' => $result['documentID']))); - array_push($objects, $object); - }else{ - foreach ($result as $row) { - $object = new Document(new NamedArguments(array('primaryKey' => $row['documentID']))); - array_push($objects, $object); - } - } - - return $objects; - } - - //returns array of Document objects that are archived - used by document display on license record - public function getArchivedDocumentsWithoutParents($orderBy){ - - $query = "SELECT D.* FROM Document D - LEFT JOIN Signature S ON (S.documentID = D.documentID) - LEFT JOIN DocumentType DT ON (DT.documentTypeID = D.documentTypeID) - WHERE D.documentTypeID = DT.documentTypeID - AND licenseID = '" . $this->licenseID . "' - AND (D.expirationDate is not null AND D.expirationDate != '0000-00-00') - AND (D.parentDocumentID is null OR D.parentDocumentID=0) - GROUP BY D.documentID - ORDER BY " . $orderBy . ";"; - - $result = $this->db->processQuery($query, 'assoc'); - - $objects = array(); - - //need to do this since it could be that there's only one request and this is how the dbservice returns result - if (isset($result['documentID'])){ - $object = new Document(new NamedArguments(array('primaryKey' => $result['documentID']))); - array_push($objects, $object); - }else{ - foreach ($result as $row) { - $object = new Document(new NamedArguments(array('primaryKey' => $row['documentID']))); - array_push($objects, $object); - } - } - - return $objects; - } - - - - - - //returns array of Attachment objects - public function getAttachments(){ - - $query = "SELECT * FROM Attachment where licenseID = '" . $this->licenseID . "' ORDER BY attachmentID"; - - $result = $this->db->processQuery($query, 'assoc'); - - $objects = array(); - - //need to do this since it could be that there's only one request and this is how the dbservice returns result - if (isset($result['attachmentID'])){ - $object = new Attachment(new NamedArguments(array('primaryKey' => $result['attachmentID']))); - array_push($objects, $object); - }else{ - foreach ($result as $row) { - $object = new Attachment(new NamedArguments(array('primaryKey' => $row['attachmentID']))); - array_push($objects, $object); - } - } - - return $objects; - } - - - - - //removes this license - public function removeLicense(){ - - //delete all documents and associated expressions and SFX providers - $document = new Document(); - foreach ($this->getDocuments() as $document) { - //delete all expressions and expression notes - $expression = new Expression(); - foreach ($document->getExpressions() as $expression) { - $expressionNote = new ExpressionNote(); - foreach ($expression->getExpressionNotes() as $expressionNote) { - $expressionNote->delete(); - } - - $expression->removeQualifiers(); - $expression->delete(); - } - - $sfxProvider = new SFXProvider(); - foreach ($document->getSFXProviders() as $sfxProvider) { - $sfxProvider->delete(); - } - - $signature = new Signature(); - foreach ($document->getSignatures() as $signature) { - $signature->delete(); - } - - $document->delete(); - } - - - //delete all attachments - $attachment = new Attachment(); - foreach ($this->getAttachments() as $attachment) { - $attachmentFile = new AttachmentFile(); - foreach ($attachment->getAttachmentFiles() as $attachmentFile) { - $attachmentFile->delete(); - } - $attachment->delete(); - } - - - $this->delete(); - } - - public function searchQuery($whereAdd, $orderBy = '', $limit = '', $count = false) { - if (count($whereAdd) > 0){ - $whereStatement = " AND " . implode(" AND ", $whereAdd); - }else{ - $whereStatement = ""; - } - - if ($limit != ""){ - $limitStatement = " LIMIT " . $limit; - }else{ - $limitStatement = ""; - } - - $config = new Configuration; - - //if the org module is installed get the org name from org database - if ($config->settings->organizationsModule == 'Y') { - $dbName = $config->settings->organizationsDatabaseName; - if ($count) { - $select = "SELECT COUNT(DISTINCT L.licenseID) count"; - } else { - $select = "SELECT distinct L.licenseID, L.shortName licenseName, O2.name consortiumName, O.name providerName, S.shortName status"; - } - //now formulate query - $query = $select . " - FROM " . $dbName . ".Organization O, License L - LEFT JOIN " . $dbName . ".Organization O2 ON (O2.organizationID = L.consortiumID) - LEFT JOIN " . $dbName . ".Alias A ON (A.organizationID = L.organizationID) - LEFT JOIN Status S ON (S.statusID = L.statusID) - LEFT JOIN Document D ON (D.licenseID = L.licenseID) - LEFT JOIN Expression E ON (D.documentID = E.documentID) - WHERE O.organizationID = L.organizationID - " . $whereStatement; - - } else { - if ($count) { - $select = "SELECT COUNT(DISTINCT L.licenseID) count"; - } else { - $select = "SELECT distinct L.licenseID, L.shortName licenseName, C.shortName consortiumName, O.shortName providerName, S.shortName status"; - } - //now formulate query - $query = $select . " - FROM Organization O, License L - LEFT JOIN Consortium C ON (C.consortiumID = L.consortiumID) - LEFT JOIN Status S ON (S.statusID = L.statusID) - LEFT JOIN Document D ON (D.licenseID = L.licenseID) - LEFT JOIN Expression E ON (D.documentID = E.documentID) - WHERE O.organizationID = L.organizationID - " . $whereStatement; - - } - - if ($orderBy) { - $query .= "\nORDER BY " . $orderBy; - } - - if ($limit) { - $query .= "\nLIMIT " . $limit; - } - - return $query; - } - - public function searchCount($whereAdd) { - $query = $this->searchQuery($whereAdd, '', '', true); - $result = $this->db->processQuery(stripslashes($query), 'assoc'); - return $result['count']; - } - - //returns array based on search - public function search($whereAdd, $orderBy, $limit){ - $query = $this->searchQuery($whereAdd, $orderBy, $limit); - - $result = $this->db->processQuery(stripslashes($query), 'assoc'); - - - $searchArray = array(); - $resultArray = array(); - - //need to do this since it could be that there's only one result and this is how the dbservice returns result - if (isset($result['licenseID'])){ - - foreach (array_keys($result) as $attributeName) { - $resultArray[$attributeName] = $result[$attributeName]; - } - - array_push($searchArray, $resultArray); - }else{ - foreach ($result as $row) { - $resultArray = array(); - foreach (array_keys($row) as $attributeName) { - $resultArray[$attributeName] = $row[$attributeName]; - } - array_push($searchArray, $resultArray); - } - } - - return $searchArray; - - - } - - - - - - - //returns array - public function getInProgressLicenses(){ - $config = new Configuration; - - //if the org module is installed get the org name from org database - if ($config->settings->organizationsModule == 'Y'){ - $dbName = $config->settings->organizationsDatabaseName; - - //execute query to get default licenses - $query = "SELECT L.licenseID, L.shortName licenseName, O2.name consortiumName, O.name providerName, S.shortName status - FROM " . $dbName . ".Organization O, License L - LEFT JOIN " . $dbName . ".Organization O2 ON (O2.organizationID = L.consortiumID) - LEFT JOIN Status S ON (S.statusID = L.statusID) - WHERE O.organizationID = L.organizationID - AND (S.shortName in ('Editing Expressions','Awaiting Document') OR L.statusID IS NULL) - ORDER BY L.shortName"; - }else{ - - //execute query to get default licenses - $query = "SELECT L.licenseID, L.shortName licenseName, C.shortName consortiumName, O.shortName providerName, S.shortName status - FROM Organization O, License L - LEFT JOIN Consortium C ON (C.consortiumID = L.consortiumID) - LEFT JOIN Status S ON (S.statusID = L.statusID) - WHERE O.organizationID = L.organizationID - AND (S.shortName in ('Editing Expressions','Awaiting Document') OR L.statusID IS NULL) - ORDER BY L.shortName"; - - } - - $result = $this->db->processQuery($query, 'assoc'); - - $searchArray = array(); - $resultArray = array(); - - //need to do this since it could be that there's only one result and this is how the dbservice returns result - if (isset($result['licenseID'])){ - - foreach (array_keys($result) as $attributeName) { - $resultArray[$attributeName] = $result[$attributeName]; - } - - array_push($searchArray, $resultArray); - }else{ - foreach ($result as $row) { - $resultArray = array(); - foreach (array_keys($row) as $attributeName) { - $resultArray[$attributeName] = $row[$attributeName]; - } - array_push($searchArray, $resultArray); - } - } - - return $searchArray; - } - - - - //returns array of Expressions - public function getAllDocumentsForExpressionDisplay(){ - - $query="SELECT distinct D.documentID, D.shortName documentName - FROM Document D, Expression E - WHERE E.documentID = D.documentID - AND licenseID = '" . $this->licenseID . "' AND (D.expirationDate is null or D.expirationDate ='0000-00-00') - ORDER BY documentID;"; - - $result = $this->db->processQuery($query, 'assoc'); - - $objects = array(); - - //need to do this since it could be that there's only one request and this is how the dbservice returns result - if (isset($result['documentID'])){ - $object = new Document(new NamedArguments(array('primaryKey' => $result['documentID']))); - array_push($objects, $object); - }else{ - foreach ($result as $row) { - $object = new Document(new NamedArguments(array('primaryKey' => $row['documentID']))); - array_push($objects, $object); - } - } - - return $objects; - } - - - //search used for the autocomplete - public function searchOrganizations($q){ - $config = new Configuration; - - $q = str_replace("+", " ",$q); - $q = str_replace("%", "&",$q); - - $orgArray = array(); - - //if the org module is installed get the org names from org database - if ($config->settings->organizationsModule == 'Y'){ - - $dbName = $config->settings->organizationsDatabaseName; - - - $query = "SELECT CONCAT(A.name, ' (', O.name, ')') name, O.organizationID - FROM " . $dbName . ".Alias A, " . $dbName . ".Organization O - WHERE A.organizationID=O.organizationID - AND upper(A.name) like upper('%" . $q . "%') - UNION - SELECT name, organizationID - FROM " . $dbName . ".Organization - WHERE upper(name) like upper('%" . $q . "%') - ORDER BY 1;"; - - $result = mysqli_query($this->db->getDatabase(), $query); - - while ($row = mysqli_fetch_assoc($result)){ - $orgArray[] = $row['organizationID'] . "|" . $row['name']; - } - - - //otherwise get the orgs from this database - }else{ - $query = "SELECT shortName, organizationID - FROM Organization - WHERE upper(shortName) like upper('%" . $q . "%') - ORDER BY 1;"; - - $result = mysqli_query($this->db->getDatabase(), $query); - - while ($row = mysqli_fetch_assoc($result)){ - $orgArray[] = $row['organizationID'] . "|" . $row['shortName']; - } - - - } - - - return $orgArray; - } - - - - - //search used index page drop down - public function getOrganizationList(){ - $config = new Configuration; - - $orgArray = array(); - - //if the org module is installed get the org names from org database - if ($config->settings->organizationsModule == 'Y'){ - $dbName = $config->settings->organizationsDatabaseName; - $query = "SELECT name, organizationID FROM " . $dbName . ".Organization ORDER BY 1;"; - - //otherwise get the orgs from this database - }else{ - $query = "SELECT shortName name, organizationID FROM Organization ORDER BY 1;"; - } - - - $result = $this->db->processQuery($query, 'assoc'); - - $resultArray = array(); - - //need to do this since it could be that there's only one result and this is how the dbservice returns result - if (isset($result['organizationID'])){ - - foreach (array_keys($result) as $attributeName) { - $resultArray[$attributeName] = $result[$attributeName]; - } - - array_push($orgArray, $resultArray); - }else{ - foreach ($result as $row) { - $resultArray = array(); - foreach (array_keys($row) as $attributeName) { - $resultArray[$attributeName] = $row[$attributeName]; - } - array_push($orgArray, $resultArray); - } - } - - return $orgArray; - - } - - - - //go to organizations and get the org name for this license - public function getOrganizationName(){ - $config = new Configuration; - - //if the org module is installed get the org name from org database - if ($config->settings->organizationsModule == 'Y'){ - $dbName = $config->settings->organizationsDatabaseName; - - $orgArray = array(); - $query = "SELECT name FROM " . $dbName . ".Organization WHERE organizationID = " . $this->organizationID; - - if ($result = mysqli_query($this->db->getDatabase(), $query)){ - - while ($row = mysqli_fetch_assoc($result)){ - return $row['name']; - } - } - //otherwise if the org module is not installed get the org name from this database - }else{ - $organization = new Organization(new NamedArguments(array('primaryKey' => $this->organizationID))); - return $organization->shortName; - } - } - - - - //insert the organization / provider if it doesn't already exist - public function setOrganization($orgID, $orgName){ - $config = new Configuration; - - //if the org module is installed get the org name from org database - if ($config->settings->organizationsModule == 'Y'){ - //if no org ID was passed in then we need to create a new organization shell - if (!$orgID){ - - $dbName = $config->settings->organizationsDatabaseName; - $orgName = str_replace("'", "''",$orgName); - - $query = "INSERT INTO " . $dbName . ".Organization (name, createDate, createLoginID) VALUES ('" . $orgName . "', NOW(), '" . $_SESSION['loginID'] . "')"; - - $this->organizationID = $this->db->processQuery($query); - - }else{ - $this->organizationID = $orgID; - } - - //otherwise if the org module is not installed get the org name from this database - }else{ - - //if no org ID was passed in then we need to create a new provider - if (!$orgID){ - $organization = new Organization(); - $organization->organizationID = ''; - $organization->shortName = $orgName; - $organization->save(); - - $this->organizationID = $organization->primaryKey; - }else{ - $this->organizationID = $orgID; - } - } - } - - - - - - //search used index page drop down - public function getConsortiumList(){ - $config = new Configuration; - - $consortiumArray = array(); - - //if the org module is installed get the consortia names from org database - if ($config->settings->organizationsModule == 'Y'){ - $dbName = $config->settings->organizationsDatabaseName; - $query = "SELECT name, O.organizationID consortiumID - FROM " . $dbName . ".Organization O, - " . $dbName . ".OrganizationRoleProfile ORP, - " . $dbName . ".OrganizationRole - WHERE OrganizationRole.organizationRoleID = ORP.organizationRoleID - AND ORP.organizationID = O.organizationID - AND UPPER(OrganizationRole.shortName) LIKE 'CONSORT%' - ORDER BY 1;"; - - //otherwise get the consortium from this database - }else{ - $query = "SELECT shortName name, consortiumID FROM Consortium ORDER BY 1;"; - } - - - $result = $this->db->processQuery($query, 'assoc'); - - $resultArray = array(); - - //need to do this since it could be that there's only one result and this is how the dbservice returns result - if (isset($result['consortiumID'])){ - - foreach (array_keys($result) as $attributeName) { - $resultArray[$attributeName] = $result[$attributeName]; - } - - array_push($consortiumArray, $resultArray); - }else{ - foreach ($result as $row) { - $resultArray = array(); - foreach (array_keys($row) as $attributeName) { - $resultArray[$attributeName] = $row[$attributeName]; - } - array_push($consortiumArray, $resultArray); - } - } - - return $consortiumArray; - - } - - - - //go to organizations and get the consortia name for this license - public function getConsortiumName(){ - $config = new Configuration; - - //if the org module is installed get the org name from org database - if ($config->settings->organizationsModule == 'Y'){ - $dbName = $config->settings->organizationsDatabaseName; - - $orgArray = array(); - $query = "SELECT name FROM " . $dbName . ".Organization WHERE organizationID = " . $this->consortiumID; - $result = mysqli_query($this->db->getDatabase(), $query); - - while ($row = mysqli_fetch_assoc($result)){ - return $row['name']; - } - //otherwise if the org module is not installed get the consortium name from this database - }else{ - $consortium = new Consortium(new NamedArguments(array('primaryKey' => $this->consortiumID))); - return $consortium->shortName; - } - } - - - - //used for A-Z on search (index) - public function getAlphabeticalList(){ - $alphArray = array(); - $result = mysqli_query($this->db->getDatabase(), "SELECT DISTINCT UPPER(SUBSTR(TRIM(LEADING 'The ' FROM shortName),1,1)) letter, COUNT(SUBSTR(TRIM(LEADING 'The ' FROM shortName),1,1)) letter_count - FROM License L - GROUP BY SUBSTR(TRIM(LEADING 'The ' FROM shortName),1,1) - ORDER BY 1;"); - - while ($row = mysqli_fetch_assoc($result)){ - $alphArray[$row['letter']] = $row['letter_count']; - } - - return $alphArray; - } - - -} - -?> +. +** +************************************************************************************************************************** +*/ + + +class License extends DatabaseObject { + + protected function defineRelationships() {} + + protected function overridePrimaryKeyName() {} + + + + //returns array of Document objects - used by forms to get dropdowns of available documents + public function getDocuments(){ + + $query = "SELECT D.* + FROM Document D + LEFT JOIN Signature S ON (S.documentID = D.documentID) + LEFT JOIN DocumentType DT ON (DT.documentTypeID = D.documentTypeID) + WHERE licenseID = '" . $this->licenseID . "' + AND (D.expirationDate is null OR D.expirationDate = '0000-00-00') + GROUP BY D.documentID + ORDER BY D.shortName;"; + + $result = $this->db->processQuery($query, 'assoc'); + + $objects = array(); + + //need to do this since it could be that there's only one request and this is how the dbservice returns result + if (isset($result['documentID'])){ + $object = new Document(new NamedArguments(array('primaryKey' => $result['documentID']))); + array_push($objects, $object); + }else{ + foreach ($result as $row) { + $object = new Document(new NamedArguments(array('primaryKey' => $row['documentID']))); + array_push($objects, $object); + } + } + + return $objects; + } + + //returns array of Resource object - used for helpful links display on license record + public function getResourceArray() { + $config = new Configuration; + $dbName = $config->settings->resourcesDatabaseName; + + if($config->settings->resourcesModule == 'Y') { + + $resourceLicenseArray = array(); + + $query = "SELECT * FROM " . $dbName . ".ResourceLicenseLink WHERE licenseID = '" . $this->licenseID . "'"; + + $result = mysqli_query($this->db->getDatabase(), $query); + + while ($row = mysqli_fetch_assoc($result)){ + $resArray = array(); + + //first, get the resource name + $query = "SELECT resourceID, titleText FROM " . $dbName . ".Resource WHERE resourceID = " . $row['resourceID']; + + $resResult = mysqli_query($this->db->getDatabase(), $query); + while($resRow = mysqli_fetch_assoc($resResult)) { + $resArray['resource'] = $resRow['titleText']; + $resArray['resourceID'] = $resRow['resourceID']; + array_push($resourceLicenseArray, $resArray); + } + } + } + return $resourceLicenseArray; + } + + //returns array of Document objects (parent documents) - used for document display on license record + public function getDocumentsWithoutParents($orderBy){ + + $query = "SELECT D.* + FROM Document D + LEFT JOIN Signature S ON (S.documentID = D.documentID) + LEFT JOIN DocumentType DT ON (DT.documentTypeID = D.documentTypeID) + WHERE licenseID = '" . $this->licenseID . "' + AND (D.expirationDate is null OR D.expirationDate = '0000-00-00') + AND (D.parentDocumentID is null OR D.parentDocumentID=0) + GROUP BY D.documentID + ORDER BY " . $orderBy . ";"; + + $result = $this->db->processQuery($query, 'assoc'); + + $objects = array(); + + //need to do this since it could be that there's only one request and this is how the dbservice returns result + if (isset($result['documentID'])){ + $object = new Document(new NamedArguments(array('primaryKey' => $result['documentID']))); + array_push($objects, $object); + }else{ + foreach ($result as $row) { + $object = new Document(new NamedArguments(array('primaryKey' => $row['documentID']))); + array_push($objects, $object); + } + } + + return $objects; + } + + + + //returns array of Document objects that are archived - used by forms to get dropdowns of available documents + public function getArchivedDocuments(){ + + $query = "SELECT D.* FROM Document D + LEFT JOIN Signature S ON (S.documentID = D.documentID) + LEFT JOIN DocumentType DT ON (DT.documentTypeID = D.documentTypeID) + WHERE D.documentTypeID = DT.documentTypeID + AND licenseID = '" . $this->licenseID . "' + AND (D.expirationDate is not null AND D.expirationDate != '0000-00-00') + GROUP BY D.documentID + ORDER BY D.shortName asc;"; + + $result = $this->db->processQuery($query, 'assoc'); + + $objects = array(); + + //need to do this since it could be that there's only one request and this is how the dbservice returns result + if (isset($result['documentID'])){ + $object = new Document(new NamedArguments(array('primaryKey' => $result['documentID']))); + array_push($objects, $object); + }else{ + foreach ($result as $row) { + $object = new Document(new NamedArguments(array('primaryKey' => $row['documentID']))); + array_push($objects, $object); + } + } + + return $objects; + } + + //returns array of Document objects that are archived - used by document display on license record + public function getArchivedDocumentsWithoutParents($orderBy){ + + $query = "SELECT D.* FROM Document D + LEFT JOIN Signature S ON (S.documentID = D.documentID) + LEFT JOIN DocumentType DT ON (DT.documentTypeID = D.documentTypeID) + WHERE D.documentTypeID = DT.documentTypeID + AND licenseID = '" . $this->licenseID . "' + AND (D.expirationDate is not null AND D.expirationDate != '0000-00-00') + AND (D.parentDocumentID is null OR D.parentDocumentID=0) + GROUP BY D.documentID + ORDER BY " . $orderBy . ";"; + + $result = $this->db->processQuery($query, 'assoc'); + + $objects = array(); + + //need to do this since it could be that there's only one request and this is how the dbservice returns result + if (isset($result['documentID'])){ + $object = new Document(new NamedArguments(array('primaryKey' => $result['documentID']))); + array_push($objects, $object); + }else{ + foreach ($result as $row) { + $object = new Document(new NamedArguments(array('primaryKey' => $row['documentID']))); + array_push($objects, $object); + } + } + + return $objects; + } + + + + + + //returns array of Attachment objects + public function getAttachments(){ + + $query = "SELECT * FROM Attachment where licenseID = '" . $this->licenseID . "' ORDER BY attachmentID"; + + $result = $this->db->processQuery($query, 'assoc'); + + $objects = array(); + + //need to do this since it could be that there's only one request and this is how the dbservice returns result + if (isset($result['attachmentID'])){ + $object = new Attachment(new NamedArguments(array('primaryKey' => $result['attachmentID']))); + array_push($objects, $object); + }else{ + foreach ($result as $row) { + $object = new Attachment(new NamedArguments(array('primaryKey' => $row['attachmentID']))); + array_push($objects, $object); + } + } + + return $objects; + } + + + + + //removes this license + public function removeLicense(){ + + //delete all documents and associated expressions and SFX providers + $document = new Document(); + foreach ($this->getDocuments() as $document) { + //delete all expressions and expression notes + $expression = new Expression(); + foreach ($document->getExpressions() as $expression) { + $expressionNote = new ExpressionNote(); + foreach ($expression->getExpressionNotes() as $expressionNote) { + $expressionNote->delete(); + } + + $expression->removeQualifiers(); + $expression->delete(); + } + + $sfxProvider = new SFXProvider(); + foreach ($document->getSFXProviders() as $sfxProvider) { + $sfxProvider->delete(); + } + + $signature = new Signature(); + foreach ($document->getSignatures() as $signature) { + $signature->delete(); + } + + $document->delete(); + } + + + //delete all attachments + $attachment = new Attachment(); + foreach ($this->getAttachments() as $attachment) { + $attachmentFile = new AttachmentFile(); + foreach ($attachment->getAttachmentFiles() as $attachmentFile) { + $attachmentFile->delete(); + } + $attachment->delete(); + } + + + $this->delete(); + } + + public function searchQuery($whereAdd, $orderBy = '', $limit = '', $count = false) { + if (count($whereAdd) > 0){ + $whereStatement = " AND " . implode(" AND ", $whereAdd); + }else{ + $whereStatement = ""; + } + + if ($limit != ""){ + $limitStatement = " LIMIT " . $limit; + }else{ + $limitStatement = ""; + } + + $config = new Configuration; + + //if the org module is installed get the org name from org database + if ($config->settings->organizationsModule == 'Y') { + $dbName = $config->settings->organizationsDatabaseName; + if ($count) { + $select = "SELECT COUNT(DISTINCT L.licenseID) count"; + } else { + $select = "SELECT distinct L.licenseID, L.shortName licenseName, O2.name consortiumName, O.name providerName, S.shortName status"; + } + //now formulate query + $query = $select . " + FROM " . $dbName . ".Organization O, License L + LEFT JOIN " . $dbName . ".Organization O2 ON (O2.organizationID = L.consortiumID) + LEFT JOIN " . $dbName . ".Alias A ON (A.organizationID = L.organizationID) + LEFT JOIN Status S ON (S.statusID = L.statusID) + LEFT JOIN Document D ON (D.licenseID = L.licenseID) + LEFT JOIN Expression E ON (D.documentID = E.documentID) + WHERE O.organizationID = L.organizationID + " . $whereStatement; + + } else { + if ($count) { + $select = "SELECT COUNT(DISTINCT L.licenseID) count"; + } else { + $select = "SELECT distinct L.licenseID, L.shortName licenseName, C.shortName consortiumName, O.shortName providerName, S.shortName status"; + } + //now formulate query + $query = $select . " + FROM Organization O, License L + LEFT JOIN Consortium C ON (C.consortiumID = L.consortiumID) + LEFT JOIN Status S ON (S.statusID = L.statusID) + LEFT JOIN Document D ON (D.licenseID = L.licenseID) + LEFT JOIN Expression E ON (D.documentID = E.documentID) + WHERE O.organizationID = L.organizationID + " . $whereStatement; + + } + + if ($orderBy) { + $query .= "\nORDER BY " . $orderBy; + } + + if ($limit) { + $query .= "\nLIMIT " . $limit; + } + + return $query; + } + + public function searchCount($whereAdd) { + $query = $this->searchQuery($whereAdd, '', '', true); + $result = $this->db->processQuery(stripslashes($query), 'assoc'); + return $result['count']; + } + + //returns array based on search + public function search($whereAdd, $orderBy, $limit){ + $query = $this->searchQuery($whereAdd, $orderBy, $limit); + + $result = $this->db->processQuery(stripslashes($query), 'assoc'); + + + $searchArray = array(); + $resultArray = array(); + + //need to do this since it could be that there's only one result and this is how the dbservice returns result + if (isset($result['licenseID'])){ + + foreach (array_keys($result) as $attributeName) { + $resultArray[$attributeName] = $result[$attributeName]; + } + + array_push($searchArray, $resultArray); + }else{ + foreach ($result as $row) { + $resultArray = array(); + foreach (array_keys($row) as $attributeName) { + $resultArray[$attributeName] = $row[$attributeName]; + } + array_push($searchArray, $resultArray); + } + } + + return $searchArray; + + + } + + + + + + + //returns array + public function getInProgressLicenses(){ + $config = new Configuration; + + //if the org module is installed get the org name from org database + if ($config->settings->organizationsModule == 'Y'){ + $dbName = $config->settings->organizationsDatabaseName; + + //execute query to get default licenses + $query = "SELECT L.licenseID, L.shortName licenseName, O2.name consortiumName, O.name providerName, S.shortName status + FROM " . $dbName . ".Organization O, License L + LEFT JOIN " . $dbName . ".Organization O2 ON (O2.organizationID = L.consortiumID) + LEFT JOIN Status S ON (S.statusID = L.statusID) + WHERE O.organizationID = L.organizationID + AND (S.shortName in ('Editing Expressions','Awaiting Document') OR L.statusID IS NULL) + ORDER BY L.shortName"; + }else{ + + //execute query to get default licenses + $query = "SELECT L.licenseID, L.shortName licenseName, C.shortName consortiumName, O.shortName providerName, S.shortName status + FROM Organization O, License L + LEFT JOIN Consortium C ON (C.consortiumID = L.consortiumID) + LEFT JOIN Status S ON (S.statusID = L.statusID) + WHERE O.organizationID = L.organizationID + AND (S.shortName in ('Editing Expressions','Awaiting Document') OR L.statusID IS NULL) + ORDER BY L.shortName"; + + } + + $result = $this->db->processQuery($query, 'assoc'); + + $searchArray = array(); + $resultArray = array(); + + //need to do this since it could be that there's only one result and this is how the dbservice returns result + if (isset($result['licenseID'])){ + + foreach (array_keys($result) as $attributeName) { + $resultArray[$attributeName] = $result[$attributeName]; + } + + array_push($searchArray, $resultArray); + }else{ + foreach ($result as $row) { + $resultArray = array(); + foreach (array_keys($row) as $attributeName) { + $resultArray[$attributeName] = $row[$attributeName]; + } + array_push($searchArray, $resultArray); + } + } + + return $searchArray; + } + + + + //returns array of Expressions + public function getAllDocumentsForExpressionDisplay(){ + + $query="SELECT distinct D.documentID, D.shortName documentName + FROM Document D, Expression E + WHERE E.documentID = D.documentID + AND licenseID = '" . $this->licenseID . "' AND (D.expirationDate is null or D.expirationDate ='0000-00-00') + ORDER BY documentID;"; + + $result = $this->db->processQuery($query, 'assoc'); + + $objects = array(); + + //need to do this since it could be that there's only one request and this is how the dbservice returns result + if (isset($result['documentID'])){ + $object = new Document(new NamedArguments(array('primaryKey' => $result['documentID']))); + array_push($objects, $object); + }else{ + foreach ($result as $row) { + $object = new Document(new NamedArguments(array('primaryKey' => $row['documentID']))); + array_push($objects, $object); + } + } + + return $objects; + } + + + //search used for the autocomplete + public function searchOrganizations($q){ + $config = new Configuration; + + $q = str_replace("+", " ",$q); + $q = str_replace("%", "&",$q); + + $orgArray = array(); + + //if the org module is installed get the org names from org database + if ($config->settings->organizationsModule == 'Y'){ + + $dbName = $config->settings->organizationsDatabaseName; + + + $query = "SELECT CONCAT(A.name, ' (', O.name, ')') name, O.organizationID + FROM " . $dbName . ".Alias A, " . $dbName . ".Organization O + WHERE A.organizationID=O.organizationID + AND upper(A.name) like upper('%" . $q . "%') + UNION + SELECT name, organizationID + FROM " . $dbName . ".Organization + WHERE upper(name) like upper('%" . $q . "%') + ORDER BY 1;"; + + $result = mysqli_query($this->db->getDatabase(), $query); + + while ($row = mysqli_fetch_assoc($result)){ + $orgArray[] = $row['organizationID'] . "|" . $row['name']; + } + + + //otherwise get the orgs from this database + }else{ + $query = "SELECT shortName, organizationID + FROM Organization + WHERE upper(shortName) like upper('%" . $q . "%') + ORDER BY 1;"; + + $result = mysqli_query($this->db->getDatabase(), $query); + + while ($row = mysqli_fetch_assoc($result)){ + $orgArray[] = $row['organizationID'] . "|" . $row['shortName']; + } + + + } + + + return $orgArray; + } + + + + + //search used index page drop down + public function getOrganizationList(){ + $config = new Configuration; + + $orgArray = array(); + + //if the org module is installed get the org names from org database + if ($config->settings->organizationsModule == 'Y'){ + $dbName = $config->settings->organizationsDatabaseName; + $query = "SELECT name, organizationID FROM " . $dbName . ".Organization ORDER BY 1;"; + + //otherwise get the orgs from this database + }else{ + $query = "SELECT shortName name, organizationID FROM Organization ORDER BY 1;"; + } + + + $result = $this->db->processQuery($query, 'assoc'); + + $resultArray = array(); + + //need to do this since it could be that there's only one result and this is how the dbservice returns result + if (isset($result['organizationID'])){ + + foreach (array_keys($result) as $attributeName) { + $resultArray[$attributeName] = $result[$attributeName]; + } + + array_push($orgArray, $resultArray); + }else{ + foreach ($result as $row) { + $resultArray = array(); + foreach (array_keys($row) as $attributeName) { + $resultArray[$attributeName] = $row[$attributeName]; + } + array_push($orgArray, $resultArray); + } + } + + return $orgArray; + + } + + + + //go to organizations and get the org name for this license + public function getOrganizationName(){ + $config = new Configuration; + + //if the org module is installed get the org name from org database + if ($config->settings->organizationsModule == 'Y'){ + $dbName = $config->settings->organizationsDatabaseName; + + $orgArray = array(); + $query = "SELECT name FROM " . $dbName . ".Organization WHERE organizationID = " . $this->organizationID; + + if ($result = mysqli_query($this->db->getDatabase(), $query)){ + + while ($row = mysqli_fetch_assoc($result)){ + return $row['name']; + } + } + //otherwise if the org module is not installed get the org name from this database + }else{ + $organization = new Organization(new NamedArguments(array('primaryKey' => $this->organizationID))); + return $organization->shortName; + } + } + + + + //insert the organization / provider if it doesn't already exist + public function setOrganization($orgID, $orgName){ + $config = new Configuration; + + //if the org module is installed get the org name from org database + if ($config->settings->organizationsModule == 'Y'){ + //if no org ID was passed in then we need to create a new organization shell + if (!$orgID){ + + $dbName = $config->settings->organizationsDatabaseName; + $orgName = str_replace("'", "''",$orgName); + + $query = "INSERT INTO " . $dbName . ".Organization (name, createDate, createLoginID) VALUES ('" . $orgName . "', NOW(), '" . $_SESSION['loginID'] . "')"; + + $this->organizationID = $this->db->processQuery($query); + + }else{ + $this->organizationID = $orgID; + } + + //otherwise if the org module is not installed get the org name from this database + }else{ + + //if no org ID was passed in then we need to create a new provider + if (!$orgID){ + $organization = new Organization(); + $organization->organizationID = ''; + $organization->shortName = $orgName; + $organization->save(); + + $this->organizationID = $organization->primaryKey; + }else{ + $this->organizationID = $orgID; + } + } + } + + + + + + //search used index page drop down + public function getConsortiumList(){ + $config = new Configuration; + + $consortiumArray = array(); + + //if the org module is installed get the consortia names from org database + if ($config->settings->organizationsModule == 'Y'){ + $dbName = $config->settings->organizationsDatabaseName; + $query = "SELECT name, O.organizationID consortiumID + FROM " . $dbName . ".Organization O, + " . $dbName . ".OrganizationRoleProfile ORP, + " . $dbName . ".OrganizationRole + WHERE OrganizationRole.organizationRoleID = ORP.organizationRoleID + AND ORP.organizationID = O.organizationID + AND UPPER(OrganizationRole.shortName) LIKE 'CONSORT%' + ORDER BY 1;"; + + //otherwise get the consortium from this database + }else{ + $query = "SELECT shortName name, consortiumID FROM Consortium ORDER BY 1;"; + } + + + $result = $this->db->processQuery($query, 'assoc'); + + $resultArray = array(); + + //need to do this since it could be that there's only one result and this is how the dbservice returns result + if (isset($result['consortiumID'])){ + + foreach (array_keys($result) as $attributeName) { + $resultArray[$attributeName] = $result[$attributeName]; + } + + array_push($consortiumArray, $resultArray); + }else{ + foreach ($result as $row) { + $resultArray = array(); + foreach (array_keys($row) as $attributeName) { + $resultArray[$attributeName] = $row[$attributeName]; + } + array_push($consortiumArray, $resultArray); + } + } + + return $consortiumArray; + + } + + + + //go to organizations and get the consortia name for this license + public function getConsortiumName(){ + $config = new Configuration; + + //if the org module is installed get the org name from org database + if ($config->settings->organizationsModule == 'Y'){ + $dbName = $config->settings->organizationsDatabaseName; + + $orgArray = array(); + $query = "SELECT name FROM " . $dbName . ".Organization WHERE organizationID = " . $this->consortiumID; + $result = mysqli_query($this->db->getDatabase(), $query); + + while ($row = mysqli_fetch_assoc($result)){ + return $row['name']; + } + //otherwise if the org module is not installed get the consortium name from this database + }else{ + $consortium = new Consortium(new NamedArguments(array('primaryKey' => $this->consortiumID))); + return $consortium->shortName; + } + } + + + + //used for A-Z on search (index) + public function getAlphabeticalList(){ + $alphArray = array(); + $result = mysqli_query($this->db->getDatabase(), "SELECT DISTINCT UPPER(SUBSTR(TRIM(LEADING 'The ' FROM shortName),1,1)) letter, COUNT(SUBSTR(TRIM(LEADING 'The ' FROM shortName),1,1)) letter_count + FROM License L + GROUP BY SUBSTR(TRIM(LEADING 'The ' FROM shortName),1,1) + ORDER BY 1;"); + + while ($row = mysqli_fetch_assoc($result)){ + $alphArray[$row['letter']] = $row['letter_count']; + } + + return $alphArray; + } + + +} + +?> diff --git a/admin/configuration_sample.ini b/admin/configuration_sample.ini index f50e708..ebe9b39 100644 --- a/admin/configuration_sample.ini +++ b/admin/configuration_sample.ini @@ -6,6 +6,8 @@ authDatabaseName= usageModule=N resourcesModule=N resourcesDatabaseName= +managementModule= +managementDatabaseName= useTermsToolFunctionality=N remoteAuthVariableName="_SERVER['REMOTE_USER']" diff --git a/ajax_forms.php b/ajax_forms.php index 8594d72..e6bff58 100644 --- a/ajax_forms.php +++ b/ajax_forms.php @@ -42,19 +42,19 @@
- +
- + - + - - - - + +
License





- +

+
@@ -63,7 +63,7 @@

+

There was an error processing this request - please verify configuration.ini is set up for organizations correctly and the database and tables have been created."; + echo ""._("There was an error processing this request - please verify configuration.ini is set up for organizations correctly and the database and tables have been created.").""; } ?> @@ -103,15 +103,15 @@ if (($config->settings->organizationsModule == 'N') || (!$config->settings->organizationsModule)){ ?>
- add consortium +
@@ -161,17 +161,17 @@ - + - + - + @@ -200,7 +200,7 @@ - + - + - + - + - - + +
Document Upload








- add document type +


" . $document->documentURL . "
replace with new file"; + echo "
" . $document->documentURL . "
"._("replace with new file").""; echo "
"; //if adding @@ -260,15 +260,15 @@ parentDocumentID == "0") || ($document->parentDocumentID == "")){ ?>
/>
                                
@@ -294,15 +294,15 @@
- + - +
Archive Document Date



- Archive Date: +


Continue


@@ -332,12 +332,12 @@ - + - + - - + +
Terms Tool Resource Link




+

-
+
@@ -395,17 +396,17 @@ ?>
- +
- +
Signatures

- - - + + + @@ -440,7 +441,7 @@ echo ""; echo ""; - echo ""; + echo ""; echo ""; echo ""; @@ -453,8 +454,8 @@ echo ""; echo ""; }else{ - echo ""; - echo ""; + echo ""; + echo ""; } } @@ -476,7 +477,7 @@ } echo ""; - echo ""; + echo ""; echo ""; echo ""; } @@ -486,7 +487,7 @@
Signer NameDateType    
commit update"._("commit update")."   editremove"._("edit").""._("remove")."add"._("add")." 
-

Close +

@@ -542,12 +543,12 @@ - + - - > - > + - +
Expressions




+


+

   - add expression type + type

+

@@ -631,12 +632,12 @@ - + - - + +


@@ -669,8 +670,8 @@ - @@ -680,7 +681,7 @@
Notes
- For Document Text:
+

+


- + @@ -701,7 +702,7 @@ echo ""; echo ""; - echo ""; + echo ""; echo ""; echo ""; echo ""; @@ -716,15 +717,15 @@ }else{ //calculate which arrows to show for reordering if ($rowNumber == "1"){ - echo ""; + echo ""; }else if($rowNumber == $rowCount){ - echo ""; + echo ""; }else{ - echo ""; + echo ""; } echo ""; - echo ""; - echo ""; + echo ""; + echo ""; } } @@ -739,7 +740,7 @@ echo ""; echo ""; echo ""; - echo ""; + echo ""; echo ""; echo ""; } @@ -749,7 +750,7 @@
  Notes    
 commit update"._("commit update")."   " . nl2br($expressionNote->note) . "editremove"._("edit").""._("remove")."
 add"._("add")." 


; return false'>Close


; return false' class='cancel-button'>
'> @@ -785,24 +786,24 @@ '> - + - - + - - - + +
Attachments




+



+
getAttachmentFiles() as $attachmentFile){ - echo "
" . $attachmentFile->attachmentURL . " remove
"; + echo "
" . $attachmentFile->attachmentURL . " "._("remove")."
"; } echo "

"; @@ -827,8 +828,8 @@
@@ -856,19 +857,19 @@
- + - +

Update



shortName . "' style='width:190px;'/>update"; + echo ""._("update").""; ?>

close

@@ -897,10 +898,10 @@ if (isset($_GET['loginID'])) $loginID = $_GET['loginID']; else $loginID = ''; if ($loginID != ''){ - $update='Update'; + $update=_('Update'); $updateUser = new User(new NamedArguments(array('primaryKey' => $loginID))); }else{ - $update='Add New'; + $update=_('Add New'); } $util = new Utility(); @@ -908,17 +909,17 @@ ?>
- - - - - + + + + + + @@ -960,8 +961,8 @@
"; }?> - - + +
User



- +
"._("Admin users have access to the Admin page and the SFX tab.")."

"._("Restricted users do not have the ability to view documents")."

"._("View only users can view all license information, including the license pdf");?>" href="">
- +
@@ -947,10 +948,10 @@ //if not configured to use SFX, hide the Terms Tool Report if ($util->useTermsTool()) { ?> -
- +
"._("Leave this field blank if the user shouldn't receive emails.");?>" href="">
            " onclick="window.parent.tb_remove(); return false" id='update-user-cancel' class='cancel-button'>
@@ -980,10 +981,10 @@ if (isset($_GET['expressionTypeID'])) $expressionTypeID = $_GET['expressionTypeID']; else $expressionTypeID = ''; if ($expressionTypeID){ - $update='Update'; + $update=_('Update'); $expressionType = new ExpressionType(new NamedArguments(array('primaryKey' => $expressionTypeID))); }else{ - $update='Add New'; + $update=_('Add New'); } @@ -991,23 +992,23 @@
- - - + + + - + - - + +
Expression Type



* Note type of display allows for terms tool use
*
@@ -1022,7 +1023,7 @@ if (isset($_GET['calendarSettingsID'])) $calendarSettingsID = $_GET['calendarSettingsID']; else $calendarSettingsID = ''; if ($calendarSettingsID){ - $update='Edit'; + $update=_('Edit'); $calendarSettings = new CalendarSettings(new NamedArguments(array('primaryKey' => $calendarSettingsID))); } @@ -1031,15 +1032,15 @@
- + shortName) == strtolower('Resource Type(s)')) { ?> - + - + + - + - + + @@ -1114,8 +1115,8 @@ - - + +
Calendar Settings



shortName; ?>
shortName; ?>
@@ -1066,10 +1067,10 @@ shortName) == strtolower('Authorized Site(s)')) { ?> -
shortName; ?>
shortName; ?>
shortName; ?>
shortName; ?>
@@ -1131,10 +1132,10 @@ if (isset($_GET['qualifierID'])) $qualifierID = $_GET['qualifierID']; else $qualifierID = ''; if ($qualifierID){ - $update='Update'; + $update=_('Update'); $qualifier = new Qualifier(new NamedArguments(array('primaryKey' => $qualifierID))); }else{ - $update='Add New'; + $update=_('Add New'); } @@ -1142,9 +1143,9 @@
- + - + - + - - + +
Qualifier



@@ -1192,7 +1193,7 @@ default: - echo "Action " . $action . " not set up!"; + echo _("Action ") . $action . _(" not set up!"); break; diff --git a/ajax_htmldata.php b/ajax_htmldata.php index ec8d737..5e9b3f8 100644 --- a/ajax_htmldata.php +++ b/ajax_htmldata.php @@ -41,16 +41,16 @@ ?> -
+
shortName; ?> canEdit()){?> - edit license | remove license + | "; + echo "
"; //make sure they have org module installed before we give them a link to view the organization $config = new Configuration; @@ -58,7 +58,7 @@ if ($config->settings->organizationsModule == 'Y'){ $util = new Utility(); - echo $license->getOrganizationName() . " edit organization"; + echo $license->getOrganizationName() . " "._("edit organization").""; if ($license->consortiumID) { echo "
" . $license->getConsortiumName(); @@ -75,7 +75,7 @@
canEdit()){ ?> - License Status:
+
- - + + @@ -138,8 +138,8 @@ echo ""; echo ""; echo ""; - echo ""; - echo ""; + echo ""; + echo ""; echo ""; } @@ -152,11 +152,11 @@ canEdit()){ - echo "

add new terms tool resource link"; + echo "

"._("add new terms tool resource link").""; } break; @@ -179,8 +179,8 @@
For DocumentResource    
" . $document->shortName . "" . $sfxProvider->shortName . "editremove"._("edit").""._("remove")."
- - + + canEdit()){ ?> @@ -203,12 +203,12 @@ echo ""; @@ -220,18 +220,18 @@ if (count($attachmentFileArray) == 0){ - echo "(none uploaded)
"; + echo _("(none uploaded)")."
"; } $i=1; foreach($attachmentFileArray as $attachmentFile) { - echo "view attachment " . $i . "
"; + echo ""._("view attachment ") . $i . "
"; $i++; } echo ""; if ($user->canEdit()){ - echo ""; + echo ""; } echo ""; @@ -242,11 +242,11 @@
DateDetails    
" . substr($attachmentText, 0,200); if (strlen($attachmentText) > 200){ - echo "...  more..."; + echo "...  "._("more...").""; } echo "
"; echo ""; echo "
edit  remove"._("edit")."  "._("remove")."
canEdit()){ - echo "

add new attachment"; + echo "

"._("add new attachment").""; } break; @@ -319,21 +319,22 @@ $licenseArray = $licenseObj->search($whereAdd, $orderBy, $limit); $pagination = ''; if ($totalRecords == 0){ - echo "

Sorry, no licenses fit your query"; + echo "

"._("Sorry, no licenses fit your query").""; $i=0; }else{ //maximum number of pages to display on screen at one time $maxDisplay = 25; $thisPageNum = count($licenseArray) + $pageStart - 1; - echo "Displaying " . $pageStart . " to " . $thisPageNum . " of " . $totalRecords . " License Records
"; + echo ""._("Displaying ") . $pageStart . _(" to ") . $thisPageNum . _(" of ") . $totalRecords . _(" License Records")."
"; //print out page selectors if ($totalRecords > $numberOfRecords){ + echo "
"; if ($pageStart == "1"){ - $pagination .= "<< "; + $pagination .= " "; }else{ - $pagination .= "<< "; + $pagination .= " "; } $page = floor($pageStart/$numberOfRecords) + 1; //now determine the starting page - we will display 3 prior to the currently selected page @@ -360,28 +361,29 @@ if ($pageStart == $nextPageStarts){ $pagination .= "" . $i . " "; }else{ - $pagination .= "" . $i . " "; + $pagination .= "" . $i . " "; } } if ($pageStart == $nextPageStarts){ - $pagination .= ">> "; + $pagination .= " "; }else{ - $pagination .= ">> "; + $pagination .= " "; } echo $pagination; + echo "
"; } else { - echo "
"; + echo "
"; } ?> - +
- - - - + + + + - -
Name 
Publisher / Provider 
Consortium 
Status 
 
 
 
 
+ + - records per page +
@@ -458,10 +460,10 @@ ?> - - - - + + + + There was an error processing this request - please verify configuration.ini is set up for organizations correctly and the database and tables have been created."; + echo ""._("There was an error processing this request - please verify configuration.ini is set up for organizations correctly and the database and tables have been created.").""; } break; @@ -525,24 +527,24 @@ foreach($etArray as $expressionTypeArray){ - echo "
"; - echo "\n
NamePublisher / ProviderConsortiumStatus
"; + echo "
"; + echo "\n
" . $expressionTypeArray['document'] . "
"; if ($user->canEdit()){ - echo "\n
" . $expressionTypeArray['document'] . "view / edit license  view / edit " . strtolower($expressionType->noteType) . " notes  view document
"; + echo "\n
"._("view / edit license")."  "._("view / edit ") . strtolower($expressionType->noteType) . _(" notes")."  "._("view document")."
"; }else{ - echo "\nview license  view document"; + echo "\n"._("view license")."  "._("view document").""; } - echo "
"; + echo "
"; if ($expressionTypeArray['documentText']){ - echo "Document Text:
" . nl2br($expressionTypeArray['documentText']) . "
"; + echo ""._("Document Text:")."

" . nl2br($expressionTypeArray['documentText']) . "
"; } - $expr_notes = "
" . ucfirst($expressionTypeArray['noteType']) . " Notes: "; + $expr_notes = "
" . ucfirst($expressionTypeArray['noteType']) . _(" Notes:")." "; $expression = new Expression(new NamedArguments(array('primaryKey' => $expressionTypeArray['expressionID']))); $expressionNotes = $expression->getExpressionNotes(); @@ -568,7 +570,7 @@ if ($expressionTypeArray['qualifiers']){ - echo "
Qualifiers:
" . $expressionTypeArray['qualifiers']; + echo "
"._("Qualifiers:")."
" . $expressionTypeArray['qualifiers']; } echo "
"; @@ -625,21 +627,21 @@ ?> - License - noteType); ?> Notes - Document Text + + noteType); ?> + " . $expressionTypeArray['document'] . " view license"; + echo "\n" . $expressionTypeArray['document'] . " "._("view license").""; if ($expressionTypeArray['documentText']){ $documentText = $expressionTypeArray['documentText']; }else{ - $documentText = "(document text not entered)"; + $documentText = _("(document text not entered)"); } echo "\n"; @@ -647,7 +649,7 @@ echo ""; - $expr_notes = ucfirst($expressionTypeArray['noteType']) . " Notes:
    "; + $expr_notes = ucfirst($expressionTypeArray['noteType']) . _(" Notes:")."
      "; $expression = new Expression(new NamedArguments(array('primaryKey' => $expressionTypeArray['expressionID']))); $expressionNotes = $expression->getExpressionNotes(); @@ -670,12 +672,12 @@ echo "
      " . substr($documentText, 0,200); if (strlen($documentText) > 200){ - echo "...  more..."; + echo "...  "._("more...").""; } echo "
      "; echo ""; @@ -687,7 +689,7 @@ #end numrows if }else{ - echo "(none for " . $expressionTypeArray['shortName'] . ")"; + echo ""._("(none for ") . $expressionTypeArray['shortName'] . ")"; } echo ""; @@ -737,7 +739,7 @@ }else if ($displayArchiveInd == '1'){ $documentArray = $license->getArchivedDocumentsWithoutParents($parentArchivedOrderBy); if (count($documentArray) > 0){ - echo "Archived Documents hide archives"; + echo ""._("Archived Documents")." "._("hide archives").""; } $chJSFunction = "setChildArchivedOrder"; @@ -765,15 +767,15 @@ -
      Name.gif' border=0> .gif' border=0>
      -
      Type.gif' border=0> .gif' border=0>
      -
      Effective Date.gif' border=0> .gif' border=0>
      -
      Signatures.gif' border=0> .gif' border=0>
      +
      .png' border=0> .png' border=0>
      +
      .png' border=0> .png' border=0>
      +
      .png' border=0> .png' border=0>
      +
      .png' border=0> .png' border=0>
      -
      Name.gif' border=0> .gif' border=0>
      -
      Type.gif' border=0> .gif' border=0>
      -
      Effective Date.gif' border=0> .gif' border=0>
      -
      Signatures.gif' border=0> .gif' border=0>
      +
      .png' border=0> .png' border=0>
      +
      .png' border=0> .png' border=0>
      +
      .png' border=0> .png' border=0>
      +
      .png' border=0> .png' border=0>
      @@ -808,7 +810,7 @@ } if (($document->expirationDate != "0000-00-00") && ($document->expirationDate != "")){ - $displayExpirationDate = 'archived on: ' . format_date($document->expirationDate); + $displayExpirationDate = _("archived on: ") . format_date($document->expirationDate); }else{ $displayExpirationDate = ''; } @@ -831,7 +833,7 @@ if (($signature['signatureDate'] != '') && ($signature['signatureDate'] != "0000-00-00")) { $signatureDate = format_date($signature['signatureDate']); }else{ - $signatureDate='(no date)'; + $signatureDate=_("(no date)"); } echo ""; @@ -842,14 +844,14 @@ } echo ""; if ($user->canEdit()){ - echo "add/view details"; + echo ""._("add/view details").""; } }else{ - echo "(none found)
      "; + echo _("(none found)")."
      "; if ($user->canEdit()){ - echo "add signatures"; + echo ""._("add signatures").""; } } @@ -858,20 +860,20 @@ echo ""; if (!$user->isRestricted()) { if ($document->documentURL != ""){ - echo "view document
      "; + echo ""._("view document")."
      "; }else{ - echo "(none uploaded)
      "; + echo _("(none uploaded)")."
      "; } } if (count($document->getExpressions) > 0){ - echo "view expressions"; + echo ""._("view expressions").""; } echo ""; if ($user->canEdit()){ - echo "edit document
      remove document"; + echo ""._("edit document")."
      "._("remove document").""; echo "
      " . $displayExpirationDate . ""; } echo ""; @@ -881,29 +883,29 @@ //if display for this child is turned off if ((($showChildrenDocumentID) && ($showChildrenDocumentID != $document->documentID)) || !($showChildrenDocumentID)) { if ($displayArchiveInd == '1') { - echo "This document has " . $numberOfChildren . " children document(s) not displayed. show all documents for this parent"; + echo ""._("This document has ") . $numberOfChildren . _(" children document(s) not displayed.")." "._("show all documents for this parent").""; }else{ - echo "This document has " . $numberOfChildren . " children document(s) not displayed. show all documents for this parent"; + echo ""._("This document has ") . $numberOfChildren . _(" children document(s) not displayed.")." "._("show all documents for this parent").""; } }else{ if ($displayArchiveInd == '1') { - echo "The following " . $numberOfChildren . " document(s) belong to " . $document->shortName . ". hide children documents for this parent"; + echo ""._("The following ") . $numberOfChildren . _(" document(s) belong to ") . $document->shortName . ". "._("hide children documents for this parent").""; }else{ - echo "The following " . $numberOfChildren . " document(s) belong to " . $document->shortName . ". hide children documents for this parent"; + echo ""._("The following ") . $numberOfChildren . _(" document(s) belong to ") . $document->shortName . ". "._("hide children documents for this parent").""; } ?> -
      Name.gif' border=0> .gif' border=0>
      -
      Type.gif' border=0> .gif' border=0>
      -
      Effective Date.gif' border=0> .gif' border=0>
      -
      Signatures.gif' border=0> .gif' border=0>
      +
      .gif' border=0> .gif' border=0>
      +
      .gif' border=0> .gif' border=0>
      +
      .gif' border=0> .gif' border=0>
      +
      .gif' border=0> .gif' border=0>
      -
      Name.gif' border=0> .gif' border=0>
      -
      Type.gif' border=0> .gif' border=0>
      -
      Effective Date.gif' border=0> .gif' border=0>
      -
      Signatures.gif' border=0> .gif' border=0>
      +
      .gif' border=0> .gif' border=0>
      +
      .gif' border=0> .gif' border=0>
      +
      .gif' border=0> .gif' border=0>
      +
      .gif' border=0> .gif' border=0>
        canEdit()){ ?> @@ -926,9 +928,9 @@ } if ((($childDocument->expirationDate == "0000-00-00") || ($childDocument->expirationDate == "")) && ($user->canEdit())){ - $displayExpirationDate = "archive document"; + $displayExpirationDate = ""._("archive document").""; }else{ - $displayExpirationDate = 'archived on: ' . format_date($childDocument->expirationDate); + $displayExpirationDate = _("archived on: ") . format_date($childDocument->expirationDate); } @@ -949,7 +951,7 @@ if (($signature['signatureDate'] != '') && ($signature['signatureDate'] != "0000-00-00")) { $signatureDate = format_date($signature['signatureDate']); }else{ - $signatureDate='(no date)'; + $signatureDate=_("(no date)"); } echo ""; @@ -960,14 +962,14 @@ } echo ""; if ($user->canEdit()){ - echo "add/view details"; + echo ""._("add/view details").""; } }else{ - echo "(none found)
      "; + echo _("(none found)")."
      "; if ($user->canEdit()){ - echo "add signatures"; + echo ""._("add signatures").""; } } @@ -976,19 +978,19 @@ echo ""; if (!$user->isRestricted) { if ($childDocument->documentURL != ""){ - echo "view document
      "; + echo ""._("view document")."
      "; }else{ - echo "(none uploaded)
      "; + echo _("(none uploaded)")."
      "; } } if (count($childDocument->getExpressions) > 0){ - echo "view expressions"; + echo ""._("view expressions").""; } echo ""; if ($user->canEdit()){ - echo "edit document
      remove document"; + echo ""._("edit document")."
      "._("remove document").""; //echo "
      " . $displayExpirationDate . ""; } echo ""; @@ -997,9 +999,9 @@ if ($numberOfChildren > 0){ if ($displayArchiveInd == '1') { - echo "The following " . $numberOfChildren . " document(s) belong to " . $childDocument->shortName . "."; + echo ""._("The following ") . $numberOfChildren . _(" document(s) belong to ") . $childDocument->shortName . "."; }else{ - echo "The following " . $numberOfChildren . " document(s) belong to " . $childDocument->shortName . "."; + echo ""._("The following ") . $numberOfChildren . _(" document(s) belong to ") . $childDocument->shortName . "."; } } @@ -1022,17 +1024,17 @@ " . $numRows . " archive(s) available. show archives

      "; + echo "" . $numRows . _(" archive(s) available.")." "._("show archives")."

      "; } } if (($user->canEdit()) && ($displayArchiveInd != "")){ - echo "upload new document"; + echo ""._("upload new document").""; } @@ -1074,14 +1076,14 @@ ?> - For Document: shortName; ?> + shortName; ?> - - + + canEdit()){ ?> - + @@ -1120,7 +1122,7 @@ } }else{ if ($expressionIns['productionUseInd'] == "1"){ - echo "

      used in terms tool"; + echo "

      "._("used in terms tool").""; } } @@ -1145,14 +1147,14 @@ echo ""; - echo ""; + echo ""; } echo ""; if ($user->canEdit()){ - echo ""; echo ""; @@ -1191,11 +1193,11 @@ } }else{ - echo "(none found)"; + echo _("(none found)"); } if ($user->canEdit()){ - echo "

      add new expression"; + echo "

      "._("add new expression").""; } @@ -1224,8 +1226,8 @@ foreach($resultArray as $result){ echo ""; echo ""; - echo ""; - echo ""; + echo ""; + echo ""; echo ""; } @@ -1234,7 +1236,7 @@
      TypeDocument Text Qualifier  
      edit  remove"._("edit")."  "._("remove")."
       " . ucfirst($expressionIns['noteType']) . " Notes:
        "; + echo "
       " . ucfirst($expressionIns['noteType']) . _(" Notes:")."
        "; }else{ - echo "
       " . ucfirst($expressionIns['noteType']) . " Notes:
        "; + echo "
       " . ucfirst($expressionIns['noteType']) . _(" Notes:")."
        "; } $expressionNoteArray = $expression->getExpressionNotes(); @@ -1165,13 +1167,13 @@ $rowcount++; } - if ($rowcount == "0"){ echo "(none)"; } + if ($rowcount == "0"){ echo _("(none)"); } echo "
      "; //link to view/edit display notes if ($user->canEdit()){ - echo "add/view " . lcfirst($expressionIns['noteType']) . " notes"; + echo ""._("add/view ") . lcfirst($expressionIns['noteType']) . _(" notes").""; } echo "
      " . $result['shortName'] . "editremove"._("edit").""._("remove")."
      - - - - + + + useTermsTool()){ - echo ""; + echo ""; } ?> @@ -1281,8 +1283,8 @@ if ($util->useTermsTool()){ echo ""; } - echo ""; - echo ""; + echo ""; + echo ""; echo ""; } @@ -1291,7 +1293,7 @@
      Login IDFirst NameLast NamePrivilege + Terms Tool Update Email"._("Terms Tool Update Email")." " . $instance['emailAddressForTermsTool'] . "updateremove"._("update").""._("remove")."
      - - + + "; echo ""; echo ""; - echo ""; - echo ""; + echo ""; + echo ""; echo ""; } @@ -1339,7 +1341,7 @@
      Expression TypeNote Type     " . $instance['shortName'] . "" . $instance['noteType'] . "updateremove"._("update").""._("remove")."
      - - + + "; - echo ""; + echo ""; echo ""; } @@ -1416,7 +1418,7 @@
      SettingValue   edit"._("edit")."
      - - + + "; echo ""; echo ""; - echo ""; - echo ""; + echo ""; + echo ""; echo ""; $i++; } @@ -1483,10 +1485,10 @@ $qualifierArray = $expressionType->getQualifiers(); if (count($qualifierArray) > 0 ) { - if (!isset($_GET['page'])) echo "Limit by Qualifier:"; + if (!isset($_GET['page'])) echo ""._("Limit by Qualifier:").""; ?> - +
      For Expression TypeQualifier     " . $displayET . "" . $qualifier->shortName . "updateremove"._("update").""._("remove")."


      Continue

      @@ -511,10 +511,10 @@ ?> - + - +

      SQL Insert Failed. getMessage(); ?> Please make sure everything is filled out correctly.

      getMessage(); ?>

      Continue

      @@ -524,10 +524,10 @@ ?> - + - +

      SQL Insert Failed. getMessage(); ?> Please make sure everything is filled out correctly.

      getMessage(); ?>

      Continue

      @@ -769,13 +769,13 @@ if ($numberOfChildren > 0){ //print out a friendly message... - echo "Unable to delete - this " . strtolower(preg_replace("/[A-Z]/", " \\0" , lcfirst($className))) . " is in use. Please make sure no licenses are set up with this information."; + echo _("Unable to delete - this ") . strtolower(preg_replace("/[A-Z]/", " \\0" , lcfirst($className))) . _(" is in use. Please make sure no licenses are set up with this information."); }else{ try { $instance->delete(); } catch (Exception $e) { //print out a friendly message... - echo "Unable to delete. Please make sure no licenses are set up with this information."; + echo _("Unable to delete. Please make sure no licenses are set up with this information."); } } echo ""; @@ -954,10 +954,10 @@ //set to web rwx, everyone else rw //this way we can edit the document directly on the server chmod ($target_path, 0766); - echo "success uploading!"; + echo _("success uploading!"); }else{ header('HTTP/1.1 500 Internal Server Error'); - echo "
      There was a problem saving your file to $target_path.
      "; + echo "
      "._("There was a problem saving your file to")." $target_path.
      "; } } @@ -1024,7 +1024,7 @@ try { $attachment->delete(); - echo "Attachment successfully deleted"; + echo _("Attachment successfully deleted"); } catch (Exception $e) { echo $e->getMessage(); } @@ -1038,7 +1038,7 @@ try { $attachmentFile->delete(); - echo "Attachment file successfully deleted"; + echo _("Attachment file successfully deleted"); } catch (Exception $e) { echo $e->getMessage(); } @@ -1059,7 +1059,7 @@ try { $license->save(); - echo "Status has been updated"; + echo _("Status has been updated"); } catch (Exception $e) { echo $e->getMessage(); } @@ -1169,7 +1169,7 @@ break; default: - echo "Action " . $action . " not set up!"; + echo _("Action ") . $action . _(" not set up!"); break; @@ -1177,4 +1177,4 @@ -?> \ No newline at end of file +?> diff --git a/calendar.php b/calendar.php index 7e3dc78..6e6d4de 100644 --- a/calendar.php +++ b/calendar.php @@ -1,272 +1,272 @@ -. -** -************************************************************************************************************************** -** This page was originally intended as a standalone add-on. After interest this was added to the Licensing module -** but it was not retrofitted to more tightly integrate into the Licensing module. -*/ -include_once 'directory.php'; -$pageTitle='Home'; -include 'templates/header.php'; -//used for creating a "sticky form" for back buttons -//except we don't want it to retain if they press the 'index' button -//check what referring script is - if (isset($_SESSION['ref_script']) && ($_SESSION['ref_script'] != "license.php")){ - $reset='Y'; - }else{ - $reset='N'; - } -$_SESSION['ref_script']=$currentPage; -//below includes search options in left pane only - the results are refreshed through ajax and placed in div searchResults -//print header -$pageTitle='Calendar'; -$config = new Configuration; -$host = $config->database->host; -$username = $config->database->username; -$password = $config->database->password; -$license_databaseName = $config->database->name; -$resource_databaseName = $config->settings->resourcesDatabaseName; -$link = mysqli_connect($host, $username, $password) or die("Could not connect to host."); -mysqli_select_db($link, $license_databaseName) or die("Could not find License database."); -mysqli_select_db($link, $resource_databaseName) or die("Could not find Resource database."); -$display = array(); -$calendarSettings = new CalendarSettings(); -try{ - $calendarSettingsArray = $calendarSettings->allAsArray(); -}catch(Exception $e){ - echo "There was an error with the CalendarSettings Table please verify the table has been created."; - exit; -} -// Check for earlier version of Resource Module. With update of 1.3 the table definition changed. -$query = "Select subscriptionStartDate from `$resource_databaseName`.`Resource`"; -$result = mysqli_query($link, $query); - if ($result) { - // Previous tabel definition before Resources version 1.3 - $startDateName = "subscriptionStartDate"; - $endDateName = "subscriptionEndDate"; - } else { - $startDateName = "currentStartDate"; - $endDateName = "currentEndDate"; - } - foreach($calendarSettingsArray as $display) { - $config_error = TRUE; - if (strtolower($display['shortName']) == strtolower('Days After Subscription End')) { - if (strlen($display['value'])>0) { - $daybefore = $display['value']; - $config_error = FALSE; - } - } elseif (strtolower($display['shortName']) == strtolower('Days Before Subscription End')) { - if (strlen($display['value'])>0) { - $dayafter = $display['value']; - $config_error = FALSE; - } - } elseif (strtolower($display['shortName']) == strtolower('Resource Type(s)')) { - if (strlen($display['value'])>0) { - $resourceType = $display['value']; - $config_error = FALSE; - } - } elseif (strtolower($display['shortName']) == strtolower('Authorized Site(s)')) { - if (strlen($display['value'])>0) { - $authorizedSiteID = preg_split("/[\s,]+/", $display['value']); - $config_error = FALSE; - } - } - } - - // Validate the config settings - if ($config_error) { - echo "There was an error with the CalendarSettings Configuration."; - exit; - } - - $query = " - SELECT DATE_FORMAT(`$resource_databaseName`.`Resource`.`$endDateName`, '%Y') AS `year`, - DATE_FORMAT(`$resource_databaseName`.`Resource`.`$endDateName`, '%M') AS `month`, - DATE_FORMAT(`$resource_databaseName`.`Resource`.`$endDateName`, '%y-%m-%d') AS `sortdate`, - DATE_FORMAT(`$resource_databaseName`.`Resource`.`$endDateName`, '%m/%d/%Y') AS `$endDateName`, - `$resource_databaseName`.`Resource`.`resourceID`, `$resource_databaseName`.`Resource`.`titleText`, - `$license_databaseName`.`License`.`shortName`, - `$license_databaseName`.`License`.`licenseID`, `$resource_databaseName`.`ResourceType`.`shortName` AS resourceTypeName, `$resource_databaseName`.`ResourceType`.`resourceTypeID` - FROM `$resource_databaseName`.`Resource` - LEFT JOIN `$resource_databaseName`.`ResourceLicenseLink` ON (`$resource_databaseName`.`Resource`.`resourceID` = `$resource_databaseName`.`ResourceLicenseLink`.`resourceID`) - LEFT JOIN `$license_databaseName`.`License` ON (`ResourceLicenseLink`.`licenseID` = `$license_databaseName`.`License`.`licenseID`) - INNER JOIN `$resource_databaseName`.`ResourceType` ON (`$resource_databaseName`.`Resource`.`resourceTypeID` = `$resource_databaseName`.`ResourceType`.`resourceTypeID`) - WHERE - `$resource_databaseName`.`Resource`.`archiveDate` IS NULL AND - `$resource_databaseName`.`Resource`.`$endDateName` IS NOT NULL AND - `$resource_databaseName`.`Resource`.`$endDateName` <> '00/00/0000' AND - `$resource_databaseName`.`Resource`.`$endDateName` BETWEEN (CURDATE() - INTERVAL " . $daybefore . " DAY) AND (CURDATE() + INTERVAL " . $dayafter . " DAY) "; - if ($resourceType) { - $query = $query . " AND `$resource_databaseName`.`Resource`.`resourceTypeID` IN ( ". $resourceType . " ) "; - } -$query = $query . "ORDER BY `sortdate`, `$resource_databaseName`.`Resource`.`titleText`"; -$result = mysqli_query($link, $query) or die("Bad Query Failure"); -?> - -
      - - - - -
      - Upcoming License Renewals -
      - -
      - - - "; - $year_html = $year_html . ""; - $year_html = $year_html . ""; - $displayYear = TRUE; - } - - if ($mMonth != $row["month"]) { - $mMonth = $row["month"]; - - $month_html = ""; - $month_html = $month_html . ""; - $month_html = $month_html . ""; - $month_html = $month_html . ""; - $displayMonth = TRUE; - } - - $html = $html . ""; - - if ($i % 2 == 0) { - $alt = "alt"; - } else { - $alt = ""; - } - $date1 = new DateTime(date("m/d/y")); - $date2 = new DateTime($row["currentEndDate"]); - $interval = $date1->diff($date2); - $num_days = ((($interval->y) * 365) + (($interval->m) * 30) + ($interval->d)); - - $html = $html . ""; - $html = $html . " - - "; - $html = $html . ""; - - if (count($arr3) > 0) { - if ($displayYear) { - echo $year_html; - $displayYear = FALSE; - } - if ($displayMonth) { - echo $month_html; - $displayMonth = FALSE; - } - echo $html; - } - - } - - ?> - -
      - - - - - - -
      " . $mYear . "
      -
      - - - - - - -
         " . $mMonth . "
      -
      "; - - $html = $html . "      ". $row["titleText"] . ""; - $html = $html . "  [License: "; - if (is_null($row["licenseID"])) { - $html = $html . "No associated licenses available."; - } else { - $html = $html . "". $row["shortName"] . ""; - } - $html = $html . " ] - " . $row["resourceTypeName"] . " "; - if ($interval->invert) { - $html = $html . "- Expired $num_days days ago"; - } else { - $html = $html . "- Expires in "; - - if ($date1 > $date2) { - $html = $html . "(" . $num_days . " days)"; ; - } else { - $html = $html . $num_days . " days "; ; - } - } - $k = 0; - $siteID = array(); - - while ($row2 = mysqli_fetch_assoc($result2)) { - if ($k == 0) { - $html = $html . "
            Participants: "; - } else { - $html = $html . ", "; - } - - $html = $html . $row2["shortName"]; - array_push( $siteID, $row2["authorizedSiteID"] ); - $k = $k + 1; - } - - $arr3 = array_intersect($authorizedSiteID, $siteID); - $html = $html . "
      -
      -
      -
      - - +. +** +************************************************************************************************************************** +** This page was originally intended as a standalone add-on. After interest this was added to the Licensing module +** but it was not retrofitted to more tightly integrate into the Licensing module. +*/ +include_once 'directory.php'; +$pageTitle=_('Home'); +include 'templates/header.php'; +//used for creating a "sticky form" for back buttons +//except we don't want it to retain if they press the 'index' button +//check what referring script is + if (isset($_SESSION['ref_script']) && ($_SESSION['ref_script'] != "license.php")){ + $reset='Y'; + }else{ + $reset='N'; + } +$_SESSION['ref_script']=$currentPage; +//below includes search options in left pane only - the results are refreshed through ajax and placed in div searchResults +//print header +$pageTitle=_('Calendar'); +$config = new Configuration; +$host = $config->database->host; +$username = $config->database->username; +$password = $config->database->password; +$license_databaseName = $config->database->name; +$resource_databaseName = $config->settings->resourcesDatabaseName; +$link = mysqli_connect($host, $username, $password) or die(_("Could not connect to host.")); +mysqli_select_db($link, $license_databaseName) or die(_("Could not find License database.")); +mysqli_select_db($link, $resource_databaseName) or die(_("Could not find Resource database.")); +$display = array(); +$calendarSettings = new CalendarSettings(); +try{ + $calendarSettingsArray = $calendarSettings->allAsArray(); +}catch(Exception $e){ + echo ""._("There was an error with the CalendarSettings Table please verify the table has been created.").""; + exit; +} +// Check for earlier version of Resource Module. With update of 1.3 the table definition changed. +$query = "Select subscriptionStartDate from `$resource_databaseName`.`Resource`"; +$result = mysqli_query($link, $query); + if ($result) { + // Previous tabel definition before Resources version 1.3 + $startDateName = "subscriptionStartDate"; + $endDateName = "subscriptionEndDate"; + } else { + $startDateName = "currentStartDate"; + $endDateName = "currentEndDate"; + } + foreach($calendarSettingsArray as $display) { + $config_error = TRUE; + if (strtolower($display['shortName']) == strtolower('Days After Subscription End')) { + if (strlen($display['value'])>0) { + $daybefore = $display['value']; + $config_error = FALSE; + } + } elseif (strtolower($display['shortName']) == strtolower('Days Before Subscription End')) { + if (strlen($display['value'])>0) { + $dayafter = $display['value']; + $config_error = FALSE; + } + } elseif (strtolower($display['shortName']) == strtolower('Resource Type(s)')) { + if (strlen($display['value'])>0) { + $resourceType = $display['value']; + $config_error = FALSE; + } + } elseif (strtolower($display['shortName']) == strtolower('Authorized Site(s)')) { + if (strlen($display['value'])>0) { + $authorizedSiteID = preg_split("/[\s,]+/", $display['value']); + $config_error = FALSE; + } + } + } + + // Validate the config settings + if ($config_error) { + echo ""._("There was an error with the CalendarSettings Configuration.").""; + exit; + } + + $query = " + SELECT DATE_FORMAT(`$resource_databaseName`.`Resource`.`$endDateName`, '%Y') AS `year`, + DATE_FORMAT(`$resource_databaseName`.`Resource`.`$endDateName`, '%M') AS `month`, + DATE_FORMAT(`$resource_databaseName`.`Resource`.`$endDateName`, '%y-%m-%d') AS `sortdate`, + DATE_FORMAT(`$resource_databaseName`.`Resource`.`$endDateName`, '%m/%d/%Y') AS `$endDateName`, + `$resource_databaseName`.`Resource`.`resourceID`, `$resource_databaseName`.`Resource`.`titleText`, + `$license_databaseName`.`License`.`shortName`, + `$license_databaseName`.`License`.`licenseID`, `$resource_databaseName`.`ResourceType`.`shortName` AS resourceTypeName, `$resource_databaseName`.`ResourceType`.`resourceTypeID` + FROM `$resource_databaseName`.`Resource` + LEFT JOIN `$resource_databaseName`.`ResourceLicenseLink` ON (`$resource_databaseName`.`Resource`.`resourceID` = `$resource_databaseName`.`ResourceLicenseLink`.`resourceID`) + LEFT JOIN `$license_databaseName`.`License` ON (`ResourceLicenseLink`.`licenseID` = `$license_databaseName`.`License`.`licenseID`) + INNER JOIN `$resource_databaseName`.`ResourceType` ON (`$resource_databaseName`.`Resource`.`resourceTypeID` = `$resource_databaseName`.`ResourceType`.`resourceTypeID`) + WHERE + `$resource_databaseName`.`Resource`.`archiveDate` IS NULL AND + `$resource_databaseName`.`Resource`.`$endDateName` IS NOT NULL AND + `$resource_databaseName`.`Resource`.`$endDateName` <> '00/00/0000' AND + `$resource_databaseName`.`Resource`.`$endDateName` BETWEEN (CURDATE() - INTERVAL " . $daybefore . " DAY) AND (CURDATE() + INTERVAL " . $dayafter . " DAY) "; + if ($resourceType) { + $query = $query . " AND `$resource_databaseName`.`Resource`.`resourceTypeID` IN ( ". $resourceType . " ) "; + } +$query = $query . "ORDER BY `sortdate`, `$resource_databaseName`.`Resource`.`titleText`"; +$result = mysqli_query($link, $query) or die(_("Bad Query Failure")); +?> + +
      + + + + +
      + +
      + +
      + + + "; + $year_html = $year_html . ""; + $year_html = $year_html . ""; + $displayYear = TRUE; + } + + if ($mMonth != $row["month"]) { + $mMonth = $row["month"]; + + $month_html = ""; + $month_html = $month_html . ""; + $month_html = $month_html . ""; + $month_html = $month_html . ""; + $displayMonth = TRUE; + } + + $html = $html . ""; + + if ($i % 2 == 0) { + $alt = "alt"; + } else { + $alt = ""; + } + $date1 = new DateTime(date("m/d/y")); + $date2 = new DateTime($row["currentEndDate"]); + $interval = $date1->diff($date2); + $num_days = ((($interval->y) * 365) + (($interval->m) * 30) + ($interval->d)); + + $html = $html . ""; + $html = $html . " + + "; + $html = $html . ""; + + if (count($arr3) > 0) { + if ($displayYear) { + echo $year_html; + $displayYear = FALSE; + } + if ($displayMonth) { + echo $month_html; + $displayMonth = FALSE; + } + echo $html; + } + + } + + ?> + +
      + + + + + + +
      " . $mYear . "
      +
      + + + + + + +
         " . $mMonth . "
      +
      "; + + $html = $html . "      ". $row["titleText"] . ""; + $html = $html . "  [License: "; + if (is_null($row["licenseID"])) { + $html = $html . ""._("No associated licenses available.").""; + } else { + $html = $html . "". $row["shortName"] . ""; + } + $html = $html . " ] - " . $row["resourceTypeName"] . " "; + if ($interval->invert) { + $html = $html . "- "._("Expired ").$num_days._(" days ago").""; + } else { + $html = $html . _("- Expires in "); + + if ($date1 > $date2) { + $html = $html . "(" . $num_days . _(" days)").""; + } else { + $html = $html . $num_days . _(" days "); + } + } + $k = 0; + $siteID = array(); + + while ($row2 = mysqli_fetch_assoc($result2)) { + if ($k == 0) { + $html = $html . "
            "._("Participants: "); + } else { + $html = $html . ", "; + } + + $html = $html . $row2["shortName"]; + array_push( $siteID, $row2["authorizedSiteID"] ); + $k = $k + 1; + } + + $arr3 = array_intersect($authorizedSiteID, $siteID); + $html = $html . "
      +
      +
      +
      + + diff --git a/compare.php b/compare.php index 54b2730..7a2244b 100644 --- a/compare.php +++ b/compare.php @@ -19,7 +19,7 @@ include_once 'directory.php'; -$pageTitle='Expression Comparison'; +$pageTitle=_('Expression Comparison'); include 'templates/header.php'; //set referring page @@ -36,7 +36,7 @@
      - Limit by Expression Type:  +  
      -
      margin-left:123px;'>
      +
      margin-left:123px;'>
      - +
      There was an error processing this request - please verify configuration.ini is set up for organizations correctly and the database and tables have been created."; + echo ""._("There was an error processing this request - please verify configuration.ini is set up for organizations correctly and the database and tables have been created.").""; } ?> @@ -98,11 +98,11 @@ - +
      @@ -146,7 +146,7 @@ - +
      @@ -202,7 +202,7 @@ - +
      ' /> @@ -212,7 +212,7 @@ - +
      -  new search +   diff --git a/install/css/style.css b/install/css/style.css index 21cf4a1..3695eb6 100644 --- a/install/css/style.css +++ b/install/css/style.css @@ -1,7 +1,7 @@ html { height: 100%; margin: 0; - padding: 0 + padding: 0; } body { @@ -10,7 +10,6 @@ body { color: #2c3c42; font-family: "arial"; font-size: 10pt; - font-weight: heavy; background: #FFFFFF; margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ padding: 0; @@ -49,21 +48,21 @@ span.redText{color:red;} span.span_AttachmentNumber{font-size:small;font-weight:normal; color:gray} .space { -line-height: 1 em; -font-size:2; +line-height: 1em; +font-size:2pt; } img {border:0;} fieldset {border:0;} -select option { color: #3D545D; font-family: "arial"; font-size: 8pt; font-weight: medium; } -.optionStyle { color: #3D545D; font-family: "arial"; font-size: 8pt; font-weight: medium; } +select option { color: #3D545D; font-family: "arial"; font-size: 8pt; } +.optionStyle { color: #3D545D; font-family: "arial"; font-size: 8pt; } .errorText { color: red;font-size:95%; } -input, select, multiple, textarea{color: #3D545D; font-family: "arial"; font-size: 8pt; font-weight: medium;} +input, select, multiple, textarea{color: #3D545D; font-family: "arial"; font-size: 8pt;} table.titleTable {width:900px;background-image:url('../images/licensingtitle.gif');background-repeat:no-repeat;height:87px;} -table.headerTable {width:900px;min-height:40px;background-image:url('../images/header.gif');background-repeat:no-repeat;text-align:left} +table.headerTable {width:900px;min-height:40px;background-image:url('../images/header.gif');background-repeat:no-repeat;text-align:left;} .headerText {font-size:125%;font-weight:bold; } .titleText {font-size:130%;font-weight:bold; } @@ -151,7 +150,6 @@ table.dataTable tr {vertical-align: top;} border-top: 1px solid #dad5c9; border-right: 1px solid #dad5c9; border-bottom: 1px solid #dad5c9; - background-color: white; vertical-align: top; } @@ -170,7 +168,7 @@ table.verticalFormTable { table.verticalFormTable td { margin: 0; - padding: 3px 3px 3px 3px; + padding: 3px; border-width: 1px 1px 0 0; border-style: solid; border-color: #e0dfe3; @@ -181,7 +179,7 @@ table.verticalFormTable td { table.verticalFormTable td.alt { margin: 0; - padding: 3px 3px 3px 3px; + padding: 3px; border-width: 1px 1px 0 0; border-style: solid; border-color: #e0dfe3; @@ -232,7 +230,6 @@ table.thickboxTable{ color: #2c3c42; font-family: "arial"; font-size: 8pt; - font-weight: heavy; } .smallText{font-size:small;} @@ -275,7 +272,7 @@ input.dp-applied { } .adminAddInput{margin-top:5px;} -.licenseAddInput{margin-top:5px;margin-bottom;5px;} +.licenseAddInput{margin-top:5px;margin-bottom:5px;} diff --git a/install/index.php b/install/index.php index ec4c441..cc121f4 100644 --- a/install/index.php +++ b/install/index.php @@ -1,21 +1,22 @@ -installed()) { - header('Location: install.php'); - exit; -} else if ($next_version = $installer->getNextUpdateVersion()) { - header('Location: update.php?version='.$next_version); - exit; -} - -$installer->header('CORAL Maintenance'); -?> - displayMessages(); ?> - displayErrorMessages(); ?> -

      CORAL Licensing

      -

      Your CORAL Licensing Module is correctly installed and there are no pending updates.

      -footer(); +installed()) { + header('Location: install.php'); + exit; +} else if ($next_version = $installer->getNextUpdateVersion()) { + header('Location: update.php?version='.$next_version); + exit; +} + +$installer->header('CORAL Maintenance'); +?> + displayMessages(); ?> + displayErrorMessages(); ?> +

      CORAL Licensing

      +

      Your CORAL Licensing Module is correctly installed and there are no pending updates.

      +

      Go to Licensing Module

      +footer(); ?> \ No newline at end of file diff --git a/install/manual_upgrade_charset_utf8.txt b/install/manual_upgrade_charset_utf8.txt new file mode 100644 index 0000000..16ed221 --- /dev/null +++ b/install/manual_upgrade_charset_utf8.txt @@ -0,0 +1,6 @@ +How to change the charset in the database to utf8 from v1.3 + + -Open SQL file in /coral/licensing/install/protected/update_latin1-to-utf8.sql and replace _DATABASE_NAME_ with your database schema name + -Run SQL file + +This script will change the charset in the database and convert all tables to utf8. \ No newline at end of file diff --git a/install/protected/install.sql b/install/protected/install.sql index ccf0a6a..9bc3114 100644 --- a/install/protected/install.sql +++ b/install/protected/install.sql @@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS `Attachment` ( `sentDate` date default NULL, `attachmentText` text, PRIMARY KEY USING BTREE (`attachmentID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `AttachmentFile` ( @@ -12,14 +12,14 @@ CREATE TABLE IF NOT EXISTS `AttachmentFile` ( `attachmentID` int(10) unsigned NOT NULL, `attachmentURL` varchar(200) NOT NULL, PRIMARY KEY USING BTREE (`attachmentFileID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `Consortium` ( `consortiumID` int(10) unsigned NOT NULL auto_increment, `shortName` tinytext NOT NULL, PRIMARY KEY (`consortiumID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `Document` ( @@ -32,14 +32,14 @@ CREATE TABLE IF NOT EXISTS `Document` ( `documentURL` varchar(200) default NULL, `parentDocumentID` int(10) unsigned default NULL, PRIMARY KEY (`documentID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `DocumentType` ( `documentTypeID` int(10) unsigned NOT NULL auto_increment, `shortName` tinytext NOT NULL, PRIMARY KEY (`documentTypeID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `Expression` ( @@ -51,7 +51,7 @@ CREATE TABLE IF NOT EXISTS `Expression` ( `lastUpdateDate` timestamp NOT NULL default '0000-00-00 00:00:00', `productionUseInd` tinyint(1) NOT NULL default '0', PRIMARY KEY (`expressionID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; @@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS `ExpressionNote` ( `displayOrderSeqNumber` int(10) default NULL, `lastUpdateDate` timestamp NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`expressionNoteID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; @@ -71,7 +71,7 @@ CREATE TABLE IF NOT EXISTS `ExpressionType` ( `shortName` tinytext NOT NULL, `noteType` varchar(45) default NULL, PRIMARY KEY (`expressionTypeID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; @@ -84,7 +84,7 @@ CREATE TABLE IF NOT EXISTS `License` ( `statusDate` datetime default NULL, `createDate` datetime default NULL, PRIMARY KEY (`licenseID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; @@ -92,7 +92,7 @@ CREATE TABLE IF NOT EXISTS `Privilege` ( `privilegeID` int(10) unsigned NOT NULL auto_increment, `shortName` varchar(50) default NULL, PRIMARY KEY USING BTREE (`privilegeID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `Organization`; @@ -100,7 +100,7 @@ CREATE TABLE IF NOT EXISTS `Organization` ( `organizationID` int(10) unsigned NOT NULL auto_increment, `shortName` tinytext NOT NULL, PRIMARY KEY USING BTREE (`organizationID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `Qualifier` ( @@ -108,14 +108,14 @@ CREATE TABLE IF NOT EXISTS `Qualifier` ( `expressionTypeID` INTEGER UNSIGNED NOT NULL, `shortName` varchar(45) NOT NULL, PRIMARY KEY (`qualifierID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `ExpressionQualifierProfile` ( `expressionID` INTEGER UNSIGNED NOT NULL, `qualifierID` INTEGER UNSIGNED NOT NULL, PRIMARY KEY (`expressionID`, `qualifierID`) -)ENGINE=MyISAM DEFAULT CHARSET=latin1; +)ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `SFXProvider` ( @@ -123,7 +123,7 @@ CREATE TABLE IF NOT EXISTS `SFXProvider` ( `documentID` int(10) unsigned NOT NULL, `shortName` varchar(245) NOT NULL, PRIMARY KEY (`sfxProviderID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `Signature` ( @@ -133,7 +133,7 @@ CREATE TABLE IF NOT EXISTS `Signature` ( `signatureDate` date default NULL, `signerName` tinytext, PRIMARY KEY (`signatureID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; @@ -141,7 +141,7 @@ CREATE TABLE IF NOT EXISTS `SignatureType` ( `signatureTypeID` int(10) unsigned NOT NULL auto_increment, `shortName` tinytext NOT NULL, PRIMARY KEY (`signatureTypeID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; @@ -149,7 +149,7 @@ CREATE TABLE IF NOT EXISTS `Status` ( `statusID` int(10) unsigned NOT NULL auto_increment, `shortName` varchar(45) NOT NULL, PRIMARY KEY (`statusID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `User` ( @@ -159,7 +159,7 @@ CREATE TABLE IF NOT EXISTS `User` ( `privilegeID` int(10) unsigned default NULL, `emailAddressForTermsTool` varchar(150) default NULL, PRIMARY KEY USING BTREE (`loginID`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS CalendarSettings ( @@ -167,7 +167,7 @@ CREATE TABLE IF NOT EXISTS CalendarSettings ( `shortName` tinytext NOT NULL, `value` varchar(45) DEFAULT NULL, PRIMARY KEY (`calendarSettingsID`) -) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; +) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; DELETE FROM DocumentType; INSERT INTO DocumentType (shortName) values ('SERU'); diff --git a/install/protected/update_latin1-to-utf8.sql b/install/protected/update_latin1-to-utf8.sql new file mode 100644 index 0000000..eea0e15 --- /dev/null +++ b/install/protected/update_latin1-to-utf8.sql @@ -0,0 +1,20 @@ +ALTER DATABASE `_DATABASE_NAME_` CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`Attachment` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`AttachmentFile` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`Consortium` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`Document` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`DocumentType` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`Expression` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`ExpressionNote` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`ExpressionType` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`License` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`Privilege` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`Organization` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`Qualifier` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`ExpressionQualifierProfile` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`SFXProvider` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`Signature` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`SignatureType` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`Status` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`User` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; +ALTER TABLE `_DATABASE_NAME_`.`CalendarSettings` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; \ No newline at end of file diff --git a/js/admin.js b/js/admin.js index 12f0721..ebc5398 100644 --- a/js/admin.js +++ b/js/admin.js @@ -119,7 +119,7 @@ function addData(tableName){ if ($('#new' + tableName).val()) { - $('#span_' + tableName + "_response").html('  Processing...'); + $('#span_' + tableName + "_response").html("  "+_("Processing...")); $.ajax({ type: "POST", @@ -252,9 +252,9 @@ function submitQualifier(){ function deleteData(tableName, deleteID){ - if (confirm("Do you really want to delete this data?") == true) { + if (confirm(_("Do you really want to delete this data?")) == true) { - $('#span_' + tableName + "_response").html('  Processing...'); + $('#span_' + tableName + "_response").html("  "+_("Processing...")); $.ajax({ type: "GET", url: "ajax_processing.php", @@ -277,9 +277,9 @@ function submitQualifier(){ function deleteUser(loginID){ - if (confirm("Do you really want to delete this user?") == true) { + if (confirm(_("Do you really want to delete this user?")) == true) { - $('#span_User_response').html('  Processing...'); + $('#span_User_response').html("  "+_("Processing...")); $.ajax({ type: "GET", url: "ajax_processing.php", @@ -303,9 +303,9 @@ function submitQualifier(){ function deleteExpressionType(deleteID){ - if (confirm("Do you really want to delete this expression type? Any associated Qualifiers will be deleted as well.") == true) { + if (confirm(_("Do you really want to delete this expression type? Any associated Qualifiers will be deleted as well.")) == true) { - $("#span_ExpressionType_response").html('  Processing...'); + $("#span_ExpressionType_response").html("  "+_("Processing...")); $.ajax({ type: "GET", url: "ajax_processing.php", @@ -330,9 +330,9 @@ function submitQualifier(){ function deleteQualifier(deleteID){ - if (confirm("Do you really want to delete this data?") == true) { + if (confirm(_("Do you really want to delete this data?")) == true) { - $("#span_Qualifier_response").html('  Processing...'); + $("#span_Qualifier_response").html("  "+_("Processing...")); $.ajax({ type: "GET", url: "ajax_processing.php", @@ -354,7 +354,7 @@ function submitQualifier(){ function showAdd(tableName){ - $('#span_new' + tableName).html(" add"); + $('#span_new' + tableName).html(" "+_("add")+""); //attach enter key event to new input and call add data when hit $('#new' + tableName).keyup(function(e) { diff --git a/js/common.js b/js/common.js index 69793e4..31095c0 100644 --- a/js/common.js +++ b/js/common.js @@ -15,7 +15,6 @@ ************************************************************************************************************************** */ - //image preloader (function($) { var cache = []; diff --git a/js/forms/attachmentForm.js b/js/forms/attachmentForm.js index 3eccf38..c461723 100644 --- a/js/forms/attachmentForm.js +++ b/js/forms/attachmentForm.js @@ -38,12 +38,12 @@ function checkUploadAttachment (file, extension){ data: { uploadAttachment: file }, success: function(response) { if (response == "1"){ - $("#div_file_message").html(" File name is already being used..."); + $("#div_file_message").html(" "+_("File name is already being used...")+""); exists=1; return false; } else if (response == "3"){ exists = "3"; - $("#div_file_message").html(" The attachments directory is not writable."); + $("#div_file_message").html(" "+_("The attachments directory is not writable.")+""); return false; } @@ -51,7 +51,7 @@ function checkUploadAttachment (file, extension){ //check if it's already been uploaded in current array //note: using indexOf prototype in common.js for IE if (URLArray.indexOf(file) >= 0){ - $("#div_file_message").html(" File name is already being used..."); + $("#div_file_message").html(" "+_("File name is already being used...")+""); exists=1; return false; } @@ -81,7 +81,7 @@ new AjaxUpload('upload_attachment_button', arrayLocation = URLArray.length; URLArray.push(fileName); - $("#div_file_success").append("
      " + fileName + " successfully uploaded. remove
      "); + $("#div_file_success").append("
      " + fileName + _(" successfully uploaded.")+" "+_("remove")+"
      "); } } @@ -98,7 +98,7 @@ new AjaxUpload('upload_attachment_button', function removeFile(arrayLocation){ - if (confirm("Do you really want to delete this attachment?") == true) { + if (confirm(_("Do you really want to delete this attachment?")) == true) { //URLArray.splice(URLArray.indexOf(value), 1); URLArray.splice(arrayLocation, 1); $("#div_" + arrayLocation).remove(); @@ -106,7 +106,7 @@ function removeFile(arrayLocation){ } function removeExistingAttachment(attachmentFileID){ - if (confirm("Do you really want to delete this attachment?") == true) { + if (confirm(_("Do you really want to delete this attachment?")) == true) { $.get("ajax_processing.php?action=deleteAttachmentFile&attachmentFileID=" + attachmentFileID, function(data){ $("#div_existing_" + attachmentFileID).remove(); diff --git a/js/forms/documentForm.js b/js/forms/documentForm.js index 949323b..1744354 100644 --- a/js/forms/documentForm.js +++ b/js/forms/documentForm.js @@ -35,7 +35,7 @@ $(function(){ $("#submitDocument").removeAttr("disabled"); canSubmit=1; }else{ - $("#span_error_shortName").html("This name is already being used!"); + $("#span_error_shortName").html(_("This name is already being used!")); $("#submitDocument").attr("disabled","disabled"); canSubmit=0; @@ -99,15 +99,15 @@ function checkUploadDocument (file, extension){ success: function(response) { if (response == "1"){ exists = "1"; - $("#div_file_message").html(" File name is already being used..."); + $("#div_file_message").html(" "+_("File name is already being used...")+""); return false; }else if (response == "2"){ exists = "2"; - $("#div_file_message").html(" File name may not contain special characters - ampersand, single quote, double quote or less than/greater than characters"); + $("#div_file_message").html(" "+_("File name may not contain special characters - ampersand, single quote, double quote or less than/greater than characters")+""); return false; } else if (response == "3"){ exists = "3"; - $("#div_file_message").html(" The documents directory is not writable."); + $("#div_file_message").html(" "+_("The documents directory is not writable.")+""); return false; }else{ exists = ""; @@ -131,7 +131,7 @@ new AjaxUpload('upload_button', if (errorMessage.size() > 0) { $("#div_file_message").html("" + errorMessage.html() + ""); } else { - $("#div_file_message").html("" + fileName + " successfully uploaded."); + $("#div_file_message").html("" + fileName + _(" successfully uploaded.")); $("#div_uploadFile").html("
      "); } } @@ -173,8 +173,8 @@ function doSubmitDocument(){ function validateForm (){ myReturn=0; - if (!validateRequired('documentTypeID','Document Type is required.')) myReturn="1"; - if (!validateRequired('shortName','Short Name is required.')) myReturn="1"; + if (!validateRequired('documentTypeID',_("Document Type is required."))) myReturn="1"; + if (!validateRequired('shortName',_("Short Name is required."))) myReturn="1"; if (myReturn == "1"){ return false; @@ -185,7 +185,7 @@ function validateForm (){ function newDocumentType(){ - $('#span_newDocumentType').html(" add"); + $('#span_newDocumentType').html(" "+_("add")+""); //attach enter key event to new input and call add data when hit $('#newDocumentType').keyup(function(e) { @@ -204,6 +204,6 @@ function addDocumentType(){ url: "ajax_processing.php?action=addDocumentType", cache: false, data: { shortName: $("#newDocumentType").val() }, - success: function(html) { $('#span_documentType').html(html); $('#span_newDocumentType').html("DocumentType has been added"); } + success: function(html) { $('#span_documentType').html(html); $('#span_newDocumentType').html(""+_("DocumentType has been added")+""); } }); } diff --git a/js/forms/expressionForm.js b/js/forms/expressionForm.js index 2a0636d..12e3d1c 100644 --- a/js/forms/expressionForm.js +++ b/js/forms/expressionForm.js @@ -75,7 +75,7 @@ $("#submitExpression").click(function () { function newExpressionType(){ - $('#span_newExpressionType').html(" add"); + $('#span_newExpressionType').html(" "+_("add")+""); } @@ -86,7 +86,7 @@ function addExpressionType(){ url: "ajax_processing.php?action=addExpressionType", cache: false, data: { shortName: $("#newExpressionType").val() }, - success: function(html) { $('#span_expressionType').html(html); $('#span_newExpressionType').html("ExpressionType has been added"); } + success: function(html) { $('#span_expressionType').html(html); $('#span_newExpressionType').html(""+_("ExpressionType has been added")+""); } }); } diff --git a/js/forms/licenseForm.js b/js/forms/licenseForm.js index 5ce0c9f..a5f5df2 100644 --- a/js/forms/licenseForm.js +++ b/js/forms/licenseForm.js @@ -31,7 +31,7 @@ $(function(){ $("#span_error_licenseShortName").html(" "); $("#submitLicense").removeAttr("disabled"); }else{ - $("#span_error_licenseShortName").html("This name is already being used!"); + $("#span_error_licenseShortName").html(_("This name is already being used!")); $("#submitLicense").attr("disabled","disabled"); } @@ -54,7 +54,7 @@ $(function(){ success: function(exists) { if (exists == "0"){ $("#licenseOrganizationID").val(""); - $("#span_error_organizationNameResult").html("
      Warning! This organization will be added new."); + $("#span_error_organizationNameResult").html("
      "+_("Warning! This organization will be added new.")); }else{ $("#licenseOrganizationID").val(exists); @@ -115,7 +115,7 @@ $(function(){ success: function(exists) { if (exists == "0"){ $("#licenseOrganizationID").val(""); - $("#span_error_organizationNameResult").html("
      Warning! This organization will be added new."); + $("#span_error_organizationNameResult").html("
      "+_("Warning! This organization will be added new.")); }else{ $("#licenseOrganizationID").val(exists); @@ -169,7 +169,7 @@ function doSubmitLicense(){ //the following are only used when interoperability with organizations module is turned off function newConsortium(){ - $('#span_newConsortium').html(" add"); + $('#span_newConsortium').html(" "+_("add")+""); //attach enter key event to new input and call add data when hit $('#span_newConsortium').keyup(function(e) { @@ -188,7 +188,7 @@ function addConsortium(){ url: "ajax_processing.php", cache: false, data: "action=addConsortium&shortName=" + $("#newConsortium").val(), - success: function(html) { $('#span_consortium').html(html); $('#span_newConsortium').html("Consortium has been added"); } + success: function(html) { $('#span_consortium').html(html); $('#span_newConsortium').html(""+_("Consortium has been added")+""); } }); } @@ -197,8 +197,8 @@ function addConsortium(){ //validates fields function validateForm (){ myReturn=0; - if (!validateRequired('licenseShortName','License Name is required.')) myReturn="1"; - if (!validateRequired('organizationName','Provider is required.')) myReturn="1"; + if (!validateRequired('licenseShortName',_("License Name is required."))) myReturn="1"; + if (!validateRequired('organizationName',_("Provider is required."))) myReturn="1"; if (myReturn == "1"){ return false; diff --git a/js/forms/sfxForm.js b/js/forms/sfxForm.js index 62b5400..51ecbe3 100644 --- a/js/forms/sfxForm.js +++ b/js/forms/sfxForm.js @@ -56,8 +56,8 @@ function submitSFXForm(){ function validateForm (){ myReturn=0; - if (!validateRequired('documentID','
      A document must be selected to continue.')) myReturn="1"; - if (!validateRequired('shortName','
      Terms Tool Resource must be entered to continue.')) myReturn="1"; + if (!validateRequired('documentID',"
      "+_("A document must be selected to continue."))) myReturn="1"; + if (!validateRequired('shortName',"
      "+_("Terms Tool Resource must be entered to continue."))) myReturn="1"; if (myReturn == "1"){ diff --git a/js/forms/signatureForm.js b/js/forms/signatureForm.js index ab120eb..a359c47 100644 --- a/js/forms/signatureForm.js +++ b/js/forms/signatureForm.js @@ -38,7 +38,7 @@ $(function(){ function log(event, data, formatted) { - $("
    • ").html( !data ? "No match!" : "Selected: " + formatted).html("#result"); + $("
    • ").html( !data ? _("No match!") : _("Selected: ") + formatted).html("#result"); } @@ -93,7 +93,7 @@ function updateSignatureForm(signatureID){ function removeSignature(signatureID){ - if (confirm("Do you really want to delete this signature?") == true) { + if (confirm(_("Do you really want to delete this signature?")) == true) { $.ajax({ type: "GET", url: "ajax_processing.php", @@ -112,7 +112,7 @@ function removeSignature(signatureID){ function newSignatureType(){ - $('#span_newSignatureType').html(" add"); + $('#span_newSignatureType').html(" "+_("add")+""); } @@ -123,7 +123,7 @@ function addSignatureType(){ url: "ajax_processing.php?action=addSignatureType", cache: false, data: { shortName: $("#newSignatureType").val() }, - success: function(html) { $('#span_signatureType').html(html); $('#span_newSignatureType').html("SignatureType has been added"); } + success: function(html) { $('#span_signatureType').html(html); $('#span_newSignatureType').html(""+_("SignatureType has been added")+""); } }); } diff --git a/js/index.js b/js/index.js index f53cb8e..aef69e1 100644 --- a/js/index.js +++ b/js/index.js @@ -40,7 +40,7 @@ var numberOfRecords = 25; var startWith = ''; function updateSearch(){ - $("#div_feedback").html(" Processing..."); + $("#div_feedback").html(" "+_("Processing...")+""); $.ajax({ diff --git a/js/license.js b/js/license.js index fa7486f..83246d0 100644 --- a/js/license.js +++ b/js/license.js @@ -25,6 +25,7 @@ $(document).ready(function(){ updateSFXProviders(); updateAttachmentsNumber(); updateAttachments(); + updateRightPanel(); $('#div_displayDocuments').show(); @@ -99,7 +100,7 @@ $(document).ready(function(){ function deleteLicense(licenseID){ - if (confirm("Do you really want to delete this license?") == true) { + if (confirm(_("Do you really want to delete this license?")) == true) { $.ajax({ type: "GET", url: "ajax_processing.php", @@ -154,6 +155,22 @@ $(document).ready(function(){ } +function updateRightPanel(){ + $("#div_rightPanel").append(" "+_("Refreshing Contents...")); + $.ajax({ + type: "GET", + url: "ajax_htmldata.php", + cache: false, + data: "action=getRightPanel&licenseID=" + $("#licenseID").val(), + success: function(html) { + $("#div_rightPanel").html(html + " "); + + } + + + }); + +} function updateArchivedDocuments(showDisplayArchiveInd, showChildrenDocumentID){ @@ -259,9 +276,9 @@ function updateAttachmentsNumber(){ data: "action=getAttachmentsNumber&licenseID=" + $("#licenseID").val(), success: function(remaining) { if (remaining == "1"){ - $(".span_AttachmentNumber").html("(" + remaining + " record)"); + $(".span_AttachmentNumber").html("(" + remaining + _(" record)")); }else{ - $(".span_AttachmentNumber").html("(" + remaining + " records)"); + $(".span_AttachmentNumber").html("(" + remaining + _(" records)")); } } }); @@ -294,7 +311,7 @@ function updateAttachmentsNumber(){ function archiveDocument(documentID){ - if (confirm("Do you really want to archive this document?") == true) { + if (confirm(_("Do you really want to archive this document?")) == true) { $.ajax({ type: "GET", url: "ajax_processing.php", @@ -312,14 +329,14 @@ function updateAttachmentsNumber(){ function deleteDocument(documentID){ - if (confirm("Do you really want to delete this document?") == true) { + if (confirm(_("Do you really want to delete this document?")) == true) { $.ajax({ type: "GET", url: "ajax_processing.php", cache: false, data: "action=deleteDocument&documentID=" + documentID, success: function(html) { - if (html) alert('There was a problem with deleting the document. You may not delete a document if there are associated expressions. Remove all expressions and try again.'); + if (html) alert(_("There was a problem with deleting the document. You may not delete a document if there are associated expressions. Remove all expressions and try again.")); updateDocuments(); updateArchivedDocuments(); } @@ -333,7 +350,7 @@ function updateAttachmentsNumber(){ function deleteExpression(expressionID){ - if (confirm("Do you really want to delete this expression?") == true) { + if (confirm(_("Do you really want to delete this expression?")) == true) { $.ajax({ type: "GET", url: "ajax_processing.php", @@ -348,7 +365,7 @@ function updateAttachmentsNumber(){ function deleteAttachment(attachmentID){ - if (confirm("Do you really want to delete this attachment? This will also delete all attached files.") == true) { + if (confirm(_("Do you really want to delete this attachment? This will also delete all attached files.")) == true) { $.ajax({ type: "GET", url: "ajax_processing.php", @@ -365,7 +382,7 @@ function updateAttachmentsNumber(){ function deleteSFXProvider(sfxProviderID){ - if (confirm("Do you really want to delete this terms tool resource link?") == true) { + if (confirm(_("Do you really want to delete this terms tool resource link?")) == true) { $.ajax({ type: "GET", url: "ajax_processing.php", @@ -405,7 +422,7 @@ function hideFullAttachmentText(attachmentID){ success: function(response) { if (response == "1"){ exists = "1"; - $("#div_file_message").html(" File name is already being used."); + $("#div_file_message").html(" "+_("File name is already being used.")+""); return false; }else{ $("#div_file_message").html(""); @@ -435,9 +452,9 @@ function hideFullAttachmentText(attachmentID){ fileName=data; if (exists == "1"){ - $("#div_file_message").html(" File name is already being used."); + $("#div_file_message").html(" "+_("File name is already being used.")+""); }else{ - $("#div_uploadFile").html("" + fileName + " successfully uploaded."); + $("#div_uploadFile").html("" + fileName + _(" successfully uploaded.")); } diff --git a/js/onix_import.js b/js/onix_import.js new file mode 100644 index 0000000..642bdff --- /dev/null +++ b/js/onix_import.js @@ -0,0 +1,117 @@ +$("#organizationName").keyup(function() { + $.ajax({ + type: "GET", + url: "ajax_processing.php", + cache: false, + async: true, + data: "action=getExistingOrganizationName&shortName=" + $("#organizationName").val(), + success: function(exists) { + if (exists == "0"){ + $("#licenseOrganizationID").val(""); + $("#span_error_organizationNameResult").html("
      "+_("Warning! This organization will be added new.")); + + }else{ + $("#licenseOrganizationID").val(exists); + $("#span_error_organizationNameResult").html(""); + + } + } + }); +}); + +//used for autocomplete formatting +formatItem = function (row){ + return "" + row[1] + ""; +} + +formatResult = function (row){ + return row[1].replace(/(<.+?>)/gi, ''); +} + +$("#organizationName").autocomplete('ajax_processing.php?action=getOrganizations', { + minChars: 2, + max: 50, + mustMatch: false, + width: 233, + delay: 20, + cacheLength: 10, + matchSubset: true, + matchContains: true, + formatItem: formatItem, + formatResult: formatResult, + parse: function(data){ + var parsed = []; + var rows = data.split("\n"); + for (var i=0; i < rows.length; i++) { + var row = $.trim(rows[i]); + if (row) { + row = row.split("|"); + parsed[parsed.length] = { + data: row, + value: row[0], + result: formatResult(row, row[0]) || row[0] + }; + } + } + + if (parsed.length == 0) { + + $.ajax({ + type: "GET", + url: "ajax_processing.php", + cache: false, + async: true, + data: "action=getExistingOrganizationName&shortName=" + $("#organizationName").val(), + success: function(exists) { + if (exists == "0"){ + $("#licenseOrganizationID").val(""); + $("#span_error_organizationNameResult").html("
      "+_("Warning! This organization will be added new.")); + + }else{ + $("#licenseOrganizationID").val(exists); + $("#span_error_organizationNameResult").html(""); + + } + } + }); + + } + } + }); + + +//once something has been selected, change the hidden input value +$("#organizationName").result(function(event, data, formatted) { + if (data[0]){ + $("#licenseOrganizationID").val(data[0]); + $("#span_error_organizationNameResult").html(""); + } +}); + +//Attach form pre-submission event for form validation +$('#importForm').submit(function() { + return validateOnixImportForm(); +}); + +function validateOnixImportForm() { + var errorString = ""; + if($('#uploadFile').val() === "") { + errorString += _("Please select a file to upload."); + } + if($('input:checkbox:checked').length === 0) { + if(errorString.length > 0) { + errorString += "\n\n"; + } + errorString += _("At least one term type must be selected."); + } + if($('#organizationName').val() === "") { + if(errorString.length > 0) { + errorString += "\n\n"; + } + errorString += _("The Publisher / Provider field must contain a value."); + } + if(errorString !== "") { + alert(_("Please correct the following form error(s):\n\n") + errorString); + return false; + } +} \ No newline at end of file diff --git a/js/plugins/Gettext.js b/js/plugins/Gettext.js new file mode 100644 index 0000000..8a905e6 --- /dev/null +++ b/js/plugins/Gettext.js @@ -0,0 +1,1265 @@ +/* +Pure Javascript implementation of Uniforum message translation. +Copyright (C) 2008 Joshua I. Miller , all rights reserved + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU Library General Public License as published +by the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +=head1 NAME + +Javascript Gettext - Javascript implemenation of GNU Gettext API. + +=head1 SYNOPSIS + + // ////////////////////////////////////////////////////////// + // Optimum caching way + + + + var gt = new Gettext({ "domain" : "myDomain" }); + // rest is the same + + + // ////////////////////////////////////////////////////////// + // The reson the shortcuts aren't exported by default is because they'd be + // glued to the single domain you created. So, if you're adding i18n support + // to some js library, you should use it as so: + + if (typeof(MyNamespace) == 'undefined') MyNamespace = {}; + MyNamespace.MyClass = function () { + var gtParms = { "domain" : 'MyNamespace_MyClass' }; + this.gt = new Gettext(gtParams); + return this; + }; + MyNamespace.MyClass.prototype._ = function (msgid) { + return this.gt.gettext(msgid); + }; + MyNamespace.MyClass.prototype.something = function () { + var myString = this._("this will get translated"); + }; + + // ////////////////////////////////////////////////////////// + // Adding the shortcuts to a global scope is easier. If that's + // ok in your app, this is certainly easier. + var myGettext = new Gettext({ 'domain' : 'myDomain' }); + function _ (msgid) { + return myGettext.gettext(msgid); + } + alert( _("text") ); + + // ////////////////////////////////////////////////////////// + // Data structure of the json data + // NOTE: if you're loading via the + + // in domain.json + json_locale_data = { + "mydomain" : { + // po header fields + "" : { + "plural-forms" : "...", + "lang" : "en", + }, + // all the msgid strings and translations + "msgid" : [ "msgid_plural", "translation", "plural_translation" ], + }, + }; + // please see the included bin/po2json script for the details on this format + +This method also allows you to use unsupported file formats, so long as you can parse them into the above format. + +=item 2. Use AJAX to load language file. + +Use XMLHttpRequest (actually, SJAX - syncronous) to load an external resource. + +Supported external formats are: + +=over + +=item * Javascript Object Notation (.json) + +(see bin/po2json) + + type=application/json + +=item * Uniforum Portable Object (.po) + +(see GNU Gettext's xgettext) + + type=application/x-po + +=item * Machine Object (compiled .po) (.mo) + +NOTE: .mo format isn't actually supported just yet, but support is planned. + +(see GNU Gettext's msgfmt) + + type=application/x-mo + +=back + +=back + +=head1 METHODS + +The following methods are implemented: + + new Gettext(args) + textdomain (domain) + gettext (msgid) + dgettext (domainname, msgid) + dcgettext (domainname, msgid, LC_MESSAGES) + ngettext (msgid, msgid_plural, count) + dngettext (domainname, msgid, msgid_plural, count) + dcngettext (domainname, msgid, msgid_plural, count, LC_MESSAGES) + pgettext (msgctxt, msgid) + dpgettext (domainname, msgctxt, msgid) + dcpgettext (domainname, msgctxt, msgid, LC_MESSAGES) + npgettext (msgctxt, msgid, msgid_plural, count) + dnpgettext (domainname, msgctxt, msgid, msgid_plural, count) + dcnpgettext (domainname, msgctxt, msgid, msgid_plural, count, LC_MESSAGES) + strargs (string, args_array) + + +=head2 new Gettext (args) + +Several methods of loading locale data are included. You may specify a plugin or alternative method of loading data by passing the data in as the "locale_data" option. For example: + + var get_locale_data = function () { + // plugin does whatever to populate locale_data + return locale_data; + }; + var gt = new Gettext( 'domain' : 'messages', + 'locale_data' : get_locale_data() ); + +The above can also be used if locale data is specified in a statically included + + diff --git a/templates/header.php b/templates/header.php index e6e734b..f7147f4 100644 --- a/templates/header.php +++ b/templates/header.php @@ -32,7 +32,7 @@ //this will redirect back to the actual license record if ((isset($_GET['editLicenseForm'])) && ($_GET['editLicenseForm'] == "Y")){ if (((isset($_GET['licenseShortName'])) && ($_GET['licenseShortName'] == "")) && ((isset($_GET['licenseOrganizationID'])) && ($_GET['licenseOrganizationID'] == ""))){ - $err="Both license name and organization must be filled out. Please try again."; + $err=""._("Both license name and organization must be filled out. Please try again.").""; }else{ $util->fixLicenseFormEnter($_GET['editLicenseID']); } @@ -53,60 +53,277 @@ - + + + - - + +getLanguage($str); + if($default_l==null || empty($default_l)){$default_l=$str;} + if(isset($_COOKIE["lang"])){ + if($_COOKIE["lang"]==$http_lang && $_COOKIE["lang"] != "en_US"){ + echo ""; + } + }else if($default_l==$http_lang && $default_l != "en_US"){ + echo ""; + } +?> + + + - - + +
      - + +
      +
      - - - - - + +
      + +
      -  - -
      - -lastName){ - echo $user->firstName . " " . $user->lastName; - }else{ - echo $user->loginID; - } -?> - -
      settings->authModule == 'Y'){ echo "logout"; } ?> -
      -
      + + + + -
      + +
      + + + +
      + + + +
      + @@ -115,41 +332,41 @@ //only show the 'Change Module' if there are other modules installed or if there is an index to the main CORAL page $config = new Configuration(); -if ((file_exists($util->getCORALPath() . "index.php")) || ($config->settings->organizationsModule == 'Y') || ($config->settings->resourcesModule == 'Y') || ($config->settings->cancellationModule == 'Y') || ($config->settings->usageModule == 'Y')) { +if ((file_exists($util->getCORALPath() . "index.php")) || ($config->settings->organizationsModule == 'Y') || ($config->settings->resourcesModule == 'Y') || ($config->settings->managementModule == 'Y') || ($config->settings->usageModule == 'Y')) { ?>
        -
      •   +
        • getCORALPath() . "index.php")) {?> -
        • +
        • settings->organizationsModule == 'Y') { + if ($config->settings->resourcesModule == 'Y') { ?> -
        • +
        • settings->resourcesModule == 'Y') { + if ($config->settings->organizationsModule == 'Y') { ?> -
        • +
        • settings->cancellationModule == 'Y') { + if ($config->settings->usageModule == 'Y') { ?> -
        • +
        • settings->usageModule == 'Y') { + if ($config->settings->managementModule == 'Y') { ?> -
        • +
      -
      + diff --git a/terms_report.php b/terms_report.php index a67fae2..b5e1ec0 100644 --- a/terms_report.php +++ b/terms_report.php @@ -19,7 +19,7 @@ include_once 'directory.php'; -$pageTitle='Terms Report'; +$pageTitle=_('Terms Report'); include 'templates/header.php'; //set referring page diff --git a/user.php b/user.php index 0ea85cc..a8e71ca 100644 --- a/user.php +++ b/user.php @@ -55,6 +55,7 @@ $authURL = $util->getCORALURL() . "auth/" . $addURL . htmlentities($_SERVER['REQUEST_URI']); header('Location: ' . $authURL, true); + exit; //PREVENT SECURITY HOLE } @@ -105,6 +106,7 @@ //if the user doesn't exist in database we need to redirect them to a page to give instructions on how to be added if ($user->privilegeID == ""){ header('Location: not_available.php'); + exit; //PREVENT SECURITY HOLE } }