diff options
author | Frank Karlitschek <frank@owncloud.org> | 2013-01-21 20:40:23 +0100 |
---|---|---|
committer | Frank Karlitschek <frank@owncloud.org> | 2013-01-21 20:40:23 +0100 |
commit | a27f92a17ae12d2d1ff48b26aadfecd7c221c589 (patch) | |
tree | afe980f2b1eeaacefb38ebd8a431de62c2a3a009 /settings | |
parent | 51a4240051cf5c4225813b3f948dcc069b725c81 (diff) | |
download | nextcloud-server-a27f92a17ae12d2d1ff48b26aadfecd7c221c589.tar.gz nextcloud-server-a27f92a17ae12d2d1ff48b26aadfecd7c221c589.zip |
we are getting closer. updating is not working yet.
Diffstat (limited to 'settings')
-rw-r--r-- | settings/ajax/apps/ocs.php | 1 | ||||
-rw-r--r-- | settings/ajax/updateapp.php | 17 | ||||
-rw-r--r-- | settings/apps.php | 5 | ||||
-rw-r--r-- | settings/js/apps.js | 30 | ||||
-rw-r--r-- | settings/routes.php | 2 | ||||
-rw-r--r-- | settings/templates/apps.php | 4 |
6 files changed, 57 insertions, 2 deletions
diff --git a/settings/ajax/apps/ocs.php b/settings/ajax/apps/ocs.php index 1ffba26ad1d..6e09785d236 100644 --- a/settings/ajax/apps/ocs.php +++ b/settings/ajax/apps/ocs.php @@ -54,6 +54,7 @@ if(is_array($catagoryNames)) { 'preview'=>$pre, 'internal'=>false, 'internallabel'=>'3rd Party App', + 'update'=>false, ); } } diff --git a/settings/ajax/updateapp.php b/settings/ajax/updateapp.php new file mode 100644 index 00000000000..68c2bbf7f00 --- /dev/null +++ b/settings/ajax/updateapp.php @@ -0,0 +1,17 @@ +<?php + +OC_JSON::checkAdminUser(); +OCP\JSON::callCheck(); + +$appid = $_POST['appid']; + +$result = OC_Installer::updateApp($appid); +if($result !== false) { + OC_JSON::success(array('data' => array('appid' => $appid))); +} else { + $l = OC_L10N::get('settings'); + OC_JSON::error(array("data" => array( "message" => $l->t("Could update app. ") ))); +} + + + diff --git a/settings/apps.php b/settings/apps.php index 99a3094399d..a2015801e57 100644 --- a/settings/apps.php +++ b/settings/apps.php @@ -68,13 +68,16 @@ foreach ( $installedApps as $app ) { $info['internal']=true; $info['internallabel']='Internal App'; + + $info['update']=false; }else{ $info['internal']=false; $info['internallabel']='3rd Party App'; - + + $info['update']=OC_Installer::isUpdateAvailable($app); } $info['preview'] = OC_Helper::imagePath('settings', 'trans.png'); diff --git a/settings/js/apps.js b/settings/js/apps.js index c4c36b4bb12..8d214bd1145 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -24,6 +24,14 @@ OC.Settings.Apps = OC.Settings.Apps || { page.find('span.author').text(app.author); page.find('span.licence').text(app.licence); + if (app.update != false) { + page.find('input.update').show(); + page.find('input.update').data('appid', app.id); + page.find('input.update').attr('value',t('settings', 'Update to ')+app.update); + } else { + page.find('input.update').hide(); + } + page.find('input.enable').show(); page.find('input.enable').val((app.active) ? t('settings', 'Disable') : t('settings', 'Enable')); page.find('input.enable').data('appid', app.id); @@ -44,6 +52,7 @@ OC.Settings.Apps = OC.Settings.Apps || { appData = appitem.data('app'); appData.active = !active; appitem.data('app', appData); + element.val(t('settings','Please wait....')); if(active) { $.post(OC.filePath('settings','ajax','disableapp.php'),{appid:appid},function(result) { if(!result || result.status!='success') { @@ -70,6 +79,20 @@ OC.Settings.Apps = OC.Settings.Apps || { $('#leftcontent li[data-id="'+appid+'"]').addClass('active'); } }, + updateApp:function(appid, element) { + console.log('updateApp:', appid, element); + element.val(t('settings','Updateing....')); + $.post(OC.filePath('settings','ajax','updateapp.php'),{appid:appid},function(result) { + if(!result || result.status!='success') { + OC.dialogs.alert('Error while updating app','Error'); + } + else { + element.val(t('settings','Updated')); + element.hide(); + } + },'json'); + }, + insertApp:function(appdata) { var applist = $('#leftcontent li'); var app = @@ -154,6 +177,13 @@ $(document).ready(function(){ OC.Settings.Apps.enableApp(appid, active, element); } }); + $('#rightcontent input.update').click(function(){ + var element = $(this); + var appid=$(this).data('appid'); + if(appid) { + OC.Settings.Apps.updateApp(appid, element); + } + }); if(appid) { var item = $('#leftcontent li[data-id="'+appid+'"]'); diff --git a/settings/routes.php b/settings/routes.php index 9b5bf809230..fa78f566525 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -51,6 +51,8 @@ $this->create('settings_ajax_enableapp', '/settings/ajax/enableapp.php') ->actionInclude('settings/ajax/enableapp.php'); $this->create('settings_ajax_disableapp', '/settings/ajax/disableapp.php') ->actionInclude('settings/ajax/disableapp.php'); +$this->create('settings_ajax_updateapp', '/settings/ajax/updateapp.php') + ->actionInclude('settings/ajax/updateapp.php'); $this->create('settings_ajax_navigationdetect', '/settings/ajax/navigationdetect.php') ->actionInclude('settings/ajax/navigationdetect.php'); // admin diff --git a/settings/templates/apps.php b/settings/templates/apps.php index 179ce9c5405..8654547ecb3 100644 --- a/settings/templates/apps.php +++ b/settings/templates/apps.php @@ -7,7 +7,7 @@ var appid = '<?php echo $_['appid']; ?>'; </script> <div id="controls"> - <a class="button" target="_blank" href="http://owncloud.org/dev/apps/getting-started/"><?php echo $l->t('Add your App');?></a> + <a class="button" target="_blank" href="http://owncloud.org/dev"><?php echo $l->t('Add your App');?></a> <a class="button" target="_blank" href="http://apps.owncloud.com"><?php echo $l->t('More Apps');?></a> </div> <ul id="leftcontent" class="applist"> @@ -31,5 +31,7 @@ <p class="appslink hidden"><a href="#" target="_blank"><?php echo $l->t('See application page at apps.owncloud.com');?></a></p> <p class="license hidden"><?php echo $l->t('<span class="licence"></span>-licensed by <span class="author"></span>');?></p> <input class="enable hidden" type="submit" /> + <?php //if(isset($app['update']) ) echo('<input class="update " type="submit" value="'.$l->t('Update').' '.$app['update'].'" />'); ?> + <input class="update hidden" type="submit" value="<?php echo($l->t('Update')); ?>" /> </div> </div> |