Résolution du bug #2930921 : le titre de la page n'était pas mis à jour avec l'AJAX

Ajout de la fonctionnalité #2930930 : l'url permanente du strip est maintenant indiquée
This commit is contained in:
Leblanc Simon 2010-01-20 02:30:45 +00:00
commit e7d737af1b
9 changed files with 31 additions and 0 deletions

View file

@ -25,6 +25,7 @@ abstract class AbstractLang
protected $contact = "Contact";
protected $rss = "RSS";
protected $licence = "Licence";
protected $permanent_link = "Lien permanent";
protected $boutique = "Boutique";
protected $teeshirt = "(t-shirts & cadeaux)";
protected $propulse = "Propulsé par";
@ -58,6 +59,7 @@ abstract class AbstractLang
public function getContact() { return $this->contact; }
public function getRss() { return $this->rss; }
public function getLicence() { return $this->licence; }
public function getPermanentLink() { return $this->permanent_link; }
public function getBoutique() { return $this->boutique; }
public function getTeeshirt() { return $this->teeshirt; }
public function getPropulse() { return $this->propulse; }

View file

@ -81,6 +81,25 @@ function getNavigation($id, $last, Lang $lang)
}
/**
* Return the permanent link for the strip
*
* @param integer $id The id of the actual strip
* @param Lang $lang The Lang object use for the actual user
* @return string The permanent link for the actual strip
*/
function getPermanentLink($id, Lang $lang)
{
$url = Config::getUrl().'/'.Config::getIndex().'?id=';
$nav_lang = '';
if (isset($_GET['lang'])) {
$nav_lang = '&lang='.$lang;
}
return $url.$id.$nav_lang;
}
/**
* Return an array with all navigation link
*

View file

@ -26,6 +26,7 @@ class Lang extends AbstractLang
$this->contact = "Contact";
$this->rss = "RSS";
$this->licence = "License";
$this->permanent_link = "Permanent link";
$this->boutique = "Shop";
$this->teeshirt = "(t-shirts & gifts)";
$this->propulse = "Powered by";

View file

@ -26,6 +26,7 @@ class Lang extends AbstractLang
$this->contact = "Contact";
$this->rss = "RSS";
$this->licence = "Licence";
$this->permanent_link = "Lien permanent";
$this->boutique = "Boutique";
$this->teeshirt = "(t-shirts & cadeaux)";
$this->propulse = "Propulsé par";

View file

@ -45,6 +45,7 @@
<p id="description"><?php echo $strip->getDescription() ?></p>
<p><span id="author">&copy; <?php echo $strip->getAuthor() ?></span> : <span id="date"><?php echo $strip->getDate() ?></span> : <a id="link_source" href="<?php echo $strip->getFilenameSrc() ?>"><?php echo $lang->getSource() ?></a></p>
<p id="license"><?php echo $lang->getLicence() ?> : <a id="link_license" href="<?php echo $strip->getLicense() ?>"><?php echo $strip->getLicense() ?></a></p>
<p><?php echo $lang->getPermanentLink() ?> : <span id="permanent"><?php echo $permanent_link ?></span></p>
</div>
</div>
</div>

View file

@ -52,6 +52,7 @@ function getStrip(link)
break;
case 'title':
if (idExist('title')) document.getElementById('title').innerHTML = '&laquo;&nbsp;' + value + '&nbsp;&raquo;';
document.title = value;
break;
case 'description':
if (idExist('description')) document.getElementById('description').innerHTML = value;
@ -100,6 +101,9 @@ function getStrip(link)
case 'nav_forum_view':
if (idExist('nav_forum_view')) document.getElementById('nav_forum_view').href = value;
break;
case 'permanent':
if (idExist('permanent')) document.getElementById('permanent').innerHTML = value;
break;
}
}
}

View file

@ -85,6 +85,7 @@
<p id="date"><?php echo $strip->getDate() ?></p>
<p id="source"><a id="link_source" href="<?php echo $strip->getFilenameSrc() ?>"><?php echo $lang->getSource() ?></a></p>
<p id="license"><?php echo $lang->getLicence() ?> : <a id="link_license" href="<?php echo $strip->getLicense() ?>"><?php echo $strip->getLicense() ?></a></p>
<p><?php echo $lang->getPermanentLink() ?> : <span id="permanent"><?php echo $permanent_link ?></span></p>
</td>
</tr>

View file

@ -16,4 +16,5 @@
<item id="navgallery"><![CDATA[<?php echo $nav_gallery ?>]]></item>
<item id="nav_forum_post"><![CDATA[<?php echo $nav_forum_post ?>]]></item>
<item id="nav_forum_view"><![CDATA[<?php echo $nav_forum_view ?>]]></item>
<item id="permanent"><![CDATA[<?php echo $permanent_link ?>]]></item>
</root>

View file

@ -55,6 +55,7 @@ $lang = getLang($lang);
list($nav_first, $nav_last, $nav_prev, $nav_next, $nav_gallery) = getNavigation($id, $last, $lang);
$nav_forum_post = Config::getFluxbbForum().'/post.php?ttitle='.urlencode($strip->getTitle()).'&fid='.Config::getFluxbbForumId();
$nav_forum_view = Config::getFluxbbForum().'/redirect_stripit.php?ttitle='.urlencode($strip->getTitle());
$permanent_link = htmlentities(getPermanentLink($id, $lang));
// If necessary, obtain the forum data
$comments = '';