[phaux commit] r134 - in trunk: Classes/Phaux-base Classes/Phaux-render HtmlRoot/scripts-standard

0 views
Skip to first unread message

codesite...@google.com

unread,
Oct 25, 2007, 10:45:16 AM10/25/07
to phau...@googlegroups.com
Author: WHarford
Date: Thu Oct 25 07:44:34 2007
New Revision: 134

Modified:
trunk/Classes/Phaux-base/WHBrowser.php
trunk/Classes/Phaux-base/WHComponent.php
trunk/Classes/Phaux-base/WHHalo.php
trunk/Classes/Phaux-render/WHFormInputTag.php
trunk/Classes/Phaux-render/WHSelectTag.php
trunk/HtmlRoot/scripts-standard/standardScript.js

Log:
Browser is almost done

Modified: trunk/Classes/Phaux-base/WHBrowser.php
==============================================================================
--- trunk/Classes/Phaux-base/WHBrowser.php (original)
+++ trunk/Classes/Phaux-base/WHBrowser.php Thu Oct 25 07:44:34 2007
@@ -187,51 +187,97 @@

}

+ public function renderCategorySelectionOn($html){
+ return
+ $html->div()->class('class-limit')->id('whbrowser-category-selection')->
+ with(
+ $html->form()->with(
+ $html->select()->id('classCategorySelect')->
+ setItems($this->classCategories())->
+ size(10)->
+ callback($this,'setCurrentCategory')->
+ liveUpdateOn('onChange',$this,'renderAjaxClassUpdateOn')->
+ setSelectedItem($this->currentCategory)
+ ).
+
+
+ $html->form()->with(
+ $html->select()->id('classHierarchySelect')->
+ itemsAndLabels($this->classHierarchyWityLabel())->
+ size(10)->
+ submitFormOnChange()->
+ callback($this,'setCurrentClass')->
+ liveUpdateOn('onChange',$this,'renderAjaxClassUpdateOn')->
+ setSelectedItem($this->currentClass)
+ )
+ );
+ }
+
public function renderClassSelectionOn($html){
return
- $html->div()->class('class-limit')->with(
- $html->form()->with(
- $html->select()->setItems($this->classCategories())->
- size(10)->
- submitFormOnChange()->
- callback($this,'setCurrentCategory')->
- setSelectedItem($this->currentCategory)
- ).
-
-
- $html->form()->with(
- $html->select()->itemsAndLabels($this->classHierarchyWityLabel())->
- size(10)->
- submitFormOnChange()->
- callback($this,'setCurrentClass')->
- setSelectedItem($this->currentClass)
- )
- ).
+ $html->div()->class('class-limit')->id('whbrowser-class-selection')->
+ with(
$html->form()->with(
$html->select()->setItems($this->currentClassList())->
- size(20)->
- submitFormOnChange()->
- callback($this,'setCurrentClass')->
- setSelectedItem($this->currentClass)
- ).
- $html->form()->with(
- $html->select()->itemsAndLabels($this->methodListWithLabel())->
- size(20)->
- submitFormOnChange()->
- callback($this,'setCurrentMethod')->
- setSelectedItem($this->currentMethod)
+ size(20)->
+ submitFormOnChange()->
+ callback($this,'setCurrentClass')->
+ liveUpdateOn('onChange',$this,'renderAjaxClassUpdateOn')->
+ setSelectedItem($this->currentClass)
+ )
);
}

+ public function renderMethodSelectionOn($html){
+ return $html->div()->class('class-limit')->id('whbrowser-method-selection')->
+ with(
+ $html->form()->with(
+ $html->select()->
+ itemsAndLabels($this->methodListWithLabel())->
+ size(20)->
+ submitFormOnChange()->
+ callback($this,'setCurrentMethod')->
+ liveUpdateOn('onChange',$this,'renderMethodSourceOn')->
+ setSelectedItem($this->currentMethod)
+ )
+ );
+ }
+
+ public function renderTopSelectionOn($html){
+ return
+ $this->renderCategorySelectionOn($html).
+ $this->renderClassSelectionOn($html).
+ $this->renderMethodSelectionOn($html).
+ $html->div()->class('spacer')->with($html->space());
+ }
+
public function renderMethodSourceOn($html){
- return $html->div()->class('whbrowser-source')->
+ return $html->div()->class('whbrowser-source')->id('whbrowser-source')->
with(highlight_string("<?php\n".
$this->currentMethodSource(),true));
}

+ public function renderAjaxClassUpdateOn($html){
+ return
+ $this->renderMethodSelectionOn($html).
+ $this->renderClassSelectionOn($html).
+ $this->renderMethodSourceOn($html).
+ $html->script()->with('
+
+ setSelectedIndexOnSelectFromLabel(
+ document.getElementById("classHierarchySelect"),
+ "'.$this->currentClass.'");
+ setSelectedIndexOnSelectFromLabel(
+ document.getElementById("classCategorySelect"),
+ "'.$this->currentCategory.'");
+ ');
+
+
+ }
+
public function renderContentOn($html){
return $html->div()->class('whbrowser')->with(
- $this->renderClassSelectionOn($html).
+ $this->renderTopSelectionOn($html).
$this->renderMethodSourceOn($html)
);
}
@@ -247,9 +293,8 @@
width:201px;
float:left;
}
- .whbrowser .class-limit select{
+ .whbrowser #whbrowser-category-selection.class-limit select{
height:125px;
-
}
.whbrowser select{
height:252px;

Modified: trunk/Classes/Phaux-base/WHComponent.php
==============================================================================
--- trunk/Classes/Phaux-base/WHComponent.php (original)
+++ trunk/Classes/Phaux-base/WHComponent.php Thu Oct 25 07:44:34 2007
@@ -71,7 +71,9 @@
return $return;
}

- abstract public function renderContentOn($html);
+ public function renderContentOn($html){
+ $this->subclassResponsibility('renderContentOn');
+ }


public function callDialog($aComponent){

Modified: trunk/Classes/Phaux-base/WHHalo.php
==============================================================================
--- trunk/Classes/Phaux-base/WHHalo.php (original)
+++ trunk/Classes/Phaux-base/WHHalo.php Thu Oct 25 07:44:34 2007
@@ -31,7 +31,7 @@

public function browsParent(){
$this->session()->toggleHalos();
- $this->session()->mainComponent()->callModel(
+ $this->session()->mainComponent()->callDialog(
Object::construct('WHBrowser')->
setCurrentClass($this->decoratedComponent->getClass())->
addDecoration(Object::construct('WHWindowDecoration'))->

Modified: trunk/Classes/Phaux-render/WHFormInputTag.php
==============================================================================
--- trunk/Classes/Phaux-render/WHFormInputTag.php (original)
+++ trunk/Classes/Phaux-render/WHFormInputTag.php Thu Oct 25 07:44:34 2007
@@ -17,7 +17,16 @@
$this->subclassResponsibility("type");
}

-
+ public function liveUpdateFunction($renderKey,$callbackKey = ""){
+ global $app;
+ $url = $_SESSION[$app]['session']->url();
+ if($callbackKey != ""){
+ $url .= "&_i[$callbackKey]='+this.value+'";
+ }
+ $url .= "&_lu=$renderKey";
+ return $this->liveUpdateFunctionWithUrl($url);
+
+ }

/*
**Register a callback for processing the user data

Modified: trunk/Classes/Phaux-render/WHSelectTag.php
==============================================================================
--- trunk/Classes/Phaux-render/WHSelectTag.php (original)
+++ trunk/Classes/Phaux-render/WHSelectTag.php Thu Oct 25 07:44:34 2007
@@ -49,6 +49,18 @@
return $this;
}

+
+ public function liveUpdateFunction($renderKey,$callbackKey = ""){
+ global $app;
+ $url = $_SESSION[$app]['session']->url();
+ if($callbackKey != ""){
+ $url .= "&_i[$callbackKey]='+this.options[this.selectedIndex].value+'";
+ }
+ $url .= "&_lu=$renderKey";
+ return $this->liveUpdateFunctionWithUrl($url);
+
+ }
+
public function addItemWithLabel($item,$label){
$this->addItem($item)->itemLabel($item,$label);
return $this;
@@ -104,7 +116,7 @@
}

public function itemLabel($anItem,$aString){
- $this->labels[$this->indexForItem($anItem)] = $aString;
+ $this->labels[$this->indexForItem($anItem)] = htmlspecialchars($aString);
return $this;
}

Modified: trunk/HtmlRoot/scripts-standard/standardScript.js
==============================================================================
--- trunk/HtmlRoot/scripts-standard/standardScript.js (original)
+++ trunk/HtmlRoot/scripts-standard/standardScript.js Thu Oct 25
07:44:34 2007
@@ -159,8 +159,7 @@
** If we get an html tag we can expect that it is unexpected
** and most likely an error. Replace the contents of the
** entire page
- */
-
+ */
if (child.tagName == "dom") {
var elementId = child.getAttribute("id");
var element = document.getElementById(elementId);
@@ -202,11 +201,9 @@

function xmlProcessResults(response) {

- for(i=0; i < response.documentElement.childNodes.length; i++) {
-
+ for(var i=0; i < response.documentElement.childNodes.length; i++) {
var child = response.documentElement.childNodes[i];
xmlLiveProcessOne(child);
-
}
}

@@ -362,4 +359,14 @@
function updateModelBox(){
fullscreen("model-overlay");
visualCenter("model-window");
+}
+
+function setSelectedIndexOnSelectFromLabel(select,label){
+
+ for(var i = 0; i < select.options.length -1; i++){
+ if(select.options[i].text.replace(/^\s+|\s+$/g, '') == label){
+ select.selectedIndex = i;
+ }
+ }
+
}

Reply all
Reply to author
Forward
0 new messages