Page MenuHomePhorge

No OneTemporary

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index 7769ef6..3915059 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1,68 +1,71 @@
<?php
/**
- * This file is automatically generated. Use 'arc liberate' to rebuild it
+ * This file is automatically generated. Use 'arc liberate' to rebuild it.
*
* @generated
* @phutil-library-version 2
*/
phutil_register_library_map(array(
'__library_version__' => 2,
'class' => array(
'Diagram' => 'storage/Diagram.php',
'DiagramApplication' => 'application/DiagramApplication.php',
'DiagramCelerityResources' => 'celerity/DiagramCelerityResources.php',
'DiagramContentTransaction' => 'xaction/DiagramContentTransaction.php',
'DiagramController' => 'controller/DiagramController.php',
'DiagramDAO' => 'storage/DiagramDAO.php',
'DiagramPHIDType' => 'phid/DiagramPHIDType.php',
'DiagramPatchList' => 'storage/patch/DiagramPatchList.php',
'DiagramReplyHandler' => 'mail/DiagramReplyHandler.php',
'DiagramSchemaSpec' => 'storage/DiagramSchemaSpec.php',
'DiagramSearchConduitAPIMethod' => 'conduit/DiagramSearchConduitAPIMethod.php',
'DiagramTransaction' => 'storage/DiagramTransaction.php',
'DiagramTransactionEditor' => 'editor/DiagramTransactionEditor.php',
'DiagramTransactionType' => 'xaction/DiagramTransactionType.php',
'DiagramUploadConduitAPIMethod' => 'conduit/DiagramUploadConduitAPIMethod.php',
'DiagramVersion' => 'storage/DiagramVersion.php',
'PhabricatorDiagramQuery' => 'query/PhabricatorDiagramQuery.php',
'PhabricatorDiagramTransactionQuery' => 'query/PhabricatorDiagramTransactionQuery.php',
'PhabricatorDiagramVersionQuery' => 'query/PhabricatorDiagramVersionQuery.php',
'PhabricatorRemarkupDiagramRule' => 'remarkup/PhabricatorRemarkupDiagramRule.php',
'PlainHtmlWebpageResponse' => 'response/PlainHtmlWebpageResponse.php',
),
'function' => array(),
'xmap' => array(
'Diagram' => array(
'DiagramDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorDestructibleInterface',
'PhabricatorPolicyInterface',
'PhabricatorSubscribableInterface',
),
'DiagramApplication' => 'PhabricatorApplication',
'DiagramCelerityResources' => 'CelerityResourcesOnDisk',
'DiagramContentTransaction' => 'DiagramTransactionType',
'DiagramController' => 'PhabricatorController',
'DiagramDAO' => 'PhabricatorLiskDAO',
'DiagramPHIDType' => 'PhabricatorPHIDType',
'DiagramPatchList' => 'PhabricatorSQLPatchList',
'DiagramReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'DiagramSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'DiagramSearchConduitAPIMethod' => 'ConduitAPIMethod',
'DiagramTransaction' => 'PhabricatorModularTransaction',
'DiagramTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
'DiagramTransactionType' => 'PhabricatorModularTransactionType',
'DiagramUploadConduitAPIMethod' => 'ConduitAPIMethod',
'DiagramVersion' => array(
'DiagramDAO',
'PhabricatorDestructibleInterface',
'PhabricatorPolicyInterface',
),
'PhabricatorDiagramQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorDiagramTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorDiagramVersionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
- 'PhabricatorRemarkupDiagramRule' => 'PhabricatorObjectRemarkupRule',
+ 'PhabricatorRemarkupDiagramRule' => array(
+ 'PhabricatorObjectRemarkupRule',
+ 'RemarkupSyntaxDocumentationProvider',
+ ),
'PlainHtmlWebpageResponse' => 'AphrontHTMLResponse',
),
));
diff --git a/src/remarkup/PhabricatorRemarkupDiagramRule.php b/src/remarkup/PhabricatorRemarkupDiagramRule.php
index c9c362f..b0e7be5 100644
--- a/src/remarkup/PhabricatorRemarkupDiagramRule.php
+++ b/src/remarkup/PhabricatorRemarkupDiagramRule.php
@@ -1,103 +1,128 @@
<?php
require_celerity_resource('diagram-remarkup-image-js', 'diagram-resources');
require_celerity_resource('diagram-remarkup-image-css', 'diagram-resources');
final class PhabricatorRemarkupDiagramRule
- extends PhabricatorObjectRemarkupRule {
+ extends PhabricatorObjectRemarkupRule
+ implements RemarkupSyntaxDocumentationProvider {
protected function getObjectNamePrefix() {
return 'DIAG';
}
public function getRuleVersion() {
return '1.0';
}
protected function loadObjects(array $ids) {
$viewer = $this->getEngine()->getConfig('viewer');
$objects = id(new PhabricatorDiagramVersionQuery())
->setViewer($viewer)
->withDiagramIDs($ids)
->execute();
return $objects;
}
protected function renderObjectEmbed(
$diagram,
PhabricatorObjectHandle $handle,
$options) {
if ($options) {
$params = explode(',', $options);
$params = array_map('trim', $params);
} else {
$params = array();
}
// Generate the appropriate HTML using the data from the Diagram and
// file objects.
$style = '';
$class = 'diagram-content';
$alt = '';
$has_layout = false;
foreach ($params as $param) {
if (strpos($param, '=') !== false) {
list($key, $value) = explode('=', $param, 2);
} else {
$key = $param;
$value = null;
}
switch ($key) {
case 'layout':
$has_layout = true;
if ($value === 'left') {
$class .= ' phabricator-remarkup-embed-layout-left';
} else if ($value === 'right') {
$class .= ' phabricator-remarkup-embed-layout-right';
}
break;
case 'float':
$class .= ' phabricator-remarkup-embed-float-left';
break;
case 'size':
if ($value === 'full') {
$style .= 'width: 100%;';
}
break;
case 'alt':
$alt = phutil_escape_html($value);
break;
}
}
if ($has_layout == false) {
$class .= ' phabricator-remarkup-embed-layout-left';
}
$output = phutil_tag(
'div',
array(
'class' => 'diagram-container',
),
phutil_tag(
'img',
array(
'style' => $style,
'class' => $class,
'src' => 'data:image/png;base64,' . $diagram->getBase64Data(),
'alt' => $alt,
'data-sigil' => 'diagram-remarkup-image',
'data-diagram-version' => $diagram->getPHID(),
'data-diagram-id' => $diagram->getDiagramID(),
'title' => 'Double click to edit...'
)
)
);
return $output;
}
+
+ public function getDocumentation() {
+ return <<<EOT
+= Diagrams
+
+Diagrams is a Phorge extension application for
+[[ https://www.drawio.com | diagrams.net (previously draw.io)]] by JGraph.
+
+You can create and store diagrams in your Phorge instance.
+These diagrams can be referenced by means of the `DIAG` token.
+For example: `{DIAG123}`.
+
+When you double click on a diagram, the editor will open the corresponding
+diagram in a new browser tab.
+
+You can create diagrams with multiple pages, but only the first one will be
+visualized in a referenced diagram.
+
+When you modify an existing diagram, a new version will be created.
+You can select older versions in the editor by means of the dropdown in the
+topright corner.
+If you don't see a dropdown, you diagram has only 1 version.
+EOT;
+ }
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 14:05 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125343
Default Alt Text
(7 KB)

Event Timeline