|
From: <al...@us...> - 2008-08-27 16:32:28
|
Revision: 649
http://sciret.svn.sourceforge.net/sciret/?rev=649&view=rev
Author: alpeb
Date: 2008-08-27 16:32:25 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
dropped prototype lib, and replaced all ajax calls with YUI's
Modified Paths:
--------------
trunk/javascript/general.js
trunk/templates/head.tpl
Modified: trunk/javascript/general.js
===================================================================
--- trunk/javascript/general.js 2008-08-27 16:31:18 UTC (rev 648)
+++ trunk/javascript/general.js 2008-08-27 16:32:25 UTC (rev 649)
@@ -14,13 +14,13 @@
* @see http://yuiblog.com/blog/2007/06/12/module-pattern/
*/
+/**
+ * Aliases definitions (functions, namespaces)
+ */
YAHOO.namespace("sciret");
SCIRET = YAHOO.sciret;
-// *********************************************************
-// ** jQuery initialization, to **
-// ** avoid conflicts with prototype **
-// *********************************************************
+// to avoid conflicts with YAHOO.tools' $ function
var $j = jQuery.noConflict();
// *********************************************************
@@ -136,39 +136,51 @@
}
}
- new Ajax.Updater( 'commentsDiv',
- 'index.php?action=AddCommentAndRating&artId='+artId+'&loadingId='+loadingId,
- { method : 'post',
- parameters : 'commentUserName='+userName+'&comment_box='+comment+'&Rate='+rate,
- evalScripts : true,
- onLoading : function() {showLoading(loadingId);},
- onComplete : function() {successAjax(loadingId)}});
+ showLoading(loadingId);
+ var transaction = YAHOO.util.Connect.asyncRequest('POST',
+ 'index.php?action=AddCommentAndRating&artId='+artId+'&loadingId='+loadingId,
+ {
+ success: commentOperationCompleted,
+ failure: function() {alert('operation failed')}
+ },
+ 'commentUserName='+userName+'&comment_box='+comment+'&Rate='+rate);
}
+function commentOperationCompleted(responseObj) {
+ $('commentsDiv').innerHTML = responseObj.responseText;
+}
+
function publishComment(commentId, loadingId) {
- new Ajax.Updater( 'commentsDiv',
- 'index.php?action=PublishComment&artId='+artId+'&commentId='+commentId+'&loadingId='+loadingId,
- { method : 'post',
- evalScripts : true,
- onLoading : function() {showLoading(loadingId);},
- onComplete : function() {successAjax(loadingId)}});
+ showLoading(loadingId);
+ var transaction = YAHOO.util.Connect.asyncRequest('POST',
+ 'index.php?action=PublishComment&artId='+artId+'&commentId='+commentId+'&loadingId='+loadingId,
+ {
+ success: commentOperationCompleted,
+ failure: function() {alert('operation failed')}
+ },
+ null);
}
function deleteComment(commentId, loadingId) {
- new Ajax.Updater( 'commentsDiv',
- 'index.php?action=DeleteComment&artId='+artId+'&commentId='+commentId+'&loadingId='+loadingId,
- { method : 'post',
- evalScripts : true,
- onLoading : function() {showLoading(loadingId);},
- onComplete : function() {successAjax(loadingId)}});
+ showLoading(loadingId);
+ var transaction = YAHOO.util.Connect.asyncRequest('POST',
+ 'index.php?action=DeleteComment&artId='+artId+'&commentId='+commentId+'&loadingId='+loadingId,
+ {
+ success: commentOperationCompleted,
+ failure: function() {alert('operation failed')}
+ },
+ null);
}
function publishArticle(loadingId, referrer, articleId) {
articleId = articleId || artId;
- new Ajax.Request( 'index.php?action=PublishArticle&artId='+articleId,
- { method : 'post',
- onLoading : function() {showLoading(loadingId);},
- onComplete : function(response) {publishArticleCompleted(response, loadingId, articleId)}});
+ var transaction = YAHOO.util.Connect.asyncRequest('POST',
+ 'index.php?action=PublishArticle&artId='+articleId,
+ {
+ success: function(response) {publishArticleCompleted(response, loadingId, articleId)},
+ failure: function() {alert('operation failed')}
+ },
+ null);
}
function publishArticleCompleted(responseObj, loadingId, articleId) {
@@ -194,26 +206,33 @@
return;
}
- new Ajax.Updater( 'relatedArticlesDiv',
- 'index.php?action=AddRelatedArticles&parentId='+parentId+'&parentType=' + parentType + '&loadingId='+loadingId,
- { method : 'post',
- parameters : 'related_articles='+relatedArticles,
- evalScripts : true,
- onLoading : function() {showLoading(loadingId)},
- onComplete : function() {successAjax(loadingId)}
- });
+ showLoading(loadingId);
+ var transaction = YAHOO.util.Connect.asyncRequest('POST',
+ 'index.php?action=AddRelatedArticles&parentId='+parentId+'&parentType=' + parentType + '&loadingId='+loadingId,
+ {
+ success: function (response) {submitRelatedArticlesCompleted(response, loadingId)},
+ failure: function() {alert('operation failed')}
+ },
+ 'related_articles='+relatedArticles);
}
+function submitRelatedArticlesCompleted(responseObj, loadingId) {
+ successAjax(loadingId);
+ $('relatedArticlesDiv').innerHTML = responseObj.responseText;
+ fade('relatedArtsMessage');
+}
+
function markAsFinal(loadingId, articleId) {
articleId = articleId || artId;
- new Ajax.Request(
- 'index.php?action=MarkArticleFinal&artId=' + articleId,
- {
- method : 'post',
- onLoading : function() {showLoading(loadingId)},
- onComplete : function(response) {markAsFinalCompleted(response, loadingId, articleId)}
- }
- );
+
+ showLoading(loadingId);
+ var transaction = YAHOO.util.Connect.asyncRequest('POST',
+ 'index.php?action=MarkArticleFinal&artId=' + articleId,
+ {
+ success: function(response) {markAsFinalCompleted(response, loadingId, articleId)},
+ failure: function() {alert('operation failed')}
+ },
+ null);
}
function markAsFinalCompleted(responseObj, loadingId, articleId) {
@@ -342,17 +361,14 @@
$('favoriteStarImg').style.display = 'none';
$('unFavoriteStarImg').style.display = 'none';
- new Ajax.Request(
- 'index.php?action=' + action,
- {
- method : 'post',
- parameters : 'artId=' + artId + '&favorite=' + favorite + '&query=' + query + '&catId=' + catId,
- onLoading : function() {
- $('favoriteProgressImg').style.display = 'inline';
- },
- onComplete : completedFavoriteArticle
- }
- );
+ $('favoriteProgressImg').style.display = 'inline';
+ var transaction = YAHOO.util.Connect.asyncRequest('POST',
+ 'index.php?action=' + action,
+ {
+ success: completedFavoriteArticle,
+ failure: function() {alert('operation failed')}
+ },
+ 'artId=' + artId + '&favorite=' + favorite + '&query=' + query + '&catId=' + catId);
}
function completedFavoriteArticle(responseObj) {
@@ -427,14 +443,13 @@
$('todoCheck_' + todoId).style.display = 'none';
$('todoProgressImg_' + todoId).style.display = 'inline';
- new Ajax.Request(
- 'index.php?action=CompleteTodo',
- {
- method : 'post',
- parameters : 'todoId=' + todoId,
- onComplete : function (response) {successAjax('todoProgressImg_' + todoId), completeTickTodo(response, todoId)}
- }
- );
+ var transaction = YAHOO.util.Connect.asyncRequest('POST',
+ 'index.php?action=CompleteTodo',
+ {
+ success: function (response) {successAjax('todoProgressImg_' + todoId), completeTickTodo(response, todoId)},
+ failure: function() {alert('operation failed')}
+ },
+ 'todoId=' + todoId);
}
function completeTickTodo(responseObj, todoId) {
Modified: trunk/templates/head.tpl
===================================================================
--- trunk/templates/head.tpl 2008-08-27 16:31:18 UTC (rev 648)
+++ trunk/templates/head.tpl 2008-08-27 16:32:25 UTC (rev 649)
@@ -16,6 +16,7 @@
<![endif]->
<!-- basic YUI libraries -->
<script type="text/javascript" src="javascript/yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
+ <script type="text/javascript" src="javascript/tools-min.js"></script>
<script type="text/javascript" src="javascript/yui/build/container/container_core-min.js"></script>
<script type="text/javascript" src="javascript/yui/build/element/element-beta-min.js"></script>
<script type="text/javascript" src="javascript/yui/build/dragdrop/dragdrop-min.js"></script>
@@ -24,14 +25,12 @@
<script type="text/javascript" src="javascript/yui/build/connection/connection-min.js"></script>
<script type="text/javascript" src="javascript/yui/build/logger/logger-min.js"></script>
<!-- required by effects.js -->
- <script type="text/javascript" src="javascript/tools-min.js"></script>
<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/simModal.js"></script>
<script type="text/javascript" src="javascript/overlib.js"></script>
- <script type="text/javascript" src="javascript/scriptaculous/lib/prototype.js"></script>
<style type="text/css">@import url(javascript/jscalendar/calendar-blue.css);</style>
<script type="text/javascript" src="javascript/jscalendar/calendar.js"></script>
<script type="text/javascript" src="javascript/jscalendar/lang/calendar-en.js"></script>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|