mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
Add notifications to feed publications
This commit is contained in:
@@ -141,7 +141,7 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
|
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':id' => $this->id));
|
$stmt->execute(array(':id' => $this->id));
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if (!$row)
|
if (!$row)
|
||||||
@@ -156,13 +156,13 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
$this->created_on = new DateTime($row['created_on']);
|
$this->created_on = new DateTime($row['created_on']);
|
||||||
|
|
||||||
$datas = array(
|
$datas = array(
|
||||||
'title' => $this->title
|
'title' => $this->title
|
||||||
, 'subtitle' => $this->subtitle
|
, 'subtitle' => $this->subtitle
|
||||||
, 'author_name' => $this->author_name
|
, 'author_name' => $this->author_name
|
||||||
, 'author_email' => $this->author_email
|
, 'author_email' => $this->author_email
|
||||||
, 'publisher_id' => $this->publisher_id
|
, 'publisher_id' => $this->publisher_id
|
||||||
, 'updated_on' => $this->updated_on
|
, 'updated_on' => $this->updated_on
|
||||||
, 'created_on' => $this->created_on
|
, 'created_on' => $this->created_on
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->set_data_to_cache($datas);
|
$this->set_data_to_cache($datas);
|
||||||
@@ -175,9 +175,9 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
$registry = registry::get_instance();
|
$registry = registry::get_instance();
|
||||||
|
|
||||||
$href = sprintf(
|
$href = sprintf(
|
||||||
'%slightbox/feeds/entry/%d/'
|
'%slightbox/feeds/entry/%d/'
|
||||||
, $registry->get('GV_ServerName')
|
, $registry->get('GV_ServerName')
|
||||||
, $this->get_id()
|
, $this->get_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
return new Feed_Link($href, $this->get_title(), 'text/html');
|
return new Feed_Link($href, $this->get_title(), 'text/html');
|
||||||
@@ -231,10 +231,10 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
if ($title === '')
|
if ($title === '')
|
||||||
throw new Exception_InvalidArgument();
|
throw new Exception_InvalidArgument();
|
||||||
|
|
||||||
$sql = 'UPDATE feed_entries
|
$sql = 'UPDATE feed_entries
|
||||||
SET title = :title, updated_on = NOW() WHERE id = :entry_id';
|
SET title = :title, updated_on = NOW() WHERE id = :entry_id';
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':title' => $title, ':entry_id' => $this->get_id()));
|
$stmt->execute(array(':title' => $title, ':entry_id' => $this->get_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
$this->delete_data_from_cache();
|
$this->delete_data_from_cache();
|
||||||
@@ -251,11 +251,11 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
{
|
{
|
||||||
$subtitle = strip_tags($subtitle);
|
$subtitle = strip_tags($subtitle);
|
||||||
|
|
||||||
$sql = 'UPDATE feed_entries
|
$sql = 'UPDATE feed_entries
|
||||||
SET description = :subtitle, updated_on = NOW()
|
SET description = :subtitle, updated_on = NOW()
|
||||||
WHERE id = :entry_id';
|
WHERE id = :entry_id';
|
||||||
$params = array(':subtitle' => $subtitle, ':entry_id' => $this->get_id());
|
$params = array(':subtitle' => $subtitle, ':entry_id' => $this->get_id());
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
$this->subtitle = $subtitle;
|
$this->subtitle = $subtitle;
|
||||||
@@ -271,14 +271,14 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
*/
|
*/
|
||||||
public function set_author_name($author_name)
|
public function set_author_name($author_name)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE feed_entries
|
$sql = 'UPDATE feed_entries
|
||||||
SET author_name = :author_name, updated_on = NOW()
|
SET author_name = :author_name, updated_on = NOW()
|
||||||
WHERE id = :entry_id';
|
WHERE id = :entry_id';
|
||||||
$params = array(
|
$params = array(
|
||||||
':author_name' => $author_name,
|
':author_name' => $author_name,
|
||||||
':entry_id' => $this->get_id()
|
':entry_id' => $this->get_id()
|
||||||
);
|
);
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
$this->author_name = $author_name;
|
$this->author_name = $author_name;
|
||||||
@@ -294,14 +294,14 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
*/
|
*/
|
||||||
public function set_author_email($author_email)
|
public function set_author_email($author_email)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE feed_entries
|
$sql = 'UPDATE feed_entries
|
||||||
SET author_email = :author_email, updated_on = NOW()
|
SET author_email = :author_email, updated_on = NOW()
|
||||||
WHERE id = :entry_id';
|
WHERE id = :entry_id';
|
||||||
$params = array(
|
$params = array(
|
||||||
':author_email' => $author_email,
|
':author_email' => $author_email,
|
||||||
':entry_id' => $this->get_id()
|
':entry_id' => $this->get_id()
|
||||||
);
|
);
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
$this->author_email = $author_email;
|
$this->author_email = $author_email;
|
||||||
@@ -312,14 +312,14 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
|
|
||||||
public function set_created_on(DateTime $datetime)
|
public function set_created_on(DateTime $datetime)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE feed_entries
|
$sql = 'UPDATE feed_entries
|
||||||
SET created_on = :created_on
|
SET created_on = :created_on
|
||||||
WHERE id = :entry_id';
|
WHERE id = :entry_id';
|
||||||
$params = array(
|
$params = array(
|
||||||
':created_on' => $datetime->format(DATE_ISO8601),
|
':created_on' => $datetime->format(DATE_ISO8601),
|
||||||
':entry_id' => $this->get_id()
|
':entry_id' => $this->get_id()
|
||||||
);
|
);
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
$this->created_on = $datetime;
|
$this->created_on = $datetime;
|
||||||
@@ -330,14 +330,14 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
|
|
||||||
public function set_updated_on(DateTime $datetime)
|
public function set_updated_on(DateTime $datetime)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE feed_entries
|
$sql = 'UPDATE feed_entries
|
||||||
SET updated_on = :updated_on
|
SET updated_on = :updated_on
|
||||||
WHERE id = :entry_id';
|
WHERE id = :entry_id';
|
||||||
$params = array(
|
$params = array(
|
||||||
':updated_on' => $datetime->format(DATE_ISO8601),
|
':updated_on' => $datetime->format(DATE_ISO8601),
|
||||||
':entry_id' => $this->get_id()
|
':entry_id' => $this->get_id()
|
||||||
);
|
);
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
$this->updated_on = $datetime;
|
$this->updated_on = $datetime;
|
||||||
@@ -411,10 +411,9 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
public function get_content()
|
public function get_content()
|
||||||
{
|
{
|
||||||
if ($this->items)
|
if ($this->items)
|
||||||
|
|
||||||
return $this->items;
|
return $this->items;
|
||||||
|
|
||||||
$rs = $this->retrieve_elements();
|
$rs = $this->retrieve_elements();
|
||||||
$items = array();
|
$items = array();
|
||||||
foreach ($rs as $item_id)
|
foreach ($rs as $item_id)
|
||||||
{
|
{
|
||||||
@@ -444,11 +443,11 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT id FROM feed_entry_elements
|
$sql = 'SELECT id FROM feed_entry_elements
|
||||||
WHERE entry_id = :entry_id ORDER BY ord ASC';
|
WHERE entry_id = :entry_id ORDER BY ord ASC';
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':entry_id' => $this->get_id()));
|
$stmt->execute(array(':entry_id' => $this->get_id()));
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$items = array();
|
$items = array();
|
||||||
@@ -474,7 +473,7 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
$content->delete();
|
$content->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'DELETE FROM feed_entries WHERE id = :entry_id';
|
$sql = 'DELETE FROM feed_entries WHERE id = :entry_id';
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':entry_id' => $this->get_id()));
|
$stmt->execute(array(':entry_id' => $this->get_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -515,12 +514,12 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
, :description, NOW(), NOW(), :author_name, :author_email)';
|
, :description, NOW(), NOW(), :author_name, :author_email)';
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
':feed_id' => $feed->get_id()
|
':feed_id' => $feed->get_id()
|
||||||
, ':publisher_id' => $publisher->get_id()
|
, ':publisher_id' => $publisher->get_id()
|
||||||
, ':title' => trim($title)
|
, ':title' => trim($title)
|
||||||
, ':description' => trim($subtitle)
|
, ':description' => trim($subtitle)
|
||||||
, ':author_name' => trim($author_name)
|
, ':author_name' => trim($author_name)
|
||||||
, ':author_email' => trim($author_mail)
|
, ':author_email' => trim($author_mail)
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
@@ -531,7 +530,12 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
|
|
||||||
$feed->delete_data_from_cache();
|
$feed->delete_data_from_cache();
|
||||||
|
|
||||||
return new self($appbox, $feed, $entry_id);
|
$entry = new self($appbox, $feed, $entry_id);
|
||||||
|
|
||||||
|
$eventsmanager = \eventsmanager_broker::getInstance($appbox);
|
||||||
|
$eventsmanager->trigger('__FEED_ENTRY_CREATE__', array('entry_id' => $entry_id), $entry);
|
||||||
|
|
||||||
|
return $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -542,10 +546,10 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
|
|||||||
*/
|
*/
|
||||||
public static function load_from_id(appbox $appbox, $id)
|
public static function load_from_id(appbox $appbox, $id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT feed_id FROM feed_entries WHERE id = :entry_id';
|
$sql = 'SELECT feed_id FROM feed_entries WHERE id = :entry_id';
|
||||||
$stmt = $appbox->get_connection()->prepare($sql);
|
$stmt = $appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':entry_id' => $id));
|
$stmt->execute(array(':entry_id' => $id));
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if (!$row)
|
if (!$row)
|
||||||
|
@@ -21,7 +21,7 @@ class eventsmanager_broker
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return eventsmanager
|
* @return \eventsmanager_broker
|
||||||
*/
|
*/
|
||||||
public static function getInstance(appbox &$appbox)
|
public static function getInstance(appbox &$appbox)
|
||||||
{
|
{
|
||||||
|
208
lib/classes/eventsmanager/notify/feed.class.php
Normal file
208
lib/classes/eventsmanager/notify/feed.class.php
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2010 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $events = array('__FEED_ENTRY_CREATE__');
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function icon_url()
|
||||||
|
{
|
||||||
|
return '/skins/icons/rss16.png';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param string $event
|
||||||
|
* @param Array $params
|
||||||
|
* @param mixed content $object
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function fire($event, $params, &$entry)
|
||||||
|
{
|
||||||
|
$params = array(
|
||||||
|
'entry_id' => $entry->get_id()
|
||||||
|
);
|
||||||
|
|
||||||
|
$dom_xml = new DOMDocument('1.0', 'UTF-8');
|
||||||
|
|
||||||
|
$dom_xml->preserveWhiteSpace = false;
|
||||||
|
$dom_xml->formatOutput = true;
|
||||||
|
|
||||||
|
$root = $dom_xml->createElement('datas');
|
||||||
|
|
||||||
|
$entry_id = $dom_xml->createElement('entry_id');
|
||||||
|
|
||||||
|
$entry_id->appendChild($dom_xml->createTextNode($params['entry_id']));
|
||||||
|
|
||||||
|
$root->appendChild($entry_id);
|
||||||
|
|
||||||
|
$dom_xml->appendChild($root);
|
||||||
|
|
||||||
|
$datas = $dom_xml->saveXml();
|
||||||
|
|
||||||
|
$Query = new \User_Query($this->appbox);
|
||||||
|
|
||||||
|
$Query->include_phantoms(true)->include_invite(false)->include_templates(false);
|
||||||
|
|
||||||
|
if ($entry->get_feed()->get_collection())
|
||||||
|
{
|
||||||
|
$Query->on_base_ids(array($entry->get_feed()->get_collection()->get_base_id()));
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = 0;
|
||||||
|
$perLoop = 100;
|
||||||
|
|
||||||
|
$from = array(
|
||||||
|
'email' => $entry->get_author_email(),
|
||||||
|
'name' => $entry->get_author_name()
|
||||||
|
);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$results = $Query->limit($start, $perLoop)->execute()->get_results();
|
||||||
|
|
||||||
|
foreach ($results as $user_to_notif)
|
||||||
|
{
|
||||||
|
/* @var $user_to_notif \User_Adapter */
|
||||||
|
$mailed = false;
|
||||||
|
|
||||||
|
$send_notif = ($this->get_prefs(__CLASS__, $user_to_notif->get_id()) != '0');
|
||||||
|
if ($send_notif)
|
||||||
|
{
|
||||||
|
$email = array(
|
||||||
|
'email' => $user_to_notif->get_email(),
|
||||||
|
'name' => $user_to_notif->get_display_name()
|
||||||
|
);
|
||||||
|
|
||||||
|
$token = \random::getUrlToken(
|
||||||
|
\random::TYPE_FEED_ENTRY
|
||||||
|
, $user_to_notif->get_id()
|
||||||
|
, null
|
||||||
|
, $entry->get_id()
|
||||||
|
);
|
||||||
|
|
||||||
|
$url = $this->appbox->get_registry()->get('GV_ServerName') . 'lightbox/index.php?LOG=' . $token;
|
||||||
|
|
||||||
|
if (self::mail($email, $from, $url, $entry))
|
||||||
|
$mailed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->broker->notify($user_to_notif->get_id(), __CLASS__, $datas, $mailed);
|
||||||
|
}
|
||||||
|
$start += $perLoop;
|
||||||
|
}
|
||||||
|
while (count($results) > 0);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param Array $datas
|
||||||
|
* @param boolean $unread
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
public function datas($datas, $unread)
|
||||||
|
{
|
||||||
|
$sx = simplexml_load_string($datas);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$entry = \Feed_Entry_Adapter::load_from_id($this->appbox, (int) $sx->entry_id);
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = array(
|
||||||
|
'text' => sprintf(
|
||||||
|
_('%1$s has published %2$s')
|
||||||
|
, $entry->get_author_name()
|
||||||
|
, '<a href="/lightbox/feeds/entry/' . $entry->get_id() . '/" target="_blank">' . $entry->get_title() . '</a>'
|
||||||
|
)
|
||||||
|
, 'class' => ($unread == 1 ? 'reload_baskets' : '')
|
||||||
|
);
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_name()
|
||||||
|
{
|
||||||
|
return _('Feeds');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_description()
|
||||||
|
{
|
||||||
|
return _('Recevoir des notifications lorsqu\'on me push quelque chose');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function is_available()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param Array $to
|
||||||
|
* @param Array $from
|
||||||
|
* @param string $message
|
||||||
|
* @param string $url
|
||||||
|
* @param boolean $accuse
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function mail($to, $from, $url, \Feed_Entry_Adapter $entry)
|
||||||
|
{
|
||||||
|
$subject = sprintf(_('Nouvelle publication : %s'), $entry->get_title());
|
||||||
|
|
||||||
|
$body = "<div>"
|
||||||
|
. sprintf('%s vient de publier %s', $entry->get_author_name(), $entry->get_title())
|
||||||
|
. _('Connectez vous a l\'adresse suivante pour la consulter')
|
||||||
|
. "</div>\n";
|
||||||
|
|
||||||
|
$body .= '<div><a href="' . $url . '">' . $url . "</a></div>\n";
|
||||||
|
|
||||||
|
$body .= " <br/> ";
|
||||||
|
|
||||||
|
$body .= "<br/>\n<br/>\n<br/>\n"
|
||||||
|
. _('push::atention: ce lien est unique et son contenu confidentiel, ne divulguez pas');
|
||||||
|
|
||||||
|
return mail::send_mail($subject, $body, $to, $from, array());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -72,11 +72,10 @@ class gatekeeper
|
|||||||
function check_directory()
|
function check_directory()
|
||||||
{
|
{
|
||||||
$request = http_request::getInstance();
|
$request = http_request::getInstance();
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
|
|
||||||
if (http_request::is_command_line())
|
if (http_request::is_command_line())
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (isset($_SERVER['PHP_SELF']) && trim($_SERVER['PHP_SELF']))
|
if (isset($_SERVER['PHP_SELF']) && trim($_SERVER['PHP_SELF']))
|
||||||
@@ -100,7 +99,7 @@ class gatekeeper
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$cookie = Session_Handler::get_cookie('persistent');
|
$cookie = Session_Handler::get_cookie('persistent');
|
||||||
$auth = new Session_Authentication_PersistentCookie($appbox, $cookie);
|
$auth = new Session_Authentication_PersistentCookie($appbox, $cookie);
|
||||||
$session->restore($auth->get_user(), $auth->get_ses_id());
|
$session->restore($auth->get_user(), $auth->get_ses_id());
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
@@ -120,9 +119,8 @@ class gatekeeper
|
|||||||
break;
|
break;
|
||||||
case 'thesaurus2':
|
case 'thesaurus2':
|
||||||
if ($this->_PHP_SELF == '/thesaurus2/xmlhttp/getterm.x.php'
|
if ($this->_PHP_SELF == '/thesaurus2/xmlhttp/getterm.x.php'
|
||||||
|| $this->_PHP_SELF == '/thesaurus2/xmlhttp/searchcandidate.x.php'
|
|| $this->_PHP_SELF == '/thesaurus2/xmlhttp/searchcandidate.x.php'
|
||||||
|| $this->_PHP_SELF == '/thesaurus2/xmlhttp/getsy.x.php')
|
|| $this->_PHP_SELF == '/thesaurus2/xmlhttp/getsy.x.php')
|
||||||
|
|
||||||
return;
|
return;
|
||||||
phrasea::redirect('/login/?redirect=/thesaurus2');
|
phrasea::redirect('/login/?redirect=/thesaurus2');
|
||||||
break;
|
break;
|
||||||
@@ -131,7 +129,6 @@ class gatekeeper
|
|||||||
break;
|
break;
|
||||||
case 'admin':
|
case 'admin':
|
||||||
if ($this->_script_name === 'runscheduler.php')
|
if ($this->_script_name === 'runscheduler.php')
|
||||||
|
|
||||||
return;
|
return;
|
||||||
phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']);
|
phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']);
|
||||||
break;
|
break;
|
||||||
@@ -151,7 +148,6 @@ class gatekeeper
|
|||||||
return;
|
return;
|
||||||
case 'setup':
|
case 'setup':
|
||||||
if ($appbox->upgradeavailable())
|
if ($appbox->upgradeavailable())
|
||||||
|
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
phrasea::redirect('/login/');
|
phrasea::redirect('/login/');
|
||||||
@@ -230,7 +226,7 @@ class gatekeeper
|
|||||||
*/
|
*/
|
||||||
protected function give_guest_access()
|
protected function give_guest_access()
|
||||||
{
|
{
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$request = http_request::getInstance();
|
$request = http_request::getInstance();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
|
|
||||||
@@ -246,7 +242,7 @@ class gatekeeper
|
|||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$url = '/login/?redirect=' . $parm['redirect']
|
$url = '/login/?redirect=' . $parm['redirect']
|
||||||
. '&error=' . urlencode($e->getMessage());
|
. '&error=' . urlencode($e->getMessage());
|
||||||
phrasea::redirect($url);
|
phrasea::redirect($url);
|
||||||
}
|
}
|
||||||
phrasea::redirect('/' . $this->_directory . '/index.php');
|
phrasea::redirect('/' . $this->_directory . '/index.php');
|
||||||
@@ -262,13 +258,12 @@ class gatekeeper
|
|||||||
*/
|
*/
|
||||||
protected function token_access()
|
protected function token_access()
|
||||||
{
|
{
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$request = new http_request();
|
$request = new http_request();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
$parm = $request->get_parms('LOG');
|
$parm = $request->get_parms('LOG');
|
||||||
|
|
||||||
if (is_null($parm["LOG"]))
|
if (is_null($parm["LOG"]))
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -287,7 +282,19 @@ class gatekeeper
|
|||||||
{
|
{
|
||||||
$datas = random::helloToken($parm['LOG']);
|
$datas = random::helloToken($parm['LOG']);
|
||||||
|
|
||||||
return phrasea::redirect("/lightbox/validate/" . $datas['datas'] . "/");
|
switch ($datas['type'])
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return $this;
|
||||||
|
break;
|
||||||
|
case \random::TYPE_FEED_ENTRY:
|
||||||
|
return phrasea::redirect("/lightbox/feeds/entry/" . $datas['datas'] . "/");
|
||||||
|
break;
|
||||||
|
case \random::TYPE_VALIDATE:
|
||||||
|
case \random::TYPE_VIEW:
|
||||||
|
return phrasea::redirect("/lightbox/validate/" . $datas['datas'] . "/");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception_NotFound $e)
|
catch (Exception_NotFound $e)
|
||||||
{
|
{
|
||||||
@@ -305,7 +312,7 @@ class gatekeeper
|
|||||||
*/
|
*/
|
||||||
public function require_session()
|
public function require_session()
|
||||||
{
|
{
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
if ($session->is_authenticated())
|
if ($session->is_authenticated())
|
||||||
{
|
{
|
||||||
|
@@ -144,7 +144,7 @@ class mail
|
|||||||
public static function mail_confirm_registered($email)
|
public static function mail_confirm_registered($email)
|
||||||
{
|
{
|
||||||
$registry = \registry::get_instance();
|
$registry = \registry::get_instance();
|
||||||
|
|
||||||
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
||||||
|
|
||||||
$body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n";
|
$body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n";
|
||||||
|
@@ -11,18 +11,28 @@
|
|||||||
|
|
||||||
class random
|
class random
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const NUMBERS = "0123456789";
|
|
||||||
|
const NUMBERS = "0123456789";
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
const LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const LETTERS_AND_NUMBERS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
const LETTERS_AND_NUMBERS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
const TYPE_FEED_ENTRY = 'FEED_ENTRY';
|
||||||
|
const TYPE_PASSWORD = 'password';
|
||||||
|
const TYPE_DOWNLOAD = 'download';
|
||||||
|
const TYPE_MAIL_DOWNLOAD = 'mail-download';
|
||||||
|
const TYPE_EMAIL = 'email';
|
||||||
|
const TYPE_VIEW = 'view';
|
||||||
|
const TYPE_VALIDATE = 'validate';
|
||||||
|
const TYPE_RSS = 'rss';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -34,15 +44,15 @@ class random
|
|||||||
{
|
{
|
||||||
$conn = connection::getPDOConnection();
|
$conn = connection::getPDOConnection();
|
||||||
|
|
||||||
$date = new DateTime();
|
$date = new DateTime();
|
||||||
$date = phraseadate::format_mysql($date);
|
$date = phraseadate::format_mysql($date);
|
||||||
$registry = registry::get_instance();
|
$registry = registry::get_instance();
|
||||||
|
|
||||||
$sql = 'SELECT * FROM tokens WHERE expire_on < :date
|
$sql = 'SELECT * FROM tokens WHERE expire_on < :date
|
||||||
AND datas IS NOT NULL AND (type="download" OR type="email")';
|
AND datas IS NOT NULL AND (type="download" OR type="email")';
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
$stmt->execute(array(':date' => $date));
|
$stmt->execute(array(':date' => $date));
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
foreach ($rs as $row)
|
foreach ($rs as $row)
|
||||||
{
|
{
|
||||||
@@ -57,7 +67,7 @@ class random
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'DELETE FROM tokens WHERE expire_on < :date and (type="download" OR type="email")';
|
$sql = 'DELETE FROM tokens WHERE expire_on < :date and (type="download" OR type="email")';
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
$stmt->execute(array(':date' => $date));
|
$stmt->execute(array(':date' => $date));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -85,8 +95,8 @@ class random
|
|||||||
|
|
||||||
$password = "";
|
$password = "";
|
||||||
if (!in_array($possible, array(self::LETTERS_AND_NUMBERS, self::LETTERS, self::NUMBERS)))
|
if (!in_array($possible, array(self::LETTERS_AND_NUMBERS, self::LETTERS, self::NUMBERS)))
|
||||||
$possible = self::LETTERS_AND_NUMBERS;
|
$possible = self::LETTERS_AND_NUMBERS;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$possible_length = strlen($possible);
|
$possible_length = strlen($possible);
|
||||||
while ($i < $length)
|
while ($i < $length)
|
||||||
{
|
{
|
||||||
@@ -106,18 +116,32 @@ class random
|
|||||||
* @param mixed content $datas
|
* @param mixed content $datas
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function getUrlToken($type, $usr, DateTime $end_date = null, $datas='')
|
public static function getUrlToken($type, $usr, DateTime $end_date = null, $datas = '')
|
||||||
{
|
{
|
||||||
self::cleanTokens();
|
self::cleanTokens();
|
||||||
$conn = connection::getPDOConnection();
|
$conn = connection::getPDOConnection();
|
||||||
$token = $test = false;
|
$token = $test = false;
|
||||||
|
|
||||||
if (!in_array($type, array('password', 'download', 'mail-download', 'email', 'view', 'validate', 'rss')))
|
switch ($type)
|
||||||
throw new Exception_InvalidArgument();
|
{
|
||||||
|
case self::TYPE_DOWNLOAD:
|
||||||
|
case self::TYPE_PASSWORD:
|
||||||
|
case self::TYPE_MAIL_DOWNLOAD:
|
||||||
|
case self::TYPE_EMAIL:
|
||||||
|
case self::TYPE_VALIDATE:
|
||||||
|
case self::TYPE_VIEW:
|
||||||
|
case self::TYPE_RSS:
|
||||||
|
case self::TYPE_FEED_ENTRY:
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception_InvalidArgument();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$n = 1;
|
$n = 1;
|
||||||
|
|
||||||
$sql = 'SELECT id FROM tokens WHERE value = :test ';
|
$sql = 'SELECT id FROM tokens WHERE value = :test ';
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
while ($n < 100)
|
while ($n < 100)
|
||||||
{
|
{
|
||||||
@@ -134,16 +158,16 @@ class random
|
|||||||
|
|
||||||
if ($token)
|
if ($token)
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO tokens (id, value, type, usr_id, created_on, expire_on, datas)
|
$sql = 'INSERT INTO tokens (id, value, type, usr_id, created_on, expire_on, datas)
|
||||||
VALUES (null, :token, :type, :usr, NOW(), :end_date, :datas)';
|
VALUES (null, :token, :type, :usr, NOW(), :end_date, :datas)';
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
':token' => $token
|
':token' => $token
|
||||||
, ':type' => $type
|
, ':type' => $type
|
||||||
, ':usr' => ($usr ? $usr : '-1')
|
, ':usr' => ($usr ? $usr : '-1')
|
||||||
, ':end_date' => ($end_date instanceof DateTime ? phraseadate::format_mysql($end_date) : null)
|
, ':end_date' => ($end_date instanceof DateTime ? phraseadate::format_mysql($end_date) : null)
|
||||||
, ':datas' => ((trim($datas) != '') ? $datas : null)
|
, ':datas' => ((trim($datas) != '') ? $datas : null)
|
||||||
);
|
);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -159,7 +183,7 @@ class random
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$conn = connection::getPDOConnection();
|
$conn = connection::getPDOConnection();
|
||||||
$sql = 'DELETE FROM tokens WHERE value = :token';
|
$sql = 'DELETE FROM tokens WHERE value = :token';
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
$stmt->execute(array(':token' => $token));
|
$stmt->execute(array(':token' => $token));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
@@ -202,12 +226,12 @@ class random
|
|||||||
self::cleanTokens();
|
self::cleanTokens();
|
||||||
|
|
||||||
$conn = connection::getPDOConnection();
|
$conn = connection::getPDOConnection();
|
||||||
$sql = 'SELECT * FROM tokens
|
$sql = 'SELECT * FROM tokens
|
||||||
WHERE value = :token
|
WHERE value = :token
|
||||||
AND (expire_on > NOW() OR expire_on IS NULL)';
|
AND (expire_on > NOW() OR expire_on IS NULL)';
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
$stmt->execute(array(':token' => $token));
|
$stmt->execute(array(':token' => $token));
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if (!$row)
|
if (!$row)
|
||||||
|
@@ -3816,7 +3816,7 @@
|
|||||||
</field>
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>type</name>
|
<name>type</name>
|
||||||
<type>enum('view','validate','password','rss','email','download')</type>
|
<type>enum('FEED_ENTRY', 'view','validate','password','rss','email','download')</type>
|
||||||
<null></null>
|
<null></null>
|
||||||
<extra></extra>
|
<extra></extra>
|
||||||
<collation>ascii_bin</collation>
|
<collation>ascii_bin</collation>
|
||||||
|
@@ -261,8 +261,8 @@ function dropOnBask(event,from,destKey)
|
|||||||
var action = "",
|
var action = "",
|
||||||
from = $(from),
|
from = $(from),
|
||||||
current_opened_sstt = $(' #baskets .ui-state-active');
|
current_opened_sstt = $(' #baskets .ui-state-active');
|
||||||
|
|
||||||
|
|
||||||
if(from.hasClass("CHIM"))
|
if(from.hasClass("CHIM"))
|
||||||
action = (current_opened_sstt.hasClass('grouping')?'REG':'CHU') + "2";
|
action = (current_opened_sstt.hasClass('grouping')?'REG':'CHU') + "2";
|
||||||
else
|
else
|
||||||
@@ -426,7 +426,7 @@ function dropOnBask(event,from,destKey)
|
|||||||
p4.baskSel = [];
|
p4.baskSel = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var current_id = current_opened_sstt.length > 0 ? current_opened_sstt.attr('id').split('_').pop() : null;
|
var current_id = current_opened_sstt.length > 0 ? current_opened_sstt.attr('id').split('_').pop() : null;
|
||||||
if((act == 'MOV') || (current_id == ssttid_dest))
|
if((act == 'MOV') || (current_id == ssttid_dest))
|
||||||
{
|
{
|
||||||
@@ -816,7 +816,7 @@ function initAnswerForm(){
|
|||||||
$('#tool_navigate').empty().append(datas.navigation);
|
$('#tool_navigate').empty().append(datas.navigation);
|
||||||
|
|
||||||
$('#proposals').empty().append(datas.phrasea_props);
|
$('#proposals').empty().append(datas.phrasea_props);
|
||||||
|
|
||||||
if($.trim(datas.phrasea_props) !== '')
|
if($.trim(datas.phrasea_props) !== '')
|
||||||
{
|
{
|
||||||
$('.activeproposals').show()
|
$('.activeproposals').show()
|
||||||
@@ -1466,7 +1466,7 @@ $(document).ready(function(){
|
|||||||
$see_more = $(this).closest('.see_more');
|
$see_more = $(this).closest('.see_more');
|
||||||
$see_more.addClass('loading');
|
$see_more.addClass('loading');
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#answers .feed .entry').live('mouseover', function(){
|
$('#answers .feed .entry').live('mouseover', function(){
|
||||||
$(this).addClass('hover');
|
$(this).addClass('hover');
|
||||||
});
|
});
|
||||||
@@ -1477,17 +1477,17 @@ $(document).ready(function(){
|
|||||||
$('a.ajax_answers').live('click', function(event){
|
$('a.ajax_answers').live('click', function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
|
||||||
var append = $this.hasClass('append');
|
var append = $this.hasClass('append');
|
||||||
var no_scroll = $this.hasClass('no_scroll');
|
var no_scroll = $this.hasClass('no_scroll');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"GET",
|
type:"GET",
|
||||||
url : $this.attr('href'),
|
url : $this.attr('href'),
|
||||||
dataType: 'html',
|
dataType: 'html',
|
||||||
success : function(data){
|
success : function(data){
|
||||||
var $answers = $('#answers');
|
var $answers = $('#answers');
|
||||||
|
|
||||||
if(!append)
|
if(!append)
|
||||||
{
|
{
|
||||||
$answers.empty();
|
$answers.empty();
|
||||||
@@ -1501,7 +1501,7 @@ $(document).ready(function(){
|
|||||||
{
|
{
|
||||||
$('.see_more.loading', $answers).remove();
|
$('.see_more.loading', $answers).remove();
|
||||||
$answers.append(data);
|
$answers.append(data);
|
||||||
|
|
||||||
if(!no_scroll)
|
if(!no_scroll)
|
||||||
{
|
{
|
||||||
$answers.animate({
|
$answers.animate({
|
||||||
@@ -1512,11 +1512,11 @@ $(document).ready(function(){
|
|||||||
callback_answerselectable();
|
callback_answerselectable();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('a.subscribe_rss').live('click',function(event){
|
$('a.subscribe_rss').live('click',function(event){
|
||||||
|
|
||||||
@@ -1537,12 +1537,12 @@ $(document).ready(function(){
|
|||||||
buttons[language.fermer] = function() {
|
buttons[language.fermer] = function() {
|
||||||
$('#DIALOG').dialog('close');
|
$('#DIALOG').dialog('close');
|
||||||
};
|
};
|
||||||
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
|
||||||
var append = $this.hasClass('append');
|
var append = $this.hasClass('append');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"GET",
|
type:"GET",
|
||||||
url : $this.attr('href')+(event.renew === true ? '?renew=true' : ''),
|
url : $this.attr('href')+(event.renew === true ? '?renew=true' : ''),
|
||||||
@@ -1573,7 +1573,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1702,12 +1702,12 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#idFrameA div.IMGT').live('mousedown',function(event){
|
$('#idFrameA div.IMGT').live('mousedown',function(event){
|
||||||
evt_mdwn_obj(this, event);
|
evt_mdwn_obj(this, event);
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#idFrameA div.IMGT').live('click',function(event){
|
$('#idFrameA div.IMGT').live('click',function(event){
|
||||||
if(is_shift_key(event) || is_ctrl_key(event))
|
if(is_shift_key(event) || is_ctrl_key(event))
|
||||||
return true;
|
return true;
|
||||||
@@ -1718,22 +1718,22 @@ $(document).ready(function(){
|
|||||||
$(this).addClass('last_selected');
|
$(this).addClass('last_selected');
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#idFrameC div.CHIM').live('mousedown',function(event){
|
$('#idFrameC div.CHIM').live('mousedown',function(event){
|
||||||
baskSelection(this, event);
|
baskSelection(this, event);
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#idFrameC div.CHIM').live('click',function(event){
|
$('#idFrameC div.CHIM').live('click',function(event){
|
||||||
if(is_shift_key(event) || is_ctrl_key(event))
|
if(is_shift_key(event) || is_ctrl_key(event))
|
||||||
return true;
|
return true;
|
||||||
p4.baskSel = new Array();
|
p4.baskSel = new Array();
|
||||||
var cont = $('#idFrameC .SSTT.content:visible');
|
var cont = $('#idFrameC .SSTT.content:visible');
|
||||||
$('.CHIM.selected, .CHIM.last_selected', cont).removeClass('selected last_selected');
|
$('.CHIM.selected, .CHIM.last_selected', cont).removeClass('selected last_selected');
|
||||||
|
|
||||||
var k = $(this).attr('id').split('_').slice(2,4).join('_');
|
var k = $(this).attr('id').split('_').slice(2,4).join('_');
|
||||||
p4.baskSel.push(k);
|
p4.baskSel.push(k);
|
||||||
$(this).addClass('selected last_selected');
|
$(this).addClass('selected last_selected');
|
||||||
@@ -1942,7 +1942,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
if($('.overlay').is(':visible'))
|
if($('.overlay').is(':visible'))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if($('.ui-widget-overlay').is(':visible'))
|
if($('.ui-widget-overlay').is(':visible'))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -2139,7 +2139,7 @@ $(document).ready(function(){
|
|||||||
resizePreview();
|
resizePreview();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input.input_select_copy').live('focus', function(){
|
$('input.input_select_copy').live('focus', function(){
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
@@ -2149,7 +2149,7 @@ $(document).ready(function(){
|
|||||||
$('input.input_select_copy').live('click', function(){
|
$('input.input_select_copy').live('click', function(){
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#answers .feed .entry a.options').live('click', function(){
|
$('#answers .feed .entry a.options').live('click', function(){
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -2200,7 +2200,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2581,12 +2581,12 @@ function chgStatusThis(url)
|
|||||||
function pushThis(sstt_id, lst)
|
function pushThis(sstt_id, lst)
|
||||||
{
|
{
|
||||||
$('#MODALDL').attr('src','about:blank');
|
$('#MODALDL').attr('src','about:blank');
|
||||||
|
|
||||||
var $form = $('#push_form');
|
var $form = $('#push_form');
|
||||||
|
|
||||||
$('input[name="lst"]', $form).val(lst);
|
$('input[name="lst"]', $form).val(lst);
|
||||||
$('input[name="SSTTID"]', $form).val(sstt_id);
|
$('input[name="SSTTID"]', $form).val(sstt_id);
|
||||||
|
|
||||||
$form.submit();
|
$form.submit();
|
||||||
|
|
||||||
var w = bodySize.x - 40;
|
var w = bodySize.x - 40;
|
||||||
@@ -2636,9 +2636,9 @@ function activeIcons()
|
|||||||
{
|
{
|
||||||
$('.TOOL_print_btn').live('click', function(){
|
$('.TOOL_print_btn').live('click', function(){
|
||||||
var value="";
|
var value="";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($(this).hasClass('results_window'))
|
if($(this).hasClass('results_window'))
|
||||||
{
|
{
|
||||||
if(p4.sel.length > 0)
|
if(p4.sel.length > 0)
|
||||||
@@ -2661,7 +2661,7 @@ function activeIcons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value !== '')
|
if(value !== '')
|
||||||
{
|
{
|
||||||
printThis(value);
|
printThis(value);
|
||||||
@@ -2673,9 +2673,9 @@ function activeIcons()
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.TOOL_bridge_btn').live('click', function(){
|
$('.TOOL_bridge_btn').live('click', function(){
|
||||||
|
|
||||||
var datas = {};
|
var datas = {};
|
||||||
|
|
||||||
if($(this).hasClass('results_window'))
|
if($(this).hasClass('results_window'))
|
||||||
{
|
{
|
||||||
if(p4.sel.length > 0)
|
if(p4.sel.length > 0)
|
||||||
@@ -2698,7 +2698,7 @@ function activeIcons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(datas.ssel || datas.lst)
|
if(datas.ssel || datas.lst)
|
||||||
{
|
{
|
||||||
init_publicator(datas);
|
init_publicator(datas);
|
||||||
@@ -2708,7 +2708,7 @@ function activeIcons()
|
|||||||
alert(language.nodocselected);
|
alert(language.nodocselected);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('.TOOL_trash_btn').live('click', function(){
|
$('.TOOL_trash_btn').live('click', function(){
|
||||||
@@ -2742,7 +2742,7 @@ function activeIcons()
|
|||||||
$('.TOOL_ppen_btn').live('click', function(){
|
$('.TOOL_ppen_btn').live('click', function(){
|
||||||
var value="";
|
var value="";
|
||||||
var type = "";
|
var type = "";
|
||||||
|
|
||||||
if($(this).hasClass('results_window'))
|
if($(this).hasClass('results_window'))
|
||||||
{
|
{
|
||||||
if(p4.sel.length > 0)
|
if(p4.sel.length > 0)
|
||||||
@@ -2785,11 +2785,11 @@ function activeIcons()
|
|||||||
alert(language.nodocselected);
|
alert(language.nodocselected);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.TOOL_publish_btn').live('click', function(){
|
$('.TOOL_publish_btn').live('click', function(){
|
||||||
var value="";
|
var value="";
|
||||||
var type = "";
|
var type = "";
|
||||||
|
|
||||||
if($(this).hasClass('results_window'))
|
if($(this).hasClass('results_window'))
|
||||||
{
|
{
|
||||||
if(p4.sel.length > 0)
|
if(p4.sel.length > 0)
|
||||||
@@ -2822,7 +2822,7 @@ function activeIcons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value !== '')
|
if(value !== '')
|
||||||
{
|
{
|
||||||
feedThis(type,value);
|
feedThis(type,value);
|
||||||
@@ -2832,7 +2832,7 @@ function activeIcons()
|
|||||||
alert(language.nodocselected);
|
alert(language.nodocselected);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function feedThis(type,value)
|
function feedThis(type,value)
|
||||||
{
|
{
|
||||||
var $feed_box = $('#modal_feed');
|
var $feed_box = $('#modal_feed');
|
||||||
@@ -2841,7 +2841,7 @@ function activeIcons()
|
|||||||
ssel:'',
|
ssel:'',
|
||||||
act:''
|
act:''
|
||||||
};
|
};
|
||||||
|
|
||||||
switch(type){
|
switch(type){
|
||||||
case "IMGT":
|
case "IMGT":
|
||||||
case "CHIM":
|
case "CHIM":
|
||||||
@@ -2856,7 +2856,7 @@ function activeIcons()
|
|||||||
$.post("/prod/feeds/requestavailable/"
|
$.post("/prod/feeds/requestavailable/"
|
||||||
, options
|
, options
|
||||||
, function(data){
|
, function(data){
|
||||||
|
|
||||||
return set_up_feed_box(data);
|
return set_up_feed_box(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2865,7 +2865,7 @@ function activeIcons()
|
|||||||
|
|
||||||
$('.TOOL_chgcoll_btn').live('click', function(){
|
$('.TOOL_chgcoll_btn').live('click', function(){
|
||||||
var value = {};
|
var value = {};
|
||||||
|
|
||||||
if($(this).hasClass('results_window'))
|
if($(this).hasClass('results_window'))
|
||||||
{
|
{
|
||||||
if(p4.sel.length > 0)
|
if(p4.sel.length > 0)
|
||||||
@@ -2904,8 +2904,8 @@ function activeIcons()
|
|||||||
|
|
||||||
$('.TOOL_chgstatus_btn').live('click', function(){
|
$('.TOOL_chgstatus_btn').live('click', function(){
|
||||||
var value="";
|
var value="";
|
||||||
|
|
||||||
|
|
||||||
if($(this).hasClass('results_window'))
|
if($(this).hasClass('results_window'))
|
||||||
{
|
{
|
||||||
if(p4.sel.length > 0)
|
if(p4.sel.length > 0)
|
||||||
@@ -2928,7 +2928,7 @@ function activeIcons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value !== '')
|
if(value !== '')
|
||||||
{
|
{
|
||||||
chgStatusThis(value);
|
chgStatusThis(value);
|
||||||
@@ -2975,8 +2975,8 @@ function activeIcons()
|
|||||||
|
|
||||||
$('.TOOL_imgtools_btn').live('click', function(){
|
$('.TOOL_imgtools_btn').live('click', function(){
|
||||||
var value="";
|
var value="";
|
||||||
|
|
||||||
|
|
||||||
if($(this).hasClass('results_window'))
|
if($(this).hasClass('results_window'))
|
||||||
{
|
{
|
||||||
if(p4.sel.length > 0)
|
if(p4.sel.length > 0)
|
||||||
@@ -2999,7 +2999,7 @@ function activeIcons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value !== '')
|
if(value !== '')
|
||||||
{
|
{
|
||||||
toolThis(value);
|
toolThis(value);
|
||||||
@@ -3013,7 +3013,7 @@ function activeIcons()
|
|||||||
|
|
||||||
$('.TOOL_disktt_btn').live('click', function(){
|
$('.TOOL_disktt_btn').live('click', function(){
|
||||||
var datas = {};
|
var datas = {};
|
||||||
|
|
||||||
if($(this).hasClass('results_window'))
|
if($(this).hasClass('results_window'))
|
||||||
{
|
{
|
||||||
if(p4.sel.length > 0)
|
if(p4.sel.length > 0)
|
||||||
@@ -3042,7 +3042,7 @@ function activeIcons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(datas.lst || datas.SSTTID)
|
if(datas.lst || datas.SSTTID)
|
||||||
downloadThis(datas);
|
downloadThis(datas);
|
||||||
|
|
||||||
@@ -4337,7 +4337,7 @@ function reorder(ssel_id)
|
|||||||
function set_up_feed_box(data)
|
function set_up_feed_box(data)
|
||||||
{
|
{
|
||||||
var $feed_box = $('#modal_feed');
|
var $feed_box = $('#modal_feed');
|
||||||
|
|
||||||
$feed_box.empty().append(data).dialog({
|
$feed_box.empty().append(data).dialog({
|
||||||
modal:true,
|
modal:true,
|
||||||
width:800,
|
width:800,
|
||||||
@@ -4345,10 +4345,10 @@ function set_up_feed_box(data)
|
|||||||
resizable:false,
|
resizable:false,
|
||||||
draggable:false
|
draggable:false
|
||||||
});
|
});
|
||||||
|
|
||||||
var $feeds_item = $('.feeds .feed', $feed_box);
|
var $feeds_item = $('.feeds .feed', $feed_box);
|
||||||
var $form = $('form.main_form', $feed_box);
|
var $form = $('form.main_form', $feed_box);
|
||||||
|
|
||||||
$feeds_item.bind('click', function(){
|
$feeds_item.bind('click', function(){
|
||||||
$feeds_item.removeClass('selected');
|
$feeds_item.removeClass('selected');
|
||||||
$(this).addClass('selected');
|
$(this).addClass('selected');
|
||||||
@@ -4358,14 +4358,14 @@ function set_up_feed_box(data)
|
|||||||
},function(){
|
},function(){
|
||||||
$(this).removeClass('hover')
|
$(this).removeClass('hover')
|
||||||
});
|
});
|
||||||
|
|
||||||
$form.bind('submit', function(){
|
$form.bind('submit', function(){
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button.valid_form').bind('click', function(){
|
$('button.valid_form', $feed_box).bind('click', function(){
|
||||||
var error = false;
|
var error = false;
|
||||||
|
|
||||||
$('.required_text', $form).each(function(i, el){
|
$('.required_text', $form).each(function(i, el){
|
||||||
if($.trim($(el).val()) === '')
|
if($.trim($(el).val()) === '')
|
||||||
{
|
{
|
||||||
@@ -4373,36 +4373,46 @@ function set_up_feed_box(data)
|
|||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
alert(language.feed_require_fields)
|
alert(language.feed_require_fields)
|
||||||
}
|
}
|
||||||
|
|
||||||
if($('input[name="feed_id"]', $form).val() === '')
|
if($('input[name="feed_id"]', $form).val() === '')
|
||||||
{
|
{
|
||||||
alert(language.feed_require_feed)
|
alert(language.feed_require_feed)
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: $form.attr('action'),
|
url: $form.attr('action'),
|
||||||
data: $form.serializeArray(),
|
data: $form.serializeArray(),
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
|
beforeSend:function(){
|
||||||
|
$('button', $feed_box).attr('disabled', 'disabled');
|
||||||
|
},
|
||||||
|
error:function(){
|
||||||
|
$('button', $feed_box).removeAttr('disabled');
|
||||||
|
},
|
||||||
|
timeout:function(){
|
||||||
|
$('button', $feed_box).removeAttr('disabled');
|
||||||
|
},
|
||||||
success: function(data){
|
success: function(data){
|
||||||
|
$('button', $feed_box).removeAttr('disabled');
|
||||||
if(data.error === true)
|
if(data.error === true)
|
||||||
{
|
{
|
||||||
alert(data.message);
|
alert(data.message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($('form.main_form', $feed_box).hasClass('entry_update'))
|
if($('form.main_form', $feed_box).hasClass('entry_update'))
|
||||||
{
|
{
|
||||||
var id = $('form input[name="entry_id"]', $feed_box).val();
|
var id = $('form input[name="entry_id"]', $feed_box).val();
|
||||||
@@ -4420,4 +4430,3 @@ function set_up_feed_box(data)
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user