Hack BrowsePhoo (InsertPhoo) de e-corona

Lo prometido es deuda, así que les voy a explicar como instalar el hack para Jaws 0.6 r2 y r3 (no se si funcione en algua versión anterior a la revisión 2), así que ahi les va……..

Primero tenemos que instalar el plugin PhooInsert el cual pueden descargarlo de mis tiliches y lo tienen que descompactar en la carpeta de plugins/ despues tienen que abrir su editor de textos favorito y modificar lo siguiente, o si no quieren sufrir modifiquen su carpeta de gadgets/Phoo por este archivo el cual esta parchado con el hack y versión 0.6r3

Se dirigen a la carpeta gadgets/Phoo y abren el archivo PhooModel.php y al final antes del ulitmo } insertan:

<br /> / <br /> * Get a list of albums ordered by the date<br /> *<br /> * @access public<br /> * @return array A list of available albums (ordered by date) and JawsError on error<br /> */<br /> function GetAlbumsByDate ()<br /> {<br /> $sql = "SELECT [[phoo_album]].*, COUNT(phoo_image_id) AS howmany<br /> FROM [[phoo_album]] LEFT JOIN [[phoo_image_album]]<br /> ON [[phoo_album]].id = phoo_album_id<br /> GROUP BY [[phoo_album]].id<br /> ORDER BY createtime DESC";</p>
<p> $result = $GLOBALS['db']->queryAll($sql);<br /> if (!JawsError::isError($result)) {<br /> $ret = array();<br /> foreach ($result as $row) {<br /> $r["createtime"] = $GLOBALS['app']->Date->ToISO($row["createtime"]);<br /> $ret[] = $row;<br /> }<br /> return $ret;<br /> } else {<br /> return new JawsError (_t("PHOO_ERROR_ALBUMSBYDATE"), _t("PHOO_NAME"));<br /> }<br /> }<br /> 

Ahora tienen que abrir el archivo PhooAdminHTML.php y al final nuevamente (antes de }) agregan

<br /> function BrowsePhoo(){<br /> $model =&#038; $GLOBALS['app']->LoadGadget('Phoo', 'AdminModel');<br /> $t =&#038; new JawsTemplate("gadgets/Phoo/templates/");<br /> $t->Load ("BrowsePhoo.html");<br /> $t->SetBlock("phoo");</p>
<p> $albums = $model->GetAlbumsByDate();<br /> if (!JawsError::IsError ($albums)) {<br /> $t->SetBlock ("phoo/photos");</p>
<p> $datecombo =&#038; Piwi::CreateWidget('Combo', 'date');<br /> $datecombo->SetStyle("width: 200px;");<br /> $datecombo->AddOption ("","");<br /> $mindate = $model->GetMinDate();<br /> if ($mindate) {<br /> $maxdate = $model->GetMaxDate();<br /> $mindateArray = explode('/', $mindate);<br /> $maxdateArray = explode('/', $maxdate);<br /> for ($year = $maxdateArray[2]; $year >= $mindateArray[2]; $year--) {<br /> if ($maxdateArray[2] == $mindateArray[2]) {<br /> $mstart = $maxdateArray[0];<br /> $mend = $mindateArray[0];<br /> } else {<br /> if ($year == $maxdateArray[2])<br /> $mstart = $maxdateArray[0];<br /> else<br /> $mstart = 12;<br /> if ($year == $mindateArray[2])<br /> $mend = $mindateArray[0];<br /> else<br /> $mend = 1;<br /> }<br /> for ($m = $mstart; $m >= $mend; $m--) {<br /> $month = $GLOBALS['app']->Date->MonthString ($m);<br /> $datecombo->AddOption ("{$month} {$year}","{$m}/{$year}");<br /> }<br /> }<br /> }</p>
<p> $t->SetVariable("date",_t("GLOBAL_DATE"));<br /> $datecombo->SetDefault (isset($_REQUEST["date"]) ? $_REQUEST["date"] : null);<br /> $datecombo->AddEvent (new JSEvent (ON_CHANGE, "selectAllAlbums(); this.form.submit();"));<br /> $t->SetVariable("date_combo",$datecombo->Get());</p>
<p> $albumcombo =&#038; Piwi::CreateWidget('Combo', 'album[]');<br /> $albumcombo->SetID('albums');<br /> $albumcombo->SetStyle('width: 200px;');<br /> $albumcombo->SetSize(12);<br /> $albumcombo->SetMultiple(true);<br /> foreach ($albums as $a) {<br /> // FIXME: Ugly hack to add title to albumcombo<br /> $o =&#038; Piwi::CreateWidget('ComboOption', $a['id'], $GLOBALS['app']->XSS->filter($a['name']));<br /> $o->SetTitle(_t('PHOO_NUM_PHOTOS_ALBUM', $a['howmany']) . ' / '.<br /> _t('PHOO_ALBUM_CREATION_DATE', $GLOBALS['app']->Date->Format($a['createtime'])));<br /> $albumcombo->_options[$a['id']] = $o;<br /> }</p>
<p> $albumcombo->SetDefault (isset ($_REQUEST["album"]) ? $_REQUEST["album"] : "");<br /> $albumcombo->AddEvent (new JSEvent (ON_CHANGE, "this.form.submit();"));<br /> $t->SetVariable("albums",_t("PHOO_ALBUMS"));<br /> $script = '';<br /> if (empty($_REQUEST["album"])) {<br /> $script .= "";<br /> }<br /> $t->SetVariable("albums_combo",$albumcombo->Get().$script);</p>
<p> // Ugly hack to convert $_REQUEST["album"] to array...<br /> if ((!empty($_REQUEST["album"])) &#038;&#038; (!is_array($_REQUEST["album"]))) {<br /> $aux = $_REQUEST["album"];<br /> $_REQUEST["album"] = array();<br /> $_REQUEST["album"][] = $aux;<br /> }</p>
<p> // Show albums<br /> if ((!empty($_REQUEST["album"])) &#038;&#038; (is_array($_REQUEST["album"]))) {<br /> foreach ($_REQUEST["album"] as $albumId) {<br /> if (!empty($_REQUEST["date"])) {<br /> $aux = explode("/",$_REQUEST["date"]);<br /> $month = $aux[0];<br /> $year = $aux[1];<br /> } else {<br /> $month = null;<br /> $year = null;<br /> }<br /> $album = $model->GetAlbum($albumId, $month, $year);<br /> if (!JawsError::IsError ($album)) {<br /> if ((isset ($album["images"]) &#038;&#038;<br /> !is_array($album["images"])) &#038;&#038;<br /> (count($album["images"]) == 0) &#038;&#038;<br /> (checkdate ($month, 1, $year))) {<br /> continue;<br /> }<br /> $t->SetBlock ("phoo/photos/albums");<br /> $t->SetVariable ("title", $album["name"]);<br /> $t->SetVariable ("description",$this->ParseText($album["description"]));<br /> $t->SetVariable ("createtime", $GLOBALS['app']->Date->Format($album["createtime"]));</p>
<p> if ((isset ($album["images"]) &#038;&#038; is_array($album["images"])) &#038;&#038; (count($album["images"]) > 0)) {<br /> // Show photos<br /> foreach ($album["images"] as $img) {<br /> $t->SetBlock ("phoo/photos/albums/item");<br /> $t->SetVariable ("url","admin.php?gadget=Phoo&amp;action=BrowsePhoo&amp;image={$img["id"]}&amp;album={$albumId}");<br /> $t->SetVariable ("image", $img["image"]);<br /> $t->SetVariable ("name",$img["name"]);<br /> $t->SetVariable ("album",$img["albumid"]);</p>
<p> if ($img["published"] == 'N') {<br /> $t->SetVariable ("notpublished", _t("PHOO_NOT_PUBLISHED"));<br /> } else {<br /> $t->SetVariable ("notpublished","");<br /> }<br /> $t->ParseBlock ("phoo/photos/albums/item");<br /> }<br /> }<br /> $t->ParseBlock ("phoo/photos/albums");<br /> } else {<br /> $GLOBALS["session"]->PushLastResponse (_t("PHOO_INEXISTENT_ALBUM"), RESPONSE_ERROR);<br /> }<br /> }<br /> }</p>
<p> //si ya se selecciono una imagen:</p>
<p> if (isset($_GET["image"]) &#038;&#038; isset($_GET["album"])){<br /> //desplegar la foto seleccionada y el form de finalizacion.</p>
<p> $image = $model->GetImage($_REQUEST["image"], $_GET["album"]);</p>
<p> if (JawsError::IsError ($image)) {<br /> $GLOBALS["session"]->PushLastResponse ($image->GetMessage(), RESPONSE_ERROR);<br /> JawsHeader::Location ("admin.php?gadget=Phoo&#038;action=Admin");<br /> }</p>
<p> $id = $image["id"];<br /> $filename = $image["original"];<br /> $title = $image["title"];<br /> $desc = $image["description"];<br /> $published = $image["published"];</p>
<p> $t->SetBlock ("phoo/photos/selected");<br /> $t->SetVariable ("t_title",_t("PHOO_PHOTO_TITLE"));<br /> $t->SetVariable ("t_css",_t("PHOO_CSS"));<br /> $t->SetVariable ("t_size",_t("PHOO_SIZE"));<br /> $t->SetVariable ("t_thumb",_t("PHOO_THUMBS"));<br /> $t->SetVariable ("t_medium",_t("PHOO_MEDIUM")); </p>
<p> $t->SetVariable ("s_image", JawsImage::GetThumbPath($filename));<br /> $t->SetVariable ("s_name", $title);<br /> $t->SetVariable ("s_picture",$id);<br /> $t->SetVariable ("s_album",$_GET["album"]);<br /> $t->ParseBlock ("phoo/photos/selected");<br /> }</p>
<p> $t->ParseBlock("phoo/photos");<br /> } else {<br /> $t->SetBlock ("phoo/noalbums");<br /> $t->SetVariable ("message", _t("PHOO_EMPTY_ALBUMSET"));<br /> $t->SetVariable("form",$form->Get());<br /> $t->ParseBlock ("phoo/noalbums");<br /> }</p>
<p> $t->ParseBlock("phoo");<br /> return $t->Get();<br /> }<br /> 

Hacen lo mismo en el archivo PhooActions.php y busquen donde diga StandaloneAdminAction y abajito escriben

<br /> $actions['BrowsePhoo'] = array('StandaloneAdminAction');<br /> 

Y en la carpeta de idioma agregan tanto en español como en ingles lo siguiente:

languages/es/Phoo.php

</p>
<p>define ("_ES_PHOO_CSS", "Clase CSS");<br /> define ("_ES_PHOO_MEDIUM", "Mediana");</p>
<p>

languages/en/Phoo.php

<br /> define ("_EN_PHOO_CSS", "CSS Class");<br /> define ("_EN_PHOO_MEDIUM", "Medium");<br /> 

Y listo!!.., solo falta que en el administrador de componentes activen el PhooInsert que se utilice en el modulo de Blog.

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *