some changes in surveys administration
authorx2004laborde <x2004laborde@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 24 Mar 2007 15:58:14 +0000 (15:58 +0000)
committerx2004laborde <x2004laborde@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 24 Mar 2007 15:58:14 +0000 (15:58 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1610 839d8a87-29fc-0310-9880-83ba4fa771e5

modules/survey.php
modules/survey/survey.inc.php
templates/survey/admin.tpl
templates/survey/show_checkbox.tpl
templates/survey/show_personal.tpl
templates/survey/show_question.tpl [moved from templates/survey/show_survey.tpl with 58% similarity]
templates/survey/show_radio.tpl
templates/survey/show_root.tpl [new file with mode: 0644]
templates/survey/show_text.tpl
templates/survey/show_textarea.tpl

index c3ed63c..23fa8f5 100644 (file)
@@ -47,28 +47,41 @@ class SurveyModule extends PLModule
     // }}}
 
     // {{{ function handler_admin() : index of admin mode
-    function handler_admin(&$page)
+    function handler_admin(&$page, $id = -1)
     {
         require_once dirname(__FILE__).'/survey/survey.inc.php';
-        $page->changeTpl('survey/admin.tpl');
-        $page->assign('survey_waiting', SurveyDB::retrieveList('w'));
-        $page->assign('survey_current', SurveyDB::retrieveList('c'));
-        $page->assign('survey_old', SurveyDB::retrieveList('o'));
+        $this->clear_session();
+        if ($id == -1) {
+            $page->changeTpl('survey/admin.tpl');
+            $page->assign('survey_waiting', SurveyDB::retrieveList('w'));
+            $page->assign('survey_current', SurveyDB::retrieveList('c'));
+            $page->assign('survey_old', SurveyDB::retrieveList('o'));
+        } else {
+            $survey = SurveyDB::retrieveSurvey($id); // retrieves all survey object structure
+            if ($survey == null) {
+                $this->show_error($page, "Sondage ".$id." introuvable.", 'admin');
+            }
+            //$this->store_session($survey, $id);
+            $page->assign('survey_adminmode', true);
+            $page->assign('survey_id', $id);
+            $this->show_survey($page, $survey);
+        }
     }
     // }}}
 
     // {{{ function handler_adminEdit() : edits a survey in admin mode
-    function handler_adminEdit(&$page, $id)
+    function handler_adminEdit(&$page, $id = -1)
     {
+        if ($id == -1) {
+            return $this->show_error($page, "Un identifiant de sondage doit &#234;tre pr&#233;cis&#233;.", 'admin');
+        }
         require_once dirname(__FILE__).'/survey/survey.inc.php';
         $survey = SurveyDB::retrieveSurvey($id); // retrieves the survey in database
-        S::kill('survey'); // cleans session (in case there would have been a problem before)
-        S::kill('survey_id');
-        if ($survey->isValid()) {
+        $this->clear_session(); // cleans session (in case there would have been a problem before)
+        /*if ($survey->isValid()) {
             return $this->show_error($page, "Il est impossible de modifier un sondage d&#233;j&#224; valid&#233;", 'admin');
-        }
-        $_SESSION['survey']    = serialize($survey);
-        $_SESSION['survey_id'] = $id;
+        }*/
+        $this->store_session($survey, $id);
         $this->handler_edit($page, 'show'); // calls handler_edit, but in admin mode since 'survey_id' is in session
     }
     // }}}
@@ -76,10 +89,11 @@ class SurveyModule extends PLModule
     // {{{ function handler_adminValidate() : validates a survey (admin mode)
     function handler_adminValidate(&$page, $id = -1)
     {
+        $id = Post::v('survey_id', $id);
         if (Post::has('survey_cancel')) { // if the admin cancels the validation, returns to the admin index
-            return $this->handler_admin(&$page);
+            $this->clear_session();
+            return $this->handler_admin(&$page, $id);
         }
-        $id = Post::v('survey_id', $id);
         if ($id == -1) {
             return $this->show_error($page, "Un identifiant de sondage doit &#234;tre pr&#233;cis&#233;.", 'admin');
         }
@@ -98,16 +112,45 @@ class SurveyModule extends PLModule
             $this->show_confirm($page, "&#202;tes-vous certain de vouloir valider le sondage \"".$surveyInfo['title']."\" ? "
                                       ."Les votes seront imm&#233;diatement ouverts.", 'admin/valid', array('id' => $id));
         }
+        /*
+        if ($id == -1 && !(S::has('survey') && S::has('survey_id'))) {
+            return $this->show_error($page, "Un identifiant de sondage doit &#234;tre pr&#233;cis&#233;.", 'admin');
+        }
+        require_once dirname(__FILE__).'/survey/survey.inc.php';
+        if ($id == -1) { // the survey and survey_id are in session, performs the validation
+            $survey = unserialize(S::v('survey'));
+            $surveyInfo = $survey->storeArray();
+            if (Post::has('survey_submit')) { // needs a confirmation before validation
+                if (SurveyDB::validateSurvey(S::v('survey_id'))) { // validates the survey (in the database)
+                    $this->show_success($page, "Le sondage \"".$surveyInfo['question']."\" a bien &#233;t&#233; valid&#233;, les votes sont maintenant ouverts.", 'admin');
+                } else {
+                    $this->show_error($page, '', 'admin');
+                }
+            } else { // asks for a confirmation
+                $this->show_confirm($page, "&#202;tes-vous certain de vouloir valider le sondage \"".$surveyInfo['question']."\" ? "
+                                          ."Les votes seront imm&#233;diatement ouverts.", 'admin/valid');
+            }
+        } else { // a survey id is given, loads this survey for validation
+            $this->clear_session();
+            $survey = SurveyDB::retrieveSurvey($id); // retrieves all survey object structure
+            if ($survey == null) {
+                $this->show_error($page, "Sondage ".$id." introuvable.", 'admin');
+            }
+            $this->store_session($survey, $id);
+            $page->assign('survey_validmode', true);
+            $this->show_survey($page, $survey);
+        }
+         */
     }
     // }}}
 
     // {{{ function handler_adminDelete() : deletes a survey (admin mode)
     function handler_adminDelete(&$page, $id = -1)
     {
+        $id = Post::v('survey_id', $id);
         if (Post::has('survey_cancel')) { // if the admin cancels the suppression, returns to the admin index
-            return $this->handler_admin(&$page);
+            return $this->handler_admin(&$page, $id);
         }
-        $id = Post::v('survey_id', $id);
         if ($id == -1) {
             return $this->show_error($page, "Un identifiant de sondage doit &#234;tre pr&#233;cis&#233;.", 'admin');
         }
@@ -123,7 +166,7 @@ class SurveyModule extends PLModule
                 $this->show_error($page, '', 'admin');
             }
         } else { // asks for a confirmation
-            $this->show_confirm($page, "&#202;tes-vous certain de vouloir supprimer le sondage \"".$surveyInfo['title']."\" ?", 'admin/delete', array('id' => $id));
+            $this->show_confirm($page, "&#202;tes-vous certain de vouloir supprimer le sondage \"".$surveyInfo['title']."\" ?", 'admin/del', array('id' => $id));
         }
     }
     // }}}
@@ -141,8 +184,9 @@ class SurveyModule extends PLModule
                 return $this->handler_index($page);
             }
         }
+        $page->assign('survey_editmode', true);
         if (S::has('survey_id')) { // if 'survey_id' is in session, it means we are modifying a survey in admin mode
-            $page->assign('survey_adminmode', true);
+            $page->assign('survey_updatemode', true);
         }
         if ($action == 'show' && !S::has('survey')) {
             $action = 'new';
@@ -155,7 +199,7 @@ class SurveyModule extends PLModule
                     return $this->show_error($page, '', 'edit');
                 }
                 $this->show_survey($page, $survey);
-                $_SESSION['survey'] = serialize($survey);
+                $this->store_session($survey);
             } else { // if a form has not been submitted, shows modification form
                 $survey = unserialize(S::v('survey'));
                 $current = $survey->searchToArray($qid); // gets the current parameters of the question
@@ -166,14 +210,12 @@ class SurveyModule extends PLModule
             } // }}}
         } elseif ($action == 'new') { // {{{ create a new survey : actually store the root question
             if (Post::has('survey_submit')) { // if the form has been submitted, creates the survey
-                S::kill('survey');
-                S::kill('survey_id');
+                $this->clear_session();
                 $survey = new SurveyRoot(Post::v('survey_question')); // creates the object structure
                 $this->show_survey($page, $survey);
-                $_SESSION['survey'] = serialize($survey);
+                $this->store_session($survey);
             } else {
-                S::kill('survey');
-                S::kill('survey_id');
+                $this->clear_session();
                 $this->show_form($page, $action, 0, 'root');
             } // }}}
         } elseif ($action == 'nested' || $action == 'after') { // {{{ adds a new question, nested in the current node, or on the same level after it
@@ -190,7 +232,7 @@ class SurveyModule extends PLModule
                     }
                 }
                 $this->show_survey($page, $survey);
-                $_SESSION['survey'] = serialize($survey);
+                $this->store_session($survey);
             } else {
                 $this->show_form($page, $action, $qid);
             } // }}}
@@ -201,7 +243,7 @@ class SurveyModule extends PLModule
                     return $this->show_error($page, '', 'edit');
                 }
                 $this->show_survey($page, $survey);
-                $_SESSION['survey'] = serialize($survey);
+                $this->store_session($survey);
             } else { // if user has not confirmed, shows a confirmation form
                 $survey = unserialize(S::v('survey'));
                 $current = $survey->searchToArray($qid); // needed to get the title of the question to delete (more user-friendly than an id)
@@ -232,8 +274,7 @@ class SurveyModule extends PLModule
                         $this->show_error($page);
                     }
                 }
-                S::kill('survey'); // cleans session
-                S::kill('survey_id');
+                $this->clear_session();
             } else { // asks for a confirmation if it has not been sent
                 $survey = unserialize(S::v('survey'));
                 $errors = $survey->checkSyntax();
@@ -249,11 +290,11 @@ class SurveyModule extends PLModule
             } // }}}
         } elseif ($action == 'cancel') { // {{{ cancels the creation/modification of a survey
             if (Post::has('survey_submit')) { // needs a confirmation
-                S::kill('survey'); // cleans session
                 if (S::has('survey_id')) {              // only possible when modifying a survey in admin mode, still this should be considered again,
-                    S::kill('survey_id');               // maybe some name with "admin" in it, "survey_adminid" or anything that might not be confusing.
+                    $this->clear_session();             // maybe some name with "admin" in it, "survey_adminid" or anything that might not be confusing.
                     return $this->handler_admin($page); // in this case, shows the admin index
                 } else {
+                    $this->clear_session();             // cleans session
                     return $this->handler_index($page); // else shows the 'normal' index
                 }
             } else { // asks for a confirmation if it has not been sent
@@ -278,11 +319,28 @@ class SurveyModule extends PLModule
     }
     // }}}
 
+    // {{{ function clear_session() : clears the data stored in session
+    function clear_session()
+    {
+        S::kill('survey');
+        S::kill('survey_id');
+    }
+    // }}}
+
+    // {{{ function store_session() : serializes and stores survey (and survey_id) in session
+    function store_session($survey, $survey_id = -1)
+    {
+        $_SESSION['survey'] = serialize($survey);
+        if ($survey_id != -1) {
+            $_SESSION['survey_id'] = $survey_id;
+        }
+    }
+    // }}}
+
     // {{{ function show_survey() : calls the template to display a survey, for editing, voting, or consulting the results
     function show_survey(&$page, $survey)
     {
-        $page->changeTpl('survey/show_survey.tpl');
-        $page->assign('survey_mode', 'edit'); // for now, only editing has been completely implemented
+        $page->changeTpl('survey/show_root.tpl');
         $page->assign('survey', $survey->toArray());
     }
     // }}}
@@ -305,7 +363,7 @@ class SurveyModule extends PLModule
     // }}}
     
     // {{{ function show_confirm() : calls the template to display a confirm form
-    function show_confirm(&$page, $message, $formaction, $formhidden)
+    function show_confirm(&$page, $message, $formaction, $formhidden = null)
     {
         $page->changeTpl('survey/confirm.tpl');
         $page->assign('survey_message', $message);
index 142d134..ee6ebbc 100644 (file)
@@ -91,6 +91,9 @@ class SurveyDB
                  WHERE survey_id={?}';
         $res = XDB::query($sql, $sid);
         $data = $res->fetchOneAssoc();
+        if (is_null($data) || !is_array($data)) {
+            return null;
+        }
         $survey = unserialize($data['questions']);
         if (isset($data['end'])) {
             $data['end'] = preg_replace('#^(\d{4})-(\d{2})-(\d{2})$#', '\3/\2/\1', $data['end']);
@@ -457,7 +460,7 @@ class SurveyRoot extends SurveyTreeable
 
     public function setValid($v)
     {
-        $this->valid = (intval($v) != 0);
+        $this->valid = (boolean) $v;
     }
 
     public function isValid()
@@ -497,22 +500,22 @@ class SurveyRoot extends SurveyTreeable
     // {{{ methods needing public access
     public function addChildNested($i, $c)
     {
-        return parent::addChildNested($i, $c);
+        return !$this->isValid() && parent::addChildNested($i, $c);
     }
 
     public function addChildAfter($i, $c)
     {
-        return parent::addChildAfter($i, $c);
+        return !$this->isValid() && parent::addChildAfter($i, $c);
     }
 
     public function delChild($i)
     {
-        return parent::delChild($i);
+        return !$this->isValid() && parent::delChild($i);
     }
 
     public function edit($i, $a)
     {
-        return parent::edit($i, $a);
+        return (!$this->isValid() || $this->getId() == $i) && parent::edit($i, $a);
     }
 
     public function toArray()
@@ -533,6 +536,7 @@ class SurveyRoot extends SurveyTreeable
         $rArr['beginning'] = $this->beginning;
         $rArr['end']       = $this->end;
         $rArr['promos']    = $this->promos;
+        $rArr['valid']     = $this->valid;
         return $rArr;
     }
     // }}}
index c0f19c5..f844b6a 100644 (file)
@@ -32,7 +32,7 @@
   <tr class="{cycle values="impair,pair"}">
     <td class="half">
       &bull;
-      <a href="survey/admin/edit/{$s.survey_id}">
+      <a href="survey/admin/{$s.survey_id}">
         {$s.title} ({$s.end|date_format:"%x"})
       </a>
     </td>
@@ -58,7 +58,7 @@
   <tr class="{cycle values="impair,pair"}">
     <td class="half">
       &bull;
-      <a href="survey/admin/edit/{$s.survey_id}">
+      <a href="survey/admin/{$s.survey_id}">
         {$s.title} ({$s.end|date_format:"%x"})
       </a>
     </td>
@@ -84,7 +84,7 @@
   <tr class="{cycle values="impair,pair"}">
     <td class="half">
       &bull;
-      <a href="survey/admin/edit/{$s.survey_id}">
+      <a href="survey/admin/{$s.survey_id}">
         {$s.title} ({$s.end|date_format:"%x"})
       </a>
     </td>
index a92da7a..d04481a 100644 (file)
@@ -21,7 +21,7 @@
 {**************************************************************************}
 
 {foreach from=$survey.choices item=choice}
-  <input type="checkbox" name="survey{$survey_id}_{$survey.id}_{$choices}" value="1" id="{$choice}" {if $survey_mode eq 'edit'}disabled="disabled"{/if}/><label for="{$choice}">{$choice}</label>
+  <input type="checkbox" name="survey{$survey_id}_{$survey.id}_{$choices}" value="1" id="{$choice}" {if !$survey_votemode}disabled="disabled"{/if}/><label for="{$choice}">{$choice}</label>
 {/foreach}
 
 {* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}
index fe7409f..be5a396 100644 (file)
 
 
 {if $survey.promo}
-  <input type="checkbox" name="survey{$survey_id}_{$survey.id}_promo" value="1" id="survey{$survey_id}_{$survey.id}_promo" {if $survey_mode eq 'edit'}disabled="disabled"{/if}/><label for="survey{$survey_id}_{$survey.id}_promo">Je veux indiquer ma promotion</label><br/>
+  <input type="checkbox" name="survey{$survey_id}_{$survey.id}_promo" value="1" id="survey{$survey_id}_{$survey.id}_promo" {if !$survey_votemode}disabled="disabled"{/if}/><label for="survey{$survey_id}_{$survey.id}_promo">Je veux indiquer ma promotion</label><br/>
 {/if}
 {if $survey.name}
-  <input type="checkbox" name="survey{$survey_id}_{$survey.id}_name" value="1" id="survey{$survey_id}_{$survey.id}_name" {if $survey_mode eq 'edit'}disabled="disabled"{/if}/><label for="survey{$survey_id}_{$survey.id}_name">Je veux indiquer mon nom et mon pr&#233;nom</label><br/>
+  <input type="checkbox" name="survey{$survey_id}_{$survey.id}_name" value="1" id="survey{$survey_id}_{$survey.id}_name" {if !$survey_votemode}disabled="disabled"{/if}/><label for="survey{$survey_id}_{$survey.id}_name">Je veux indiquer mon nom et mon pr&#233;nom</label><br/>
 {/if}
   <strong>Attention, cocher cette(ces) case(s) d&#233;truit totalement ou en partie l'anonymat de ta r&#233;ponse.</strong>
 
similarity index 58%
rename from templates/survey/show_survey.tpl
rename to templates/survey/show_question.tpl
index 1e474af..30b8c11 100644 (file)
 {*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
 {*                                                                        *}
 {**************************************************************************}
-{if $survey.type == 'root'}
-<h1>Sondage : {$survey.question}</h1>
-  {if $survey.comment != ''}
-    {$survey.comment}
-  {/if}
-<br/>Fin du sondage :
-  {if $survey.end eq "#"}
-    erreur
-  {else}
-    {$survey.end|date_format:"%x"}
-  {/if}
-<br/>R&#233;serv&#233; aux promotions :
-  {if $survey.promos eq "#"}
-    erreur
-  {elseif $survey.promos eq ""}
-    aucune restriction
-  {else}
-    {$survey.promos}
-  {/if}
-<br/>
-<a href='./survey/edit/question/{$survey.id}'>Modifier la racine</a> |
-<a href='./survey/edit/nested/{$survey.id}'>Ajouter une question au début</a>
-  {if is_array($survey.children)}
-    {foreach from=$survey.children item=child}
-      {include file='survey/show_survey.tpl' survey=$child recursive=true}
-    {/foreach}
-  {/if}
-<br/><br/>
-<a href='./survey/edit/valid'>{if $survey_adminmode}Enregistrer les modifications{else}Proposer ce sondage{/if}</a> |
-<a href='./survey/edit/cancel'>Annuler {if $survey_adminmode}les modifications{else}totalement la cr&#233;ation de ce sondage{/if}</a>
 
-{else}
 <div>
   <h2>{$survey.question}</h2>
-  {if $survey.comment != ''}
-    {$survey.comment}<br/>
-  {/if}
-  {assign var='survey_type' value=$survey.type}
-  {include file="survey/show_$survey_type.tpl"}
+{if $survey.comment != ''}
+  {$survey.comment}<br/>
+{/if}
+{assign var='survey_type' value=$survey.type}
+{include file="survey/show_$survey_type.tpl"}
   <br/>
+{if $survey_editmode}
   <a href='./survey/edit/question/{$survey.id}'>Modifier cette question</a> |
   <a href='./survey/edit/del/{$survey.id}'>Supprimer cette question</a> |
-  {if is_array($survey.children)}
-  <a href='./survey/edit/nested/{$survey.id}'>Ajouter une question imbriqu&#233;e</a>
+{/if}
+{if is_array($survey.children)}
+  {if $survey_editmode}<a href='./survey/edit/nested/{$survey.id}'>Ajouter une question imbriqu&#233;e</a>{/if}
   <div style="padding-left:20px">
-    {foreach from=$survey.children item=child}
-      {include file='survey/show_survey.tpl' survey=$child recursive=true}
-    {/foreach}
+  {foreach from=$survey.children item=child}
+    {include file='survey/show_question.tpl' survey=$child recursive=true}
+  {/foreach}
   </div>
-  {/if}
+{/if}
+{if $survey_editmode}
   <a href='./survey/edit/after/{$survey.id}'>Ajouter une question apr&#232;s</a>
-</div>
 {/if}
+</div>
 
 {* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}
index 178f5ae..de13de0 100644 (file)
@@ -21,7 +21,7 @@
 {**************************************************************************}
 
 {foreach from=$survey.choices item=choice}
-  <input type="radio" name="survey{$survey_id}_{$survey.id}" value="{$choice}" id="{$choice}" {if $survey_mode eq 'edit'}disabled="disabled"{/if}/><label for="{$choice}">{$choice}</label>
+  <input type="radio" name="survey{$survey_id}_{$survey.id}" value="{$choice}" id="{$choice}" {if !$survey_votemode}disabled="disabled"{/if}/><label for="{$choice}">{$choice}</label>
 {/foreach}
 
 {* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}
diff --git a/templates/survey/show_root.tpl b/templates/survey/show_root.tpl
new file mode 100644 (file)
index 0000000..96aefa4
--- /dev/null
@@ -0,0 +1,69 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2007 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.org/                                  *}
+{*                                                                        *}
+{*  This program is free software; you can redistribute it and/or modify  *}
+{*  it under the terms of the GNU General Public License as published by  *}
+{*  the Free Software Foundation; either version 2 of the License, or     *}
+{*  (at your option) any later version.                                   *}
+{*                                                                        *}
+{*  This program is distributed in the hope that it will be useful,       *}
+{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
+{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
+{*  GNU General Public License for more details.                          *}
+{*                                                                        *}
+{*  You should have received a copy of the GNU General Public License     *}
+{*  along with this program; if not, write to the Free Software           *}
+{*  Foundation, Inc.,                                                     *}
+{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<h1>Sondage : {$survey.question}</h1>
+{if $survey.comment != ''}
+  {$survey.comment}
+{/if}
+<br/>Fin du sondage :
+{if $survey.end eq "#"}
+  erreur
+{else}
+  {$survey.end|date_format:"%x"}
+{/if}
+<br/>R&#233;serv&#233; aux promotions :
+{if $survey.promos eq "#"}
+  erreur
+{elseif $survey.promos eq ""}
+  aucune restriction
+{else}
+  {$survey.promos}
+{/if}
+<br/>
+{if $survey_editmode}
+  {assign var="survey_rooteditmode" value=true}
+  {if $survey.valid}
+    {assign var="survey_editmode" value=false}
+  {/if}
+{/if}
+{if $survey_rooteditmode}<a href='./survey/edit/question/{$survey.id}'>Modifier la racine</a>{/if}
+{if $survey_editmode} | <a href='./survey/edit/nested/{$survey.id}'>Ajouter une question au début</a>{/if}
+{if is_array($survey.children)}
+  {foreach from=$survey.children item=child}
+    {include file='survey/show_question.tpl' survey=$child recursive=true}
+  {foreachelse}
+    <br/>
+  {/foreach}
+{/if}
+{if $survey_rooteditmode}
+<br/>
+<a href='./survey/edit/valid'>{if $survey_updatemode}Enregistrer les modifications{else}Proposer ce sondage{/if}</a> |
+<a href='./survey/edit/cancel'>Annuler {if $survey_updatemode}les modifications{else}totalement la cr&#233;ation de ce sondage{/if}</a>
+{elseif $survey_adminmode}
+<br/>
+{if !$survey.valid}<a href="./survey/admin/valid/{$survey_id}">Valider ce sondage</a> | {/if}
+<a href="./survey/admin/edit/{$survey_id}">Modifier ce sondage</a> |
+<a href="./survey/admin/del/{$survey_id}">Supprimer ce sondage</a> |
+<a href="./survey/admin">Retour</a>
+{/if}
+
+{* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}
index de2b20b..109d8f8 100644 (file)
@@ -20,6 +20,6 @@
 {*                                                                        *}
 {**************************************************************************}
 
-  <input type="text" name="survey{$survey_id}_{$survey.id}" value="" size="50" maxlength="200" {if $survey_mode eq 'edit'}disabled="disabled"{/if}/>
+  <input type="text" name="survey{$survey_id}_{$survey.id}" value="" size="50" maxlength="200" {if !$survey_votemode}disabled="disabled"{/if}/>
 
 {* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}
index ef924d3..53b2bdc 100644 (file)
@@ -20,6 +20,6 @@
 {*                                                                        *}
 {**************************************************************************}
 
-  <textarea name="survey{$survey_id}_{$survey.id}" rows="5" cols="60" {if $survey_mode eq 'edit'}disabled="disabled"{/if}></textarea>
+  <textarea name="survey{$survey_id}_{$survey.id}" rows="5" cols="60" {if !$survey_votemode}disabled="disabled"{/if}></textarea>
 
 {* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}