Ejemplo n.º 1
0
 protected function setup_widget(Widget $obj)
 {
     $tpl = parent::setup_widget($obj);
     if ($obj instanceof NotesTopic && $obj->summary) {
         $tpl->setTemplate('views/templates/tableless/NotesBoardTopic.tpl.php');
     } else {
         if ($obj instanceof WidgetGroup) {
             if ($obj instanceof Form) {
                 $tpl->setTemplate('views/templates/tableless/Form.tpl.php');
                 if ($obj instanceof EditBox) {
                     $tpl->setTemplate('views/templates/tableless/EditBox.tpl.php');
                 }
             } else {
                 if ($obj instanceof FormItemSet) {
                     $tpl->setTemplate('views/templates/tableless/FormItemSet.tpl.php');
                 } else {
                     if ($obj instanceof AutoRead) {
                         // Setting the class this way is kinda sketchy, we should really handle classes better
                         $tpl->level_link_template->tag_attributes .= ' class="autoreadlink"';
                         $tpl->markasread_template->tag_attributes .= " onclick =\"return confirm('Are you sure you\\'d like to mark all the Plans on level " . $obj->priority . " as read?')\"";
                         $tpl->setTemplate('views/templates/tableless/AutoRead.tpl.php');
                     } else {
                         if ($obj instanceof NotesBoard) {
                             $tpl->setTemplate('views/templates/tableless/NotesBoard.tpl.php');
                         } else {
                             if ($obj instanceof NotesTopic) {
                                 $tpl->setTemplate('views/templates/tableless/NotesTopic.tpl.php');
                             } else {
                                 if ($obj instanceof WidgetList) {
                                     $tpl->setTemplate('views/templates/tableless/WidgetList.tpl.php');
                                 } else {
                                     if ($obj instanceof WidgetGroup) {
                                         $tpl->setTemplate('views/templates/tableless/WidgetGroup.tpl.php');
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         } else {
             if ($obj instanceof SubmitInput) {
                 $tpl->tag_attributes = 'class="submitinput"';
                 $tpl->setTemplate('views/templates/std/FormButton.tpl.php');
             } else {
                 if ($obj instanceof FormItem) {
                     $tpl->tag_attributes .= ' class="form_prompt ' . strtolower(get_class($obj)) . '"';
                     if ($obj instanceof HiddenInput) {
                         $tpl->setTemplate('views/templates/std/FormInput.tpl.php');
                     } else {
                         if ($obj instanceof TextInput || $obj instanceof TextareaInput || $obj instanceof PasswordInput) {
                             $tpl->setTemplate('views/templates/tableless/FormElement_title_prepend.tpl.php');
                         } else {
                             $tpl->setTemplate('views/templates/tableless/FormElement.tpl.php');
                         }
                     }
                 } else {
                     if ($obj instanceof Secret) {
                         $tpl->setTemplate('views/templates/tableless/Secret.tpl.php');
                     } else {
                         if ($obj instanceof PlanContent) {
                             if ($obj->addform) {
                                 $tpl->addform_template = $this->setup_widget($obj->addform);
                             } else {
                                 $tpl->addform_template = new Plans_Savant3();
                                 $tpl->addform_template->setTemplate('views/templates/std/Empty.tpl.php');
                             }
                             $tpl->setTemplate('views/templates/tableless/Plan.tpl.php');
                         } else {
                             if ($obj instanceof PlanText) {
                                 $tpl->setTemplate('views/templates/tableless/PlanText.tpl.php');
                             } else {
                                 if ($obj instanceof HeadingText) {
                                     // Do nothing, already handled
                                 } else {
                                     if ($obj instanceof RegularText) {
                                         // Do nothing, already handled
                                     } else {
                                         if ($obj instanceof Text) {
                                             $tpl->setTemplate('views/templates/tableless/Text.tpl.php');
                                         } else {
                                             if ($obj instanceof NotesPost) {
                                                 $tpl->setTemplate('views/templates/tableless/NotesPost.tpl.php');
                                             } else {
                                                 if ($obj instanceof NotesNavigation) {
                                                     $tpl->setTemplate('views/templates/tableless/NotesNavigation.tpl.php');
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $tpl;
 }
Ejemplo n.º 2
0
 protected function setup_widget(Widget $obj)
 {
     $tpl = parent::setup_widget($obj);
     if ($obj instanceof NotesTopic && $obj->summary) {
         // Override the forced lowercase that gets applied to Hyperlinks
         $tpl->title_template->description = $obj->title->description;
         $tpl->setTemplate('views/templates/legacy/NotesBoardTopic.tpl.php');
     } else {
         if ($obj instanceof WidgetGroup) {
             if ($obj instanceof Form) {
                 foreach ($obj->contents as $i => $item) {
                     if ($item instanceof SubmitInput) {
                         $tpl->submit_button = $item;
                     }
                 }
                 $tpl->setTemplate('views/templates/legacy/Form.tpl.php');
                 if ($this->page->identifier == 'planname' || $this->page->identifier == 'search') {
                     $tpl = $this->oneline_form($obj, $tpl);
                 } else {
                     if ($obj->identifier == 'signup') {
                         $tpl->contents[2]->setTemplate('views/templates/legacy/FormElement_no_table.tpl.php');
                     } else {
                         if ($this->page->identifier == 'poll') {
                             $tpl->setTemplate('views/templates/legacy/PollForm.tpl.php');
                         }
                     }
                 }
                 if ($obj instanceof EditBox) {
                     $tpl->setTemplate('views/templates/legacy/EditBox.tpl.php');
                 }
             } else {
                 if ($obj instanceof FormItemSet) {
                     $tpl->tag_attributes = self::id_and_class($obj->identifier, array($obj->group, 'formitemset'));
                     foreach ($tpl->contents as $template) {
                         $template->setTemplate('views/templates/legacy/FormElement_no_row.tpl.php');
                     }
                     $tpl->setTemplate('views/templates/legacy/FormItemSet.tpl.php');
                 } else {
                     if ($obj instanceof NotesBoard) {
                         foreach ($tpl->contents as $t) {
                             $t->list_attributes = str_replace('even', 'noteslight', $t->list_attributes);
                             $t->list_attributes = str_replace('odd', 'notesdark', $t->list_attributes);
                         }
                         $tpl->setTemplate('views/templates/legacy/NotesBoard.tpl.php');
                     } else {
                         if ($obj instanceof NotesTopic) {
                             $tpl->tag_attributes = ' class="boardmessages"';
                             foreach ($tpl->contents as $t) {
                                 $t->list_attributes = str_replace('even', 'noteslight', $t->list_attributes);
                                 $t->list_attributes = str_replace('odd', 'notesdark', $t->list_attributes);
                             }
                             $tpl->setTemplate('views/templates/legacy/NotesTopic.tpl.php');
                         } else {
                             if ($obj instanceof WidgetList) {
                                 $tpl->tag_attributes = self::id_and_class($obj->identifier, $obj->group);
                                 $tpl->setTemplate('views/templates/legacy/WidgetList.tpl.php');
                                 // The Preferences page
                                 if ($this->page->identifier == 'prefs') {
                                     $part2 = false;
                                     foreach ($obj->contents as $i => $item) {
                                         $t = $tpl->contents[$i];
                                         if ($part2) {
                                             $t->tag_attributes = ' class="lev2"';
                                         } else {
                                             if ($item instanceof HeadingText) {
                                                 $t->tag_attributes = ' class="main"';
                                                 $t->tag = 'p';
                                                 $t->setTemplate('views/templates/std/GenericTag.tpl.php');
                                                 $part2 = true;
                                             } else {
                                                 $t->tag_attributes = ' class="main"';
                                             }
                                         }
                                     }
                                 } else {
                                     if ($obj->identifier == 'autoread_alphabet') {
                                         $tpl->setTemplate('views/templates/legacy/WidgetGroup.tpl.php');
                                     } else {
                                         if ($obj->identifier == 'search_results' || $obj->group == 'result_sublist') {
                                             blkafkjaass;
                                             $tpl->setTemplate('views/templates/tableless/WidgetList.tpl.php');
                                         }
                                     }
                                 }
                             } else {
                                 if ($obj instanceof WidgetGroup) {
                                     $tpl->setTemplate('views/templates/legacy/WidgetGroup.tpl.php');
                                     if ($obj->group == 'notes_header') {
                                         $t = $tpl;
                                         $tpl = new Plans_Savant3();
                                         $tpl->inner_template = $t;
                                         $tpl->tag = 'center';
                                         $tpl->setTemplate('views/templates/std/GenericWrapperTag.tpl.php');
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             return $tpl;
             //TODO remove
         } else {
             if ($obj instanceof SubmitInput) {
                 // We handle this elsewhere, so print nothing here
                 $tpl->setTemplate('views/templates/std/Empty.tpl.php');
             } else {
                 if ($obj instanceof FormItem) {
                     if ($obj instanceof HiddenInput) {
                         $tpl->setTemplate('views/templates/std/FormInput.tpl.php');
                     } else {
                         if ($obj instanceof TextInput || $obj instanceof TextareaInput || $obj instanceof PasswordInput) {
                             $tpl->setTemplate('views/templates/legacy/FormElement_title_prepend.tpl.php');
                         } else {
                             $tpl->setTemplate('views/templates/legacy/FormElement.tpl.php');
                         }
                     }
                 } else {
                     if ($obj instanceof Hyperlink) {
                         $tpl->description = strtolower($obj->description);
                         if ($obj->identifier == 'older_secrets') {
                             $t = $tpl;
                             $tpl = new Plans_Savant3();
                             $tpl->inner_template = $t;
                             $tpl->tag = 'p';
                             $tpl->setTemplate('views/templates/std/GenericWrapperTag.tpl.php');
                         }
                     } else {
                         if ($obj instanceof Secret) {
                             $tpl->message = preg_replace('/(^<p class="sub">)|(<\\/p>$)/', '', $tpl->message);
                             $tpl->setTemplate('views/templates/legacy/Secret.tpl.php');
                         } else {
                             if ($obj instanceof PlanContent) {
                                 if ($obj->addform) {
                                     $tpl->addform_present = true;
                                     $tpl->addform_template = $this->oneline_form($obj->addform, $tpl->addform_template);
                                     $tpl->addform_template->setTemplate('views/templates/legacy/addform.tpl.php');
                                 } else {
                                     $tpl->addform_present = false;
                                 }
                                 $tpl->setTemplate('views/templates/legacy/Plan.tpl.php');
                             } else {
                                 if ($obj instanceof PlanText) {
                                     $tpl->setTemplate('views/templates/legacy/PlanText.tpl.php');
                                 } else {
                                     if ($obj instanceof HeadingText) {
                                         $tpl->tag = 'h' . ($obj->sublevel + 1);
                                         $tpl->text = $obj->message;
                                         $tpl->setTemplate('views/templates/std/GenericTag.tpl.php');
                                     } else {
                                         if ($obj instanceof RegularText) {
                                             $tpl->tag = 'span';
                                             $tpl->text = $obj->message;
                                             $tpl->setTemplate('views/templates/std/GenericTag.tpl.php');
                                         } else {
                                             if ($obj instanceof Text) {
                                                 $tpl->setTemplate('views/templates/legacy/Text.tpl.php');
                                             } else {
                                                 if ($obj instanceof NotesPost) {
                                                     $tpl->text = preg_replace('/(^<p class="sub">)|(<\\/p>$)/', '', $tpl->text);
                                                     $tpl->yes_style = $obj->user_vote == 'yes' ? ' style="border:#222222 thin solid"' : null;
                                                     $tpl->no_style = $obj->user_vote == 'no' ? ' style="border:#222222 thin solid"' : null;
                                                     $tpl->setTemplate('views/templates/legacy/NotesPost.tpl.php');
                                                 } else {
                                                     if ($obj instanceof NotesNavigation) {
                                                         $tpl->current->text = '[' . $tpl->current->text . ']';
                                                         $tpl->setTemplate('views/templates/legacy/NotesNavigation.tpl.php');
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $tpl;
 }