Add jsc3d to view default models in projects
This commit is contained in:
@@ -57,8 +57,6 @@ class Projects extends CI_Controller {
|
||||
$data = array(
|
||||
'name' => $this->input->post('name'),
|
||||
'description' => $this->input->post('description'),
|
||||
'defaultmodel' => $modelData['file_name'],
|
||||
'defaultconfig' => $configData['file_name'],
|
||||
);
|
||||
|
||||
$data['project_id'] = $this->project->create($data);
|
||||
@@ -79,7 +77,10 @@ class Projects extends CI_Controller {
|
||||
$config['file_name'] = 'defaultmodel';
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if (!$this->upload->do_upload('defaultmodel')) {
|
||||
if ($this->upload->do_upload('defaultmodel')) {
|
||||
$default = $this->upload->data();
|
||||
$this->project->update($data['project_id'], array('default_model' => $default['file_name']));
|
||||
} else {
|
||||
$this->messages->add(_('The default model could not be uploaded.'), 'error');
|
||||
}
|
||||
}
|
||||
@@ -87,7 +88,10 @@ class Projects extends CI_Controller {
|
||||
$config['file_name'] = 'defaultconfig';
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if (!$this->upload->do_upload('defaultconfig')) {
|
||||
if ($this->upload->do_upload('defaultconfig')) {
|
||||
$default = $this->upload->data();
|
||||
$this->project->update($data['project_id'], array('default_config' => $default['file_name']));
|
||||
} else {
|
||||
$this->messages->add(_('The default config could not be uploaded.'), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,14 @@
|
||||
<?=link_tag('assets/css/form.css');?>
|
||||
|
||||
<?=script_tag('assets/js/minmax.js');?>
|
||||
<?=script_tag('assets/js/jsc3d.min.js');?>
|
||||
<?=script_tag('https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');?>
|
||||
<?=script_tag('assets/js/scattport.js');?>
|
||||
<?=script_tag('assets/js/tablednd.jquery.js');?>
|
||||
<?=script_tag('assets/js/jtip.js');?>
|
||||
<script type="text/javascript">
|
||||
var SITE_URL = '<?=site_url()?>';
|
||||
var BASE_URL = '<?=base_url()?>';
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -11,6 +11,29 @@
|
||||
<div class="editInPlace"><?=auto_typography($project['description']);?></div>
|
||||
<p></p>
|
||||
|
||||
<?php
|
||||
if ($project['default_model'] != ''):
|
||||
?>
|
||||
<canvas id="cv" style="border: #e8e8e8 1px solid;" width="120" height="120"></canvas>
|
||||
<p></p>
|
||||
|
||||
<script type="text/javascript">
|
||||
var canvas = document.getElementById('cv');
|
||||
var viewer = new JSC3D.Viewer(canvas);
|
||||
viewer.setParameter('SceneUrl', BASE_URL + 'uploads/<?=$project['id'];?>/<?=$project['default_model'];?>');
|
||||
viewer.setParameter('InitRotationX', -20);
|
||||
viewer.setParameter('InitRotationY', 20);
|
||||
viewer.setParameter('InitRotationZ', 0);
|
||||
viewer.setParameter('ModelColor', '#cccccc');
|
||||
viewer.setParameter('BackgroundColor1', '#ffffff');
|
||||
viewer.setParameter('BackgroundColor2', '#ffffff');
|
||||
viewer.setParameter('RenderMode', 'flat');
|
||||
viewer.init();
|
||||
viewer.update();
|
||||
</script>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
<h3><?=_('Trials');?></h3>
|
||||
<table class="tableList">
|
||||
<thead>
|
||||
|
||||
Reference in New Issue
Block a user