JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS)))
JQUERY_UI_VERSION=1.8.7
-JQUERY_UI=core tabs widget
+JQUERY_UI=core tabs datepicker widget
JQUERY_UI_PATHES=$(addprefix htdocs/javascript/jquery.ui.,$(addsuffix .js,$(JQUERY_UI)))
JQUERY_TMPL_VERSION=vBeta1.0.0
.ui-tabs-hide { display: none; }
+.ui-icon {
+ width: 16px;
+ height: 16px;
+}
+
+.ui-datepicker {
+ background: #ffffff;
+ color: #000000;
+ position: absolute;
+}
+
+.ui-datepicker a {
+ color: black;
+ text-decoration: none;
+ text-align: center;
+}
+
+.ui-datepicker-header {
+ padding: 2px;
+ margin: 1px;
+ background: #777;
+ border: 1px solid;
+ border-color: #333;
+}
+
+.ui-datepicker-title {
+ text-align: center;
+ height: 19px;
+}
+
+.ui-datepicker-prev {
+ background: #777 url('/images/icons/resultset_previous.gif');
+ position: absolute;
+ width: 16px;
+ height: 16px;
+ top: 4px;
+ left: 4px;
+ outline: none;
+ display: block;
+}
+
+.ui-datepicker-next {
+ background: #777 url('/images/icons/resultset_next.gif');
+ position: absolute;
+ width: 16px;
+ height: 16px;
+ top: 4px;
+ right: 4px;
+ outline: none;
+ display: block;
+}
+
+.ui-datepicker-next span, .ui-datepicker-prev span {
+ display: block;
+ position: absolute;
+ text-indent: -99999px;
+ overflow: hidden;
+}
+
+.ui-datepicker-week-end {
+ background-color: #eee;
+}
+
+.ui-datepicker-unselectable {
+ color: #777;
+}
+
/* vim: set et ts=4 sts=4 sw=4: */
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2003-2011 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 *
+ ***************************************************************************/
+
+(function($) {
+ $.fn.extend({
+ surveyQuestions: function(questions) {
+ var data = $('#question_base').tmpl(questions);
+ this.children().remove();
+ data.appendTo(this);
+ return this;
+ }
+ });
+})(jQuery);
+
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
return array(
'survey' => $this->make_hook('index', AUTH_COOKIE),
'survey/vote' => $this->make_hook('vote', AUTH_COOKIE),
- /* 'survey/result' => $this->make_hook('result', AUTH_COOKIE),
'survey/edit' => $this->make_hook('edit', AUTH_COOKIE),
+ /*
+ 'survey/result' => $this->make_hook('result', AUTH_COOKIE),
'survey/ajax' => $this->make_hook('ajax', AUTH_COOKIE),
'survey/admin' => $this->make_hook('admin', AUTH_MDP, 'admin'),
'survey/admin/edit' => $this->make_hook('adminEdit', AUTH_MDP, 'admin'),
{
$this->load('survey.inc.php');
$page->addJsLink('jquery.tmpl.js');
+ $page->addJsLink('survey.js');
$page->changeTpl('survey/vote.tpl');
$survey = Survey::get($name);
if (is_null($survey)) {
}
$page->assign('survey', $survey);
}
+
+ function handler_edit(PlPage $page, $name = null)
+ {
+ $this->load('survey.inc.php');
+ $page->addJsLink('jquery.ui.core.js');
+ $page->addJsLink('jquery.ui.widget.js');
+ $page->addJsLink('jquery.ui.datepicker.js');
+ $page->addJsLink('jquery.tmpl.js');
+ $page->addJsLink('survey.js');
+ $page->changeTpl('survey/edit.tpl');
+
+ if (!is_null($name)) {
+ $survey = Survey::get($name);
+ } else {
+ $survey = new Survey();
+ $survey->id = null;
+ $survey->uid = S::user()->id();
+ }
+ if (Post::has('save')) {
+ }
+ $page->assign('survey', $survey);
+ }
}
// vim:set et sw=4 sts=4 ts=4 foldmethod=marker enc=utf-8:
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2011 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>Edition de sondage</h1>
+
+<form action="survey/edit/{$survey->shortname}" method="post">
+ <fieldset>
+ <legend>Description du sondage</legend>
+
+ Titre : <input type="text" name="title" /><br />
+ Nom : <input type="text" name="shortname" /><br />
+
+ Premier jour : <input type="text" class="datepicker" name="begin" /><br />
+ Dernier jour : <input type="text" class="datepicker" name="end" /><br />
+ </fieldset>
+</form>
+
+{literal}
+<script type="text/javascript">
+ //<![CDATA[
+ $($(".datepicker").datepicker({
+ dateFormat: 'dd/mm/yyyy',
+ firstDay: 1,
+ hideIfNoPrevNext: true,
+ minDate: new Date()
+ }));
+ //]]>
+</script>
+{/literal}
+
+{* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}
//<![CDATA[
var questions = {$survey->exportQuestionsToJSON()|smarty:nodefaults};
- {literal}
- $(function() {
- $("#question_base").tmpl(questions).appendTo("#questions");
- });
- {/literal}
+ $($("#questions").surveyQuestions(questions));
//]]>
</script>