Update of /cvsroot/phpvortex/phpvortex
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv760
Modified Files:
SEC_Edit.class.php
Log Message:
Added a Find functionality to SEC_Edit, and changed the Reset functionality
Index: SEC_Edit.class.php
===================================================================
RCS file: /cvsroot/phpvortex/phpvortex/SEC_Edit.class.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SEC_Edit.class.php 8 Oct 2004 17:14:47 -0000 1.1
--- SEC_Edit.class.php 24 Apr 2005 21:37:28 -0000 1.2
***************
*** 66,74 ****
* <li /> 'N' = New
* <li /> 'D' = Delete
* </ul>
*
* @var string
*/
! var $buttons = 'SRND';
/**
--- 66,75 ----
* <li /> 'N' = New
* <li /> 'D' = Delete
+ * <li /> 'F' = Find
* </ul>
*
* @var string
*/
! var $buttons = 'SRFND';
/**
***************
*** 129,132 ****
--- 130,147 ----
/**
+ * Text for the find button.
+ *
+ * @var string
+ */
+ var $txt_find = '';
+
+ /**
+ * Image for the find button.
+ *
+ * @var string
+ */
+ var $img_find = '';
+
+ /**
* Constructor: Process form data and prepare the section to display.
*
***************
*** 158,161 ****
--- 173,182 ----
)
);
+ if (!(empty($_REQUEST["{$this->table->name}_action"]) || strcmp($_REQUEST["{$this->table->name}_action"], 'F'))) {
+ $opts['data'] = array();
+ foreach ($this->table->fields_form as $field) {
+ if (!empty($_REQUEST[$field->name_form])) $opts['data'][$field->name_form] = $_REQUEST[$field->name_form];
+ }
+ }
$this->AddSection("{$this->table->name}_list", $this->list, $opts);
***************
*** 172,176 ****
* Perform a action.
*
! * @param string $action Action to perform ('S' for INSERT/UPDATE, 'E' for edit, 'N' for new, 'D' for DELETE).
*/
function Perform($action)
--- 193,197 ----
* Perform a action.
*
! * @param string $action Action to perform ('S' for INSERT/UPDATE, 'E' for edit, 'N' for new, 'D' for DELETE, 'F' for find).
*/
function Perform($action)
***************
*** 196,201 ****
--- 217,226 ----
} elseif (!strcmp($action, 'E')) {
$this->table->Seek($_REQUEST);
+ } elseif (!strcmp($action, 'F')) {
+ $this->table->Seek($_REQUEST);
} elseif (!strcmp($action, 'N')) {
$this->table->Seek();
+ } elseif (!strcmp($action, 'R')) {
+ $this->table->Seek();
} elseif (!strcmp($action, 'D')) {
if ($this->table->Delete($_REQUEST)) {
***************
*** 235,242 ****
}
} elseif (!strcmp($button, 'R')) {
if (empty($this->img_reset)) {
! $code .= "<input type='reset' value='".(empty($this->txt_reset)?$vortex_msgs['form_reset']:$this->txt_reset)."' />\n";
} else {
! $code .= "<input type='image' src='{$this->img_reset}' alt='".(empty($this->txt_reset)?$vortex_msgs['form_reset']:$this->txt_reset)."' onclick='document.form_{$this->table->name}.reset();return false;' />\n";
}
} elseif (!strcmp($button, 'N')) {
--- 260,270 ----
}
} elseif (!strcmp($button, 'R')) {
+ $url =& new URL();
+ $url->parameters["{$this->table->name}_action"] = 'R';
+ $code .= "<script language='JavaScript'>\n\tfunction {$this->table->name}_Reset() {\n\t\tdocument.form_{$this->table->name}.action = '".$url->Get()."';\n\t\tdocument.form_{$this->table->name}.submit();\n\t}\n</script>\n";
if (empty($this->img_reset)) {
! $code .= "<input type='button' value='".(empty($this->txt_reset)?$vortex_msgs['form_reset']:$this->txt_reset)."' onclick='{$this->table->name}_Reset();' />\n";
} else {
! $code .= "<input type='image' src='{$this->img_reset}' alt='".(empty($this->txt_reset)?$vortex_msgs['form_reset']:$this->txt_reset)."' onclick='{$this->table->name}_Reset();' />\n";
}
} elseif (!strcmp($button, 'N')) {
***************
*** 258,261 ****
--- 286,298 ----
$code .= "<input type='image' src='{$this->img_delete}' alt='".(empty($this->txt_delete)?$vortex_msgs['form_delete']:$this->txt_delete)."' onclick='{$this->table->name}_Delete();' />\n";
}
+ } elseif (!strcmp($button, 'F')) {
+ $url =& new URL();
+ $url->parameters["{$this->table->name}_action"] = 'F';
+ $code .= "<script language='JavaScript'>\n\tfunction {$this->table->name}_Find() {\n\t\tdocument.form_{$this->table->name}.action = '".$url->Get()."';\n\t\tdocument.form_{$this->table->name}.submit();\n\t}\n</script>\n";
+ if (empty($this->img_find)) {
+ $code .= "<input type='button' value='".(empty($this->txt_find)?$vortex_msgs['form_find']:$this->txt_find)."' onclick='{$this->table->name}_Find();' />\n";
+ } else {
+ $code .= "<input type='image' src='{$this->img_find}' alt='".(empty($this->txt_find)?$vortex_msgs['form_find']:$this->txt_find)."' onclick='{$this->table->name}_Find();' />\n";
+ }
}
}
|