[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14569] booking: convert contactperson
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14569] booking: convert contactperson |
Date: |
Thu, 10 Dec 2015 15:39:22 +0000 |
Revision: 14569
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14569
Author: sigurdne
Date: 2015-12-10 15:39:21 +0000 (Thu, 10 Dec 2015)
Log Message:
-----------
booking: convert contactperson
Modified Paths:
--------------
branches/dev-syncromind/booking/inc/class.socontactperson.inc.php
branches/dev-syncromind/booking/inc/class.uicontactperson.inc.php
branches/dev-syncromind/booking/templates/base/contactperson_edit.xsl
branches/dev-syncromind/booking/templates/base/contactperson_fields.xsl
Modified: branches/dev-syncromind/booking/inc/class.socontactperson.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.socontactperson.inc.php
2015-12-10 14:57:37 UTC (rev 14568)
+++ branches/dev-syncromind/booking/inc/class.socontactperson.inc.php
2015-12-10 15:39:21 UTC (rev 14569)
@@ -7,16 +7,16 @@
function __construct()
{
parent::__construct('bb_contact_person', array(
- 'id' => array('type' =>
'auto', 'nullable' => false),
- 'ssn' => array('type' =>
'varchar', 'precision' => '12', 'nullable' => True,),
- 'name' => array('type' =>
'varchar', 'precision' => '50', 'nullable' => False,
+ 'id' => array('type' =>
'int', 'nullable' => false),
+ 'ssn' => array('type' =>
'string', 'precision' => '12', 'nullable' => True,),
+ 'name' => array('type' =>
'string', 'precision' => '50', 'nullable' => False,
'query' => true,),
- 'homepage' => array('type' =>
'varchar', 'precision' => '50', 'nullable' => False),
- 'phone' => array('type' =>
'varchar', 'precision' => '50', 'nullable' => False,
+ 'homepage' => array('type' =>
'string', 'precision' => '50', 'nullable' => False),
+ 'phone' => array('type' =>
'string', 'precision' => '50', 'nullable' => False,
'default' => ''),
- 'email' => array('type' =>
'varchar', 'precision' => '50', 'nullable' => False,
+ 'email' => array('type' =>
'string', 'precision' => '50', 'nullable' => False,
'default' => ''),
- 'description' => array('type' => 'varchar',
'precision' => '1000', 'nullable' => False,
+ 'description' => array('type' => 'string',
'precision' => '1000', 'nullable' => False,
'default' => ''),
)
);
Modified: branches/dev-syncromind/booking/inc/class.uicontactperson.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uicontactperson.inc.php
2015-12-10 14:57:37 UTC (rev 14568)
+++ branches/dev-syncromind/booking/inc/class.uicontactperson.inc.php
2015-12-10 15:39:21 UTC (rev 14569)
@@ -18,18 +18,23 @@
$this->bo =
CreateObject('booking.bocontactperson');
self::set_active_menu('booking::contacts');
$this->module = "booking";
+ $this->fields = array(
+ 'name' => 'string',
+ 'ssn' => 'string',
+ 'homepage' => 'url',
+ 'phone' => 'string',
+ 'email' => 'email',
+ 'description' => 'html',
+ );
}
public function index()
{
if(phpgw::get_var('phpgw_return_as') == 'json')
{
- return $this->index_json();
+ return $this->query();
}
- self::add_javascript('booking', 'booking',
'datatable.js');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('paginator');
$data = array(
'form' => array(
'toolbar' => array(
@@ -52,19 +57,15 @@
),
),
'datatable' => array(
- 'source' =>
self::link(array('menuaction' => 'booking.uicontactperson.index',
- 'phpgw_return_as' => 'json')),
+ 'source' =>
self::link(array('menuaction' => 'booking.uicontactperson.index',
+ 'phpgw_return_as' =>
'json')),
'field' => array(
array(
'key' =>
'name',
'label' =>
lang('First name'),
- 'formatter' =>
'YAHOO.booking.formatLink'
+ 'formatter' =>
'JqueryPortico.formatLink'
),
array(
- 'key' => 'surname',
- 'label' =>
lang('Surname'),
- ),
- array(
'key' =>
'organization',
'label' =>
lang('Organization')
),
@@ -73,7 +74,7 @@
'label' =>
lang('Phone')
),
array(
- 'key' => 'mail',
+ 'key' => 'email',
'label' =>
lang('Email')
),
array(
@@ -83,36 +84,33 @@
)
)
);
- self::render_template('datatable', $data);
+ self::render_template_xsl('datatable_jquery', $data);
}
- public function index_json()
+ public function query()
{
if($id = phpgw::get_var('id', 'int'))
{
$person = $this->bo->read_single($id);
- return
$this->yui_results(array("totalResultsAvailable" => 1, "results" => $person));
+ return
$this->jquery_results(array("totalResultsAvailable" => 1, "results" =>
$person));
}
$persons = $this->bo->read();
array_walk($persons["results"], array($this,
"_add_links"), "booking.uicontactperson.show");
- return $this->yui_results($persons);
+ return $this->jquery_results($persons);
}
- function query()
- {
-
- }
+
public function show()
{
$person
= $this->bo->read_single(phpgw::get_var('id', 'int'));
$person['contactpersons_link'] =
self::link(array('menuaction' => 'booking.uicontactperson.index'));
$person['edit_link'] =
self::link(array('menuaction' => 'booking.uicontactperson.edit',
- 'id' => $person['id']));
+ 'id' => $person['id']));
$data = array(
'group' => $group
);
- self::render_template('contactperson', array('person'
=> $person,));
+ self::render_template_xsl('contactperson',
array('person' => $person,));
}
public function edit()
@@ -124,7 +122,8 @@
$person['id']
= $id;
$person['contactpersons_link'] =
self::link(array('menuaction' => 'booking.uicontactperson.index'));
$person['edit_link'] =
self::link(array('menuaction' => 'booking.uicontactperson.edit',
- 'id' => $person['id']));
+ 'id' => $person['id']));
+ $person['cancel_link'] =
self::link(array('menuaction' => 'booking.uicontactperson.index'));
}
else
{
@@ -134,8 +133,7 @@
$errors = array();
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
- $person = array_merge($person,
extract_values($_POST, array('ssn', 'name', 'homepage',
- 'phone', 'email', 'description',)));
+ $person = array_merge($person,
extract_values($_POST, $this->fields));
$errors = $this->bo->validate($person);
if(!$errors)
{
@@ -148,19 +146,13 @@
$receipt =
$this->bo->add($person);
}
$this->redirect(array('menuaction' =>
$this->module . '.uicontactperson.show',
- 'id' => $receipt['id']));
+ 'id' =>
$receipt['id']));
}
}
$this->flash_form_errors($errors);
+
phpgwapi_jquery::init_ckeditor('contact-field-description');
-
self::add_stylesheet('phpgwapi/js/yahoo/assets/skins/sam/skin.css');
- self::add_javascript('yahoo', 'yahoo/yahoo-dom-event',
'yahoo-dom-event.js');
- self::add_javascript('yahoo', 'yahoo/element',
'element-min.js');
- self::add_javascript('yahoo', 'yahoo/dom',
'dom-min.js');
- self::add_javascript('yahoo', 'yahoo/container',
'container_core-min.js');
- self::add_javascript('yahoo', 'yahoo/editor',
'simpleeditor-min.js');
-
self::add_template_file("contactperson_fields");
- self::render_template('contactperson_edit',
array('person' => $person,));
+ self::render_template_xsl('contactperson_edit',
array('person' => $person,));
}
}
\ No newline at end of file
Modified: branches/dev-syncromind/booking/templates/base/contactperson_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/contactperson_edit.xsl
2015-12-10 14:57:37 UTC (rev 14568)
+++ branches/dev-syncromind/booking/templates/base/contactperson_edit.xsl
2015-12-10 15:39:21 UTC (rev 14569)
@@ -33,25 +33,12 @@
</input>
<a class="cancel">
<xsl:attribute name="href">
- <xsl:value-of
select="booking/cancel_link"/>
+ <xsl:value-of
select="person/cancel_link"/>
</xsl:attribute>
<xsl:value-of
select="php:function('lang', 'Cancel')" />
</a>
</div>
</form>
</div>
-
- <script type="text/javascript">
-<![CDATA[
-var descEdit = new YAHOO.widget.SimpleEditor('contact-field-description', {
- height: '300px',
- width: '522px',
- dompath: true,
- animate: true,
- handleSubmit: true
-});
-descEdit.render();
-]]>
- </script>
</xsl:template>
Modified:
branches/dev-syncromind/booking/templates/base/contactperson_fields.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/contactperson_fields.xsl
2015-12-10 14:57:37 UTC (rev 14568)
+++ branches/dev-syncromind/booking/templates/base/contactperson_fields.xsl
2015-12-10 15:39:21 UTC (rev 14569)
@@ -2,7 +2,7 @@
<dl class="form">
<dt>
<label for="field_name">
- <xsl:value-of select="php:function('lang',
'First name')" />
+ <xsl:value-of select="php:function('lang',
'Name')" />
</label>
</dt>
<dd>
@@ -14,16 +14,6 @@
</dd>
<dt>
- <label>
- <xsl:value-of select="php:function('lang',
'Surname')" />
- </label>
- </dt>
- <dd>
- <input type="text">
- </input>
- </dd>
-
- <dt>
<label for="contact-field-ssn">
<xsl:value-of select="php:function('lang',
'Social Security Number')" />
</label>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14569] booking: convert contactperson,
Sigurd Nes <=