aboutsummaryrefslogtreecommitdiff
path: root/h-source
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-05-19 22:10:52 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-05-19 22:10:52 +0000
commit759f536ae8a94ec5cce173fd00855aa39f0dbf3a (patch)
tree47757058638952d70185bbc5c0dcd153ed0212f8 /h-source
parentc91e85da877b40c1857c0d900dff11257c3e436f (diff)
h-source:added preview button for the description entry and for the wiki pages
Diffstat (limited to 'h-source')
-rw-r--r--h-source/Application/Controllers/GenericController.php23
-rw-r--r--h-source/Application/Controllers/WikiController.php25
-rw-r--r--h-source/Application/Include/languages.php2
-rw-r--r--h-source/Application/Views/Notebooks/form.php11
-rw-r--r--h-source/Application/Views/Wiki/form.php9
-rw-r--r--h-source/Application/Views/form.php13
-rw-r--r--h-source/Public/Css/main.css23
7 files changed, 90 insertions, 16 deletions
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php
index 31271b9..9cbaeee 100644
--- a/h-source/Application/Controllers/GenericController.php
+++ b/h-source/Application/Controllers/GenericController.php
@@ -63,6 +63,8 @@ class GenericController extends BaseController
$this->shift(2);
$clean['token'] = sanitizeAlphanum($token);
+
+ $data['descriptionPreview'] = null; //contains the HTML of the preview of the description entry
$data['notice'] = null;
$data['submission_response'] = 'error';
@@ -114,7 +116,9 @@ class GenericController extends BaseController
}
}
}
-
+
+ $data['descriptionPreview'] = $this->getPreview();
+
$data['notice'] = $this->m['HardwareModel']->notice;
$data['submitName'] = "insertAction";
@@ -143,7 +147,7 @@ class GenericController extends BaseController
$this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/catalogue/".$this->lang,0);
}
}
-
+
public function del($lang = 'en', $token = '')
{
header('Content-type: text/html; charset=UTF-8');
@@ -210,6 +214,8 @@ class GenericController extends BaseController
$this->shift(2);
$clean['token'] = sanitizeAlphanum($token);
+
+ $data['descriptionPreview'] = null; //contains the HTML of the preview of the description entry
$data['notice'] = null;
$data['submission_response'] = 'error';
@@ -264,6 +270,8 @@ class GenericController extends BaseController
}
}
}
+
+ $data['descriptionPreview'] = $this->getPreview();
$data['notice'] = $this->m['HardwareModel']->notice;
@@ -306,6 +314,17 @@ class GenericController extends BaseController
}
}
+ //get the preview of the description entry
+ protected function getPreview()
+ {
+ if (isset($_POST['previewAction']))
+ {
+ $this->m['HardwareModel']->result = false;
+ return $this->request->post('description','','sanitizeHtml');
+ }
+ return null;
+ }
+
protected function checkVendorId($interface)
{
if (strcmp($this->m['HardwareModel']->type,'notebook') === 0) return true;
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php
index 0e05ffd..9815055 100644
--- a/h-source/Application/Controllers/WikiController.php
+++ b/h-source/Application/Controllers/WikiController.php
@@ -40,6 +40,8 @@ class WikiController extends BaseController
public function insert($lang = 'en')
{
$this->shift(1);
+
+ $data['pagePreview'] = null;
$data['title'] = 'insert a wiki page - '.Website::$generalName;
@@ -64,6 +66,8 @@ class WikiController extends BaseController
die();
}
}
+
+ $data['pagePreview'] = $this->getPreview();
$data['notice'] = $this->m['WikiModel']->notice;
@@ -87,6 +91,8 @@ class WikiController extends BaseController
{
$this->shift(1);
+ $data['pagePreview'] = null;
+
$data['title'] = 'update a wiki page - '.Website::$generalName;
$this->m['WikiModel']->setFields('title,page','sanitizeAll');
@@ -125,6 +131,8 @@ class WikiController extends BaseController
}
}
+ $data['pagePreview'] = $this->getPreview();
+
$data['notice'] = $this->m['WikiModel']->notice;
$data['id_wiki'] = $clean['id_wiki'];
@@ -151,13 +159,16 @@ class WikiController extends BaseController
}
}
-// protected function viewRedirect($titleClean)
-// {
-// if ($this->m['WikiModel']->queryResult)
-// {
-// $this->redirect($this->controller.'/page/'.$this->lang.'/'.$titleClean);
-// }
-// }
+ //get the preview of the description entry
+ protected function getPreview()
+ {
+ if (isset($_POST['previewAction']))
+ {
+ $this->m['WikiModel']->result = false;
+ return $this->request->post('page','','sanitizeHtml');
+ }
+ return null;
+ }
public function page($lang = 'en', $title_clean = null)
{
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php
index afd5c27..710032c 100644
--- a/h-source/Application/Include/languages.php
+++ b/h-source/Application/Include/languages.php
@@ -226,6 +226,8 @@ class Lang
"Write here the model name obtained by the lspci or lsusb command." => "Scrivi qui il nome del modello ottenuto dal comando lspci o dal comando lsusb.",
"This is the name of the chipset of your device." => "Questo รจ il nome del chipset del tuo dispositivo.",
"possible other names of the device" => "eventuali altri nomi del dispositivo",
+ "Description entry preview" => "Anteprima del campo descrizione",
+ "Page preview" => "Anteprima della pagina",
),
'es' => array
(
diff --git a/h-source/Application/Views/Notebooks/form.php b/h-source/Application/Views/Notebooks/form.php
index d4e871b..a331539 100644
--- a/h-source/Application/Views/Notebooks/form.php
+++ b/h-source/Application/Views/Notebooks/form.php
@@ -120,11 +120,20 @@
<div class="form_entry">
<div class="entry_label"><?php echo gtext("Description: (write here all the useful information)");?><br /><a href="<?php echo $this->baseUrl."/help/index/$lang#wiki-syntax";?>"><?php echo gtext("discover all the wiki tags");?></a></div>
+
+ <?php if (isset($descriptionPreview)) { ?>
+ <div class="description_preview_title"><?php echo gtext("Description entry preview");?>:</div>
+ <div class="description_preview">
+ <?php echo decodeWikiText($descriptionPreview); ?>
+ </div>
+ <?php } ?>
+
<?php echo Html_Form::textarea('description',$values['description'],'textarea_entry','bb_code');?>
</div>
<?php echo $hiddenInput;?>
-
+
+ <input type="submit" name="previewAction" value="Preview">
<input type="submit" name="<?php echo $submitName;?>" value="Save">
<div class="mandatory_fields_notice">
diff --git a/h-source/Application/Views/Wiki/form.php b/h-source/Application/Views/Wiki/form.php
index 5949cf0..12d84d1 100644
--- a/h-source/Application/Views/Wiki/form.php
+++ b/h-source/Application/Views/Wiki/form.php
@@ -82,11 +82,20 @@
<div class="form_entry">
<div class="entry_label"><?php echo gtext("the text of the wiki page");?>:<br /><a href="<?php echo $this->baseUrl."/help/index/$lang#wiki-syntax";?>"><?php echo gtext("discover all the wiki tags");?></a></div>
+
+ <?php if (isset($pagePreview)) { ?>
+ <div class="description_preview_title"><?php echo gtext("Page preview");?>:</div>
+ <div class="description_preview">
+ <?php echo decodeWikiText($pagePreview); ?>
+ </div>
+ <?php } ?>
+
<?php echo Html_Form::textarea('page',$values['page'],'textarea_entry','bb_code');?>
</div>
<?php echo $hiddenInput;?>
+ <input type="submit" name="previewAction" value="Preview">
<input type="submit" name="<?php echo $submitName;?>" value="Save">
</div>
diff --git a/h-source/Application/Views/form.php b/h-source/Application/Views/form.php
index a5c3dd5..f7d61eb 100644
--- a/h-source/Application/Views/form.php
+++ b/h-source/Application/Views/form.php
@@ -117,18 +117,27 @@
<div class="entry_label hidden_x_explorer"><?php echo gtext("free driver used");?> (<?php echo gtext("see the help page or leave blank if you are not sure");?>):</div>
<?php echo Html_Form::input('driver',$values['driver'],'input_entry');?>
</div>
-
+
<div class="form_entry">
<div class="entry_label"><?php echo gtext("Description: (write here all the useful information)");?><br /><a href="<?php echo $this->baseUrl."/help/index/$lang#wiki-syntax";?>"><?php echo gtext("discover all the wiki tags");?></a></div>
<?php if (strcmp($this->controller,'threegcards') === 0 ) { ?>
<!--if it is a 3G-card-->
<div class="isp_notice"><?php echo gtext("Please specify in the below description entry the Internet Service Provider (ISP) and the country where the service is provided");?></div>
<?php } ?>
+
+ <?php if (isset($descriptionPreview)) { ?>
+ <div class="description_preview_title"><?php echo gtext("Description entry preview");?>:</div>
+ <div class="description_preview">
+ <?php echo decodeWikiText($descriptionPreview); ?>
+ </div>
+ <?php } ?>
+
<?php echo Html_Form::textarea('description',$values['description'],'textarea_entry','bb_code');?>
</div>
<?php echo $hiddenInput;?>
-
+
+ <input type="submit" name="previewAction" value="Preview">
<input type="submit" name="<?php echo $submitName;?>" value="Save">
<div class="mandatory_fields_notice">
diff --git a/h-source/Public/Css/main.css b/h-source/Public/Css/main.css
index 20c2f20..da2c7b5 100644
--- a/h-source/Public/Css/main.css
+++ b/h-source/Public/Css/main.css
@@ -1311,9 +1311,23 @@ ins
}
.issues_message_item_preview
{
- background:#fffdc2;
- border-top:1px dashed #f9a92b;
- border-bottom:1px dashed #f9a92b;
+ margin:5px 0px 20px 0px;
+ background:#FFF;
+ border:1px dashed #f9a92b;
+}
+.description_preview
+{
+ padding:10px;
+ margin:0px 0px;
+ border:2px dashed #f9a92b;
+}
+.description_preview_title
+{
+ padding:5px 0px;
+ margin:0px 0px;
+ font-style:italic;
+ color:#f9a92b;
+ font-weight:bold;
}
.talk_message_item_hidden
{
@@ -1331,8 +1345,9 @@ ins
}
.message_preview_notice
{
+ color:#f9a92b;
margin:3px 3px;
- font:bold 14px/1 sans-serif,arial;
+ font:italic 14px/1 sans-serif,arial;
}
.useful_links_ext div
{