Changeset 601

Show
Ignore:
Timestamp:
04/29/05 14:21:46 (7 years ago)
Author:
fproulx
Message:

2005-04-29 Fran�ois Proulx <francois.proulx@…>

  • Removed all inline unuseful javascript code on submit buttons onclick='submit()'
  • This conflicted with the actual click on the submit button in Safari
  • Fixed check in Network for isOwner, only check superAdmin
  • Fixed bug so you can't add an existing content group to itself ( deadlock )
  • Started coding Pattern language narrative display
Location:
trunk/wifidog-auth
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/ChangeLog

    r600 r601  
     12005-04-29 François Proulx <francois.proulx@gmail.com> 
     2        * Removed all inline unuseful javascript code on submit buttons onclick='submit()' 
     3        * This conflicted with the actual click on the submit button in Safari 
     4        * Fixed check in Network for isOwner, only check superAdmin 
     5        * Fixed bug so you can't add an existing content group to itself ( deadlock ) 
     6        * Started coding Pattern language narrative display 
     7 
    182005-04-29 François Proulx <francois.proulx@gmail.com> 
    29        * Wrote User.php addcontent, removeContent, getAllContent() 
  • trunk/wifidog-auth/wifidog/admin/generic_object_admin.php

    r593 r601  
    113113                $node = Node :: getObject($node_id); 
    114114                Node :: setCurrentNode($node); 
     115         
     116        $html .= "<h1>"._("Showing preview as it would appear at ").$node->getName()."</h1><p>";  
    115117        } 
    116118        $common_input = ''; 
     
    127129        $name = "node_id"; 
    128130        $html .= Node :: getSelectNodeUI($name); 
    129  
     131     
    130132        $html .= $object->getUserUI(); 
    131133        $html .= "<input type='hidden' name='action' value='preview'>\n"; 
  • trunk/wifidog-auth/wifidog/admin/hotspot.php

    r573 r601  
    167167        try { 
    168168                $node = Node::getObject($node_id); 
    169             $node->delete(); 
     169            $node->delete($errmsg); 
    170170        } catch (Exception $e) { 
    171171            echo '<p class="warning">'.$e->getMessage().'</p>';  
  • trunk/wifidog-auth/wifidog/classes/Content.php

    r600 r601  
    172172                        $value = _("Add"); 
    173173                } 
    174                 $html .= "<input type='submit' name='$name' value='$value'>"; // onclick='submit();' 
     174                $html .= "<input type='submit' name='$name' value='$value'>"; 
    175175                return $html; 
    176176        } 
     
    378378        public function isDisplayableAt($node) 
    379379        { 
    380  
    381380                return true; 
    382381        } 
     
    598597                                        $html .= "<div class='admin_section_tools'>\n"; 
    599598                                        $name = "content_".$this->id."_title_erase"; 
    600                                         $html .= "<input type='submit' name='$name' value='"._("Delete")."' onclick='submit();'>"; 
     599                                        $html .= "<input type='submit' name='$name' value='"._("Delete")."'>"; 
    601600                                        $html .= "</div>\n"; 
    602601                                } 
     
    629628                                        $html .= "<div class='admin_section_tools'>\n"; 
    630629                                        $name = "content_".$this->id."_description_erase"; 
    631                                         $html .= "<input type='submit' name='$name' value='"._("Delete")."' onclick='submit();'>"; 
     630                                        $html .= "<input type='submit' name='$name' value='"._("Delete")."'>"; 
    632631                                        $html .= "</div>\n"; 
    633632                                } 
     
    650649                                        $html .= "<div class='admin_section_tools'>\n"; 
    651650                                        $name = "content_".$this->id."_project_info_erase"; 
    652                                         $html .= "<input type='submit' name='$name' value='"._("Delete")."' onclick='submit();'>"; 
     651                                        $html .= "<input type='submit' name='$name' value='"._("Delete")."'>"; 
    653652                                        $html .= "</div>\n"; 
    654653                                } 
     
    671670                                        $html .= "<div class='admin_section_tools'>\n"; 
    672671                                        $name = "content_".$this->id."_sponsor_info_erase"; 
    673                                         $html .= "<input type='submit' name='$name' value='"._("Delete")."' onclick='submit();'>"; 
     672                                        $html .= "<input type='submit' name='$name' value='"._("Delete")."'>"; 
    674673                                        $html .= "</div>\n"; 
    675674                                } 
     
    701700                                                $html .= "<div class='admin_section_tools'>\n"; 
    702701                                                $name = "content_".$this->id."_owner_".$user->GetId()."_remove"; 
    703                                                 $html .= "<input type='submit' name='$name' value='"._("Remove")."' onclick='submit();'>"; 
     702                                                $html .= "<input type='submit' name='$name' value='"._("Remove")."'>"; 
    704703                                                $html .= "</div>\n"; 
    705704                                                $html .= "</li>\n"; 
     
    714713                                $name = "content_{$this->id}_add_owner_submit"; 
    715714                                $value = _("Add owner"); 
    716                                 $html .= "<input type='submit' name='$name' value='$value' onclick='submit();'>"; 
     715                                $html .= "<input type='submit' name='$name' value='$value'>"; 
    717716                                $html .= "</div>\n"; 
    718717                                $html .= "</li>\n"; 
     
    757756                                        { 
    758757                                                $db->ExecSqlUpdate("UPDATE content SET title = NULL WHERE content_id = '$this->id'", FALSE); 
    759                                                 $title->delete(); 
     758                                                $title->delete($errmsg); 
    760759                                        } 
    761760                                        else 
     
    786785                                        { 
    787786                                                $db->ExecSqlUpdate("UPDATE content SET description = NULL WHERE content_id = '$this->id'", FALSE); 
    788                                                 $description->delete(); 
     787                                                $description->delete($errmsg); 
    789788                                        } 
    790789                                        else 
     
    811810                                        { 
    812811                                                $db->ExecSqlUpdate("UPDATE content SET project_info = NULL WHERE content_id = '$this->id'", FALSE); 
    813                                                 $project_info->delete(); 
     812                                                $project_info->delete($errmsg); 
    814813                                        } 
    815814                                        else 
     
    836835                                        { 
    837836                                                $db->ExecSqlUpdate("UPDATE content SET sponsor_info = NULL WHERE content_id = '$this->id'", FALSE); 
    838                                                 $sponsor_info->delete(); 
     837                                                $sponsor_info->delete($errmsg); 
    839838                                        } 
    840839                                        else 
     
    888887        } 
    889888        } 
     889     
     890    /** 
     891     * Tell if a given user is already subscribed to this content 
     892     * @param User the given user 
     893     * @return boolean 
     894     */ 
     895    public function isUserSubscribed(User $user) 
     896    { 
     897        global $db; 
     898        $sql = "SELECT content_id FROM user_has_content WHERE user_id = '{$user->getId()}' AND content_id = '{$this->getId()}';"; 
     899        $db->ExecSqlUniqueRes($sql, $row, false); 
     900         
     901        if($row) 
     902            return true; 
     903        else 
     904            return false; 
     905    } 
     906     
    890907        /** Subscribe to the project  
    891908         * @return true on success, false on failure */ 
  • trunk/wifidog-auth/wifidog/classes/Content/ContentGroup.php

    r593 r601  
    390390                        $html .= "<div class='admin_section_tools'>\n"; 
    391391                        $name = "content_group_".$this->id."_element_".$element->GetId()."_erase"; 
    392                         $html .= "<input type='submit' name='$name' value='"._("Delete")."' onclick='submit();'>"; 
     392                        $html .= "<input type='submit' name='$name' value='"._("Delete")."'>"; 
    393393                        $html .= "</div>\n"; 
    394394                        $html .= "</li>\n"; 
     
    397397        $html .= "<b>"._("Add a new content OR select previously created content")."</b><br>"; 
    398398                $html .= self :: getNewContentUI("content_group_{$this->id}_new_element")."<br>"; 
    399         $html .= self :: getSelectContentUI("content_group_{$this->id}_existing_element"); 
     399        $html .= self :: getSelectContentUI("content_group_{$this->id}_existing_element", "AND content_id != '$this->id'"); 
    400400        $html .= "<input type='submit' name='content_group_{$this->id}_existing_element_add' value='"._("Add")."'>"; 
    401401        $html .= "</li>\n"; 
     
    695695        /** Retreives the user interface of this object.  Anything that overrides this method should call the parent method with it's output at the END of processing. 
    696696         * @param $subclass_admin_interface Html content of the interface element of a children 
     697     * @param boolean $hide_elements allows the child class ( for example 
     698     * Pattern Language) to tell the content group not to display elements ) for 
     699     * elements that need to be hidden before subscription 
    697700         * @return The HTML fragment for this interface */ 
    698         public function getUserUI($subclass_user_interface = null) 
     701        public function getUserUI($subclass_user_interface = null, $hide_elements = false) 
    699702        { 
    700703                $html = ''; 
     
    702705                $html .= "<div class='user_ui_object_class'>ContentGroup (".get_class($this)." instance)</div>\n"; 
    703706 
    704                 $display_elements = $this->getDisplayElements(); 
    705                 if (count($display_elements) > 0) 
    706                 { 
    707                         foreach ($display_elements as $display_element) 
    708                         { 
    709                 // If the content group logging is disabled, all the children will inherit this property temporarly 
    710                 if($this->getLoggingStatus() == false) 
    711                     $display_element->setLoggingStatus(false); 
    712                                 $html .= $display_element->getUserUI(); 
    713                         } 
    714                 } 
    715                 else 
    716                 { 
    717                         $html .= '<p class="warningmsg">'._("Sorry, no elements available at this hotspot or all elements of the content group have already been shown")."</p>\n"; 
    718                 } 
     707                if($hide_elements == false) 
     708        { 
     709            $display_elements = $this->getDisplayElements(); 
     710                if (count($display_elements) > 0) 
     711                { 
     712                        foreach ($display_elements as $display_element) 
     713                        { 
     714                    // If the content group logging is disabled, all the children will inherit this property temporarly 
     715                    if($this->getLoggingStatus() == false) 
     716                        $display_element->setLoggingStatus(false); 
     717                                $html .= $display_element->getUserUI(); 
     718                        } 
     719                } 
     720                else 
     721                { 
     722                        $html .= '<p class="warningmsg">'._("Sorry, no elements available at this hotspot or all elements of the content group have already been shown")."</p>\n"; 
     723                } 
     724        } 
    719725 
    720726                $html .= $subclass_user_interface; 
  • trunk/wifidog-auth/wifidog/classes/Content/EmbeddedContent.php

    r600 r601  
    104104                        $html .= "</div>\n"; 
    105105                         
    106                         $html .= "<input type='submit' name='$name' value='"._("Delete")."'>"; //  onclick='submit();' 
     106                        $html .= "<input type='submit' name='$name' value='"._("Delete")."'>"; 
    107107                        $html .= "</div>\n"; 
    108108                } 
     
    125125                        $html .= "<div class='admin_section_tools'>\n"; 
    126126                        $name = "fallback_content_".$this->id."_fallback_content_erase"; 
    127                         $html .= "<input type='submit' name='$name' value='"._("Delete")."'>"; // onclick='submit();' 
     127                        $html .= "<input type='submit' name='$name' value='"._("Delete")."'>"; 
    128128                        $html .= "</div>\n"; 
    129129                } 
  • trunk/wifidog-auth/wifidog/classes/Content/Langstring.php

    r593 r601  
    164164                                                                $html .= "<div class='admin_section_tools'>\n"; 
    165165                                $name = "langstrings_".$this->id."_substring_$value[langstring_entries_id]_erase"; 
    166                                 $html .= "<input type='submit' name='$name' value='"._("Delete string")."' onclick='submit();'>"; 
     166                                $html .= "<input type='submit' name='$name' value='"._("Delete string")."'>"; 
    167167                                                                $html .= "</div>\n"; 
    168168                                                                $html .= "</li>\n"; 
     
    189189                 
    190190                $new_substring_submit_name = "langstrings_".$this->id."_add_new_entry"; 
    191                 $html .= "<input type='submit' name='$new_substring_submit_name' value='"._("Add new string")."' onclick='submit();'>"; 
     191                $html .= "<input type='submit' name='$new_substring_submit_name' value='"._("Add new string")."'>"; 
    192192                $html .= "</div>\n"; 
    193193                $html .= "</li>\n"; 
  • trunk/wifidog-auth/wifidog/classes/Content/PatternLanguage.php

    r588 r601  
    2525 */ 
    2626require_once BASEPATH.'classes/Content/ContentGroup.php'; 
     27require_once BASEPATH.'classes/User.php'; 
    2728 
    2829/** Pattern Language is a location-aware fiction project by Kate Armstrong that attaches patterns of narrative to individuals as they move through the city of Montreal. Each person's path is logged in the system and compiled into a document that can be read online. The work is meant to engage with the rhythms of the city: by evolving according to the patterns of an individual, each story forms both a map or trace of movement and a fabric of sound.  
     
    4445        $this->setIsExpandable(false); 
    4546        } 
     47     
     48    /** Retreives the user interface of this object.  Anything that overrides this method should call the parent method with it's output at the END of processing. 
     49     * @param $subclass_admin_interface Html content of the interface element of a children 
     50     * @return The HTML fragment for this interface */ 
     51      
     52     //TODO: complete this 
     53     /* 
     54    public function getUserUI($subclass_user_interface = null) 
     55    { 
     56        $html = ''; 
     57        $html .= "<div class='user_ui_container'>\n"; 
     58        $html .= "<div class='user_ui_object_class'>PatternLanguage (".get_class($this)." instance)</div>\n"; 
     59         
     60        // Check if the user has already subscribed to Pattern language 
     61        $current_user = User::getCurrentUser(); 
     62        if($current_user == null || $this->isUserSubscribed($current_user) == false) 
     63        { 
     64            // hyperlink to all users narrative 
     65             
     66            // Until subscription is done DO NOT log this ! 
     67            $this->setLoggingStatus(false); 
     68            // Tell the content group not to display elements until subscription is done 
     69            $parent_output = parent :: getUserUI($html, true); 
     70        } 
     71        else 
     72        { 
     73            // The user is subscribed to the pattern language show an element ! 
     74            // hyperlink to user's narrative 
     75             
     76            // Display the random pattern 
     77            $parent_output = parent :: getUserUI($html); 
     78        } 
     79         
     80        $html .= $subclass_user_interface; 
     81        $html .= "</div>\n"; 
     82         
     83        return $parent_output; 
     84    }*/ 
    4685 
    4786        /** Display the narrative 
  • trunk/wifidog-auth/wifidog/classes/ContentGroupElement.php

    r593 r601  
    142142                                $html .= "<div class='admin_section_tools'>\n"; 
    143143                                $name = "content_group_element_".$this->id."_allowed_node_".$node->GetId()."_remove"; 
    144                                 $html .= "<input type='submit' name='$name' value='"._("Remove")."' onclick='submit();'>"; 
     144                                $html .= "<input type='submit' name='$name' value='"._("Remove")."'>"; 
    145145                                $html .= "</div>\n"; 
    146146                                $html .= "</li>\n"; 
     
    155155                $html .= Node :: getSelectNodeUI($name, $sql_additional_where); 
    156156                $name = "content_group_element_{$this->id}_new_allowed_node_submit"; 
    157                 $html .= "<input type='submit' name='$name' value='"._("Add new allowed node")."' onclick='submit();'>"; 
     157                $html .= "<input type='submit' name='$name' value='"._("Add new allowed node")."'>"; 
    158158                $html .= "</li'>\n"; 
    159159 
     
    168168            $html .= "<b>"._("Add a new displayed content OR select an existing one")."</b><br>"; 
    169169                        $html .= self :: getNewContentUI("content_group_element_{$this->id}_new_displayed_content")."<br>"; 
    170             $html .= self :: getSelectContentUI("content_group_element_{$this->id}_new_displayed_existing_element"); 
     170            $html .= self :: getSelectContentUI("content_group_element_{$this->id}_new_displayed_existing_element", "AND content_id != '$this->id'"); 
    171171            $html .= "<input type='submit' name='content_group_element_{$this->id}_new_displayed_existing_element_add' value='"._("Add")."'>"; 
    172172                } 
     
    177177                        $html .= "<div class='admin_section_tools'>\n"; 
    178178                        $name = "content_group_element_{$this->id}_erase_displayed_content"; 
    179                         $html .= "<input type='submit' name='$name' value='"._("Delete")."' onclick='submit();'>"; 
     179                        $html .= "<input type='submit' name='$name' value='"._("Delete")."'>"; 
    180180                        $html .= "</div>\n"; 
    181181                } 
  • trunk/wifidog-auth/wifidog/classes/Network.php

    r600 r601  
    207207                        $html .= "<div class='admin_section_tools'>\n"; 
    208208                        $name = "content_group_".$this->id."_element_".$content->GetId()."_erase"; 
    209                         $html .= "<input type='submit' name='$name' value='"._("Remove")."' onclick='submit();'>"; 
     209                        $html .= "<input type='submit' name='$name' value='"._("Remove")."'>"; 
    210210                        $html .= "</div>\n"; 
    211211                        $html .= "</li>\n"; 
     
    215215                $html .= Content :: getSelectContentUI($name, "AND content_id NOT IN (SELECT content_id FROM network_has_content WHERE network_id='$this->id')"); 
    216216                $name = "network_{$this->id}_new_content_submit"; 
    217                 $html .= "<input type='submit' name='$name' value='"._("Add")."' onclick='submit();'>"; 
     217                $html .= "<input type='submit' name='$name' value='"._("Add")."'>"; 
    218218                $html .= "</li>\n"; 
    219219                $html .= "</ul>\n"; 
     
    227227        { 
    228228        $user = User::getCurrentUser(); 
    229         if (!$this->isOwner($user) && !$user->isSuperAdmin()) 
     229        if (!$user->isSuperAdmin()) 
    230230        { 
    231231            throw new Exception(_('Access denied!')); 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r600 r601  
    354354                        $html .= "<div class='admin_section_tools'>\n"; 
    355355                        $name = "node_".$this->id."_content_".$content->GetId()."_erase"; 
    356                         $html .= "<input type='submit' name='$name' value='"._("Remove")."' onclick='submit();'>"; 
     356                        $html .= "<input type='submit' name='$name' value='"._("Remove")."'>"; 
    357357                        $html .= "</div>\n"; 
    358358                        $html .= "</li>\n"; 
     
    362362                $html .= Content :: getSelectContentUI($name, "AND content_id NOT IN (SELECT content_id FROM node_has_content WHERE node_id='$this->id')"); 
    363363                $name = "node_{$this->id}_new_content_submit"; 
    364                 $html .= "<input type='submit' name='$name' value='"._("Add")."' onclick='submit();'>"; 
     364                $html .= "<input type='submit' name='$name' value='"._("Add")."'>"; 
    365365                $html .= "</li>\n"; 
    366366                $html .= "</ul>\n";