Change app path logic in templates

This commit is contained in:
Brice Maron 2012-06-06 19:54:57 +00:00
parent 6a812644e4
commit 5c2b2fc842
5 changed files with 12 additions and 10 deletions

View file

@ -22,8 +22,8 @@
OCP\App::checkAppEnabled('contacts');
if(substr($_SERVER["REQUEST_URI"],0,strlen(OC::$APPSWEBROOT . '/apps/contacts/carddav.php')) == OC::$APPSWEBROOT . '/apps/contacts/carddav.php'){
$baseuri = OC::$APPSWEBROOT . '/apps/contacts/carddav.php';
if(substr($_SERVER["REQUEST_URI"],0,strlen(OC_App::getAppWebPath('contacts').'/carddav.php')) == OC_App::getAppWebPath('contacts').'/carddav.php'){
$baseuri = OC_App::getAppWebPath('contacts').'/carddav.php';
}
// only need authentication apps

View file

@ -31,7 +31,7 @@ t.cache={};
OC={
webroot:oc_webroot,
appswebroot:oc_appswebroot,
appswebroots:oc_appswebroots,
currentUser:(typeof oc_current_user!=='undefined')?oc_current_user:false,
coreApps:['', 'admin','log','search','settings','core','3rdparty'],
/**
@ -63,10 +63,8 @@ OC={
link+= file;
}
}else if(file.substring(file.length-3) != 'php' && !isCore){
link=OC.appswebroot;
link+='/';
link+='apps/';
link+=app+'/';
link=OC.appswebroots[app];
link+='/'+app+'/';
if(type){
link+=type+'/';
}

View file

@ -12,7 +12,7 @@
<?php endforeach; ?>
<script type="text/javascript">
var oc_webroot = '<?php echo OC::$WEBROOT; ?>';
var oc_appswebroot = '<?php echo OC::$APPSWEBROOT; ?>';
var oc_appswebroots = <?php echo $_['apps_paths'] ?>;
</script>
<?php if (!defined('DEBUG') || !DEBUG): ?>
<script type="text/javascript" src="<?php echo OC_Helper::linkToRemote('core.js', false) ?>"></script>

View file

@ -12,8 +12,7 @@
<?php endforeach; ?>
<script type="text/javascript">
var oc_webroot = '<?php echo OC::$WEBROOT; ?>';
var oc_appswebroot = '<?php //echo OC::$APPSWEBROOT; ?>';
// TODO: PATH
var oc_appswebroots = <?php echo $_['apps_paths'] ?>;
var oc_current_user = '<?php echo OC_User::getUser() ?>';
</script>
<?php if (!defined('DEBUG') || !DEBUG): ?>

View file

@ -383,6 +383,11 @@ class OC_Template{
}else{
$page = new OC_Template( "core", "layout.guest" );
}
$apps_paths = array();
foreach(OC_App::getEnabledApps() as $app){
$apps_paths[$app] = OC_App::getAppWebPath($app);
}
$page->assign( 'apps_paths', str_replace('\\/', '/',json_encode($apps_paths)) ); // Ugly unescape slashes waiting for better solution
// Read the selected theme from the config file
$theme=OC_Config::getValue( "theme" );