mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 05:37:32 +02:00
Javascript CDN framework options added to admin -> prefs. (mostly for testing)
This commit is contained in:
@@ -1102,7 +1102,7 @@ $text .= "
|
||||
</fieldset>
|
||||
";
|
||||
|
||||
// Javascripts
|
||||
// Javascript Control
|
||||
//TODO LANS
|
||||
$text .= "
|
||||
<fieldset class='e-hideme' id='core-prefs-javascript'>
|
||||
@@ -1114,20 +1114,38 @@ $text .= "
|
||||
</colgroup>
|
||||
<tbody>";
|
||||
|
||||
$js_options = array('admin'=>'Admin Area','front'=>'Front-End','all'=>"Both");
|
||||
$js_options = array('admin'=>'Admin Area','front'=>'Front-End','all'=>"Both", 'none'=> 'Disabled');
|
||||
|
||||
|
||||
//TODO FIXME - remove JS framework dependency from front-end and backend.
|
||||
// ie. no JS errors when prototype.js is completely disabled.
|
||||
// no JS error with only 'e107 Core Minimum' is enabled.
|
||||
// e107 Core Minimum should function independently of framework.
|
||||
// ie. e107 Core Minimum: JS similar to e107 v1.0 should be loaded "e_js.php" (no framwork dependency)
|
||||
// with basic functions like SyncWithServerTime() and expandit(), externalLinks() etc.
|
||||
|
||||
//TODO Move paths into js_manager and store only keys like 'prototype-local', 'core-minimum' in prefs.
|
||||
|
||||
$js_types = array(
|
||||
'prototype/prototype.js' ,
|
||||
'scriptaculous/scriptaculous.js',
|
||||
'scriptaculous/effects.js',
|
||||
'e107.js.php'
|
||||
array('name'=> 'Prototype (local)', 'path'=> 'prototype/prototype.js') ,
|
||||
array('name'=> 'Scriptaculous (local)', 'path'=> 'scriptaculous/scriptaculous.js'),
|
||||
array('name'=> 'Scriptaculous-effects (local)', 'path'=> 'scriptaculous/effects.js'),
|
||||
array('name'=> 'Prototype (CDN)', 'path'=> 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js'),
|
||||
array('name'=> 'Scriptaculous + Effects (CDN)', 'path'=> 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js?load=effects'),
|
||||
array('name'=> 'jQuery (CDN)', 'path'=> 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'),
|
||||
array('name'=> 'jQuery UI (CDN)', 'path'=> 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js'),
|
||||
array('name'=> 'e107 Core Minimum', 'path'=> 'e107.js.php'),
|
||||
array('name'=> 'e107 Plugin Scripts (TO-DO)', 'path'=> ''), // all js that has been added by Plugins.
|
||||
array('name'=> 'e107 Theme Scripts (TO-DO)', 'path'=> ''), // all js that has been added by Themes.
|
||||
);
|
||||
|
||||
foreach($js_types as $k)
|
||||
|
||||
foreach($js_types as $arr)
|
||||
{
|
||||
$k = $arr['path'];
|
||||
$name = $arr['name'];
|
||||
$text .= "<tr>
|
||||
<td>".$k."</td>
|
||||
<td>".$name."</td>
|
||||
<td>".$frm->radio_multi("e_jslib_core[{$k}]",$js_options,$pref['e_jslib_core'][$k])."</td>
|
||||
</tr>";
|
||||
}
|
||||
|
@@ -175,7 +175,11 @@ class e_jsmanager
|
||||
$this->setCacheId(deftrue('e_NOCACHE') ? time() : e107::getPref('e_jslib_browser_cache'));
|
||||
|
||||
// Load stored in preferences core lib paths ASAP - FIXME - find better way to store libs - array structure and separate table row
|
||||
|
||||
$core_libs = e107::getPref('e_jslib_core');
|
||||
|
||||
|
||||
|
||||
if(!$core_libs)
|
||||
{
|
||||
$core_libs = array();
|
||||
@@ -516,16 +520,35 @@ class e_jsmanager
|
||||
* @see footerInline()
|
||||
* @param string $type core|plugin - jslib.php, header|footer|header_inline|footer_inline|core_css|plugin_css|theme_css|other_css|inline_css - runtime
|
||||
* @param string|array $file_path
|
||||
* @param string|integer $runtime_location admin|front|all (jslib), 0-5 (runtime inclusion), 'media' attribute (CSS)
|
||||
* @param string|integer $runtime_location admin|front|all|none (jslib), 0-5 (runtime inclusion), 'media' attribute (CSS)
|
||||
* @return object $this
|
||||
*/
|
||||
protected function addJs($type, $file_path, $runtime_location = '', $pre = '', $post = '')
|
||||
{
|
||||
// TODO FIXME - remove JS framework dependency from front-end and backend.
|
||||
// ie. no JS errors when prototype.js is completely disabled.
|
||||
// no JS error with only 'e107 Core Minimum' is enabled.
|
||||
// e107 Core Minimum should function independently of framework.
|
||||
// ie. e107 Core Minimum: JS similar to e107 v1.0 should be loaded "e_js.php" (no framwork dependency)
|
||||
// with basic functions like SyncWithServerTime() and expandit(), externalLinks() etc.
|
||||
|
||||
|
||||
if(empty($file_path))
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
if($type == 'core' && ($runtime_location == 'none')) // disabled core js library
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
if($type == 'core' && substr($file_path,0,4)=='http' ) // Core using CDN.
|
||||
{
|
||||
$type = 'header';
|
||||
$runtime_location = 1;
|
||||
}
|
||||
|
||||
// FIXME - this could break something after CSS support was added, move it to separate method(s), recursion by type!
|
||||
if(is_array($file_path))
|
||||
{
|
||||
|
Reference in New Issue
Block a user