diff options
Diffstat (limited to 'framework/gii/views/common')
| -rw-r--r-- | framework/gii/views/common/code.php | 16 | ||||
| -rw-r--r-- | framework/gii/views/common/diff.php | 9 | ||||
| -rw-r--r-- | framework/gii/views/common/generator.php | 76 |
3 files changed, 101 insertions, 0 deletions
diff --git a/framework/gii/views/common/code.php b/framework/gii/views/common/code.php new file mode 100644 index 0000000..9d996c9 --- /dev/null +++ b/framework/gii/views/common/code.php @@ -0,0 +1,16 @@ +<?php +if($file->type==='php') +{ + echo '<div class="content">'; + highlight_string($file->content); + echo '</div>'; +} +else if(in_array($file->type,array('txt','js','css'))) +{ + echo '<div class="content">'; + echo nl2br($file->content); + echo '</div>'; +} +else + echo '<div class="error">Preview is not available for this file type.</div>'; +?>
\ No newline at end of file diff --git a/framework/gii/views/common/diff.php b/framework/gii/views/common/diff.php new file mode 100644 index 0000000..ed3f89c --- /dev/null +++ b/framework/gii/views/common/diff.php @@ -0,0 +1,9 @@ +<?php if($diff===false): ?> + <div class="error">Diff is not supported for this file type.</div> +<?php elseif(empty($diff)): ?> + <div class="error">No changes.</div> +<?php else: ?> + <div class="content"> + <pre class="diff"><?php echo $diff; ?></pre> + </div> +<?php endif; ?> diff --git a/framework/gii/views/common/generator.php b/framework/gii/views/common/generator.php new file mode 100644 index 0000000..8da17d5 --- /dev/null +++ b/framework/gii/views/common/generator.php @@ -0,0 +1,76 @@ +<div class="row template sticky"> + <?php echo $this->labelEx($model,'template'); ?> + <?php echo $this->dropDownList($model,'template',$templates); ?> + <div class="tooltip"> + Please select which set of the templates should be used to generated the code. + </div> + <?php echo $this->error($model,'template'); ?> +</div> + +<div class="buttons"> + <?php echo CHtml::submitButton('Preview',array('name'=>'preview')); ?> + + <?php if($model->status===CCodeModel::STATUS_PREVIEW && !$model->hasErrors()): ?> + <?php echo CHtml::submitButton('Generate',array('name'=>'generate')); ?> + <?php endif; ?> +</div> + +<?php if(!$model->hasErrors()): ?> + <div class="feedback"> + <?php if($model->status===CCodeModel::STATUS_SUCCESS): ?> + <div class="success"> + <?php echo $model->successMessage(); ?> + </div> + <?php elseif($model->status===CCodeModel::STATUS_ERROR): ?> + <div class="error"> + <?php echo $model->errorMessage(); ?> + </div> + <?php endif; ?> + + <?php if(isset($_POST['generate'])): ?> + <pre class="results"><?php echo $model->renderResults(); ?></pre> + <?php elseif(isset($_POST['preview'])): ?> + <?php echo CHtml::hiddenField("answers"); ?> + <table class="preview"> + <tr> + <th class="file">Code File</th> + <th class="confirm"> + <label for="check-all">Generate</label> + <?php + $count=0; + foreach($model->files as $file) + { + if($file->operation!==CCodeFile::OP_SKIP) + $count++; + } + if($count>1) + echo '<input type="checkbox" name="checkAll" id="check-all" />'; + ?> + </th> + </tr> + <?php foreach($model->files as $i=>$file): ?> + <tr class="<?php echo $file->operation; ?>"> + <td class="file"> + <?php echo CHtml::link(CHtml::encode($file->relativePath), array('code','id'=>$i), array('class'=>'view-code','rel'=>$file->path)); ?> + <?php if($file->operation===CCodeFile::OP_OVERWRITE): ?> + (<?php echo CHtml::link('diff', array('diff','id'=>$i), array('class'=>'view-code','rel'=>$file->path)); ?>) + <?php endif; ?> + </td> + <td class="confirm"> + <?php + if($file->operation===CCodeFile::OP_SKIP) + echo 'unchanged'; + else + { + $key=md5($file->path); + echo CHtml::label($file->operation, "answers_{$key}") + . ' ' . CHtml::checkBox("answers[$key]", $model->confirmed($file)); + } + ?> + </td> + </tr> + <?php endforeach; ?> + </table> + <?php endif; ?> + </div> +<?php endif; ?> |
