Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15452513
D14125.id34119.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D14125.id34119.diff
View Options
diff --git a/resources/sql/autopatches/20150917.phortune.contact.1.sql b/resources/sql/autopatches/20150917.phortune.contact.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150917.phortune.contact.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_phortune.phortune_merchant
+ ADD contactInfo LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL;
diff --git a/src/applications/phortune/controller/PhortuneMerchantEditController.php b/src/applications/phortune/controller/PhortuneMerchantEditController.php
--- a/src/applications/phortune/controller/PhortuneMerchantEditController.php
+++ b/src/applications/phortune/controller/PhortuneMerchantEditController.php
@@ -47,6 +47,7 @@
$e_name = true;
$v_name = $merchant->getName();
$v_desc = $merchant->getDescription();
+ $v_cont = $merchant->getContactInfo();
$v_members = $merchant->getMemberPHIDs();
$e_members = null;
@@ -54,12 +55,14 @@
if ($request->isFormPost()) {
$v_name = $request->getStr('name');
$v_desc = $request->getStr('desc');
+ $v_cont = $request->getStr('cont');
$v_view = $request->getStr('viewPolicy');
$v_edit = $request->getStr('editPolicy');
$v_members = $request->getArr('memberPHIDs');
$type_name = PhortuneMerchantTransaction::TYPE_NAME;
$type_desc = PhortuneMerchantTransaction::TYPE_DESCRIPTION;
+ $type_cont = PhortuneMerchantTransaction::TYPE_CONTACTINFO;
$type_edge = PhabricatorTransactions::TYPE_EDGE;
$type_view = PhabricatorTransactions::TYPE_VIEW_POLICY;
@@ -76,6 +79,10 @@
->setNewValue($v_desc);
$xactions[] = id(new PhortuneMerchantTransaction())
+ ->setTransactionType($type_cont)
+ ->setNewValue($v_cont);
+
+ $xactions[] = id(new PhortuneMerchantTransaction())
->setTransactionType($type_view)
->setNewValue($v_view);
@@ -127,6 +134,12 @@
->setName('desc')
->setLabel(pht('Description'))
->setValue($v_desc))
+ ->appendChild(
+ id(new PhabricatorRemarkupControl())
+ ->setUser($viewer)
+ ->setName('cont')
+ ->setLabel(pht('Contact Info'))
+ ->setValue($v_cont))
->appendControl(
id(new AphrontFormTokenizerControl())
->setDatasource(new PhabricatorPeopleDatasource())
diff --git a/src/applications/phortune/controller/PhortuneMerchantViewController.php b/src/applications/phortune/controller/PhortuneMerchantViewController.php
--- a/src/applications/phortune/controller/PhortuneMerchantViewController.php
+++ b/src/applications/phortune/controller/PhortuneMerchantViewController.php
@@ -141,10 +141,25 @@
'default',
$viewer);
- $view->addSectionHeader(pht('Description'));
+ $view->addSectionHeader(
+ pht('Description'),
+ PHUIPropertyListView::ICON_SUMMARY);
$view->addTextContent($description);
}
+ $contact_info = $merchant->getContactInfo();
+ if (strlen($contact_info)) {
+ $contact_info = PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent($contact_info),
+ 'default',
+ $viewer);
+
+ $view->addSectionHeader(
+ pht('Contact Information'),
+ PHUIPropertyListView::ICON_SUMMARY);
+ $view->addTextContent($contact_info);
+ }
+
return $view;
}
diff --git a/src/applications/phortune/editor/PhortuneMerchantEditor.php b/src/applications/phortune/editor/PhortuneMerchantEditor.php
--- a/src/applications/phortune/editor/PhortuneMerchantEditor.php
+++ b/src/applications/phortune/editor/PhortuneMerchantEditor.php
@@ -16,6 +16,7 @@
$types[] = PhortuneMerchantTransaction::TYPE_NAME;
$types[] = PhortuneMerchantTransaction::TYPE_DESCRIPTION;
+ $types[] = PhortuneMerchantTransaction::TYPE_CONTACTINFO;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDGE;
@@ -30,6 +31,8 @@
return $object->getName();
case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
return $object->getDescription();
+ case PhortuneMerchantTransaction::TYPE_CONTACTINFO:
+ return $object->getContactInfo();
}
return parent::getCustomTransactionOldValue($object, $xaction);
@@ -42,6 +45,7 @@
switch ($xaction->getTransactionType()) {
case PhortuneMerchantTransaction::TYPE_NAME:
case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
+ case PhortuneMerchantTransaction::TYPE_CONTACTINFO:
return $xaction->getNewValue();
}
@@ -59,6 +63,9 @@
case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
$object->setDescription($xaction->getNewValue());
return;
+ case PhortuneMerchantTransaction::TYPE_CONTACTINFO:
+ $object->setContactInfo($xaction->getNewValue());
+ return;
}
return parent::applyCustomInternalTransaction($object, $xaction);
@@ -71,6 +78,7 @@
switch ($xaction->getTransactionType()) {
case PhortuneMerchantTransaction::TYPE_NAME:
case PhortuneMerchantTransaction::TYPE_DESCRIPTION:
+ case PhortuneMerchantTransaction::TYPE_CONTACTINFO:
return;
}
diff --git a/src/applications/phortune/storage/PhortuneMerchant.php b/src/applications/phortune/storage/PhortuneMerchant.php
--- a/src/applications/phortune/storage/PhortuneMerchant.php
+++ b/src/applications/phortune/storage/PhortuneMerchant.php
@@ -8,6 +8,7 @@
protected $name;
protected $viewPolicy;
protected $description;
+ protected $contactInfo;
private $memberPHIDs = self::ATTACHABLE;
@@ -23,6 +24,7 @@
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'description' => 'text',
+ 'contactInfo' => 'text',
),
) + parent::getConfiguration();
}
diff --git a/src/applications/phortune/storage/PhortuneMerchantTransaction.php b/src/applications/phortune/storage/PhortuneMerchantTransaction.php
--- a/src/applications/phortune/storage/PhortuneMerchantTransaction.php
+++ b/src/applications/phortune/storage/PhortuneMerchantTransaction.php
@@ -5,6 +5,7 @@
const TYPE_NAME = 'merchant:name';
const TYPE_DESCRIPTION = 'merchant:description';
+ const TYPE_CONTACTINFO = 'merchant:contactinfo';
public function getApplicationName() {
return 'phortune';
@@ -42,6 +43,10 @@
return pht(
'%s updated the description for this merchant.',
$this->renderHandleLink($author_phid));
+ case self::TYPE_CONTACTINFO:
+ return pht(
+ '%s updated the contact information for this merchant.',
+ $this->renderHandleLink($author_phid));
}
return parent::getTitle();
@@ -51,6 +56,7 @@
$old = $this->getOldValue();
switch ($this->getTransactionType()) {
case self::TYPE_DESCRIPTION:
+ case self::TYPE_CONTACTINFO:
return ($old === null);
}
return parent::shouldHide();
@@ -60,6 +66,8 @@
switch ($this->getTransactionType()) {
case self::TYPE_DESCRIPTION:
return ($this->getOldValue() !== null);
+ case self::TYPE_CONTACTINFO:
+ return ($this->getOldValue() !== null);
}
return parent::hasChangeDetails();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 30, 5:25 AM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7229422
Default Alt Text
D14125.id34119.diff (7 KB)
Attached To
Mode
D14125: Add Contact Information to Phortune Merchants
Attached
Detach File
Event Timeline
Log In to Comment