Changeset 1167

Show
Ignore:
Timestamp:
01/15/07 02:59:25 (6 years ago)
Author:
benoitg
Message:
  • Content.php: Make hasDisplayableMetadata() consider Authors, and make it a bit faster.


Location:
trunk/wifidog-auth
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1166 r1167  
    112007-01-14 Benoit Grégoire  <bock@step.polymtl.ca> 
    22        * Dependencies.php, AuthenticatorRadius.php:  Fix bug #287 (Dependencies not being detected properly) 
    3  
     3        * Content.php: Make hasDisplayableMetadata() consider Authors, and make it a bit faster. 
     4         
    452007-01-13 Benoit Grégoire  <bock@step.polymtl.ca> 
    56        * Content.php:  Add setUserUIMainDisplayContent() and setUserUIMainInteractionArea() 
  • trunk/wifidog-auth/wifidog/classes/Content.php

    r1165 r1167  
    921921                //Delete the KVP 
    922922                $retval = $db->execSqlUpdate("DELETE FROM content_key_value_pairs WHERE content_id='" . $this->getId() . "' AND key='$key_sql'", false); 
    923                         if(isset ($this->kvps[$key])) { 
    924                                 unset ($this->kvps[$key]); 
    925                         } 
     923                if(isset ($this->kvps[$key])) { 
     924                        unset ($this->kvps[$key]); 
     925                } 
    926926        } else if (!isset ($this->kvps[$key])) { 
    927927                //This is a new key 
     
    11341134        return false; 
    11351135    } 
    1136      
     1136 
    11371137    /** This function will be called by MainUI for each Content BEFORE any getUserUI function is called to allow two pass Content display. 
    11381138     * Two pass Content display allows such things as modyfying headers, title, creating content type that accumulate content from other pieces (like RSS feeds) 
     
    11481148        $retval = false; 
    11491149        $metadata = $this->getTitle(); 
    1150         if ($metadata  && $this->titleShouldDisplay()){ 
     1150        if ($metadata && $this->titleShouldDisplay()){ 
    11511151                $retval = true; 
    11521152        } 
    1153         $metadata = $this->getDescription(); 
    1154         if ($metadata){ 
     1153        elseif ($this->getDescription()){ 
    11551154                $retval = true; 
    11561155        } 
    1157         $metadata = $this->getLongDescription(); 
    1158         if ($metadata){ 
     1156        elseif ($this->getLongDescription()){ 
    11591157                $retval = true; 
    11601158        } 
    1161         $metadata = $this->getProjectInfo(); 
    1162         if ($metadata){ 
     1159        elseif ($this->getProjectInfo()){ 
     1160                $retval = true; 
     1161        } 
     1162        elseif($this->getAuthors()) { 
    11631163                $retval = true; 
    11641164        } 
  • trunk/wifidog-auth/wifidog/classes/Content/Avatar/Avatar.php

    r1099 r1167  
    4646 * Load Picture content class 
    4747 */ 
    48 require_once('classes/Content/Picture/Picture.php'); 
     48require_once('classes/Content/SimplePicture/SimplePicture.php'); 
    4949 
    5050/** 
     
    5656 * @copyright  2005-2006 Francois Proulx, Technologies Coeus inc. 
    5757 */ 
    58 class Avatar extends Picture 
     58class Avatar extends SimplePicture 
    5959{ 
    6060    /** 
     
    6666    { 
    6767        parent :: __construct($content_id); 
    68     } 
    69  
    70     /** 
    71      * Shows the administration interface for Avatar 
    72      * 
    73      * @param string $subclass_admin_interface HTML code to be added after the 
    74      *                                         administration interface 
    75      * 
    76      * @return string HTML code for the administration interface 
    77      */ 
    78     public function getAdminUI($subclass_admin_interface = null, $title=null) 
    79     { 
    80         // Init values 
    81         $html = ''; 
    82                 $html .= "<ul class='admin_element_list'>\n"; 
    83         // Show File admin UI + display the picture 
    84         $html .= "<li class='admin_element_item_container'>\n"; 
    85         $html .= "<div class='admin_element_data'>\n"; 
    86         $html .= "<div class='admin_element_label'>"._("Picture preview")." : </div>\n"; 
    87         $html .= "<br>\n"; 
    88  
    89         $html .= "<img src='".htmlentities($this->getFileUrl())."' alt='".$this->getFileName()."''>"; 
    90         $html .= "</div>\n"; 
    91         $html .= "</li>\n"; 
    92  
    93         $html .= "<li class='admin_element_item_container'>\n"; 
    94         $html .= "<div class='admin_element_label'>"; 
    95         $html .= "<input type='radio' name='file_mode".$this->getId()."' value='by_upload' ". ($this->isLocalFile() ? "CHECKED" : "").">"; 
    96         $html .= _("Upload a new file (Uploading a new one will replace any existing file)")." : </div>\n"; 
    97         $html .= "<div class='admin_element_data'>\n"; 
    98         $html .= '<input type="hidden" name="MAX_FILE_SIZE" value="1073741824" />'; 
    99         $html .= '<input name="file_file_upload'.$this->getId().'" type="file" />'; 
    100         $html .= "</div>\n"; 
    101         $html .= "</li>\n"; 
    102  
    103         $html .= "<li class='admin_element_item_container'>\n"; 
    104         $html .= "<div class='admin_element_label'>"; 
    105         $html .= "<input type='radio' name='file_mode".$this->getId()."' value='remote' ". (!$this->isLocalFile() ? "CHECKED" : "").">"; 
    106         $html .= _("Remote file via URL")." : </div>\n"; 
    107         $html .= "<div class='admin_element_data'>\n"; 
    108  
    109         if ($this->isLocalFile()) { 
    110             $html .= "<input name='file_url".$this->getId()."' type='text' size='50'/>"; 
    111         } else { 
    112             $html .= "<input name='file_url".$this->getId()."' type='text' size='50' value='".$this->getFileUrl()."'/>"; 
    113         } 
    114  
    115         $html .= "</div>\n"; 
    116         $html .= "</li>\n"; 
    117  
    118         if (!$this->isLocalFile()) { 
    119             $html .= "<li class='admin_element_item_container'>\n"; 
    120             $html .= "<div class='admin_element_label'>"._("File URL")." : </div>\n"; 
    121             $html .= "<div class='admin_element_data'>\n"; 
    122             $html .= $this->getFileUrl(); 
    123             $html .= "</div>\n"; 
    124             $html .= "</li>\n"; 
    125         } 
    126                 $html .= "</ul>\n"; 
    127         $html .= $subclass_admin_interface; 
    128         return parent :: getAdminUI($html, $title); 
    129     } 
    130  
    131     /** 
    132      * Processes the input of the administration interface for RssAggregator 
    133      * 
    134      * @return void 
    135      */ 
    136     public function processAdminUI() 
    137     { 
    138         if ($this->isOwner(User :: getCurrentUser()) || User :: getCurrentUser()->isSuperAdmin()) { 
    139             parent :: processAdminUI(); 
    140         } 
    141     } 
    142  
    143     /** 
    144      * Retreives the user interface of this object. 
    145      * 
    146      * @return string The HTML fragment for this interface 
    147      */ 
    148     public function getUserUI() 
    149     { 
    150         // Init values 
    151         $html = ''; 
    152  
    153         $html .= "<div class='user_ui_container ".get_class($this)."'>\n"; 
    154  
    155         $html .= "<img src='".htmlentities($this->getFileUrl())."' alt='".$this->getFileName()."''>"; 
    156         $html .= "</div>\n"; 
    157  
    158         return $html; 
    15968    } 
    16069 
  • trunk/wifidog-auth/wifidog/classes/Content/SimplePicture/SimplePicture.php

    r1148 r1167  
    4646 * Load required classes 
    4747 */ 
    48  
     48require_once('classes/Content/Picture/Picture.php'); 
    4949/** 
    5050 * Represents a simple picture (no title, description, etc.)