+
-
+
diff --git a/application/views/plugins/configure.php b/application/views/plugins/configure.php
index bd04e1d2169..76deeff4dbe 100644
--- a/application/views/plugins/configure.php
+++ b/application/views/plugins/configure.php
@@ -9,7 +9,7 @@
'ok'));
- echo CHtml::submitButton('Cancel', array('name'=>'cancel'));
+ echo CHtml::submitButton(gT('Save plugin settings'), array('name'=>'ok'));
+ echo CHtml::submitButton(gT('Cancel'), array('name'=>'cancel'));
echo CHtml::endForm();
?>
diff --git a/application/views/plugins/index.php b/application/views/plugins/index.php
index f4d778fe473..62d2ee8ecfe 100644
--- a/application/views/plugins/index.php
+++ b/application/views/plugins/index.php
@@ -2,21 +2,43 @@
'CLinkColumn',
- 'header' => 'Plugin',
- 'labelExpression' => function($data) { return $data['name']; },
- 'urlExpression' => function($data) { return array("/plugins/configure", "id" => $data['id']); }
+ 'header' => gT('Status'),
+ 'labelExpression' => function($data) { return ($data['active'] == 1 ? CHtml::image(App()->getConfig('adminimageurl') . 'active.png', gT('Active'), array('width' => 32, 'height' => 32)) : CHtml::image(App()->getConfig('adminimageurl') . 'inactive.png', gT('Inactive'), array('width' => 32, 'height' => 32))); },
+ 'url' => '#'
),
array(// display the activation link
- 'class' => 'CLinkColumn',
- 'header' => 'Activation status',
- 'labelExpression' => function($data) { return ($data['active'] == 0 ? 'activate' : 'deactivate'); },
- 'urlExpression' => function($data) { return $data['active'] == 0 ? array("/plugins/activate", "id" => $data['id']) : array("/plugins/activate", "id" => $data['id']); }
- )
- );
+ 'class' => 'CDataColumn',
+ 'type' => 'raw',
+ 'header' => gT('Action'),
+ 'value' => function($data) {
+ if ($data['active'] == 0)
+ {
+ $output = CHtml::link(CHtml::image(App()->getConfig('adminimageurl') . 'active.png', gT('Activate'), array('width' => 16, 'height' => 16)), array("/plugins/activate", "id" => $data['id']));
+ } else {
+ $output = CHtml::link(CHtml::image(App()->getConfig('adminimageurl') . 'inactive.png', gT('Deactivate'), array('width' => 16, 'height' => 16)), array("/plugins/deactivate", "id" => $data['id']));
+ }
+ $output .= CHtml::link(CHtml::image(App()->getConfig('adminimageurl') . 'survey_settings_30.png', gT('Configure'), array('width' => 16, 'height' => 16, 'style' => 'margin-left: 8px;')), array("/plugins/configure", "id" => $data['id']));
+ return $output;
+ }
+ ),
+ array(// display the 'name' attribute
+ 'class' => 'CDataColumn',
+ 'header' => gT('Plugin'),
+ 'name' => 'name'
+ ),
+ array(// display the 'name' attribute
+ 'class' => 'CDataColumn',
+ 'header' => gT('Description'),
+ 'name' => 'description'
+ ),
+ );
+
/*
array( // display a column with "view", "update" and "delete" buttons
'class' => 'CallbackColumn',
@@ -25,7 +47,8 @@
)
);
*/
- $this->widget('application.extensions.GridViewWidget', array(
+
+ $this->widget('bootstrap.widgets.TbExtendedGridView', array(
'dataProvider'=>$dataProvider,
'columns'=>$gridColumns,
'rowCssClassExpression'=> function ($data, $row) { return ($row % 2 ? 'even' : 'odd') . ' ' . ($data['new']==1 ? "new" : "old"); },
diff --git a/application/views/questions/settingsblock.php b/application/views/questions/settingsblock.php
new file mode 100644
index 00000000000..fa0b26f09a4
--- /dev/null
+++ b/application/views/questions/settingsblock.php
@@ -0,0 +1,11 @@
+
+
+ $setting)
+ {
+ $setting['language'] = $language;
+ echo CHtml::tag('div', array('class' => 'control-group'), $PluginSettings->renderSetting($name, $setting, $form, true));
+ }
+ ?>
+
+
\ No newline at end of file
diff --git a/application/views/questions/update.php b/application/views/questions/update.php
index a0144a80bd6..d296349d85b 100644
--- a/application/views/questions/update.php
+++ b/application/views/questions/update.php
@@ -5,6 +5,8 @@
Yii::import('application.helpers.PluginSettingsHelper');
$PluginSettings = new PluginSettingsHelper();
+ echo CHtml::beginForm('', 'post', array('id' => $form, 'class' => 'form-horizontal'));
+
// Render basic and advanced non localized settings.
$this->renderPartial('/questions/update_nonlocalized', compact('basicSettings', 'question', 'survey', 'groups', 'questions', 'questiontypes', 'form', 'attributes', 'PluginSettings'));
@@ -31,7 +33,7 @@
$form, 'class' => 'modern'));
+
echo CHtml::submitButton(gT('Save'));
echo CHtml::endForm();
diff --git a/application/views/questions/update_localized.php b/application/views/questions/update_localized.php
index 7969fce3c96..a2d7c05b272 100644
--- a/application/views/questions/update_localized.php
+++ b/application/views/questions/update_localized.php
@@ -1,42 +1,58 @@
-
-
-
-
- $setting)
- {
- if ($setting['localized'] && !$setting['advanced'])
- {
- $setting['language'] = $language;
- echo CHtml::tag('li', array(), $PluginSettings->renderSetting($name, $setting, $form, true));
- }
- }
- ?>
-
+ $setting)
+ {
+ if ($setting['localized'] && !$setting['advanced'])
+ {
+ $basic[$name] = $setting;
+ }
+ elseif ($setting['localized'] && $setting['advanced'])
+ {
+ $advanced[$name] = $setting;
+ }
+ }
-
-
-
- $setting)
- {
- if ($setting['localized'] && $setting['advanced'])
- {
- $setting['language'] = $language;
- echo CHtml::tag('li', array(), $PluginSettings->renderSetting($name, $setting, $form, true));
- }
- }
- ?>
-
-
-
-
\ No newline at end of file
+ $id = "localized-$language";
+ $idbasic = "basic" . isset($language) ? $language : '';
+ $idadvanced = "advanced" . isset($language) ? $language : '';
+ $class[] = "localized";
+
+ // Decide if we need basic / advanced tab.
+ $out = '';
+ if (!empty($basic) && !empty($advanced))
+ {
+ $class[] = "tabs";
+ $tabs[] = CHtml::link(CHtml::tag('span', array(), gT('Basic settings')), "#$idbasic");
+ $tabs[] = CHtml::link(CHtml::tag('span', array(), gT('Advanced settings')), "#$idadvanced");
+ $out .= CHtml::openTag('ul');
+ foreach ($tabs as $tab)
+ {
+ $out .= CHtml::tag('li', array(), $tab);
+
+
+ }
+ $out.= CHtml::closeTag('ul');
+ }
+ echo CHtml::openTag('div', array(
+ 'id' => $id,
+ 'class' => explode(' ', $class)
+ ));
+ echo $out;
+
+ $this->renderPartial('/questions/settingsblock', array(
+ 'id' => $idbasic,
+ 'settings' => $basic,
+ 'language' => $language,
+ 'form' => $form,
+ 'PluginSettings' => $PluginSettings
+ ));
+ $this->renderPartial('/questions/settingsblock', array(
+ 'id' => $idadvanced,
+ 'settings' => $advanced,
+ 'language' => $language,
+ 'form' => $form,
+ 'PluginSettings' => $PluginSettings
+ ));
+ echo CHtml::closeTag('div');
+?>
diff --git a/application/views/questions/update_nonlocalized.php b/application/views/questions/update_nonlocalized.php
index 6cceb2c320c..32b395010d9 100644
--- a/application/views/questions/update_nonlocalized.php
+++ b/application/views/questions/update_nonlocalized.php
@@ -1,34 +1,53 @@
-
-
-
-
- $setting)
- {
- if (!$setting['localized'] && !$setting['advanced'])
- {
- echo CHtml::tag('li', array(), $PluginSettings->renderSetting($name, $setting, $form, true));
- }
- }
- ?>
-
-
-
-
-
- $setting)
+ $setting)
+ {
+ if (!$setting['localized'] && !$setting['advanced'])
{
- if (!$setting['localized'] && $setting['advanced'])
- {
- echo CHtml::tag('li', array(), $PluginSettings->renderSetting($name, $setting, $form, true));
- }
+ $basic[$name] = $setting;
}
- ?>
-
-
-
+ elseif (!$setting['localized'] && $setting['advanced'])
+ {
+ $advanced[$name] = $setting;
+ }
+ }
+
+ $class[] = "localized";
+
+ // Decide if we need basic / advanced tab.
+ $out = '';
+ if (!empty($basic) && !empty($advanced))
+ {
+ $class[] = "tabs";
+ $tabs[] = CHtml::link(CHtml::tag('span', array(), gT('Basic settings')), '#basic');
+ $tabs[] = CHtml::link(CHtml::tag('span', array(), gT('Advanced settings')), '#advanced');
+ $out .= CHtml::openTag('ul');
+ foreach ($tabs as $tab)
+ {
+ $out .= CHtml::tag('li', array(), $tab);
+
+
+ }
+ $out.= CHtml::closeTag('ul');
+ }
+ echo CHtml::openTag('div', array(
+ 'class' => explode(' ', $class)
+ ));
+ echo $out;
+ $this->renderPartial('/questions/settingsblock', array(
+ 'id' => 'basic',
+ 'settings' => $basic,
+ 'language' => $language,
+ 'form' => $form,
+ 'PluginSettings' => $PluginSettings
+ ));
+ $this->renderPartial('/questions/settingsblock', array(
+ 'id' => 'advanced',
+ 'settings' => $advanced,
+ 'language' => $language,
+ 'form' => $form,
+ 'PluginSettings' => $PluginSettings
+ ));
+ echo CHtml::closeTag('div');
+?>
\ No newline at end of file
diff --git a/plugins/YesNoQuestion/FreeTextQuestionObject.php b/plugins/YesNoQuestion/FreeTextQuestionObject.php
index 65457220def..785d006730b 100644
--- a/plugins/YesNoQuestion/FreeTextQuestionObject.php
+++ b/plugins/YesNoQuestion/FreeTextQuestionObject.php
@@ -33,7 +33,15 @@ class FreeTextQuestionObject extends QuestionBase implements iQuestion
'originalName' => 'Free Text',
'startDev' => '2013-30-1'
);
-
+
+
+ public static function getJavascript()
+ {
+ $functions = parent::getJavascript();
+ // Override get and set if using checkbox layout.
+ $functions['bindChange'] = 'js:function(callback) { $(this).bind("change keyup", callback) }';
+ return $functions;
+ }
/**
*
* @param Twig_Environment $twig
@@ -41,20 +49,23 @@ class FreeTextQuestionObject extends QuestionBase implements iQuestion
* @param string $name Unique string prefix to be used for all elements with a name and or id attribute.
* @return null|html
*/
-
- public function render($name, $language, $return = false)
+ public function render($name, $language, $return = false)
{
- $context = array(
- 'default' => $this->default,
- 'name' => $name
- );
- if (!$return)
+ $questionText = $this->get('question', '', $language);
+
+ $value = $this->getResponse();
+
+
+ $out = CHtml::label($this->api->EMevaluateExpression($questionText), $name);
+
+ $out .= CHtml::textField($name, $value, $data);
+ if ($return)
{
- $twig->display('default.twig', $context);
+ return $out;
}
else
{
- return $twig->render('default.twig', $context);
+ echo $out;
}
}
}
diff --git a/plugins/YesNoQuestion/YesNoQuestionObject.php b/plugins/YesNoQuestion/YesNoQuestionObject.php
index ad0c330a98a..2b09c9f227d 100644
--- a/plugins/YesNoQuestion/YesNoQuestionObject.php
+++ b/plugins/YesNoQuestion/YesNoQuestionObject.php
@@ -21,7 +21,8 @@ class YesNoQuestionObject extends QuestionBase implements iQuestion
'type' => 'select',
'options' => array(
'radio' => 'Radio buttons',
- 'dropdown' => 'Dropdown list'
+ 'dropdown' => 'Dropdown list',
+ 'checkbox' => 'Checkbox'
),
'localized' => false,
@@ -49,9 +50,29 @@ class YesNoQuestionObject extends QuestionBase implements iQuestion
'originalName' => 'Yes / No',
'startDev' => '2013-30-1'
);
-
+
+
+ public static function getJavascript()
+ {
+ $functions = parent::getJavascript();
+ // Override get and set if using checkbox layout.
+ $functions['get'] =
+ 'js:function(variable) {
+ if (!($(this).prop("type") == "checkbox")) {
+ return $(this).val();
+ } else {
+ var a = $("input[name=" + $(this).prop("name") + "]").serializeArray(); return a[a.length-1].value;}
+ }';
+ $functions['set'] = 'js:function(variable, value) {
+ if (!($(this).prop("type") == "checkbox")) {$(this).val(value);
+ } else {
+ $(this).prop("checked", $(this).prop("value") == value)}
+ }';
+ return $functions;
+ }
/**
- *
+ * Renders the question object. The question object MUST create an element
+ * with an id equal to $name.
* @param boolean $return
* @param string $name Unique string prefix to be used for all elements with a name and or id attribute.
* @return null|html
@@ -70,23 +91,25 @@ public function render($name, $language, $return = false)
1 => 'Yes',
0 => 'No'
);
- if ($this->get('display') == 'dropdown')
- {
- $out .= CHtml::dropDownList($name, $value, $data);
-
+ switch ($this->get('display')) {
+ case 'dropdown':
+ $out .= CHtml::dropDownList($name, $value, $data);
+ break;
+ case 'checkbox':
+ $out .= CHtml::checkBox($name, $value, array('uncheckValue' => 0, 'value' => 1));
+ break;
+ case 'radio' :
+ default:
+ $out .= CHtml::radioButtonList($name, $value, $data);
+
}
- else
- {
- $out .= CHtml::radioButtonList($name, $value, $data);
- }
-
if ($return)
{
- return CHtml::tag('div', array('class' => 'question'), $out);
+ return $out;
}
else
{
- echo CHtml::tag('div', array('class' => 'question'), $out);
+ echo $out;
}
}
}
diff --git a/plugins/YesNoQuestion/views/default.twig b/plugins/YesNoQuestion/views/default.twig
deleted file mode 100644
index c345da2c799..00000000000
--- a/plugins/YesNoQuestion/views/default.twig
+++ /dev/null
@@ -1,4 +0,0 @@
-{# Default view file for Yes/No pluggable question. #}
-
{{ trans("Yes") }}
-
{{ trans("No") }}
-
diff --git a/themes/default/views/surveys/publiclist_twig.view b/themes/default/views/surveys/publiclist_twig.view
new file mode 100644
index 00000000000..e36daa7c2b4
--- /dev/null
+++ b/themes/default/views/surveys/publiclist_twig.view
@@ -0,0 +1,13 @@
+
+
+
Basic template: {{this.pageTitle}}
+
+
+
+ {% for survey in surveys %}
+ - {{ survey.languagesettings[0].surveyls_title }}
+ {% endfor %}
+
+
+
+