Skip to content

Commit

Permalink
Fixed issue: Template editor not using syntax highlighting according …
Browse files Browse the repository at this point in the history
…to file type
  • Loading branch information
c-schmitz committed May 15, 2012
1 parent c62fc4f commit d31f07d
Show file tree
Hide file tree
Showing 20 changed files with 229 additions and 224 deletions.
4 changes: 3 additions & 1 deletion application/controllers/admin/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ public function index($editfile = 'startpage.pstpl', $screenname = 'welcome', $t
$aViewUrls = $this->_initialise($templatename, $screenname, $editfile);
$this->getController()->_js_admin_includes(Yii::app()->getConfig('adminscripts') . 'templates.js');
$this->getController()->_css_admin_includes(Yii::app()->getConfig('adminscripts') . 'codemirror_ui/lib/CodeMirror-2.0/lib/codemirror.css');
$this->getController()->_js_admin_includes(Yii::app()->getConfig('adminscripts') . 'codemirror_ui/lib/CodeMirror-2.0/mode/htmlmixed/htmlmixed.js');
$this->getController()->_css_admin_includes(Yii::app()->getConfig('adminscripts') . 'codemirror_ui/lib/CodeMirror-2.0/mode/css/css.css');
$this->getController()->_css_admin_includes(Yii::app()->getConfig('adminscripts') . 'codemirror_ui/lib/CodeMirror-2.0/mode/javascript/javascript.css');
$this->getController()->_css_admin_includes(Yii::app()->getConfig('adminscripts') . 'codemirror_ui/lib/CodeMirror-2.0/mode/xml/xml.css');
$this->getController()->_css_admin_includes(Yii::app()->getConfig('adminscripts') . 'codemirror_ui/css/codemirror-ui.css');


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ function checkuploadfiletype(filename)
<div class='menubar-left'>
<a href='<?php echo $this->createUrl("/admin"); ?>'>
<img src='<?php echo $sImageURL; ?>home.png' alt='<?php $clang->eT("Return to survey administration"); ?>' /></a>
<img src='<?php echo $sImageURL; ?>blank.gif' alt='' width='60' height='10' />
<img src='<?php echo $sImageURL; ?>separator.gif' class='separator' alt='' />

<?php
Expand Down
13 changes: 9 additions & 4 deletions application/views/admin/templates/templatesummary_view.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
<?php if (is_template_editable($templatename)==true)
{ ?>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/scripts/admin/codemirror_ui/lib/CodeMirror-2.0/lib/codemirror.js" ></script>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/scripts/admin/codemirror_ui/lib/CodeMirror-2.0/mode/javascript/javascript.js" ></script>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/scripts/admin/codemirror_ui/lib/CodeMirror-2.0/mode/css/css.js" ></script>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/scripts/admin/codemirror_ui/lib/CodeMirror-2.0/mode/htmlmixed/htmlmixed.js" ></script>
<?php if ($sEditorFileType=='htmlmixed')
{?>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/scripts/admin/codemirror_ui/lib/CodeMirror-2.0/mode/xml/xml.js" ></script>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/scripts/admin/codemirror_ui/lib/CodeMirror-2.0/mode/javascript/javascript.js" ></script>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/scripts/admin/codemirror_ui/lib/CodeMirror-2.0/mode/css/css.js" ></script>
<?php }
?>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/scripts/admin/codemirror_ui/lib/CodeMirror-2.0/mode/<?php echo $sEditorFileType; ?>/<?php echo $sEditorFileType; ?>.js" ></script>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/scripts/admin/codemirror_ui/js/codemirror-ui.js" ></script>
<script type="text/javascript">
var editorfiletype='<?php echo $sEditorFileType; ?>';
</script>
<div class='header'>
<?php echo sprintf($clang->gT("Editing template '%s' - File '%s'"),$templatename,$editfile); ?>
</div>
<div id='templateleft' style="float:left;padding-left:1em">
<div id='templateleft' style="float:left;padding-left:1em;width:12%;">
<div >
<?php $clang->eT("Standard files:"); ?><br>
<select size='6' name='editfile' onchange="javascript: window.open('<?php echo $this->createUrl("admin/templates/fileredirect/templatename/".$templatename."/screenname/".urlencode($screenname)); ?>/editfile/'+escape(this.value), '_top')">
Expand Down
2 changes: 1 addition & 1 deletion styles/gringegreen/adminstyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -1653,5 +1653,5 @@ ol.organizer {

#templateleft select
{
width:150px;
width:140px;
}
20 changes: 10 additions & 10 deletions templates/default/assessment.pstpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<br />
<table class="assessment-table">
<tr>
<td class="assessment-heading">
{ASSESSMENT_HEADING}
</td>
</tr>
<tr>
<td class="assessments-container">
{ASSESSMENTS}
</td>
</tr>
<tr>
<td class="assessment-heading">
{ASSESSMENT_HEADING}
</td>
</tr>
<tr>
<td class="assessments-container">
{ASSESSMENTS}
</td>
</tr>
</table>
16 changes: 8 additions & 8 deletions templates/default/clearall.pstpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<br />
<table class="clearall-result">
<tr>
<td align="center">
<span class="warning-text">{ANSWERSCLEARED}</span>
<br /><br />
{RESTART}<br />
{CLOSEWINDOW}
</td>
</tr>
<tr>
<td align="center">
<span class="warning-text">{ANSWERSCLEARED}</span>
<br /><br />
{RESTART}<br />
{CLOSEWINDOW}
</td>
</tr>
</table>
<br />
20 changes: 10 additions & 10 deletions templates/default/completed.pstpl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<br />
<table class="completed-table">
<tr>
<td class="completed-text">
<br />
{COMPLETED}
<br />
<br />
{URL}
<br /><br />
</td>
</tr>
<tr>
<td class="completed-text">
<br />
{COMPLETED}
<br />
<br />
{URL}
<br /><br />
</td>
</tr>
</table>
<br />
6 changes: 3 additions & 3 deletions templates/default/groupdescription.pstpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<br />
<span class="group-description">{GROUPDESCRIPTION}</span>
<br /><br />
<br />
<span class="group-description">{GROUPDESCRIPTION}</span>
<br /><br />
34 changes: 17 additions & 17 deletions templates/default/load.pstpl
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<table id="loadtable">
<tr>
<td class="load-heading">
<h3>{LOADHEADING}</h3>
</td>
</tr>
<tr>
<td align="center">
<br />
<p class="load-error">{LOADERROR}</p>
<p class="load-message">{LOADMESSAGE}</p>
<br />
<div class="load-form">{LOADFORM}</div>
<br />
<span class="return-to-survey">{RETURNTOSURVEY}</span>
<br /><br />
</td>
</tr>
<tr>
<td class="load-heading">
<h3>{LOADHEADING}</h3>
</td>
</tr>
<tr>
<td align="center">
<br />
<p class="load-error">{LOADERROR}</p>
<p class="load-message">{LOADMESSAGE}</p>
<br />
<div class="load-form">{LOADFORM}</div>
<br />
<span class="return-to-survey">{RETURNTOSURVEY}</span>
<br /><br />
</td>
</tr>
</table>
22 changes: 11 additions & 11 deletions templates/default/navigator.pstpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<table class="navigator-table">
<tr>
<td class="save-all">
{SAVE}
</td>
<td class="submit-buttons">
{NAVIGATOR}
</td>
<td class="clear-all">
{CLEARALL}
</td>
</tr>
<tr>
<td class="save-all">
{SAVE}
</td>
<td class="submit-buttons">
{NAVIGATOR}
</td>
<td class="clear-all">
{CLEARALL}
</td>
</tr>
</table>
13 changes: 6 additions & 7 deletions templates/default/print_group.pstpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<div class="survey-group{ODD_EVEN}">
<h2>{GROUPNAME}</h2>

<div class="survey-group{ODD_EVEN}">
<h2>{GROUPNAME}</h2>
<div class="group-desc">
{GROUPDESCRIPTION}
</div>

<div class="group-desc">
{GROUPDESCRIPTION}
</div>

{QUESTIONS}
{QUESTIONS}

</div>

30 changes: 15 additions & 15 deletions templates/default/print_question.pstpl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

<div id="question{QUESTION_ID}" class="{QUESTION_CLASS}">
<div class="q-text">
<h3>{QUESTION_NUMBER} [{QUESTION_CODE}]{QUESTION_TEXT} <span class="mandatory">{QUESTION_MANDATORY}</span></h3>
<p class="q-scenaria">{QUESTION_SCENARIO}</p>
<p class="q-type-help">{QUESTION_TYPE_HELP}</p>
<p class="q-man-message">{QUESTION_MAN_MESSAGE}</p>
<p class="q-validation">{QUESTION_VALID_MESSAGE}</p>
<p class="q-fvalidation">{QUESTION_FILE_VALID_MESSAGE}</p>
</div>
<div class="q-answer">
{ANSWER}
</div>
<div class="q-help">
{QUESTIONHELP}
</div>
<div id="question{QUESTION_ID}" class="{QUESTION_CLASS}">
<div class="q-text">
<h3>{QUESTION_NUMBER} [{QUESTION_CODE}]{QUESTION_TEXT} <span class="mandatory">{QUESTION_MANDATORY}</span></h3>
<p class="q-scenaria">{QUESTION_SCENARIO}</p>
<p class="q-type-help">{QUESTION_TYPE_HELP}</p>
<p class="q-man-message">{QUESTION_MAN_MESSAGE}</p>
<p class="q-validation">{QUESTION_VALID_MESSAGE}</p>
<p class="q-fvalidation">{QUESTION_FILE_VALID_MESSAGE}</p>
</div>
<div class="q-answer">
{ANSWER}
</div>
<div class="q-help">
{QUESTIONHELP}
</div>
</div>

46 changes: 23 additions & 23 deletions templates/default/print_survey.pstpl
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{SITENAME} - {SURVEYNAME}</title>
{HEADELEMENTS}
<head>
<title>{SITENAME} - {SURVEYNAME}</title>
{HEADELEMENTS}

<link rel="stylesheet" type="text/css" href="{TEMPLATEURL}print_template.css" />
</head>
<body>
<div id="limesurvey">
<h1>{SURVEYNAME}</h1>

<div class="survey-description">{SURVEYDESCRIPTION}</div>

<div class="survey-welcome">{WELCOME}</div>
<link rel="stylesheet" type="text/css" href="{TEMPLATEURL}print_template.css" />
</head>
<body>
<div id="limesurvey">
<h1>{SURVEYNAME}</h1>

<p class="x-questions">{THEREAREXQUESTIONS}</p>
{GROUPS}
{PRIVACY}
<p class="submit-by">
{END}<br />
<div class="survey-description">{SURVEYDESCRIPTION}</div>

<div class="survey-welcome">{WELCOME}</div>

<p class="x-questions">{THEREAREXQUESTIONS}</p>
{GROUPS}
{PRIVACY}
<p class="submit-by">
{END}<br />
{SUBMIT_BY}<br />
{FAX_TO}<br />
{SUBMIT_TEXT}<br />
{THANKS}<br />
</p>
</div>
{FAX_TO}<br />
{SUBMIT_TEXT}<br />
{THANKS}<br />
</p>
</div>

</body>
</body>
</html>
12 changes: 6 additions & 6 deletions templates/default/privacy.pstpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<table class='privacy'>
<tr>
<td width="15%">&nbsp;</td>
<td class='privacynote'>{PRIVACYMESSAGE}</td>
<td width="15%" >&nbsp;</td>
</tr>
<tr><td><br /> </td></tr>
<tr>
<td width="15%">&nbsp;</td>
<td class='privacynote'>{PRIVACYMESSAGE}</td>
<td width="15%" >&nbsp;</td>
</tr>
<tr><td><br /> </td></tr>
</table>
40 changes: 20 additions & 20 deletions templates/default/question.pstpl
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<div {QUESTION_ESSENTIALS} class="{QUESTION_CLASS}{QUESTION_MAN_CLASS}{QUESTION_INPUT_ERROR_CLASS}">
<table class="question-wrapper">
<tr>
<td class="questiontext">
<span class="asterisk">{QUESTION_MANDATORY}</span><span class="qnumcode">{QUESTION_NUMBER} {QUESTION_CODE} </span>{QUESTION_TEXT}<br /><span class="questionhelp">{QUESTION_HELP}</span>
{QUESTION_MAN_MESSAGE}
{QUESTION_VALID_MESSAGE}
{QUESTION_FILE_VALID_MESSAGE}
</td>
</tr>
<tr>
<td class="answer">
{ANSWER}
</td>
</tr>
<tr>
<td class="survey-question-help">
{QUESTIONHELP}
</td>
</tr>
</table>
<table class="question-wrapper">
<tr>
<td class="questiontext">
<span class="asterisk">{QUESTION_MANDATORY}</span><span class="qnumcode">{QUESTION_NUMBER} {QUESTION_CODE} </span>{QUESTION_TEXT}<br /><span class="questionhelp">{QUESTION_HELP}</span>
{QUESTION_MAN_MESSAGE}
{QUESTION_VALID_MESSAGE}
{QUESTION_FILE_VALID_MESSAGE}
</td>
</tr>
<tr>
<td class="answer">
{ANSWER}
</td>
</tr>
<tr>
<td class="survey-question-help">
{QUESTIONHELP}
</td>
</tr>
</table>
</div>
16 changes: 8 additions & 8 deletions templates/default/register.pstpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<table class="register-table">
<tr>
<td>
<span class="warning-text">{REGISTERERROR}</span>
<p class="register-message-1">{REGISTERMESSAGE1}</p>
<p class="register-message-2">{REGISTERMESSAGE2}</p>
<div class="register-form">{REGISTERFORM}</div>
</td>
</tr>
<tr>
<td>
<span class="warning-text">{REGISTERERROR}</span>
<p class="register-message-1">{REGISTERMESSAGE1}</p>
<p class="register-message-2">{REGISTERMESSAGE2}</p>
<div class="register-form">{REGISTERFORM}</div>
</td>
</tr>
</table>

0 comments on commit d31f07d

Please sign in to comment.