Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/controllers/components/developers.php
diff options
context:
space:
mode:
Diffstat (limited to 'site/app/controllers/components/developers.php')
-rw-r--r--site/app/controllers/components/developers.php98
1 files changed, 16 insertions, 82 deletions
diff --git a/site/app/controllers/components/developers.php b/site/app/controllers/components/developers.php
index ceb24f8..35becf1 100644
--- a/site/app/controllers/components/developers.php
+++ b/site/app/controllers/components/developers.php
@@ -231,11 +231,6 @@ class DevelopersComponent extends Object {
function detectAddontype($file) {
$extension = substr($file['name'], strrpos($file['name'], '.'));
switch ($extension) {
- case '.xo':
- case '.xol':
- return ADDON_EXTENSION;
- break;
-
case '.xpi':
// Dictionaries have a .dic file in the dictionaries directory
$zip = new Archive_Zip($file['tmp_name']);
@@ -257,6 +252,14 @@ class DevelopersComponent extends Object {
case '.xml':
return ADDON_SEARCH;
break;
+
+ case '.xo':
+ return ADDON_ACTIVITY;
+ break;
+
+ case '.xol':
+ return ADDON_CONTENT;
+ break;
default:
return 0;
@@ -476,7 +479,9 @@ class DevelopersComponent extends Object {
*/
function getAllowedExtensions($addontype) {
switch ($addontype) {
- case ADDON_EXTENSION: $allowed = array('.xo', '.xol');
+ case ADDON_ACTIVITY: $allowed = array('.xo');
+ break;
+ case ADDON_CONTENT: $allowed = array('.xol');
break;
case ADDON_EXTENSION: $allowed = array('.xpi');
break;
@@ -1166,6 +1171,11 @@ class DevelopersComponent extends Object {
ADDON_DICT => $this->controller->Addontype->getName(ADDON_DICT),
ADDON_LPAPP => $this->controller->Addontype->getName(ADDON_LPAPP)
);
+
+ global $app_listedtypes;
+ foreach ($app_listedtypes[APP_SUGAR] as $type) {
+ $addontypes[$type] = $this->controller->Addontype->getName($type);
+ }
if ($autoDetect == true) {
$addontypes[0] = _('devcp_additem_addontype_autodetect');
@@ -1179,81 +1189,5 @@ class DevelopersComponent extends Object {
return $addontypes;
}
-
- function getLicenses($version_id=null) {
- if ($version_id != null) {
- $version = $this->controller->Version->findById($version_id);
- $version = $version['Version'];
- $license = $this->controller->License->findById($version['license_id']);
- }
-
- // Add 'Please Choose...' only if no license has been selected.
- if (!isset($version['license_id'])) {
- $licenses['null'] = array(
- 'name' => ___('devcp_uploader_please_choose'),
- 'selected' => True);
- }
-
- // Grab all the pre-approved licenses.
- foreach ($this->controller->License->getNames() as $num => $builtin) {
- $licenses['builtin_'.$num] = array(
- 'name' => $builtin,
- 'selected' => isset($license) && (string)$num === $license['License']['name']);
- }
-
- // The trans array holds translations for all the custom licenses we'll
- // be displaying. `other` starts off empty, for creating new licenses.
- $trans['other']['text']['en-US'] = '';
-
- if ($version_id != null) {
- // Find all the custom licenses in use by this add-on.
- $q = "SELECT Version.version, Version.license_id
- FROM versions AS Version INNER JOIN licenses AS License
- ON Version.license_id = License.id
- WHERE Version.addon_id = {$version['addon_id']}
- AND Version.license_id IS NOT NULL
- AND License.name = -1
- GROUP BY License.id
- ORDER BY Version.id DESC";
- foreach ($this->controller->Version->execute($q) as $existing) {
- $existing = $existing['Version'];
- $t = ___('devcp_license_existing');
- $val = 'existing_'.$existing['license_id'];
- $licenses[$val] = array(
- 'name' => sprintf($t, $version['addon_id'], $existing['version']),
- 'selected' => $existing['license_id'] == $version['license_id']);
- $trans[$val] = $this->controller->License->getAllTranslations($existing['license_id']);
- }
- }
-
- $licenses['other'] = array('name' => ___('devcp_uploader_option_other'),
- 'selected' => False);
- return array($licenses, $trans);
- }
-
- function saveLicense($licenseData, $text, $params) {
- $License = $this->controller->License;
- if ($licenseData['name'] != 'null') {
- $license = $licenseData['name'];
- // If the license is pre-approved, we prefixed the id with builtin_.
- if (preg_match('/^builtin_(\d+)$/', $license, $matches)) {
- $license_id = $License->getBuiltin($matches[1]);
- } else if ($license == 'other' ||
- preg_match('/^existing_(\d+)$/', $license, $matches)) {
- // If it's 'other', we need to create a new license.
- if ($license == 'other') {
- $data['License']['name'] = -1;
- $License->save($data);
- $license_id = $License->getLastInsertId();
- } else {
- $license_id = $matches[1];
- }
- // Save any changed translation text.
- $localized['text'] = $text;
- $License->saveTranslations($license_id, $params, $localized);
- }
- return $license_id;
- }
- }
}
?>