[geeklog-hg] geeklog: Updated Polls Plugin to Version 2.1.4. Now uses standar...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Feb 19 10:15:12 EST 2015


changeset 9578:4677305ad945
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/4677305ad945
user: Tom
date: Thu Feb 19 10:07:43 2015 -0500
description:
Updated Polls Plugin to Version 2.1.4. Now uses standardized template and css file location functions

diffstat:

 plugins/polls/autoinstall.php                                |   6 +-
 plugins/polls/functions.inc                                  |  37 +-----
 plugins/polls/templates/admin/pollansweroption.thtml         |   9 -
 plugins/polls/templates/admin/polleditor.thtml               |  66 ---------
 plugins/polls/templates/admin/pollquestions.thtml            |  15 --
 plugins/polls/templates/default/admin/pollansweroption.thtml |   9 +
 plugins/polls/templates/default/admin/polleditor.thtml       |  66 +++++++++
 plugins/polls/templates/default/admin/pollquestions.thtml    |  15 ++
 plugins/polls/templates/default/pollanswer.thtml             |   5 +
 plugins/polls/templates/default/pollblock.thtml              |  18 ++
 plugins/polls/templates/default/pollcomments.thtml           |   5 +
 plugins/polls/templates/default/polllist.thtml               |   5 +
 plugins/polls/templates/default/pollquestion.thtml           |  10 +
 plugins/polls/templates/default/pollquestions.thtml          |  10 +
 plugins/polls/templates/default/pollresult.thtml             |   9 +
 plugins/polls/templates/default/pollvotes_bar.thtml          |  15 ++
 plugins/polls/templates/default/pollvotes_num.thtml          |   8 +
 plugins/polls/templates/pollanswer.thtml                     |   5 -
 plugins/polls/templates/pollblock.thtml                      |  18 --
 plugins/polls/templates/pollcomments.thtml                   |   5 -
 plugins/polls/templates/polllist.thtml                       |   5 -
 plugins/polls/templates/pollquestion.thtml                   |  10 -
 plugins/polls/templates/pollquestions.thtml                  |  10 -
 plugins/polls/templates/pollresult.thtml                     |   9 -
 plugins/polls/templates/pollvotes_bar.thtml                  |  15 --
 plugins/polls/templates/pollvotes_num.thtml                  |   8 -
 public_html/admin/plugins/polls/index.php                    |   3 +-
 public_html/polls/css/default/style.css                      |  80 ++++++++++++
 public_html/polls/style.css                                  |  80 ------------
 29 files changed, 264 insertions(+), 292 deletions(-)

diffs (truncated from 724 to 300 lines):

diff -r d2ad6a1f6a74 -r 4677305ad945 plugins/polls/autoinstall.php
--- a/plugins/polls/autoinstall.php	Thu Feb 19 10:06:22 2015 -0500
+++ b/plugins/polls/autoinstall.php	Thu Feb 19 10:07:43 2015 -0500
@@ -52,7 +52,7 @@
         'pi_name'         => $pi_name,
         'pi_display_name' => $pi_display_name,
         'pi_version'      => '2.1.6',
-        'pi_gl_version'   => '2.1.0',
+        'pi_gl_version'   => '2.1.1',
         'pi_homepage'     => 'http://www.geeklog.net/'
     );
 
@@ -163,6 +163,10 @@
     if (! function_exists('SEC_loginRequiredForm')) {
         return false;
     }
+    
+    if (! function_exists('CTL_plugin_templatePath')) {
+        return false;
+    }    
 
     return true;
 }
diff -r d2ad6a1f6a74 -r 4677305ad945 plugins/polls/functions.inc
--- a/plugins/polls/functions.inc	Thu Feb 19 10:06:22 2015 -0500
+++ b/plugins/polls/functions.inc	Thu Feb 19 10:07:43 2015 -0500
@@ -422,36 +422,6 @@
 }
 
 /**
-* Get path for the template files.
-*
-* @param    string  $path   subdirectory within the base template path
-* @return   string          full path to template directory
-*
-*/
-function polls_templatePath ($path = '')
-{
-    global $_CONF;
-
-    if (empty ($path)) {
-        $layout_path = $_CONF['path_layout'] . polls;
-    } else {
-        $layout_path = $_CONF['path_layout'] . polls . '/' . $path;
-    }
-
-    if (is_dir ($layout_path)) {
-        $retval = $layout_path;
-    } else {
-        $retval = $_CONF['path'] . 'plugins/polls/templates';
-        if (!empty ($path)) {
-            $retval .= '/' . $path;
-        }
-    }
-
-    return $retval;
-}
-
-
-/**
 * Shows a poll form
 *
 * Shows an HTML formatted poll for the given topic ID
@@ -492,8 +462,7 @@
             $nquestions = DB_numRows($questions );
 
             if ($nquestions > 0) {
-                $poll = COM_newTemplate($_CONF['path']
-                                     . 'plugins/polls/templates/');
+                $poll = COM_newTemplate(CTL_plugin_templatePath('polls'));
                 $poll->set_file(array('panswer'    => 'pollanswer.thtml',
                                       'block'      => 'pollblock.thtml',
                                       'pquestions' => 'pollquestions.thtml',
@@ -811,7 +780,7 @@
         }
 
         if ($nquestions > 0){
-            $poll = COM_newTemplate($_CONF['path'] . 'plugins/polls/templates/' );
+            $poll = COM_newTemplate(CTL_plugin_templatePath('polls'));
             $poll->set_file(array('result' => 'pollresult.thtml',
                 'question' => 'pollquestion.thtml',
                 'comments' => 'pollcomments.thtml',
@@ -1121,7 +1090,7 @@
     // You normally only set the css file when needed but with the possibility of
     // the poll block or autotag being displayed after COM_SiteHeader being called
     // we need to set it just in case
-    $_SCRIPTS->setCSSFile('polls', '/polls/style.css');
+    $_SCRIPTS->setCSSFile('polls', CTL_plugin_cssURL('polls'));
 }
 
 
diff -r d2ad6a1f6a74 -r 4677305ad945 plugins/polls/templates/admin/pollansweroption.thtml
--- a/plugins/polls/templates/admin/pollansweroption.thtml	Thu Feb 19 10:06:22 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-{# begin {templatelocation} #}
-
-<div style="margin-bottom:1.5em;">
-  <input type="text" name="answer[{question_id}][]" value="{answer_text}" maxlength="255" class="size3"{xhtml}> /
-  <input type="text" name="votes[{question_id}][]" value="{answer_votes}" class="size1"{xhtml}> /
-  <input type="text" name="remark[{question_id}][]" value="{remark_text}" maxlength="255" class="size3"{xhtml}>
-</div>
-
-{# end {templatelocation} #}
diff -r d2ad6a1f6a74 -r 4677305ad945 plugins/polls/templates/admin/polleditor.thtml
--- a/plugins/polls/templates/admin/polleditor.thtml	Thu Feb 19 10:06:22 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-{# begin {templatelocation} #}
-
-{noscript}
-<div id="advanced_editor" style="display:none;">
-  <form action="{site_admin_url}/plugins/polls/index.php" method="post" id="polls-polleditor" class="compact">
-    <div class="admin_basic">
-      <dl class="form_block">
-        <dt><label for="polls-polleditor-pid">{lang_pollid}</label></dt>
-        <dd><input type="text" dir="ltr" name="pid" value="{poll_id}" maxlength="128" id="polls-polleditor-pid" class="size5"{xhtml}> {lang_donotusespaces}</dd>
-
-        <dt><label for="polls-polleditor-topic">{lang_topic}</label></dt>
-        <dd><input type="text" name="topic" value="{poll_topic}" maxlength="255" id="polls-polleditor-topic" class="size6"{xhtml}><br{xhtml}>{poll_topic_info}</dd>
-
-        <dt{hide_meta}><label for="polls-polleditor-meta_description">{lang_metadescription}</label></dt>
-        <dd{hide_meta}><textarea name="meta_description" cols="45" rows="2" id="polls-polleditor-meta_description" class="wide">{meta_description}</textarea></dd>
-
-        <dt{hide_meta}><label for="polls-polleditor-meta_keywords">{lang_metakeywords}</label></dt>
-        <dd{hide_meta}><textarea name="meta_keywords" cols="45" rows="2" id="polls-polleditor-meta_keywords" class="wide">{meta_keywords}</textarea></dd>
-
-        <dt><label for="polls-polleditor-commentcode">{lang_mode}</label></dt>
-        <dd><select name="commentcode" id="polls-polleditor-commentcode">{comment_options}</select></dd>
-
-        <dt><label for="polls-polleditor-mainpage">{lang_appearsonhomepage}</label></dt>
-        <dd><input type="checkbox" name="mainpage" id="polls-polleditor-mainpage" {poll_display}{xhtml}></dd>
-
-        <dt><label for="polls-polleditor-open">{lang_openforvoting}</label></dt>
-        <dd><input type="checkbox" name="open" id="polls-polleditor-open" {poll_open}{xhtml}></dd>
-
-        <dt><label for="polls-polleditor-hideresults">{lang_hideresults}</label></dt>
-        <dd><input type="checkbox" name="hideresults" id="polls-polleditor-hideresults" {poll_hideresults}{xhtml}> {poll_hideresults_explain}</dd>
-      </dl>
-
-      <div id="po_navbar" class="jsenabled_show">
-        {navbar}
-      </div>
-      {question_list}
-
-      <fieldset>
-        <legend>{lang_accessrights}</legend>
-
-        <dl class="form_block">
-          <dt>{lang_owner}</dt>
-          <dd>{owner_name}<input type="hidden" name="owner_id" value="{owner_id}"{xhtml}></dd>
-
-          <dt><label for="group_id">{lang_group}</label></dt>
-          <dd>{group_dropdown}</dd>
-
-          <dt><label for="admin-permissions">{lang_permissions}</label></dt>
-          <dd>{permissions_editor}</dd>
-          <dd class="description">{lang_perm_key}</dd>
-          <dd class="description">{lang_permissions_msg}</dd>
-        </dl>
-      </fieldset>
-
-      <div class="submit">
-        <input type="submit" name="mode" value="{lang_save}" class="submit"{xhtml}>
-        <input type="submit" name="mode" value="{lang_cancel}" class="submit"{xhtml}>
-        {delete_option}
-        <input type="hidden" name="{gltoken_name}" value="{gltoken}"{xhtml}>
-        <input type="hidden" value="{poll_id}" name="old_pid"{xhtml}>
-      </div>
-    </div>
-  </form>
-</div>
-
-{# end {templatelocation} #}
diff -r d2ad6a1f6a74 -r 4677305ad945 plugins/polls/templates/admin/pollquestions.thtml
--- a/plugins/polls/templates/admin/pollquestions.thtml	Thu Feb 19 10:06:22 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-{# begin {templatelocation} #}
-
-<div id="po_{question_id}" {style} class="wide">
-  <dl class="form_block">
-    <dt><label>{lang_question}</label></dt>
-    <dd><input type="text" dir="ltr" name="question[]" value="{question_text}" maxlength="255" class="size5"{xhtml}></dd>
-
-    <dt><label>{lang_answersvotes}</label></dt>
-    <dd>{answer_option}</dd>
-  </dl>
-</div>
-
-<hr class="separator"{xhtml}>
-
-{# end {templatelocation} #}
diff -r d2ad6a1f6a74 -r 4677305ad945 plugins/polls/templates/default/admin/pollansweroption.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/polls/templates/default/admin/pollansweroption.thtml	Thu Feb 19 10:07:43 2015 -0500
@@ -0,0 +1,9 @@
+{# begin {templatelocation} #}
+
+<div style="margin-bottom:1.5em;">
+  <input type="text" name="answer[{question_id}][]" value="{answer_text}" maxlength="255" class="size3"{xhtml}> /
+  <input type="text" name="votes[{question_id}][]" value="{answer_votes}" class="size1"{xhtml}> /
+  <input type="text" name="remark[{question_id}][]" value="{remark_text}" maxlength="255" class="size3"{xhtml}>
+</div>
+
+{# end {templatelocation} #}
diff -r d2ad6a1f6a74 -r 4677305ad945 plugins/polls/templates/default/admin/polleditor.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/polls/templates/default/admin/polleditor.thtml	Thu Feb 19 10:07:43 2015 -0500
@@ -0,0 +1,66 @@
+{# begin {templatelocation} #}
+
+{noscript}
+<div id="advanced_editor" style="display:none;">
+  <form action="{site_admin_url}/plugins/polls/index.php" method="post" id="polls-polleditor" class="compact">
+    <div class="admin_basic">
+      <dl class="form_block">
+        <dt><label for="polls-polleditor-pid">{lang_pollid}</label></dt>
+        <dd><input type="text" dir="ltr" name="pid" value="{poll_id}" maxlength="128" id="polls-polleditor-pid" class="size5"{xhtml}> {lang_donotusespaces}</dd>
+
+        <dt><label for="polls-polleditor-topic">{lang_topic}</label></dt>
+        <dd><input type="text" name="topic" value="{poll_topic}" maxlength="255" id="polls-polleditor-topic" class="size6"{xhtml}><br{xhtml}>{poll_topic_info}</dd>
+
+        <dt{hide_meta}><label for="polls-polleditor-meta_description">{lang_metadescription}</label></dt>
+        <dd{hide_meta}><textarea name="meta_description" cols="45" rows="2" id="polls-polleditor-meta_description" class="wide">{meta_description}</textarea></dd>
+
+        <dt{hide_meta}><label for="polls-polleditor-meta_keywords">{lang_metakeywords}</label></dt>
+        <dd{hide_meta}><textarea name="meta_keywords" cols="45" rows="2" id="polls-polleditor-meta_keywords" class="wide">{meta_keywords}</textarea></dd>
+
+        <dt><label for="polls-polleditor-commentcode">{lang_mode}</label></dt>
+        <dd><select name="commentcode" id="polls-polleditor-commentcode">{comment_options}</select></dd>
+
+        <dt><label for="polls-polleditor-mainpage">{lang_appearsonhomepage}</label></dt>
+        <dd><input type="checkbox" name="mainpage" id="polls-polleditor-mainpage" {poll_display}{xhtml}></dd>
+
+        <dt><label for="polls-polleditor-open">{lang_openforvoting}</label></dt>
+        <dd><input type="checkbox" name="open" id="polls-polleditor-open" {poll_open}{xhtml}></dd>
+
+        <dt><label for="polls-polleditor-hideresults">{lang_hideresults}</label></dt>
+        <dd><input type="checkbox" name="hideresults" id="polls-polleditor-hideresults" {poll_hideresults}{xhtml}> {poll_hideresults_explain}</dd>
+      </dl>
+
+      <div id="po_navbar" class="jsenabled_show">
+        {navbar}
+      </div>
+      {question_list}
+
+      <fieldset>
+        <legend>{lang_accessrights}</legend>
+
+        <dl class="form_block">
+          <dt>{lang_owner}</dt>
+          <dd>{owner_name}<input type="hidden" name="owner_id" value="{owner_id}"{xhtml}></dd>
+
+          <dt><label for="group_id">{lang_group}</label></dt>
+          <dd>{group_dropdown}</dd>
+
+          <dt><label for="admin-permissions">{lang_permissions}</label></dt>
+          <dd>{permissions_editor}</dd>
+          <dd class="description">{lang_perm_key}</dd>
+          <dd class="description">{lang_permissions_msg}</dd>
+        </dl>
+      </fieldset>
+
+      <div class="submit">
+        <input type="submit" name="mode" value="{lang_save}" class="submit"{xhtml}>
+        <input type="submit" name="mode" value="{lang_cancel}" class="submit"{xhtml}>
+        {delete_option}
+        <input type="hidden" name="{gltoken_name}" value="{gltoken}"{xhtml}>
+        <input type="hidden" value="{poll_id}" name="old_pid"{xhtml}>
+      </div>
+    </div>
+  </form>
+</div>
+
+{# end {templatelocation} #}
diff -r d2ad6a1f6a74 -r 4677305ad945 plugins/polls/templates/default/admin/pollquestions.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/polls/templates/default/admin/pollquestions.thtml	Thu Feb 19 10:07:43 2015 -0500
@@ -0,0 +1,15 @@
+{# begin {templatelocation} #}
+
+<div id="po_{question_id}" {style} class="wide">
+  <dl class="form_block">
+    <dt><label>{lang_question}</label></dt>
+    <dd><input type="text" dir="ltr" name="question[]" value="{question_text}" maxlength="255" class="size5"{xhtml}></dd>
+
+    <dt><label>{lang_answersvotes}</label></dt>
+    <dd>{answer_option}</dd>
+  </dl>
+</div>
+
+<hr class="separator"{xhtml}>
+
+{# end {templatelocation} #}
diff -r d2ad6a1f6a74 -r 4677305ad945 plugins/polls/templates/default/pollanswer.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/polls/templates/default/pollanswer.thtml	Thu Feb 19 10:07:43 2015 -0500
@@ -0,0 +1,5 @@
+{# begin {templatelocation} #}



More information about the geeklog-cvs mailing list