internal links in procedure
This commit is contained in:
@@ -1159,7 +1159,7 @@ class Databap extends PhpObject
|
||||
$asTable['title'] = self::getTableFormat($asTable['title']);
|
||||
$asTable['description'] = self::getDescriptionFormat($asTable['description']);
|
||||
$asTable['led'] = self::getDateFormat($asTable['led']);
|
||||
$asTable['formatted_keywords'] = str_replace("\n", '<br />', ToolBox::findReplaceLinks($asTable['keywords']));
|
||||
$asTable['formated_keywords'] = ToolBox::formatText($asTable['keywords']);
|
||||
}
|
||||
}
|
||||
return $asTable;
|
||||
@@ -2621,7 +2621,7 @@ class Databap extends PhpObject
|
||||
|
||||
public static function getDescriptionFormat($sDescription)
|
||||
{
|
||||
return ToolBox::mb_ucfirst($sDescription);
|
||||
return ToolBox::mb_ucfirst(ToolBox::findReplaceLinks($sDescription));
|
||||
}
|
||||
|
||||
public static function getTableFormat($sTable)
|
||||
|
||||
@@ -229,27 +229,18 @@ class Procedure extends PhpObject
|
||||
|
||||
public function getProcedure()
|
||||
{
|
||||
// [id_step]=>text
|
||||
// [id_step][id_image]=>array('name'=>file name, 'desc'=> description)
|
||||
/*
|
||||
$asSteps = $asImages = array();
|
||||
$iLocalStepId = 1;
|
||||
foreach($this->asSteps as $iStepId=>$sStepDesc)
|
||||
foreach($this->asSteps as $iStepId=>$asStep)
|
||||
{
|
||||
$asSteps[$iLocalStepId] = $sStepDesc;
|
||||
if(array_key_exists($iStepId, $this->asImages))
|
||||
{
|
||||
$asImages[] =
|
||||
$this->asSteps[$iStepId]['formated_description'] = ToolBox::formatText($asStep['description']);
|
||||
}
|
||||
$iLocalStepId++;
|
||||
}*/
|
||||
|
||||
return array( 'proc_id'=>$this->iProcId,
|
||||
'id_user'=>$this->iUserId,
|
||||
'title'=>Databap::getDescriptionFormat($this->sTitle),
|
||||
'description'=>Databap::getDescriptionFormat($this->sDescription),
|
||||
'led'=>Databap::getDateFormat($this->dLed),
|
||||
'steps'=>$this->asSteps,
|
||||
'images'=>$this->asImages);
|
||||
'id_user'=>$this->iUserId,
|
||||
'title'=>Databap::getDescriptionFormat($this->sTitle),
|
||||
'description'=>Databap::getDescriptionFormat($this->sDescription),
|
||||
'led'=>Databap::getDateFormat($this->dLed),
|
||||
'steps'=>$this->asSteps,
|
||||
'images'=>$this->asImages);
|
||||
}
|
||||
|
||||
private function refreshProcId()
|
||||
|
||||
@@ -265,6 +265,11 @@ class ToolBox
|
||||
setcookie($sCookieName, $sCookieValue, $iTimeLimit);
|
||||
}
|
||||
|
||||
public static function formatText($sText)
|
||||
{
|
||||
return str_replace("\n", '<br />', self::findReplaceLinks($sText));
|
||||
}
|
||||
|
||||
//TODO implement link pattern
|
||||
public static function findReplaceLinks($sText, $sLinkPattern='')
|
||||
{
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="titles_read" class="step_box round hide">
|
||||
<p class="read_title"><span id="titles_read_title"></span></p>
|
||||
<p class="read_title"><span id="title_read" class="read"></span></p>
|
||||
<p class="read_details">Créé par <span id="titles_read_user"></span> (<span id="titles_read_company"></span>) le <span id="titles_read_led"></span></p>
|
||||
<p class="read_description"><span id="titles_read_description"></span></p>
|
||||
<p class="read_description"><span id="description_read" class="read"></span></p>
|
||||
</div>
|
||||
<div id="procedure_steps"></div>
|
||||
<div class="proc_menu" id="bottom_menu">
|
||||
@@ -45,7 +45,10 @@
|
||||
<td colspan="2" class="step_nb_box">Étape <span id="step_nb"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="step_margin"><textarea id="step_text" name="step_text" class="round"></textarea></td>
|
||||
<td class="step_margin">
|
||||
<textarea id="step_text" name="step_text" class="round"></textarea>
|
||||
<div id="step_text_read" class="read textarea round"></div>
|
||||
</td>
|
||||
<td class="image_box_container">
|
||||
<div id="step_images"></div>
|
||||
<div id="step_images_thumbs"></div>
|
||||
@@ -148,18 +151,14 @@ function resizeDescription()
|
||||
|
||||
function setDisplay(sNewMode)
|
||||
{
|
||||
//On page first load
|
||||
var sOldMode = databap.vars.mode;
|
||||
if(!sOldMode || sOldMode=='')
|
||||
{
|
||||
sOldMode = (sNewMode=='read')?'edit':'read';
|
||||
}
|
||||
sNewMode = sNewMode || '';
|
||||
|
||||
//On page first load
|
||||
if(sOldMode=='') sOldMode = (sNewMode=='read')?'edit':'read';
|
||||
|
||||
//default behaviour : switch to alternative display
|
||||
if(!sNewMode)
|
||||
{
|
||||
sNewMode = (sOldMode=='read')?'edit':'read';
|
||||
}
|
||||
if(!sNewMode) sNewMode = (sOldMode=='read')?'edit':'read';
|
||||
|
||||
//Set new Display
|
||||
if(sNewMode!=sOldMode)
|
||||
@@ -167,14 +166,11 @@ function setDisplay(sNewMode)
|
||||
var sDisabled;
|
||||
|
||||
//Set read mode data
|
||||
if(sNewMode=='read')
|
||||
{
|
||||
syncReadModeData();
|
||||
}
|
||||
if(sNewMode=='read' && databap.vars.mode!='') syncReadModeData();
|
||||
|
||||
//Hide / show boxes
|
||||
var $EditBoxes = databap.getMainElem('.uploader_box, .step_buttons, #add_step, #submit_procedure, #titles_edit');
|
||||
var $ReadBoxes = databap.getMainElem('#share, #titles_read');
|
||||
var $EditBoxes = databap.getMainElem('.uploader_box, .step_buttons, #add_step, #submit_procedure, #titles_edit, textarea[id$="step_text"]');
|
||||
var $ReadBoxes = databap.getMainElem('#share, #titles_read, div[id$="step_text_read"]');
|
||||
|
||||
switch(sNewMode)
|
||||
{
|
||||
@@ -210,13 +206,14 @@ function setDisplay(sNewMode)
|
||||
|
||||
function syncReadModeData()
|
||||
{
|
||||
//Title & description
|
||||
var $EditBox = databap.getMainElem('#titles_edit');
|
||||
var $ReadBox = databap.getMainElem('#titles_read');
|
||||
$ReadBox.find('#titles_read_title').text($EditBox.find('#title').val());
|
||||
$ReadBox.find('#titles_read_description').text($EditBox.find('#description').val());
|
||||
|
||||
//Steps
|
||||
$('.read').each(function()
|
||||
{
|
||||
$This = $(this);
|
||||
var sEditValue = $('#'+$This.attr('id').substr(0, $This.attr('id').length - '_read'.length)).val();
|
||||
var sReadValue = sEditValue.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
||||
$This.html(sReadValue);
|
||||
});
|
||||
databap.feedback('warning', 'Le formattage du texte reviendra lors de la validation');
|
||||
}
|
||||
|
||||
function setThumbnails(bShow)
|
||||
@@ -288,7 +285,7 @@ function getImageUrl(sImageName, bThumbnail)
|
||||
return sImageUrl;
|
||||
}
|
||||
|
||||
function addStep(stepId, sPosition, sDesc)
|
||||
function addStep(stepId, sPosition, sDesc, sFormatedDesc)
|
||||
{
|
||||
//Set Step Count
|
||||
iCurrentStep = '0';
|
||||
@@ -298,6 +295,7 @@ function addStep(stepId, sPosition, sDesc)
|
||||
|
||||
//Add Step text
|
||||
if(sDesc) $step.find('#step_text').val(sDesc);
|
||||
if(sFormatedDesc) $step.find('#step_text_read').html(sFormatedDesc);
|
||||
|
||||
//Insert new step before this step
|
||||
$step.find('#insert_step_before').click
|
||||
@@ -449,7 +447,6 @@ function saveProcedure()
|
||||
|
||||
databap.addSuccessBefore('La procédure est enregistrée', '#bottom_menu');
|
||||
databap.addSuccessIcon();
|
||||
//setDisplay('read');
|
||||
|
||||
//Unblock exit & go
|
||||
databap.tmp('started', false);
|
||||
@@ -507,7 +504,7 @@ function loadProcedure(iProcId, fOnSuccess)
|
||||
proc_info.steps,
|
||||
function(iStepId, sStepDesc)
|
||||
{
|
||||
iDisplayedStepId = addStep(false, false, sStepDesc.description);
|
||||
iDisplayedStepId = addStep(false, false, sStepDesc.description, sStepDesc.formated_description);
|
||||
|
||||
//Image
|
||||
if(iStepId in proc_info.images)
|
||||
@@ -544,10 +541,15 @@ function loadProcedure(iProcId, fOnSuccess)
|
||||
);
|
||||
}
|
||||
|
||||
//TODO delete this silly function and rethink the whole thing
|
||||
function addExtraReadElements(data)
|
||||
{
|
||||
debug(data);
|
||||
|
||||
//Add extra read-mode data
|
||||
$ReadTitles = databap.getMainElem('#titles_read');
|
||||
$ReadTitles.find('#title_read').text(data.title);
|
||||
$ReadTitles.find('#description_read').text(data.description);
|
||||
$ReadTitles.find('#titles_read_user').text(data.name);
|
||||
$ReadTitles.find('#titles_read_company').text(data.company);
|
||||
$ReadTitles.find('#titles_read_led').text(data.led);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div id="table_main" class="step_box form_success round">
|
||||
<p class="step_box_title"><!-- <a href="http://fr.wikipedia.org/wiki/Le_Monde_de_monsieur_Fred" target="_blank"> --><span title="Helmut Perchut">"J'ai explication !"</span><!-- </a> --></p>
|
||||
<textarea name="keywords" id="keywords" class="edit inc_border round"></textarea>
|
||||
<p class="read" id="read_formatted_keywords"></p>
|
||||
<p class="read" id="read_formated_keywords"></p>
|
||||
</div>
|
||||
<div id="validation" class="form_success"></div>
|
||||
</form>
|
||||
|
||||
5209
style/screen.css
5209
style/screen.css
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user