Revision | 95 (tree) |
---|---|
Time | 2020-10-11 06:17:15 |
Author | derekwildstar |
Zost.bsdesign e styles.css
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Estilo para alertas atualizado
controller.php
¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Comentários adicionados
view.xml.php
¯¯¯¯¯¯¯¯¯¯¯¯
Comentários adicionados
default.php
¯¯¯¯¯¯¯¯¯¯¯
Mais ajustes no form de envio de anexos (arquivos ou urls). Ainda não foi concluído
@@ -53,6 +53,12 @@ | ||
53 | 53 | É por isso que o padrão de nomes de layouts é snake_case |
54 | 54 | */ |
55 | 55 | $this->setLayout("default_xml"); |
56 | + /* | |
57 | + O content-disposition dos documentos xml são inline com filename = | |
58 | + joomla (nome padrão do documento). Estou configurando o nome como | |
59 | + "zost" apenas para aparecer bonitinho header :) | |
60 | + */ | |
61 | + $this->document->setName("zost"); | |
56 | 62 | parent::display($tpl); |
57 | 63 | } |
58 | 64 | } |
@@ -142,6 +142,13 @@ | ||
142 | 142 | $view->document = $document; |
143 | 143 | |
144 | 144 | $view->display(); |
145 | + /* | |
146 | + Eu vi em algumas implementações de componentes a colocação de um exit() | |
147 | + depois do display(). Isso quebra as coisas. Ao se fazer isso, o conteúdo | |
148 | + esperado não é carregado dentro do template ativo. Isso acontecia com o | |
149 | + componente de anexos (com_attachment) | |
150 | + */ | |
151 | + //exit(); | |
145 | 152 | } |
146 | 153 | } |
147 | 154 | ?> |
\ No newline at end of file |
@@ -683,7 +683,7 @@ | ||
683 | 683 | |
684 | 684 | /* ==== Início: Personalização de alertas do Bootstrap ==== */ |
685 | 685 | |
686 | -.alert-info { | |
686 | +.alert-info, .alert-danger, alert-warning { | |
687 | 687 | text-shadow: initial; |
688 | 688 | } |
689 | 689 |
@@ -26,8 +26,6 @@ | ||
26 | 26 | |
27 | 27 | use Zost\Helpers; |
28 | 28 | use Joomla\CMS\Language\Text; |
29 | -//use Joomla\CMS\Factory; | |
30 | -//echo(__FILE__ . ":" . __LINE__); | |
31 | 29 | |
32 | 30 | $zostHelpers = Helpers::getHelpers(); |
33 | 31 |
@@ -37,11 +35,11 @@ | ||
37 | 35 | $parent_id = $attachment->parent_id === null ? 0 : $attachment->parent_id; |
38 | 36 | // Set up to toggle between uploading file/urls |
39 | 37 | if ($attachment->uri_type == "file" ) { |
40 | - $upload_toggle_button_text = "Em vez disso, informe o URL de uma arquivo"; | |
38 | + $upload_toggle_button_text = "Em vez disso, informe o URL de um arquivo"; | |
41 | 39 | $upload_toggle_url = $this->upload_url_url; |
42 | 40 | $upload_button_text = "Enviar"; |
43 | 41 | } else { |
44 | - $upload_toggle_button_text = "Em vez disso, selecione um arquivo a enviar"; | |
42 | + $upload_toggle_button_text = "Em vez disso, selecione um arquivo a carregar"; | |
45 | 43 | $upload_toggle_url = $this->upload_file_url; |
46 | 44 | $upload_button_text = "Adicionar URL"; |
47 | 45 | } |
@@ -67,92 +65,79 @@ | ||
67 | 65 | $upload_id = "upload_warning"; |
68 | 66 | break; |
69 | 67 | } |
70 | -/* | |
71 | -Quando há um erro no envio do arquivo ou do url, este scrip é chamado de forma | |
72 | -crua, exatamente como ele é, ou seja, apenas o miolo de algo que normalmente aparece dentro de <body>, por conta disso | |
73 | -precisamos recriar o html apenas neste caso. As duas funções abaixo criam o html necessário | |
74 | -*/ | |
75 | -//continue aquicriando as funcoes tais como existem em view.html.php. Talvez não seja necessário recriar o html | |
76 | -//talvez tenha como configurar aqui o document e deixar que o joomla se vire. Verifique se ->doc tem algo dentro de erro | |
77 | - | |
78 | -// If this is an error re-display, display the CSS links directly | |
79 | -if ($this->error) { | |
80 | - //echo($this->startHTML()); | |
81 | -} | |
82 | 68 | // Realizando uma tradução básica |
83 | 69 | $parentEntityName = $attachment->parent_entity_name == "Article" ? "o artigo" : $attachment->parent_entity_name; |
84 | -?> | |
85 | -<h2><?php echo(Text::sprintf("Anexos para %s \"%s\"",$parentEntityName, $attachment->parent_title)); ?></h2> | |
86 | -<?php | |
70 | + | |
71 | +echo("<h2>" . Text::sprintf("Anexos para %s \"%s\"",$parentEntityName, $attachment->parent_title) . "</h2>\n"); | |
72 | + | |
87 | 73 | if ($this->error_msg) { |
88 | -?> | |
89 | - <div class="formWarning" id="formWarning"><?php echo($this->error_msg); ?></div> | |
90 | -<?php | |
74 | + echo(' <div class="alert alert-danger alert-dismissible fade show" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><span style="font-weight: bold">' . $this->error_msg . '</span></div>'."\n"); | |
91 | 75 | } |
92 | 76 | ?> |
93 | 77 | <form class="attachments" enctype="multipart/form-data" name="upload_form" action="<?php echo($this->save_url); ?>" method="post"> |
94 | 78 | <fieldset class="form-group"> |
95 | - <legend>Definição do anexo</legend> | |
96 | -<?php if ( $attachment->uri_type == 'file' ): ?> | |
97 | - <p><label for="<?php echo $upload_id ?>"><?php | |
98 | - echo JText::_('ATTACH_ATTACH_FILE_COLON') ?></label> | |
99 | - <a class="changeButton" href="<?php echo $upload_toggle_url ?>"><?php | |
100 | - echo $upload_toggle_button_text;?></a></p> | |
101 | - <p><input type="file" name="upload" id="<?php echo $upload_id; ?>" | |
102 | - size="78" maxlength="1024" /></p> | |
103 | - <p class="display_name"><label for="display_name" | |
104 | - title="<?php echo JText::_('ATTACH_DISPLAY_FILENAME_TOOLTIP'); ?>" | |
105 | - ><?php echo JText::_('ATTACH_DISPLAY_FILENAME_OPTIONAL_COLON'); ?></label> | |
106 | - <input type="text" name="display_name" id="display_name" | |
107 | - size="70" maxlength="80" | |
108 | - title="<?php echo JText::_('ATTACH_DISPLAY_FILENAME_TOOLTIP'); ?>" | |
109 | - value="<?php echo $attachment->display_name; ?>" /></p> | |
110 | -<?php else: ?> | |
111 | - <p><label for="<?php echo $upload_id ?>"><?php | |
112 | - echo JText::_('ATTACH_ENTER_URL') ?></label> | |
113 | - | |
114 | - <label for="verify_url"><?php echo JText::_('ATTACH_VERIFY_URL_EXISTENCE') ?></label> | |
115 | - <input type="checkbox" name="verify_url" value="verify" <?php echo $this->verify_url_checked ?> | |
116 | - title="<?php echo JText::_('ATTACH_VERIFY_URL_EXISTENCE_TOOLTIP'); ?>" /> | |
117 | - | |
118 | - <label for="relative_url"><?php echo JText::_('ATTACH_RELATIVE_URL') ?></label> | |
119 | - <input type="checkbox" name="relative_url" value="relative" <?php echo $this->relative_url_checked ?> | |
120 | - title="<?php echo JText::_('ATTACH_RELATIVE_URL_TOOLTIP'); ?>" /> | |
121 | - <a class="changeButton" href="<?php echo $upload_toggle_url ?>"><?php | |
122 | - echo $upload_toggle_button_text;?></a><br /> | |
123 | - <input type="text" name="url" id="<?php echo $upload_id; ?>" | |
124 | - size="80" maxlength="255" title="<?php echo JText::_('ATTACH_ENTER_URL_TOOLTIP'); ?>" | |
125 | - value="<?php echo $attachment->url; ?>" /><br /><?php | |
126 | - echo JText::_('ATTACH_NOTE_ENTER_URL_WITH_HTTP'); ?></p> | |
127 | - <p class="display_name"><label for="display_name" | |
128 | - title="<?php echo JText::_('ATTACH_DISPLAY_URL_TOOLTIP'); ?>" | |
129 | - ><?php echo JText::_('ATTACH_DISPLAY_URL_COLON'); ?></label> | |
130 | - <input type="text" name="display_name" id="display_name" | |
131 | - size="70" maxlength="80" | |
132 | - title="<?php echo JText::_('ATTACH_DISPLAY_URL_TOOLTIP'); ?>" | |
133 | - value="<?php echo $attachment->display_name; ?>" /></p> | |
134 | -<?php endif; ?> | |
135 | - <p><label for="description"><?php echo JText::_('ATTACH_DESCRIPTION_COLON'); ?></label> | |
136 | - <input type="text" name="description" id="description" | |
137 | - size="70" maxlength="255" | |
138 | - value="<?php echo stripslashes($attachment->description); ?>" /></p> | |
79 | +<?php | |
80 | +if ($attachment->uri_type == "file") { | |
81 | +?> | |
82 | + <legend>Carregar e anexar um arquivo (<a href="<?php echo($upload_toggle_url); ?>"><?php echo($upload_toggle_button_text); ?></a>)</legend> | |
83 | + <div class="form-group"> | |
84 | + <input type="file" name="upload" id="<?php echo($upload_id); ?>" class="form-control-file" /> | |
85 | + </div> | |
86 | + <div class="form-group"> | |
87 | + <label for="display_name">Nome de arquivo a ser exibido</label> | |
88 | + <input type="text" name="display_name" id="display_name" class="form-control form-control-sm" maxlength="80" title="Informe um nome de arquivo alternativo a ser exibido ao invéz do nome de arquivo completo" value="<?php echo($attachment->display_name); ?>" /> | |
89 | + </div> | |
90 | +<?php | |
91 | +} else { | |
92 | +?> | |
93 | + <legend>Anexar uma URL (<a href="<?php echo($upload_toggle_url); ?>"><?php echo($upload_toggle_button_text); ?></a>)</legend> | |
94 | + <div class="form-group"> | |
95 | + <label for="<?php echo($upload_id); ?>">Informe o URL do arquivo</label> | |
96 | + <div class="custom-control custom-switch" style="display: inline-block; float: right; margin-left: 1rem" title="Marque esta caixa para informar um URL relativo dentro deste site. Você provavelmente também precisará desmarcar a caixa "Verificar a existência do URL" para adicionar um URL relativo"> | |
97 | + <input class="custom-control-input" type="checkbox" name="relative_url" id="relative_url" value="relative" <?php echo($this->relative_url_checked); ?> /> | |
98 | + <label class="custom-control-label" for="relative_url">URL relativo</label> | |
99 | + </div> | |
100 | + <div class="custom-control custom-switch" style="display: inline-block; float: right" title="Marque esta caixa para verificar se a URL é acessível (apenas para URLs novas ou editadas). Ao manter esta caixa desmarcada o URL ainda será verificado quanto a sua sintaxe"> | |
101 | + <input class="custom-control-input" type="checkbox" name="verify_url" id="verify_url" value="verify" <?php echo($this->verify_url_checked); ?> /> | |
102 | + <label class="custom-control-label" for="verify_url">Verificar a existência do URL</label> | |
103 | + </div> | |
104 | + <input type="text" name="url" id="<?php echo($upload_id); ?>" class="form-control form-control-sm" maxlength="255" title="Digite o URL aqui. O recurso apontado pelo URL não será carregado, apenas o URL propriamente dito será salvo. Atenção: ao informar URLs relativos desmarque o checkbox "Verificar a existência do URL" e selecione "URL Relativo"" value="<?php echo($attachment->url); ?>" placeholder="Informe um url com o prefixo "http", senão o URL será interpretado como relativo" /> | |
105 | + </div> | |
106 | + <div class="form-group"> | |
107 | + <label for="display_name">URL a ser exibido</label> | |
108 | + <input type="text" name="display_name" id="display_name" class="form-control form-control-sm" maxlength="80" title="Informe um URL alternativo a ser exibido ao invéz do URL original" value="<?php echo($attachment->display_name); ?>" /> | |
109 | + </div> | |
110 | +<?php | |
111 | +} | |
112 | +?> | |
113 | + <div class="form-group"> | |
114 | + <label for="description">Descrição</label> | |
115 | + <input type="text" name="description" id="description" class="form-control form-control-sm" maxlength="255" value="<?php echo(stripslashes($attachment->description)); ?>" title="Informe uma descrição curta para este anexo" /> | |
116 | + </div> | |
117 | + | |
118 | + | |
119 | + | |
139 | 120 | <?php if ( $this->may_publish ): ?> |
140 | 121 | <div class="at_control"><label><?php echo JText::_('ATTACH_PUBLISHED'); ?></label><?php echo $this->publish; ?></div> |
141 | 122 | <?php endif; ?> |
123 | + | |
142 | 124 | <?php if ( $params->get('allow_frontend_access_editing', false) ): ?> |
143 | 125 | |
144 | 126 | <div class="at_control"><label for="access" title="<?php echo $this->access_level_tooltip; ?>"><? echo JText::_('ATTACH_ACCESS_COLON'); ?></label> <?php echo $this->access_level; ?></div> |
145 | 127 | <?php endif; ?> |
128 | + | |
146 | 129 | <?php if ( $params->get('user_field_1_name', false) ): ?> |
147 | 130 | <p><label for="user_field_1"><?php echo $params->get('user_field_1_name'); ?>:</label> |
148 | 131 | <input type="text" name="user_field_1" id="user_field_1" size="70" maxlength="100" |
149 | 132 | value="<?php echo stripslashes($attachment->user_field_1); ?>" /></p> |
150 | 133 | <?php endif; ?> |
134 | + | |
151 | 135 | <?php if ( $params->get('user_field_2_name', false) ): ?> |
152 | 136 | <p><label for="user_field_2"><?php echo $params->get('user_field_2_name'); ?>:</label> |
153 | 137 | <input type="text" name="user_field_2" id="user_field_2" size="70" maxlength="100" |
154 | 138 | value="<?php echo stripslashes($attachment->user_field_2); ?>" /></p> |
155 | 139 | <?php endif; ?> |
140 | + | |
156 | 141 | <?php if ( $params->get('user_field_3_name', false) ): ?> |
157 | 142 | <p><label for="user_field_3"><?php echo $params->get('user_field_3_name'); ?>:</label> |
158 | 143 | <input type="text" name="user_field_3" id="user_field_3" size="70" maxlength="100" |
@@ -202,11 +187,8 @@ | ||
202 | 187 | $controller->displayString($parent_id, $attachment->parent_type, $attachment->parent_entity, |
203 | 188 | 'ATTACH_EXISTING_ATTACHMENTS', |
204 | 189 | false, false, true, $this->from); |
205 | - } | |
190 | +} | |
206 | 191 | |
207 | -if ($this->error) { | |
208 | - //echo($this->endHTML()); | |
209 | -} | |
210 | 192 | /* |
211 | 193 | Limpa todos os estilos existentes no array de estilos do documento. Isso faz com |
212 | 194 | que possamos adicionar apenas nossos próprios estilos usando métodos do próprio |
@@ -297,21 +279,4 @@ | ||
297 | 279 | /* ]]> */ |
298 | 280 | EOS; |
299 | 281 | |
300 | -$zostHelpers->doc->addScriptDeclaration($scriptDeclaration); | |
301 | - | |
302 | -if ($this->error) { | |
303 | -// $this->document = &$zostHelpers->doc; | |
304 | -} | |
305 | - | |
306 | -/* | |
307 | - | |
308 | -this = AttachmentsViewUpload | |
309 | - | |
310 | - $document = JFactory::getDocument(); | |
311 | - $this->assignRef('document', $document); | |
312 | - | |
313 | - $app = JFactory::getApplication(); | |
314 | - $this->template = $app->getTemplate(true)->template; | |
315 | - $template_dir = $this->baseurl.'/templates/'.$this->template; | |
316 | - | |
317 | -*/ | |
282 | +$zostHelpers->doc->addScriptDeclaration($scriptDeclaration); | |
\ No newline at end of file |