Index: deki/core/objects/deki_page_info.php
===================================================================
--- deki/core/objects/deki_page_info.php (revision 19293)
+++ deki/core/objects/deki_page_info.php (working copy)
@@ -28,14 +28,86 @@
*/
class DekiPageInfo
{
+ const PATH_TYPE_LINKED = 'linked';
+ const PATH_TYPE_CUSTOM = 'custom';
+ const PATH_TYPE_FIXED = 'fixed';
+
+ /* @var int */
public $id = null;
+ /* @var uri - api location for the verbase page xml */
public $href = null;
+ /* @var string - display title */
public $title = null;
+ /* @var string - page path */
public $path = null;
+ /* @var enum - see path type constants */
+ public $pathType = null;
public $namespace = null;
+ /* @var uri */
public $uriUi = null;
-
+
+
/**
+ * Moves a page. Info object must correspond to a real page
+ * @see API::pages/{id}/move
+ *
+ * @param DekiPageInfo &$Info - Page to move. On success, this object is updated with the new page location
+ * @param DekiPageInfo $Parent
+ * @param string $pageTitle - page display title
+ * @param string $pageName - url encoded path segment
+ * @return DekiResult
+ */
+ public static function move(DekiPageInfo &$Info, $Parent = null, $pageTitle = null, $pageName = null)
+ {
+ $Plug = DekiPlug::getInstance();
+ $Plug = $Plug->At('pages', $Info->id, 'move');
+
+ if (!is_null($Parent))
+ {
+ $Plug = $Plug->With('parentid', $Parent->id);
+ }
+ if (!is_null($pageTitle))
+ {
+ $Plug = $Plug->With('title', $pageTitle);
+ }
+ if (!is_null($pageName))
+ {
+ $Plug = $Plug->With('name', $pageName);
+ }
+
+ $Result = $Plug->Post();
+ if ($Result->isSuccess())
+ {
+ $count = $Result->getVal('body/pages.moved/@count', 0);
+ if ($count > 0)
+ {
+ $Info = DekiPageInfo::newFromArray($Result->getVal('body/pages.moved/page'));
+ }
+ }
+
+ return $Result;
+ }
+
+ /**
+ * Loads the page info from the API
+ * @TODO: handle 401?
+ * @param int $id
+ * @return DekiPageInfo
+ */
+ public static function loadFromId($id)
+ {
+ $Plug = DekiPlug::getInstance();
+
+ $Result = $Plug->At('pages', $id, 'info')->Get();
+ if (!$Result->isSuccess())
+ {
+ return null;
+ }
+
+ return self::newFromArray($Result->getVal('body/page'));
+ }
+
+ /**
* Creates a page info object from an API page info result
* @param array $result
* @return DekiPageInfo
@@ -53,12 +125,62 @@
$Info->id = $X->getVal('@id');
$Info->href = $X->getVal('@href');
$Info->title = $X->getVal('title');
- $Info->path = $X->getVal('path');
$Info->namespace = $X->getVal('namespace');
$Info->uriUi = $X->getVal('uri.ui');
+ $Info->pathType = $X->getVal('path/@type');
+ if (!is_null($Info->pathType))
+ {
+ $Info->path = $X->getVal('path/#text');
+ }
+ else
+ {
+ // no path type found
+ $Info->path = $X->getVal('path');
+ $Info->pathType = self::PATH_TYPE_LINKED;
+ }
+
return $Info;
}
+
+ /**
+ * Determine if this info corresponds to the homepage
+ * @return bool
+ */
+ public function isHomepage() { return empty($this->path); }
- public function isHomepage() { return empty($this->path); }
+ /**
+ * Return the path with or without the namespace
+ * @param bool $includeNamespace - for main, this is implicitly true
+ * @return string
+ */
+ public function getPath($includeNamespace = false)
+ {
+ if ($this->namespace == 'main' || $includeNamespace)
+ {
+ return $this->path;
+ }
+ else
+ {
+ return substr($this->path, strlen($this->namespace) + 1);
+ }
+ }
+
+ /**
+ * Retrieve the partial path segment for this info
+ * @return string
+ */
+ public function getPathName()
+ {
+ if ($this->isHomepage())
+ {
+ return '';
+ }
+
+ // replace double slashes with encoded single slashes
+ $encoded = str_replace('//', '%2f', $this->getPath());
+ $pieces = explode('/', $encoded);
+
+ return array_pop($pieces);
+ }
}
Index: includes/GlobalFunctions.php
===================================================================
--- includes/GlobalFunctions.php (revision 19293)
+++ includes/GlobalFunctions.php (working copy)
@@ -1012,6 +1012,11 @@
$html .= FlashMessage::format('<ul>'.$msg.'</ul>', 'sessionMsg', $key);
}
}
+ else if ($type == 'general')
+ {
+ // always output a message container
+ $html .= '<div id="sessionMsg"><div class="inner"><ul></ul></div></div>';
+ }
return $html;
}
}
Index: resources/resources.txt
===================================================================
--- resources/resources.txt (revision 19293)
+++ resources/resources.txt (working copy)
@@ -1153,6 +1153,10 @@
submit=Insert template
page-title=Insert template
+[Dialog.PageTitleEditor]
+ success=Page title has been updated.
+ success.moved=Page title has been updated. Your page's URL has been successfully updated to $1
+
[Dialog.Unsupported]
browser-message=You are using an unsupported browser. We're sorry for any inconvenience, but only (IE 6, IE 7, FF 1.5, FF 2.0) are supported. If you have any questions, please contact MindTouch Support.
button-close-window=Close window
Index: skins/ace/ace.php
===================================================================
--- skins/ace/ace.php (revision 19293)
+++ skins/ace/ace.php (working copy)
@@ -270,7 +270,10 @@
<?php if (!Skin::isNewPage() && !Skin::isEditPage() && $this->hasData('displaypagetitle')) {?>
<div class="t-title">
- <h1 id="title"><?php $this->text('displaypagetitle'); ?></h1>
+ <h1 id="title">
+ <?php //$this->text('displaypagetitle'); ?>
+ <?php $this->html('page.title'); ?>
+ </h1>
</div>
<?php } ?>
Index: skins/common/deki.js
===================================================================
--- skins/common/deki.js (revision 19293)
+++ skins/common/deki.js (working copy)
@@ -16,10 +16,31 @@
Deki.Ui = {};
}
+// yellowbox exceptions
Deki.Ui.Message = function(title, message, details) {
MTMessage.Show(title, message, 'ui-errormsg', details);
};
+// generate a flash message
+Deki.Ui.Flash = function(messageHtml, type) {
+ // find the message container
+ var $flash = $('#sessionMsg');
+ var $ul = $flash.find('ul');
+ // clear messages
+ $ul.empty();
+ $flash.removeClass('errormsg successmsg');
+ // set the message type
+ var flashClass = 'successmsg';
+ switch (type) {
+ case 'error':
+ flashClass = 'errormsg';
+ default:
+ }
+ $flash.addClass(flashClass);
+ // create the message
+ $('<li></li>').html(messageHtml).appendTo($ul);
+};
+
// Gui
if (typeof Deki.Gui == 'undefined') {
Deki.Gui = {};
Index: skins/common/js.php
===================================================================
--- skins/common/js.php (revision 19293)
+++ skins/common/js.php (working copy)
@@ -45,6 +45,7 @@
$Js->addCommon('comments.js');
$Js->addCommon('jquery/thickbox/thickbox.js');
$Js->addCommon('jquery/autocomplete/jquery.autocomplete.js');
+$Js->addCommon('jquery/jquery.hoverIntent.min.js');
$Js->addCommon('pagebus.js');
$Js->addCommon('deki.js');
$Js->addCommon('quickpopup.js'); // lightweight popup
Index: skins/deucebeta/deucebeta.php
===================================================================
--- skins/deucebeta/deucebeta.php (revision 19293)
+++ skins/deucebeta/deucebeta.php (working copy)
@@ -356,7 +356,7 @@
echo('<div class="talkpage"><a href="'.$wgTitle->getLocalUrl().'">'.Skin::iconify('pagetalk').'</a></div>');
}
?>
- <?php $this->text('title'); ?>
+ <?php $this->html('page.title'); ?>
<?php if ($this->get('pageismoved')) : ?>
<span class="redir"><?php echo(wfMsg('Article.Common.redirected-from', $this->get('pagemovelocation'))); ?></span>
Index: skins/fiesta/fiesta.php
===================================================================
--- skins/fiesta/fiesta.php (revision 19293)
+++ skins/fiesta/fiesta.php (working copy)
@@ -279,7 +279,12 @@
<?php if ($this->haveData('pageismoved')) {
echo('<a class="pageMoved" href="'.$this->haveData('pagemovelocation').'">'.$this->haveData('pagemovemessage').'</a>');
}?>
- <h1 id="title"><span <?php if ($this->haveData('pageisrestricted')) { echo(' class="pageRestricted" '); }?>><?php $this->text('displaypagetitle'); ?></span></h1>
+ <h1 id="title">
+ <span <?php if ($this->haveData('pageisrestricted')) { echo(' class="pageRestricted" '); }?>>
+ <?php //$this->text('displaypagetitle'); ?>
+ <?php $this->html('page.title'); ?>
+ </span>
+ </h1>
</div>
<?php } ?>
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by