Skip to content

Commit

Permalink
Port the functionality 'Create/edit/delete labels' to the Yii PHP fra…
Browse files Browse the repository at this point in the history
…mework - dony by GCI participant Ivan

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11522 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Nov 27, 2011
1 parent f28cdae commit 8fdb202
Show file tree
Hide file tree
Showing 14 changed files with 364 additions and 244 deletions.
13 changes: 10 additions & 3 deletions application/config/routes.php
Expand Up @@ -46,16 +46,23 @@

//Admin Routes
$route['admin'] = "admin/index";

$route['admin/labels/view'] = "admin/labels/view";

//question
$route['admin/question/newquestion/(:num)/(:num)'] = "admin/question/index/addquestion/$1/$2";
$route['admin/question/editquestion/(:num)/(:num)/(:num)'] = "admin/question/index/editquestion/$1/$2/$3";
$route['admin/question/deletequestion/(:num)/(:num)/(:num)'] = "admin/question/delete/delquestion/$1/$2/$3";

$route['admin/labels/exportmulti'] = "admin/labels/exportmulti";
$route['admin/labels/process'] = "admin/labels/process";
$route['admin/labels/view/<lid:\d+>'] = "admin/labels/view/<lid>";
$route['admin/labels/<action:\w+>'] = "admin/labels/index/<action>";
$route['admin/labels/<action:\w+>/<lid:\d+>'] = "admin/labels/index/<action>/<id>";
//labels
$route['admin/labels/newlabel'] = "admin/labels/index/newlabelset";
$route['admin/labels/editlabel/(:num)'] = "admin/labels/index/editlabelset/$1";
//$route['admin/labels/newlabel'] = "admin/labels/index/newlabelset";
//$route['admin/labels/editlabel/(:num)'] = "admin/labels/index/editlabelset/$1";

$route['<controller:\w+>/<action:\w+>'] = '<controller>/<action>';

//Expression Manager tests
$route['admin/expressions'] = "admin/expressions/index";
Expand Down
27 changes: 14 additions & 13 deletions application/controllers/AdminController.php
Expand Up @@ -24,13 +24,12 @@ class AdminController extends LSYii_Controller
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();

$updatelastcheck = '';

$this->_sessioncontrol();
protected function _init()
{
parent::_init();
$updatelastcheck = '';

$this->_sessioncontrol();

if (Yii::app()->getConfig('buildnumber') != "" && Yii::app()->getConfig('updatecheckperiod') > 0 && $updatelastcheck < date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", "-". Yii::app()->getConfig('updatecheckperiod')." days"))
updatecheck();
Expand Down Expand Up @@ -111,12 +110,14 @@ public function actions()
'index' => 'application.controllers.admin.index',
'globalsettings' => 'application.controllers.admin.globalsettings',
'quotas' => 'application.controllers.admin.quotas',
'export' => 'application.controllers.admin.export',
'assessments' =>'application.controllers.admin.assessments',
'checkintegrity' => 'application.controllers.admin.checkintegrity',
'survey' => 'application.controllers.admin.surveyaction',
'printablesurvey' => 'application.controllers.admin.printablesurvey',
'tokens' => 'application.controllers.admin.tokens',
'export' => 'application.controllers.admin.export',
'assessments' =>'application.controllers.admin.assessments',
'checkintegrity' => 'application.controllers.admin.checkintegrity',
'labels' => 'application.controllers.admin.labels',
'htmleditor_pop' => 'application.controllers.admin.htmleditor_pop',
'survey' => 'application.controllers.admin.surveyaction',
'printablesurvey' => 'application.controllers.admin.printablesurvey',
'tokens' => 'application.controllers.admin.tokens',
'surveypermission' => 'application.controllers.admin.surveypermission',
'questiongroup' => 'application.controllers.admin.questiongroup',
'question' => 'application.controllers.admin.question',
Expand Down
36 changes: 21 additions & 15 deletions application/controllers/admin/htmleditor_pop.php
Expand Up @@ -17,35 +17,41 @@
//include_once("login_check.php");


class htmleditor_pop extends Admin_Controller {
class htmleditor_pop extends CAction {


function __construct()
function run()
{
parent::__construct();
$fieldname = $_GET['index'];
foreach($_GET[''] as $key=>$val)
{
$fieldtext = $key;
$fieldtype = $val;
}


$this->index($fieldname, $fieldtext, $fieldtype);
}

function index($fieldname=0,$fieldtext=0,$fieldtype=0,$action=0,$sid=0,$gid=0,$qid=0,$lang=0)
{
$yii = Yii::app();
$sid = (int) $sid;
$gid = (int) $gid;
$qid = (int) $qid;

//require_once(dirname(__FILE__).'/../config-defaults.php');
//require_once(dirname(__FILE__).'/../common.php');

if (!$lang)
{
$this->load->library('Limesurvey_lang',array('en'));
$yii->loadLibrary('Limesurvey_lang',array('en'));

$clang = $this->limesurvey_lang; // limesurvey_lang("en");
$clang = $yii->lang; // limesurvey_lang("en");

}
else
{
$this->load->library('Limesurvey_lang',array($lang));
$clang = $this->limesurvey_lang; // new limesurvey_lang($_GET['lang']);
$yii->loadLibrary('Limesurvey_lang',array($lang));
$clang = $yii->lang; // new limesurvey_lang($_GET['lang']);
}

if (!$fieldname || !$fieldtext)
Expand All @@ -71,7 +77,7 @@ function index($fieldname=0,$fieldtext=0,$fieldtype=0,$action=0,$sid=0,$gid=0,$q
</table>
<form onsubmit="self.close()">
<input type="submit" value="'.$clang->gT("Close Editor").'" />
<input type="hidden" name="checksessionbypost" value="'.$this->session->userdata('checksessionpost').'" />
<input type="hidden" name="checksessionbypost" value="'.$yii->session['checksessionpost'].'" />
</form>
</body>
</html>';
Expand Down Expand Up @@ -107,16 +113,16 @@ function index($fieldname=0,$fieldtext=0,$fieldtype=0,$action=0,$sid=0,$gid=0,$q
<title>'.sprintf($clang->gT("Editing %s"), $fieldtext).'</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<script type="text/javascript" src="'.$this->config->item('generalscripts').'jquery/jquery.js"></script>
<script type="text/javascript" src="'.$this->config->item('sCKEditorURL').'/ckeditor.js"></script>
<script type="text/javascript" src="'.$yii->getConfig('generalscripts').'jquery/jquery.js"></script>
<script type="text/javascript" src="'.$yii->getConfig('sCKEditorURL').'/ckeditor.js"></script>
</head>';


$output .= "
<body>
<form method='post' onsubmit='saveChanges=true;'>
<input type='hidden' name='checksessionbypost' value='".$this->session->userdata('checksessionpost')."' />
<input type='hidden' name='checksessionbypost' value='".$yii->session['checksessionpost']."' />
<script type='text/javascript'>
<!--
function closeme()
Expand All @@ -136,7 +142,7 @@ function closeme()
CKEDITOR.on('instanceReady',CKeditor_OnComplete);
var oCKeditor = CKEDITOR.replace( 'MyTextarea' , { height : '350',
width : '98%',
customConfig : \"".$this->config->item('sCKEditorURL')."/limesurvey-config.js\",
customConfig : \"".$yii->getConfig('sCKEditorURL')."/limesurvey-config.js\",
toolbarStartupExpanded : true,
ToolbarCanCollapse : false,
toolbar : '".$toolbarname."',
Expand All @@ -145,7 +151,7 @@ function closeme()
LimeReplacementFieldsQID : \"".$qid."\",
LimeReplacementFieldsType: \"".$fieldtype."\",
LimeReplacementFieldsAction: \"".$action."\",
smiley_path: \"".$this->config->item('rooturl')."/upload/images/smiley/msn/\"
smiley_path: \"".$yii->getConfig('rooturl')."/upload/images/smiley/msn/\"
{$htmlformatoption} });
});
Expand Down

0 comments on commit 8fdb202

Please sign in to comment.