|
From: <al...@us...> - 2008-10-24 00:21:59
|
Revision: 761
http://sciret.svn.sourceforge.net/sciret/?rev=761&view=rev
Author: alpeb
Date: 2008-10-24 00:21:54 +0000 (Fri, 24 Oct 2008)
Log Message:
-----------
Optimized js lib loading, through the YUI loader facilities. Also added entry in config.ini.php, to allow downloading those libs from YDN.
Modified Paths:
--------------
trunk/classes/Controller.php
trunk/config.ini.php
trunk/flowMap.php
trunk/templates/EditArticle.tpl
trunk/templates/MainView.tpl
trunk/templates/TodosDropdown.tpl
trunk/templates/footer.tpl
trunk/templates/head.tpl
trunk/views/View.php
Modified: trunk/classes/Controller.php
===================================================================
--- trunk/classes/Controller.php 2008-10-24 00:19:17 UTC (rev 760)
+++ trunk/classes/Controller.php 2008-10-24 00:21:54 UTC (rev 761)
@@ -68,6 +68,7 @@
require "views/$view.php";
$obj = new $view($this->user, $this->configuration);
$obj->setTemplate(new KB_Template('templates', $this->user));
+ $obj->setYUIVars();
$obj->preDispatch();
if ($this->views[$view][SHOW_HEAD]) {
$obj->setHTMLHeader($this->views[$view][SHOW_HEADER]);
Modified: trunk/config.ini.php
===================================================================
--- trunk/config.ini.php 2008-10-24 00:19:17 UTC (rev 760)
+++ trunk/config.ini.php 2008-10-24 00:21:54 UTC (rev 761)
@@ -5,6 +5,7 @@
array (
'session_name' => 'SCIRET',
'production' => true,
+ 'YDN' => true,
'loglevel' => 0,
),
'general' =>
@@ -25,4 +26,4 @@
),
);
-?>
\ No newline at end of file
+?>
Modified: trunk/flowMap.php
===================================================================
--- trunk/flowMap.php 2008-10-24 00:19:17 UTC (rev 760)
+++ trunk/flowMap.php 2008-10-24 00:21:54 UTC (rev 761)
@@ -42,7 +42,7 @@
'ViewRelatedArticles' => array(User::ROLE_ANONYMOUS, true, true, false, true),
'GetFavoritesDropdown' => array(User::ROLE_REGISTERED, true, true, false),
'ViewAllFavorites' => array(User::ROLE_REGISTERED, true, true, true, false),
- 'GetTodosDropdown' => array(User::ROLE_REGISTERED, true, true, false),
+ 'GetTodosDropdown' => array(User::ROLE_REGISTERED, true, false, false),
'EditTodo' => array(User::ROLE_REGISTERED, true, false, false),
'Upgrade' => array(User::ROLE_ANONYMOUS, true, true, true, false),
'UpgradeOk' => array(User::ROLE_ANONYMOUS, true, true, true, false),
Modified: trunk/templates/EditArticle.tpl
===================================================================
--- trunk/templates/EditArticle.tpl 2008-10-24 00:19:17 UTC (rev 760)
+++ trunk/templates/EditArticle.tpl 2008-10-24 00:21:54 UTC (rev 761)
@@ -8,15 +8,6 @@
* @packager TheGang
*/
-->
-
-<!-- Needed for resizing ability -->
-<link rel="stylesheet" type="text/css" href="javascript/yui/assets/skins/sam/resize.css">
-<script type="text/javascript" src="javascript/yui/resize/resize-beta-min.js"></script>
-<!-- Needed for Menus, Buttons and Overlays used in the Toolbar -->
-<script type="text/javascript" src="javascript/yui/menu/menu-min.js"></script>
-<!-- Source file for Rich Text Editor-->
-<script src="javascript/yui/editor/editor-min.js"></script>
-
<h1>
<!-- BEGIN addArticleTitle_block -->
[l]Add Article[/l]
@@ -107,10 +98,6 @@
<tr>
<td colspan="2">
<textarea name="text_content" id="text_content" style="width: 100%; height:350px; margin:0; border:0">{textareaContent}</textarea>
- <script>
- // can't make editor bigger, or else problem under IE
- SCIRET.editor.init('100%','350px', 'text_content');
- </script>
</td>
</tr>
<tr class="th">
@@ -125,7 +112,7 @@
</td>
</tr>
<!-- BEGIN saveAsDraftButton_block -->
- <tr>
+ <tr>
<td colspan="2" class="td_submit">
<input type="button" value="[l]Save as Draft[/l]" onclick="saveDraft(form);" />
</td>
@@ -135,11 +122,19 @@
</form>
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function() {
- YAHOO.util.Event.addListener($("expDateButton"),
- "click",
- showArticleCalendar);
- });
+ SCIRET.loader.insert(
+ ["resize", "menu", "editor", "calendar"],
+ function() {
+ YAHOO.util.Event.addListener($("expDateButton"),
+ "click",
+ showArticleCalendar);
+ // can't make editor bigger, or else problem under IE
+ SCIRET.editor.init('100%','350px', 'text_content');
+ }
+ );
+ });
+
function showArticleCalendar() {
var cal = new YAHOO.widget.Calendar("expirationCalContainer", {
close: true
@@ -175,5 +170,4 @@
return true;
}
-
</script>
Modified: trunk/templates/MainView.tpl
===================================================================
--- trunk/templates/MainView.tpl 2008-10-24 00:19:17 UTC (rev 760)
+++ trunk/templates/MainView.tpl 2008-10-24 00:21:54 UTC (rev 761)
@@ -9,15 +9,16 @@
*/
-->
+<!-- only core css because we have our own skin in style.css -->
+<link rel="stylesheet" type="text/css" href="{YUILocation}tabview/assets/tabview-core.css">
+<script type="text/javascript" src="{YUILocation}tabview/tabview-min.js"></script>
<script type="text/javascript">
- YAHOO.util.Event.onDOMReady(function() {
- var mainViewTabs = new YAHOO.widget.TabView(
- "mainViewTabs"
- //,{activeIndex: {activeTabIndex}} Broken in YUI 2.6.0
- );
- });
+ var mainViewTabs = new YAHOO.widget.TabView(
+ "mainViewTabs"
+ //,{activeIndex: {activeTabIndex}} Broken in YUI 2.6.0. Gotta use class="selected" instead
+ );
</script>
-<div id="mainViewTabs" >
+<div id="mainViewTabs">
<ul class="yui-nav">
<li class="{selectedCategoriesTab}">
<a href="#categories"><em>[l]Categories[/l]</em></a>
Modified: trunk/templates/TodosDropdown.tpl
===================================================================
--- trunk/templates/TodosDropdown.tpl 2008-10-24 00:19:17 UTC (rev 760)
+++ trunk/templates/TodosDropdown.tpl 2008-10-24 00:21:54 UTC (rev 761)
@@ -47,3 +47,6 @@
<img id="editTodoProgressImg_0" src="images/progress.gif" style="visibility:hidden" />
</p>
</div>
+<script type="text/javascript">
+ SCIRET.loader.insert(["container"], null);
+</script>
Modified: trunk/templates/footer.tpl
===================================================================
--- trunk/templates/footer.tpl 2008-10-24 00:19:17 UTC (rev 760)
+++ trunk/templates/footer.tpl 2008-10-24 00:21:54 UTC (rev 761)
@@ -139,5 +139,15 @@
<p>Copyright (C) 2005-2008 Keyboard Monkeys Ltd. Community as a service (TM)</p>
</div>
+<script type="text/javascript" src="javascript/tools-min.js"></script>
+<script type="text/javascript" src="javascript/effects-min.js"></script>
+<script type="text/javascript" src="javascript/jquery.js"></script>
+<script type="text/javascript" src="javascript/general.js"></script>
+<script type="text/javascript">
+ SCIRET.loader.combine = {YUILoaderCombine};
+ SCIRET.loader.base = "{YUILocation}";
+</script>
+<script type="text/javascript" src="javascript/overlib.js"></script>
+
</body>
</html>
Modified: trunk/templates/head.tpl
===================================================================
--- trunk/templates/head.tpl 2008-10-24 00:19:17 UTC (rev 760)
+++ trunk/templates/head.tpl 2008-10-24 00:21:54 UTC (rev 761)
@@ -4,37 +4,11 @@
<head>
<title>[l]Knowledge Base[/l]</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
- <link rel="stylesheet" type="text/css" href="javascript/yui/assets/skins/sam/skin.css">
- <link type="text/css" rel="stylesheet" href="javascript/yui/logger/assets/skins/sam/logger.css">
- <link rel="stylesheet" type="text/css" href="javascript/yui/container/assets/skins/sam/container.css">
- <link rel="stylesheet" type="text/css" href="javascript/yui/calendar/assets/skins/sam/calendar.css">
+
<link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8"/>
<!--[if IE 6]><link rel="stylesheet" href="style_ie6.css" type="text/css" media="screen" charset="utf-8"><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="style_ie7.css" type="text/css" media="screen" charset="utf-8"><![endif]-->
<link href="others.css" type="text/css" rel="StyleSheet" />
- <script type="text/javascript">var isIE7 = false;</script>
- <!--[if IE 7]>
- <script type="text/javascript">isIE7 = true;</script>
- <![endif]-->
- <!-- basic YUI libraries -->
- <script type="text/javascript" src="javascript/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
- <script type="text/javascript" src="javascript/yui/connection/connection.js"></script>
- <script type="text/javascript" src="javascript/tools-min.js"></script>
- <script type="text/javascript" src="javascript/yui/element/element-beta-min.js"></script>
- <script type="text/javascript" src="javascript/yui/dragdrop/dragdrop-min.js"></script>
- <script type="text/javascript" src="javascript/yui/container/container.js"></script>
- <script type="text/javascript" src="javascript/yui/animation/animation-min.js"></script>
- <script type="text/javascript" src="javascript/yui/button/button-min.js"></script>
- <script type="text/javascript" src="javascript/yui/calendar/calendar-min.js"></script>
- <script type="text/javascript" src="javascript/yui/logger/logger-min.js"></script>
- <script type="text/javascript" src="javascript/yui/json/json-min.js"></script>
- <script type="text/javascript" src="javascript/yui/tabview/tabview-min.js"></script>
- <!-- required by effects.js -->
- <script type="text/javascript" src="javascript/effects-min.js"></script>
-
- <script src="javascript/jquery.js" type="text/javascript" charset="utf-8"></script>
- <script type="text/javascript" src="javascript/general.js"></script>
- <script type="text/javascript" src="javascript/overlib.js"></script>
<!-- BEGIN rtl_block -->
<style>
input, textarea {
@@ -42,10 +16,21 @@
}
</style>
<!-- END rtl_block -->
-</head>
-<body class="yui-skin-sam">
+
+ <script type="text/javascript" src="{YUILocation}utilities/utilities.js"></script>
<script type="text/javascript">
- // var myLogReader = new YAHOO.widget.LogReader();
+ var isIE7 = false;
</script>
+ <!--[if IE 7]>
+ <script type="text/javascript">isIE7 = true;</script>
+ <![endif]-->
+
+
+
+<!-- <script type="text/javascript" src="javascript/yui/json/json-min.js"></script> -->
+
+</head>
+<body class="yui-skin-sam">
+ <!-- <script type="text/javascript">var myLogReader = new YAHOO.widget.LogReader();</script>-->
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<div id="todoDialog" style="display:none"></div>
Modified: trunk/views/View.php
===================================================================
--- trunk/views/View.php 2008-10-24 00:19:17 UTC (rev 760)
+++ trunk/views/View.php 2008-10-24 00:21:54 UTC (rev 761)
@@ -12,8 +12,8 @@
require 'classes/kb_template.php';
require_once 'models/ArticleGateway.php';
-class View {
-
+abstract class View
+{
var $tpl;
var $user;
var $configuration;
@@ -40,7 +40,25 @@
$this->tpl =& $tpl;
}
- function setHTMLHeader($showHeader) {
+ public function setYUIVars()
+ {
+ if (Zend_Registry::get('config')->environment->YDN) {
+ $this->tpl->set_var(array(
+ 'YUILocation' => 'http://yui.yahooapis.com/2.6.0/build/',
+ 'YUILoaderCombine' => 'true',
+ ));
+ } else {
+ // the combiner is only available when using YDN
+ $this->tpl->set_var(array(
+ 'YUILocation' => 'javascript/yui/',
+ 'YUILoaderCombine' => 'false',
+ ));
+ }
+
+ }
+
+ function setHTMLHeader($showHeader)
+ {
$this->tpl->set_file('head', 'head.tpl');
$this->tpl->set_file('footer', 'footer.tpl');
$this->tpl->set_block('head', 'rtl_block', 'rtl');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|