diff --git a/application/config/internal.php b/application/config/internal.php index e0714790123..12c0a8fe2fc 100644 --- a/application/config/internal.php +++ b/application/config/internal.php @@ -64,11 +64,10 @@ 'modules'=>array( 'gii'=>array( - //'class'=>'system.gii.GiiModule', - //'password'=>'toto', - // 'ipFilters'=>array(...a list of IPs...), - // 'newFileMode'=>0666, - // 'newDirMode'=>0777, + 'class'=>'system.gii.GiiModule', + 'password'=>'toto', + 'newFileMode'=>0666, + 'newDirMode'=>0777, ), ), diff --git a/application/controllers/admin/SurveymenuController.php b/application/controllers/admin/SurveymenuController.php new file mode 100644 index 00000000000..44dce7c1e62 --- /dev/null +++ b/application/controllers/admin/SurveymenuController.php @@ -0,0 +1,36 @@ +render('index'); + } + + // Uncomment the following methods and override them if needed + /* + public function filters() + { + // return the filter configuration for this controller, e.g.: + return array( + 'inlineFilterName', + array( + 'class'=>'path.to.FilterClass', + 'propertyName'=>'propertyValue', + ), + ); + } + + public function actions() + { + // return external action classes, e.g.: + return array( + 'action1'=>'path.to.ActionClass', + 'action2'=>array( + 'class'=>'path.to.AnotherActionClass', + 'propertyName'=>'propertyValue', + ), + ); + } + */ +} \ No newline at end of file diff --git a/application/controllers/admin/SurveymenuEntryController.php b/application/controllers/admin/SurveymenuEntryController.php new file mode 100644 index 00000000000..2c05846d2d7 --- /dev/null +++ b/application/controllers/admin/SurveymenuEntryController.php @@ -0,0 +1,36 @@ +render('index'); + } + + // Uncomment the following methods and override them if needed + /* + public function filters() + { + // return the filter configuration for this controller, e.g.: + return array( + 'inlineFilterName', + array( + 'class'=>'path.to.FilterClass', + 'propertyName'=>'propertyValue', + ), + ); + } + + public function actions() + { + // return external action classes, e.g.: + return array( + 'action1'=>'path.to.ActionClass', + 'action2'=>array( + 'class'=>'path.to.AnotherActionClass', + 'propertyName'=>'propertyValue', + ), + ); + } + */ +} \ No newline at end of file diff --git a/application/controllers/admin/surveyadmin.php b/application/controllers/admin/surveyadmin.php index e844ea603bf..eb8bbc2d990 100644 --- a/application/controllers/admin/surveyadmin.php +++ b/application/controllers/admin/surveyadmin.php @@ -491,12 +491,8 @@ public function getAjaxMenuArray($surveyid){ $iSurveyID = sanitize_int($surveyid); $survey = Survey::model()->findByPk($iSurveyID); $baselang = $survey->language; - //$menu_items = $this->_collectMenuItems($currentMenu); - - return Yii::app()->getController()->renderPartial( - '/admin/super/_renderJson', - array( - 'data' => array( + $menus = $survey->getSurveyMenus(); + $propArray = array( 'menuEntries' => [ [ 'active' => false, @@ -516,7 +512,12 @@ public function getAjaxMenuArray($surveyid){ 'name' => gT('Language'), 'link' => $this->getController()->createUrl("admin/survey/sa/editlanguagesettings",['surveyid' => $surveyid]) ], - ], + ]); + return Yii::app()->getController()->renderPartial( + '/admin/super/_renderJson', + array( + 'data' => [ + 'menues'=> $menus, 'settings' => array( 'extrasettings' => false, 'parseHTML' => false, @@ -530,7 +531,7 @@ public function getAjaxMenuArray($surveyid){ // $setting_entry, // $lastquestiongroup // ] - ) + ] ), false, false @@ -926,23 +927,83 @@ public function editSurvey_json() } /** - * Edit surveytexts and general settings + * New system of rendering content + * Based on yii submenu rendering + * + * @param [int] $iSurveyID + * @param [string] $subaction + * @return void */ + public function rendersidemenulink($iSurveyID, $subaction){ + $aViewUrls = $aData = $activePanels = []; + $menuaction = (String) $subaction; + $iSurveyID = sanitize_int($iSurveyID); - public function surveygeneralsettings($iSurveyID){ - $aViewUrls = $aData = $activePanels = array(); + //Get all languages + $grplangs = Survey::model()->findByPk($iSurveyID)->additionalLanguages; + $baselang = Survey::model()->findByPk($iSurveyID)->language; + array_unshift($grplangs, $baselang); + + //Get surveyinfo + $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo; - $pageTitle=gT("Edit survey text elements and settings"); - if (Permission::model()->hasSurveyPermission($iSurveyID, 'surveylocale', 'read') && !Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'read')) + //@TODO add language checks here + $menuEntry = SurveymenuEntries::model()->find(['condition' => 'name="'.$menuaction.'"']); + + $esrow = self::_fetchSurveyInfo('editsurvey', $iSurveyID); + + if (!(Permission::model()->hasSurveyPermission($iSurveyID, $menuEntry->permission, $menuEntry->permission_grade))) { - $pageTitle=gT("Edit survey text elements"); + Yii::app()->setFlashMessage(gT("You do not have permission to access this page."),'error'); + $this->getController()->redirect(array('admin/survey','sa'=>'view','surveyid'=>$iSurveyID)); + Yii::app()->end(); } - elseif (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveylocale', 'read') && Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'read')) + + if( empty($menuEntry->data)) + { + $templateData = call_user_func_array(array($this,$menuEntry->getdatamethod), array('surveyid'=> $iSurveyID, 'esrow' => $esrow)); + } + else { - $pageTitle=gT("Edit survey settings"); + $templateData = $menuEntry->data; } + + $templateData = array_merge($this->_getGeneralTemplateData($iSurveyID), $templateData); + + $this->_registerScriptFiles(); + Yii::app()->loadHelper("admin/htmleditor"); + + //Start collecting aData + $aData['surveyid'] = $iSurveyID; + $aData['menuaction'] = $menuaction; + $aData['template'] = $menuEntry->template; + $aData['templateData'] = $templateData; + $aData['surveyls_language'] = $baselang; + $aData['action'] = $menuEntry->action; + $aData['entryData'] = $menuEntry->attributes; + $aData['dateformatdetails'] = getDateFormatData(Yii::app()->session['dateformat']); + $aData['display']['menu_bars']['surveysummary'] = $menuEntry->title; + $aData['title_bar']['title'] = $surveyinfo['surveyls_title']." (".gT("ID").":".$iSurveyID.")"; + $aData['surveybar']['savebutton']['form'] = 'globalsetting'; + $aData['surveybar']['savebutton']['useformid'] = 'true'; + $aData['surveybar']['saveandclosebutton']['form'] = true; + $aData['surveybar']['closebutton']['url'] = $this->getController()->createUrl("'admin/survey/sa/view/",['surveyid' => $iSurveyID]); // Close button + + $aViewUrls[] = $menuEntry->template; + + $this->_renderWrappedTemplate('survey', $aViewUrls, $aData); + } + + /** + * Edit surveytexts and general settings + */ + public function surveygeneralsettings($iSurveyID){ + $aViewUrls = $aData = $activePanels = array(); $aData['surveyid'] = $iSurveyID = sanitize_int($iSurveyID); + + + if (!(Permission::model()->hasSurveyPermission($iSurveyID, 'surveylocale', 'read') || Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'read'))) { Yii::app()->setFlashMessage(gT("You do not have permission to access this page."),'error'); @@ -962,7 +1023,7 @@ public function surveygeneralsettings($iSurveyID){ $grplangs = Survey::model()->findByPk($iSurveyID)->additionalLanguages; $baselang = Survey::model()->findByPk($iSurveyID)->language; array_unshift($grplangs, $baselang); - + ### Yii::app()->loadHelper("admin/htmleditor"); $aData['scripts'] = PrepareEditorScript(false, $this->getController()); @@ -1555,17 +1616,8 @@ private function _generalTabNewSurvey() return $aData; } - /** - * survey::_generalTabEditSurvey() - * Load "General" tab of edit survey screen. - * @param mixed $iSurveyID - * @param mixed $esrow - * @return - */ - private function _generalTabEditSurvey($iSurveyID, $esrow) - { - $aData['action'] = "editsurveysettings"; - $aData['esrow'] = $esrow; + private function _getGeneralTemplateData($iSurveyID){ + //$aData['action'] = "editsurveysettings"; $aData['surveyid'] = $iSurveyID; // Get users, but we only need id and name (NOT password etc) @@ -1577,6 +1629,24 @@ private function _generalTabEditSurvey($iSurveyID, $esrow) } // Sort users by name asort($aData['users']); + return $aData; + } + + private function _getTextEditData($iSurveyID, $esrow){ + + } + + /** + * survey::_generalTabEditSurvey() + * Load "General" tab of edit survey screen. + * @param mixed $iSurveyID + * @param mixed $esrow + * @return + */ + private function _generalTabEditSurvey($iSurveyID, $esrow) + { + $aData['esrow'] = $esrow; + $beforeSurveySettings = new PluginEvent('beforeSurveySettings'); $beforeSurveySettings->set('survey', $iSurveyID); App()->getPluginManager()->dispatchEvent($beforeSurveySettings); @@ -1590,7 +1660,7 @@ private function _generalTabEditSurvey($iSurveyID, $esrow) * @param mixed $esrow * @return */ - private function _tabPresentationNavigation($esrow) + private function _tabPresentationNavigation($iSurveyID, $esrow) { global $showxquestions, $showgroupinfo, $showqnumcode; @@ -1613,7 +1683,7 @@ private function _tabPresentationNavigation($esrow) * @param mixed $esrow * @return */ - private function _tabPublicationAccess($esrow) + private function _tabPublicationAccess($iSurveyID, $esrow) { $aDateFormatDetails = getDateFormatData(Yii::app()->session['dateformat']); $startdate = ''; @@ -1644,7 +1714,7 @@ private function _tabPublicationAccess($esrow) * @param mixed $esrow * @return */ - private function _tabNotificationDataManagement($esrow) + private function _tabNotificationDataManagement($iSurveyID, $esrow) { $aData['esrow'] = $esrow; return $aData; @@ -1656,14 +1726,14 @@ private function _tabNotificationDataManagement($esrow) * @param mixed $esrow * @return */ - private function _tabTokens($esrow) + private function _tabTokens($iSurveyID, $esrow) { $aData = array(); $aData['esrow'] = $esrow; return $aData; } - private function _tabPanelIntegration($esrow) + private function _tabPanelIntegration($iSurveyID, $esrow) { $aData = array(); return $aData; @@ -1675,7 +1745,7 @@ private function _tabPanelIntegration($esrow) * @param mixed $iSurveyID * @return */ - private function _tabResourceManagement($iSurveyID) + private function _tabResourceManagement($iSurveyID, $esrow) { global $sCKEditorURL; diff --git a/application/models/Survey.php b/application/models/Survey.php index 0e0716df3fc..a1233547f9f 100644 --- a/application/models/Survey.php +++ b/application/models/Survey.php @@ -216,6 +216,7 @@ public function relations() 'owner' => array(self::BELONGS_TO, 'User', 'owner_id', 'together' => true), 'groups' => array(self::HAS_MANY, 'QuestionGroup', 'sid', 'together' => true), 'quotas' => array(self::HAS_MANY, 'Quota', 'sid','order'=>'name ASC'), + 'surveymenus' => array(self::HAS_MANY, 'Surveymenu', array('survey_id' => 'sid')), ); } @@ -538,6 +539,69 @@ public function getGoogleanalyticsapikey(){ } + private function _getDefaultSurveyMenu(){ + $oDefaultMenu = Surveymenu::model()->findByPk(1); + //Posibility to add more languages to the database is given, so it is possible to add a call by language + //Also for peripheral menues we may add submenus someday. + $defaultMenuEntries = $oDefaultMenu->surveymenuEntries; + $aResult = [ + "title" => $oDefaultMenu->title, + "description" => $oDefaultMenu->description, + "entries" => [ + [ + 'id'=> "0", + 'link'=> App()->getController()->createUrl("admin/survey/sa/view",['surveyid' => $this->sid]), + 'menu_class'=> "", + 'menu_description'=> "Survey overwiew", + 'menu_icon'=> "list", + 'menu_icon_type'=> "fontawesome", + 'menu_id'=> "1", + 'menu_title'=> "Overview", + 'name'=> "overview", + 'title'=> "General overview", + ] + ] + ]; + foreach($defaultMenuEntries as $menuEntry){ + $aEntry = $menuEntry->attributes; + $aEntry['link'] = App()->getController()->createUrl("admin/survey/sa/rendersidemenulink",['surveyid' => $this->sid, 'subaction' => $aEntry['name'] ]); + $aResult["entries"][] = $aEntry; + } + return $aResult; + } + + + /** + * Get surveymenu configuration + * This will be made bigger in future releases, but right now it only collects the default menu-entries + */ + public function getSurveyMenus(){ + + $aSurveyMenus = []; + + //Get the default menu + $aSurveyMenus[] = $this->_getDefaultSurveyMenu(); + + //get all survey specific menus + foreach($this->surveymenus as $menu){ + $aMenuResult = [ + "title" => $menu->title, + "description" => $menu->description, + "entries" => [] + ]; + + foreach($menu->surveymenuEntries as $menuEntry){ + $aEntry = $menuEntry->attributes; + $aEntry['link'] = App()->getController()->createUrl("admin/survey/sa/rendersidemenulink",['surveyid' => $this->sid, 'subaction' => $aEntry['name'] ]); + $aMenuResult["entries"][] = $aEntry; + } + $aSurveyMenus[] = $aMenuResult; + } + + //soon to come => Event to add menus for plugins + + return $aSurveyMenus; + } /** * Creates a new survey - does some basic checks of the suppplied data diff --git a/application/models/Surveymenu.php b/application/models/Surveymenu.php new file mode 100644 index 00000000000..9020a2b53e3 --- /dev/null +++ b/application/models/Surveymenu.php @@ -0,0 +1,128 @@ +true), + array('title', 'length', 'max'=>255), + array('description, created_at', 'safe'), + // The following rule is used by search(). + // @todo Please remove those attributes that should not be searched. + array('id, parent_id, survey_id, priority, level, title, description, changed_at, changed_by, created_at, created_by', 'safe', 'on'=>'search'), + ); + } + + /** + * @return array relational rules. + */ + public function relations() + { + // NOTE: you may need to adjust the relation name and the related + // class name for the relations automatically generated below. + return array( + 'surveymenuEntries' => array(self::HAS_MANY, 'SurveymenuEntries', 'menu_id'), + 'survey' => array(self::BELONGS_TO, 'Survey', ''), + ); + } + + /** + * @return array customized attribute labels (name=>label) + */ + public function attributeLabels() + { + return array( + 'id' => 'ID', + 'parent_id' => 'Parent', + 'survey_id' => 'Survey', + 'priority' => 'Priority', + 'level' => 'Level', + 'title' => 'Title', + 'description' => 'Description', + 'changed_at' => 'Changed At', + 'changed_by' => 'Changed By', + 'created_at' => 'Created At', + 'created_by' => 'Created By', + ); + } + + /** + * Retrieves a list of models based on the current search/filter conditions. + * + * Typical usecase: + * - Initialize the model fields with values from filter form. + * - Execute this method to get CActiveDataProvider instance which will filter + * models according to data in model fields. + * - Pass data provider to CGridView, CListView or any similar widget. + * + * @return CActiveDataProvider the data provider that can return the models + * based on the search/filter conditions. + */ + public function search() + { + // @todo Please modify the following code to remove attributes that should not be searched. + + $criteria=new CDbCriteria; + + $criteria->compare('id',$this->id); + $criteria->compare('parent_id',$this->parent_id); + $criteria->compare('survey_id',$this->survey_id); + $criteria->compare('priority',$this->priority); + $criteria->compare('level',$this->level); + $criteria->compare('title',$this->title,true); + $criteria->compare('description',$this->description,true); + $criteria->compare('changed_at',$this->changed_at,true); + $criteria->compare('changed_by',$this->changed_by); + $criteria->compare('created_at',$this->created_at,true); + $criteria->compare('created_by',$this->created_by); + + return new CActiveDataProvider($this, array( + 'criteria'=>$criteria, + )); + } + + /** + * Returns the static model of the specified AR class. + * Please note that you should have this exact method in all your CActiveRecord descendants! + * @param string $className active record class name. + * @return Surveymenu the static model class + */ + public static function model($className=__CLASS__) + { + return parent::model($className); + } +} diff --git a/application/models/SurveymenuEntries.php b/application/models/SurveymenuEntries.php new file mode 100644 index 00000000000..99798abd38f --- /dev/null +++ b/application/models/SurveymenuEntries.php @@ -0,0 +1,160 @@ +true), + array('title, menu_title, menu_icon, menu_class, action, template, partial, permission, permissionGrade, classes, getdatamethod', 'length', 'max'=>255), + array('description, menu_description, language, data, created_at', 'safe'), + // The following rule is used by search(). + // @todo Please remove those attributes that should not be searched. + array('id, menu_id, priority, title, description, menu_title, menu_description, menu_icon, menu_class, action, template, partial, language, permission, permissionGrade, classes, data, getdatamethod, changed_at, changed_by, created_at, created_by', 'safe', 'on'=>'search'), + ); + } + + /** + * @return array relational rules. + */ + public function relations() + { + // NOTE: you may need to adjust the relation name and the related + // class name for the relations automatically generated below. + return array( + 'menu' => array(self::BELONGS_TO, 'Surveymenu', 'menu_id'), + ); + } + + /** + * @return array customized attribute labels (name=>label) + */ + public function attributeLabels() + { + return array( + 'id' => 'ID', + 'menu_id' => 'Menu', + 'priority' => 'Priority', + 'title' => 'Title', + 'description' => 'Description', + 'menu_title' => 'Menu Title', + 'menu_description' => 'Menu Description', + 'menu_icon' => 'Menu Icon', + 'menu_class' => 'Menu Class', + 'action' => 'Action', + 'template' => 'Template', + 'partial' => 'Partial', + 'language' => 'Language', + 'permission' => 'Permission', + 'permissionGrade' => 'Permission Grade', + 'classes' => 'Classes', + 'data' => 'Data', + 'getdatamethod' => 'Getdatamethod', + 'changed_at' => 'Changed At', + 'changed_by' => 'Changed By', + 'created_at' => 'Created At', + 'created_by' => 'Created By', + ); + } + + /** + * Retrieves a list of models based on the current search/filter conditions. + * + * Typical usecase: + * - Initialize the model fields with values from filter form. + * - Execute this method to get CActiveDataProvider instance which will filter + * models according to data in model fields. + * - Pass data provider to CGridView, CListView or any similar widget. + * + * @return CActiveDataProvider the data provider that can return the models + * based on the search/filter conditions. + */ + public function search() + { + // @todo Please modify the following code to remove attributes that should not be searched. + + $criteria=new CDbCriteria; + + $criteria->compare('id',$this->id); + $criteria->compare('menu_id',$this->menu_id); + $criteria->compare('priority',$this->priority); + $criteria->compare('title',$this->title,true); + $criteria->compare('description',$this->description,true); + $criteria->compare('menu_title',$this->menu_title,true); + $criteria->compare('menu_description',$this->menu_description,true); + $criteria->compare('menu_icon',$this->menu_icon,true); + $criteria->compare('menu_class',$this->menu_class,true); + $criteria->compare('action',$this->action,true); + $criteria->compare('template',$this->template,true); + $criteria->compare('partial',$this->partial,true); + $criteria->compare('language',$this->language,true); + $criteria->compare('permission',$this->permission,true); + $criteria->compare('permissionGrade',$this->permissionGrade,true); + $criteria->compare('classes',$this->classes,true); + $criteria->compare('data',$this->data,true); + $criteria->compare('getdatamethod',$this->getdatamethod,true); + $criteria->compare('changed_at',$this->changed_at,true); + $criteria->compare('changed_by',$this->changed_by); + $criteria->compare('created_at',$this->created_at,true); + $criteria->compare('created_by',$this->created_by); + + return new CActiveDataProvider($this, array( + 'criteria'=>$criteria, + )); + } + + /** + * Returns the static model of the specified AR class. + * Please note that you should have this exact method in all your CActiveRecord descendants! + * @param string $className active record class name. + * @return SurveymenuEntries the static model class + */ + public static function model($className=__CLASS__) + { + return parent::model($className); + } +} diff --git a/application/views/admin/survey/editLocalSettings_main_view.php b/application/views/admin/survey/editLocalSettings_main_view.php index 07e5337f33d..cacebbfee09 100644 --- a/application/views/admin/survey/editLocalSettings_main_view.php +++ b/application/views/admin/survey/editLocalSettings_main_view.php @@ -18,21 +18,19 @@
renderPartial('/admin/survey/breadcrumb', array('oSurvey'=>$oSurvey, 'active'=>$sTitle)); ?> -

+ $this->renderPartial('/admin/survey/breadcrumb', array('oSurvey'=>$oSurvey, 'active'=>$entryData['title'])); ?> +

- $panel['name'],'name'=>$panel['name'],'class'=>'form-horizontal form30')); ?> + $entryData['name'],'name'=>$entryData['name'],'class'=>'form-horizontal form30')); ?>
- hasSurveyPermission($iSurveyID, $panel['permission'], $panel['permissionGrade'])):?> -
- renderPartial($panel['template'],$panel['data']); ?> -
- +
+ renderPartial($entryData['partial'],$templateData); ?> +
- + diff --git a/application/views/admin/survey/settings/default.xml b/application/views/admin/survey/settings/default.xml new file mode 100644 index 00000000000..97f3091f15b --- /dev/null +++ b/application/views/admin/survey/settings/default.xml @@ -0,0 +1,19 @@ + + + + surveysetting + Surveysettings + + generalsettings + surveytexts + presentation + publication + panelintegration + tokens + ressources + + 1.0.0 + \ No newline at end of file diff --git a/application/views/admin/survey/settings/panelintegration.xml b/application/views/admin/survey/settings/panelintegration.xml new file mode 100644 index 00000000000..d6e97f7d2b0 --- /dev/null +++ b/application/views/admin/survey/settings/panelintegration.xml @@ -0,0 +1,32 @@ + + + + panelintegration + Edit survey panel integration + + Panel integration + Define panel integrations for your survey + + fa-link + + 1.0.0 + surveygeneralsettings + + + + /admin/survey/subview/accordion/_integration_panel + + + surveylocale + read + col-sm-12 col-md-7 content-right + + _tabPanelIntegration + \ No newline at end of file diff --git a/application/views/admin/survey/settings/plugins.xml b/application/views/admin/survey/settings/plugins.xml new file mode 100644 index 00000000000..28e5cbea95a --- /dev/null +++ b/application/views/admin/survey/settings/plugins.xml @@ -0,0 +1,31 @@ + + + + plugins + Plugin settings + + Plugins + Edit plugin settings + + fa-file-text-o + + 1.0.0 + surveygeneralsettings + + + + /admin/survey/subview/accordion/_plugins_panel + + surveylocale + read + col-sm-12 col-md-7 content-right + + _generalTabEditSurvey + \ No newline at end of file diff --git a/application/views/admin/survey/settings/presentation.xml b/application/views/admin/survey/settings/presentation.xml new file mode 100644 index 00000000000..a1f868d29de --- /dev/null +++ b/application/views/admin/survey/settings/presentation.xml @@ -0,0 +1,31 @@ + + + + generalsettings + Presentation & navigation settings + + Presentation + Edit presentation and navigation settings + + fa-eye-slash + + 1.0.0 + surveygeneralsettings + + + + /admin/survey/subview/tab_edit_view + + surveylocale + read + col-sm-12 col-md-7 content-right + + _tabPresentationNavigation + \ No newline at end of file diff --git a/application/views/admin/survey/settings/publication.xml b/application/views/admin/survey/settings/publication.xml new file mode 100644 index 00000000000..96f9c7b9730 --- /dev/null +++ b/application/views/admin/survey/settings/publication.xml @@ -0,0 +1,31 @@ + + + + publication + Publication and access control settings + + Publication&Access + Edit settings for publicationa and access control + + fa-key + + 1.0.0 + surveygeneralsettings + + + + /admin/survey/subview/accordion/_publication_panel + + surveylocale + read + col-sm-12 col-md-7 content-right + + _tabPublicationAccess + \ No newline at end of file diff --git a/application/views/admin/survey/settings/ressources.xml b/application/views/admin/survey/settings/ressources.xml new file mode 100644 index 00000000000..7556af6b336 --- /dev/null +++ b/application/views/admin/survey/settings/ressources.xml @@ -0,0 +1,31 @@ + + + + ressources + Add/Edit ressources to the survey + + Ressources + Add/Edit ressources to the survey + + fa-file + + 1.0.0 + surveygeneralsettings + + + + /admin/survey/subview/accordion/_resources_panel + + surveylocale + read + col-sm-12 col-md-7 content-right + + _tabResourceManagement + \ No newline at end of file diff --git a/application/views/admin/survey/settings/surveytexts.xml b/application/views/admin/survey/settings/surveytexts.xml index 72d1f239536..746df55f156 100644 --- a/application/views/admin/survey/settings/surveytexts.xml +++ b/application/views/admin/survey/settings/surveytexts.xml @@ -8,8 +8,8 @@ This Entries can either point to a general template file, or to a newly created generalsettings Edit survey text elements - General settings - Survey texts + Survey texts + Edit survey text elements fa-file-text-o diff --git a/application/views/admin/survey/settings/tokens.xml b/application/views/admin/survey/settings/tokens.xml new file mode 100644 index 00000000000..97916d244c9 --- /dev/null +++ b/application/views/admin/survey/settings/tokens.xml @@ -0,0 +1,32 @@ + + + + tokens + Token handling + + Participant tokens + Define how tokens should be treated or generated + + fa-users + + 1.0.0 + surveygeneralsettings + + + + /admin/survey/subview/accordion/_tokens_panel + + + surveylocale + read + col-sm-12 col-md-7 content-right + + _tabTokens + \ No newline at end of file diff --git a/application/views/admin/survey/subview/accordion/_generaloptions_panel.php b/application/views/admin/survey/subview/accordion/_generaloptions_panel.php index 7d785ab06ae..7698056a12f 100644 --- a/application/views/admin/survey/subview/accordion/_generaloptions_panel.php +++ b/application/views/admin/survey/subview/accordion/_generaloptions_panel.php @@ -47,203 +47,210 @@ function checkSelect2Languages(mylangs) };"; Yii::app()->getClientScript()->registerScript('confirmLanguage',$sConfirmLanguage,CClientScript::POS_BEGIN); ?> + +
+
+
+ +
+ +
+ +
+
- -
- -
- -
-
+ +
+ +
+ findByPk($surveyid)->additionalLanguages as $sSurveyLang) + { + if(!array_key_exists($sSurveyLang,$aAllLanguages)) + { + $aAllLanguages[$sSurveyLang]=getLanguageNameFromCode($sSurveyLang,false); + } + } + unset($aAllLanguages[$esrow['language']]); + + Yii::app()->getController()->widget('yiiwheels.widgets.select2.WhSelect2', array( + 'asDropDownList' => true, + 'htmlOptions'=>array('multiple'=>'multiple','style'=>"width: 100%"), + 'data' => $aAllLanguages, + 'value' => Survey::model()->findByPk($surveyid)->additionalLanguages, + 'name' => 'additional_languages', + 'pluginOptions' => array( + 'placeholder' => gt('Select additional languages','unescaped'), + ))); + ?> + findByPk($surveyid)->additionalLanguages); ?>'> +
+
- -
- -
+ findByPk($surveyid)->additionalLanguages as $sSurveyLang) - { - if(!array_key_exists($sSurveyLang,$aAllLanguages)) - { - $aAllLanguages[$sSurveyLang]=getLanguageNameFromCode($sSurveyLang,false); - } - } - unset($aAllLanguages[$esrow['language']]); - - Yii::app()->getController()->widget('yiiwheels.widgets.select2.WhSelect2', array( - 'asDropDownList' => true, - 'htmlOptions'=>array('multiple'=>'multiple','style'=>"width: 100%"), - 'data' => $aAllLanguages, - 'value' => Survey::model()->findByPk($surveyid)->additionalLanguages, - 'name' => 'additional_languages', - 'pluginOptions' => array( - 'placeholder' => gt('Select additional languages','unescaped'), - ))); - ?> - findByPk($surveyid)->additionalLanguages); ?>'> -
-
+ if (Yii::app()->session['loginID']==$esrow['owner_id'] || Permission::model()->hasGlobalPermission('superadmin','read')):?> +
+ +
getController()->widget('yiiwheels.widgets.select2.WhSelect2', array( + 'asDropDownList' => true, + 'htmlOptions'=>array('style'=>"width: 80%"), + 'data' => $users, + 'value' => $esrow['owner_id'], + 'name' => 'owner_id', + 'pluginOptions' => array( + ) + )); + ?> +
+
+ - - session['loginID']==$esrow['owner_id'] || Permission::model()->hasGlobalPermission('superadmin','read')):?> -
- -
getController()->widget('yiiwheels.widgets.select2.WhSelect2', array( - 'asDropDownList' => true, - 'htmlOptions'=>array('style'=>"width: 80%"), - 'data' => $users, - 'value' => $esrow['owner_id'], - 'name' => 'owner_id', - 'pluginOptions' => array( - ) - )); - ?> + + +
+ +
+ +
-
- + +
+ +
+ +
+
- -
- -
- -
-
+ +
+ +
+ +
+
- -
- -
- -
-
+ +
+ +
+ +
+
- -
- -
- -
-
+ + +
+ +
+ +
+
- -
- -
- -
-
+ +
+ +
+ +
+
- - -
- -
- -
-
+ +
+ +
+ 'dateformat','size'=>'1', 'class'=>'form-control')); ?> +
+
- -
- -
- -
-
+ +
+ +
+ 'numberformat','size'=>'1', 'class'=>'form-control')); ?> +
+
- -
- -
- 'dateformat','size'=>'1', 'class'=>'form-control')); ?> -
-
+ +
+ +
+ ' /> +
+
- -
- -
- 'numberformat','size'=>'1', 'class'=>'form-control')); ?> -
-
+ +
+ +
+ ' /> +
+
- -
- -
- ' /> -
-
+ +
+ +
+ ' /> +
+
- -
- -
- ' /> -
-
+ +
+ +
+ +
+
- -
- -
- ' /> -
+
- - -
- -
- +
+ +
+ +
+ widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array( + 'name' => 'format', + 'value'=> $esrow['format'] , + 'selectOptions'=>array( + 'S' => gT('Question by Question','unescaped'), + 'G' => gT('Group by Group','unescaped'), + 'A' => gT('All in one','unescaped')) + ));?> +
-
- - - - -
- -
- widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array( - 'name' => 'format', - 'value'=> $esrow['format'] , - 'selectOptions'=>array( - 'S' => gT('Question by Question','unescaped'), - 'G' => gT('Group by Group','unescaped'), - 'A' => gT('All in one','unescaped')) - ));?> -
-
+ +
+ +
+ - hasGlobalPermission('superadmin','read') || Permission::model()->hasGlobalPermission('templates','read') || hasTemplateManageRights(Yii::app()->session["loginID"], $tname) == 1 || $esrow['template']==htmlspecialchars($tname) ) { ?> - - - -
-
- <?php  eT("Template preview image"); ?>/preview.png' /> -
-
+ if (Permission::model()->hasGlobalPermission('superadmin','read') || Permission::model()->hasGlobalPermission('templates','read') || hasTemplateManageRights(Yii::app()->session["loginID"], $tname) == 1 || $esrow['template']==htmlspecialchars($tname) ) { ?> + + + +
+
+ <?php  eT("Template preview image"); ?>/preview.png' /> +
+
+ +
+
+
diff --git a/application/views/admin/survey/subview/accordion/_integration_panel.php b/application/views/admin/survey/subview/accordion/_integration_panel.php index 85f544bdd80..efbde90597d 100755 --- a/application/views/admin/survey/subview/accordion/_integration_panel.php +++ b/application/views/admin/survey/subview/accordion/_integration_panel.php @@ -24,15 +24,16 @@ var sEditParam = ""; var iSurveyId = ""; - - -
-
-
+ +
+
+
- - - + + + + +
diff --git a/application/views/admin/survey/subview/accordion/_notification_panel.php b/application/views/admin/survey/subview/accordion/_notification_panel.php index 8235946bb1c..f7c7db4ac0a 100755 --- a/application/views/admin/survey/subview/accordion/_notification_panel.php +++ b/application/views/admin/survey/subview/accordion/_notification_panel.php @@ -4,195 +4,197 @@ */ ?> -
+
- -
- -
- 70, 'class'=>"form-control")); ?> -
-
- - -
- -
- 70, 'class'=>"form-control")) ?> +
+ +
+ +
+ + + + + widget('yiiwheels.widgets.switch.WhSwitch', array( + 'name' => 'datestamp', + 'value'=> $esrow['datestamp'] == "Y", + 'onLabel'=>gT('On'), + 'offLabel'=>gT('Off'), + 'events'=>array('switchChange.bootstrapSwitch'=>"function(event,state){ + if ($('#anonymized').is(':checked') == true) { + $('#datestampModal').modal(); + } + }") + )); + $this->widget('bootstrap.widgets.TbModal', array( + 'id' => 'datestampModal', + 'header' => gt('Warning','unescaped'), + 'content' => '

'.gT("If the option -Anonymized responses- is activated only a dummy date stamp (1980-01-01) will be used for all responses to ensure the anonymity of your participants.").'

', + 'footer' => TbHtml::button('Close', array('data-dismiss' => 'modal')) + )); + } + ?> +
-
- - -
- -
- - +
+ +
+ - - - + + widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'datestamp', - 'value'=> $esrow['datestamp'] == "Y", - 'onLabel'=>gT('On'), - 'offLabel'=>gT('Off'), - 'events'=>array('switchChange.bootstrapSwitch'=>"function(event,state){ - if ($('#anonymized').is(':checked') == true) { - $('#datestampModal').modal(); - } - }") - )); - $this->widget('bootstrap.widgets.TbModal', array( - 'id' => 'datestampModal', - 'header' => gt('Warning','unescaped'), - 'content' => '

'.gT("If the option -Anonymized responses- is activated only a dummy date stamp (1980-01-01) will be used for all responses to ensure the anonymity of your participants.").'

', - 'footer' => TbHtml::button('Close', array('data-dismiss' => 'modal')) + 'name' => 'ipaddr', + 'value'=> $esrow['ipaddr'] == "Y", + 'onLabel'=>gT('On'), + 'offLabel'=>gT('Off') )); - } - ?> + } ?> +
-
- -
- -
- +
+ +
+ + + + + widget('yiiwheels.widgets.switch.WhSwitch', array( + 'name' => 'refurl', + 'value'=> $esrow['refurl'] == "Y", + 'onLabel'=>gT('On'), + 'offLabel'=>gT('Off') + )); } ?> - - +
+ + +
+ +
+ + + + + + + + + + widget('yiiwheels.widgets.switch.WhSwitch', array( + 'name' => 'savetimings', + 'value'=> $esrow['savetimings'] == "Y", + 'onLabel'=>gT('On'), + 'offLabel'=>gT('Off') + )); + ?> + +
+
+ + +
+ +
widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'ipaddr', - 'value'=> $esrow['ipaddr'] == "Y", + 'name' => 'assessments', + 'value'=> $esrow['assessments'] == "Y", 'onLabel'=>gT('On'), 'offLabel'=>gT('Off') )); - } ?> + ?>
-
- -
- -
- - - - - widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'refurl', - 'value'=> $esrow['refurl'] == "Y", + +
+ +
+ widget('yiiwheels.widgets.switch.WhSwitch', array( + 'name' => 'allowsave', + 'value'=> $esrow['allowsave'] == "Y", 'onLabel'=>gT('On'), 'offLabel'=>gT('Off') - )); - } ?> + )); + ?> +
- - -
- -
- - - - - - - - - - widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'savetimings', - 'value'=> $esrow['savetimings'] == "Y", - 'onLabel'=>gT('On'), - 'offLabel'=>gT('Off') - )); - ?> - +
+ +
+ +
+ 70, 'class'=>"form-control")); ?> +
-
- -
- -
widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'assessments', - 'value'=> $esrow['assessments'] == "Y", - 'onLabel'=>gT('On'), - 'offLabel'=>gT('Off') - )); - ?>
-
- - -
- -
- widget('yiiwheels.widgets.switch.WhSwitch', array( - 'name' => 'allowsave', - 'value'=> $esrow['allowsave'] == "Y", - 'onLabel'=>gT('On'), - 'offLabel'=>gT('Off') - )); - ?> + +
+ +
+ 70, 'class'=>"form-control")) ?> +
-
- -
- -
- widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array( - 'name' => 'googleanalyticsapikeysetting', - 'value'=> $esrow['googleanalyticsapikeysetting'], - 'selectOptions'=>array( - "N"=>gT("None",'unescaped'), - "Y"=>gT("Use settings below",'unescaped'), - "G"=>gT("Use global settings",'unescaped') - ) - ));?> + +
+ +
+ widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array( + 'name' => 'googleanalyticsapikeysetting', + 'value'=> $esrow['googleanalyticsapikeysetting'], + 'selectOptions'=>array( + "N"=>gT("None",'unescaped'), + "Y"=>gT("Use settings below",'unescaped'), + "G"=>gT("Use global settings",'unescaped') + ) + ));?> +
-
- -
- -
- 20), array('class'=>"form-control")); ?> + +
+ +
+ 20), array('class'=>"form-control")); ?> +
-
- -
- -
- widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array( - 'name' => 'googleanalyticsstyle', - 'value'=> $esrow['googleanalyticsstyle'] , - 'selectOptions'=>array( - "0"=>gT("Off",'unescaped'), - "1"=>gT("Default",'unescaped'), - "2"=>gT("Survey-SID/Group",'unescaped')) - ));?> + +
+ +
+ widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array( + 'name' => 'googleanalyticsstyle', + 'value'=> $esrow['googleanalyticsstyle'] , + 'selectOptions'=>array( + "0"=>gT("Off",'unescaped'), + "1"=>gT("Default",'unescaped'), + "2"=>gT("Survey-SID/Group",'unescaped')) + ));?> +
diff --git a/assets/packages/adminpanel/build/lsadminpanel.js b/assets/packages/adminpanel/build/lsadminpanel.js index c565fd38abd..ef8a96a8767 100644 --- a/assets/packages/adminpanel/build/lsadminpanel.js +++ b/assets/packages/adminpanel/build/lsadminpanel.js @@ -28574,7 +28574,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); return { 'currentTab': 'settings', 'questiongroups': [], - 'mainMenu': [] + 'menues': [] }; }, computed: { @@ -28592,6 +28592,12 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); }, activeTab(currentTab) { return this.currentTab === currentTab; + }, + checkIsActive(link) { + let locationUrl = document.createElement('a');locationUrl.href = location.href; + let checkUrl = document.createElement('a');checkUrl.href = link; + console.log(locationUrl.pathname, checkUrl.pathname, link, locationUrl.pathname == checkUrl.pathname); + return locationUrl.pathname == checkUrl.pathname; } }, mounted() { @@ -28603,14 +28609,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); }); this.get(this.getMenuUrl).then(result => { console.log(result); - let locationUrl = document.createElement('a'); - locationUrl.href = location.href; - self.mainMenu = result.data.menuEntries; - __WEBPACK_IMPORTED_MODULE_1_lodash___default.a.each(self.mainMenu, (menuitem, i) => { - let checkUrl = document.createElement('a');checkUrl.href = menuitem.link; - menuitem.active = locationUrl.pathname == checkUrl.pathname; - console.log(menuitem.active, locationUrl.pathname, checkUrl.pathname, menuitem.link, locationUrl.pathname == checkUrl.pathname); - }); + self.menues = result.data.menues; self.$forceUpdate(); }); } @@ -29013,44 +29012,51 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c _vm.changeTab('questiontree') } } - }, [_vm._v(_vm._s(_vm.translate.structure))])])]), _vm._v(" "), _c('ul', { - staticClass: "list-group" - }, _vm._l((_vm.mainMenu), function(menuItem, index) { - return _c('li', { - directives: [{ - name: "show", - rawName: "v-show", - value: (_vm.activeTab('settings')), - expression: "activeTab('settings')" - }], - staticClass: "list-group-item", - staticStyle: { - "padding": "0" - } - }, [_c('a', { - staticClass: "ls-flex-row nowrap align-item-center align-content-center pjax", + }, [_vm._v(_vm._s(_vm.translate.structure))])])]), _vm._v(" "), _vm._l((_vm.menues), function(menu) { + return _c('ul', { + key: menu.title, + staticClass: "list-group", attrs: { - "href": menuItem.link + '?pjax=true', - "title": menuItem.description, - "data-toggle": "tooltip" - } - }, [_c('div', { - class: menuItem.active ? 'col-sm-10 selected' : 'col-sm-12', - staticStyle: { - "padding": "15px 10px" - } - }, [_c('i', { - staticClass: "fa", - class: menuItem.icon - }, [_vm._v(" ")]), _vm._v("  \n " + _vm._s(menuItem.title) + "\n ")]), _vm._v(" "), (menuItem.active) ? _c('div', { - staticClass: "col-sm-2 background white", - staticStyle: { - "padding": "15px 10px" - } - }, [_c('i', { - staticClass: "fa fa-chevron-right" - }, [_vm._v(" ")])]) : _vm._e()])]) - })), _vm._v(" "), _c('div', { + "title": menu.title + } + }, _vm._l((menu.entries), function(menuItem, index) { + return _c('li', { + directives: [{ + name: "show", + rawName: "v-show", + value: (_vm.activeTab('settings')), + expression: "activeTab('settings')" + }], + key: menuItem.id, + staticClass: "list-group-item", + staticStyle: { + "padding": "0" + } + }, [_c('a', { + staticClass: "ls-flex-row nowrap align-item-center align-content-center pjax", + attrs: { + "href": menuItem.link + '?menu=' + menu.menu_title, + "title": menuItem.menu_description, + "data-toggle": "tooltip" + } + }, [_c('div', { + class: _vm.checkIsActive(menuItem.link) ? 'col-sm-10 selected' : 'col-sm-12', + staticStyle: { + "padding": "15px 10px" + } + }, [_c('i', { + staticClass: "fa", + class: 'fa-' + menuItem.menu_icon + }, [_vm._v(" ")]), _vm._v("  \n " + _vm._s(menuItem.menu_title) + "\n ")]), _vm._v(" "), (_vm.checkIsActive(menuItem.link)) ? _c('div', { + staticClass: "col-sm-2 background white", + staticStyle: { + "padding": "15px 10px" + } + }, [_c('i', { + staticClass: "fa fa-chevron-right" + }, [_vm._v(" ")])]) : _vm._e()])]) + })) + }), _vm._v(" "), _c('div', { directives: [{ name: "show", rawName: "v-show", @@ -29066,7 +29072,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c "editentity": _vm.editEntity, "openentity": _vm.openEntity } - })], 1)])]) + })], 1)], 2)]) },staticRenderFns: []} module.exports.render._withStripped = true if (false) {