Permalink
Browse files

Merge branch '960gs' into devel

  • Loading branch information...
2 parents 943bd0c + cadb6b8 commit 55ecffdd2ba4856e5666e3597da8dc914288867e @romaninsh romaninsh committed Mar 22, 2011
View
@@ -0,0 +1,76 @@
+<?php
+class page_playground2 extends Page {
+ function init(){
+ parent::init();
+
+ $this->add('H1')->set('Fullscreen Forms 960gs');
+
+ $t=$this->add('Tabs');
+
+ foreach(array(
+ 'basic',
+ 'inline',
+ 'vertical',
+ 'horizontal',
+ 'basic-2col'
+ ) as $form_class){
+
+ $t1=$t->addTab('atk-form-'.$form_class);
+ $t1->add('H3')->set('$form->setFormClass(\''.$form_class.'\');');
+ $t1->add('SampleForm')->setFormClass($form_class);
+ }
+
+ }
+}
+
+class SampleForm extends Form {
+ function setFormClass($class){
+ $this->template->trySet('form_class',$class);
+ }
+
+ function init(){
+ parent::init();
+ $f=$this;
+
+ $f->addField('line','email')
+ ->validateNotNull()
+ ->validateField('filter_var($this->get(), FILTER_VALIDATE_EMAIL)')
+ ;
+
+ $f->addField('password','password')->validateNotNull()
+ ->setProperty('max-length',30)
+ ->add('Text',null,'after_field')->set('<ins>30 char max</ins>');
+
+ $f->addField('password','password2')
+ ->validateField('$this->get()==$this->owner->getElement("password")->get()',
+ 'Passwords do not match');
+
+
+ $f->addField('line','name')->validateNotNull();
+
+ $f->addField('radio','sex')
+ ->setValueList(array('m'=>'Male','f'=>'Female'))
+ ; // automatically validated to be one of value list
+
+
+ $f->addSeparator(' ');
+
+ $f->addField('DatePicker','date_birth','Birthdate');
+
+ $f->addField('dropdown','age')
+ ->setValueList(array('','11 - 20', '21 - 30', '31 - 40'));
+
+ $f->addField('text','about')
+ ->setProperty('cols',45)->setProperty('rows','5')
+ ->validateField('5000>=strlen($this->get())','Too long');
+
+ $f->addField('checkbox','agreeRules',
+ $f->js()->univ()->dialogURL('Rules',
+ $this->api->getDestinationURL(null,array('showTerms'=>true,'cut_object'=>'rules')))
+ ->getLink('I Agree to Rules and Terms')
+ )->validateNotNull('You must agree to the rules');
+
+ $f->addSubmit('Register');
+}
+
+}
View
@@ -60,7 +60,6 @@ class Form extends AbstractView {
public $js_widget='ui.atk4_form';
public $js_widget_arguments=array();
-
public $dq = null;
function init(){
/**
@@ -140,6 +139,7 @@ function addField($type,$name,$caption=null,$attr=null){
$last_field=$this->add('Form_Field_'.$type,$name,'form_body','form_line')
->setCaption($caption);
+ $last_field->template->trySet('field_type',$type);
if (is_array($attr)){
foreach ($attr as $key => $value){
$this->last_field->setProperty($key, $value);
@@ -381,6 +381,10 @@ function setLayout($template){
$this->template->trySet('form_class_layout',$c='form_'.basename($template));
return $this;
}
+ function setFormClass($class){
+ $this->template->trySet('form_class',$class);
+ return $this;
+ }
function render(){
// Assuming, that child fields already inserted their HTML code into 'form'/form_body using 'form_line'
// Assuming, that child buttons already inserted their HTML code into 'form'/form_buttons
View
@@ -32,7 +32,7 @@
public $default_value=null;
// Field customization
- private $separator=':';
+ private $separator='';
public $show_input_only;
View
@@ -348,24 +348,24 @@ dialogAttention: function(text,options,fn){
$.extend({buttons:{'Ok':function(){ $(this).dialog('close');if(fn)fn()}}},options));
},
message: function(msg,icon){
- if($.ui.atk4_notify && $('#float-messages').length){
- $('#float-messages').atk4_notify().atk4_notify('message',msg,icon);
+ if($.ui.atk4_notify && $('#atk-growl-holder').length){
+ $('#atk-growl-holder').atk4_notify().atk4_notify('message',msg,icon);
return;
}
},
successMessage: function(msg){
var html="";
- if($.ui.atk4_notify && $('#float-messages').length){
- $('#float-messages').atk4_notify().atk4_notify('successMessage',msg);
+ if($.ui.atk4_notify && $('#atk-growl-holder').length){
+ $('#atk-growl-holder').atk4_notify().atk4_notify('successMessage',msg);
return;
}
- if(!$('#float-messages').length)return alert(msg);
+ if(!$('#atk-growl-holder').length)return alert(msg);
html = '<p class="growl">'+msg
+'&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" class="growl_close"></a></p>';
- var growl=$(html).prependTo('#float-messages');
+ var growl=$(html).prependTo('#atk-growl-holder');
growl.find('.growl_close').click(function(){
growl.fadeOut(500,function(){ growl.remove(); });
});
@@ -97,7 +97,7 @@ $.widget("ui.atk4_form", {
self._setChanged(true);
}).change(function(){
self._setChanged(true);
- });;
+ });
// This class defines field error template
// <div class="field-error-template"> .. <span class="field-error-text">..</span></div>
@@ -229,7 +229,7 @@ $.widget("ui.atk4_form", {
var field_highlight=field.closest('.atk-field').addClass('field_has_error');
// Clear previous errors
- while(field_highlight.next().is('.atk-error'))field_highlight.next().remove();
+ field_highlight.find('.atk-form-error').remove();
if(!this.template['field_error'].length){
// no template, use alert;
@@ -238,7 +238,7 @@ $.widget("ui.atk4_form", {
}
var error_bl=this.template['field_error'].clone();
error_bl.find('.field-error-text').text(error);
- error_bl.insertAfter(field_highlight).fadeIn();
+ error_bl.appendTo(field_highlight).fadeIn();
this.form.addClass('form_has_error');
@@ -81,17 +81,17 @@ $.widget('ui.atk4_notify', {
/*
* This display a message which you would commonly use on successful operation completion.
*/
- var html=$('<div class="growl"><i class="atk-icon"></i><span>Sample Text</span><b></b></div>');
- if(!icon)icon='success';
- html.find('i').addClass('atk-icon-red');
- html.find('i').addClass('atk-icon-'+icon);
+ var html=$('<div class="atk-growl ui-widget-content ui-corner-all"><i class="atk-icon"></i>Sample Text<i class="ui-icon ui-icon-closethick"></i></div>');
+ if(!icon)icon='basic-check';
+ html.find('.atk-icon').addClass('atk-icons-green');
+ html.find('.atk-icon').addClass('atk-icon-'+icon);
html.find('span').text(text);
- html.find('b').addClass('close');
+ html.find('.ui-icon').addClass('close');
this.messageHTML(html);
},
successMessage: function(text){
- this.message(text,'success');
+ this.message(text,'basic-check');
}
});
Oops, something went wrong.

0 comments on commit 55ecffd

Please sign in to comment.