Skip to content

Commit

Permalink
Zoho l41 t950 6 other inconsistencies (#2038)
Browse files Browse the repository at this point in the history
* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Themes - Back Button does not work

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Dashboard: Moved and renamed Save Box Settings Button to Save and moved Create Box Button to the left side

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Central Participant management: Added 'Survey quotas' Button to the topbar

* Dev: Added TypeHints and Descriptions to functions. Also removed commented out code

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Central Participant management: Survey quotas: Moved 'Add new quotas' and 'Quick CSV report' Buttons to a new quotas topbar

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: User management:  Resend login data throws error without proper error message

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Themes - Back Button does not work

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Dashboard: Moved and renamed Save Box Settings Button to Save and moved Create Box Button to the left side

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Central Participant management: Added 'Survey quotas' Button to the topbar

* Dev: Added TypeHints and Descriptions to functions. Also removed commented out code

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Central Participant management: Survey quotas: Moved 'Add new quotas' and 'Quick CSV report' Buttons to a new quotas topbar

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: User management:  Resend login data throws error without proper error message

* Dev: Applied Code Review Changes

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Themes - Back Button does not work

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Dashboard: Moved and renamed Save Box Settings Button to Save and moved Create Box Button to the left side

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Central Participant management: Added 'Survey quotas' Button to the topbar

* Dev: Added TypeHints and Descriptions to functions. Also removed commented out code

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: Central Participant management: Survey quotas: Moved 'Add new quotas' and 'Quick CSV report' Buttons to a new quotas topbar

* Fixed issue: 6. Other inconsistencies - [XLS - Design Inconsistencies]: User management:  Resend login data throws error without proper error message

* Dev: Applied Code Review Changes

* Dev: Fixed TypeDoc in UserManagementController.php

* Dev: Fixed TypeDoc in quotas.php

* Dev: Fixed TypeDoc in quotas.php

* Dev: Fixed TypeDoc in quotas.php

* Dev: Fixed TypeDoc in quotas.php

* Dev: Applied Code Review Changes

* Zoho l41 t1354 dashboard save button is now visible in both tabs (#2047)

* Fixed issue: Dashboard - Save Button is now visible in both tabs

* Fixed issue: Dashboard - Save Button is now visible in both tabs - default behaviour

* Fixed issue: Dashboard - Save Button is now visible in both tabs - Code Review Changes
  • Loading branch information
Jessica Höck committed Sep 24, 2021
1 parent 2409201 commit a30c24b
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 58 deletions.
2 changes: 1 addition & 1 deletion application/controllers/ThemeOptionsController.php
Expand Up @@ -474,7 +474,7 @@ public function actionIndex()

// White Bar with Buttons
$aData['fullpagebar']['returnbutton'] = [
'url' => 'index',
'url' => 'admin/index',
'text' => gT('Back'),
];

Expand Down
7 changes: 5 additions & 2 deletions application/controllers/UserManagementController.php
Expand Up @@ -343,7 +343,7 @@ public function actionDeleteConfirm()
/**
* Show some user detail and statistics
*
* @param $userid int
* @param int $userid
* @return string|null
* @throws CException
*/
Expand Down Expand Up @@ -619,7 +619,7 @@ public function actionRenderUserImport(string $importFormat = 'csv')
/**
* Creates users from an uploaded CSV / JSON file
*
* @param string importFormat - format of the imported file - Choice between csv / json
* @param string $importFormat - format of the imported file - Choice between csv / json
* @return string
* @throws CException
*/
Expand Down Expand Up @@ -888,6 +888,9 @@ public function actionBatchSendAndResetLoginData()
$passwordManagement = new \LimeSurvey\Models\Services\PasswordManagement($oUser);
$successData = $passwordManagement->sendPasswordLinkViaEmail(\LimeSurvey\Models\Services\PasswordManagement::EMAIL_TYPE_RESET_PW);
$success = $successData['success'];
if (!$success) {
$aResults[$user]['error'] = sprintf(gT("Error: New password could not be sent to %s"), $oUser->email);
}
$aResults[$user]['result'] = $success;
}
}
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/UserRoleController.php
Expand Up @@ -68,10 +68,10 @@ public function actionIndex()
/**
* Returns the modal view for adding/editing a user role
*
* @param null $ptid
* @param int $ptid (optional)
* @throws CException
*/
public function actionEditRoleModal($ptid = null)
public function actionEditRoleModal(?int $ptid = 0)
{
if (!Permission::model()->hasGlobalPermission('superadmin', 'read')) {
Yii::app()->session['flashmessage'] = gT('You have no access to the role management!');
Expand Down
66 changes: 44 additions & 22 deletions application/controllers/admin/quotas.php
Expand Up @@ -126,9 +126,13 @@ public function massiveAction()
}
}

public function index($iSurveyId, $quickreport = false)
/**
* Index
* @param int $iSurveyId
* @param bool $quickreport Default is false
*/
public function index(int $iSurveyId, bool $quickreport = false)
{

$iSurveyId = sanitize_int($iSurveyId);
$this->_checkPermissions($iSurveyId, 'read');
$aData = $this->_getData($iSurveyId);
Expand All @@ -147,7 +151,7 @@ public function index($iSurveyId, $quickreport = false)
$aData['title_bar']['title'] = $oSurvey->currentLanguageSettings->surveyls_title . " (" . gT("ID") . ":" . $iSurveyID . ")";
$aData['subaction'] = gT("Survey quotas");

//$aData['surveybar']['active_survey_properties'] = 'quotas';
// TODO: I dont think that is is needed anymore. Remove it.
$aData['surveybar']['buttons']['view'] = true;
$aData['surveybar']['active_survey_properties']['img'] = 'quota';
$aData['surveybar']['active_survey_properties']['txt'] = gT("Quotas");
Expand All @@ -170,9 +174,13 @@ public function index($iSurveyId, $quickreport = false)
),
));


//if there are quotas let's proceed
$aViewUrls['output'] = '';

// TopBar
$aData['topBar']['name'] = 'surveyTopbar_view';
$aData['topBar']['leftSideView'] = 'quotasTopbarLeft_view';

if (!empty($oSurvey->quotas)) {
$aData['output'] = '';
$aQuotaItems = array();
Expand Down Expand Up @@ -237,7 +245,6 @@ public function index($iSurveyId, $quickreport = false)
}
} else {
// No quotas have been set for this survey
//$aViewUrls[] = 'viewquotasempty_view';
$aData['output'] = $this->getController()->renderPartial('/admin/quotas/viewquotasempty_view', $aData, true);
}

Expand All @@ -258,8 +265,11 @@ public function index($iSurveyId, $quickreport = false)
}
}


public function insertquotaanswer($iSurveyId)
/**
* Insert Quota answer
* @param int $iSurveyId
*/
public function insertquotaanswer(int $iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
$this->_checkPermissions($iSurveyId, 'update');
Expand Down Expand Up @@ -287,7 +297,11 @@ public function insertquotaanswer($iSurveyId)
}
}

public function delans($iSurveyId)
/**
* Delete answers
* @param int $iSurveyId
*/
public function delans(int $iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
$this->_checkPermissions($iSurveyId, 'update');
Expand All @@ -301,7 +315,11 @@ public function delans($iSurveyId)
self::_redirectToIndex($iSurveyId);
}

public function delquota($iSurveyId)
/**
* Delete Quota
* @param int iSurveyId
*/
public function delquota(int $iSurveyId)
{
$this->requirePostRequest();

Expand All @@ -319,7 +337,11 @@ public function delquota($iSurveyId)
self::_redirectToIndex($iSurveyId);
}

function editquota($iSurveyId)
/**
* Edit Quota
* @param int iSurveyId
*/
function editquota(int $iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
$oSurvey = Survey::model()->findByPk($iSurveyId);
Expand Down Expand Up @@ -354,7 +376,6 @@ function editquota($iSurveyId)
}
}


$aData['oQuota'] = $oQuota;
$aData['aQuotaLanguageSettings'] = array();
foreach ($oQuota->languagesettings as $languagesetting) {
Expand All @@ -366,7 +387,6 @@ function editquota($iSurveyId)
$aData['sidemenu']['state'] = false;
$aData['title_bar']['title'] = $oSurvey->currentLanguageSettings->surveyls_title . " (" . gT("ID") . ":" . $iSurveyId . ")";

//$aData['surveybar']['active_survey_properties'] = 'quotas';
$aData['surveybar']['closebutton']['url'] = 'admin/quotas/sa/index/surveyid/' . $iSurveyId; // Close button
$aData['surveybar']['savebutton']['form'] = 'frmeditgroup';
$aData['topBar']['showSaveButton'] = true;
Expand Down Expand Up @@ -412,7 +432,7 @@ public function new_answer($iSurveyId, $sSubAction = 'new_answer')

foreach ($aQuestionAnswers as $aQACheck) {
if (isset($aQACheck['rowexists'])) {
$x++;
$x++;
}
}

Expand All @@ -431,7 +451,11 @@ public function new_answer($iSurveyId, $sSubAction = 'new_answer')
$this->_renderWrappedTemplate('quotas', $aViewUrls, $aData);
}

public function newquota($iSurveyId)
/**
* New Quota
* @param int iSurveyId
*/
public function newquota(int $iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
$oSurvey = Survey::model()->findByPk($iSurveyId);
Expand All @@ -451,7 +475,6 @@ public function newquota($iSurveyId)
$oQuota = new Quota();
$oQuota->sid = $oSurvey->primaryKey;


if (isset($_POST['Quota'])) {
$oQuota->attributes = $_POST['Quota'];
if ($oQuota->save()) {
Expand All @@ -461,7 +484,6 @@ public function newquota($iSurveyId)
$oQuotaLanguageSetting->quotals_quota_id = $oQuota->primaryKey;
$oQuotaLanguageSetting->quotals_language = $language;


//Clean XSS - Automatically provided by CI
$oQuotaLanguageSetting->quotals_message = html_entity_decode($oQuotaLanguageSetting->quotals_message, ENT_QUOTES, "UTF-8");
// Fix bug with FCKEditor saving strange BR types
Expand Down Expand Up @@ -503,13 +525,13 @@ public function newquota($iSurveyId)
}

/**
*
* Get Quota Answers
* @param integer $iQuestionId
* @param integer $iSurveyId
* @param integer $iQuotaId
* @return array
*/
public function getQuotaAnswers($iQuestionId, $iSurveyId, $iQuotaId)
public function getQuotaAnswers(int $iQuestionId, int $iSurveyId, int $iQuotaId)
{
$iQuestionId = sanitize_int($iQuestionId);
$iSurveyId = sanitize_int($iSurveyId);
Expand All @@ -519,7 +541,6 @@ public function getQuotaAnswers($iQuestionId, $iSurveyId, $iQuotaId)
$this->_checkPermissions($iSurveyId, 'read');
$oSurvey = Survey::model()->findByPk($iSurveyId);


$aQuestion = Question::model()
->with('questionl10ns', array('language' => $sBaseLang))
->findByPk(array('qid' => $iQuestionId));
Expand Down Expand Up @@ -605,9 +626,10 @@ public function getQuotaAnswers($iQuestionId, $iSurveyId, $iQuotaId)
/**
* Renders template(s) wrapped in header and footer
*
* @param string $sAction Current action, the folder to fetch views from
* @param string|array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
* @param string $sAction Current action, the folder to fetch views from. Default is 'quotas'.
* @param string|array $aViewUrls View url(s)
* @param array $aData Data to be passed on. Optional.
* @param bool $sRenderFile Default is false.
*/
protected function _renderWrappedTemplate($sAction = 'quotas', $aViewUrls = array(), $aData = array(), $sRenderFile = false)
{
Expand Down
@@ -0,0 +1,9 @@
<!-- Quick CSV report -->
<a class="btn btn-default" role="button" onClick="window.open('<?php echo Yii::App()->createUrl("admin/quotas/sa/index/surveyid/$surveyid/quickreport/y") ?>', '_top')">
<?php eT("Quick CSV report"); ?>
</a>

<!-- Add new quota -->
<a class="btn btn-default quota_new" type="submit" role="button" href="<?php echo Yii::App()->createUrl("admin/quotas/sa/newquota/surveyid/$surveyid") ?>">
<?php eT("Add new quota"); ?>
</a>
Expand Up @@ -168,3 +168,9 @@
<?php eT("View in CPDB"); ?>
</a>
<?php endif; ?>

<!-- Survey Quotas -->
<a class="btn btn-default" href='<?php echo Yii::App()->createUrl("admin/quotas/sa/index/surveyid/$oSurvey->sid"); ?>' role="button">
<span class="fa fa-tasks"></span>
<?php eT("Survey quotas"); ?>
</a>
11 changes: 0 additions & 11 deletions application/views/admin/quotas/viewquotas_view.php
Expand Up @@ -81,12 +81,6 @@
'header' => gT('Completed'),
'type' => 'raw',
'htmlOptions' => array('style' => 'vertical-align:top'),
// 'value'=>function($oQuota)use($oSurvey){
// $completerCount =getQuotaCompletedCount($oSurvey->sid, $oQuota->id);
// $class = ($completerCount <= $oQuota->qlimit ? 'text-warning':null);
// $span = CHtml::tag('span',array('class'=>$class),$completerCount);
// return $span;
// },
'footer' => $totalcompleted,
),
array(
Expand Down Expand Up @@ -139,11 +133,6 @@
<?php echo CHtml::hiddenField('sid',$oSurvey->getPrimaryKey());?>
<?php echo CHtml::hiddenField('action','quotas');?>
<?php echo CHtml::hiddenField('subaction','new_quota');?>
<input type="button" class="btn btn-default" value="<?php eT("Quick CSV report");?>" onClick="window.open('<?php echo $this->createUrl("admin/quotas/sa/index/surveyid/$surveyid/quickreport/y") ?>', '_top')" />
<?php echo CHtml::submitButton(gT("Add new quota"),array(
'name'=>'submit',
'class'=>'quota_new btn btn-default',
));?>
<?php echo CHtml::endForm();?>
</div>
<?php endif; ?>
Expand Down
14 changes: 2 additions & 12 deletions application/views/admin/super/fullpagebar_view.php
Expand Up @@ -9,6 +9,8 @@
<!-- Full page menu bar -->
<div class='menubar surveybar' id="fullpagebar">
<div class='row'>

<!-- Left actions -->
<div class="col-md-6 text-left">
<!-- Plugin Manager -->
<?php if (isset($fullpagebar['pluginManager'])) : ?>
Expand Down Expand Up @@ -137,18 +139,6 @@ class='btn btn-default'
</a>
<?php endif;?>

<!-- Box Buttons -->
<?php if (isset($fullpagebar['boxbuttons'])) :?>
<a href="<?php echo $this->createUrl('homepageSettings/createBox/');?>" class="btn btn-default">
<span class="icon-add text-success"></span>
<?php eT("Create a new box");?>
</a>
<a href="<?php echo $this->createUrl('homepageSettings/resetAllBoxes/');?>" class="btn btn-danger" data-confirm="<?php eT('This will delete all current boxes to restore the default ones. Are you sure you want to continue?'); ?>">
<span class="fa fa-refresh"></span>
<?php eT("Reset to default boxes");?>
</a>
<?php endif;?>

<!-- Manage your Key -->
<?php if (isset($fullpagebar['update'])) :?>
<a href="<?php echo $this->createUrl('admin/update/sa/managekey/');?>" class="btn btn-default" style="margin-top:10px;">
Expand Down
11 changes: 10 additions & 1 deletion application/views/homepageSettings/index.php
Expand Up @@ -171,7 +171,6 @@
</div>
<div class="col-sm-3">
<input type="hidden" id="boxesupdatemessage" data-ajaxsuccessmessage="<?php eT('Box settings updated!'); ?>"/>
<button class="btn btn-default" type="button" id="save_boxes_setting" data-url="<?php echo App()->createUrl('homepageSettings/updateBoxesSettings'); ?>"><?php eT('Save boxes settings'); ?></button>
</div>
<br/><br/><br/><br/>
</div>
Expand All @@ -186,8 +185,18 @@
window.location.hash = $(this).attr('href');
e.preventDefault();
$(this).tab('show');

// Hide the save button for boxes tab
let tabName = $(this).tab().attr('href');
if (tabName === '#boxes') {
$('#save_boxes_setting').hide();
} else {
$('#save_boxes_setting').show();
}
});
$(document).on('ready pjax:scriptcomplete', function () {
// Default behaviour: hide the save button
$('#save_boxes_setting').hide();
if (window.location.hash) {
$('#boxeslist').find('a[href=' + window.location.hash + ']').trigger('click');
}
Expand Down
24 changes: 17 additions & 7 deletions application/views/layouts/fullpagebar_view.php
Expand Up @@ -9,6 +9,7 @@
<!-- Full page menu bar -->
<div class="menubar surveybar" id="fullpagebar">
<div class="row">
<!-- Left actions -->
<div class="col-md-6 text-left">

<!-- Themes -->
Expand Down Expand Up @@ -66,8 +67,16 @@ class="btn btn-default"
<?php eT("Create survey group");?>
</a>
<?php endif;?>
</div>

<!-- Dashboard - Add a new Box -->
<?php if(isset($fullpagebar['boxbuttons'])): ?>
<!-- Create Box Button -->
<a href="<?php echo $this->createUrl('homepageSettings/createBox/'); ?>" class="btn btn-default">
<span class="icon-add text-success"></span>
<?php eT("Create Box"); ?>
</a>
<?php endif; ?>
</div>

<!-- Right actions -->
<div class="col-md-6 text-right">
Expand Down Expand Up @@ -116,14 +125,15 @@ class="btn btn-default"
<!-- Box Buttons -->
<?php if (isset($fullpagebar['boxbuttons'])) :?>
<!-- Reset Boxes Button -->
<a href="<?php echo $this->createUrl('homepageSettings/resetAllBoxes/');?>" class="btn btn-warning" data-confirm="<?php eT('This will delete all current boxes to restore the default ones. Are you sure you want to continue?'); ?>">
<span class="fa fa-refresh"></span>
<a href="<?php echo $this->createUrl('homepageSettings/resetAllBoxes/');?>" class="btn btn-warning" data-confirm="<?php eT('This will delete all current boxes to restore the default ones. Are you sure you want to continue?'); ?>"> <span class="fa fa-refresh"></span>
<?php eT("Reset");?>
</a>

<a href="<?php echo $this->createUrl('homepageSettings/createBox/');?>" class="btn btn-default">
<span class="icon-add text-success"></span>
<?php eT("Create box");?>
<!-- Save Box Settings Button -->
<a data-url="<?php echo $this->createUrl('homepageSettings/updateBoxesSettings'); ?>"
class="btn btn-success"
role="button"
id="save_boxes_setting">
<?php eT('Save'); ?>
</a>
<?php endif;?>

Expand Down

0 comments on commit a30c24b

Please sign in to comment.