page Settgins ready
This commit is contained in:
parent
4e3371d251
commit
c26d0e1ddf
|
@ -1,6 +1,9 @@
|
|||
# User specific & automatically generated files #
|
||||
#################################################
|
||||
/app/Config/database.php
|
||||
/app/webroot/uploads/
|
||||
/app/webroot/avatar/
|
||||
/app/webroot/dreamjob/
|
||||
/app/tmp
|
||||
/lib/Cake/Console/Templates/skel/tmp/
|
||||
/plugins
|
||||
|
|
|
@ -216,10 +216,11 @@ Configure::write('Routing.prefixes', array('admin'));
|
|||
* the cake shell command: cake schema create Sessions
|
||||
*
|
||||
*/
|
||||
Configure::write('Session', array(
|
||||
'defaults' => 'php'
|
||||
));
|
||||
|
||||
Configure::write('Session', array(
|
||||
'defaults' => 'php',
|
||||
'cookie' => 'PHPSESSID'
|
||||
)
|
||||
);
|
||||
/**
|
||||
* A random string used in security hashing methods.
|
||||
*/
|
||||
|
@ -384,10 +385,3 @@ Cache::config('_cake_model_', array(
|
|||
'serialize' => ($engine === 'File'),
|
||||
'duration' => $duration
|
||||
));
|
||||
|
||||
|
||||
Configure::write('Session', array(
|
||||
'defaults' => 'php',
|
||||
'cookie' => 'DreamJOBSession'
|
||||
)
|
||||
);
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
Router::connect('/profil', array('controller' => 'user', 'action' => 'profil'));
|
||||
Router::connect('/profil/page/:page', array('controller' => 'user', 'action' => 'profil'),array("page" => "[0-9]+"));
|
||||
Router::connect('/settings', array('controller' => 'user', 'action' => 'settings_account'));
|
||||
Router::connect('/settings/pages', array('controller' => 'user', 'action' => 'settings_pages'));
|
||||
Router::connect('/settings/pages/:page', array('controller' => 'user', 'action' => 'settings_pages'),array("page" => "[0-9]+"));
|
||||
Router::connect('/settings/pages', array('controller' => 'user', 'action' => 'settings_pageInh'));
|
||||
Router::connect('/settings/pages/:page', array('controller' => 'user', 'action' => 'settings_pageInh'),array("page" => "[0-9]+"));
|
||||
Router::connect('/settings/isearch', array('controller' => 'user', 'action' => 'settings_isearch'));
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class MiconwareSessionComponent extends Component {
|
|||
$controller->set("COMPANY",($this->self_company_obj)?$this->self_company_obj:false);
|
||||
}
|
||||
$controller->set("isStaff",$this->isStaff());
|
||||
$controller->set("MEDIA_URL","http://dev.dreamjob.cc/media/");
|
||||
$controller->set("MEDIA_URL","/");
|
||||
$controller->set('default_sForm',array(
|
||||
'inputDefaults' => array(
|
||||
'div' => array('class' => 'control-group'),
|
||||
|
|
|
@ -91,7 +91,7 @@ class HomeController extends AppController {
|
|||
}
|
||||
|
||||
|
||||
public function iagb() {
|
||||
public function agb() {
|
||||
$this->MiconwareSession->init($this);
|
||||
$this->MiconwareSession->initWeb($this);
|
||||
$this->set('title', 'dreamjob.agb');
|
||||
|
|
|
@ -21,6 +21,7 @@ class UserController extends AppController {
|
|||
* @throws NotFoundException When the view file could not be found
|
||||
* or MissingViewException in debug mode.
|
||||
*/
|
||||
|
||||
public function profil() {
|
||||
$this->MiconwareSession->init($this);
|
||||
|
||||
|
@ -267,7 +268,8 @@ class UserController extends AppController {
|
|||
$this->render('/User/settings_account');
|
||||
}
|
||||
}
|
||||
public function settings_pages() {
|
||||
public function settings_pageInh() {
|
||||
|
||||
$this->MiconwareSession->init($this);
|
||||
|
||||
$this->MiconwareSession->initWeb($this);
|
||||
|
@ -275,7 +277,7 @@ class UserController extends AppController {
|
|||
$this->layout = 'default';
|
||||
$this->RequestHandler->setContent('html', 'application/html' );
|
||||
|
||||
|
||||
$result = false;
|
||||
|
||||
$profil = $this->MiconwareSession->getWorker();
|
||||
if(empty($profil) or count($profil) <= 0)
|
||||
|
@ -286,24 +288,63 @@ class UserController extends AppController {
|
|||
$this->set('error', 'dreamjob.error.noPermision');
|
||||
$this->render('/Home/error');
|
||||
}else{
|
||||
var_dump($this->request->data);
|
||||
if(!empty($this->request->params['page'])){
|
||||
$image = false;
|
||||
$page = $this->DreamjobPageText->find('first',
|
||||
array('conditions' => array("DreamjobPageInh.id" => $this->request->params['page'],'DreamjobPageInh.user_id' => $profil['AppUser']['id']))
|
||||
);
|
||||
if(!is_array($page) or count($page)<= 0)
|
||||
if(!is_array($page) or count($page)<= 0){
|
||||
$page = $this->DreamjobPageImage->find('first',
|
||||
array('conditions' => array("DreamjobPageInh.id" => $this->request->params['page'],'DreamjobPageInh.user_id' => $profil['AppUser']['id']))
|
||||
);
|
||||
if($this->request->is('post')){
|
||||
$this->MiconwareSession->setFlash(__('dreamjob.page.save'),'flash',array('alert'=>'success'));
|
||||
$image = true;
|
||||
}
|
||||
if(!empty($page) and count($page)> 0){
|
||||
if($this->request->is('post')){
|
||||
$this->request->data['DreamjobPageInh']['user_id']=$profil['AppUser']['id'];
|
||||
if($image){
|
||||
$this->request->data['DreamjobPageInh']['id']=$page['DreamjobPageInh']['id'];
|
||||
$this->request->data['DreamjobPageImage']['page_ptr_id']=$page['DreamjobPageInh']['id'];
|
||||
$result = $this->DreamjobPageImage->saveAndUpload($this->request->data);
|
||||
}else{
|
||||
$this->request->data['DreamjobPageInh']['id']=$page['DreamjobPageInh']['id'];
|
||||
$this->request->data['DreamjobPageText']['page_ptr_id']=$page['DreamjobPageInh']['id'];
|
||||
$result = $this->DreamjobPageText->saveAssociated($this->request->data);
|
||||
}
|
||||
if(!$result)
|
||||
$this->MiconwareSession->setFlash(__('dreamjob.page.save.error'),'flash',array('alert'=>'danger'));
|
||||
}else
|
||||
$this->request->data=$page;
|
||||
$this->set('page',$page);
|
||||
}else
|
||||
$this->MiconwareSession->setFlash(__('dreamjob.error.page.notFound'),'flash',array('alert'=>'danger'));
|
||||
}else{
|
||||
if($this->request->is('post')){
|
||||
$this->MiconwareSession->setFlash(__('dreamjob.page.save'),'flash',array('alert'=>'success'));
|
||||
if(!empty($this->request->data['DreamjobPageText']['text']) and $this->request->data['DreamjobPageImage']['image']['error']==0){
|
||||
$this->MiconwareSession->setFlash(__('dreamjob.page.oneType'),'flash',array('alert'=>'danger'));
|
||||
}else{
|
||||
$this->request->data['DreamjobPageInh']['user_id']=$profil['AppUser']['id'];
|
||||
if($this->request->data['DreamjobPageImage']['image']['error']==0){
|
||||
unset($this->request->data['DreamjobPageText']);
|
||||
$this->DreamjobPageImage->create();
|
||||
$result = $this->DreamjobPageImage->saveAndUpload($this->request->data);
|
||||
}else{
|
||||
unset($this->request->data['DreamjobPageImage']);
|
||||
$this->DreamjobPageText->create();
|
||||
$result = $this->DreamjobPageText->saveAssociated($this->request->data);
|
||||
}
|
||||
|
||||
if(!$result)
|
||||
$this->MiconwareSession->setFlash(__('dreamjob.page.save.error'),'flash',array('alert'=>'danger'));
|
||||
}
|
||||
}
|
||||
}
|
||||
if($result){
|
||||
$this->MiconwareSession->refreshCache();
|
||||
$this->MiconwareSession->setFlash(__('dreamjob.page.save'),'flash',array('alert'=>'success'));
|
||||
$profil = $this->MiconwareSession->getWorker();
|
||||
if(empty($profil) or count($profil) <= 0)
|
||||
$profil = $this->MiconwareSession->getCompany();
|
||||
}
|
||||
$this->set('profil',$profil);
|
||||
$this->render('/User/settings_pages');
|
||||
|
|
|
@ -10,7 +10,7 @@ class DreamjobJobFavority extends AppModel {
|
|||
|
||||
public $useDbConfig = 'dreamjobMain';
|
||||
|
||||
public $useTable = 'mic_dj_job_opening_worker';
|
||||
public $useTable = 'mic_dj_jobs_opening_worker';
|
||||
|
||||
public $validate = array(
|
||||
'worker_id' => array(
|
||||
|
|
|
@ -35,6 +35,8 @@ class DreamjobPageImage extends AppModel {
|
|||
*/
|
||||
public $displayField = 'page_ptr_id';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
|
@ -59,28 +61,93 @@ class DreamjobPageImage extends AppModel {
|
|||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||
),
|
||||
),
|
||||
/* 'image' => array(
|
||||
'notEmpty' => array(
|
||||
'rule' => array('notEmpty'),
|
||||
//'message' => 'Your custom message here',
|
||||
//'allowEmpty' => false,
|
||||
//'required' => false,
|
||||
//'last' => false, // Stop validation after this rule
|
||||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||
'image' => array(
|
||||
// http://book.cakephp.org/2.0/en/models/data-validation.html#Validation::uploadError
|
||||
'uploadError' => array(
|
||||
'rule' => 'uploadError',
|
||||
'message' => 'Something went wrong with the file upload',
|
||||
'required' => FALSE,
|
||||
'allowEmpty' => TRUE,
|
||||
),
|
||||
'alphaNumeric' => array(
|
||||
'rule' => array('alphaNumeric'),
|
||||
//'message' => 'Your custom message here',
|
||||
//'allowEmpty' => false,
|
||||
//'required' => false,
|
||||
//'last' => false, // Stop validation after this rule
|
||||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||
// http://book.cakephp.org/2.0/en/models/data-validation.html#Validation::mimeType
|
||||
'mimeType' => array(
|
||||
'rule' => array('mimeType', array('image/gif','image/png','image/jpg','image/jpeg')),
|
||||
'message' => 'Invalid file, only images allowed',
|
||||
'required' => FALSE,
|
||||
'allowEmpty' => TRUE,
|
||||
),
|
||||
),*/
|
||||
'processUpload' => array(
|
||||
'rule' => 'processUpload',
|
||||
'message' => 'Something went wrong with the file upload',
|
||||
'required' => FALSE,
|
||||
'allowEmpty' => TRUE,
|
||||
'last' => TRUE,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||
/**
|
||||
* Upload Directory relative to WWW_ROOT
|
||||
* @param string
|
||||
*/
|
||||
public $uploadDir = 'uploads';
|
||||
|
||||
/**
|
||||
* Before Validation Callback
|
||||
* @param array $options
|
||||
* @return boolean
|
||||
*/
|
||||
public function beforeValidate($options = array()) {
|
||||
// ignore empty file - causes issues with form validation when file is empty and optional
|
||||
if (!empty($this->data[$this->alias]['image']['error']) && $this->data[$this->alias]['image']['error']==4 && $this->data[$this->alias]['image']['size']==0) {
|
||||
unset($this->data[$this->alias]['image']);
|
||||
}
|
||||
return parent::beforeValidate($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the Upload
|
||||
* @param array $check
|
||||
* @return boolean
|
||||
*/
|
||||
public function processUpload($check=array()) {
|
||||
// deal with uploaded file
|
||||
if (!empty($check['image']['tmp_name'])) {
|
||||
|
||||
// check file is uploaded
|
||||
if (!is_uploaded_file($check['image']['tmp_name'])) {
|
||||
return FALSE;
|
||||
}
|
||||
$this->data[$this->alias]['image'] = "onUpload";
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
public function saveAndUpload($data){
|
||||
$dataSource = $this->getDataSource();
|
||||
$dataSource->begin();
|
||||
$result = $this->saveAssociated($data);
|
||||
if($result){
|
||||
$filename = $data["DreamjobPageInh"]['user_id'] . "_-_p" . $this->id .".". pathinfo($data[$this->alias]['image']['name'], PATHINFO_EXTENSION);
|
||||
$filename = WWW_ROOT . $this->uploadDir . DS . $filename;
|
||||
|
||||
if (!move_uploaded_file($data[$this->alias]['image']['tmp_name'], $filename)) {
|
||||
$result = false;
|
||||
} else {
|
||||
$this->saveField('image', str_replace(DS, "/", str_replace(WWW_ROOT, "", $filename) ));
|
||||
}
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$dataSource->commit();
|
||||
return true;
|
||||
} else {
|
||||
$dataSource->rollback();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* belongsTo associations
|
||||
*
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<?=$this->Form->checkbox('agb').__("dreamjob.agb.accept");?>
|
||||
</div>
|
||||
<br/>
|
||||
<?=$this->Form->button(__('dreamjob.application.send'),array('div' => false,'class'=>"btn btn-default ",'type' => 'submit'));?>
|
||||
<?=$this->Form->button(__('dreamjob.application.send'),array('div' => false,'class'=>"btn btn-primary ",'type' => 'submit'));?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo $this->Form->end(); ?>
|
||||
|
|
|
@ -46,7 +46,7 @@ echo $this->Form->create('DreamjobJobOpening',$default_Form);
|
|||
<legend><?=__("dreamjob.text");?></legend>
|
||||
<?php echo $this->Form->textarea('DreamjobJobOpening.text',array("class"=>'form-control',"rows"=>10)); ?>
|
||||
<div class="buttonrow">
|
||||
<?=$this->Form->button(__('dreamjob.save'),array('div' => false,'class'=>"btn btn-default",'type' => 'submit'));?>
|
||||
<?=$this->Form->button(__('dreamjob.save'),array('div' => false,'class'=>"btn btn-primary",'type' => 'submit'));?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo $this->Form->end(); ?>
|
||||
|
|
|
@ -16,7 +16,7 @@ if($profil['AppUser']['take_systemwide']){
|
|||
<div class="tabs-below">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li class="active"><?=$this->Html->link(__("dreamjob.settings"),array('controller'=>'user','action'=>'settings_account'));?></li>
|
||||
<li><?=$this->Html->link(__("dreamjob.settings.pages"),array('controller'=>'user','action'=>'settings_pages'));?></li>
|
||||
<li><?=$this->Html->link(__("dreamjob.settings.pages"),array('controller'=>'user','action'=>'settings_pageInh'));?></li>
|
||||
<?php
|
||||
if(!empty($WORKER) and count($WORKER)>0){
|
||||
?>
|
||||
|
@ -42,7 +42,7 @@ if($profil['AppUser']['take_systemwide']){
|
|||
?>
|
||||
<legend><?=__("dreamjob.worker");?></legend>
|
||||
<?php
|
||||
echo $this->Form->input('AppUser.mannerofaddress_id',array('label'=>array('text'=>__("dreamjob.mannerofaddress_id"),"class"=>$default_Form['inputDefaults']['label']['class'])));
|
||||
echo $this->Form->input('AppUser.mannerofaddress_id',array('label'=>array('text'=>__("dreamjob.mannerofaddress"),"class"=>$default_Form['inputDefaults']['label']['class'])));
|
||||
echo $this->Form->input('AppUser.first_name',array('label'=>array('text'=>__("dreamjob.first_name"),"class"=>$default_Form['inputDefaults']['label']['class'])));
|
||||
echo $this->Form->input('AppUser.last_name',array('label'=>array('text'=>__("dreamjob.last_name"),"class"=>$default_Form['inputDefaults']['label']['class'])));
|
||||
echo $this->Form->input('AppUser.bday',array('label'=>array('text'=>__("dreamjob.bday"),"class"=>$default_Form['inputDefaults']['label']['class']),"style"=>'width:20%;display:inline-block;'));
|
||||
|
@ -79,7 +79,7 @@ if($profil['AppUser']['take_systemwide']){
|
|||
echo $this->Form->input('DreamjobWorker.country',array('label'=>array('text'=>__("dreamjob.country"),"class"=>$default_Form['inputDefaults']['label']['class'])));
|
||||
?>
|
||||
<div class="buttonrow">
|
||||
<?=$this->Form->button(__('dreamjob.settings.save'),array('div' => false,'class'=>"btn btn-default ",'type' => 'submit'));?>
|
||||
<?=$this->Form->button(__('dreamjob.settings.save'),array('div' => false,'class'=>"btn btn-primary ",'type' => 'submit'));?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo $this->Form->end(); ?>
|
||||
|
|
|
@ -15,7 +15,7 @@ if($profil['AppUser']['take_systemwide']){
|
|||
<div class="tabs-below">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li><?=$this->Html->link(__("dreamjob.settings"),array('controller'=>'user','action'=>'settings_account'));?></li>
|
||||
<li><?=$this->Html->link(__("dreamjob.settings.pages"),array('controller'=>'user','action'=>'settings_pages'));?></li>
|
||||
<li><?=$this->Html->link(__("dreamjob.settings.pages"),array('controller'=>'user','action'=>'settings_pageInh'));?></li>
|
||||
<li class="active"><?=$this->Html->link(__("dreamjob.settings.isearch"),array('controller'=>'user','action'=>'settings_isearch'));?></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -33,7 +33,7 @@ if($profil['AppUser']['take_systemwide']){
|
|||
<div class="tabs-below">
|
||||
<ul class="nav nav-tabs pull-right">
|
||||
<li><?=$this->Html->link(__("dreamjob.settings"),array('controller'=>'user','action'=>'settings_account'));?></li>
|
||||
<li class="active"><?=$this->Html->link(__("dreamjob.settings.pages"),array('controller'=>'user','action'=>'settings_pages'));?></li>
|
||||
<li class="active"><?=$this->Html->link(__("dreamjob.settings.pages"),array('controller'=>'user','action'=>'settings_pageInh'));?></li>
|
||||
<?php
|
||||
if(!empty($WORKER) and count($WORKER)>0){
|
||||
?>
|
||||
|
@ -48,18 +48,20 @@ if($profil['AppUser']['take_systemwide']){
|
|||
<?php foreach($profil['DreamjobPageInh'] as $pag){ ?>
|
||||
<li<?php if(isset($page['DreamjobPageInh']['id'])) if ($page['DreamjobPageInh']['id'] == $pag['id']){?> class="active"<?php } ?> page="<?=$pag['id'];?>">
|
||||
<?php
|
||||
echo $this->Html->link('<span class="glyphicon glyphicon-move"></span> '.$pag['title'],array('controller'=>'user','action'=>'settings_pages','page'=> $pag['id'] ),array('escape'=>false));
|
||||
echo $this->Html->link('<span class="glyphicon glyphicon-move"></span> '.$pag['title'],array('controller'=>'user','action'=>'settings_pageInh','page'=> $pag['id'] ),array('escape'=>false));
|
||||
?>
|
||||
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li<?php if(empty($page)){?> class="active"<?php } ?>>
|
||||
<?php echo $this->Html->link('<span class="glyphicon glyphicon-plus"></span> '.__('dreamjob.page.new'),array('controller'=>'user','action'=>'settings_pages'),array('escape'=>false));
|
||||
<?php echo $this->Html->link('<span class="glyphicon glyphicon-plus"></span> '.__('dreamjob.page.new'),array('controller'=>'user','action'=>'settings_pageInh'),array('escape'=>false));
|
||||
?></li>
|
||||
</ul>
|
||||
<legend></legend>
|
||||
|
||||
<?php
|
||||
if(empty($page) or !isset($page['DreamjobPageText']))
|
||||
$default_Form['type']='file';
|
||||
echo $this->Form->create(false,$default_Form);
|
||||
?>
|
||||
<fieldset>
|
||||
|
@ -70,24 +72,26 @@ if($profil['AppUser']['take_systemwide']){
|
|||
<legend><?=__('dreamjob.pages.types');?></legend>
|
||||
<fieldset>
|
||||
<?php
|
||||
$extra = array('type'=>'file');
|
||||
if(!empty($page) and !isset($page['DreamjobPageImage']))
|
||||
$extra['disabled'] = 'disabled';
|
||||
echo $this->Form->input('DreamjobPageImage.image',$extra);
|
||||
$extra = array();
|
||||
if(!empty($page) and !isset($page['DreamjobPageText']))
|
||||
$extra['disabled'] = 'disabled';
|
||||
if(empty($page) or isset($page['DreamjobPageImage']))
|
||||
echo $this->Form->input('DreamjobPageImage.image',array('type'=>'file'));
|
||||
|
||||
if(empty($page)){
|
||||
?>
|
||||
<div>Oder:</div>
|
||||
<?=$this->Form->input('DreamjobPageText.text',$extra);?>
|
||||
<?php
|
||||
}
|
||||
|
||||
if(empty($page) or isset($page['DreamjobPageText']))
|
||||
echo $this->Form->input('DreamjobPageText.text');
|
||||
?>
|
||||
</fieldset>
|
||||
<div class="buttonrow">
|
||||
<?php
|
||||
if(!empty($page)){
|
||||
echo $this->Html->link('<span class="glyphicon glyphicon-trash"></span> '.__('dreamjob.page.del'),array('controller'=>'user','action'=>'settings_pages','?'=>array('del'=> $pag['id'])),array('escape'=>false,'class'=>'btn btn-default'));
|
||||
echo $this->Html->link('<span class="glyphicon glyphicon-trash"></span> '.__('dreamjob.page.del'),array('controller'=>'user','action'=>'settings_pageInh','?'=>array('del'=> $pag['id'])),array('escape'=>false,'class'=>'btn btn-default'));
|
||||
}
|
||||
?>
|
||||
<?=$this->Form->button('<span class="glyphicon glyphicon-floppy-disk"></span> '.__('dreamjob.settings.save'),array('div' => false,'class'=>"btn btn-default ",'type' => 'submit'));?>
|
||||
<?=$this->Form->button('<span class="glyphicon glyphicon-floppy-disk"></span> '.__('dreamjob.settings.save'),array('div' => false,'class'=>"btn btn-primary ",'type' => 'submit'));?>
|
||||
</div>
|
||||
<?php
|
||||
echo $this->Form->end();
|
||||
|
|
|
@ -402,8 +402,4 @@ body.loading #container{
|
|||
.infofield{
|
||||
color:black;
|
||||
}
|
||||
.btn.btn-primary{
|
||||
background-color:red;
|
||||
border-color:orange;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,10 @@
|
|||
});
|
||||
|
||||
|
||||
$(where+" form:not(.hide-form)").submit(function(e){
|
||||
$(where+" form").submit(function(e){
|
||||
if(!$(this).hasClass("hide-form") && $(this).attr('enctype')!='multipart/form-data' ){
|
||||
e.stopPropagation();
|
||||
//e.preventDefault();
|
||||
|
||||
if(!$(this).hasClass("hide-form")){
|
||||
if($(this).attr("back"))
|
||||
back=window.location.href;
|
||||
else
|
||||
|
@ -37,7 +36,18 @@
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
$("form[ enctype *= 'multipart/form-data' ]").each(function(evt){
|
||||
if (!$('#fileUpload').length)
|
||||
$('body').append('<iframe id="fileUpload" name="fileUpload" style="display:none" />');
|
||||
$(this).attr('target','fileUpload');
|
||||
$(this).submit(function(){
|
||||
frame = $('#fileUpload').load(function(){
|
||||
setContent(frame.contents().find('body').html());
|
||||
frame.unbind('load');
|
||||
setTimeout(function (){frame.html('');}, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
$(where+" form.hide-form").each(function(evt){
|
||||
that = this;
|
||||
$('span.edit.label',this).click(function(evt){
|
||||
|
@ -74,22 +84,7 @@
|
|||
|
||||
//$(where+" form label.has-error").parent(".form-group").addClass("has-error")
|
||||
}
|
||||
function load(pageurl,conf,tab){
|
||||
data = {};
|
||||
typemethode = "GET";
|
||||
back = false;
|
||||
if(conf['data'])
|
||||
data = conf['data'];
|
||||
if(conf['type'])
|
||||
typemethode = conf['type'];
|
||||
if(conf['back'] && conf['back'].indexOf("logout")== -1 && conf['back'].indexOf("login")== -1 )
|
||||
back = conf['back'];
|
||||
//e.preventDefault();
|
||||
/*
|
||||
if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content;
|
||||
if commented, html5 nonsupported browers will reload the page to the specified link.
|
||||
*/
|
||||
$.ajax({url:pageurl,data:data,type:typemethode,success: function(data){
|
||||
function setContent(data,back,tab){
|
||||
alert = data.split('<!-- alert -->')[1].split('<!-- /alert -->')[0];
|
||||
if( alert.trim().length > 0){
|
||||
$('#alert').html(alert);
|
||||
|
@ -122,7 +117,8 @@
|
|||
navbar = data.split('<!-- extraScript -->')[1].split('<!-- /extraScript -->')[0];
|
||||
eval($(navbar).html());
|
||||
}
|
||||
},error:function(data){
|
||||
}
|
||||
function setContentError(data,back,tab){
|
||||
alert = "<div class=\"alert alert-danger\">"+data.statusText+
|
||||
"<button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>"
|
||||
+ "</div>";
|
||||
|
@ -130,7 +126,23 @@
|
|||
event("#alert");
|
||||
$('#container').html(data.responseText);
|
||||
event("#container");
|
||||
}});
|
||||
}
|
||||
function load(pageurl,conf,tab){
|
||||
data = {};
|
||||
typemethode = "GET";
|
||||
back = false;
|
||||
if(conf['data'])
|
||||
data = conf['data'];
|
||||
if(conf['type'])
|
||||
typemethode = conf['type'];
|
||||
if(conf['back'] && conf['back'].indexOf("logout")== -1 && conf['back'].indexOf("login")== -1 )
|
||||
back = conf['back'];
|
||||
//e.preventDefault();
|
||||
/*
|
||||
if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content;
|
||||
if commented, html5 nonsupported browers will reload the page to the specified link.
|
||||
*/
|
||||
$.ajax({url:pageurl,data:data,type:typemethode,success:function(data){setContent(data,back,tab);} ,error:function(data){setContentError(data,back,tab);}});
|
||||
if(pageurl!=window.location){
|
||||
window.history.pushState({path:pageurl},'',pageurl);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue