[geeklog-cvs] geeklog: Updated Polls plugin to use Scripts class

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Mar 12 15:41:12 EST 2011


changeset 8155:2062a881bc08
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/2062a881bc08
user: Tom <websitemaster at cogeco.net>
date: Sat Mar 12 15:38:08 2011 -0500
description:
Updated Polls plugin to use Scripts class

diffstat:

 plugins/polls/functions.inc                    |  14 +++++++-------
 plugins/polls/templates/admin/polleditor.thtml |   1 -
 public_html/admin/plugins/polls/index.php      |   4 +++-
 3 files changed, 10 insertions(+), 9 deletions(-)

diffs (55 lines):

diff -r bee903bf8c9b -r 2062a881bc08 plugins/polls/functions.inc
--- a/plugins/polls/functions.inc	Sat Mar 12 14:57:58 2011 -0500
+++ b/plugins/polls/functions.inc	Sat Mar 12 15:38:08 2011 -0500
@@ -1114,14 +1114,14 @@
 
 function plugin_getheadercode_polls()
 {
-    global $_CONF;
+    global $_SCRIPTS;
+    
+    // You normally only set the css file when needed but with the way the plugin was 
+    // written with COM_SiteHeader called right at the begininng of most pages 
+    // it is easier for now to set it all the time
+    $_SCRIPTS->setCSSFile('polls', '/polls/style.css');
+}
 
-    $str = null;
-    $str = LB . '<link rel="stylesheet" type="text/css" href="'
-        . $_CONF['site_url'] . '/polls/style.css"' . XHTML . '>';
-
-    return $str;
-}
 
 /**
 * Update the Polls plugin
diff -r bee903bf8c9b -r 2062a881bc08 plugins/polls/templates/admin/polleditor.thtml
--- a/plugins/polls/templates/admin/polleditor.thtml	Sat Mar 12 14:57:58 2011 -0500
+++ b/plugins/polls/templates/admin/polleditor.thtml	Sat Mar 12 15:38:08 2011 -0500
@@ -1,5 +1,4 @@
                                 <noscript><div class="pluginAlert" style="padding:10px;">{no_javascript_warning}</div></noscript>
-                                <script type="text/JavaScript" src="{site_url}/polls/polls_editor.js"></script>
                                 <form action="{site_admin_url}/plugins/polls/index.php" method="post">
                                     <table cellspacing="0" cellpadding="2" width="100%">
                                         <tr>
diff -r bee903bf8c9b -r 2062a881bc08 public_html/admin/plugins/polls/index.php
--- a/public_html/admin/plugins/polls/index.php	Sat Mar 12 14:57:58 2011 -0500
+++ b/public_html/admin/plugins/polls/index.php	Sat Mar 12 15:38:08 2011 -0500
@@ -346,7 +346,7 @@
 function editpoll ($pid = '')
 {
     global $_CONF, $_PO_CONF, $_GROUPS, $_TABLES, $_USER, $LANG25, $LANG_ACCESS,
-           $LANG_ADMIN, $MESSAGE, $LANG_POLLS;
+           $LANG_ADMIN, $MESSAGE, $LANG_POLLS, $_SCRIPTS;
 
     $retval = '';
 
@@ -426,6 +426,8 @@
         $T['commentcode'] = $_CONF['comment_code'];
         $access = 3;
     }
+    
+    $_SCRIPTS->setJavaScriptFile('polls_editor', '/polls/polls_editor.js');
 
     $poll_templates->set_var('lang_pollid', $LANG25[6]);
     $poll_templates->set_var('poll_id', $T['pid']);



More information about the geeklog-cvs mailing list