Skip to content

Commit

Permalink
MooTools added MTAjaxInPlace based on the original AjaxInPlace. Also …
Browse files Browse the repository at this point in the history
…added an example of it's usage to the example project.
  • Loading branch information
johnnykahalawai authored and Pascal Robert committed Apr 15, 2012
1 parent 4ae898c commit e1c6e22
Show file tree
Hide file tree
Showing 12 changed files with 559 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<wo:Main pageTitle = "Ajax In Place Port">
<h2>Ajax In Place...</h2>
<hr />
<p>
AjaxInPlace provides support for arbitrarily complex view and edit components.
</p>
<hr/>
<h3>Simple AjaxInPlace</h3>
<hr/>
<webobject name = "ExampleInPlace">
<webobject name = "View">View: <webobject name = "Value" /></webobject>
<webobject name = "Edit"><label>Edit:</label><webobject name = "ValueField" /></webobject>
</webobject>
<hr/>
<h3>Simple AjaxInPlace with Manual Controls</h3>
<hr/>
<webobject name = "ExampleInPlaceManual">
<webobject name = "ViewManual">
View: <webobject name = "ManualValue"/>
<br/>
<webobject name = "ClickToEdit">click to edit</webobject>
</webobject>
<webobject name = "EditManual">
Edit: <webobject name = "ManualValueField"/>
<br/>
<webobject name = "ClickToSave">click to save</webobject>
<webobject name = "ClickToCancel">click to cancel</webobject>
</webobject>
</webobject>
<hr/>
<h3>Fancier AjaxInPlace</h3>
<hr/>
<webobject name = "FancyInPlace">
<webobject name = "FancyView">
<div id = "fancyView">
<h2>Personal Information</h2>
<table class = "table table-striped">
<tr>
<th>First Name</th>
<td><webobject name = "FirstName"/></td>
</tr>

<tr>
<th>Last Name</th>
<td><webobject name = "LastName"/></td>
</tr>

<tr>
<th>Phone Number</th>
<td><webobject name = "PhoneNumber"/></td>
</tr>
</table>
<span class = "label label-info">click anywhere to edit</span>
</div>
</webobject>
<webobject name = "FancyEdit">
<div id = "fancyEdit">
<fieldset>
<legend>Edit Personal Information</legend>
<div class="control-group">
<label class="control-label" for="firstName">First Name</label>
<div class="controls">
<webobject name = "FirstNameField"/>
<p class="help-block">Enter your first name here.</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="lastName">Last Name</label>
<div class="controls">
<webobject name = "LastNameField"/>
<p class="help-block">Enter your last name here.</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="phoneNumber">Phone Number</label>
<div class="controls">
<webobject name = "PhoneNumberField"/>
<p class="help-block">Enter your phone number here.</p>
</div>
</div>
<div class = "form-actions">
<webobject name = "FancySave">save</webobject> or
<webobject name = "FancyCancel">cancel</webobject>
</div>
</fieldset>
</div>
</webobject>
</webobject>
</wo:Main>
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
ClickToCancel : WOHyperlink {
class = "btn";
href = "javascript:void(0)";
onclick = "ExampleInPlaceManualCancel()";
}

ClickToEdit : WOHyperlink {
class = "btn";
href = "javascript:void(0)";
onclick = "ExampleInPlaceManualEdit()";
}

ClickToSave : WOHyperlink {
class = "btn btn-primary";
href = "javascript:void(0)";
onclick = "ExampleInPlaceManualSave()";
}

Edit : ERXWOTemplate {
templateName = "edit";
}

EditManual : ERXWOTemplate {
templateName = "edit";
}

ExampleInPlace : MTAjaxInPlace {
cancelAction = valueCancelled;
cancelClass = "btn btn-inverse";
formClass = "well form-inline";
saveClass = "btn btn-primary";
saveAction = valueSaved;
}

ExampleInPlaceManual : MTAjaxInPlace {
cancelAction = valueCancelled;
id = "ExampleInPlaceManual";
manualControl = true;
saveAction = valueSaved;
}

FancyCancel : AjaxFunctionLink {
class = "btn";
onclick = "fancyCancel()";
}

FancyEdit : ERXWOTemplate {
templateName = "edit";
}

FancyInPlace : MTAjaxInPlace {
formClass = "well";
id = "fancy";
manualEditControl = true;
}

FancySave : MTAjaxSubmitButton {
class = "btn btn-primary";
onClick = "fancySave()";
value = "save";
}

FancyView : ERXWOTemplate {
templateName = "view";
}

FirstName : WOString {
value = firstName;
}

FirstNameField : WOTextField {
class = "span3";
id = "firstName";
value = firstName;
}

LastName : WOString {
value = lastName;
}

LastNameField : WOTextField {
class = "span3";
id = "lastName";
value = lastName;
}

ManualValue : WOString {
value = manualValue;
}

ManualValueField : WOTextField {
value = manualValue;
size = "30";
}

PhoneNumber : WOString {
value = phoneNumber;
}

PhoneNumberField : WOTextField {
class = "span3";
id = "phoneNumber";
value = phoneNumber;
}

Value : WOString {
value = value;
}

ValueField : WOTextField {
id = "valueField";
onEnter = "alert('You hit enter and I am showing you an onEnter handler now.')";
selectAll = true;
value = value;
}

View : ERXWOTemplate {
templateName = "view";
}

ViewManual : ERXWOTemplate {
templateName = "view";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"WebObjects Release" = "WebObjects 5.0";
encoding = "UTF-8";
}
9 changes: 9 additions & 0 deletions Examples/Ajax/MooToolsExample/Components/Main.wo/Main.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@
<i class="icon-refresh"></i>
Ajax Ping
</wo:link></li>
<li><wo:link directActionName = "PageAction/MTMediaBoxTestPage">
<i class="icon-picture"></i>
Media Box
</wo:link></li>
<li><wo:link directActionName = "PageAction/MTAjaxInPlaceTestPage">
<i class="icon-edit"></i>
Ajax In Place
</wo:link></li>

</ul>
</div>
<div class = "span9">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package er.ajax.mootools.example.components;

import com.webobjects.appserver.WOActionResults;
import com.webobjects.appserver.WOContext;

public class MTAjaxInPlaceTestPage extends Main {

public String _manualValue;
public String _value;
public String _firstName;
public String _lastName;
public String _phoneNumber;

public MTAjaxInPlaceTestPage(WOContext context) {
super(context);
_value = "ExampleInPlace Value";
_manualValue = "ExampleInPlaceManual Value";
_firstName = "Johnny";
_lastName = "Ajax";
_phoneNumber = "800-555-1212";
}

public WOActionResults valueSaved() {
System.out.println("InPlaceExample.valueSaved: saved!");
return null;
}

public WOActionResults valueCancelled() {
System.out.println("InPlaceExample.valueCancelled: cancelled!");
return null;
}

}
44 changes: 44 additions & 0 deletions Frameworks/Ajax/MooTools/Components/MTAjaxInPlace.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wodefinitions>
<wo class="MTAjaxInPlace" wocomponentcontent="true"> <binding name="button"/>
<binding name="cancelAction"/>
<binding name="cancelClass"/>
<binding name="cancelLabel"/>
<binding name="canEdit"/>
<binding name="cancelUpdateContainerID"/>
<binding name="canSave"/>
<binding name="class"/>
<binding name="disabled"/>
<binding name="editAction"/>
<binding name="editClass"/>
<binding name="editing"/>
<binding name="editOnly"/>
<binding name="elementName"/>
<binding name="formSerializer"/>
<binding name="id"/>
<binding name="manualControl"/>
<binding name="manualEditControl"/>
<binding name="manualViewControl"/>
<binding name="onCancelClick"/>
<binding name="onCancelFailure"/>
<binding name="onCancelling"/>
<binding name="onCancelSuccess"/>
<binding name="onEditClick"/>
<binding name="onEditFailure"/>
<binding name="onEditing"/>
<binding name="onEditSuccess"/>
<binding name="onRefreshComplete"/>
<binding name="onSaveClick"/>
<binding name="onSaveFailure"/>
<binding name="onSaveSuccess"/>
<binding name="onSaving"/>
<binding name="onSubmit"/>
<binding name="saveAction"/>
<binding name="saveClass"/>
<binding name="saveLabel"/>
<binding name="saveUpdateContainerID"/>
<binding name="style"/>
<binding name="submitOnSave"/>
<binding name="formClass"/>
</wo>
</wodefinitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<webobject name = "UpdateContainer">
<webobject name = "IsNotEditingConditional">
<webobject name = "IsChangingToViewConditional">
<webobject name = "ScriptContainer">
MTAIP.cleanupEdit('<webobject name = "ID" />');
</webobject>
</webobject>
<webobject name = "EditFunction"></webobject>
<webobject name = "ManualViewControlConditional">
<webobject name = "ViewComponent"></webobject>
</webobject>
<webobject name = "NotManualViewControlConditional">
<webobject name = "EditAction"><webobject name = "ViewComponent" /></webobject>
</webobject>
</webobject>
<webobject name = "IsEditingConditional">
<webobject name = "EditForm">
<webobject name = "EditComponent" />
<webobject name = "IsChangingToEditConditional">
<webobject name = "ScriptContainer">
MTAIP.cleanupView('<webobject name = "ID"></webobject>');
</webobject>
</webobject>
<webobject name = "SubmitOnSaveConditional">
<webobject name = "SaveSubmitFunction"></webobject>
</webobject>
<webobject name = "LinkOnSaveConditional">
<webobject name = "SaveLinkFunction"></webobject>
</webobject>
<webobject name = "CancelFunction"></webobject>
<webobject name = "NotManualEditControlConditional">
<webobject name = "ButtonConditional">
<webobject name = "SaveButtonAction"></webobject>
</webobject>
<webobject name = "LinkConditional">
<webobject name = "SaveLinkAction">
<webobject name = "SaveLabel" />
</webobject>
</webobject>
<webobject name = "CancelAction">
<webobject name = "CancelLabel"/>
</webobject>
</webobject>
</webobject>
</webobject>
</webobject>

0 comments on commit e1c6e22

Please sign in to comment.